From f431547fe69b23f08a1492181758d763970f8859 Mon Sep 17 00:00:00 2001 From: nk46-cloud Date: Thu, 26 Feb 2026 03:27:37 -0600 Subject: [PATCH 1/2] feat: fix empty space in react apps --- .gitignore | 3 + examples/react-app/index.html | 11 + examples/react-app/main.tsx | 3335 +++++++++++++++++++++++++++++ examples/react-app/vite.config.ts | 61 + examples/react/index.html | 2319 ++++++++++++++++++-- package-lock.json | 24 +- package.json | 6 +- scripts/build-site.js | 6 + tsconfig.json | 2 +- typedoc.json | 4 +- 10 files changed, 5582 insertions(+), 189 deletions(-) create mode 100644 examples/react-app/index.html create mode 100644 examples/react-app/main.tsx create mode 100644 examples/react-app/vite.config.ts diff --git a/.gitignore b/.gitignore index 0b3944b9..b97ef1d6 100644 --- a/.gitignore +++ b/.gitignore @@ -185,3 +185,6 @@ _site/ # Test React app (local verification only) test-react-app/ + +# Built React example (generated by build:react-example) +examples/react/ diff --git a/examples/react-app/index.html b/examples/react-app/index.html new file mode 100644 index 00000000..613e7c99 --- /dev/null +++ b/examples/react-app/index.html @@ -0,0 +1,11 @@ + + + + + MAIDR React Examples + + +
+ + + diff --git a/examples/react-app/main.tsx b/examples/react-app/main.tsx new file mode 100644 index 00000000..d60f6f08 --- /dev/null +++ b/examples/react-app/main.tsx @@ -0,0 +1,3335 @@ +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import { Maidr, TraceType } from 'maidr/react'; +import type { MaidrData } from 'maidr/react'; + +const barData: MaidrData = { + id: 'bar', + title: 'The Number of Tips by Day', + subplots: [ + [ + { + layers: [ + { + id: '0', + type: TraceType.BAR, + selectors: 'path[clip-path="url(#p0f12ed050e)"]', + axes: { + x: 'Day', + y: 'Count', + format: { + x: { + function: + "const days = {Sun: 'Sunday', Mon: 'Monday', Tue: 'Tuesday', Wed: 'Wednesday', Thur: 'Thursday', Fri: 'Friday', Sat: 'Saturday'}; return days[value] || value", + }, + y: { type: 'fixed', decimals: 1 }, + }, + }, + data: [ + { x: 'Sat', y: 87 }, + { x: 'Sun', y: 76 }, + { x: 'Thur', y: 62 }, + { x: 'Fri', y: 19 }, + ], + }, + ], + }, + ], + ], +}; + +const barSvgInnerHTML = ` + + + + 2024-01-18T11:51:31.025970 + image/svg+xml + + + Matplotlib v3.8.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `; + +const lineData: MaidrData = { + id: '151f3961-0445-4713-94f4-e2059c74c53a', + subplots: [ + [ + { + id: 'd54fac17-e805-4ade-8b78-f110c534984c', + layers: [ + { + id: 'c4ac3f68-6266-4f35-8125-33d8cdff1e9a', + type: TraceType.LINE, + title: + 'Line: Total Passengers per Year\nFrom the Flights Dataset', + axes: { + x: 'Year', + y: 'Total Passengers (Thousands)', + }, + data: [ + [ + { x: 1949.0, y: 1520.0 }, + { x: 1950.0, y: 1676.0 }, + { x: 1951.0, y: 2042.0 }, + { x: 1952.0, y: 2364.0 }, + { x: 1953.0, y: 2700.0 }, + { x: 1954.0, y: 2867.0 }, + { x: 1955.0, y: 3408.0 }, + { x: 1956.0, y: 3939.0 }, + { x: 1957.0, y: 4421.0 }, + { x: 1958.0, y: 4572.0 }, + { x: 1959.0, y: 5140.0 }, + { x: 1960.0, y: 5714.0 }, + ], + ], + selectors: [ + "g[id='maidr-bc200021-0bee-4a65-b89e-5bc56843df54'] path", + ], + }, + ], + }, + ], + ], +}; + +const lineSvgInnerHTML = ` + + + + 2025-09-28T20:47:59.778672 + image/svg+xml + + + Matplotlib v3.9.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `; + +const smoothData: MaidrData = { + "id": "a6b8ffb5-9a9d-44be-9151-439a5373e405", + "subplots": [ + [ + { + "id": "599348d6-602e-4fde-a4ca-504d759db44a", + "layers": [ + { + "id": "c8cdf051-8c1b-4427-9589-39677dd422e3", + "type": TraceType.SMOOTH, + "title": "KDE: Plot of Random Data", + "axes": { + "x": "Value", + "y": "Density" + }, + "data": [ + [ + { + "x": -4.090659720653128, + "y": 0.00003130990414432069, + "svg_x": 70.71000000000001, + "svg_y": 390.01265590666407 + }, + { + "x": -4.046474878482817, + "y": 0.00004940157954895194, + "svg_x": 72.38738693467339, + "svg_y": 389.9968557796951 + }, + { + "x": -4.002290036312505, + "y": 0.00007607327310168, + "svg_x": 74.06477386934678, + "svg_y": 389.9735624066279 + }, + { + "x": -3.9581051941421945, + "y": 0.00011432974593037363, + "svg_x": 75.74216080402013, + "svg_y": 389.94015161881754 + }, + { + "x": -3.9139203519718837, + "y": 0.00016769783590326188, + "svg_x": 77.41954773869348, + "svg_y": 389.89354329875846 + }, + { + "x": -3.8697355098015724, + "y": 0.00024007344105625092, + "svg_x": 79.09693467336685, + "svg_y": 389.8303350150977 + }, + { + "x": -3.825550667631261, + "y": 0.0003354436629372707, + "svg_x": 80.77432160804022, + "svg_y": 389.74704468509356 + }, + { + "x": -3.7813658254609503, + "y": 0.0004574762153518218, + "svg_x": 82.45170854271358, + "svg_y": 389.64046915909194 + }, + { + "x": -3.737180983290639, + "y": 0.0006089919549181578, + "svg_x": 84.12909547738695, + "svg_y": 389.5081448790347 + }, + { + "x": -3.6929961411203283, + "y": 0.0007913668341964648, + "svg_x": 85.80648241206032, + "svg_y": 389.34887017483504 + }, + { + "x": -3.648811298950017, + "y": 0.001003941753084901, + "svg_x": 87.4838693467337, + "svg_y": 389.1632206629054 + }, + { + "x": -3.604626456779706, + "y": 0.0012435452535690175, + "svg_x": 89.16125628140705, + "svg_y": 388.95396609442633 + }, + { + "x": -3.560441614609395, + "y": 0.0015042461494080136, + "svg_x": 90.83864321608043, + "svg_y": 388.7262863929583 + }, + { + "x": -3.5162567724390836, + "y": 0.0017774433516954526, + "svg_x": 92.5160301507538, + "svg_y": 388.4876932064695 + }, + { + "x": -3.472071930268773, + "y": 0.002052364207035492, + "svg_x": 94.19341708542716, + "svg_y": 388.2475946902381 + }, + { + "x": -3.4278870880984615, + "y": 0.002316982220368148, + "svg_x": 95.87080402010052, + "svg_y": 388.0164940256824 + }, + { + "x": -3.3837022459281507, + "y": 0.002559288528300005, + "svg_x": 97.5481909547739, + "svg_y": 387.8048789958368 + }, + { + "x": -3.3395174037578395, + "y": 0.002768773463206442, + "svg_x": 99.22557788944727, + "svg_y": 387.6219280808119 + }, + { + "x": -3.2953325615875286, + "y": 0.002937912950730226, + "svg_x": 100.90296482412062, + "svg_y": 387.4742123320726 + }, + { + "x": -3.2511477194172174, + "y": 0.0030634264478196717, + "svg_x": 102.580351758794, + "svg_y": 387.36459676878286 + }, + { + "x": -3.206962877246906, + "y": 0.003147090269864315, + "svg_x": 104.25773869346736, + "svg_y": 387.2915300692401 + }, + { + "x": -3.1627780350765953, + "y": 0.003195954713735132, + "svg_x": 105.93512562814071, + "svg_y": 387.2488549493211 + }, + { + "x": -3.118593192906284, + "y": 0.003221916448122887, + "svg_x": 107.61251256281409, + "svg_y": 387.226181609761 + }, + { + "x": -3.0744083507359727, + "y": 0.0032407201625036775, + "svg_x": 109.28989949748747, + "svg_y": 387.2097596329092 + }, + { + "x": -3.030223508565662, + "y": 0.0032705799740616803, + "svg_x": 110.96728643216083, + "svg_y": 387.1836819588776 + }, + { + "x": -2.986038666395351, + "y": 0.003330695294811018, + "svg_x": 112.6446733668342, + "svg_y": 387.1311810334864 + }, + { + "x": -2.94185382422504, + "y": 0.003439966724407699, + "svg_x": 114.32206030150756, + "svg_y": 387.03575026640186 + }, + { + "x": -2.8976689820547286, + "y": 0.003616184369685506, + "svg_x": 115.99944723618094, + "svg_y": 386.8818529016033 + }, + { + "x": -2.8534841398844177, + "y": 0.0038758663520965255, + "svg_x": 117.67683417085428, + "svg_y": 386.6550630547879 + }, + { + "x": -2.8092992977141065, + "y": 0.004234785019886466, + "svg_x": 119.35422110552767, + "svg_y": 386.3416061528822 + }, + { + "x": -2.765114455543795, + "y": 0.004709059027274733, + "svg_x": 121.03160804020102, + "svg_y": 385.92740518104165 + }, + { + "x": -2.7209296133734844, + "y": 0.005316543236077628, + "svg_x": 122.70899497487441, + "svg_y": 385.39686683033267 + }, + { + "x": -2.6767447712031736, + "y": 0.006078147298138619, + "svg_x": 124.38638190954775, + "svg_y": 384.7317299310948 + }, + { + "x": -2.6325599290328623, + "y": 0.007018683279955856, + "svg_x": 126.06376884422113, + "svg_y": 383.9103251911113 + }, + { + "x": -2.588375086862551, + "y": 0.00816689653076014, + "svg_x": 127.7411557788945, + "svg_y": 382.9075482373789 + }, + { + "x": -2.54419024469224, + "y": 0.00955447058922441, + "svg_x": 129.41854271356786, + "svg_y": 381.69572866775593 + }, + { + "x": -2.500005402521929, + "y": 0.011213998114074414, + "svg_x": 131.09592964824122, + "svg_y": 380.2464021120498 + }, + { + "x": -2.4558205603516177, + "y": 0.013176142299326211, + "svg_x": 132.7733165829146, + "svg_y": 378.5327892727166 + }, + { + "x": -2.411635718181307, + "y": 0.015466432767102797, + "svg_x": 134.45070351758795, + "svg_y": 376.53259418976427 + }, + { + "x": -2.367450876010996, + "y": 0.018102298264606652, + "svg_x": 136.12809045226132, + "svg_y": 374.23059569585735 + }, + { + "x": -2.3232660338406848, + "y": 0.021090992314206837, + "svg_x": 137.8054773869347, + "svg_y": 371.6204590225546 + }, + { + "x": -2.2790811916703735, + "y": 0.024428988799018718, + "svg_x": 139.48286432160808, + "svg_y": 368.7052636576999 + }, + { + "x": -2.2348963495000627, + "y": 0.02810320766963468, + "svg_x": 141.16025125628144, + "svg_y": 365.49643289055643 + }, + { + "x": -2.1907115073297514, + "y": 0.03209410150887552, + "svg_x": 142.8376381909548, + "svg_y": 362.01103820104174 + }, + { + "x": -2.14652666515944, + "y": 0.03638024637711627, + "svg_x": 144.51502512562817, + "svg_y": 358.2677899052919 + }, + { + "x": -2.1023418229891293, + "y": 0.04094371272125957, + "svg_x": 146.1924120603015, + "svg_y": 354.2823465428893 + }, + { + "x": -2.058156980818818, + "y": 0.045775230098893754, + "svg_x": 147.8697989949749, + "svg_y": 350.06280433288975 + }, + { + "x": -2.013972138648507, + "y": 0.05087807783074991, + "svg_x": 149.54718592964826, + "svg_y": 345.60629932362684 + }, + { + "x": -1.969787296478196, + "y": 0.05626977565145946, + "svg_x": 151.22457286432166, + "svg_y": 340.89753088508985 + }, + { + "x": -1.9256024543078851, + "y": 0.06198100985542495, + "svg_x": 152.901959798995, + "svg_y": 335.909699545316 + }, + { + "x": -1.8814176121375739, + "y": 0.06805175414252536, + "svg_x": 154.57934673366836, + "svg_y": 330.6078947988169 + }, + { + "x": -1.837232769967263, + "y": 0.07452512761687477, + "svg_x": 156.2567336683417, + "svg_y": 324.9544591426496 + }, + { + "x": -1.7930479277969518, + "y": 0.08144004739823013, + "svg_x": 157.9341206030151, + "svg_y": 318.9154048216907 + }, + { + "x": -1.7488630856266405, + "y": 0.08882405659950532, + "svg_x": 159.61150753768845, + "svg_y": 312.46667742022527 + }, + { + "x": -1.7046782434563297, + "y": 0.09668775184442237, + "svg_x": 161.28889447236185, + "svg_y": 305.5990225161777 + }, + { + "x": -1.6604934012860184, + "y": 0.10502196952360994, + "svg_x": 162.9662814070352, + "svg_y": 298.320443027372 + }, + { + "x": -1.6163085591157076, + "y": 0.11379835840206126, + "svg_x": 164.64366834170855, + "svg_y": 290.65569913233304 + }, + { + "x": -1.5721237169453963, + "y": 0.12297327358409418, + "svg_x": 166.32105527638194, + "svg_y": 282.6429075271602 + }, + { + "x": -1.527938874775085, + "y": 0.13249421999549524, + "svg_x": 167.9984422110553, + "svg_y": 274.3279140950715 + }, + { + "x": -1.4837540326047742, + "y": 0.14230750717421917, + "svg_x": 169.67582914572867, + "svg_y": 265.75760869553903 + }, + { + "x": -1.439569190434463, + "y": 0.15236547832193598, + "svg_x": 171.35321608040204, + "svg_y": 256.97361176711854 + }, + { + "x": -1.3953843482641521, + "y": 0.1626317155316665, + "svg_x": 173.03060301507543, + "svg_y": 248.00772841029658 + }, + { + "x": -1.3511995060938409, + "y": 0.17308299772117272, + "svg_x": 174.70798994974876, + "svg_y": 238.8802384520938 + }, + { + "x": -1.30701466392353, + "y": 0.18370742466476686, + "svg_x": 176.38537688442213, + "svg_y": 229.60153479823182 + }, + { + "x": -1.2628298217532188, + "y": 0.19449889202295975, + "svg_x": 178.0627638190955, + "svg_y": 220.17694859338522 + }, + { + "x": -1.2186449795829075, + "y": 0.2054488548588255, + "svg_x": 179.7401507537689, + "svg_y": 210.61394244592802 + }, + { + "x": -1.1744601374125967, + "y": 0.2165369037626608, + "svg_x": 181.41753768844222, + "svg_y": 200.9303406456211 + }, + { + "x": -1.1302752952422854, + "y": 0.22772198721362596, + "svg_x": 183.09492462311562, + "svg_y": 191.1619949987251 + }, + { + "x": -1.0860904530719746, + "y": 0.23893609109306826, + "svg_x": 184.77231155778895, + "svg_y": 181.36830474198078 + }, + { + "x": -1.0419056109016633, + "y": 0.2500818398791641, + "svg_x": 186.44969849246235, + "svg_y": 171.6343115077452 + }, + { + "x": -0.9977207687313525, + "y": 0.2610348806492031, + "svg_x": 188.12708542713568, + "svg_y": 162.06861728692533 + }, + { + "x": -0.9535359265610412, + "y": 0.2716511589935541, + "svg_x": 189.80447236180905, + "svg_y": 152.79703010513026 + }, + { + "x": -0.90935108439073, + "y": 0.28177842263187014, + "svg_x": 191.48185929648247, + "svg_y": 143.95251749062885 + }, + { + "x": -0.8651662422204192, + "y": 0.29127061621789874, + "svg_x": 193.1592462311558, + "svg_y": 135.6626349607336 + }, + { + "x": -0.8209814000501079, + "y": 0.30000335676177387, + "svg_x": 194.83663316582917, + "svg_y": 128.03601076510688 + }, + { + "x": -0.7767965578797971, + "y": 0.3078884629472529, + "svg_x": 196.51402010050253, + "svg_y": 121.14965689748414 + }, + { + "x": -0.7326117157094858, + "y": 0.3148855717629324, + "svg_x": 198.1914070351759, + "svg_y": 115.03882386345772 + }, + { + "x": -0.6884268735391745, + "y": 0.32100919334303957, + "svg_x": 199.8687939698493, + "svg_y": 109.69083942798028 + }, + { + "x": -0.6442420313688637, + "y": 0.3263300819174363, + "svg_x": 201.54618090452263, + "svg_y": 105.04391131419479 + }, + { + "x": -0.6000571891985524, + "y": 0.3309704701335142, + "svg_x": 203.223567839196, + "svg_y": 100.99128924578093 + }, + { + "x": -0.5558723470282416, + "y": 0.33509344713360784, + "svg_x": 204.9009547738694, + "svg_y": 97.39054146346182 + }, + { + "x": -0.5116875048579304, + "y": 0.3388874734755469, + "svg_x": 206.57834170854272, + "svg_y": 94.07707841564785 + }, + { + "x": -0.46750266268761953, + "y": 0.34254763379388015, + "svg_x": 208.25572864321612, + "svg_y": 90.88052550039473 + }, + { + "x": -0.42331782051730826, + "y": 0.3462556531994323, + "svg_x": 209.93311557788948, + "svg_y": 87.64217548024303 + }, + { + "x": -0.379132978346997, + "y": 0.35016088460650785, + "svg_x": 211.61050251256287, + "svg_y": 84.23159295015594 + }, + { + "x": -0.3349481361766862, + "y": 0.35436437876964516, + "svg_x": 213.28788944723618, + "svg_y": 80.56052656158184 + }, + { + "x": -0.2907632940063749, + "y": 0.3589077829052686, + "svg_x": 214.96527638190958, + "svg_y": 76.59260426534928 + }, + { + "x": -0.24657845183606408, + "y": 0.36376822627732547, + "svg_x": 216.6426633165829, + "svg_y": 72.34779991824182 + }, + { + "x": -0.20239360966575282, + "y": 0.3688596280403082, + "svg_x": 218.32005025125628, + "svg_y": 67.90129109548116 + }, + { + "x": -0.158208767495442, + "y": 0.37404011136746473, + "svg_x": 219.9974371859297, + "svg_y": 63.376984059284666 + }, + { + "x": -0.11402392532513073, + "y": 0.3791245353462726, + "svg_x": 221.67482412060306, + "svg_y": 58.93656919263699 + }, + { + "x": -0.0698390831548199, + "y": 0.3839006470696864, + "svg_x": 223.35221105527637, + "svg_y": 54.76541478265602 + }, + { + "x": -0.025654240984508192, + "y": 0.3881470589083364, + "svg_x": 225.0295979899498, + "svg_y": 51.05686680616102 + }, + { + "x": 0.01853060118580263, + "y": 0.3916511783707175, + "svg_x": 226.70698492462313, + "svg_y": 47.996590121895395 + }, + { + "x": 0.06271544335611345, + "y": 0.3942253366467558, + "svg_x": 228.3843718592965, + "svg_y": 45.748482818950734 + }, + { + "x": 0.10690028552642428, + "y": 0.3957196363213503, + "svg_x": 230.06175879396986, + "svg_y": 44.44345583497918 + }, + { + "x": 0.151085127696736, + "y": 0.39603042641955505, + "svg_x": 231.73914572864328, + "svg_y": 44.17203138685543 + }, + { + "x": 0.1952699698670468, + "y": 0.3951037788258021, + "svg_x": 233.41653266331664, + "svg_y": 44.98130688563249 + }, + { + "x": 0.23945481203735763, + "y": 0.3929338567226222, + "svg_x": 235.09391959798995, + "svg_y": 46.87637983914471 + }, + { + "x": 0.28363965420766934, + "y": 0.38955660570240125, + "svg_x": 236.77130653266335, + "svg_y": 49.82585763664865 + }, + { + "x": 0.32782449637798017, + "y": 0.3850397242779236, + "svg_x": 238.4486934673367, + "svg_y": 53.770616671641264 + }, + { + "x": 0.372009338548291, + "y": 0.37947032874379705, + "svg_x": 240.12608040201007, + "svg_y": 58.63457507303636 + }, + { + "x": 0.4161941807186018, + "y": 0.372942049436482, + "svg_x": 241.80346733668344, + "svg_y": 64.33596201689767 + }, + { + "x": 0.4603790228889135, + "y": 0.3655434111757971, + "svg_x": 243.4808542713568, + "svg_y": 70.79746551515571 + }, + { + "x": 0.5045638650592243, + "y": 0.3573492075739796, + "svg_x": 245.1582412060302, + "svg_y": 77.95376554943806 + }, + { + "x": 0.5487487072295352, + "y": 0.3484161627521771, + "svg_x": 246.83562814070353, + "svg_y": 85.75532285396146 + }, + { + "x": 0.5929335493998469, + "y": 0.3387835224962189, + "svg_x": 248.51301507537693, + "svg_y": 94.16786263740713 + }, + { + "x": 0.6371183915701577, + "y": 0.3284784205214732, + "svg_x": 250.19040201005024, + "svg_y": 103.16768802602685 + }, + { + "x": 0.6813032337404685, + "y": 0.31752505393460234, + "svg_x": 251.86778894472366, + "svg_y": 112.7336667946952 + }, + { + "x": 0.7254880759107802, + "y": 0.3059560185697742, + "svg_x": 253.54517587939702, + "svg_y": 122.83733179998868 + }, + { + "x": 0.7696729180810911, + "y": 0.29382372648592153, + "svg_x": 255.2225628140704, + "svg_y": 133.43290965899396 + }, + { + "x": 0.8138577602514019, + "y": 0.2812097378049739, + "svg_x": 256.8999497487437, + "svg_y": 144.44917091101868 + }, + { + "x": 0.8580426024217127, + "y": 0.26823011005451347, + "svg_x": 258.5773366834171, + "svg_y": 155.78475823947977 + }, + { + "x": 0.9022274445920244, + "y": 0.25503545937694905, + "svg_x": 260.2547236180905, + "svg_y": 167.3081330156758 + }, + { + "x": 0.9464122867623352, + "y": 0.241805244640202, + "svg_x": 261.93211055276385, + "svg_y": 178.8625671956059 + }, + { + "x": 0.9905971289326461, + "y": 0.2287366979512775, + "svg_x": 263.60949748743724, + "svg_y": 190.2758107104763 + }, + { + "x": 1.0347819711029578, + "y": 0.21602969136412215, + "svg_x": 265.2868844221106, + "svg_y": 201.37330792852399 + }, + { + "x": 1.0789668132732686, + "y": 0.20386951697380692, + "svg_x": 266.96427135678397, + "svg_y": 211.99323643347245 + }, + { + "x": 1.1231516554435794, + "y": 0.19240996017254688, + "svg_x": 268.64165829145725, + "svg_y": 222.00128977394942 + }, + { + "x": 1.1673364976138902, + "y": 0.18175909718993138, + "svg_x": 270.3190452261307, + "svg_y": 231.3030809950905 + }, + { + "x": 1.211521339784202, + "y": 0.17196992964293195, + "svg_x": 271.9964321608041, + "svg_y": 239.85232183121636 + }, + { + "x": 1.2557061819545128, + "y": 0.16303731457455878, + "svg_x": 273.67381909547737, + "svg_y": 247.65350381622972 + }, + { + "x": 1.2998910241248236, + "y": 0.15490174451017114, + "svg_x": 275.35120603015076, + "svg_y": 254.75859702111066 + }, + { + "x": 1.3440758662951353, + "y": 0.14745951009473, + "svg_x": 277.02859296482416, + "svg_y": 261.25817464822086 + }, + { + "x": 1.3882607084654461, + "y": 0.14057779975761067, + "svg_x": 278.70597989949755, + "svg_y": 267.268225937467 + }, + { + "x": 1.432445550635757, + "y": 0.13411252411764132, + "svg_x": 280.38336683417083, + "svg_y": 272.9145894563934 + }, + { + "x": 1.4766303928060678, + "y": 0.12792623967307265, + "svg_x": 282.0607537688443, + "svg_y": 278.31729968108544 + }, + { + "x": 1.5208152349763795, + "y": 0.12190357217991503, + "svg_x": 283.7381407035176, + "svg_y": 283.57711719137956 + }, + { + "x": 1.5650000771466903, + "y": 0.11596201041823524, + "svg_x": 285.41552763819095, + "svg_y": 288.76610207691124 + }, + { + "x": 1.6091849193170011, + "y": 0.11005677379190186, + "svg_x": 287.09291457286434, + "svg_y": 293.92336288284264 + }, + { + "x": 1.6533697614873129, + "y": 0.1041794959941977, + "svg_x": 288.7703015075377, + "svg_y": 299.05620621320224 + }, + { + "x": 1.6975546036576237, + "y": 0.09835151283339667, + "svg_x": 290.44768844221113, + "svg_y": 304.1459987202113 + }, + { + "x": 1.7417394458279345, + "y": 0.09261339706378388, + "svg_x": 292.1250753768844, + "svg_y": 309.1573067220882 + }, + { + "x": 1.7859242879982453, + "y": 0.08701289282645258, + "svg_x": 293.8024623115578, + "svg_y": 314.04843350062254 + }, + { + "x": 1.830109130168557, + "y": 0.08159348966267956, + "svg_x": 295.4798492462312, + "svg_y": 318.7813980364436 + }, + { + "x": 1.8742939723388679, + "y": 0.0763855528957766, + "svg_x": 297.15723618090453, + "svg_y": 323.32968117347247 + }, + { + "x": 1.9184788145091787, + "y": 0.07140128599983042, + "svg_x": 298.8346231155779, + "svg_y": 327.68262516798353 + }, + { + "x": 1.9626636566794904, + "y": 0.06663398846512668, + "svg_x": 300.51201005025126, + "svg_y": 331.8460818220832 + }, + { + "x": 2.006848498849801, + "y": 0.06206125598316489, + "svg_x": 302.18939698492466, + "svg_y": 335.8396176441818 + }, + { + "x": 2.051033341020112, + "y": 0.05765109900480679, + "svg_x": 303.866783919598, + "svg_y": 339.6911702866393 + }, + { + "x": 2.095218183190423, + "y": 0.05336953822680194, + "svg_x": 305.54417085427133, + "svg_y": 343.4304151274219 + }, + { + "x": 2.1394030253607346, + "y": 0.04918812043192671, + "svg_x": 307.2215577889447, + "svg_y": 347.08220140988345 + }, + { + "x": 2.1835878675310454, + "y": 0.04508997402881915, + "svg_x": 308.8989447236181, + "svg_y": 350.66126371662773 + }, + { + "x": 2.227772709701356, + "y": 0.04107342782164594, + "svg_x": 310.5763316582915, + "svg_y": 354.1690615645742 + }, + { + "x": 2.271957551871668, + "y": 0.03715275152929256, + "svg_x": 312.25371859296484, + "svg_y": 357.5931326822549 + }, + { + "x": 2.3161423940419787, + "y": 0.03335613121151739, + "svg_x": 313.93110552763824, + "svg_y": 360.9088611447775 + }, + { + "x": 2.3603272362122896, + "y": 0.029721463665121975, + "svg_x": 315.6084924623116, + "svg_y": 364.0831502826634 + }, + { + "x": 2.4045120783826004, + "y": 0.026290863920869323, + "svg_x": 317.2858793969849, + "svg_y": 367.0792194872361 + }, + { + "x": 2.448696920552912, + "y": 0.02310489079809747, + "svg_x": 318.9632663316583, + "svg_y": 369.8616472466169 + }, + { + "x": 2.492881762723223, + "y": 0.020197411492372003, + "svg_x": 320.6406532663317, + "svg_y": 372.4008560906129 + }, + { + "x": 2.5370666048935337, + "y": 0.017591789775999962, + "svg_x": 322.3180402010051, + "svg_y": 374.67644157570675 + }, + { + "x": 2.5812514470638455, + "y": 0.01529876128924196, + "svg_x": 323.9954271356784, + "svg_y": 376.67902787155583 + }, + { + "x": 2.6254362892341563, + "y": 0.013316029334183386, + "svg_x": 325.67281407035176, + "svg_y": 378.4106207691025 + }, + { + "x": 2.669621131404467, + "y": 0.01162934173930686, + "svg_x": 327.35020100502516, + "svg_y": 379.88366721505133 + }, + { + "x": 2.713805973574779, + "y": 0.010214636781484931, + "svg_x": 329.02758793969855, + "svg_y": 381.1191811990967 + }, + { + "x": 2.7579908157450896, + "y": 0.009040787223736605, + "svg_x": 330.7049748743719, + "svg_y": 382.1443472846079 + }, + { + "x": 2.8021756579154005, + "y": 0.008072511565588254, + "svg_x": 332.3823618090452, + "svg_y": 382.9899781063835 + }, + { + "x": 2.8463605000857113, + "y": 0.00727312623331302, + "svg_x": 334.0597487437186, + "svg_y": 383.6881107814732 + }, + { + "x": 2.890545342256023, + "y": 0.006606939789464267, + "svg_x": 335.737135678392, + "svg_y": 384.2699159577439 + }, + { + "x": 2.934730184426334, + "y": 0.006041203199682887, + "svg_x": 337.41452261306534, + "svg_y": 384.7639945739927 + }, + { + "x": 2.9789150265966446, + "y": 0.0055476053537744045, + "svg_x": 339.0919095477387, + "svg_y": 385.1950717662671 + }, + { + "x": 3.0230998687669564, + "y": 0.005103334328184673, + "svg_x": 340.76929648241213, + "svg_y": 385.583070028228 + }, + { + "x": 3.067284710937267, + "y": 0.00469172161203444, + "svg_x": 342.44668341708547, + "svg_y": 385.942546584808 + }, + { + "x": 3.111469553107578, + "y": 0.004302467273663569, + "svg_x": 344.1240703517588, + "svg_y": 386.2824967459695 + }, + { + "x": 3.155654395277889, + "y": 0.0039314288367225045, + "svg_x": 345.8014572864322, + "svg_y": 386.6065382889954 + }, + { + "x": 3.1998392374482005, + "y": 0.00357996005874073, + "svg_x": 347.4788442211056, + "svg_y": 386.9134889275373 + }, + { + "x": 3.2440240796185114, + "y": 0.00325381308477103, + "svg_x": 349.1562311557789, + "svg_y": 387.1983251013032 + }, + { + "x": 3.288208921788822, + "y": 0.0029616641378080047, + "svg_x": 350.83361809045226, + "svg_y": 387.4534695449565 + }, + { + "x": 3.332393763959134, + "y": 0.002713377658558054, + "svg_x": 352.51100502512566, + "svg_y": 387.6703072788363 + }, + { + "x": 3.3765786061294447, + "y": 0.0025181727194137945, + "svg_x": 354.18839195979905, + "svg_y": 387.840786947218 + }, + { + "x": 3.4207634482997555, + "y": 0.002382886367062822, + "svg_x": 355.8657788944724, + "svg_y": 387.9589375052238 + }, + { + "x": 3.4649482904700664, + "y": 0.0023105334984811314, + "svg_x": 357.5431658291457, + "svg_y": 388.0221259321987 + }, + { + "x": 3.509133132640378, + "y": 0.002299339525314164, + "svg_x": 359.22055276381917, + "svg_y": 388.03190204156226 + }, + { + "x": 3.553317974810689, + "y": 0.002342372821469825, + "svg_x": 360.8979396984925, + "svg_y": 387.9943194778723 + }, + { + "x": 3.5975028169809997, + "y": 0.0024278347355157397, + "svg_x": 362.57532663316584, + "svg_y": 387.9196824383092 + }, + { + "x": 3.6416876591513114, + "y": 0.002539984145932302, + "svg_x": 364.25271356783924, + "svg_y": 387.82173822449556 + }, + { + "x": 3.6858725013216223, + "y": 0.00266059114609928, + "svg_x": 365.9301005025126, + "svg_y": 387.71640768581597 + }, + { + "x": 3.730057343491933, + "y": 0.0027707415340285407, + "svg_x": 367.60748743718597, + "svg_y": 387.6202092920222 + }, + { + "x": 3.774242185662244, + "y": 0.0028527615963428567, + "svg_x": 369.2848743718593, + "svg_y": 387.548578148439 + }, + { + "x": 3.8184270278325556, + "y": 0.0028920110633454373, + "svg_x": 370.9622613065327, + "svg_y": 387.5143001422159 + }, + { + "x": 3.8626118700028664, + "y": 0.0028783073053032645, + "svg_x": 372.6396482412061, + "svg_y": 387.52626813921876 + }, + { + "x": 3.9067967121731773, + "y": 0.0028067962210261664, + "svg_x": 374.3170351758794, + "svg_y": 387.5887214049333 + }, + { + "x": 3.950981554343488, + "y": 0.0026781680364643024, + "svg_x": 375.9944221105527, + "svg_y": 387.70105713959646 + }, + { + "x": 3.9951663965138, + "y": 0.00249821579518853, + "svg_x": 377.67180904522615, + "svg_y": 387.85821606473297 + }, + { + "x": 4.0393512386841115, + "y": 0.0022768327260684323, + "svg_x": 379.3491959798996, + "svg_y": 388.05155805891803 + }, + { + "x": 4.083536080854421, + "y": 0.0020266235580977277, + "svg_x": 381.0265829145729, + "svg_y": 388.2700749477258 + }, + { + "x": 4.127720923024733, + "y": 0.0017613498743171332, + "svg_x": 382.7039698492462, + "svg_y": 388.5017482334508 + }, + { + "x": 4.171905765195045, + "y": 0.0014944339249074296, + "svg_x": 384.3813567839196, + "svg_y": 388.73485577028185 + }, + { + "x": 4.216090607365355, + "y": 0.0012377111179778001, + "svg_x": 386.058743718593, + "svg_y": 388.9590612600776 + }, + { + "x": 4.2602754495356665, + "y": 0.0010005588724088612, + "svg_x": 387.7361306532664, + "svg_y": 389.1661750572889 + }, + { + "x": 4.304460291705976, + "y": 0.0007894538513937033, + "svg_x": 389.4135175879397, + "svg_y": 389.350540853227 + }, + { + "x": 4.348645133876288, + "y": 0.0006079369247854676, + "svg_x": 391.09090452261313, + "svg_y": 389.5090662757368 + }, + { + "x": 4.3928299760466, + "y": 0.0004569087173062373, + "svg_x": 392.76829145728647, + "svg_y": 389.6409647760525 + }, + { + "x": 4.43701481821691, + "y": 0.0003351459303867038, + "svg_x": 394.4456783919598, + "svg_y": 389.747304705904 + }, + { + "x": 4.4811996603872215, + "y": 0.00023992108230452394, + "svg_x": 396.1230653266332, + "svg_y": 389.8304680756114 + }, + { + "x": 4.525384502557533, + "y": 0.00016762178506926528, + "svg_x": 397.8004522613066, + "svg_y": 389.89360971675495 + }, + { + "x": 4.569569344727843, + "y": 0.00011429271609108016, + "svg_x": 399.47783919597987, + "svg_y": 389.94018395834104 + }, + { + "x": 4.613754186898155, + "y": 0.00007605568471392627, + "svg_x": 401.15522613065326, + "svg_y": 389.9735777672152 + }, + { + "x": 4.657939029068467, + "y": 0.00004939342986240425, + "svg_x": 402.8326130653267, + "svg_y": 389.9968628971167 + }, + { + "x": 4.7021238712387765, + "y": 0.00003130622022640016, + "svg_x": 404.51000000000005, + "svg_y": 390.0126591239654 + } + ] + ], + "selectors": [ + "g[id='maidr-03825914-44f3-4ca5-94f0-42078a82560e'] path" + ] + } + ] + } + ] + ] +}; + +const smoothSvgInnerHTML = ` + + + + 2025-11-11T11:50:33.867359 + image/svg+xml + + + Matplotlib v3.10.6, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `; + +function BarChart() { + return ( + + + + ); +} + +function LineChart() { + return ( + + + + ); +} + +function SmoothChart() { + return ( + + + + ); +} + +function App() { + return ( +
+

MAIDR React Examples

+

Bar Chart

+ +

Line Chart

+ +

Smooth Chart

+ +
+ ); +} + +document.addEventListener('DOMContentLoaded', () => { + createRoot(document.getElementById('root')!).render(); +}); diff --git a/examples/react-app/vite.config.ts b/examples/react-app/vite.config.ts new file mode 100644 index 00000000..dde205fa --- /dev/null +++ b/examples/react-app/vite.config.ts @@ -0,0 +1,61 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; +import { viteSingleFile } from 'vite-plugin-singlefile'; + +/** + * Post-build plugin that strips `type="module"` from inlined scripts + * so the single-file HTML works when opened via the file:// protocol. + */ +function stripModuleType() { + return { + name: 'strip-module-type', + closeBundle() { + const outPath = path.resolve(__dirname, '../react/index.html'); + if (fs.existsSync(outPath)) { + let html = fs.readFileSync(outPath, 'utf-8'); + html = html.replace(/ +`});return m(),p(),y+` +`+(i===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(` +`))+1))}const l="#".repeat(i),u=n.enter("headingAtx"),f=n.enter("phrasing");s.move(l+" ");let h=n.containerPhrasing(e,{before:"# ",after:` +`,...s.current()});return/^[\t ]/.test(h)&&(h=Rc(h.charCodeAt(0))+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),f(),u(),h}U9.peek=Pq;function U9(e){return e.value||""}function Pq(){return"<"}Q9.peek=Bq;function Q9(e,t,n,r){const i=M2(n),s=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const f=n.createTracker(r);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(u=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),u(),e.title&&(u=n.enter(`title${s}`),h+=f.move(" "+i),h+=f.move(n.safe(e.title,{before:h,after:i,...f.current()})),h+=f.move(i),u()),h+=f.move(")"),l(),h}function Bq(){return"!"}q9.peek=jq;function q9(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("![");const h=n.safe(e.alt,{before:f,after:"]",...u.current()});f+=u.move(h+"]["),l();const p=n.stack;n.stack=[],l=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=p,s(),i==="full"||!h||h!==m?f+=u.move(m+"]"):i==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function jq(){return"!"}G9.peek=$q;function G9(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s\u007F]/.test(e.url))}X9.peek=Fq;function X9(e,t,n,r){const i=M2(n),s=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,f;if(W9(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let m=l.move("<");return m+=l.move(n.containerPhrasing(e,{before:m,after:">",...l.current()})),m+=l.move(">"),u(),n.stack=p,m}u=n.enter("link"),f=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(e,{before:h,after:"](",...l.current()})),h+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(e.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(f=n.enter("destinationRaw"),h+=l.move(n.safe(e.url,{before:h,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${s}`),h+=l.move(" "+i),h+=l.move(n.safe(e.title,{before:h,after:i,...l.current()})),h+=l.move(i),f()),h+=l.move(")"),u(),h}function Fq(e,t,n){return W9(e,n)?"<":"["}Y9.peek=Hq;function Y9(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("[");const h=n.containerPhrasing(e,{before:f,after:"]",...u.current()});f+=u.move(h+"]["),l();const p=n.stack;n.stack=[],l=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=p,s(),i==="full"||!h||h!==m?f+=u.move(m+"]"):i==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function Hq(){return"["}function L2(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Uq(e){const t=L2(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Qq(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function K9(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function qq(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let l=e.ordered?Qq(n):L2(n);const u=e.ordered?l==="."?")":".":Uq(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),K9(n)===l&&p){let m=-1;for(;++m-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let l=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(s+" ".repeat(l-s.length)),u.shift(l);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,u.current()),p);return f(),h;function p(m,y,v){return y?(v?"":" ".repeat(l))+m:(v?s:s+" ".repeat(l-s.length))+m}}function Xq(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),l=n.containerPhrasing(e,r);return s(),i(),l}const Yq=bc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Kq(e,t,n,r){return(e.children.some(function(l){return Yq(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Zq(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Z9.peek=Jq;function Z9(e,t,n,r){const i=Zq(n),s=n.enter("strong"),l=n.createTracker(r),u=l.move(i+i);let f=l.move(n.containerPhrasing(e,{after:i,before:u,...l.current()}));const h=f.charCodeAt(0),p=kh(r.before.charCodeAt(r.before.length-1),h,i);p.inside&&(f=Rc(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=kh(r.after.charCodeAt(0),m,i);y.inside&&(f=f.slice(0,-1)+Rc(m));const v=l.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},u+f+v}function Jq(e,t,n){return n.options.strong||"*"}function eG(e,t,n,r){return n.safe(e.value,r)}function tG(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function nG(e,t,n){const r=(K9(n)+(n.options.ruleSpaces?" ":"")).repeat(tG(n));return n.options.ruleSpaces?r.slice(0,-1):r}const J9={blockquote:Aq,break:$9,code:Oq,definition:_q,emphasis:H9,hardBreak:$9,heading:Vq,html:U9,image:Q9,imageReference:q9,inlineCode:G9,link:X9,linkReference:Y9,list:qq,listItem:Wq,paragraph:Xq,root:Kq,strong:Z9,text:eG,thematicBreak:nG};function rG(){return{enter:{table:iG,tableData:ex,tableHeader:ex,tableRow:sG},exit:{codeText:oG,table:aG,tableData:R2,tableHeader:R2,tableRow:R2}}}function iG(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function aG(e){this.exit(e),this.data.inTable=void 0}function sG(e){this.enter({type:"tableRow",children:[]},e)}function R2(e){this.exit(e)}function ex(e){this.enter({type:"tableCell",children:[]},e)}function oG(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,lG));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function lG(e,t){return t==="|"?t:e}function uG(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:l,tableCell:f,tableRow:u}};function l(v,b,S,T){return h(p(v,S,T),v.align)}function u(v,b,S,T){const E=m(v,S,T),A=h([E]);return A.slice(0,A.indexOf(` +`))}function f(v,b,S,T){const E=S.enter("tableCell"),A=S.enter("phrasing"),L=S.containerPhrasing(v,{...T,before:s,after:s});return A(),E(),L}function h(v,b){return Tq(v,{align:b,alignDelimiters:r,padding:n,stringLength:i})}function p(v,b,S){const T=v.children;let E=-1;const A=[],L=b.enter("table");for(;++E0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const kG={tokenize:NG,partial:!0};function MG(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:DG,continuation:{tokenize:_G},exit:IG}},text:{91:{name:"gfmFootnoteCall",tokenize:OG},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:LG,resolveTo:RG}}}}function LG(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const f=r.events[i][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!l||!l._balanced)return n(f);const h=Vi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function RG(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function OG(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return u;function u(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(m){if(s>999||m===93&&!l||m===null||m===91||sn(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return i.includes(Vi(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return sn(m)||(l=!0),s++,e.consume(m),m===92?p:h}function p(m){return m===91||m===92||m===93?(e.consume(m),s++,h):h(m)}}function DG(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,u;return f;function f(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(b)}function p(b){if(l>999||b===93&&!u||b===null||b===91||sn(b))return n(b);if(b===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return s=Vi(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return sn(b)||(u=!0),l++,e.consume(b),b===92?m:p}function m(b){return b===91||b===92||b===93?(e.consume(b),l++,p):p(b)}function y(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ct(e,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return t(b)}}function _G(e,t,n){return e.check(pc,t,e.attempt(kG,t,n))}function IG(e){e.exit("gfmFootnoteDefinition")}function NG(e,t,n){const r=this;return Ct(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(s):n(s)}}function zG(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,u){let f=-1;for(;++f1?f(b):(l.consume(b),m++,v);if(m<2&&!n)return f(b);const T=l.exit("strikethroughSequenceTemporary"),E=pl(b);return T._open=!E||E===2&&!!S,T._close=!S||S===2&&!!E,u(b)}}}class VG{constructor(){this.map=[]}add(t,n,r){PG(this,t,n,r)}consume(t){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function PG(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const P=r.events[Z][1].type;if(P==="lineEnding"||P==="linePrefix")Z--;else break}const D=Z>-1?r.events[Z][1].type:null,q=D==="tableHead"||D==="tableRow"?_:f;return q===_&&r.parser.lazy[r.now().line]?n(U):q(U)}function f(U){return e.enter("tableHead"),e.enter("tableRow"),h(U)}function h(U){return U===124||(l=!0,s+=1),p(U)}function p(U){return U===null?n(U):Ge(U)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),v):n(U):Rt(U)?Ct(e,p,"whitespace")(U):(s+=1,l&&(l=!1,i+=1),U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),l=!0,p):(e.enter("data"),m(U)))}function m(U){return U===null||U===124||sn(U)?(e.exit("data"),p(U)):(e.consume(U),U===92?y:m)}function y(U){return U===92||U===124?(e.consume(U),m):m(U)}function v(U){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(U):(e.enter("tableDelimiterRow"),l=!1,Rt(U)?Ct(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):b(U))}function b(U){return U===45||U===58?T(U):U===124?(l=!0,e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),S):I(U)}function S(U){return Rt(U)?Ct(e,T,"whitespace")(U):T(U)}function T(U){return U===58?(s+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),E):U===45?(s+=1,E(U)):U===null||Ge(U)?M(U):I(U)}function E(U){return U===45?(e.enter("tableDelimiterFiller"),A(U)):I(U)}function A(U){return U===45?(e.consume(U),A):U===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),L):(e.exit("tableDelimiterFiller"),L(U))}function L(U){return Rt(U)?Ct(e,M,"whitespace")(U):M(U)}function M(U){return U===124?b(U):U===null||Ge(U)?!l||i!==s?I(U):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(U)):I(U)}function I(U){return n(U)}function _(U){return e.enter("tableRow"),V(U)}function V(U){return U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),V):U===null||Ge(U)?(e.exit("tableRow"),t(U)):Rt(U)?Ct(e,V,"whitespace")(U):(e.enter("data"),W(U))}function W(U){return U===null||U===124||sn(U)?(e.exit("data"),V(U)):(e.consume(U),U===92?K:W)}function K(U){return U===92||U===124?(e.consume(U),W):W(U)}}function FG(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],l=[0,0,0,0],u=!1,f=0,h,p,m;const y=new VG;for(;++nn[2]+1){const b=n[2]+1,S=n[3]-n[2]-1;e.add(b,S,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return i!==void 0&&(s.end=Object.assign({},Sl(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function cx(e,t,n,r,i){const s=[],l=Sl(t.events,n);i&&(i.end=Object.assign({},l),s.push(["exit",i,t])),r.end=Object.assign({},l),s.push(["exit",r,t]),e.add(n+1,0,s)}function Sl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const HG={name:"tasklistCheck",tokenize:QG};function UG(){return{text:{91:HG}}}function QG(e,t,n){const r=this;return i;function i(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),s)}function s(f){return sn(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(f)}function u(f){return Ge(f)?t(f):Rt(f)?e.check({tokenize:qG},t,n)(f):n(f)}}function qG(e,t,n){return Ct(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function GG(e){return G7([vG(),MG(),zG(e),jG(),UG()])}const WG={};function XG(e){const t=this,n=e||WG,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(GG(n)),s.push(pG()),l.push(mG(n))}function YG(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:u,mathText:l,mathTextData:u}};function e(f){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},f)}function t(){this.buffer()}function n(){const f=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=f}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(f){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),p=this.stack[this.stack.length-1];p.type,this.exit(f),p.value=h;const m=p.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function s(f){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},f),this.buffer()}function l(f){const h=this.resume(),p=this.stack[this.stack.length-1];p.type,this.exit(f),p.value=h,p.data.hChildren.push({type:"text",value:h})}function u(f){this.config.enter.data.call(this,f),this.config.exit.data.call(this,f)}}function KG(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(s,l,u,f){const h=s.value||"",p=u.createTracker(f),m="$".repeat(Math.max(F9(h,"$")+1,2)),y=u.enter("mathFlow");let v=p.move(m);if(s.meta){const b=u.enter("mathFlowMeta");v+=p.move(u.safe(s.meta,{after:` +`,before:v,encode:["$"],...p.current()})),b()}return v+=p.move(` +`),h&&(v+=p.move(h+` +`)),v+=p.move(m),y(),v}function r(s,l,u){let f=s.value||"",h=1;for(t||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(f);)h++;const p="$".repeat(h);/[^ \r\n]/.test(f)&&(/^[ \r\n]/.test(f)&&/[ \r\n]$/.test(f)||/^\$|\$$/.test(f))&&(f=" "+f+" ");let m=-1;for(;++m{const[r,i]=N.useState(""),[s,l]=N.useState(!0),u=N.useRef(null),f=Ii("settings"),h=N.useMemo(()=>{try{return window.self!==window.top}catch{return!0}},[]),p=N.useMemo(()=>h?{contain:"layout style",willChange:"auto",overflowWrap:"anywhere",wordBreak:"break-word"}:{},[h]);return N.useEffect(()=>{if(t||h){i(e),l(!1);return}let m=0;const v=setInterval(()=>{m<=e.length?(i(e.slice(0,m)),m++,n&&n()):(l(!1),clearInterval(v))},10);return()=>clearInterval(v)},[e,t,h]),N.useEffect(()=>{if(!s&&u.current){const m=u.current.textContent||"";u.current.setAttribute("aria-label",`AI message: ${m}`)}},[s]),R.jsxs(Bn,{style:p,children:[R.jsx("div",{className:`chat-message-content ${t?"user":""}`,children:R.jsx(YF,{rehypePlugins:[OQ,[$Q,{attributes:{"*":["className","aria-label","aria-hidden","role","aria-busy","aria-live","aria-atomic"],a:["href","target"],img:["src","alt"],math:["display"],span:["style"],svg:["aria-hidden","role","xmlns","width","height","viewBox"],path:["d"]},tagNames:["p","br","b","i","em","strong","a","pre","code","ul","ol","li","blockquote","img","math","span","svg","path"]}]],remarkPlugins:[XG,sW],components:{pre:({node:m,...y})=>R.jsx("pre",{...y,role:"text","aria-label":"Code block"}),a:({node:m,...y})=>R.jsx("a",{...y,"aria-label":`Link: ${y.children}`}),img:({node:m,...y})=>R.jsx("img",{...y,alt:y.alt||"Image in message"})},children:r})}),R.jsx("div",{className:"sr-only","aria-live":f.general.ariaMode,"aria-atomic":"true",children:s?"":e}),s&&!h&&R.jsx("span",{className:"typing-cursor","aria-hidden":"true",role:"presentation",children:"|"})]})};function _2(e){switch(e){case"OPENAI":return"OpenAI";case"ANTHROPIC_CLAUDE":return"Anthropic Claude";case"GOOGLE_GEMINI":return"Google Gemini";default:return"AI Assistant"}}const lW=({message:e,disabled:t,_onOpenSettings:n,onTypingUpdate:r})=>{const i=()=>e.isUser?R.jsx(sD,{}):R.jsx(KP,{model:e.model}),s=()=>{const l=e.isUser?"Your message":"AI Assistant message",u=e.isUser?"":` from ${_2(e.model)}`,f=!e.isUser&&e.status==="PENDING"?" (typing)":"";return`${l}${u}${f}`};return R.jsx(Bn,{sx:{display:"flex",justifyContent:e.isUser?"flex-end":"flex-start",mb:2},role:"listitem",children:R.jsxs(Bn,{sx:{display:"flex",alignItems:"flex-start",gap:1.5,maxWidth:"80%",flexDirection:e.isUser?"row-reverse":"row"},children:[R.jsx(XI,{className:`chat-avatar ${e.isUser?"user":""}`,"aria-hidden":"true",children:i()}),R.jsxs(Bn,{className:`chat-bubble ${e.isUser?"user":"ai"}`,role:"article","aria-label":s(),children:[!e.isUser&&R.jsx(En,{className:"model-name",variant:"caption",fontWeight:"medium",color:"text.secondary",component:"h3",sx:{fontSize:"0.8rem",margin:0,marginBottom:.5},"aria-label":`Model: ${_2(e.model)}`,children:_2(e.model)}),R.jsx(oW,{text:e.text,isUser:e.isUser,onTypingUpdate:r}),e.isWelcomeMessage&&e.modelSelections&&R.jsx(ZP,{enabledModels:e.modelSelections}),R.jsxs(Bn,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mt:.5},children:[t&&e.id.startsWith("system-")&&R.jsx(Ku,{variant:"text",onClick:n,"aria-label":"Open settings",style:{padding:0},children:"Open Settings"}),R.jsx(En,{className:"timestamp",variant:"caption",color:"text.secondary",component:"time",dateTime:new Date(e.timestamp).toISOString(),"aria-label":`Sent at ${new Date(e.timestamp).toLocaleTimeString()}`,children:new Date(e.timestamp).toLocaleTimeString()})]}),!e.isUser&&e.status==="PENDING"&&R.jsx(Bn,{role:"status","aria-label":"AI is typing",children:R.jsx(Ef,{size:16})})]})]})})},hx=N.memo(({suggestion:e,onClick:t})=>{const n=Ca();return R.jsx(DI,{label:e.text,onClick:t,role:"button","aria-label":`Suggestion: ${e.text}`,sx:{bgcolor:n.palette.primary.main,color:n.palette.primary.contrastText,"&:hover":{bgcolor:n.palette.primary.dark}}})});hx.displayName="SuggestionChip";const dx=N.memo(({suggestions:e,onSuggestionClick:t})=>{const n=Ca();return!e||!e.length?null:R.jsx(Bn,{role:"region","aria-label":"Suggested responses",sx:{p:2,display:"flex",flexWrap:"wrap",gap:1,borderTop:`1px solid ${n.palette.divider}`,bgcolor:n.palette.background.paper},children:e.map(r=>R.jsx(hx,{suggestion:r,onClick:()=>t(r)},r.id))})});dx.displayName="Suggestions";const uW=()=>{var L;const e=N.useId(),t=Ca(),n=Qi("chat"),r=Qi("settings"),{messages:i,suggestions:s}=Ii("chat"),l=!n.canSend,[u,f]=N.useState(""),h=N.useRef(null),p=N.useRef(null),m=N.useRef(0),y=N.useRef(null),v=()=>{r.toggle()},b=(M=!1)=>{if(!p.current)return;const I=p.current;(I.scrollTop+I.clientHeight>=I.scrollHeight-100||M)&&requestAnimationFrame(()=>{I.scrollTo({top:I.scrollHeight,behavior:"smooth"})})};N.useEffect(()=>{const M=setTimeout(()=>{b(!0)},200);return()=>clearTimeout(M)},[i.length]),N.useEffect(()=>{setTimeout(()=>b(!0),200)},[]),N.useEffect(()=>{if(!p.current)return;const M=p.current;return y.current&&y.current.disconnect(),y.current=new MutationObserver(I=>{let _=!1;I.forEach(V=>{(V.type==="childList"||V.type==="characterData")&&M.scrollTop+M.clientHeight>=M.scrollHeight-100&&(_=!0)}),_&&requestAnimationFrame(()=>{M.scrollTo({top:M.scrollHeight,behavior:"auto"})})}),y.current.observe(M,{childList:!0,subtree:!0,characterData:!0}),()=>{y.current&&y.current.disconnect()}},[i.length]),N.useEffect(()=>{if(!p.current)return;const M=p.current,I=M.scrollHeight;I>m.current&&M.scrollTop+M.clientHeight>=m.current-100&&requestAnimationFrame(()=>{M.scrollTo({top:I,behavior:"auto"})}),m.current=I},[i]),N.useEffect(()=>{if(i.length>0){const M=i[i.length-1];if(M.status==="SUCCESS"||M.status==="FAILED"){const I=setTimeout(()=>{b(!0)},300);return()=>clearTimeout(I)}}},[i.length>0?(L=i[i.length-1])==null?void 0:L.status:""]);const S=()=>{n.toggle()},T=()=>{u.trim()&&(n.sendMessage(u),f(""),setTimeout(()=>b(!0),100))},E=M=>{f(M.text)},A=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),T())};return R.jsxs(zf,{id:e,role:"dialog",open:!0,onClose:S,maxWidth:"md",fullWidth:!0,disablePortal:!0,sx:{"& .MuiDialog-paper":{height:"70vh",maxHeight:"90vh"}},children:[R.jsx(Py,{component:"h2",sx:{p:2},children:R.jsxs(We,{container:!0,justifyContent:"space-between",alignItems:"center",children:[R.jsx(We,{size:"auto",children:R.jsx(En,{variant:"h6",fontWeight:"bold",component:"h2",sx:{margin:0},"aria-label":"Chart Assistant - AI Chat Interface",children:"Chart Assistant"})}),R.jsx(We,{size:"auto",children:R.jsx(Fu,{onClick:S,"aria-label":"Close chat dialog",children:R.jsx(P6,{})})})]})}),R.jsx(Vf,{dividers:!0,sx:{p:0,overflow:"hidden"},children:R.jsxs(We,{container:!0,direction:"column",sx:{height:"100%"},children:[R.jsxs(We,{ref:p,size:12,component:"section","aria-label":"Chat messages",sx:{flex:1,overflowY:"auto",p:2,bgcolor:t.palette.background.default,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:t.palette.grey[100]},"&::-webkit-scrollbar-thumb":{background:t.palette.grey[400],borderRadius:"3px"}},children:[i.map(M=>R.jsx(lW,{message:M,disabled:l,_onOpenSettings:v,onTypingUpdate:()=>{if(p.current){const I=p.current;I.scrollTop+I.clientHeight>=I.scrollHeight-100&&requestAnimationFrame(()=>{I.scrollTo({top:I.scrollHeight,behavior:"auto"})})}}},M.id)),R.jsx("div",{ref:h})]}),R.jsx(dx,{suggestions:s,onSuggestionClick:E}),R.jsx(We,{size:12,component:"section","aria-label":"Message input",sx:{p:2,borderTop:`1px solid ${t.palette.divider}`},children:R.jsxs(We,{container:!0,spacing:1,alignItems:"center",children:[R.jsx(We,{size:{xs:10},children:R.jsx(pi,{value:u,disabled:l,onChange:M=>f(M.target.value),onKeyDown:A,maxRows:4,placeholder:"What can I help you with?",variant:"outlined",size:"small",autoFocus:!0,fullWidth:!0,multiline:!0,"aria-label":"Type your message to the AI assistant"})}),R.jsx(We,{size:{xs:2},container:!0,justifyContent:"flex-end",children:R.jsx(Fu,{onClick:T,disabled:l,color:"primary","aria-label":"Send message to AI assistant",sx:{bgcolor:t.palette.primary.main,color:t.palette.primary.contrastText,"&:hover":{bgcolor:t.palette.primary.dark}},children:R.jsx(uD,{})})})]})})]})})]})};function cW(){const{commandExecutor:e}=x5(),t=N.useCallback(s=>{e.executeCommand(s)},[e]),n=N.useCallback(s=>{const l=e.onScopeChange(s);return()=>l.dispose()},[e]),r=N.useCallback(()=>e.getCurrentScope(),[e]),i=N.useSyncExternalStore(n,r);return{executeCommand:t,currentScope:i}}const fW=()=>{const e=Qi("commandPalette"),t=Ii("commandPalette"),{executeCommand:n}=cW(),[r]=N.useState(""),i=N.useRef(null),s=N.useRef(null),l=N.useRef(!1),u=N.useMemo(()=>{if(!t.search.trim())return t.commands;const m=t.search.toLowerCase();return t.commands.filter(y=>y.description.toLowerCase().includes(m)||y.key.toLowerCase().includes(m))},[t.commands,t.search]);N.useEffect(()=>{t.visible&&i.current&&setTimeout(()=>{i.current&&i.current.focus()},100)},[t.visible]),N.useEffect(()=>{t.visible&&i.current&&t.selectedIndex},[t.selectedIndex,t.visible]),N.useEffect(()=>{if(s.current&&t.selectedIndex>=0){const m=s.current,y=m.children[t.selectedIndex];if(y){y.focus();const v=m.getBoundingClientRect(),b=y.getBoundingClientRect();(b.topv.bottom)&&y.scrollIntoView({behavior:"smooth",block:"nearest"})}}},[t.selectedIndex]);const f=N.useCallback(()=>{e.hide()},[e]),h=N.useCallback(m=>{n(m),f()},[n,f]),p=N.useCallback(m=>{e.updateSearch(m.target.value)},[e]);return t.visible?R.jsxs(zf,{open:t.visible,onClose:f,maxWidth:"md",fullWidth:!0,disablePortal:!0,role:"dialog","aria-modal":"true","aria-labelledby":"command-palette-title","aria-describedby":"command-palette-description",sx:{"& .MuiDialog-paper":{maxHeight:"80vh"}},children:[R.jsx(Bn,{component:"h2",id:"command-palette-title",sx:{p:2,m:0},children:R.jsx(Bn,{component:"span",sx:{fontSize:"1.25rem",fontWeight:600},children:"Command Palette"})}),R.jsxs(Vf,{dividers:!0,sx:{p:2,overflow:"hidden"},children:[R.jsx(Bn,{id:"command-palette-description",sx:{mb:2},children:R.jsx(En,{variant:"body2",color:"text.secondary",sx:{m:0},children:"Type to search commands, use arrow keys to navigate the list, and press Enter to execute a command"})}),R.jsx(pi,{ref:i,fullWidth:!0,placeholder:"Search commands...",value:t.search,onChange:p,sx:{mb:2},autoFocus:!0,inputProps:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":"command-list","aria-expanded":!0,"aria-activedescendant":t.selectedIndex>=0?`command-${t.selectedIndex}`:void 0,"aria-label":"Search commands","aria-describedby":"command-palette-description",onKeyDown:m=>{if(m.key==="Enter"){if(m.preventDefault(),m.stopPropagation(),u.length>0&&t.selectedIndex>=0){const y=u[t.selectedIndex];y&&h(y.commandKey)}}else m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),e.moveDown()):m.key==="ArrowUp"&&(m.preventDefault(),m.stopPropagation(),t.selectedIndex===0?e.moveToSearch():e.moveUp())}}}),R.jsx(Hp,{ref:s,id:"command-list",role:"listbox","aria-label":"Available commands",sx:{flex:1,overflow:"auto",maxHeight:"60vh"},children:u.map((m,y)=>R.jsx(Jz,{id:`command-${y}`,role:"option","aria-selected":y===t.selectedIndex,"aria-label":`${m.description} (${m.key})`,selected:y===t.selectedIndex,tabIndex:y===t.selectedIndex?0:-1,onClick:()=>{l.current||h(m.commandKey)},onKeyDown:v=>{v.key==="Enter"?(v.preventDefault(),v.stopPropagation(),l.current=!0,setTimeout(()=>{l.current=!1},100),h(m.commandKey)):v.key==="ArrowUp"?(v.preventDefault(),v.stopPropagation(),y===0?e.moveToSearch():e.moveUp()):v.key==="ArrowDown"&&(v.preventDefault(),v.stopPropagation(),e.moveDown())},sx:{cursor:"pointer","&:hover":{bgcolor:"action.hover"},"&.Mui-selected":{bgcolor:"action.selected"}},children:R.jsx(qy,{primary:m.description,secondary:`${m.key}`})},m.commandKey))}),r&&R.jsx("div",{"aria-live":"assertive",style:{position:"absolute",left:"-10000px",width:"1px",height:"1px",overflow:"hidden"},children:r})]})]}):null},hW=({label:e,shortcut:t})=>R.jsxs(We,{container:!0,spacing:1,alignItems:"center",sx:{py:1},children:[R.jsx(We,{size:{xs:12,sm:6,md:7},children:R.jsx(En,{variant:"body2",children:e})}),R.jsx(We,{size:{xs:12,sm:6,md:5},children:R.jsx(En,{variant:"body2",fontWeight:300,children:t})})]}),dW=()=>{const e=N.useId(),t=Qi("help"),{items:n}=t.state,r=()=>{t.toggle()};return R.jsxs(zf,{id:e,role:"dialog",open:!0,onClose:r,maxWidth:"sm",fullWidth:!0,disablePortal:!0,children:[R.jsx(We,{container:!0,component:Py,children:R.jsx(We,{size:"grow",children:R.jsx(En,{variant:"h6",fontWeight:"bold",children:"Keyboard Shortcuts"})})}),R.jsx(Vf,{children:R.jsx(We,{container:!0,spacing:1,children:n.map((i,s)=>R.jsxs(Ri.Fragment,{children:[R.jsx(We,{size:12,children:R.jsx(hW,{label:i.description,shortcut:i.key})},s),s!==n.length-1&&R.jsx(We,{size:12,children:R.jsx(Ju,{})})]},s))})}),R.jsx(We,{container:!0,component:Vy,children:R.jsx(We,{size:"grow",container:!0,spacing:1,justifyContent:"flex-end",sx:{px:2,py:1},children:R.jsx(We,{size:"auto",children:R.jsx(Ku,{variant:"contained",color:"primary",onClick:r,children:"Close"})})})})]})},pW=()=>{const e=N.useId(),{value:t}=Ii("review");return R.jsx("div",{id:e,children:R.jsx("input",{id:`${J.REVIEW_INPUT}-${e}`,defaultValue:t,onFocus:n=>n.target.setSelectionRange(0,0),size:50,type:"text",autoComplete:"off",autoFocus:!0})})};class Lh{static async validateApiKey(t,n){try{switch(t){case"OPENAI":return await this.validateOpenAiKey(n);case"ANTHROPIC_CLAUDE":return await this.validateAnthropicKey(n);case"GOOGLE_GEMINI":return await this.validateGeminiKey(n);default:return{isValid:!1,error:"Invalid model key"}}}catch(r){return{isValid:!1,error:r instanceof Error?r.message:"Unknown error occurred"}}}static async validateOpenAiKey(t){try{return(await fetch(this.OPENAI_API_URL,{method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}})).ok?{isValid:!0}:{isValid:!1,error:"Invalid API key"}}catch{return{isValid:!1,error:"Invalid API key"}}}static async validateAnthropicKey(t){try{return(await fetch(this.ANTHROPIC_API_URL,{method:"POST",headers:{"x-api-key":t,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"claude-3-sonnet-20240229",max_tokens:1,messages:[{role:"user",content:"test"}]})}).catch(()=>({ok:!1}))).ok?{isValid:!0}:{isValid:!1,error:"Invalid API key"}}catch{return{isValid:!1,error:"Invalid API key"}}}static async validateGeminiKey(t){try{return(await fetch(`${this.GEMINI_API_URL}?key=${t}`,{method:"GET"}).catch(()=>({ok:!1}))).ok?{isValid:!0}:{isValid:!1,error:"Invalid API key"}}catch{return{isValid:!1,error:"Invalid API key"}}}}O(Lh,"OPENAI_API_URL","https://api.openai.com/v1/models"),O(Lh,"ANTHROPIC_API_URL","https://api.anthropic.com/v1/messages"),O(Lh,"GEMINI_API_URL","https://generativelanguage.googleapis.com/v1beta/models");const Rh=10;function mW(e,t){const n=Su[e],r=n.options;return!t||!r.includes(t)?n.default:t}const Dr=({label:e,input:t,alignLabel:n="center"})=>R.jsxs(We,{container:!0,spacing:1,alignItems:n,className:"settings-grid-container",sx:{py:1},children:[R.jsx(We,{size:{xs:12,sm:6,md:4},sx:n==="flex-start"?{py:1}:void 0,children:R.jsx(En,{variant:"body2",fontWeight:"normal",children:e})}),R.jsx(We,{size:{xs:12,sm:6,md:8},children:t})]}),gW=({modelKey:e,modelSettings:t,onToggle:n,onChangeKey:r,onChangeVersion:i})=>{const s=mW(e,t.version),[l,u]=N.useState(!1),[f,h]=N.useState(null),p=()=>t.enabled?l?"Validating API key...":f===!1?`${t.name} API key is invalid`:f===!0?`${t.name} API key is valid`:"":"",m=async v=>{if(!t.enabled||!v.trim()){h(null);return}u(!0);try{const b=await Lh.validateApiKey(e,v);h(b.isValid)}catch{h(!1)}finally{u(!1)}};N.useEffect(()=>{const v=setTimeout(()=>{m(t.apiKey)},500);return()=>clearTimeout(v)},[t.apiKey,t.enabled,e]);const y=()=>{const v=Su[e];return v.options.map(b=>{const S=v.labels[b],T=t.version===b;return R.jsxs(ll,{value:b,className:`llm-model-setting-row-menu-item ${T?"selected":""}`,children:[T&&R.jsx(V6,{className:"llm-model-setting-row-check-icon"}),S]},b)})};return R.jsx(Dr,{label:t.name,input:R.jsxs(We,{container:!0,spacing:1,alignItems:"center",children:[R.jsx(We,{children:R.jsx(qP,{checked:t.enabled,onChange:v=>n(e,v.target.checked),slotProps:{input:{"aria-label":`Enable ${t.name}`}}})}),R.jsx(We,{size:7,children:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{disabled:!t.enabled,fullWidth:!0,size:"small",value:t.apiKey,onChange:v=>r(e,v.target.value),placeholder:`Enter ${t.name} API Key`,type:"password",error:f===!1,helperText:p(),slotProps:{input:{"aria-label":`${t.name} API Key`,"aria-describedby":`${e}-status`,endAdornment:R.jsx(jz,{position:"end",children:R.jsx("div",{id:`${e}-status`,role:"status","aria-live":"polite","aria-label":l?"Validating API key":f===!0?"API key is valid":f===!1?"API key is invalid":"",children:l?R.jsx(Ef,{size:20}):f===!0?R.jsx(V6,{color:"success"}):f===!1?R.jsx(oD,{color:"error"}):null})})}}})})}),R.jsx(We,{size:8,children:R.jsx(Wn,{fullWidth:!0,children:R.jsx(sc,{value:s,onChange:v=>{const b=v.target.value;i(e,b)},disabled:!t.enabled||!t.apiKey.trim()||!f,fullWidth:!0,size:"small",slotProps:{input:{"aria-label":`${t.name} Model Version`}},MenuProps:{disablePortal:!0,PaperProps:{className:"settings-menu-paper"}},children:y()})})})]})})},yW=()=>{const e=N.useId(),t=Qi("settings"),n=Qi("chat"),{general:r,llm:i}=t.state,[s,l]=N.useState(r),[u,f]=N.useState(i);N.useEffect(()=>{t.load()},[t]),N.useEffect(()=>{l(r),f(i)},[r,i]);const h=(A,L)=>{l(M=>({...M,[A]:L}))},p=(A,L)=>{f(M=>({...M,[A]:L}))},m=(A,L,M)=>{f(I=>({...I,models:{...I.models,[A]:{...I.models[A],[L]:L==="apiKey"&&typeof M=="string"?M.trim():M}}}))},y=()=>{t.reset();const{general:A,llm:L}=t.state;l(A),f(L)},v=()=>{t.toggle()},b=()=>{t.saveAndClose({general:s,llm:u}),n.refreshInitialMessage()},S=N.useCallback(A=>{A.stopPropagation()},[]),T=N.useCallback(A=>{A.stopPropagation(),p("expertiseLevel",A.target.value)},[p]),E=u.expertiseLevel!=="custom"||u.customInstruction.length>=Rh;return R.jsxs(zf,{id:e,role:"dialog","aria-label":"Settings",open:!0,maxWidth:"sm",fullWidth:!0,disablePortal:!0,disableEnforceFocus:!0,onClick:A=>A.stopPropagation(),className:"settings-dialog",children:[R.jsxs(Vf,{className:"settings-dialog-content",children:[R.jsx(We,{size:"grow",children:R.jsx(En,{variant:"h6",fontWeight:"bold",gutterBottom:!0,children:"General Settings"})}),R.jsxs(We,{container:!0,spacing:.5,children:[R.jsx(We,{size:12,children:R.jsx(Dr,{label:"Volume",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(DP,{value:s.volume,onChange:(A,L)=>h("volume",Number(L)),min:0,max:100,step:1,valueLabelDisplay:"auto",slotProps:{input:{"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Volume","aria-labelledby":"volume-label"}},className:"settings-slider-value-label"})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"Outline Color",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"color",size:"small",value:s.highlightColor,onChange:A=>h("highlightColor",A.target.value),slotProps:{input:{inputProps:{"aria-label":"Highlight Color"}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"High Contrast Mode",input:R.jsx(Wn,{children:R.jsx(al,{control:R.jsx(EN,{checked:s.highContrastMode,onChange:A=>h("highContrastMode",A.target.checked),size:"small"}),label:s.highContrastMode?"On":"Off",slotProps:{typography:{variant:"body2"}},"aria-label":"High Contrast Mode"})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"High Contrast Levels",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"number",size:"small",value:s.highContrastLevels,onChange:A=>h("highContrastLevels",Number(A.target.value)),slotProps:{input:{inputProps:{"aria-label":"High Contrast Levels",min:2,max:20}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"High Contrast Light Color",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"color",size:"small",value:s.highContrastLightColor,onChange:A=>h("highContrastLightColor",A.target.value),slotProps:{input:{inputProps:{"aria-label":"High Contrast Light Color"}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"High Contrast Dark Color",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"color",size:"small",value:s.highContrastDarkColor,onChange:A=>h("highContrastDarkColor",A.target.value),slotProps:{input:{inputProps:{"aria-label":"High Contrast Dark Color"}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"Braille Display Size",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"number",size:"small",value:s.brailleDisplaySize,onChange:A=>h("brailleDisplaySize",Number(A.target.value)),slotProps:{input:{inputProps:{"aria-label":"Braille Display Size"}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"Min Frequency (Hz)",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"number",size:"small",value:s.minFrequency,onChange:A=>h("minFrequency",Number(A.target.value)),slotProps:{input:{inputProps:{"aria-label":"Minimum Frequency"}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"Max Frequency (Hz)",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"number",size:"small",value:s.maxFrequency,onChange:A=>h("maxFrequency",Number(A.target.value)),slotProps:{input:{inputProps:{"aria-label":"Maximum Frequency"}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"Autoplay Duration (ms)",input:R.jsx(Wn,{fullWidth:!0,children:R.jsx(pi,{fullWidth:!0,type:"number",size:"small",value:s.autoplayDuration,onChange:A=>h("autoplayDuration",Number(A.target.value)),slotProps:{input:{inputProps:{"aria-label":"Autoplay Duration"}}}})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"ARIA Mode",input:R.jsx(Wn,{children:R.jsxs(a7,{row:!0,value:s.ariaMode,onChange:A=>h("ariaMode",A.target.value),"aria-label":"ARIA Mode",children:[R.jsx(al,{value:"assertive",control:R.jsx(ic,{size:"small"}),label:"Assertive"}),R.jsx(al,{value:"polite",control:R.jsx(ic,{size:"small"}),label:"Polite"})]})})})}),R.jsx(We,{size:12,children:R.jsx(Dr,{label:"Hover Mode",input:R.jsx(Wn,{children:R.jsxs(a7,{row:!0,value:s.hoverMode,onChange:A=>h("hoverMode",A.target.value),"aria-label":"Hover Mode",children:[R.jsx(al,{value:"off",control:R.jsx(ic,{size:"small"}),label:"Off"}),R.jsx(al,{value:"pointermove",control:R.jsx(ic,{size:"small"}),label:"Hover"}),R.jsx(al,{value:"click",control:R.jsx(ic,{size:"small"}),label:"Click"})]})})})})]}),R.jsx(We,{size:12,children:R.jsx(Ju,{className:"settings-divider"})}),R.jsxs(We,{container:!0,spacing:.5,className:"settings-section",children:[R.jsx(We,{size:12,children:R.jsx(En,{variant:"h6",fontWeight:"bold",gutterBottom:!0,className:"settings-section-title",children:"LLM Settings"})}),Object.keys(u.models).map(A=>{const L=u.models[A];return R.jsx(We,{size:12,className:"settings-model-row",children:R.jsx(gW,{modelKey:A,modelSettings:L,onToggle:(M,I)=>m(M,"enabled",I),onChangeKey:(M,I)=>m(M,"apiKey",I),onChangeVersion:(M,I)=>m(M,"version",I)})},A)}),R.jsx(We,{size:12,className:"settings-row",children:R.jsx(Wn,{fullWidth:!0,size:"small",className:"settings-model-select",children:R.jsx(Dr,{label:"Expertise Level",input:R.jsxs(sc,{value:u.expertiseLevel,onChange:T,onClick:S,slotProps:{input:{"aria-label":"Expertise Level"}},MenuProps:{disablePortal:!0,PaperProps:{className:"llm-model-setting-select-menu"}},children:[R.jsx(ll,{value:"basic",children:"Basic"}),R.jsx(ll,{value:"intermediate",children:"Intermediate"}),R.jsx(ll,{value:"advanced",children:"Advanced"}),R.jsx(ll,{value:"custom",children:"Custom"})]})})})}),u.expertiseLevel==="custom"&&R.jsx(We,{size:12,children:R.jsxs(We,{container:!0,spacing:1,alignItems:"flex-start",sx:{py:1},children:[R.jsx(We,{size:12,sx:{py:1},children:R.jsx(En,{variant:"body2",fontWeight:"normal",children:"Custom Instructions"})}),R.jsx(We,{size:12,children:R.jsx(Wn,{fullWidth:!0,children:R.jsx(Ty,{minRows:3,maxRows:6,value:u.customInstruction,onChange:A=>p("customInstruction",A.target.value),style:{width:"100%",padding:"8px",border:"1px solid #ccc",borderRadius:"4px"},placeholder:"Enter custom instruction...","aria-label":"Custom Instructions"})})}),u.customInstruction.length{const{enabled:e,announce:t,value:n,revision:r,message:i}=Ii("text"),{rotor_value:s}=Ii("rotor"),l=Ii("settings"),u=e&&n||"",f=typeof i=="string"?i:"",h=f.trim().length>0?f:t&&u?u:"",p=f.trim().length>0?f:u;return R.jsxs("div",{children:[R.jsx("div",{id:J.TEXT_CONTAINER,children:p&&p.trim().length>0&&R.jsx("p",{children:p})}),h&&R.jsx("div",{role:"alert",style:vW,children:h},r),R.jsx("div",{id:J.ROTOR_AREA,"aria-live":l.general.ariaMode,children:s})]})},bW=({plot:e})=>{const{tooltip:t}=Ii("display"),[n,r]=N.useState(!1),i=N.useRef({x:0,y:0}),s=N.useRef(null),l=N.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(i.current.x,i.current.y,0,0)}),[]);return N.useEffect(()=>{if(!e)return;const u=p=>{var m,y;i.current={x:p.clientX,y:p.clientY},(y=(m=s.current)==null?void 0:m.update)==null||y.call(m),r(!0)},f=()=>r(!0),h=()=>r(!1);return e.addEventListener(ya.MOUSE_MOVE,u),e.addEventListener(ya.MOUSE_ENTER,f),e.addEventListener(ya.MOUSE_LEAVE,h),()=>{e.removeEventListener(ya.MOUSE_MOVE,u),e.removeEventListener(ya.MOUSE_ENTER,f),e.removeEventListener(ya.MOUSE_LEAVE,h)}},[e]),R.jsx(BP,{title:t.value,open:n,placement:"top",arrow:!0,slotProps:{popper:{popperRef:s,anchorEl:l}},children:R.jsx(Bn,{sx:{display:"none"},children:"TooltipAnchor"})})};function SW(e){return{p:1.5,border:e?2:1,borderColor:e?"primary.main":"divider",borderRadius:1,mb:.5,cursor:"pointer",bgcolor:e?"action.selected":"transparent",transition:"all 0.2s ease","&:hover":{bgcolor:"action.hover"},"&:focus":{outline:"none",borderColor:"primary.main",bgcolor:"action.selected"}}}const wW=()=>{const e=Qi("goToExtrema"),t=Ii("goToExtrema"),n=N.useRef(null),r=N.useRef(null),i=N.useRef(null),s=N.useRef(null),[l,u]=N.useState(""),[f,h]=N.useState(!1),[p,m]=N.useState([]),[y,v]=N.useState(-1),b=N.useRef(null),S=N.useRef(null),T=N.useRef(null),E=N.useRef(null);N.useEffect(()=>{i.current&&i.current.focus()},[]);const A=N.useMemo(()=>e.getAvailableXValues(),[e]);N.useEffect(()=>{if(l.trim()==="")m(A);else{const P=l.toLowerCase();m(A.filter(G=>String(G).toLowerCase().includes(P)))}f&&v(P=>P<0?0:Math.min(P,Math.max(0,A.length-1)))},[l,A,f]);const L=y>=0&&p[y]!==void 0?String(p[y]):void 0,M={input:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":"x-value-listbox","aria-expanded":f,"aria-activedescendant":y>=0?`option-${y}`:void 0,"aria-valuetext":L,"aria-label":"Search and select X value",endAdornment:R.jsx(Fu,{"aria-label":f?"Close dropdown":"Open dropdown",size:"small",onClick:P=>{P.stopPropagation(),h(!f)},children:R.jsx(lD,{})})}};N.useEffect(()=>{if(E.current){const P=L??"";E.current.textContent=P}},[y,L]),N.useEffect(()=>{if(n.current&&r.current){const P=r.current,G=n.current;G.focus();const B=P.getBoundingClientRect(),te=G.getBoundingClientRect();te.bottom>B.bottom?G.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}):te.top{if(f&&y>=0&&T.current){const P=T.current.querySelector(`#option-${y}`);P&&P.scrollIntoView({block:"nearest"})}},[y,f]);const I=P=>{var B;const G=(B=e.activeContext)==null?void 0:B.active;G&&_(G)&&G.navigateToExtrema(P),e.hide()};function _(P){return P!==null&&typeof P=="object"&&"navigateToExtrema"in P&&typeof P.navigateToExtrema=="function"}const V=()=>{E.current&&(E.current.textContent=""),e.hide()},W=P=>{var B;const G=(B=e.activeContext)==null?void 0:B.active;G&&K(G)&&(G.moveToXValue(P),h(!1),v(-1),u(""),e.hide())};function K(P){return P!==null&&typeof P=="object"&&"moveToXValue"in P&&typeof P.moveToXValue=="function"}const U=()=>{S.current?S.current.focus():b.current&&b.current.focus()},Z=P=>{E.current&&(E.current.textContent=P)},D=P=>{if(P.key==="ArrowDown")if(P.preventDefault(),P.stopPropagation(),t.selectedIndex===t.targets.length-1)U(),h(!0),v(0),Z("Moved to search. Type to filter X values.");else{e.moveDown();const G=t.targets[t.selectedIndex+1];Z(`Selected: ${G.label}`)}else if(P.key==="ArrowUp")if(P.preventDefault(),P.stopPropagation(),t.selectedIndex===0)Z("At first extrema option");else{e.moveUp();const G=t.targets[t.selectedIndex-1];Z(`Selected: ${G.label}`)}else if(P.key==="Enter"&&(P.preventDefault(),P.stopPropagation(),t.selectedIndex{if(P.key==="Enter")P.preventDefault(),P.stopPropagation(),y>=0&&p[y]!==void 0&&W(p[y]);else if(P.key==="ArrowDown")P.preventDefault(),P.stopPropagation(),y===p.length-1?Z("At last search result"):(v(G=>Math.min(G+1,p.length-1)),p[y+1]&&Z(`Selected: ${p[y+1]}`));else if(P.key==="ArrowUp")if(P.preventDefault(),P.stopPropagation(),y===0){h(!1),v(-1);const G=t.targets[t.selectedIndex];Z(`Returning to extrema options: ${G.label}`),n.current&&n.current.focus()}else v(G=>Math.max(0,G-1)),p[y-1]&&Z(`Selected: ${p[y-1]}`)};return t.visible&&t.targets.length>0?R.jsxs(R.Fragment,{children:[R.jsx(Bn,{sx:{position:"fixed",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0, 0, 0, 0.5)",zIndex:9999},onClick:V,"aria-hidden":"true"}),R.jsxs(Bn,{ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"go-to-extrema-title","aria-describedby":"go-to-extrema-description",tabIndex:0,sx:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",bgcolor:"background.paper",border:1,borderColor:"divider",borderRadius:2,p:3,boxShadow:3,zIndex:1e4,minWidth:300,maxHeight:"80vh",outline:"none"},children:[R.jsxs(Bn,{id:"go-to-extrema-title",sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[R.jsx(En,{variant:"h6",component:"h3",sx:{m:0,fontWeight:600},children:"Go To Extrema"}),R.jsx(Fu,{onClick:V,"aria-label":"Close dialog",size:"small",children:R.jsx(P6,{})})]}),R.jsx(Bn,{id:"go-to-extrema-description",sx:{mb:2},children:R.jsx(En,{variant:"body2",color:"text.secondary",sx:{m:0},children:t.description||"Navigate to statistical extremes"})}),R.jsxs(Bn,{ref:r,role:"listbox","aria-label":"Extrema targets",onKeyDown:D,sx:{maxHeight:300,overflowY:"auto",border:1,borderColor:"divider",borderRadius:1,p:1},children:[t.targets.map((P,G)=>R.jsx(Bn,{ref:G===t.selectedIndex?n:null,id:`extrema-target-${G}`,onClick:()=>I(P),role:"option","aria-selected":t.selectedIndex===G,"aria-label":`${P.label.split(" at ")[0]} Value: ${P.value.toFixed(2)} at ${P.label.split(" at ")[1]}`,tabIndex:0,sx:SW(t.selectedIndex===G),children:R.jsx(En,{variant:"body2",sx:{fontWeight:600},children:`${P.label.split(" at ")[0]} Value: ${P.value.toFixed(2)} at ${P.label.split(" at ")[1]}`})},`${P.segment}-${P.type}-${P.pointIndex}`)),A.length>0&&R.jsxs(Bn,{ref:s,id:"search-input-option",role:"option","aria-selected":t.selectedIndex===t.targets.length,"aria-label":"Search and navigate to specific X value","aria-expanded":f,"aria-controls":"x-value-listbox",tabIndex:0,sx:{p:1.5,borderRadius:1,mb:.5,border:t.selectedIndex===t.targets.length?2:1,borderColor:t.selectedIndex===t.targets.length?"primary.main":"divider",bgcolor:t.selectedIndex===t.targets.length?"action.selected":"transparent",position:"relative"},onClick:()=>{U(),h(!0),v(0)},children:[R.jsx(pi,{ref:b,inputRef:S,label:"Search X values",placeholder:`Type to search ${A.length} values`,fullWidth:!0,variant:"outlined",size:"small",value:l,onChange:P=>{u(P.target.value),h(!0),y<0&&v(0)},onFocus:()=>{h(!0),y<0&&v(0)},onKeyDown:q,slotProps:M}),f&&p.length>0&&R.jsx(Hp,{ref:T,id:"x-value-listbox",role:"listbox","aria-label":"Available X values","aria-hidden":!f,sx:{position:"absolute",top:"100%",left:0,right:0,bgcolor:"background.paper",border:1,borderColor:"divider",borderRadius:1,maxHeight:180,overflowY:"auto",zIndex:2,boxShadow:2,mt:.5},children:p.map((P,G)=>R.jsx(oV,{id:`option-${G}`,role:"option","aria-selected":y===G,"aria-label":String(P),tabIndex:0,onClick:()=>W(P),onKeyDown:B=>{B.key==="Enter"?(B.preventDefault(),B.stopPropagation(),W(P)):B.key==="ArrowDown"?(B.preventDefault(),B.stopPropagation(),v(te=>Math.min(te+1,p.length-1))):B.key==="ArrowUp"&&(B.preventDefault(),B.stopPropagation(),v(te=>Math.max(te-1,0)))},sx:{cursor:"pointer",py:1,px:2,bgcolor:y===G?"action.selected":"transparent","&:hover":{bgcolor:"action.hover"}},children:R.jsx(qy,{primary:String(P)})},`${P}-${G}`))}),R.jsx("div",{ref:E,id:"sr-active-option-announcer","aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",left:"-10000px",width:"1px",height:"1px",overflow:"hidden"}})]})]})]})]}):null},EW=({plot:e})=>{const{focus:t,tooltip:n}=Ii("display"),r=i=>{switch(i){case"BRAILLE":return R.jsx(LM,{});case"CHAT":return R.jsx(uW,{});case"COMMAND_PALETTE":return R.jsx(fW,{});case"GO_TO_EXTREMA":return R.jsx(wW,{});case"HELP":return R.jsx(dW,{});case"REVIEW":return R.jsx(pW,{});case"SETTINGS":return R.jsx(yW,{});default:return null}};return R.jsxs(R.Fragment,{children:[n.visible&&R.jsx(bW,{plot:e}),R.jsx(xW,{}),r(t)]})};function TW({plot:e,store:t,contextValue:n}){return R.jsx(EM,{store:t,children:R.jsx(v5.Provider,{value:n,children:R.jsx(EW,{plot:e})})})}function I2({data:e,children:t}){const n=N.useRef(null);n.current===null&&(n.current=lM());const r=n.current,{plotRef:i,figureRef:s,contextValue:l,onFocusIn:u,onFocusOut:f}=sM(e,r);return R.jsx("article",{id:`maidr-article-${e.id}`,children:R.jsxs("figure",{ref:s,id:`maidr-figure-${e.id}`,onFocus:u,onBlur:f,children:[R.jsx("div",{ref:i,tabIndex:0,style:{width:"fit-content"},children:t}),l&&i.current&&R.jsx("div",{id:`react-container-${e.id}`,children:R.jsx(TW,{plot:i.current,store:r,contextValue:l})})]})})}const CW={id:"bar",title:"The Number of Tips by Day",subplots:[[{layers:[{id:"0",type:jt.BAR,selectors:'path[clip-path="url(#p0f12ed050e)"]',axes:{x:"Day",y:"Count",format:{x:{function:"const days = {Sun: 'Sunday', Mon: 'Monday', Tue: 'Tuesday', Wed: 'Wednesday', Thur: 'Thursday', Fri: 'Friday', Sat: 'Saturday'}; return days[value] || value"},y:{type:"fixed",decimals:1}}},data:[{x:"Sat",y:87},{x:"Sun",y:76},{x:"Thur",y:62},{x:"Fri",y:19}]}]}]]},AW=` + + + + 2024-01-18T11:51:31.025970 + image/svg+xml + + + Matplotlib v3.8.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- Sat --> + + + + + + + + + + + + + + + + + + + + \x3C!-- Sun --> + + + + + + + + + + + + + + + + + + + \x3C!-- Thur --> + + + + + + + + + + + + + + + + + + + + + \x3C!-- Fri --> + + + + + + + + + + + + + \x3C!-- Day --> + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- 0 --> + + + + + + + + + + + + + + + + \x3C!-- 20 --> + + + + + + + + + + + + + + + + + \x3C!-- 40 --> + + + + + + + + + + + + + + + + + \x3C!-- 60 --> + + + + + + + + + + + + + + + + + \x3C!-- 80 --> + + + + + + + + + + + \x3C!-- Count --> + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- The Number of Tips by Day --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `,kW={id:"151f3961-0445-4713-94f4-e2059c74c53a",subplots:[[{id:"d54fac17-e805-4ade-8b78-f110c534984c",layers:[{id:"c4ac3f68-6266-4f35-8125-33d8cdff1e9a",type:jt.LINE,title:`Line: Total Passengers per Year +From the Flights Dataset`,axes:{x:"Year",y:"Total Passengers (Thousands)"},data:[[{x:1949,y:1520},{x:1950,y:1676},{x:1951,y:2042},{x:1952,y:2364},{x:1953,y:2700},{x:1954,y:2867},{x:1955,y:3408},{x:1956,y:3939},{x:1957,y:4421},{x:1958,y:4572},{x:1959,y:5140},{x:1960,y:5714}]],selectors:["g[id='maidr-bc200021-0bee-4a65-b89e-5bc56843df54'] path"]}]}]]},MW=` + + + + 2025-09-28T20:47:59.778672 + image/svg+xml + + + Matplotlib v3.9.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- 1950 --> + + + + + + + + + + + + + + + + + + + + + + \x3C!-- 1952 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 1954 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 1956 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 1958 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 1960 --> + + + + + + + + + + \x3C!-- Year --> + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- 2000 --> + + + + + + + + + + + + + + + + \x3C!-- 3000 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 4000 --> + + + + + + + + + + + + + + + + \x3C!-- 5000 --> + + + + + + + + + + \x3C!-- Total Passengers (Thousands) --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- Total Passengers per Year --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- From the Flights Dataset --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `,LW={id:"a6b8ffb5-9a9d-44be-9151-439a5373e405",subplots:[[{id:"599348d6-602e-4fde-a4ca-504d759db44a",layers:[{id:"c8cdf051-8c1b-4427-9589-39677dd422e3",type:jt.SMOOTH,title:"KDE: Plot of Random Data",axes:{x:"Value",y:"Density"},data:[[{x:-4.090659720653128,y:3130990414432069e-20,svg_x:70.71000000000001,svg_y:390.01265590666407},{x:-4.046474878482817,y:4940157954895194e-20,svg_x:72.38738693467339,svg_y:389.9968557796951},{x:-4.002290036312505,y:7607327310168e-17,svg_x:74.06477386934678,svg_y:389.9735624066279},{x:-3.9581051941421945,y:.00011432974593037363,svg_x:75.74216080402013,svg_y:389.94015161881754},{x:-3.9139203519718837,y:.00016769783590326188,svg_x:77.41954773869348,svg_y:389.89354329875846},{x:-3.8697355098015724,y:.00024007344105625092,svg_x:79.09693467336685,svg_y:389.8303350150977},{x:-3.825550667631261,y:.0003354436629372707,svg_x:80.77432160804022,svg_y:389.74704468509356},{x:-3.7813658254609503,y:.0004574762153518218,svg_x:82.45170854271358,svg_y:389.64046915909194},{x:-3.737180983290639,y:.0006089919549181578,svg_x:84.12909547738695,svg_y:389.5081448790347},{x:-3.6929961411203283,y:.0007913668341964648,svg_x:85.80648241206032,svg_y:389.34887017483504},{x:-3.648811298950017,y:.001003941753084901,svg_x:87.4838693467337,svg_y:389.1632206629054},{x:-3.604626456779706,y:.0012435452535690175,svg_x:89.16125628140705,svg_y:388.95396609442633},{x:-3.560441614609395,y:.0015042461494080136,svg_x:90.83864321608043,svg_y:388.7262863929583},{x:-3.5162567724390836,y:.0017774433516954526,svg_x:92.5160301507538,svg_y:388.4876932064695},{x:-3.472071930268773,y:.002052364207035492,svg_x:94.19341708542716,svg_y:388.2475946902381},{x:-3.4278870880984615,y:.002316982220368148,svg_x:95.87080402010052,svg_y:388.0164940256824},{x:-3.3837022459281507,y:.002559288528300005,svg_x:97.5481909547739,svg_y:387.8048789958368},{x:-3.3395174037578395,y:.002768773463206442,svg_x:99.22557788944727,svg_y:387.6219280808119},{x:-3.2953325615875286,y:.002937912950730226,svg_x:100.90296482412062,svg_y:387.4742123320726},{x:-3.2511477194172174,y:.0030634264478196717,svg_x:102.580351758794,svg_y:387.36459676878286},{x:-3.206962877246906,y:.003147090269864315,svg_x:104.25773869346736,svg_y:387.2915300692401},{x:-3.1627780350765953,y:.003195954713735132,svg_x:105.93512562814071,svg_y:387.2488549493211},{x:-3.118593192906284,y:.003221916448122887,svg_x:107.61251256281409,svg_y:387.226181609761},{x:-3.0744083507359727,y:.0032407201625036775,svg_x:109.28989949748747,svg_y:387.2097596329092},{x:-3.030223508565662,y:.0032705799740616803,svg_x:110.96728643216083,svg_y:387.1836819588776},{x:-2.986038666395351,y:.003330695294811018,svg_x:112.6446733668342,svg_y:387.1311810334864},{x:-2.94185382422504,y:.003439966724407699,svg_x:114.32206030150756,svg_y:387.03575026640186},{x:-2.8976689820547286,y:.003616184369685506,svg_x:115.99944723618094,svg_y:386.8818529016033},{x:-2.8534841398844177,y:.0038758663520965255,svg_x:117.67683417085428,svg_y:386.6550630547879},{x:-2.8092992977141065,y:.004234785019886466,svg_x:119.35422110552767,svg_y:386.3416061528822},{x:-2.765114455543795,y:.004709059027274733,svg_x:121.03160804020102,svg_y:385.92740518104165},{x:-2.7209296133734844,y:.005316543236077628,svg_x:122.70899497487441,svg_y:385.39686683033267},{x:-2.6767447712031736,y:.006078147298138619,svg_x:124.38638190954775,svg_y:384.7317299310948},{x:-2.6325599290328623,y:.007018683279955856,svg_x:126.06376884422113,svg_y:383.9103251911113},{x:-2.588375086862551,y:.00816689653076014,svg_x:127.7411557788945,svg_y:382.9075482373789},{x:-2.54419024469224,y:.00955447058922441,svg_x:129.41854271356786,svg_y:381.69572866775593},{x:-2.500005402521929,y:.011213998114074414,svg_x:131.09592964824122,svg_y:380.2464021120498},{x:-2.4558205603516177,y:.013176142299326211,svg_x:132.7733165829146,svg_y:378.5327892727166},{x:-2.411635718181307,y:.015466432767102797,svg_x:134.45070351758795,svg_y:376.53259418976427},{x:-2.367450876010996,y:.018102298264606652,svg_x:136.12809045226132,svg_y:374.23059569585735},{x:-2.3232660338406848,y:.021090992314206837,svg_x:137.8054773869347,svg_y:371.6204590225546},{x:-2.2790811916703735,y:.024428988799018718,svg_x:139.48286432160808,svg_y:368.7052636576999},{x:-2.2348963495000627,y:.02810320766963468,svg_x:141.16025125628144,svg_y:365.49643289055643},{x:-2.1907115073297514,y:.03209410150887552,svg_x:142.8376381909548,svg_y:362.01103820104174},{x:-2.14652666515944,y:.03638024637711627,svg_x:144.51502512562817,svg_y:358.2677899052919},{x:-2.1023418229891293,y:.04094371272125957,svg_x:146.1924120603015,svg_y:354.2823465428893},{x:-2.058156980818818,y:.045775230098893754,svg_x:147.8697989949749,svg_y:350.06280433288975},{x:-2.013972138648507,y:.05087807783074991,svg_x:149.54718592964826,svg_y:345.60629932362684},{x:-1.969787296478196,y:.05626977565145946,svg_x:151.22457286432166,svg_y:340.89753088508985},{x:-1.9256024543078851,y:.06198100985542495,svg_x:152.901959798995,svg_y:335.909699545316},{x:-1.8814176121375739,y:.06805175414252536,svg_x:154.57934673366836,svg_y:330.6078947988169},{x:-1.837232769967263,y:.07452512761687477,svg_x:156.2567336683417,svg_y:324.9544591426496},{x:-1.7930479277969518,y:.08144004739823013,svg_x:157.9341206030151,svg_y:318.9154048216907},{x:-1.7488630856266405,y:.08882405659950532,svg_x:159.61150753768845,svg_y:312.46667742022527},{x:-1.7046782434563297,y:.09668775184442237,svg_x:161.28889447236185,svg_y:305.5990225161777},{x:-1.6604934012860184,y:.10502196952360994,svg_x:162.9662814070352,svg_y:298.320443027372},{x:-1.6163085591157076,y:.11379835840206126,svg_x:164.64366834170855,svg_y:290.65569913233304},{x:-1.5721237169453963,y:.12297327358409418,svg_x:166.32105527638194,svg_y:282.6429075271602},{x:-1.527938874775085,y:.13249421999549524,svg_x:167.9984422110553,svg_y:274.3279140950715},{x:-1.4837540326047742,y:.14230750717421917,svg_x:169.67582914572867,svg_y:265.75760869553903},{x:-1.439569190434463,y:.15236547832193598,svg_x:171.35321608040204,svg_y:256.97361176711854},{x:-1.3953843482641521,y:.1626317155316665,svg_x:173.03060301507543,svg_y:248.00772841029658},{x:-1.3511995060938409,y:.17308299772117272,svg_x:174.70798994974876,svg_y:238.8802384520938},{x:-1.30701466392353,y:.18370742466476686,svg_x:176.38537688442213,svg_y:229.60153479823182},{x:-1.2628298217532188,y:.19449889202295975,svg_x:178.0627638190955,svg_y:220.17694859338522},{x:-1.2186449795829075,y:.2054488548588255,svg_x:179.7401507537689,svg_y:210.61394244592802},{x:-1.1744601374125967,y:.2165369037626608,svg_x:181.41753768844222,svg_y:200.9303406456211},{x:-1.1302752952422854,y:.22772198721362596,svg_x:183.09492462311562,svg_y:191.1619949987251},{x:-1.0860904530719746,y:.23893609109306826,svg_x:184.77231155778895,svg_y:181.36830474198078},{x:-1.0419056109016633,y:.2500818398791641,svg_x:186.44969849246235,svg_y:171.6343115077452},{x:-.9977207687313525,y:.2610348806492031,svg_x:188.12708542713568,svg_y:162.06861728692533},{x:-.9535359265610412,y:.2716511589935541,svg_x:189.80447236180905,svg_y:152.79703010513026},{x:-.90935108439073,y:.28177842263187014,svg_x:191.48185929648247,svg_y:143.95251749062885},{x:-.8651662422204192,y:.29127061621789874,svg_x:193.1592462311558,svg_y:135.6626349607336},{x:-.8209814000501079,y:.30000335676177387,svg_x:194.83663316582917,svg_y:128.03601076510688},{x:-.7767965578797971,y:.3078884629472529,svg_x:196.51402010050253,svg_y:121.14965689748414},{x:-.7326117157094858,y:.3148855717629324,svg_x:198.1914070351759,svg_y:115.03882386345772},{x:-.6884268735391745,y:.32100919334303957,svg_x:199.8687939698493,svg_y:109.69083942798028},{x:-.6442420313688637,y:.3263300819174363,svg_x:201.54618090452263,svg_y:105.04391131419479},{x:-.6000571891985524,y:.3309704701335142,svg_x:203.223567839196,svg_y:100.99128924578093},{x:-.5558723470282416,y:.33509344713360784,svg_x:204.9009547738694,svg_y:97.39054146346182},{x:-.5116875048579304,y:.3388874734755469,svg_x:206.57834170854272,svg_y:94.07707841564785},{x:-.46750266268761953,y:.34254763379388015,svg_x:208.25572864321612,svg_y:90.88052550039473},{x:-.42331782051730826,y:.3462556531994323,svg_x:209.93311557788948,svg_y:87.64217548024303},{x:-.379132978346997,y:.35016088460650785,svg_x:211.61050251256287,svg_y:84.23159295015594},{x:-.3349481361766862,y:.35436437876964516,svg_x:213.28788944723618,svg_y:80.56052656158184},{x:-.2907632940063749,y:.3589077829052686,svg_x:214.96527638190958,svg_y:76.59260426534928},{x:-.24657845183606408,y:.36376822627732547,svg_x:216.6426633165829,svg_y:72.34779991824182},{x:-.20239360966575282,y:.3688596280403082,svg_x:218.32005025125628,svg_y:67.90129109548116},{x:-.158208767495442,y:.37404011136746473,svg_x:219.9974371859297,svg_y:63.376984059284666},{x:-.11402392532513073,y:.3791245353462726,svg_x:221.67482412060306,svg_y:58.93656919263699},{x:-.0698390831548199,y:.3839006470696864,svg_x:223.35221105527637,svg_y:54.76541478265602},{x:-.025654240984508192,y:.3881470589083364,svg_x:225.0295979899498,svg_y:51.05686680616102},{x:.01853060118580263,y:.3916511783707175,svg_x:226.70698492462313,svg_y:47.996590121895395},{x:.06271544335611345,y:.3942253366467558,svg_x:228.3843718592965,svg_y:45.748482818950734},{x:.10690028552642428,y:.3957196363213503,svg_x:230.06175879396986,svg_y:44.44345583497918},{x:.151085127696736,y:.39603042641955505,svg_x:231.73914572864328,svg_y:44.17203138685543},{x:.1952699698670468,y:.3951037788258021,svg_x:233.41653266331664,svg_y:44.98130688563249},{x:.23945481203735763,y:.3929338567226222,svg_x:235.09391959798995,svg_y:46.87637983914471},{x:.28363965420766934,y:.38955660570240125,svg_x:236.77130653266335,svg_y:49.82585763664865},{x:.32782449637798017,y:.3850397242779236,svg_x:238.4486934673367,svg_y:53.770616671641264},{x:.372009338548291,y:.37947032874379705,svg_x:240.12608040201007,svg_y:58.63457507303636},{x:.4161941807186018,y:.372942049436482,svg_x:241.80346733668344,svg_y:64.33596201689767},{x:.4603790228889135,y:.3655434111757971,svg_x:243.4808542713568,svg_y:70.79746551515571},{x:.5045638650592243,y:.3573492075739796,svg_x:245.1582412060302,svg_y:77.95376554943806},{x:.5487487072295352,y:.3484161627521771,svg_x:246.83562814070353,svg_y:85.75532285396146},{x:.5929335493998469,y:.3387835224962189,svg_x:248.51301507537693,svg_y:94.16786263740713},{x:.6371183915701577,y:.3284784205214732,svg_x:250.19040201005024,svg_y:103.16768802602685},{x:.6813032337404685,y:.31752505393460234,svg_x:251.86778894472366,svg_y:112.7336667946952},{x:.7254880759107802,y:.3059560185697742,svg_x:253.54517587939702,svg_y:122.83733179998868},{x:.7696729180810911,y:.29382372648592153,svg_x:255.2225628140704,svg_y:133.43290965899396},{x:.8138577602514019,y:.2812097378049739,svg_x:256.8999497487437,svg_y:144.44917091101868},{x:.8580426024217127,y:.26823011005451347,svg_x:258.5773366834171,svg_y:155.78475823947977},{x:.9022274445920244,y:.25503545937694905,svg_x:260.2547236180905,svg_y:167.3081330156758},{x:.9464122867623352,y:.241805244640202,svg_x:261.93211055276385,svg_y:178.8625671956059},{x:.9905971289326461,y:.2287366979512775,svg_x:263.60949748743724,svg_y:190.2758107104763},{x:1.0347819711029578,y:.21602969136412215,svg_x:265.2868844221106,svg_y:201.37330792852399},{x:1.0789668132732686,y:.20386951697380692,svg_x:266.96427135678397,svg_y:211.99323643347245},{x:1.1231516554435794,y:.19240996017254688,svg_x:268.64165829145725,svg_y:222.00128977394942},{x:1.1673364976138902,y:.18175909718993138,svg_x:270.3190452261307,svg_y:231.3030809950905},{x:1.211521339784202,y:.17196992964293195,svg_x:271.9964321608041,svg_y:239.85232183121636},{x:1.2557061819545128,y:.16303731457455878,svg_x:273.67381909547737,svg_y:247.65350381622972},{x:1.2998910241248236,y:.15490174451017114,svg_x:275.35120603015076,svg_y:254.75859702111066},{x:1.3440758662951353,y:.14745951009473,svg_x:277.02859296482416,svg_y:261.25817464822086},{x:1.3882607084654461,y:.14057779975761067,svg_x:278.70597989949755,svg_y:267.268225937467},{x:1.432445550635757,y:.13411252411764132,svg_x:280.38336683417083,svg_y:272.9145894563934},{x:1.4766303928060678,y:.12792623967307265,svg_x:282.0607537688443,svg_y:278.31729968108544},{x:1.5208152349763795,y:.12190357217991503,svg_x:283.7381407035176,svg_y:283.57711719137956},{x:1.5650000771466903,y:.11596201041823524,svg_x:285.41552763819095,svg_y:288.76610207691124},{x:1.6091849193170011,y:.11005677379190186,svg_x:287.09291457286434,svg_y:293.92336288284264},{x:1.6533697614873129,y:.1041794959941977,svg_x:288.7703015075377,svg_y:299.05620621320224},{x:1.6975546036576237,y:.09835151283339667,svg_x:290.44768844221113,svg_y:304.1459987202113},{x:1.7417394458279345,y:.09261339706378388,svg_x:292.1250753768844,svg_y:309.1573067220882},{x:1.7859242879982453,y:.08701289282645258,svg_x:293.8024623115578,svg_y:314.04843350062254},{x:1.830109130168557,y:.08159348966267956,svg_x:295.4798492462312,svg_y:318.7813980364436},{x:1.8742939723388679,y:.0763855528957766,svg_x:297.15723618090453,svg_y:323.32968117347247},{x:1.9184788145091787,y:.07140128599983042,svg_x:298.8346231155779,svg_y:327.68262516798353},{x:1.9626636566794904,y:.06663398846512668,svg_x:300.51201005025126,svg_y:331.8460818220832},{x:2.006848498849801,y:.06206125598316489,svg_x:302.18939698492466,svg_y:335.8396176441818},{x:2.051033341020112,y:.05765109900480679,svg_x:303.866783919598,svg_y:339.6911702866393},{x:2.095218183190423,y:.05336953822680194,svg_x:305.54417085427133,svg_y:343.4304151274219},{x:2.1394030253607346,y:.04918812043192671,svg_x:307.2215577889447,svg_y:347.08220140988345},{x:2.1835878675310454,y:.04508997402881915,svg_x:308.8989447236181,svg_y:350.66126371662773},{x:2.227772709701356,y:.04107342782164594,svg_x:310.5763316582915,svg_y:354.1690615645742},{x:2.271957551871668,y:.03715275152929256,svg_x:312.25371859296484,svg_y:357.5931326822549},{x:2.3161423940419787,y:.03335613121151739,svg_x:313.93110552763824,svg_y:360.9088611447775},{x:2.3603272362122896,y:.029721463665121975,svg_x:315.6084924623116,svg_y:364.0831502826634},{x:2.4045120783826004,y:.026290863920869323,svg_x:317.2858793969849,svg_y:367.0792194872361},{x:2.448696920552912,y:.02310489079809747,svg_x:318.9632663316583,svg_y:369.8616472466169},{x:2.492881762723223,y:.020197411492372003,svg_x:320.6406532663317,svg_y:372.4008560906129},{x:2.5370666048935337,y:.017591789775999962,svg_x:322.3180402010051,svg_y:374.67644157570675},{x:2.5812514470638455,y:.01529876128924196,svg_x:323.9954271356784,svg_y:376.67902787155583},{x:2.6254362892341563,y:.013316029334183386,svg_x:325.67281407035176,svg_y:378.4106207691025},{x:2.669621131404467,y:.01162934173930686,svg_x:327.35020100502516,svg_y:379.88366721505133},{x:2.713805973574779,y:.010214636781484931,svg_x:329.02758793969855,svg_y:381.1191811990967},{x:2.7579908157450896,y:.009040787223736605,svg_x:330.7049748743719,svg_y:382.1443472846079},{x:2.8021756579154005,y:.008072511565588254,svg_x:332.3823618090452,svg_y:382.9899781063835},{x:2.8463605000857113,y:.00727312623331302,svg_x:334.0597487437186,svg_y:383.6881107814732},{x:2.890545342256023,y:.006606939789464267,svg_x:335.737135678392,svg_y:384.2699159577439},{x:2.934730184426334,y:.006041203199682887,svg_x:337.41452261306534,svg_y:384.7639945739927},{x:2.9789150265966446,y:.0055476053537744045,svg_x:339.0919095477387,svg_y:385.1950717662671},{x:3.0230998687669564,y:.005103334328184673,svg_x:340.76929648241213,svg_y:385.583070028228},{x:3.067284710937267,y:.00469172161203444,svg_x:342.44668341708547,svg_y:385.942546584808},{x:3.111469553107578,y:.004302467273663569,svg_x:344.1240703517588,svg_y:386.2824967459695},{x:3.155654395277889,y:.0039314288367225045,svg_x:345.8014572864322,svg_y:386.6065382889954},{x:3.1998392374482005,y:.00357996005874073,svg_x:347.4788442211056,svg_y:386.9134889275373},{x:3.2440240796185114,y:.00325381308477103,svg_x:349.1562311557789,svg_y:387.1983251013032},{x:3.288208921788822,y:.0029616641378080047,svg_x:350.83361809045226,svg_y:387.4534695449565},{x:3.332393763959134,y:.002713377658558054,svg_x:352.51100502512566,svg_y:387.6703072788363},{x:3.3765786061294447,y:.0025181727194137945,svg_x:354.18839195979905,svg_y:387.840786947218},{x:3.4207634482997555,y:.002382886367062822,svg_x:355.8657788944724,svg_y:387.9589375052238},{x:3.4649482904700664,y:.0023105334984811314,svg_x:357.5431658291457,svg_y:388.0221259321987},{x:3.509133132640378,y:.002299339525314164,svg_x:359.22055276381917,svg_y:388.03190204156226},{x:3.553317974810689,y:.002342372821469825,svg_x:360.8979396984925,svg_y:387.9943194778723},{x:3.5975028169809997,y:.0024278347355157397,svg_x:362.57532663316584,svg_y:387.9196824383092},{x:3.6416876591513114,y:.002539984145932302,svg_x:364.25271356783924,svg_y:387.82173822449556},{x:3.6858725013216223,y:.00266059114609928,svg_x:365.9301005025126,svg_y:387.71640768581597},{x:3.730057343491933,y:.0027707415340285407,svg_x:367.60748743718597,svg_y:387.6202092920222},{x:3.774242185662244,y:.0028527615963428567,svg_x:369.2848743718593,svg_y:387.548578148439},{x:3.8184270278325556,y:.0028920110633454373,svg_x:370.9622613065327,svg_y:387.5143001422159},{x:3.8626118700028664,y:.0028783073053032645,svg_x:372.6396482412061,svg_y:387.52626813921876},{x:3.9067967121731773,y:.0028067962210261664,svg_x:374.3170351758794,svg_y:387.5887214049333},{x:3.950981554343488,y:.0026781680364643024,svg_x:375.9944221105527,svg_y:387.70105713959646},{x:3.9951663965138,y:.00249821579518853,svg_x:377.67180904522615,svg_y:387.85821606473297},{x:4.0393512386841115,y:.0022768327260684323,svg_x:379.3491959798996,svg_y:388.05155805891803},{x:4.083536080854421,y:.0020266235580977277,svg_x:381.0265829145729,svg_y:388.2700749477258},{x:4.127720923024733,y:.0017613498743171332,svg_x:382.7039698492462,svg_y:388.5017482334508},{x:4.171905765195045,y:.0014944339249074296,svg_x:384.3813567839196,svg_y:388.73485577028185},{x:4.216090607365355,y:.0012377111179778001,svg_x:386.058743718593,svg_y:388.9590612600776},{x:4.2602754495356665,y:.0010005588724088612,svg_x:387.7361306532664,svg_y:389.1661750572889},{x:4.304460291705976,y:.0007894538513937033,svg_x:389.4135175879397,svg_y:389.350540853227},{x:4.348645133876288,y:.0006079369247854676,svg_x:391.09090452261313,svg_y:389.5090662757368},{x:4.3928299760466,y:.0004569087173062373,svg_x:392.76829145728647,svg_y:389.6409647760525},{x:4.43701481821691,y:.0003351459303867038,svg_x:394.4456783919598,svg_y:389.747304705904},{x:4.4811996603872215,y:.00023992108230452394,svg_x:396.1230653266332,svg_y:389.8304680756114},{x:4.525384502557533,y:.00016762178506926528,svg_x:397.8004522613066,svg_y:389.89360971675495},{x:4.569569344727843,y:.00011429271609108016,svg_x:399.47783919597987,svg_y:389.94018395834104},{x:4.613754186898155,y:7605568471392627e-20,svg_x:401.15522613065326,svg_y:389.9735777672152},{x:4.657939029068467,y:4939342986240425e-20,svg_x:402.8326130653267,svg_y:389.9968628971167},{x:4.7021238712387765,y:3130622022640016e-20,svg_x:404.51000000000005,svg_y:390.0126591239654}]],selectors:["g[id='maidr-03825914-44f3-4ca5-94f0-42078a82560e'] path"]}]}]]},RW=` + + + + 2025-11-11T11:50:33.867359 + image/svg+xml + + + Matplotlib v3.10.6, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- −4 --> + + + + + + + + + + + + + + + + + + \x3C!-- −2 --> + + + + + + + + + + + + + + + + + \x3C!-- 0 --> + + + + + + + + + + + + + + + + \x3C!-- 2 --> + + + + + + + + + + + + + \x3C!-- 4 --> + + + + + + + \x3C!-- Value --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- 0.00 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 0.05 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 0.10 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 0.15 --> + + + + + + + + + + + + + + + + \x3C!-- 0.20 --> + + + + + + + + + + + + + + + + \x3C!-- 0.25 --> + + + + + + + + + + + + + + + + \x3C!-- 0.30 --> + + + + + + + + + + + + + + + + + + + \x3C!-- 0.35 --> + + + + + + + + + + + + + + + + \x3C!-- 0.40 --> + + + + + + + + + + \x3C!-- Density --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \x3C!-- KDE Plot of Random Data --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `;function OW(){return R.jsx(I2,{data:CW,children:R.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"720pt",height:"432pt",viewBox:"0 0 720 432",version:"1.1",dangerouslySetInnerHTML:{__html:AW}})})}function DW(){return R.jsx(I2,{data:kW,children:R.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"1008pt",height:"504pt",viewBox:"0 0 1008 504",version:"1.1",dangerouslySetInnerHTML:{__html:MW}})})}function _W(){return R.jsx(I2,{data:LW,children:R.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"432pt",height:"432pt",viewBox:"0 0 432 432",version:"1.1",id:"a6b8ffb5-9a9d-44be-9151-439a5373e405",dangerouslySetInnerHTML:{__html:RW}})})}function IW(){return R.jsxs("div",{style:{padding:"20px"},children:[R.jsx("h1",{children:"MAIDR React Examples"}),R.jsx("h2",{children:"Bar Chart"}),R.jsx(OW,{}),R.jsx("h2",{children:"Line Chart"}),R.jsx(DW,{}),R.jsx("h2",{children:"Smooth Chart"}),R.jsx(_W,{})]})}document.addEventListener("DOMContentLoaded",()=>{yE.createRoot(document.getElementById("root")).render(R.jsx(IW,{}))})})(); +
diff --git a/package-lock.json b/package-lock.json index 6acfdcce..ad1f406c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "maidr", - "version": "3.51.0", + "version": "3.52.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "maidr", - "version": "3.51.0", + "version": "3.52.0", "dependencies": { "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", @@ -56,7 +56,8 @@ "typedoc-theme-hierarchy": "^6.0.0", "typescript": "^5.8.3", "vite": "^6.3.5", - "vite-plugin-dts": "^4.5.4" + "vite-plugin-dts": "^4.5.4", + "vite-plugin-singlefile": "^2.3.0" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0", @@ -20359,6 +20360,23 @@ } } }, + "node_modules/vite-plugin-singlefile": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/vite-plugin-singlefile/-/vite-plugin-singlefile-2.3.0.tgz", + "integrity": "sha512-DAcHzYypM0CasNLSz/WG0VdKOCxGHErfrjOoyIPiNxTPTGmO6rRD/te93n1YL/s+miXq66ipF1brMBikf99c6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">18.0.0" + }, + "peerDependencies": { + "rollup": "^4.44.1", + "vite": "^5.4.11 || ^6.0.0 || ^7.0.0" + } + }, "node_modules/vscode-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.1.0.tgz", diff --git a/package.json b/package.json index f42539a9..b6ebdf53 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "e2e": "npx playwright test --config=e2e_tests/config/test-config.ts", "e2e:ui": "npx playwright test --ui", "e2e:debug": "npx playwright test --debug", - "e2e:install": "npx playwright install --with-deps" + "e2e:install": "npx playwright install --with-deps", + "build:react-example": "vite build --config examples/react-app/vite.config.ts" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0", @@ -101,7 +102,8 @@ "typedoc-theme-hierarchy": "^6.0.0", "typescript": "^5.8.3", "vite": "^6.3.5", - "vite-plugin-dts": "^4.5.4" + "vite-plugin-dts": "^4.5.4", + "vite-plugin-singlefile": "^2.3.0" }, "directories": { "doc": "docs", diff --git a/scripts/build-site.js b/scripts/build-site.js index 9c2b3f4b..03be4ed0 100644 --- a/scripts/build-site.js +++ b/scripts/build-site.js @@ -208,6 +208,12 @@ if (fs.existsSync(distSource)) { fs.cpSync(distSource, distDest, { recursive: true }); } +// Build React example +console.log('Building React example...'); +const { execSync } = require('node:child_process'); + +execSync('npm run build:react-example', { stdio: 'inherit', cwd: ROOT }); + // Copy examples folder console.log('Copying examples folder...'); const examplesSource = path.join(ROOT, 'examples'); diff --git a/tsconfig.json b/tsconfig.json index f3dbee87..d41eb4d1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -28,5 +28,5 @@ "skipLibCheck": true }, - "exclude": ["node_modules", "dist", "test-react-app"] + "exclude": ["node_modules", "dist", "test-react-app", "examples", "_site"] } diff --git a/typedoc.json b/typedoc.json index 01ede2ca..38d0d4a7 100644 --- a/typedoc.json +++ b/typedoc.json @@ -8,7 +8,9 @@ "**/*.test.ts", "**/*.spec.ts", "**/node_modules/**", - "test-react-app/**" + "test-react-app/**", + "examples/**", + "_site/**" ], "name": "MAIDR Documentation", "includeVersion": true, From ade02248395264ad6b7dcb1c89508c094bc86ebe Mon Sep 17 00:00:00 2001 From: nk46-cloud Date: Thu, 26 Feb 2026 11:15:48 -0600 Subject: [PATCH 2/2] chore: address security vulnerabilities and modify gitignore --- examples/react-app/data/barData.ts | 1086 ++++++++ examples/react-app/data/lineData.ts | 511 ++++ examples/react-app/data/smoothData.ts | 1671 +++++++++++++ examples/react-app/main.tsx | 3272 +------------------------ examples/react-app/tsconfig.json | 18 + examples/react-app/vite.config.ts | 20 +- examples/react/index.html | 2509 ------------------- scripts/build-site.js | 3 +- 8 files changed, 3307 insertions(+), 5783 deletions(-) create mode 100644 examples/react-app/data/barData.ts create mode 100644 examples/react-app/data/lineData.ts create mode 100644 examples/react-app/data/smoothData.ts create mode 100644 examples/react-app/tsconfig.json delete mode 100644 examples/react/index.html diff --git a/examples/react-app/data/barData.ts b/examples/react-app/data/barData.ts new file mode 100644 index 00000000..d77f1ee4 --- /dev/null +++ b/examples/react-app/data/barData.ts @@ -0,0 +1,1086 @@ +import { TraceType } from 'maidr/react'; +import type { MaidrData } from 'maidr/react'; + +export const barData: MaidrData = { + id: 'bar', + title: 'The Number of Tips by Day', + subplots: [ + [ + { + layers: [ + { + id: '0', + type: TraceType.BAR, + selectors: 'path[clip-path="url(#p0f12ed050e)"]', + axes: { + x: 'Day', + y: 'Count', + format: { + x: { + function: + "const days = {Sun: 'Sunday', Mon: 'Monday', Tue: 'Tuesday', Wed: 'Wednesday', Thur: 'Thursday', Fri: 'Friday', Sat: 'Saturday'}; return days[value] || value", + }, + y: { type: 'fixed', decimals: 1 }, + }, + }, + data: [ + { x: 'Sat', y: 87 }, + { x: 'Sun', y: 76 }, + { x: 'Thur', y: 62 }, + { x: 'Fri', y: 19 }, + ], + }, + ], + }, + ], + ], +}; + +export const barSvgInnerHTML = ` + + + + 2024-01-18T11:51:31.025970 + image/svg+xml + + + Matplotlib v3.8.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `; \ No newline at end of file diff --git a/examples/react-app/data/lineData.ts b/examples/react-app/data/lineData.ts new file mode 100644 index 00000000..3091a0a3 --- /dev/null +++ b/examples/react-app/data/lineData.ts @@ -0,0 +1,511 @@ +import { TraceType } from 'maidr/react'; +import type { MaidrData } from 'maidr/react'; + +export const lineData: MaidrData = { + id: '151f3961-0445-4713-94f4-e2059c74c53a', + subplots: [ + [ + { + layers: [ + { + id: 'c4ac3f68-6266-4f35-8125-33d8cdff1e9a', + type: TraceType.LINE, + title: + 'Line: Total Passengers per Year\nFrom the Flights Dataset', + axes: { + x: 'Year', + y: 'Total Passengers (Thousands)', + }, + data: [ + [ + { x: 1949.0, y: 1520.0 }, + { x: 1950.0, y: 1676.0 }, + { x: 1951.0, y: 2042.0 }, + { x: 1952.0, y: 2364.0 }, + { x: 1953.0, y: 2700.0 }, + { x: 1954.0, y: 2867.0 }, + { x: 1955.0, y: 3408.0 }, + { x: 1956.0, y: 3939.0 }, + { x: 1957.0, y: 4421.0 }, + { x: 1958.0, y: 4572.0 }, + { x: 1959.0, y: 5140.0 }, + { x: 1960.0, y: 5714.0 }, + ], + ], + selectors: [ + "g[id='maidr-bc200021-0bee-4a65-b89e-5bc56843df54'] path", + ], + }, + ], + }, + ], + ], +}; + +export const lineSvgInnerHTML = ` + + + + 2025-09-28T20:47:59.778672 + image/svg+xml + + + Matplotlib v3.9.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `; \ No newline at end of file diff --git a/examples/react-app/data/smoothData.ts b/examples/react-app/data/smoothData.ts new file mode 100644 index 00000000..6d65c260 --- /dev/null +++ b/examples/react-app/data/smoothData.ts @@ -0,0 +1,1671 @@ +import { TraceType } from 'maidr/react'; +import type { MaidrData } from 'maidr/react'; + +export const smoothData: MaidrData = { + "id": "a6b8ffb5-9a9d-44be-9151-439a5373e405", + "subplots": [ + [ + { + "layers": [ + { + "id": "c8cdf051-8c1b-4427-9589-39677dd422e3", + "type": TraceType.SMOOTH, + "title": "KDE: Plot of Random Data", + "axes": { + "x": "Value", + "y": "Density" + }, + "data": [ + [ + { + "x": -4.090659720653128, + "y": 0.00003130990414432069, + "svg_x": 70.71000000000001, + "svg_y": 390.01265590666407 + }, + { + "x": -4.046474878482817, + "y": 0.00004940157954895194, + "svg_x": 72.38738693467339, + "svg_y": 389.9968557796951 + }, + { + "x": -4.002290036312505, + "y": 0.00007607327310168, + "svg_x": 74.06477386934678, + "svg_y": 389.9735624066279 + }, + { + "x": -3.9581051941421945, + "y": 0.00011432974593037363, + "svg_x": 75.74216080402013, + "svg_y": 389.94015161881754 + }, + { + "x": -3.9139203519718837, + "y": 0.00016769783590326188, + "svg_x": 77.41954773869348, + "svg_y": 389.89354329875846 + }, + { + "x": -3.8697355098015724, + "y": 0.00024007344105625092, + "svg_x": 79.09693467336685, + "svg_y": 389.8303350150977 + }, + { + "x": -3.825550667631261, + "y": 0.0003354436629372707, + "svg_x": 80.77432160804022, + "svg_y": 389.74704468509356 + }, + { + "x": -3.7813658254609503, + "y": 0.0004574762153518218, + "svg_x": 82.45170854271358, + "svg_y": 389.64046915909194 + }, + { + "x": -3.737180983290639, + "y": 0.0006089919549181578, + "svg_x": 84.12909547738695, + "svg_y": 389.5081448790347 + }, + { + "x": -3.6929961411203283, + "y": 0.0007913668341964648, + "svg_x": 85.80648241206032, + "svg_y": 389.34887017483504 + }, + { + "x": -3.648811298950017, + "y": 0.001003941753084901, + "svg_x": 87.4838693467337, + "svg_y": 389.1632206629054 + }, + { + "x": -3.604626456779706, + "y": 0.0012435452535690175, + "svg_x": 89.16125628140705, + "svg_y": 388.95396609442633 + }, + { + "x": -3.560441614609395, + "y": 0.0015042461494080136, + "svg_x": 90.83864321608043, + "svg_y": 388.7262863929583 + }, + { + "x": -3.5162567724390836, + "y": 0.0017774433516954526, + "svg_x": 92.5160301507538, + "svg_y": 388.4876932064695 + }, + { + "x": -3.472071930268773, + "y": 0.002052364207035492, + "svg_x": 94.19341708542716, + "svg_y": 388.2475946902381 + }, + { + "x": -3.4278870880984615, + "y": 0.002316982220368148, + "svg_x": 95.87080402010052, + "svg_y": 388.0164940256824 + }, + { + "x": -3.3837022459281507, + "y": 0.002559288528300005, + "svg_x": 97.5481909547739, + "svg_y": 387.8048789958368 + }, + { + "x": -3.3395174037578395, + "y": 0.002768773463206442, + "svg_x": 99.22557788944727, + "svg_y": 387.6219280808119 + }, + { + "x": -3.2953325615875286, + "y": 0.002937912950730226, + "svg_x": 100.90296482412062, + "svg_y": 387.4742123320726 + }, + { + "x": -3.2511477194172174, + "y": 0.0030634264478196717, + "svg_x": 102.580351758794, + "svg_y": 387.36459676878286 + }, + { + "x": -3.206962877246906, + "y": 0.003147090269864315, + "svg_x": 104.25773869346736, + "svg_y": 387.2915300692401 + }, + { + "x": -3.1627780350765953, + "y": 0.003195954713735132, + "svg_x": 105.93512562814071, + "svg_y": 387.2488549493211 + }, + { + "x": -3.118593192906284, + "y": 0.003221916448122887, + "svg_x": 107.61251256281409, + "svg_y": 387.226181609761 + }, + { + "x": -3.0744083507359727, + "y": 0.0032407201625036775, + "svg_x": 109.28989949748747, + "svg_y": 387.2097596329092 + }, + { + "x": -3.030223508565662, + "y": 0.0032705799740616803, + "svg_x": 110.96728643216083, + "svg_y": 387.1836819588776 + }, + { + "x": -2.986038666395351, + "y": 0.003330695294811018, + "svg_x": 112.6446733668342, + "svg_y": 387.1311810334864 + }, + { + "x": -2.94185382422504, + "y": 0.003439966724407699, + "svg_x": 114.32206030150756, + "svg_y": 387.03575026640186 + }, + { + "x": -2.8976689820547286, + "y": 0.003616184369685506, + "svg_x": 115.99944723618094, + "svg_y": 386.8818529016033 + }, + { + "x": -2.8534841398844177, + "y": 0.0038758663520965255, + "svg_x": 117.67683417085428, + "svg_y": 386.6550630547879 + }, + { + "x": -2.8092992977141065, + "y": 0.004234785019886466, + "svg_x": 119.35422110552767, + "svg_y": 386.3416061528822 + }, + { + "x": -2.765114455543795, + "y": 0.004709059027274733, + "svg_x": 121.03160804020102, + "svg_y": 385.92740518104165 + }, + { + "x": -2.7209296133734844, + "y": 0.005316543236077628, + "svg_x": 122.70899497487441, + "svg_y": 385.39686683033267 + }, + { + "x": -2.6767447712031736, + "y": 0.006078147298138619, + "svg_x": 124.38638190954775, + "svg_y": 384.7317299310948 + }, + { + "x": -2.6325599290328623, + "y": 0.007018683279955856, + "svg_x": 126.06376884422113, + "svg_y": 383.9103251911113 + }, + { + "x": -2.588375086862551, + "y": 0.00816689653076014, + "svg_x": 127.7411557788945, + "svg_y": 382.9075482373789 + }, + { + "x": -2.54419024469224, + "y": 0.00955447058922441, + "svg_x": 129.41854271356786, + "svg_y": 381.69572866775593 + }, + { + "x": -2.500005402521929, + "y": 0.011213998114074414, + "svg_x": 131.09592964824122, + "svg_y": 380.2464021120498 + }, + { + "x": -2.4558205603516177, + "y": 0.013176142299326211, + "svg_x": 132.7733165829146, + "svg_y": 378.5327892727166 + }, + { + "x": -2.411635718181307, + "y": 0.015466432767102797, + "svg_x": 134.45070351758795, + "svg_y": 376.53259418976427 + }, + { + "x": -2.367450876010996, + "y": 0.018102298264606652, + "svg_x": 136.12809045226132, + "svg_y": 374.23059569585735 + }, + { + "x": -2.3232660338406848, + "y": 0.021090992314206837, + "svg_x": 137.8054773869347, + "svg_y": 371.6204590225546 + }, + { + "x": -2.2790811916703735, + "y": 0.024428988799018718, + "svg_x": 139.48286432160808, + "svg_y": 368.7052636576999 + }, + { + "x": -2.2348963495000627, + "y": 0.02810320766963468, + "svg_x": 141.16025125628144, + "svg_y": 365.49643289055643 + }, + { + "x": -2.1907115073297514, + "y": 0.03209410150887552, + "svg_x": 142.8376381909548, + "svg_y": 362.01103820104174 + }, + { + "x": -2.14652666515944, + "y": 0.03638024637711627, + "svg_x": 144.51502512562817, + "svg_y": 358.2677899052919 + }, + { + "x": -2.1023418229891293, + "y": 0.04094371272125957, + "svg_x": 146.1924120603015, + "svg_y": 354.2823465428893 + }, + { + "x": -2.058156980818818, + "y": 0.045775230098893754, + "svg_x": 147.8697989949749, + "svg_y": 350.06280433288975 + }, + { + "x": -2.013972138648507, + "y": 0.05087807783074991, + "svg_x": 149.54718592964826, + "svg_y": 345.60629932362684 + }, + { + "x": -1.969787296478196, + "y": 0.05626977565145946, + "svg_x": 151.22457286432166, + "svg_y": 340.89753088508985 + }, + { + "x": -1.9256024543078851, + "y": 0.06198100985542495, + "svg_x": 152.901959798995, + "svg_y": 335.909699545316 + }, + { + "x": -1.8814176121375739, + "y": 0.06805175414252536, + "svg_x": 154.57934673366836, + "svg_y": 330.6078947988169 + }, + { + "x": -1.837232769967263, + "y": 0.07452512761687477, + "svg_x": 156.2567336683417, + "svg_y": 324.9544591426496 + }, + { + "x": -1.7930479277969518, + "y": 0.08144004739823013, + "svg_x": 157.9341206030151, + "svg_y": 318.9154048216907 + }, + { + "x": -1.7488630856266405, + "y": 0.08882405659950532, + "svg_x": 159.61150753768845, + "svg_y": 312.46667742022527 + }, + { + "x": -1.7046782434563297, + "y": 0.09668775184442237, + "svg_x": 161.28889447236185, + "svg_y": 305.5990225161777 + }, + { + "x": -1.6604934012860184, + "y": 0.10502196952360994, + "svg_x": 162.9662814070352, + "svg_y": 298.320443027372 + }, + { + "x": -1.6163085591157076, + "y": 0.11379835840206126, + "svg_x": 164.64366834170855, + "svg_y": 290.65569913233304 + }, + { + "x": -1.5721237169453963, + "y": 0.12297327358409418, + "svg_x": 166.32105527638194, + "svg_y": 282.6429075271602 + }, + { + "x": -1.527938874775085, + "y": 0.13249421999549524, + "svg_x": 167.9984422110553, + "svg_y": 274.3279140950715 + }, + { + "x": -1.4837540326047742, + "y": 0.14230750717421917, + "svg_x": 169.67582914572867, + "svg_y": 265.75760869553903 + }, + { + "x": -1.439569190434463, + "y": 0.15236547832193598, + "svg_x": 171.35321608040204, + "svg_y": 256.97361176711854 + }, + { + "x": -1.3953843482641521, + "y": 0.1626317155316665, + "svg_x": 173.03060301507543, + "svg_y": 248.00772841029658 + }, + { + "x": -1.3511995060938409, + "y": 0.17308299772117272, + "svg_x": 174.70798994974876, + "svg_y": 238.8802384520938 + }, + { + "x": -1.30701466392353, + "y": 0.18370742466476686, + "svg_x": 176.38537688442213, + "svg_y": 229.60153479823182 + }, + { + "x": -1.2628298217532188, + "y": 0.19449889202295975, + "svg_x": 178.0627638190955, + "svg_y": 220.17694859338522 + }, + { + "x": -1.2186449795829075, + "y": 0.2054488548588255, + "svg_x": 179.7401507537689, + "svg_y": 210.61394244592802 + }, + { + "x": -1.1744601374125967, + "y": 0.2165369037626608, + "svg_x": 181.41753768844222, + "svg_y": 200.9303406456211 + }, + { + "x": -1.1302752952422854, + "y": 0.22772198721362596, + "svg_x": 183.09492462311562, + "svg_y": 191.1619949987251 + }, + { + "x": -1.0860904530719746, + "y": 0.23893609109306826, + "svg_x": 184.77231155778895, + "svg_y": 181.36830474198078 + }, + { + "x": -1.0419056109016633, + "y": 0.2500818398791641, + "svg_x": 186.44969849246235, + "svg_y": 171.6343115077452 + }, + { + "x": -0.9977207687313525, + "y": 0.2610348806492031, + "svg_x": 188.12708542713568, + "svg_y": 162.06861728692533 + }, + { + "x": -0.9535359265610412, + "y": 0.2716511589935541, + "svg_x": 189.80447236180905, + "svg_y": 152.79703010513026 + }, + { + "x": -0.90935108439073, + "y": 0.28177842263187014, + "svg_x": 191.48185929648247, + "svg_y": 143.95251749062885 + }, + { + "x": -0.8651662422204192, + "y": 0.29127061621789874, + "svg_x": 193.1592462311558, + "svg_y": 135.6626349607336 + }, + { + "x": -0.8209814000501079, + "y": 0.30000335676177387, + "svg_x": 194.83663316582917, + "svg_y": 128.03601076510688 + }, + { + "x": -0.7767965578797971, + "y": 0.3078884629472529, + "svg_x": 196.51402010050253, + "svg_y": 121.14965689748414 + }, + { + "x": -0.7326117157094858, + "y": 0.3148855717629324, + "svg_x": 198.1914070351759, + "svg_y": 115.03882386345772 + }, + { + "x": -0.6884268735391745, + "y": 0.32100919334303957, + "svg_x": 199.8687939698493, + "svg_y": 109.69083942798028 + }, + { + "x": -0.6442420313688637, + "y": 0.3263300819174363, + "svg_x": 201.54618090452263, + "svg_y": 105.04391131419479 + }, + { + "x": -0.6000571891985524, + "y": 0.3309704701335142, + "svg_x": 203.223567839196, + "svg_y": 100.99128924578093 + }, + { + "x": -0.5558723470282416, + "y": 0.33509344713360784, + "svg_x": 204.9009547738694, + "svg_y": 97.39054146346182 + }, + { + "x": -0.5116875048579304, + "y": 0.3388874734755469, + "svg_x": 206.57834170854272, + "svg_y": 94.07707841564785 + }, + { + "x": -0.46750266268761953, + "y": 0.34254763379388015, + "svg_x": 208.25572864321612, + "svg_y": 90.88052550039473 + }, + { + "x": -0.42331782051730826, + "y": 0.3462556531994323, + "svg_x": 209.93311557788948, + "svg_y": 87.64217548024303 + }, + { + "x": -0.379132978346997, + "y": 0.35016088460650785, + "svg_x": 211.61050251256287, + "svg_y": 84.23159295015594 + }, + { + "x": -0.3349481361766862, + "y": 0.35436437876964516, + "svg_x": 213.28788944723618, + "svg_y": 80.56052656158184 + }, + { + "x": -0.2907632940063749, + "y": 0.3589077829052686, + "svg_x": 214.96527638190958, + "svg_y": 76.59260426534928 + }, + { + "x": -0.24657845183606408, + "y": 0.36376822627732547, + "svg_x": 216.6426633165829, + "svg_y": 72.34779991824182 + }, + { + "x": -0.20239360966575282, + "y": 0.3688596280403082, + "svg_x": 218.32005025125628, + "svg_y": 67.90129109548116 + }, + { + "x": -0.158208767495442, + "y": 0.37404011136746473, + "svg_x": 219.9974371859297, + "svg_y": 63.376984059284666 + }, + { + "x": -0.11402392532513073, + "y": 0.3791245353462726, + "svg_x": 221.67482412060306, + "svg_y": 58.93656919263699 + }, + { + "x": -0.0698390831548199, + "y": 0.3839006470696864, + "svg_x": 223.35221105527637, + "svg_y": 54.76541478265602 + }, + { + "x": -0.025654240984508192, + "y": 0.3881470589083364, + "svg_x": 225.0295979899498, + "svg_y": 51.05686680616102 + }, + { + "x": 0.01853060118580263, + "y": 0.3916511783707175, + "svg_x": 226.70698492462313, + "svg_y": 47.996590121895395 + }, + { + "x": 0.06271544335611345, + "y": 0.3942253366467558, + "svg_x": 228.3843718592965, + "svg_y": 45.748482818950734 + }, + { + "x": 0.10690028552642428, + "y": 0.3957196363213503, + "svg_x": 230.06175879396986, + "svg_y": 44.44345583497918 + }, + { + "x": 0.151085127696736, + "y": 0.39603042641955505, + "svg_x": 231.73914572864328, + "svg_y": 44.17203138685543 + }, + { + "x": 0.1952699698670468, + "y": 0.3951037788258021, + "svg_x": 233.41653266331664, + "svg_y": 44.98130688563249 + }, + { + "x": 0.23945481203735763, + "y": 0.3929338567226222, + "svg_x": 235.09391959798995, + "svg_y": 46.87637983914471 + }, + { + "x": 0.28363965420766934, + "y": 0.38955660570240125, + "svg_x": 236.77130653266335, + "svg_y": 49.82585763664865 + }, + { + "x": 0.32782449637798017, + "y": 0.3850397242779236, + "svg_x": 238.4486934673367, + "svg_y": 53.770616671641264 + }, + { + "x": 0.372009338548291, + "y": 0.37947032874379705, + "svg_x": 240.12608040201007, + "svg_y": 58.63457507303636 + }, + { + "x": 0.4161941807186018, + "y": 0.372942049436482, + "svg_x": 241.80346733668344, + "svg_y": 64.33596201689767 + }, + { + "x": 0.4603790228889135, + "y": 0.3655434111757971, + "svg_x": 243.4808542713568, + "svg_y": 70.79746551515571 + }, + { + "x": 0.5045638650592243, + "y": 0.3573492075739796, + "svg_x": 245.1582412060302, + "svg_y": 77.95376554943806 + }, + { + "x": 0.5487487072295352, + "y": 0.3484161627521771, + "svg_x": 246.83562814070353, + "svg_y": 85.75532285396146 + }, + { + "x": 0.5929335493998469, + "y": 0.3387835224962189, + "svg_x": 248.51301507537693, + "svg_y": 94.16786263740713 + }, + { + "x": 0.6371183915701577, + "y": 0.3284784205214732, + "svg_x": 250.19040201005024, + "svg_y": 103.16768802602685 + }, + { + "x": 0.6813032337404685, + "y": 0.31752505393460234, + "svg_x": 251.86778894472366, + "svg_y": 112.7336667946952 + }, + { + "x": 0.7254880759107802, + "y": 0.3059560185697742, + "svg_x": 253.54517587939702, + "svg_y": 122.83733179998868 + }, + { + "x": 0.7696729180810911, + "y": 0.29382372648592153, + "svg_x": 255.2225628140704, + "svg_y": 133.43290965899396 + }, + { + "x": 0.8138577602514019, + "y": 0.2812097378049739, + "svg_x": 256.8999497487437, + "svg_y": 144.44917091101868 + }, + { + "x": 0.8580426024217127, + "y": 0.26823011005451347, + "svg_x": 258.5773366834171, + "svg_y": 155.78475823947977 + }, + { + "x": 0.9022274445920244, + "y": 0.25503545937694905, + "svg_x": 260.2547236180905, + "svg_y": 167.3081330156758 + }, + { + "x": 0.9464122867623352, + "y": 0.241805244640202, + "svg_x": 261.93211055276385, + "svg_y": 178.8625671956059 + }, + { + "x": 0.9905971289326461, + "y": 0.2287366979512775, + "svg_x": 263.60949748743724, + "svg_y": 190.2758107104763 + }, + { + "x": 1.0347819711029578, + "y": 0.21602969136412215, + "svg_x": 265.2868844221106, + "svg_y": 201.37330792852399 + }, + { + "x": 1.0789668132732686, + "y": 0.20386951697380692, + "svg_x": 266.96427135678397, + "svg_y": 211.99323643347245 + }, + { + "x": 1.1231516554435794, + "y": 0.19240996017254688, + "svg_x": 268.64165829145725, + "svg_y": 222.00128977394942 + }, + { + "x": 1.1673364976138902, + "y": 0.18175909718993138, + "svg_x": 270.3190452261307, + "svg_y": 231.3030809950905 + }, + { + "x": 1.211521339784202, + "y": 0.17196992964293195, + "svg_x": 271.9964321608041, + "svg_y": 239.85232183121636 + }, + { + "x": 1.2557061819545128, + "y": 0.16303731457455878, + "svg_x": 273.67381909547737, + "svg_y": 247.65350381622972 + }, + { + "x": 1.2998910241248236, + "y": 0.15490174451017114, + "svg_x": 275.35120603015076, + "svg_y": 254.75859702111066 + }, + { + "x": 1.3440758662951353, + "y": 0.14745951009473, + "svg_x": 277.02859296482416, + "svg_y": 261.25817464822086 + }, + { + "x": 1.3882607084654461, + "y": 0.14057779975761067, + "svg_x": 278.70597989949755, + "svg_y": 267.268225937467 + }, + { + "x": 1.432445550635757, + "y": 0.13411252411764132, + "svg_x": 280.38336683417083, + "svg_y": 272.9145894563934 + }, + { + "x": 1.4766303928060678, + "y": 0.12792623967307265, + "svg_x": 282.0607537688443, + "svg_y": 278.31729968108544 + }, + { + "x": 1.5208152349763795, + "y": 0.12190357217991503, + "svg_x": 283.7381407035176, + "svg_y": 283.57711719137956 + }, + { + "x": 1.5650000771466903, + "y": 0.11596201041823524, + "svg_x": 285.41552763819095, + "svg_y": 288.76610207691124 + }, + { + "x": 1.6091849193170011, + "y": 0.11005677379190186, + "svg_x": 287.09291457286434, + "svg_y": 293.92336288284264 + }, + { + "x": 1.6533697614873129, + "y": 0.1041794959941977, + "svg_x": 288.7703015075377, + "svg_y": 299.05620621320224 + }, + { + "x": 1.6975546036576237, + "y": 0.09835151283339667, + "svg_x": 290.44768844221113, + "svg_y": 304.1459987202113 + }, + { + "x": 1.7417394458279345, + "y": 0.09261339706378388, + "svg_x": 292.1250753768844, + "svg_y": 309.1573067220882 + }, + { + "x": 1.7859242879982453, + "y": 0.08701289282645258, + "svg_x": 293.8024623115578, + "svg_y": 314.04843350062254 + }, + { + "x": 1.830109130168557, + "y": 0.08159348966267956, + "svg_x": 295.4798492462312, + "svg_y": 318.7813980364436 + }, + { + "x": 1.8742939723388679, + "y": 0.0763855528957766, + "svg_x": 297.15723618090453, + "svg_y": 323.32968117347247 + }, + { + "x": 1.9184788145091787, + "y": 0.07140128599983042, + "svg_x": 298.8346231155779, + "svg_y": 327.68262516798353 + }, + { + "x": 1.9626636566794904, + "y": 0.06663398846512668, + "svg_x": 300.51201005025126, + "svg_y": 331.8460818220832 + }, + { + "x": 2.006848498849801, + "y": 0.06206125598316489, + "svg_x": 302.18939698492466, + "svg_y": 335.8396176441818 + }, + { + "x": 2.051033341020112, + "y": 0.05765109900480679, + "svg_x": 303.866783919598, + "svg_y": 339.6911702866393 + }, + { + "x": 2.095218183190423, + "y": 0.05336953822680194, + "svg_x": 305.54417085427133, + "svg_y": 343.4304151274219 + }, + { + "x": 2.1394030253607346, + "y": 0.04918812043192671, + "svg_x": 307.2215577889447, + "svg_y": 347.08220140988345 + }, + { + "x": 2.1835878675310454, + "y": 0.04508997402881915, + "svg_x": 308.8989447236181, + "svg_y": 350.66126371662773 + }, + { + "x": 2.227772709701356, + "y": 0.04107342782164594, + "svg_x": 310.5763316582915, + "svg_y": 354.1690615645742 + }, + { + "x": 2.271957551871668, + "y": 0.03715275152929256, + "svg_x": 312.25371859296484, + "svg_y": 357.5931326822549 + }, + { + "x": 2.3161423940419787, + "y": 0.03335613121151739, + "svg_x": 313.93110552763824, + "svg_y": 360.9088611447775 + }, + { + "x": 2.3603272362122896, + "y": 0.029721463665121975, + "svg_x": 315.6084924623116, + "svg_y": 364.0831502826634 + }, + { + "x": 2.4045120783826004, + "y": 0.026290863920869323, + "svg_x": 317.2858793969849, + "svg_y": 367.0792194872361 + }, + { + "x": 2.448696920552912, + "y": 0.02310489079809747, + "svg_x": 318.9632663316583, + "svg_y": 369.8616472466169 + }, + { + "x": 2.492881762723223, + "y": 0.020197411492372003, + "svg_x": 320.6406532663317, + "svg_y": 372.4008560906129 + }, + { + "x": 2.5370666048935337, + "y": 0.017591789775999962, + "svg_x": 322.3180402010051, + "svg_y": 374.67644157570675 + }, + { + "x": 2.5812514470638455, + "y": 0.01529876128924196, + "svg_x": 323.9954271356784, + "svg_y": 376.67902787155583 + }, + { + "x": 2.6254362892341563, + "y": 0.013316029334183386, + "svg_x": 325.67281407035176, + "svg_y": 378.4106207691025 + }, + { + "x": 2.669621131404467, + "y": 0.01162934173930686, + "svg_x": 327.35020100502516, + "svg_y": 379.88366721505133 + }, + { + "x": 2.713805973574779, + "y": 0.010214636781484931, + "svg_x": 329.02758793969855, + "svg_y": 381.1191811990967 + }, + { + "x": 2.7579908157450896, + "y": 0.009040787223736605, + "svg_x": 330.7049748743719, + "svg_y": 382.1443472846079 + }, + { + "x": 2.8021756579154005, + "y": 0.008072511565588254, + "svg_x": 332.3823618090452, + "svg_y": 382.9899781063835 + }, + { + "x": 2.8463605000857113, + "y": 0.00727312623331302, + "svg_x": 334.0597487437186, + "svg_y": 383.6881107814732 + }, + { + "x": 2.890545342256023, + "y": 0.006606939789464267, + "svg_x": 335.737135678392, + "svg_y": 384.2699159577439 + }, + { + "x": 2.934730184426334, + "y": 0.006041203199682887, + "svg_x": 337.41452261306534, + "svg_y": 384.7639945739927 + }, + { + "x": 2.9789150265966446, + "y": 0.0055476053537744045, + "svg_x": 339.0919095477387, + "svg_y": 385.1950717662671 + }, + { + "x": 3.0230998687669564, + "y": 0.005103334328184673, + "svg_x": 340.76929648241213, + "svg_y": 385.583070028228 + }, + { + "x": 3.067284710937267, + "y": 0.00469172161203444, + "svg_x": 342.44668341708547, + "svg_y": 385.942546584808 + }, + { + "x": 3.111469553107578, + "y": 0.004302467273663569, + "svg_x": 344.1240703517588, + "svg_y": 386.2824967459695 + }, + { + "x": 3.155654395277889, + "y": 0.0039314288367225045, + "svg_x": 345.8014572864322, + "svg_y": 386.6065382889954 + }, + { + "x": 3.1998392374482005, + "y": 0.00357996005874073, + "svg_x": 347.4788442211056, + "svg_y": 386.9134889275373 + }, + { + "x": 3.2440240796185114, + "y": 0.00325381308477103, + "svg_x": 349.1562311557789, + "svg_y": 387.1983251013032 + }, + { + "x": 3.288208921788822, + "y": 0.0029616641378080047, + "svg_x": 350.83361809045226, + "svg_y": 387.4534695449565 + }, + { + "x": 3.332393763959134, + "y": 0.002713377658558054, + "svg_x": 352.51100502512566, + "svg_y": 387.6703072788363 + }, + { + "x": 3.3765786061294447, + "y": 0.0025181727194137945, + "svg_x": 354.18839195979905, + "svg_y": 387.840786947218 + }, + { + "x": 3.4207634482997555, + "y": 0.002382886367062822, + "svg_x": 355.8657788944724, + "svg_y": 387.9589375052238 + }, + { + "x": 3.4649482904700664, + "y": 0.0023105334984811314, + "svg_x": 357.5431658291457, + "svg_y": 388.0221259321987 + }, + { + "x": 3.509133132640378, + "y": 0.002299339525314164, + "svg_x": 359.22055276381917, + "svg_y": 388.03190204156226 + }, + { + "x": 3.553317974810689, + "y": 0.002342372821469825, + "svg_x": 360.8979396984925, + "svg_y": 387.9943194778723 + }, + { + "x": 3.5975028169809997, + "y": 0.0024278347355157397, + "svg_x": 362.57532663316584, + "svg_y": 387.9196824383092 + }, + { + "x": 3.6416876591513114, + "y": 0.002539984145932302, + "svg_x": 364.25271356783924, + "svg_y": 387.82173822449556 + }, + { + "x": 3.6858725013216223, + "y": 0.00266059114609928, + "svg_x": 365.9301005025126, + "svg_y": 387.71640768581597 + }, + { + "x": 3.730057343491933, + "y": 0.0027707415340285407, + "svg_x": 367.60748743718597, + "svg_y": 387.6202092920222 + }, + { + "x": 3.774242185662244, + "y": 0.0028527615963428567, + "svg_x": 369.2848743718593, + "svg_y": 387.548578148439 + }, + { + "x": 3.8184270278325556, + "y": 0.0028920110633454373, + "svg_x": 370.9622613065327, + "svg_y": 387.5143001422159 + }, + { + "x": 3.8626118700028664, + "y": 0.0028783073053032645, + "svg_x": 372.6396482412061, + "svg_y": 387.52626813921876 + }, + { + "x": 3.9067967121731773, + "y": 0.0028067962210261664, + "svg_x": 374.3170351758794, + "svg_y": 387.5887214049333 + }, + { + "x": 3.950981554343488, + "y": 0.0026781680364643024, + "svg_x": 375.9944221105527, + "svg_y": 387.70105713959646 + }, + { + "x": 3.9951663965138, + "y": 0.00249821579518853, + "svg_x": 377.67180904522615, + "svg_y": 387.85821606473297 + }, + { + "x": 4.0393512386841115, + "y": 0.0022768327260684323, + "svg_x": 379.3491959798996, + "svg_y": 388.05155805891803 + }, + { + "x": 4.083536080854421, + "y": 0.0020266235580977277, + "svg_x": 381.0265829145729, + "svg_y": 388.2700749477258 + }, + { + "x": 4.127720923024733, + "y": 0.0017613498743171332, + "svg_x": 382.7039698492462, + "svg_y": 388.5017482334508 + }, + { + "x": 4.171905765195045, + "y": 0.0014944339249074296, + "svg_x": 384.3813567839196, + "svg_y": 388.73485577028185 + }, + { + "x": 4.216090607365355, + "y": 0.0012377111179778001, + "svg_x": 386.058743718593, + "svg_y": 388.9590612600776 + }, + { + "x": 4.2602754495356665, + "y": 0.0010005588724088612, + "svg_x": 387.7361306532664, + "svg_y": 389.1661750572889 + }, + { + "x": 4.304460291705976, + "y": 0.0007894538513937033, + "svg_x": 389.4135175879397, + "svg_y": 389.350540853227 + }, + { + "x": 4.348645133876288, + "y": 0.0006079369247854676, + "svg_x": 391.09090452261313, + "svg_y": 389.5090662757368 + }, + { + "x": 4.3928299760466, + "y": 0.0004569087173062373, + "svg_x": 392.76829145728647, + "svg_y": 389.6409647760525 + }, + { + "x": 4.43701481821691, + "y": 0.0003351459303867038, + "svg_x": 394.4456783919598, + "svg_y": 389.747304705904 + }, + { + "x": 4.4811996603872215, + "y": 0.00023992108230452394, + "svg_x": 396.1230653266332, + "svg_y": 389.8304680756114 + }, + { + "x": 4.525384502557533, + "y": 0.00016762178506926528, + "svg_x": 397.8004522613066, + "svg_y": 389.89360971675495 + }, + { + "x": 4.569569344727843, + "y": 0.00011429271609108016, + "svg_x": 399.47783919597987, + "svg_y": 389.94018395834104 + }, + { + "x": 4.613754186898155, + "y": 0.00007605568471392627, + "svg_x": 401.15522613065326, + "svg_y": 389.9735777672152 + }, + { + "x": 4.657939029068467, + "y": 0.00004939342986240425, + "svg_x": 402.8326130653267, + "svg_y": 389.9968628971167 + }, + { + "x": 4.7021238712387765, + "y": 0.00003130622022640016, + "svg_x": 404.51000000000005, + "svg_y": 390.0126591239654 + } + ] + ], + "selectors": [ + "g[id='maidr-03825914-44f3-4ca5-94f0-42078a82560e'] path" + ] + } + ] + } + ] + ] +}; + +export const smoothSvgInnerHTML = ` + + + + 2025-11-11T11:50:33.867359 + image/svg+xml + + + Matplotlib v3.10.6, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `; diff --git a/examples/react-app/main.tsx b/examples/react-app/main.tsx index d60f6f08..db5b9f6e 100644 --- a/examples/react-app/main.tsx +++ b/examples/react-app/main.tsx @@ -1,3271 +1,9 @@ -import React from 'react'; import { createRoot } from 'react-dom/client'; -import { Maidr, TraceType } from 'maidr/react'; -import type { MaidrData } from 'maidr/react'; +import { Maidr } from 'maidr/react'; -const barData: MaidrData = { - id: 'bar', - title: 'The Number of Tips by Day', - subplots: [ - [ - { - layers: [ - { - id: '0', - type: TraceType.BAR, - selectors: 'path[clip-path="url(#p0f12ed050e)"]', - axes: { - x: 'Day', - y: 'Count', - format: { - x: { - function: - "const days = {Sun: 'Sunday', Mon: 'Monday', Tue: 'Tuesday', Wed: 'Wednesday', Thur: 'Thursday', Fri: 'Friday', Sat: 'Saturday'}; return days[value] || value", - }, - y: { type: 'fixed', decimals: 1 }, - }, - }, - data: [ - { x: 'Sat', y: 87 }, - { x: 'Sun', y: 76 }, - { x: 'Thur', y: 62 }, - { x: 'Fri', y: 19 }, - ], - }, - ], - }, - ], - ], -}; - -const barSvgInnerHTML = ` - - - - 2024-01-18T11:51:31.025970 - image/svg+xml - - - Matplotlib v3.8.2, https://matplotlib.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `; - -const lineData: MaidrData = { - id: '151f3961-0445-4713-94f4-e2059c74c53a', - subplots: [ - [ - { - id: 'd54fac17-e805-4ade-8b78-f110c534984c', - layers: [ - { - id: 'c4ac3f68-6266-4f35-8125-33d8cdff1e9a', - type: TraceType.LINE, - title: - 'Line: Total Passengers per Year\nFrom the Flights Dataset', - axes: { - x: 'Year', - y: 'Total Passengers (Thousands)', - }, - data: [ - [ - { x: 1949.0, y: 1520.0 }, - { x: 1950.0, y: 1676.0 }, - { x: 1951.0, y: 2042.0 }, - { x: 1952.0, y: 2364.0 }, - { x: 1953.0, y: 2700.0 }, - { x: 1954.0, y: 2867.0 }, - { x: 1955.0, y: 3408.0 }, - { x: 1956.0, y: 3939.0 }, - { x: 1957.0, y: 4421.0 }, - { x: 1958.0, y: 4572.0 }, - { x: 1959.0, y: 5140.0 }, - { x: 1960.0, y: 5714.0 }, - ], - ], - selectors: [ - "g[id='maidr-bc200021-0bee-4a65-b89e-5bc56843df54'] path", - ], - }, - ], - }, - ], - ], -}; - -const lineSvgInnerHTML = ` - - - - 2025-09-28T20:47:59.778672 - image/svg+xml - - - Matplotlib v3.9.4, https://matplotlib.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `; - -const smoothData: MaidrData = { - "id": "a6b8ffb5-9a9d-44be-9151-439a5373e405", - "subplots": [ - [ - { - "id": "599348d6-602e-4fde-a4ca-504d759db44a", - "layers": [ - { - "id": "c8cdf051-8c1b-4427-9589-39677dd422e3", - "type": TraceType.SMOOTH, - "title": "KDE: Plot of Random Data", - "axes": { - "x": "Value", - "y": "Density" - }, - "data": [ - [ - { - "x": -4.090659720653128, - "y": 0.00003130990414432069, - "svg_x": 70.71000000000001, - "svg_y": 390.01265590666407 - }, - { - "x": -4.046474878482817, - "y": 0.00004940157954895194, - "svg_x": 72.38738693467339, - "svg_y": 389.9968557796951 - }, - { - "x": -4.002290036312505, - "y": 0.00007607327310168, - "svg_x": 74.06477386934678, - "svg_y": 389.9735624066279 - }, - { - "x": -3.9581051941421945, - "y": 0.00011432974593037363, - "svg_x": 75.74216080402013, - "svg_y": 389.94015161881754 - }, - { - "x": -3.9139203519718837, - "y": 0.00016769783590326188, - "svg_x": 77.41954773869348, - "svg_y": 389.89354329875846 - }, - { - "x": -3.8697355098015724, - "y": 0.00024007344105625092, - "svg_x": 79.09693467336685, - "svg_y": 389.8303350150977 - }, - { - "x": -3.825550667631261, - "y": 0.0003354436629372707, - "svg_x": 80.77432160804022, - "svg_y": 389.74704468509356 - }, - { - "x": -3.7813658254609503, - "y": 0.0004574762153518218, - "svg_x": 82.45170854271358, - "svg_y": 389.64046915909194 - }, - { - "x": -3.737180983290639, - "y": 0.0006089919549181578, - "svg_x": 84.12909547738695, - "svg_y": 389.5081448790347 - }, - { - "x": -3.6929961411203283, - "y": 0.0007913668341964648, - "svg_x": 85.80648241206032, - "svg_y": 389.34887017483504 - }, - { - "x": -3.648811298950017, - "y": 0.001003941753084901, - "svg_x": 87.4838693467337, - "svg_y": 389.1632206629054 - }, - { - "x": -3.604626456779706, - "y": 0.0012435452535690175, - "svg_x": 89.16125628140705, - "svg_y": 388.95396609442633 - }, - { - "x": -3.560441614609395, - "y": 0.0015042461494080136, - "svg_x": 90.83864321608043, - "svg_y": 388.7262863929583 - }, - { - "x": -3.5162567724390836, - "y": 0.0017774433516954526, - "svg_x": 92.5160301507538, - "svg_y": 388.4876932064695 - }, - { - "x": -3.472071930268773, - "y": 0.002052364207035492, - "svg_x": 94.19341708542716, - "svg_y": 388.2475946902381 - }, - { - "x": -3.4278870880984615, - "y": 0.002316982220368148, - "svg_x": 95.87080402010052, - "svg_y": 388.0164940256824 - }, - { - "x": -3.3837022459281507, - "y": 0.002559288528300005, - "svg_x": 97.5481909547739, - "svg_y": 387.8048789958368 - }, - { - "x": -3.3395174037578395, - "y": 0.002768773463206442, - "svg_x": 99.22557788944727, - "svg_y": 387.6219280808119 - }, - { - "x": -3.2953325615875286, - "y": 0.002937912950730226, - "svg_x": 100.90296482412062, - "svg_y": 387.4742123320726 - }, - { - "x": -3.2511477194172174, - "y": 0.0030634264478196717, - "svg_x": 102.580351758794, - "svg_y": 387.36459676878286 - }, - { - "x": -3.206962877246906, - "y": 0.003147090269864315, - "svg_x": 104.25773869346736, - "svg_y": 387.2915300692401 - }, - { - "x": -3.1627780350765953, - "y": 0.003195954713735132, - "svg_x": 105.93512562814071, - "svg_y": 387.2488549493211 - }, - { - "x": -3.118593192906284, - "y": 0.003221916448122887, - "svg_x": 107.61251256281409, - "svg_y": 387.226181609761 - }, - { - "x": -3.0744083507359727, - "y": 0.0032407201625036775, - "svg_x": 109.28989949748747, - "svg_y": 387.2097596329092 - }, - { - "x": -3.030223508565662, - "y": 0.0032705799740616803, - "svg_x": 110.96728643216083, - "svg_y": 387.1836819588776 - }, - { - "x": -2.986038666395351, - "y": 0.003330695294811018, - "svg_x": 112.6446733668342, - "svg_y": 387.1311810334864 - }, - { - "x": -2.94185382422504, - "y": 0.003439966724407699, - "svg_x": 114.32206030150756, - "svg_y": 387.03575026640186 - }, - { - "x": -2.8976689820547286, - "y": 0.003616184369685506, - "svg_x": 115.99944723618094, - "svg_y": 386.8818529016033 - }, - { - "x": -2.8534841398844177, - "y": 0.0038758663520965255, - "svg_x": 117.67683417085428, - "svg_y": 386.6550630547879 - }, - { - "x": -2.8092992977141065, - "y": 0.004234785019886466, - "svg_x": 119.35422110552767, - "svg_y": 386.3416061528822 - }, - { - "x": -2.765114455543795, - "y": 0.004709059027274733, - "svg_x": 121.03160804020102, - "svg_y": 385.92740518104165 - }, - { - "x": -2.7209296133734844, - "y": 0.005316543236077628, - "svg_x": 122.70899497487441, - "svg_y": 385.39686683033267 - }, - { - "x": -2.6767447712031736, - "y": 0.006078147298138619, - "svg_x": 124.38638190954775, - "svg_y": 384.7317299310948 - }, - { - "x": -2.6325599290328623, - "y": 0.007018683279955856, - "svg_x": 126.06376884422113, - "svg_y": 383.9103251911113 - }, - { - "x": -2.588375086862551, - "y": 0.00816689653076014, - "svg_x": 127.7411557788945, - "svg_y": 382.9075482373789 - }, - { - "x": -2.54419024469224, - "y": 0.00955447058922441, - "svg_x": 129.41854271356786, - "svg_y": 381.69572866775593 - }, - { - "x": -2.500005402521929, - "y": 0.011213998114074414, - "svg_x": 131.09592964824122, - "svg_y": 380.2464021120498 - }, - { - "x": -2.4558205603516177, - "y": 0.013176142299326211, - "svg_x": 132.7733165829146, - "svg_y": 378.5327892727166 - }, - { - "x": -2.411635718181307, - "y": 0.015466432767102797, - "svg_x": 134.45070351758795, - "svg_y": 376.53259418976427 - }, - { - "x": -2.367450876010996, - "y": 0.018102298264606652, - "svg_x": 136.12809045226132, - "svg_y": 374.23059569585735 - }, - { - "x": -2.3232660338406848, - "y": 0.021090992314206837, - "svg_x": 137.8054773869347, - "svg_y": 371.6204590225546 - }, - { - "x": -2.2790811916703735, - "y": 0.024428988799018718, - "svg_x": 139.48286432160808, - "svg_y": 368.7052636576999 - }, - { - "x": -2.2348963495000627, - "y": 0.02810320766963468, - "svg_x": 141.16025125628144, - "svg_y": 365.49643289055643 - }, - { - "x": -2.1907115073297514, - "y": 0.03209410150887552, - "svg_x": 142.8376381909548, - "svg_y": 362.01103820104174 - }, - { - "x": -2.14652666515944, - "y": 0.03638024637711627, - "svg_x": 144.51502512562817, - "svg_y": 358.2677899052919 - }, - { - "x": -2.1023418229891293, - "y": 0.04094371272125957, - "svg_x": 146.1924120603015, - "svg_y": 354.2823465428893 - }, - { - "x": -2.058156980818818, - "y": 0.045775230098893754, - "svg_x": 147.8697989949749, - "svg_y": 350.06280433288975 - }, - { - "x": -2.013972138648507, - "y": 0.05087807783074991, - "svg_x": 149.54718592964826, - "svg_y": 345.60629932362684 - }, - { - "x": -1.969787296478196, - "y": 0.05626977565145946, - "svg_x": 151.22457286432166, - "svg_y": 340.89753088508985 - }, - { - "x": -1.9256024543078851, - "y": 0.06198100985542495, - "svg_x": 152.901959798995, - "svg_y": 335.909699545316 - }, - { - "x": -1.8814176121375739, - "y": 0.06805175414252536, - "svg_x": 154.57934673366836, - "svg_y": 330.6078947988169 - }, - { - "x": -1.837232769967263, - "y": 0.07452512761687477, - "svg_x": 156.2567336683417, - "svg_y": 324.9544591426496 - }, - { - "x": -1.7930479277969518, - "y": 0.08144004739823013, - "svg_x": 157.9341206030151, - "svg_y": 318.9154048216907 - }, - { - "x": -1.7488630856266405, - "y": 0.08882405659950532, - "svg_x": 159.61150753768845, - "svg_y": 312.46667742022527 - }, - { - "x": -1.7046782434563297, - "y": 0.09668775184442237, - "svg_x": 161.28889447236185, - "svg_y": 305.5990225161777 - }, - { - "x": -1.6604934012860184, - "y": 0.10502196952360994, - "svg_x": 162.9662814070352, - "svg_y": 298.320443027372 - }, - { - "x": -1.6163085591157076, - "y": 0.11379835840206126, - "svg_x": 164.64366834170855, - "svg_y": 290.65569913233304 - }, - { - "x": -1.5721237169453963, - "y": 0.12297327358409418, - "svg_x": 166.32105527638194, - "svg_y": 282.6429075271602 - }, - { - "x": -1.527938874775085, - "y": 0.13249421999549524, - "svg_x": 167.9984422110553, - "svg_y": 274.3279140950715 - }, - { - "x": -1.4837540326047742, - "y": 0.14230750717421917, - "svg_x": 169.67582914572867, - "svg_y": 265.75760869553903 - }, - { - "x": -1.439569190434463, - "y": 0.15236547832193598, - "svg_x": 171.35321608040204, - "svg_y": 256.97361176711854 - }, - { - "x": -1.3953843482641521, - "y": 0.1626317155316665, - "svg_x": 173.03060301507543, - "svg_y": 248.00772841029658 - }, - { - "x": -1.3511995060938409, - "y": 0.17308299772117272, - "svg_x": 174.70798994974876, - "svg_y": 238.8802384520938 - }, - { - "x": -1.30701466392353, - "y": 0.18370742466476686, - "svg_x": 176.38537688442213, - "svg_y": 229.60153479823182 - }, - { - "x": -1.2628298217532188, - "y": 0.19449889202295975, - "svg_x": 178.0627638190955, - "svg_y": 220.17694859338522 - }, - { - "x": -1.2186449795829075, - "y": 0.2054488548588255, - "svg_x": 179.7401507537689, - "svg_y": 210.61394244592802 - }, - { - "x": -1.1744601374125967, - "y": 0.2165369037626608, - "svg_x": 181.41753768844222, - "svg_y": 200.9303406456211 - }, - { - "x": -1.1302752952422854, - "y": 0.22772198721362596, - "svg_x": 183.09492462311562, - "svg_y": 191.1619949987251 - }, - { - "x": -1.0860904530719746, - "y": 0.23893609109306826, - "svg_x": 184.77231155778895, - "svg_y": 181.36830474198078 - }, - { - "x": -1.0419056109016633, - "y": 0.2500818398791641, - "svg_x": 186.44969849246235, - "svg_y": 171.6343115077452 - }, - { - "x": -0.9977207687313525, - "y": 0.2610348806492031, - "svg_x": 188.12708542713568, - "svg_y": 162.06861728692533 - }, - { - "x": -0.9535359265610412, - "y": 0.2716511589935541, - "svg_x": 189.80447236180905, - "svg_y": 152.79703010513026 - }, - { - "x": -0.90935108439073, - "y": 0.28177842263187014, - "svg_x": 191.48185929648247, - "svg_y": 143.95251749062885 - }, - { - "x": -0.8651662422204192, - "y": 0.29127061621789874, - "svg_x": 193.1592462311558, - "svg_y": 135.6626349607336 - }, - { - "x": -0.8209814000501079, - "y": 0.30000335676177387, - "svg_x": 194.83663316582917, - "svg_y": 128.03601076510688 - }, - { - "x": -0.7767965578797971, - "y": 0.3078884629472529, - "svg_x": 196.51402010050253, - "svg_y": 121.14965689748414 - }, - { - "x": -0.7326117157094858, - "y": 0.3148855717629324, - "svg_x": 198.1914070351759, - "svg_y": 115.03882386345772 - }, - { - "x": -0.6884268735391745, - "y": 0.32100919334303957, - "svg_x": 199.8687939698493, - "svg_y": 109.69083942798028 - }, - { - "x": -0.6442420313688637, - "y": 0.3263300819174363, - "svg_x": 201.54618090452263, - "svg_y": 105.04391131419479 - }, - { - "x": -0.6000571891985524, - "y": 0.3309704701335142, - "svg_x": 203.223567839196, - "svg_y": 100.99128924578093 - }, - { - "x": -0.5558723470282416, - "y": 0.33509344713360784, - "svg_x": 204.9009547738694, - "svg_y": 97.39054146346182 - }, - { - "x": -0.5116875048579304, - "y": 0.3388874734755469, - "svg_x": 206.57834170854272, - "svg_y": 94.07707841564785 - }, - { - "x": -0.46750266268761953, - "y": 0.34254763379388015, - "svg_x": 208.25572864321612, - "svg_y": 90.88052550039473 - }, - { - "x": -0.42331782051730826, - "y": 0.3462556531994323, - "svg_x": 209.93311557788948, - "svg_y": 87.64217548024303 - }, - { - "x": -0.379132978346997, - "y": 0.35016088460650785, - "svg_x": 211.61050251256287, - "svg_y": 84.23159295015594 - }, - { - "x": -0.3349481361766862, - "y": 0.35436437876964516, - "svg_x": 213.28788944723618, - "svg_y": 80.56052656158184 - }, - { - "x": -0.2907632940063749, - "y": 0.3589077829052686, - "svg_x": 214.96527638190958, - "svg_y": 76.59260426534928 - }, - { - "x": -0.24657845183606408, - "y": 0.36376822627732547, - "svg_x": 216.6426633165829, - "svg_y": 72.34779991824182 - }, - { - "x": -0.20239360966575282, - "y": 0.3688596280403082, - "svg_x": 218.32005025125628, - "svg_y": 67.90129109548116 - }, - { - "x": -0.158208767495442, - "y": 0.37404011136746473, - "svg_x": 219.9974371859297, - "svg_y": 63.376984059284666 - }, - { - "x": -0.11402392532513073, - "y": 0.3791245353462726, - "svg_x": 221.67482412060306, - "svg_y": 58.93656919263699 - }, - { - "x": -0.0698390831548199, - "y": 0.3839006470696864, - "svg_x": 223.35221105527637, - "svg_y": 54.76541478265602 - }, - { - "x": -0.025654240984508192, - "y": 0.3881470589083364, - "svg_x": 225.0295979899498, - "svg_y": 51.05686680616102 - }, - { - "x": 0.01853060118580263, - "y": 0.3916511783707175, - "svg_x": 226.70698492462313, - "svg_y": 47.996590121895395 - }, - { - "x": 0.06271544335611345, - "y": 0.3942253366467558, - "svg_x": 228.3843718592965, - "svg_y": 45.748482818950734 - }, - { - "x": 0.10690028552642428, - "y": 0.3957196363213503, - "svg_x": 230.06175879396986, - "svg_y": 44.44345583497918 - }, - { - "x": 0.151085127696736, - "y": 0.39603042641955505, - "svg_x": 231.73914572864328, - "svg_y": 44.17203138685543 - }, - { - "x": 0.1952699698670468, - "y": 0.3951037788258021, - "svg_x": 233.41653266331664, - "svg_y": 44.98130688563249 - }, - { - "x": 0.23945481203735763, - "y": 0.3929338567226222, - "svg_x": 235.09391959798995, - "svg_y": 46.87637983914471 - }, - { - "x": 0.28363965420766934, - "y": 0.38955660570240125, - "svg_x": 236.77130653266335, - "svg_y": 49.82585763664865 - }, - { - "x": 0.32782449637798017, - "y": 0.3850397242779236, - "svg_x": 238.4486934673367, - "svg_y": 53.770616671641264 - }, - { - "x": 0.372009338548291, - "y": 0.37947032874379705, - "svg_x": 240.12608040201007, - "svg_y": 58.63457507303636 - }, - { - "x": 0.4161941807186018, - "y": 0.372942049436482, - "svg_x": 241.80346733668344, - "svg_y": 64.33596201689767 - }, - { - "x": 0.4603790228889135, - "y": 0.3655434111757971, - "svg_x": 243.4808542713568, - "svg_y": 70.79746551515571 - }, - { - "x": 0.5045638650592243, - "y": 0.3573492075739796, - "svg_x": 245.1582412060302, - "svg_y": 77.95376554943806 - }, - { - "x": 0.5487487072295352, - "y": 0.3484161627521771, - "svg_x": 246.83562814070353, - "svg_y": 85.75532285396146 - }, - { - "x": 0.5929335493998469, - "y": 0.3387835224962189, - "svg_x": 248.51301507537693, - "svg_y": 94.16786263740713 - }, - { - "x": 0.6371183915701577, - "y": 0.3284784205214732, - "svg_x": 250.19040201005024, - "svg_y": 103.16768802602685 - }, - { - "x": 0.6813032337404685, - "y": 0.31752505393460234, - "svg_x": 251.86778894472366, - "svg_y": 112.7336667946952 - }, - { - "x": 0.7254880759107802, - "y": 0.3059560185697742, - "svg_x": 253.54517587939702, - "svg_y": 122.83733179998868 - }, - { - "x": 0.7696729180810911, - "y": 0.29382372648592153, - "svg_x": 255.2225628140704, - "svg_y": 133.43290965899396 - }, - { - "x": 0.8138577602514019, - "y": 0.2812097378049739, - "svg_x": 256.8999497487437, - "svg_y": 144.44917091101868 - }, - { - "x": 0.8580426024217127, - "y": 0.26823011005451347, - "svg_x": 258.5773366834171, - "svg_y": 155.78475823947977 - }, - { - "x": 0.9022274445920244, - "y": 0.25503545937694905, - "svg_x": 260.2547236180905, - "svg_y": 167.3081330156758 - }, - { - "x": 0.9464122867623352, - "y": 0.241805244640202, - "svg_x": 261.93211055276385, - "svg_y": 178.8625671956059 - }, - { - "x": 0.9905971289326461, - "y": 0.2287366979512775, - "svg_x": 263.60949748743724, - "svg_y": 190.2758107104763 - }, - { - "x": 1.0347819711029578, - "y": 0.21602969136412215, - "svg_x": 265.2868844221106, - "svg_y": 201.37330792852399 - }, - { - "x": 1.0789668132732686, - "y": 0.20386951697380692, - "svg_x": 266.96427135678397, - "svg_y": 211.99323643347245 - }, - { - "x": 1.1231516554435794, - "y": 0.19240996017254688, - "svg_x": 268.64165829145725, - "svg_y": 222.00128977394942 - }, - { - "x": 1.1673364976138902, - "y": 0.18175909718993138, - "svg_x": 270.3190452261307, - "svg_y": 231.3030809950905 - }, - { - "x": 1.211521339784202, - "y": 0.17196992964293195, - "svg_x": 271.9964321608041, - "svg_y": 239.85232183121636 - }, - { - "x": 1.2557061819545128, - "y": 0.16303731457455878, - "svg_x": 273.67381909547737, - "svg_y": 247.65350381622972 - }, - { - "x": 1.2998910241248236, - "y": 0.15490174451017114, - "svg_x": 275.35120603015076, - "svg_y": 254.75859702111066 - }, - { - "x": 1.3440758662951353, - "y": 0.14745951009473, - "svg_x": 277.02859296482416, - "svg_y": 261.25817464822086 - }, - { - "x": 1.3882607084654461, - "y": 0.14057779975761067, - "svg_x": 278.70597989949755, - "svg_y": 267.268225937467 - }, - { - "x": 1.432445550635757, - "y": 0.13411252411764132, - "svg_x": 280.38336683417083, - "svg_y": 272.9145894563934 - }, - { - "x": 1.4766303928060678, - "y": 0.12792623967307265, - "svg_x": 282.0607537688443, - "svg_y": 278.31729968108544 - }, - { - "x": 1.5208152349763795, - "y": 0.12190357217991503, - "svg_x": 283.7381407035176, - "svg_y": 283.57711719137956 - }, - { - "x": 1.5650000771466903, - "y": 0.11596201041823524, - "svg_x": 285.41552763819095, - "svg_y": 288.76610207691124 - }, - { - "x": 1.6091849193170011, - "y": 0.11005677379190186, - "svg_x": 287.09291457286434, - "svg_y": 293.92336288284264 - }, - { - "x": 1.6533697614873129, - "y": 0.1041794959941977, - "svg_x": 288.7703015075377, - "svg_y": 299.05620621320224 - }, - { - "x": 1.6975546036576237, - "y": 0.09835151283339667, - "svg_x": 290.44768844221113, - "svg_y": 304.1459987202113 - }, - { - "x": 1.7417394458279345, - "y": 0.09261339706378388, - "svg_x": 292.1250753768844, - "svg_y": 309.1573067220882 - }, - { - "x": 1.7859242879982453, - "y": 0.08701289282645258, - "svg_x": 293.8024623115578, - "svg_y": 314.04843350062254 - }, - { - "x": 1.830109130168557, - "y": 0.08159348966267956, - "svg_x": 295.4798492462312, - "svg_y": 318.7813980364436 - }, - { - "x": 1.8742939723388679, - "y": 0.0763855528957766, - "svg_x": 297.15723618090453, - "svg_y": 323.32968117347247 - }, - { - "x": 1.9184788145091787, - "y": 0.07140128599983042, - "svg_x": 298.8346231155779, - "svg_y": 327.68262516798353 - }, - { - "x": 1.9626636566794904, - "y": 0.06663398846512668, - "svg_x": 300.51201005025126, - "svg_y": 331.8460818220832 - }, - { - "x": 2.006848498849801, - "y": 0.06206125598316489, - "svg_x": 302.18939698492466, - "svg_y": 335.8396176441818 - }, - { - "x": 2.051033341020112, - "y": 0.05765109900480679, - "svg_x": 303.866783919598, - "svg_y": 339.6911702866393 - }, - { - "x": 2.095218183190423, - "y": 0.05336953822680194, - "svg_x": 305.54417085427133, - "svg_y": 343.4304151274219 - }, - { - "x": 2.1394030253607346, - "y": 0.04918812043192671, - "svg_x": 307.2215577889447, - "svg_y": 347.08220140988345 - }, - { - "x": 2.1835878675310454, - "y": 0.04508997402881915, - "svg_x": 308.8989447236181, - "svg_y": 350.66126371662773 - }, - { - "x": 2.227772709701356, - "y": 0.04107342782164594, - "svg_x": 310.5763316582915, - "svg_y": 354.1690615645742 - }, - { - "x": 2.271957551871668, - "y": 0.03715275152929256, - "svg_x": 312.25371859296484, - "svg_y": 357.5931326822549 - }, - { - "x": 2.3161423940419787, - "y": 0.03335613121151739, - "svg_x": 313.93110552763824, - "svg_y": 360.9088611447775 - }, - { - "x": 2.3603272362122896, - "y": 0.029721463665121975, - "svg_x": 315.6084924623116, - "svg_y": 364.0831502826634 - }, - { - "x": 2.4045120783826004, - "y": 0.026290863920869323, - "svg_x": 317.2858793969849, - "svg_y": 367.0792194872361 - }, - { - "x": 2.448696920552912, - "y": 0.02310489079809747, - "svg_x": 318.9632663316583, - "svg_y": 369.8616472466169 - }, - { - "x": 2.492881762723223, - "y": 0.020197411492372003, - "svg_x": 320.6406532663317, - "svg_y": 372.4008560906129 - }, - { - "x": 2.5370666048935337, - "y": 0.017591789775999962, - "svg_x": 322.3180402010051, - "svg_y": 374.67644157570675 - }, - { - "x": 2.5812514470638455, - "y": 0.01529876128924196, - "svg_x": 323.9954271356784, - "svg_y": 376.67902787155583 - }, - { - "x": 2.6254362892341563, - "y": 0.013316029334183386, - "svg_x": 325.67281407035176, - "svg_y": 378.4106207691025 - }, - { - "x": 2.669621131404467, - "y": 0.01162934173930686, - "svg_x": 327.35020100502516, - "svg_y": 379.88366721505133 - }, - { - "x": 2.713805973574779, - "y": 0.010214636781484931, - "svg_x": 329.02758793969855, - "svg_y": 381.1191811990967 - }, - { - "x": 2.7579908157450896, - "y": 0.009040787223736605, - "svg_x": 330.7049748743719, - "svg_y": 382.1443472846079 - }, - { - "x": 2.8021756579154005, - "y": 0.008072511565588254, - "svg_x": 332.3823618090452, - "svg_y": 382.9899781063835 - }, - { - "x": 2.8463605000857113, - "y": 0.00727312623331302, - "svg_x": 334.0597487437186, - "svg_y": 383.6881107814732 - }, - { - "x": 2.890545342256023, - "y": 0.006606939789464267, - "svg_x": 335.737135678392, - "svg_y": 384.2699159577439 - }, - { - "x": 2.934730184426334, - "y": 0.006041203199682887, - "svg_x": 337.41452261306534, - "svg_y": 384.7639945739927 - }, - { - "x": 2.9789150265966446, - "y": 0.0055476053537744045, - "svg_x": 339.0919095477387, - "svg_y": 385.1950717662671 - }, - { - "x": 3.0230998687669564, - "y": 0.005103334328184673, - "svg_x": 340.76929648241213, - "svg_y": 385.583070028228 - }, - { - "x": 3.067284710937267, - "y": 0.00469172161203444, - "svg_x": 342.44668341708547, - "svg_y": 385.942546584808 - }, - { - "x": 3.111469553107578, - "y": 0.004302467273663569, - "svg_x": 344.1240703517588, - "svg_y": 386.2824967459695 - }, - { - "x": 3.155654395277889, - "y": 0.0039314288367225045, - "svg_x": 345.8014572864322, - "svg_y": 386.6065382889954 - }, - { - "x": 3.1998392374482005, - "y": 0.00357996005874073, - "svg_x": 347.4788442211056, - "svg_y": 386.9134889275373 - }, - { - "x": 3.2440240796185114, - "y": 0.00325381308477103, - "svg_x": 349.1562311557789, - "svg_y": 387.1983251013032 - }, - { - "x": 3.288208921788822, - "y": 0.0029616641378080047, - "svg_x": 350.83361809045226, - "svg_y": 387.4534695449565 - }, - { - "x": 3.332393763959134, - "y": 0.002713377658558054, - "svg_x": 352.51100502512566, - "svg_y": 387.6703072788363 - }, - { - "x": 3.3765786061294447, - "y": 0.0025181727194137945, - "svg_x": 354.18839195979905, - "svg_y": 387.840786947218 - }, - { - "x": 3.4207634482997555, - "y": 0.002382886367062822, - "svg_x": 355.8657788944724, - "svg_y": 387.9589375052238 - }, - { - "x": 3.4649482904700664, - "y": 0.0023105334984811314, - "svg_x": 357.5431658291457, - "svg_y": 388.0221259321987 - }, - { - "x": 3.509133132640378, - "y": 0.002299339525314164, - "svg_x": 359.22055276381917, - "svg_y": 388.03190204156226 - }, - { - "x": 3.553317974810689, - "y": 0.002342372821469825, - "svg_x": 360.8979396984925, - "svg_y": 387.9943194778723 - }, - { - "x": 3.5975028169809997, - "y": 0.0024278347355157397, - "svg_x": 362.57532663316584, - "svg_y": 387.9196824383092 - }, - { - "x": 3.6416876591513114, - "y": 0.002539984145932302, - "svg_x": 364.25271356783924, - "svg_y": 387.82173822449556 - }, - { - "x": 3.6858725013216223, - "y": 0.00266059114609928, - "svg_x": 365.9301005025126, - "svg_y": 387.71640768581597 - }, - { - "x": 3.730057343491933, - "y": 0.0027707415340285407, - "svg_x": 367.60748743718597, - "svg_y": 387.6202092920222 - }, - { - "x": 3.774242185662244, - "y": 0.0028527615963428567, - "svg_x": 369.2848743718593, - "svg_y": 387.548578148439 - }, - { - "x": 3.8184270278325556, - "y": 0.0028920110633454373, - "svg_x": 370.9622613065327, - "svg_y": 387.5143001422159 - }, - { - "x": 3.8626118700028664, - "y": 0.0028783073053032645, - "svg_x": 372.6396482412061, - "svg_y": 387.52626813921876 - }, - { - "x": 3.9067967121731773, - "y": 0.0028067962210261664, - "svg_x": 374.3170351758794, - "svg_y": 387.5887214049333 - }, - { - "x": 3.950981554343488, - "y": 0.0026781680364643024, - "svg_x": 375.9944221105527, - "svg_y": 387.70105713959646 - }, - { - "x": 3.9951663965138, - "y": 0.00249821579518853, - "svg_x": 377.67180904522615, - "svg_y": 387.85821606473297 - }, - { - "x": 4.0393512386841115, - "y": 0.0022768327260684323, - "svg_x": 379.3491959798996, - "svg_y": 388.05155805891803 - }, - { - "x": 4.083536080854421, - "y": 0.0020266235580977277, - "svg_x": 381.0265829145729, - "svg_y": 388.2700749477258 - }, - { - "x": 4.127720923024733, - "y": 0.0017613498743171332, - "svg_x": 382.7039698492462, - "svg_y": 388.5017482334508 - }, - { - "x": 4.171905765195045, - "y": 0.0014944339249074296, - "svg_x": 384.3813567839196, - "svg_y": 388.73485577028185 - }, - { - "x": 4.216090607365355, - "y": 0.0012377111179778001, - "svg_x": 386.058743718593, - "svg_y": 388.9590612600776 - }, - { - "x": 4.2602754495356665, - "y": 0.0010005588724088612, - "svg_x": 387.7361306532664, - "svg_y": 389.1661750572889 - }, - { - "x": 4.304460291705976, - "y": 0.0007894538513937033, - "svg_x": 389.4135175879397, - "svg_y": 389.350540853227 - }, - { - "x": 4.348645133876288, - "y": 0.0006079369247854676, - "svg_x": 391.09090452261313, - "svg_y": 389.5090662757368 - }, - { - "x": 4.3928299760466, - "y": 0.0004569087173062373, - "svg_x": 392.76829145728647, - "svg_y": 389.6409647760525 - }, - { - "x": 4.43701481821691, - "y": 0.0003351459303867038, - "svg_x": 394.4456783919598, - "svg_y": 389.747304705904 - }, - { - "x": 4.4811996603872215, - "y": 0.00023992108230452394, - "svg_x": 396.1230653266332, - "svg_y": 389.8304680756114 - }, - { - "x": 4.525384502557533, - "y": 0.00016762178506926528, - "svg_x": 397.8004522613066, - "svg_y": 389.89360971675495 - }, - { - "x": 4.569569344727843, - "y": 0.00011429271609108016, - "svg_x": 399.47783919597987, - "svg_y": 389.94018395834104 - }, - { - "x": 4.613754186898155, - "y": 0.00007605568471392627, - "svg_x": 401.15522613065326, - "svg_y": 389.9735777672152 - }, - { - "x": 4.657939029068467, - "y": 0.00004939342986240425, - "svg_x": 402.8326130653267, - "svg_y": 389.9968628971167 - }, - { - "x": 4.7021238712387765, - "y": 0.00003130622022640016, - "svg_x": 404.51000000000005, - "svg_y": 390.0126591239654 - } - ] - ], - "selectors": [ - "g[id='maidr-03825914-44f3-4ca5-94f0-42078a82560e'] path" - ] - } - ] - } - ] - ] -}; - -const smoothSvgInnerHTML = ` - - - - 2025-11-11T11:50:33.867359 - image/svg+xml - - - Matplotlib v3.10.6, https://matplotlib.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `; +import { barData, barSvgInnerHTML } from './data/barData'; +import { lineData, lineSvgInnerHTML } from './data/lineData'; +import { smoothData, smoothSvgInnerHTML } from './data/smoothData'; function BarChart() { return ( @@ -3332,4 +70,4 @@ function App() { document.addEventListener('DOMContentLoaded', () => { createRoot(document.getElementById('root')!).render(); -}); +}); \ No newline at end of file diff --git a/examples/react-app/tsconfig.json b/examples/react-app/tsconfig.json new file mode 100644 index 00000000..df6c9e78 --- /dev/null +++ b/examples/react-app/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "maidr/react": ["../../src/react-entry.ts"], + "@command/*": ["../../src/command/*"], + "@model/*": ["../../src/model/*"], + "@state/*": ["../../src/state/*"], + "@service/*": ["../../src/service/*"], + "@type/*": ["../../src/type/*"], + "@ui/*": ["../../src/ui/*"], + "@util/*": ["../../src/util/*"] + } + }, + "include": ["./**/*.ts", "./**/*.tsx"], + "exclude": ["node_modules"] +} diff --git a/examples/react-app/vite.config.ts b/examples/react-app/vite.config.ts index dde205fa..6bb48c26 100644 --- a/examples/react-app/vite.config.ts +++ b/examples/react-app/vite.config.ts @@ -5,8 +5,10 @@ import { defineConfig } from 'vite'; import { viteSingleFile } from 'vite-plugin-singlefile'; /** - * Post-build plugin that strips `type="module"` from inlined scripts - * so the single-file HTML works when opened via the file:// protocol. + * Post-build plugin that strips `type="module"` and `crossorigin` from + * inlined scripts so the single-file HTML works when opened via the + * file:// protocol. Uses attribute-level replacement so it handles any + * attribute order or extra attributes Vite may add in the future. */ function stripModuleType() { return { @@ -15,7 +17,9 @@ function stripModuleType() { const outPath = path.resolve(__dirname, '../react/index.html'); if (fs.existsSync(outPath)) { let html = fs.readFileSync(outPath, 'utf-8'); - html = html.replace(/ - - - -
- - diff --git a/scripts/build-site.js b/scripts/build-site.js index 03be4ed0..1b898fe6 100644 --- a/scripts/build-site.js +++ b/scripts/build-site.js @@ -8,6 +8,7 @@ * - TypeDoc generates API docs separately */ +const { execSync } = require('node:child_process'); const fs = require('node:fs'); const path = require('node:path'); const { marked } = require('marked'); @@ -210,8 +211,6 @@ if (fs.existsSync(distSource)) { // Build React example console.log('Building React example...'); -const { execSync } = require('node:child_process'); - execSync('npm run build:react-example', { stdio: 'inherit', cwd: ROOT }); // Copy examples folder