@cloudflare/kumo 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/README.md +3 -39
- package/ai/USAGE.md +89 -80
- package/ai/component-registry.json +165 -55
- package/ai/component-registry.md +484 -94
- package/ai/schemas.ts +4 -2
- package/bin/kumo.js +1 -1
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +1928 -1916
- package/dist/ai/schemas.js +5550 -4085
- package/dist/blocks-source/delete-resource/delete-resource.tsx +5 -5
- package/dist/blocks-source/resource-list/resource-list.test.tsx +1 -1
- package/dist/blocks-source/resource-list/resource-list.tsx +1 -4
- package/dist/button-Bbi7gFL7.d.ts +227 -0
- package/dist/catalog.d.ts +377 -0
- package/dist/catalog.js +347 -215
- package/dist/chunks/AlertDialogTrigger-fn9yjykev9h5l12q.js +24 -0
- package/dist/chunks/AutocompleteItem-clgm7u7zzgjy1hvb.js +82 -0
- package/dist/chunks/Button-oczevl8g75m85ew9.js +27 -0
- package/dist/chunks/CSPContext-guqghj8kxoukvlky.js +17 -0
- package/dist/chunks/CSPProvider-ogozggb4nr6evned.js +24 -0
- package/dist/chunks/CheckboxGroup-h9w1c6bo2nlcc4uj.js +177 -0
- package/dist/chunks/CheckboxGroupContext-f9wox07n2u5moq4h.js +12 -0
- package/dist/chunks/CheckboxIndicator-gz18hapnzraxyz9a.js +49 -0
- package/dist/chunks/CheckboxRoot-g6fb44xqgc0qxusf.js +361 -0
- package/dist/chunks/CollapsiblePanel-mnjlf99v79k3yabx.js +177 -0
- package/dist/chunks/ComboboxChipRemove-opf1zyu9yyp98dqd.js +302 -0
- package/dist/chunks/ComboboxClear-fi4op1n12c99ktca.js +302 -0
- package/dist/chunks/ComboboxEmpty-dr78bn7zilhqbkgc.js +1882 -0
- package/dist/chunks/ComboboxPopup-bugeajuqjattk1n7.js +205 -0
- package/dist/chunks/CompositeItem-l7zee38lq5m224d5.js +23 -0
- package/dist/chunks/CompositeList-bek8pmx9o8cu36ig.js +129 -0
- package/dist/chunks/CompositeListContext-oetjj2x8li8678as.js +18 -0
- package/dist/chunks/CompositeRoot-jm9n0rrea12rfny1.js +225 -0
- package/dist/chunks/CompositeRootContext-ofhzmevv7hadjhyy.js +12 -0
- package/dist/chunks/DialogHandle-o964gplvp59qqv23.js +139 -0
- package/dist/chunks/DialogPopup-cz73mkiyi9c33mhn.js +174 -0
- package/dist/chunks/DialogRoot-kfhbouiouenljp3q.js +15 -0
- package/dist/chunks/DialogTrigger-gzxvssie7e5e1iba.js +139 -0
- package/dist/chunks/DirectionContext-jc1g0w645603sd6p.js +13 -0
- package/dist/chunks/DirectionProvider-gdktkteyrlpnokak.js +21 -0
- package/dist/chunks/FieldControl-oz007qbkl6ejp7di.js +104 -0
- package/dist/chunks/FieldDescription-go88jdymmj9o0ugi.js +121 -0
- package/dist/chunks/FieldItemContext-j85dc0ihramj5ezs.js +10 -0
- package/dist/chunks/FieldLabel-junk2aczkvogpv5d.js +558 -0
- package/dist/chunks/FieldsetLegend-ch85hugankjah152.js +68 -0
- package/dist/chunks/FieldsetRootContext-b633e9uzilttuyfi.js +12 -0
- package/dist/chunks/FloatingPortalLite-ld4o97z16w23x6za.js +25 -0
- package/dist/chunks/FloatingTree-jdm71b3m43e34hk7.js +115 -0
- package/dist/chunks/Form-f1ibju5npd1qqowg.js +102 -0
- package/dist/chunks/FormContext-xz0b4h7ue30fkkn1.js +17 -0
- package/dist/chunks/Input-opaph7rt3w2vx3c0.js +20 -0
- package/dist/chunks/LabelableContext-hetas2e4y0kywfas.js +131 -0
- package/dist/chunks/MenuBackdrop-m0tfcr6sg50f9sn5.js +78 -0
- package/dist/chunks/MenuSubmenuTrigger-n281iqpstcnacsk6.js +1532 -0
- package/dist/chunks/MenuTrigger-dwh2ewyxp5j3ml02.js +266 -0
- package/dist/chunks/Menubar-m8euwx8biy1qpo44.js +117 -0
- package/dist/chunks/MenubarContext-ei2r6vu6lmsspozo.js +12 -0
- package/dist/chunks/MeterLabel-efe4koezlgg05cv8.js +151 -0
- package/dist/chunks/PopoverClose-inm8xliypc51murq.js +666 -0
- package/dist/chunks/RadioGroup-h25jrjmet0gxrvex.js +165 -0
- package/dist/chunks/RadioGroupContext-ft0nndmzqynjz8a2.js +10 -0
- package/dist/chunks/RadioIndicator-lvpixnzpkxpq7rp1.js +296 -0
- package/dist/chunks/ScrollAreaThumb-jydo7azxxwjn1cqf.js +944 -0
- package/dist/chunks/SelectGroupLabel-mug19qcz2k67qule.js +1600 -0
- package/dist/chunks/Separator-b8wf5rea6m1cei8k.js +24 -0
- package/dist/chunks/SwitchRoot-gumgk7356eqv7dve.js +237 -0
- package/dist/chunks/TabsList-obzldrvfzo50uqr4.js +617 -0
- package/dist/chunks/Toggle-hlf7recxsq6mxvax.js +89 -0
- package/dist/chunks/ToggleGroup-l8tfcwe33tlqqm8a.js +106 -0
- package/dist/chunks/ToggleGroupContext-cdk2zo6ciddpockn.js +12 -0
- package/dist/chunks/ToolbarGroupContext-nriz3632ymugfj6h.js +12 -0
- package/dist/chunks/ToolbarInput-oy7o682hhn2jdjen.js +152 -0
- package/dist/chunks/ToolbarRootContext-lvi96r1vvs93rhde.js +12 -0
- package/dist/chunks/TooltipPopup-ehusafczcky9jvae.js +868 -0
- package/dist/chunks/TooltipProvider-iq6hgymrn3b68h50.js +64 -0
- package/dist/chunks/addEventListener-lhqvk2ahlzjsanyg.js +13 -0
- package/dist/chunks/areArraysEqual-nlbeaqlzf4274zr3.js +7 -0
- package/dist/chunks/autocomplete-m8n1c775n0iilomf.js +152 -0
- package/dist/chunks/badge-e16yhhe9xibra5k7.js +148 -0
- package/dist/chunks/banner-cu2mip76zfx0gf27.js +258 -0
- package/dist/chunks/bash-jpzh6zbf5237424t.js +3 -0
- package/dist/chunks/breadcrumbs-hxibrxjtvudy0ir9.js +164 -0
- package/dist/chunks/button-eikucjpgqbsn5m5m.js +260 -0
- package/dist/chunks/chart-bxxlck50zlsbj3kl.js +3083 -0
- package/dist/chunks/checkbox-fovnhs7f1sekaxrh.js +158 -0
- package/dist/chunks/clamp-kvu4wtr1dw6b3pnd.js +7 -0
- package/dist/chunks/clipboard-text-fuyj4apm2xry4hkk.js +198 -0
- package/dist/chunks/cloudflare-logo-g0aimzpllornl0rc.js +186 -0
- package/dist/chunks/code-eu8kzwqnlhoyin24.js +96 -0
- package/dist/chunks/collapsible-lj0glxe1hezap65x.js +178 -0
- package/dist/chunks/combobox-m2nvbt0b1stb2syc.js +301 -0
- package/dist/chunks/command-palette-jjrbvylvvbj0qusg.js +507 -0
- package/dist/chunks/composite-o65hjzwwzb4kvl4w.js +102 -0
- package/dist/chunks/constants-j09lrtg73n4vlx5x.js +5 -0
- package/dist/chunks/core-kjfqbvgicl9i3abf.js +7163 -0
- package/dist/chunks/createBaseUIEventDetails-ddivuhl74gni72qn.js +86 -0
- package/dist/chunks/createToastManager-kjd838m8jog8pddj.js +1233 -0
- package/dist/chunks/css-d3t41yfupsmz7l1a.js +4 -0
- package/dist/chunks/date-picker-njfirc1m165k6yax.js +6786 -0
- package/dist/chunks/date-range-picker-g6sje1ua7n7jerkq.js +335 -0
- package/dist/chunks/dialog-b4r3dv8uvgl2pqem.js +170 -0
- package/dist/chunks/diff-g2re0kj6fh27rgg5.js +4 -0
- package/dist/chunks/dropdown-k0y5j6iuad7tvqgx.js +279 -0
- package/dist/chunks/empty-hmu7x39lnp0z2qm6.js +89 -0
- package/dist/chunks/engine-io35xsj9fgfxtihg.js +10 -0
- package/dist/chunks/engine-javascript-d795u677f1802oaf.js +3103 -0
- package/dist/chunks/engine-oniguruma-xjlw46ay321yj1av.js +388 -0
- package/dist/chunks/error-mm98alb8acdy93vq.js +15 -0
- package/dist/chunks/field-dxe9ne8fqy5whws2.js +70 -0
- package/dist/chunks/flow-fbsv3yek3w7v5a6p.js +10270 -0
- package/dist/chunks/formatNumber-hjijm58g645q6a0n.js +26 -0
- package/dist/chunks/getCssDimensions-mi941fe1jvztqm6b.js +21 -0
- package/dist/chunks/getEmptyRootContext-2utawetz04dqkzyn.js +18 -0
- package/dist/chunks/getPseudoElementBounds-jg72lmrlwgbqhmjh.js +28 -0
- package/dist/chunks/github-light-kb466scjoy42qxpu.js +5 -0
- package/dist/chunks/graphql-gtqr4wytdf0qjybo.js +16 -0
- package/dist/chunks/grid-d43q1qme6ffbbcl1.js +118 -0
- package/dist/chunks/hcl-ohpfnrffs96hzyj5.js +4 -0
- package/dist/chunks/html-ijyj3f9k0foag15c.js +12 -0
- package/dist/chunks/index.parts-9xtishx4m3j6sbg9.js +1429 -0
- package/dist/chunks/index.parts-bsarfaby0ttw67bb.js +206 -0
- package/dist/chunks/index.parts-buqjmx1pfsd225r7.js +30 -0
- package/dist/chunks/index.parts-bzlq2foymrigspiz.js +81 -0
- package/dist/chunks/index.parts-c4kz48uuogge3k9g.js +1462 -0
- package/dist/chunks/index.parts-cou5w8shwfwuk6wo.js +128 -0
- package/dist/chunks/index.parts-etb66t5m85rhhipe.js +11 -0
- package/dist/chunks/index.parts-f3xvfc67ai7txeru.js +127 -0
- package/dist/chunks/index.parts-g0wrrbkxyh0oo730.js +171 -0
- package/dist/chunks/index.parts-g27bw668q8dtcjz8.js +1229 -0
- package/dist/chunks/index.parts-gcwd6ds0od2n1i0p.js +10 -0
- package/dist/chunks/index.parts-ghwrm31fyo614381.js +23 -0
- package/dist/chunks/index.parts-giu46tgp0ypgfq6a.js +88 -0
- package/dist/chunks/index.parts-hi0bbzsnswj74v28.js +11 -0
- package/dist/chunks/index.parts-ixizrcasario34jo.js +213 -0
- package/dist/chunks/index.parts-j775zfdbhcd9ypeb.js +41 -0
- package/dist/chunks/index.parts-jmkwypigix07dit1.js +119 -0
- package/dist/chunks/index.parts-kdoulw17e9zk96yw.js +156 -0
- package/dist/chunks/index.parts-kh9waplhfwlszcyp.js +245 -0
- package/dist/chunks/index.parts-kwqb2nzc7u2zzxqs.js +2464 -0
- package/dist/chunks/index.parts-kwx43zlomuu96clc.js +46 -0
- package/dist/chunks/index.parts-lojnx790s6z0mi1f.js +388 -0
- package/dist/chunks/index.parts-n6t1aj932fytioz8.js +692 -0
- package/dist/chunks/index.parts-ngc39crwuz80oiij.js +13 -0
- package/dist/chunks/index.parts-nq06i1gji6fjnmln.js +192 -0
- package/dist/chunks/index.parts-omt7bu8mbte48ulb.js +73 -0
- package/dist/chunks/index.parts-pb65142mbin4hpc7.js +564 -0
- package/dist/chunks/index2.parts-k2au6nzued1wgy6t.js +95 -0
- package/dist/chunks/index2.parts-noiw2eweufmplfsp.js +10 -0
- package/dist/chunks/inertValue-f9pgp32jxnm88df3.js +9 -0
- package/dist/chunks/input-dwl9oy1f1ufah0bx.js +145 -0
- package/dist/chunks/input-group-otq3m9lach1jyxl0.js +452 -0
- package/dist/chunks/input-o3mtvvtqf69j5k10.js +85 -0
- package/dist/chunks/isElementDisabled-ffsy1y4adxocmexb.js +7 -0
- package/dist/chunks/javascript-b6fq9bl50fdj6813.js +4 -0
- package/dist/chunks/json-h2g0z143t3cs13d7.js +4 -0
- package/dist/chunks/jsonc-jxlzvingck161eej.js +4 -0
- package/dist/chunks/jsx-jp7a33937sef92sn.js +4 -0
- package/dist/chunks/label-opyibemromjwmd0s.js +72 -0
- package/dist/chunks/layer-card-nah241sxhj6i7i03.js +72 -0
- package/dist/chunks/link-1b3jda6cdzl4lkeo.js +112 -0
- package/dist/chunks/link-provider-l9ohtet4pj559eg0.js +60 -0
- package/dist/chunks/loader-j2v6fab8iucuxz1z.js +91 -0
- package/dist/chunks/markdown-eybeqjr58vfygtz1.js +4 -0
- package/dist/chunks/menubar-m0h31eymts6exeke.js +103 -0
- package/dist/chunks/mergeCleanups-pexn3wul6a4zn873.js +15 -0
- package/dist/chunks/meter-iauic8ww87xxqf74.js +35 -0
- package/dist/chunks/pagination-k0yll9ynbi8flc3b.js +290 -0
- package/dist/chunks/popover-l0xg7b854w7txyoz.js +152 -0
- package/dist/chunks/popupStateMapping-jpzw7eyzl8ghiv8s.js +868 -0
- package/dist/chunks/popupStoreUtils-fpjh6veok5pa2hd1.js +367 -0
- package/dist/chunks/portal-provider-langu3fqwfr9tlhm.js +59 -0
- package/dist/chunks/python-nrpnmxq4r6yp6fcd.js +4 -0
- package/dist/chunks/radio-igpo6t2t2tpe08d5.js +173 -0
- package/dist/chunks/resolve-variant-l6x5ksfrjtu4m66l.js +35 -0
- package/dist/chunks/resolveAriaLabelledBy-h9qwvo10ftlj6t9k.js +10 -0
- package/dist/chunks/resolveValueLabel-i36fqhi09ki67hx5.js +89 -0
- package/dist/chunks/rolldown-runtime-hi7ti5xiuxsegr96.js +18 -0
- package/dist/chunks/safePolygon-flrfpyc6fpidq4fb.js +659 -0
- package/dist/chunks/safeReact-bavzz23j5tex60z2.js +18 -0
- package/dist/chunks/select-ln6ibqbbs0n4tiig.js +262 -0
- package/dist/chunks/sensitive-input-karaei12un7z7nep.js +256 -0
- package/dist/chunks/serializeValue-ci3kihruew64i36f.js +13 -0
- package/dist/chunks/shellscript-i4m7lo8wi0f5bl8b.js +4 -0
- package/dist/chunks/sidebar-kvjzu0ya0b2z6eec.js +1297 -0
- package/dist/chunks/skeleton-line-f6sju1dxawm8h9tg.js +40 -0
- package/dist/chunks/sql-do9h6435gka97c4c.js +4 -0
- package/dist/chunks/store-i9l3lkcl6auhkpfl.js +88 -0
- package/dist/chunks/stringifyLocale-cl8et9xf6zon4qbs.js +9 -0
- package/dist/chunks/styles-dbhgpd8fm76fdfo3.js +35 -0
- package/dist/chunks/surface-jwwh5xl06kv9tp7b.js +30 -0
- package/dist/chunks/switch-cusffup6w3tan5ot.js +202 -0
- package/dist/chunks/table-ds3nzcffm3pu9o0l.js +238 -0
- package/dist/chunks/table-of-contents-l66abisn473qzd07.js +231 -0
- package/dist/chunks/tabs-dz3fsnkrznrggilz.js +255 -0
- package/dist/chunks/text-e1ko7r96hsoz2tor.js +109 -0
- package/dist/chunks/toast-itl6qo5oy1vy6d36.js +324 -0
- package/dist/chunks/toml-oyqrgosuct25x413.js +4 -0
- package/dist/chunks/toolbar-gwd1orc8yl7lzaou.js +127 -0
- package/dist/chunks/tooltip-maelyxs1y7a78vje.js +90 -0
- package/dist/chunks/tsx-pem8x69upvmibv6l.js +4 -0
- package/dist/chunks/typescript-pe5y016phdwbgws7.js +4 -0
- package/dist/chunks/useAnchoredPopupScrollLock-bx8vvwcdp25ix0kj.js +31 -0
- package/dist/chunks/useAnimationFrame-ssgc72hyq6sg3yit.js +86 -0
- package/dist/chunks/useAriaLabelledBy-bvw56m1d7czf0w3f.js +38 -0
- package/dist/chunks/useBaseUiId-gqkl5ep5pn6hd0rw.js +13 -0
- package/dist/chunks/useButton-cpo6u2idqcnou6vy.js +149 -0
- package/dist/chunks/useClick-fvwb39qgead2jyft.js +86 -0
- package/dist/chunks/useCollapsiblePanel-bw63vwvq9a3sj73q.js +379 -0
- package/dist/chunks/useCompositeItem-esr3n4pmlssiuxuy.js +31 -0
- package/dist/chunks/useCompositeListItem-0exfww37ospqz69b.js +75 -0
- package/dist/chunks/useControlled-nlx0kk1ksgk0auvi.js +52 -0
- package/dist/chunks/useDismiss-l2gbj4cain4zqtne.js +353 -0
- package/dist/chunks/useFilteredItems-ckor5h4rcmztfgt1.js +183 -0
- package/dist/chunks/useFloatingRootContext-jo582qzez5k9gbgk.js +51 -0
- package/dist/chunks/useFocus-e8drzpkl9flxq1o1.js +122 -0
- package/dist/chunks/useForcedRerendering-el1fbg3ib5yo0v7k.js +14 -0
- package/dist/chunks/useId-l9soitgw3e4jk5ie.js +32 -0
- package/dist/chunks/useIsHydrating-b6whcsimonagru6u.js +22 -0
- package/dist/chunks/useLabel-nh9hf8h7o6oquqn5.js +47 -0
- package/dist/chunks/useLabelableId-b1kwq9st3rjrtakn.js +60 -0
- package/dist/chunks/useListNavigation-iyo9r9vug2g1clmc.js +447 -0
- package/dist/chunks/useOnMount-j4wobeq47l3u9olo.js +12 -0
- package/dist/chunks/useOpenChangeComplete-dpkex2e23s1evpol.js +117 -0
- package/dist/chunks/usePopupViewport-at3zpph46apa78a3.js +343 -0
- package/dist/chunks/usePositioner-h1n5q86am1sjo5hn.js +602 -0
- package/dist/chunks/usePreviousValue-le0grv8f43vmunn1.js +21 -0
- package/dist/chunks/useRegisterFieldControl-m1rxsuvtpau2341n.js +34 -0
- package/dist/chunks/useRegisteredLabelId-dh83mybmzy75waje.js +16 -0
- package/dist/chunks/useRender-gtnbrp1ityffi4xf.js +13 -0
- package/dist/chunks/useRenderDialogRoot-ecyv072j7yj8q0w3.js +262 -0
- package/dist/chunks/useRenderElement-m8kc7jyuczp71mq8.js +433 -0
- package/dist/chunks/useScrollLock-lj0spjth12xjeap0.js +854 -0
- package/dist/chunks/useStableCallback-ninxmksdjvwl6ejj.js +38 -0
- package/dist/chunks/useSwipeDismiss-bpbyw2ihsw3fw6y9.js +818 -0
- package/dist/chunks/useTimeout-oqptmu2xmyv5ccic.js +43 -0
- package/dist/chunks/useTransitionStatus-ig4waxl2kervpyw4.js +66 -0
- package/dist/chunks/useTriggerFocusGuards-j8nano0pqu9dscrz.js +49 -0
- package/dist/chunks/useTypeahead-onenwjyhgw955ygx.js +114 -0
- package/dist/chunks/useValueAsRef-lrn42zari17368c9.js +27 -0
- package/dist/chunks/useValueChanged-kthmz4wk7ywnjwtx.js +18 -0
- package/dist/chunks/utils-0i7gujfv3f3e9dqh.js +19 -0
- package/dist/chunks/valueToPercent-henpkkj3juy3ukeu.js +7 -0
- package/dist/chunks/vendor-floating-ui-dsysdmve7iazaaes.js +1558 -0
- package/dist/chunks/vendor-styling-da1xibnxfkjmtglr.js +3631 -0
- package/dist/chunks/vendor-utils-luqsvbyuig727bnr.js +512 -0
- package/dist/chunks/vesper-ho3j3gt6ilwfuc1g.js +5 -0
- package/dist/chunks/visuallyHidden-n14xllazfozg55ox.js +24 -0
- package/dist/chunks/wasm-nfbosyhilcq70atf.js +8 -0
- package/dist/chunks/yaml-kzk5ddyekbyha04v.js +4 -0
- package/dist/cn-DCSItmT-.d.ts +5 -0
- package/dist/code/server.d.ts +97 -0
- package/dist/code/server.js +146 -84
- package/dist/code.d.ts +82 -0
- package/dist/code.js +348 -248
- package/dist/components/autocomplete.d.ts +2 -0
- package/dist/components/autocomplete.js +2 -8
- package/dist/components/badge.d.ts +2 -0
- package/dist/components/badge.js +2 -6
- package/dist/components/banner.d.ts +2 -0
- package/dist/components/banner.js +2 -6
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +2 -8
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +2 -8
- package/dist/components/chart.d.ts +2 -0
- package/dist/components/chart.js +2 -11
- package/dist/components/checkbox.d.ts +2 -0
- package/dist/components/checkbox.js +2 -7
- package/dist/components/clipboard-text.d.ts +2 -0
- package/dist/components/clipboard-text.js +2 -5
- package/dist/components/cloudflare-logo.d.ts +2 -0
- package/dist/components/cloudflare-logo.js +2 -9
- package/dist/components/code.d.ts +2 -0
- package/dist/components/code.js +2 -6
- package/dist/components/collapsible.d.ts +2 -0
- package/dist/components/collapsible.js +2 -5
- package/dist/components/combobox.d.ts +2 -0
- package/dist/components/combobox.js +2 -5
- package/dist/components/command-palette.d.ts +2 -0
- package/dist/components/command-palette.js +2 -7
- package/dist/components/date-picker.d.ts +2 -0
- package/dist/components/date-picker.js +2 -5
- package/dist/components/date-range-picker.d.ts +2 -0
- package/dist/components/date-range-picker.js +2 -5
- package/dist/components/dialog.d.ts +2 -0
- package/dist/components/dialog.js +2 -10
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +2 -5
- package/dist/components/empty.d.ts +2 -0
- package/dist/components/empty.js +2 -8
- package/dist/components/field.d.ts +2 -0
- package/dist/components/field.js +2 -9
- package/dist/components/flow.d.ts +2 -0
- package/dist/components/flow.js +2 -5795
- package/dist/components/grid.d.ts +2 -0
- package/dist/components/grid.js +2 -10
- package/dist/components/input-group.d.ts +2 -0
- package/dist/components/input-group.js +2 -7
- package/dist/components/input.d.ts +4 -0
- package/dist/components/input.js +4 -13
- package/dist/components/label.d.ts +2 -0
- package/dist/components/label.js +2 -9
- package/dist/components/layer-card.d.ts +2 -0
- package/dist/components/layer-card.js +2 -5
- package/dist/components/link.d.ts +68 -0
- package/dist/components/link.js +2 -8
- package/dist/components/loader.d.ts +2 -0
- package/dist/components/loader.js +3 -7
- package/dist/components/menubar.d.ts +2 -0
- package/dist/components/menubar.js +2 -6
- package/dist/components/meter.d.ts +2 -0
- package/dist/components/meter.js +2 -5
- package/dist/components/pagination.d.ts +2 -0
- package/dist/components/pagination.js +2 -5
- package/dist/components/popover.d.ts +2 -0
- package/dist/components/popover.js +2 -13
- package/dist/components/radio.d.ts +2 -0
- package/dist/components/radio.js +2 -9
- package/dist/components/select.d.ts +2 -0
- package/dist/components/select.js +2 -5
- package/dist/components/sensitive-input.d.ts +2 -0
- package/dist/components/sensitive-input.js +2 -7
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +2 -33
- package/dist/components/surface.d.ts +2 -0
- package/dist/components/surface.js +2 -5
- package/dist/components/switch.d.ts +2 -0
- package/dist/components/switch.js +2 -7
- package/dist/components/table-of-contents.d.ts +2 -0
- package/dist/components/table-of-contents.js +2 -7
- package/dist/components/table.d.ts +2 -0
- package/dist/components/table.js +2 -7
- package/dist/components/tabs.d.ts +2 -0
- package/dist/components/tabs.js +2 -5
- package/dist/components/text.d.ts +2 -0
- package/dist/components/text.js +2 -5
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +3 -10
- package/dist/components/toolbar.d.ts +2 -0
- package/dist/components/toolbar.js +2 -7
- package/dist/components/tooltip.d.ts +2 -0
- package/dist/components/tooltip.js +2 -6
- package/dist/field-DIjlHM8W.d.ts +91 -0
- package/dist/index-AMEc1MEg2.d.ts +180 -0
- package/dist/index-B-hCpI5K.d.ts +1 -0
- package/dist/index-B6LJIy7_2.d.ts +52 -0
- package/dist/index-B9niVl3r.d.ts +140 -0
- package/dist/index-BAQwS4mL.d.ts +70 -0
- package/dist/index-BD-gTiEv.d.ts +71 -0
- package/dist/index-BVgXnR1V.d.ts +137 -0
- package/dist/index-Bgl_czT12.d.ts +140 -0
- package/dist/index-BkyMHk632.d.ts +110 -0
- package/dist/index-BlEUcijd.d.ts +795 -0
- package/dist/index-BoPqM1Ia2.d.ts +179 -0
- package/dist/index-BzE0aNpx.d.ts +143 -0
- package/dist/index-C3iraF8M2.d.ts +100 -0
- package/dist/index-CGbkysYW2.d.ts +161 -0
- package/dist/index-CLsBWiaS.d.ts +79 -0
- package/dist/index-CSWbPhke.d.ts +126 -0
- package/dist/index-CYoiniZ4.d.ts +135 -0
- package/dist/index-CeBzVJP8.d.ts +426 -0
- package/dist/index-ClS-eFxE.d.ts +104 -0
- package/dist/index-Cp0aQngm.d.ts +182 -0
- package/dist/index-CzIWigmH.d.ts +62 -0
- package/dist/index-CzTgKPh-.d.ts +105 -0
- package/dist/index-D-y1ktn-.d.ts +68 -0
- package/dist/index-D2Gvly0i2.d.ts +96 -0
- package/dist/index-DBlw3E9m.d.ts +166 -0
- package/dist/index-DCA5tjHa.d.ts +68 -0
- package/dist/index-DIV3riUd2.d.ts +148 -0
- package/dist/index-DJIRVD5B.d.ts +85 -0
- package/dist/index-DUCaDjfd.d.ts +240 -0
- package/dist/index-Di3sC6UF.d.ts +91 -0
- package/dist/index-DnbdiagK.d.ts +171 -0
- package/dist/index-DpzpArsi2.d.ts +614 -0
- package/dist/index-Dsn2VLZv.d.ts +238 -0
- package/dist/index-FZvrMcIo2.d.ts +158 -0
- package/dist/index-J1qdw9mL.d.ts +188 -0
- package/dist/index-Vj9ZzRh0.d.ts +66 -0
- package/dist/index-bAud6rG22.d.ts +278 -0
- package/dist/index-lOWfpkxK.d.ts +118 -0
- package/dist/index-yK3Hayg_.d.ts +40 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +195 -348
- package/dist/input-BeWEb-jD.d.ts +122 -0
- package/dist/input-group-DpGSsAZy.d.ts +100 -0
- package/dist/layer-card-BNIn9pqy.d.ts +56 -0
- package/dist/link-provider-tz-NJp9x.d.ts +67 -0
- package/dist/portal-provider-4AHCxYE6.d.ts +51 -0
- package/dist/primitives/accordion.d.ts +1 -0
- package/dist/primitives/accordion.js +2 -5
- package/dist/primitives/alert-dialog.d.ts +1 -0
- package/dist/primitives/alert-dialog.js +2 -5
- package/dist/primitives/autocomplete.d.ts +1 -0
- package/dist/primitives/autocomplete.js +2 -5
- package/dist/primitives/avatar.d.ts +1 -0
- package/dist/primitives/avatar.js +2 -5
- package/dist/primitives/button.d.ts +1 -0
- package/dist/primitives/button.js +2 -5
- package/dist/primitives/checkbox-group.d.ts +1 -0
- package/dist/primitives/checkbox-group.js +2 -5
- package/dist/primitives/checkbox.d.ts +1 -0
- package/dist/primitives/checkbox.js +2 -5
- package/dist/primitives/collapsible.d.ts +1 -0
- package/dist/primitives/collapsible.js +2 -5
- package/dist/primitives/combobox.d.ts +1 -0
- package/dist/primitives/combobox.js +2 -5
- package/dist/primitives/context-menu.d.ts +1 -0
- package/dist/primitives/context-menu.js +2 -5
- package/dist/primitives/csp-provider.d.ts +1 -0
- package/dist/primitives/csp-provider.js +2 -5
- package/dist/primitives/dialog.d.ts +1 -0
- package/dist/primitives/dialog.js +2 -5
- package/dist/primitives/direction-provider.d.ts +1 -0
- package/dist/primitives/direction-provider.js +3 -6
- package/dist/primitives/drawer.d.ts +1 -0
- package/dist/primitives/drawer.js +2 -5
- package/dist/primitives/field.d.ts +1 -0
- package/dist/primitives/field.js +2 -5
- package/dist/primitives/fieldset.d.ts +1 -0
- package/dist/primitives/fieldset.js +2 -5
- package/dist/primitives/form.d.ts +1 -0
- package/dist/primitives/form.js +2 -5
- package/dist/primitives/input.d.ts +1 -0
- package/dist/primitives/input.js +2 -5
- package/dist/primitives/menu.d.ts +1 -0
- package/dist/primitives/menu.js +2 -5
- package/dist/primitives/menubar.d.ts +1 -0
- package/dist/primitives/menubar.js +2 -5
- package/dist/primitives/meter.d.ts +1 -0
- package/dist/primitives/meter.js +2 -5
- package/dist/primitives/navigation-menu.d.ts +1 -0
- package/dist/primitives/navigation-menu.js +2 -5
- package/dist/primitives/number-field.d.ts +1 -0
- package/dist/primitives/number-field.js +2 -5
- package/dist/primitives/otp-field.d.ts +3 -0
- package/dist/primitives/otp-field.js +2 -6
- package/dist/primitives/popover.d.ts +1 -0
- package/dist/primitives/popover.js +2 -5
- package/dist/primitives/preview-card.d.ts +1 -0
- package/dist/primitives/preview-card.js +2 -5
- package/dist/primitives/progress.d.ts +1 -0
- package/dist/primitives/progress.js +2 -5
- package/dist/primitives/radio-group.d.ts +1 -0
- package/dist/primitives/radio-group.js +2 -5
- package/dist/primitives/radio.d.ts +1 -0
- package/dist/primitives/radio.js +2 -5
- package/dist/primitives/scroll-area.d.ts +1 -0
- package/dist/primitives/scroll-area.js +2 -5
- package/dist/primitives/select.d.ts +1 -0
- package/dist/primitives/select.js +2 -5
- package/dist/primitives/separator.d.ts +1 -0
- package/dist/primitives/separator.js +2 -5
- package/dist/primitives/slider.d.ts +1 -0
- package/dist/primitives/slider.js +2 -5
- package/dist/primitives/switch.d.ts +1 -0
- package/dist/primitives/switch.js +2 -5
- package/dist/primitives/tabs.d.ts +1 -0
- package/dist/primitives/tabs.js +2 -5
- package/dist/primitives/toast.d.ts +1 -0
- package/dist/primitives/toast.js +2 -5
- package/dist/primitives/toggle-group.d.ts +1 -0
- package/dist/primitives/toggle-group.js +2 -5
- package/dist/primitives/toggle.d.ts +1 -0
- package/dist/primitives/toggle.js +2 -5
- package/dist/primitives/toolbar.d.ts +1 -0
- package/dist/primitives/toolbar.js +2 -5
- package/dist/primitives/tooltip.d.ts +1 -0
- package/dist/primitives/tooltip.js +2 -5
- package/dist/primitives.d.ts +42 -0
- package/dist/primitives.js +42 -46
- package/dist/registry.d.ts +2 -0
- package/dist/registry.js +0 -1
- package/dist/scripts/theme-generator/config.d.ts +7 -5
- package/dist/scripts/theme-generator/config.js +475 -627
- package/dist/scripts/theme-generator/types.d.ts +51 -49
- package/dist/scripts/theme-generator/types.js +0 -1
- package/dist/styles/kumo-binding.css +35 -8
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/kumo.css +3 -5
- package/dist/styles/theme-fedramp.css +7 -15
- package/dist/styles/theme-kumo.css +101 -56
- package/dist/tooltip-BuCo6Ki4.d.ts +105 -0
- package/dist/types-C402rKiz.d.ts +132 -0
- package/dist/types-CdzJnnIl.d.ts +193 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +5 -12
- package/package.json +231 -232
- package/scripts/component-registry/index.test.ts +1 -1
- package/scripts/component-registry/metadata.ts +3 -4
- package/scripts/component-registry/props-filter.ts +3 -1
- package/scripts/component-registry/variant-parser.ts +1 -0
- package/scripts/theme-generator/config.ts +21 -22
- package/scripts/theme-generator/generate-css.test.ts +1 -1
- package/dist/ai/schemas.d.ts.map +0 -1
- package/dist/ai/schemas.js.map +0 -1
- package/dist/catalog.js.map +0 -1
- package/dist/chunks/Maps-imwfwgb7do9lr3i5.js +0 -2448
- package/dist/chunks/Maps-imwfwgb7do9lr3i5.js.map +0 -1
- package/dist/chunks/autocomplete-a4gvspveibfuod24.js +0 -193
- package/dist/chunks/autocomplete-a4gvspveibfuod24.js.map +0 -1
- package/dist/chunks/badge-dfc1r37osagi3rs4.js +0 -163
- package/dist/chunks/badge-dfc1r37osagi3rs4.js.map +0 -1
- package/dist/chunks/banner-j52y8l13puk7dybi.js +0 -120
- package/dist/chunks/banner-j52y8l13puk7dybi.js.map +0 -1
- package/dist/chunks/bash-g5z23u7me5rx7bzt.js +0 -15
- package/dist/chunks/bash-g5z23u7me5rx7bzt.js.map +0 -1
- package/dist/chunks/breadcrumbs-js59m7m57bdsveew.js +0 -169
- package/dist/chunks/breadcrumbs-js59m7m57bdsveew.js.map +0 -1
- package/dist/chunks/button-ebfdg9mkhojue36n.js +0 -237
- package/dist/chunks/button-ebfdg9mkhojue36n.js.map +0 -1
- package/dist/chunks/checkbox-k355pnfisqt0h4eg.js +0 -216
- package/dist/chunks/checkbox-k355pnfisqt0h4eg.js.map +0 -1
- package/dist/chunks/clipboard-text-isb05zkg2aox0tp6.js +0 -191
- package/dist/chunks/clipboard-text-isb05zkg2aox0tp6.js.map +0 -1
- package/dist/chunks/cloudflare-logo-fiuocxdxqrxawjfv.js +0 -175
- package/dist/chunks/cloudflare-logo-fiuocxdxqrxawjfv.js.map +0 -1
- package/dist/chunks/cn-bo7ya7641lkickbt.js +0 -22
- package/dist/chunks/cn-bo7ya7641lkickbt.js.map +0 -1
- package/dist/chunks/code-pbkfdfat0yilg6dx.js +0 -61
- package/dist/chunks/code-pbkfdfat0yilg6dx.js.map +0 -1
- package/dist/chunks/collapsible-f9hgtc1u6xvqrgt8.js +0 -76
- package/dist/chunks/collapsible-f9hgtc1u6xvqrgt8.js.map +0 -1
- package/dist/chunks/combobox-hc9wi9nwsyyli8ur.js +0 -408
- package/dist/chunks/combobox-hc9wi9nwsyyli8ur.js.map +0 -1
- package/dist/chunks/command-palette-c03zze4ayuytwxjg.js +0 -403
- package/dist/chunks/command-palette-c03zze4ayuytwxjg.js.map +0 -1
- package/dist/chunks/core-dyku7qctyc40nnhh.js +0 -5464
- package/dist/chunks/core-dyku7qctyc40nnhh.js.map +0 -1
- package/dist/chunks/css-d1mi3wy1sl3fzekh.js +0 -8
- package/dist/chunks/css-d1mi3wy1sl3fzekh.js.map +0 -1
- package/dist/chunks/date-picker-bffp889exjixmgz3.js +0 -2921
- package/dist/chunks/date-picker-bffp889exjixmgz3.js.map +0 -1
- package/dist/chunks/date-range-picker-oks2r14lbbukd545.js +0 -408
- package/dist/chunks/date-range-picker-oks2r14lbbukd545.js.map +0 -1
- package/dist/chunks/dialog-ovhmzfuppr5xix0e.js +0 -134
- package/dist/chunks/dialog-ovhmzfuppr5xix0e.js.map +0 -1
- package/dist/chunks/diff-cpj1h9lg0bw716mj.js +0 -8
- package/dist/chunks/diff-cpj1h9lg0bw716mj.js.map +0 -1
- package/dist/chunks/dropdown-iey8f344rd5dgahz.js +0 -321
- package/dist/chunks/dropdown-iey8f344rd5dgahz.js.map +0 -1
- package/dist/chunks/empty-k83r53jh5utqvv7w.js +0 -94
- package/dist/chunks/empty-k83r53jh5utqvv7w.js.map +0 -1
- package/dist/chunks/engine-javascript-hi1kqifa6nkcridk.js +0 -2638
- package/dist/chunks/engine-javascript-hi1kqifa6nkcridk.js.map +0 -1
- package/dist/chunks/engine-oniguruma-g75h8oxao68cjmhg.js +0 -295
- package/dist/chunks/engine-oniguruma-g75h8oxao68cjmhg.js.map +0 -1
- package/dist/chunks/field-bmglk138wa8bf3ei.js +0 -77
- package/dist/chunks/field-bmglk138wa8bf3ei.js.map +0 -1
- package/dist/chunks/github-light-ulev8flhimfg79ob.js +0 -6
- package/dist/chunks/github-light-ulev8flhimfg79ob.js.map +0 -1
- package/dist/chunks/graphql-ft2h47erta7isqn4.js +0 -16
- package/dist/chunks/graphql-ft2h47erta7isqn4.js.map +0 -1
- package/dist/chunks/grid-jze04557ljywg3uc.js +0 -128
- package/dist/chunks/grid-jze04557ljywg3uc.js.map +0 -1
- package/dist/chunks/hcl-hcu7d6ja6t540ijn.js +0 -8
- package/dist/chunks/hcl-hcu7d6ja6t540ijn.js.map +0 -1
- package/dist/chunks/html-kl304jmqj4jxj777.js +0 -12
- package/dist/chunks/html-kl304jmqj4jxj777.js.map +0 -1
- package/dist/chunks/input-area-sg518xu4pyg4m0km.js +0 -144
- package/dist/chunks/input-area-sg518xu4pyg4m0km.js.map +0 -1
- package/dist/chunks/input-ckl5misj0jd9cu5r.js +0 -130
- package/dist/chunks/input-ckl5misj0jd9cu5r.js.map +0 -1
- package/dist/chunks/input-group-bflx1m6ki55e99vf.js +0 -505
- package/dist/chunks/input-group-bflx1m6ki55e99vf.js.map +0 -1
- package/dist/chunks/javascript-hhx3avh9uv2o27ay.js +0 -8
- package/dist/chunks/javascript-hhx3avh9uv2o27ay.js.map +0 -1
- package/dist/chunks/json-jovp9qemdkp5cziz.js +0 -8
- package/dist/chunks/json-jovp9qemdkp5cziz.js.map +0 -1
- package/dist/chunks/jsonc-jbkkgjer6ispw2u3.js +0 -8
- package/dist/chunks/jsonc-jbkkgjer6ispw2u3.js.map +0 -1
- package/dist/chunks/jsx-ij885l2li2lzfoss.js +0 -8
- package/dist/chunks/jsx-ij885l2li2lzfoss.js.map +0 -1
- package/dist/chunks/label-i1xbmg8y1n0tbtkx.js +0 -68
- package/dist/chunks/label-i1xbmg8y1n0tbtkx.js.map +0 -1
- package/dist/chunks/layer-card-m6h85dpadvee39h2.js +0 -47
- package/dist/chunks/layer-card-m6h85dpadvee39h2.js.map +0 -1
- package/dist/chunks/link-j93fl5m8zrcfivsr.js +0 -95
- package/dist/chunks/link-j93fl5m8zrcfivsr.js.map +0 -1
- package/dist/chunks/link-provider-mn2voeohon7cj9o4.js +0 -22
- package/dist/chunks/link-provider-mn2voeohon7cj9o4.js.map +0 -1
- package/dist/chunks/loader-g8a6j76ue5nq0lr8.js +0 -109
- package/dist/chunks/loader-g8a6j76ue5nq0lr8.js.map +0 -1
- package/dist/chunks/markdown-n2vyyq7l68fy32wc.js +0 -8
- package/dist/chunks/markdown-n2vyyq7l68fy32wc.js.map +0 -1
- package/dist/chunks/menubar-opzxfzylaatfz4nv.js +0 -98
- package/dist/chunks/menubar-opzxfzylaatfz4nv.js.map +0 -1
- package/dist/chunks/meter-6br6z5ekw41trxeh.js +0 -51
- package/dist/chunks/meter-6br6z5ekw41trxeh.js.map +0 -1
- package/dist/chunks/pagination-j33ntwqmm9qskfgv.js +0 -266
- package/dist/chunks/pagination-j33ntwqmm9qskfgv.js.map +0 -1
- package/dist/chunks/popover-cqdmpp8i4hg8gzzx.js +0 -181
- package/dist/chunks/popover-cqdmpp8i4hg8gzzx.js.map +0 -1
- package/dist/chunks/portal-provider-hwmkdmkpvct0cb76.js +0 -18
- package/dist/chunks/portal-provider-hwmkdmkpvct0cb76.js.map +0 -1
- package/dist/chunks/python-gg755pb8oe9ra1d1.js +0 -8
- package/dist/chunks/python-gg755pb8oe9ra1d1.js.map +0 -1
- package/dist/chunks/radio-ejey7i6r4tq314av.js +0 -226
- package/dist/chunks/radio-ejey7i6r4tq314av.js.map +0 -1
- package/dist/chunks/resolve-variant-gw6eh7fa4st8ej7m.js +0 -11
- package/dist/chunks/resolve-variant-gw6eh7fa4st8ej7m.js.map +0 -1
- package/dist/chunks/select-p8adn2tnpom25hpl.js +0 -237
- package/dist/chunks/select-p8adn2tnpom25hpl.js.map +0 -1
- package/dist/chunks/sensitive-input-it1hsswlccq3u7g6.js +0 -273
- package/dist/chunks/sensitive-input-it1hsswlccq3u7g6.js.map +0 -1
- package/dist/chunks/sidebar-7whsl7qwrw5b6ip8.js +0 -1144
- package/dist/chunks/sidebar-7whsl7qwrw5b6ip8.js.map +0 -1
- package/dist/chunks/skeleton-line-omxgxia23vpav94x.js +0 -33
- package/dist/chunks/skeleton-line-omxgxia23vpav94x.js.map +0 -1
- package/dist/chunks/sql-ovukp5mrfunfk5tv.js +0 -8
- package/dist/chunks/sql-ovukp5mrfunfk5tv.js.map +0 -1
- package/dist/chunks/surface-gc2gblserrxcb1eg.js +0 -29
- package/dist/chunks/surface-gc2gblserrxcb1eg.js.map +0 -1
- package/dist/chunks/switch-ljsq915e0l1a5mjd.js +0 -256
- package/dist/chunks/switch-ljsq915e0l1a5mjd.js.map +0 -1
- package/dist/chunks/table-of-contents-cghjqyk43nj5zmlw.js +0 -106
- package/dist/chunks/table-of-contents-cghjqyk43nj5zmlw.js.map +0 -1
- package/dist/chunks/table-ojjjeqszmt9jgnug.js +0 -208
- package/dist/chunks/table-ojjjeqszmt9jgnug.js.map +0 -1
- package/dist/chunks/tabs-kemdy19kfesj2xjr.js +0 -177
- package/dist/chunks/tabs-kemdy19kfesj2xjr.js.map +0 -1
- package/dist/chunks/text-oqp48b9m5u6t62b4.js +0 -103
- package/dist/chunks/text-oqp48b9m5u6t62b4.js.map +0 -1
- package/dist/chunks/toast-ldj9zi940w83ub90.js +0 -386
- package/dist/chunks/toast-ldj9zi940w83ub90.js.map +0 -1
- package/dist/chunks/toml-nczb2z9n0o23o3ci.js +0 -8
- package/dist/chunks/toml-nczb2z9n0o23o3ci.js.map +0 -1
- package/dist/chunks/toolbar-lmylyrod70sn0q4i.js +0 -172
- package/dist/chunks/toolbar-lmylyrod70sn0q4i.js.map +0 -1
- package/dist/chunks/tooltip-mooldq78tg77ekvv.js +0 -103
- package/dist/chunks/tooltip-mooldq78tg77ekvv.js.map +0 -1
- package/dist/chunks/tsx-ehy8lrzet6v54zur.js +0 -8
- package/dist/chunks/tsx-ehy8lrzet6v54zur.js.map +0 -1
- package/dist/chunks/typescript-k4ggjrxhrhcdni6u.js +0 -8
- package/dist/chunks/typescript-k4ggjrxhrhcdni6u.js.map +0 -1
- package/dist/chunks/vendor-base-ui-elpbzr8xeffrz4h2.js +0 -25027
- package/dist/chunks/vendor-base-ui-elpbzr8xeffrz4h2.js.map +0 -1
- package/dist/chunks/vendor-floating-ui-k1zjlb8fkwtcw4k5.js +0 -1310
- package/dist/chunks/vendor-floating-ui-k1zjlb8fkwtcw4k5.js.map +0 -1
- package/dist/chunks/vendor-styling-ofvnbcuht98q88oo.js +0 -3252
- package/dist/chunks/vendor-styling-ofvnbcuht98q88oo.js.map +0 -1
- package/dist/chunks/vendor-utils-m5h2xu7s2rs3pgk5.js +0 -217
- package/dist/chunks/vendor-utils-m5h2xu7s2rs3pgk5.js.map +0 -1
- package/dist/chunks/vesper-ebfu9ns65f2v830s.js +0 -6
- package/dist/chunks/vesper-ebfu9ns65f2v830s.js.map +0 -1
- package/dist/chunks/wasm-oj22f8usru9h7dzg.js +0 -9
- package/dist/chunks/wasm-oj22f8usru9h7dzg.js.map +0 -1
- package/dist/chunks/yaml-e2v22lr79tss2brj.js +0 -8
- package/dist/chunks/yaml-e2v22lr79tss2brj.js.map +0 -1
- package/dist/code/server.js.map +0 -1
- package/dist/code.js.map +0 -1
- package/dist/components/autocomplete.js.map +0 -1
- package/dist/components/badge.js.map +0 -1
- package/dist/components/banner.js.map +0 -1
- package/dist/components/breadcrumbs.js.map +0 -1
- package/dist/components/button.js.map +0 -1
- package/dist/components/chart.js.map +0 -1
- package/dist/components/checkbox.js.map +0 -1
- package/dist/components/clipboard-text.js.map +0 -1
- package/dist/components/cloudflare-logo.js.map +0 -1
- package/dist/components/code.js.map +0 -1
- package/dist/components/collapsible.js.map +0 -1
- package/dist/components/combobox.js.map +0 -1
- package/dist/components/command-palette.js.map +0 -1
- package/dist/components/date-picker.js.map +0 -1
- package/dist/components/date-range-picker.js.map +0 -1
- package/dist/components/dialog.js.map +0 -1
- package/dist/components/dropdown.js.map +0 -1
- package/dist/components/empty.js.map +0 -1
- package/dist/components/field.js.map +0 -1
- package/dist/components/flow.js.map +0 -1
- package/dist/components/grid.js.map +0 -1
- package/dist/components/input-group.js.map +0 -1
- package/dist/components/input.js.map +0 -1
- package/dist/components/label.js.map +0 -1
- package/dist/components/layer-card.js.map +0 -1
- package/dist/components/link.js.map +0 -1
- package/dist/components/loader.js.map +0 -1
- package/dist/components/menubar.js.map +0 -1
- package/dist/components/meter.js.map +0 -1
- package/dist/components/pagination.js.map +0 -1
- package/dist/components/popover.js.map +0 -1
- package/dist/components/radio.js.map +0 -1
- package/dist/components/select.js.map +0 -1
- package/dist/components/sensitive-input.js.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/surface.js.map +0 -1
- package/dist/components/switch.js.map +0 -1
- package/dist/components/table-of-contents.js.map +0 -1
- package/dist/components/table.js.map +0 -1
- package/dist/components/tabs.js.map +0 -1
- package/dist/components/text.js.map +0 -1
- package/dist/components/toast.js.map +0 -1
- package/dist/components/toolbar.js.map +0 -1
- package/dist/components/tooltip.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/primitives/accordion.js.map +0 -1
- package/dist/primitives/alert-dialog.js.map +0 -1
- package/dist/primitives/autocomplete.js.map +0 -1
- package/dist/primitives/avatar.js.map +0 -1
- package/dist/primitives/button.js.map +0 -1
- package/dist/primitives/checkbox-group.js.map +0 -1
- package/dist/primitives/checkbox.js.map +0 -1
- package/dist/primitives/collapsible.js.map +0 -1
- package/dist/primitives/combobox.js.map +0 -1
- package/dist/primitives/context-menu.js.map +0 -1
- package/dist/primitives/csp-provider.js.map +0 -1
- package/dist/primitives/dialog.js.map +0 -1
- package/dist/primitives/direction-provider.js.map +0 -1
- package/dist/primitives/drawer.js.map +0 -1
- package/dist/primitives/field.js.map +0 -1
- package/dist/primitives/fieldset.js.map +0 -1
- package/dist/primitives/form.js.map +0 -1
- package/dist/primitives/input.js.map +0 -1
- package/dist/primitives/menu.js.map +0 -1
- package/dist/primitives/menubar.js.map +0 -1
- package/dist/primitives/meter.js.map +0 -1
- package/dist/primitives/navigation-menu.js.map +0 -1
- package/dist/primitives/number-field.js.map +0 -1
- package/dist/primitives/otp-field.js.map +0 -1
- package/dist/primitives/popover.js.map +0 -1
- package/dist/primitives/preview-card.js.map +0 -1
- package/dist/primitives/progress.js.map +0 -1
- package/dist/primitives/radio-group.js.map +0 -1
- package/dist/primitives/radio.js.map +0 -1
- package/dist/primitives/scroll-area.js.map +0 -1
- package/dist/primitives/select.js.map +0 -1
- package/dist/primitives/separator.js.map +0 -1
- package/dist/primitives/slider.js.map +0 -1
- package/dist/primitives/switch.js.map +0 -1
- package/dist/primitives/tabs.js.map +0 -1
- package/dist/primitives/toast.js.map +0 -1
- package/dist/primitives/toggle-group.js.map +0 -1
- package/dist/primitives/toggle.js.map +0 -1
- package/dist/primitives/toolbar.js.map +0 -1
- package/dist/primitives/tooltip.js.map +0 -1
- package/dist/primitives.js.map +0 -1
- package/dist/registry.js.map +0 -1
- package/dist/scripts/theme-generator/config.d.ts.map +0 -1
- package/dist/scripts/theme-generator/config.js.map +0 -1
- package/dist/scripts/theme-generator/generate-css.d.ts +0 -31
- package/dist/scripts/theme-generator/generate-css.d.ts.map +0 -1
- package/dist/scripts/theme-generator/index.d.ts +0 -13
- package/dist/scripts/theme-generator/index.d.ts.map +0 -1
- package/dist/scripts/theme-generator/migrate.d.ts +0 -56
- package/dist/scripts/theme-generator/migrate.d.ts.map +0 -1
- package/dist/scripts/theme-generator/types.d.ts.map +0 -1
- package/dist/scripts/theme-generator/types.js.map +0 -1
- package/dist/src/blocks/delete-resource/delete-resource.d.ts +0 -46
- package/dist/src/blocks/delete-resource/delete-resource.d.ts.map +0 -1
- package/dist/src/blocks/delete-resource/index.d.ts +0 -2
- package/dist/src/blocks/delete-resource/index.d.ts.map +0 -1
- package/dist/src/blocks/page-header/index.d.ts +0 -2
- package/dist/src/blocks/page-header/index.d.ts.map +0 -1
- package/dist/src/blocks/page-header/page-header.d.ts +0 -38
- package/dist/src/blocks/page-header/page-header.d.ts.map +0 -1
- package/dist/src/blocks/resource-list/index.d.ts +0 -2
- package/dist/src/blocks/resource-list/index.d.ts.map +0 -1
- package/dist/src/blocks/resource-list/resource-list.d.ts +0 -18
- package/dist/src/blocks/resource-list/resource-list.d.ts.map +0 -1
- package/dist/src/catalog/catalog.d.ts +0 -75
- package/dist/src/catalog/catalog.d.ts.map +0 -1
- package/dist/src/catalog/data.d.ts +0 -44
- package/dist/src/catalog/data.d.ts.map +0 -1
- package/dist/src/catalog/index.d.ts +0 -39
- package/dist/src/catalog/index.d.ts.map +0 -1
- package/dist/src/catalog/types.d.ts +0 -226
- package/dist/src/catalog/types.d.ts.map +0 -1
- package/dist/src/catalog/visibility.d.ts +0 -37
- package/dist/src/catalog/visibility.d.ts.map +0 -1
- package/dist/src/code/code-highlighted.d.ts +0 -32
- package/dist/src/code/code-highlighted.d.ts.map +0 -1
- package/dist/src/code/context.d.ts +0 -16
- package/dist/src/code/context.d.ts.map +0 -1
- package/dist/src/code/index.d.ts +0 -32
- package/dist/src/code/index.d.ts.map +0 -1
- package/dist/src/code/provider.d.ts +0 -13
- package/dist/src/code/provider.d.ts.map +0 -1
- package/dist/src/code/server.d.ts +0 -95
- package/dist/src/code/server.d.ts.map +0 -1
- package/dist/src/code/types.d.ts +0 -130
- package/dist/src/code/types.d.ts.map +0 -1
- package/dist/src/code/use-shiki-highlighter.d.ts +0 -36
- package/dist/src/code/use-shiki-highlighter.d.ts.map +0 -1
- package/dist/src/command-line/build-cli.d.ts +0 -7
- package/dist/src/command-line/build-cli.d.ts.map +0 -1
- package/dist/src/command-line/cli.d.ts +0 -13
- package/dist/src/command-line/cli.d.ts.map +0 -1
- package/dist/src/command-line/commands/add.d.ts +0 -10
- package/dist/src/command-line/commands/add.d.ts.map +0 -1
- package/dist/src/command-line/commands/ai.d.ts +0 -10
- package/dist/src/command-line/commands/ai.d.ts.map +0 -1
- package/dist/src/command-line/commands/blocks.d.ts +0 -10
- package/dist/src/command-line/commands/blocks.d.ts.map +0 -1
- package/dist/src/command-line/commands/doc.d.ts +0 -14
- package/dist/src/command-line/commands/doc.d.ts.map +0 -1
- package/dist/src/command-line/commands/init.d.ts +0 -18
- package/dist/src/command-line/commands/init.d.ts.map +0 -1
- package/dist/src/command-line/commands/ls.d.ts +0 -10
- package/dist/src/command-line/commands/ls.d.ts.map +0 -1
- package/dist/src/command-line/commands/migrate.d.ts +0 -10
- package/dist/src/command-line/commands/migrate.d.ts.map +0 -1
- package/dist/src/command-line/utils/config.d.ts +0 -42
- package/dist/src/command-line/utils/config.d.ts.map +0 -1
- package/dist/src/command-line/utils/transformer.d.ts +0 -21
- package/dist/src/command-line/utils/transformer.d.ts.map +0 -1
- package/dist/src/components/autocomplete/autocomplete.d.ts +0 -181
- package/dist/src/components/autocomplete/autocomplete.d.ts.map +0 -1
- package/dist/src/components/autocomplete/index.d.ts +0 -3
- package/dist/src/components/autocomplete/index.d.ts.map +0 -1
- package/dist/src/components/badge/badge.d.ts +0 -180
- package/dist/src/components/badge/badge.d.ts.map +0 -1
- package/dist/src/components/badge/index.d.ts +0 -2
- package/dist/src/components/badge/index.d.ts.map +0 -1
- package/dist/src/components/banner/banner.d.ts +0 -106
- package/dist/src/components/banner/banner.d.ts.map +0 -1
- package/dist/src/components/banner/index.d.ts +0 -2
- package/dist/src/components/banner/index.d.ts.map +0 -1
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts +0 -78
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts.map +0 -1
- package/dist/src/components/breadcrumbs/index.d.ts +0 -2
- package/dist/src/components/breadcrumbs/index.d.ts.map +0 -1
- package/dist/src/components/button/button.d.ts +0 -214
- package/dist/src/components/button/button.d.ts.map +0 -1
- package/dist/src/components/button/index.d.ts +0 -2
- package/dist/src/components/button/index.d.ts.map +0 -1
- package/dist/src/components/chart/Color.d.ts +0 -107
- package/dist/src/components/chart/Color.d.ts.map +0 -1
- package/dist/src/components/chart/EChart.d.ts +0 -166
- package/dist/src/components/chart/EChart.d.ts.map +0 -1
- package/dist/src/components/chart/Legend.d.ts +0 -51
- package/dist/src/components/chart/Legend.d.ts.map +0 -1
- package/dist/src/components/chart/Maps.d.ts +0 -211
- package/dist/src/components/chart/Maps.d.ts.map +0 -1
- package/dist/src/components/chart/SankeyChart.d.ts +0 -98
- package/dist/src/components/chart/SankeyChart.d.ts.map +0 -1
- package/dist/src/components/chart/TimeseriesChart.d.ts +0 -189
- package/dist/src/components/chart/TimeseriesChart.d.ts.map +0 -1
- package/dist/src/components/chart/index.d.ts +0 -7
- package/dist/src/components/chart/index.d.ts.map +0 -1
- package/dist/src/components/chart/timeseries-markers.d.ts +0 -107
- package/dist/src/components/chart/timeseries-markers.d.ts.map +0 -1
- package/dist/src/components/chart/timeseries-thresholds.d.ts +0 -61
- package/dist/src/components/chart/timeseries-thresholds.d.ts.map +0 -1
- package/dist/src/components/chart/timeseries-tooltip.d.ts +0 -28
- package/dist/src/components/chart/timeseries-tooltip.d.ts.map +0 -1
- package/dist/src/components/chart/tooltip-utils.d.ts +0 -4
- package/dist/src/components/chart/tooltip-utils.d.ts.map +0 -1
- package/dist/src/components/checkbox/checkbox.d.ts +0 -197
- package/dist/src/components/checkbox/checkbox.d.ts.map +0 -1
- package/dist/src/components/checkbox/index.d.ts +0 -2
- package/dist/src/components/checkbox/index.d.ts.map +0 -1
- package/dist/src/components/clipboard-text/clipboard-text.d.ts +0 -88
- package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +0 -1
- package/dist/src/components/clipboard-text/index.d.ts +0 -2
- package/dist/src/components/clipboard-text/index.d.ts.map +0 -1
- package/dist/src/components/cloudflare-logo/cloudflare-logo.d.ts +0 -133
- package/dist/src/components/cloudflare-logo/cloudflare-logo.d.ts.map +0 -1
- package/dist/src/components/cloudflare-logo/index.d.ts +0 -2
- package/dist/src/components/cloudflare-logo/index.d.ts.map +0 -1
- package/dist/src/components/code/code.d.ts +0 -189
- package/dist/src/components/code/code.d.ts.map +0 -1
- package/dist/src/components/code/index.d.ts +0 -4
- package/dist/src/components/code/index.d.ts.map +0 -1
- package/dist/src/components/collapsible/collapsible.d.ts +0 -109
- package/dist/src/components/collapsible/collapsible.d.ts.map +0 -1
- package/dist/src/components/collapsible/index.d.ts +0 -2
- package/dist/src/components/collapsible/index.d.ts.map +0 -1
- package/dist/src/components/combobox/combobox.d.ts +0 -246
- package/dist/src/components/combobox/combobox.d.ts.map +0 -1
- package/dist/src/components/combobox/index.d.ts +0 -3
- package/dist/src/components/combobox/index.d.ts.map +0 -1
- package/dist/src/components/command-palette/command-palette.d.ts +0 -258
- package/dist/src/components/command-palette/command-palette.d.ts.map +0 -1
- package/dist/src/components/command-palette/index.d.ts +0 -3
- package/dist/src/components/command-palette/index.d.ts.map +0 -1
- package/dist/src/components/command-palette/types.d.ts +0 -168
- package/dist/src/components/command-palette/types.d.ts.map +0 -1
- package/dist/src/components/date-picker/date-picker.d.ts +0 -65
- package/dist/src/components/date-picker/date-picker.d.ts.map +0 -1
- package/dist/src/components/date-picker/index.d.ts +0 -4
- package/dist/src/components/date-picker/index.d.ts.map +0 -1
- package/dist/src/components/date-range-picker/date-range-picker.d.ts +0 -125
- package/dist/src/components/date-range-picker/date-range-picker.d.ts.map +0 -1
- package/dist/src/components/date-range-picker/index.d.ts +0 -5
- package/dist/src/components/date-range-picker/index.d.ts.map +0 -1
- package/dist/src/components/dialog/dialog.d.ts +0 -242
- package/dist/src/components/dialog/dialog.d.ts.map +0 -1
- package/dist/src/components/dialog/index.d.ts +0 -2
- package/dist/src/components/dialog/index.d.ts.map +0 -1
- package/dist/src/components/dropdown/dropdown.d.ts +0 -116
- package/dist/src/components/dropdown/dropdown.d.ts.map +0 -1
- package/dist/src/components/dropdown/index.d.ts +0 -2
- package/dist/src/components/dropdown/index.d.ts.map +0 -1
- package/dist/src/components/empty/empty.d.ts +0 -69
- package/dist/src/components/empty/empty.d.ts.map +0 -1
- package/dist/src/components/empty/index.d.ts +0 -2
- package/dist/src/components/empty/index.d.ts.map +0 -1
- package/dist/src/components/field/field.d.ts +0 -89
- package/dist/src/components/field/field.d.ts.map +0 -1
- package/dist/src/components/field/index.d.ts +0 -2
- package/dist/src/components/field/index.d.ts.map +0 -1
- package/dist/src/components/flow/connectors.d.ts +0 -59
- package/dist/src/components/flow/connectors.d.ts.map +0 -1
- package/dist/src/components/flow/diagram.d.ts +0 -105
- package/dist/src/components/flow/diagram.d.ts.map +0 -1
- package/dist/src/components/flow/flow-layout.d.ts +0 -77
- package/dist/src/components/flow/flow-layout.d.ts.map +0 -1
- package/dist/src/components/flow/index.d.ts +0 -26
- package/dist/src/components/flow/index.d.ts.map +0 -1
- package/dist/src/components/flow/node.d.ts +0 -61
- package/dist/src/components/flow/node.d.ts.map +0 -1
- package/dist/src/components/flow/parallel.d.ts +0 -9
- package/dist/src/components/flow/parallel.d.ts.map +0 -1
- package/dist/src/components/flow/use-children.d.ts +0 -27
- package/dist/src/components/flow/use-children.d.ts.map +0 -1
- package/dist/src/components/grid/grid.d.ts +0 -135
- package/dist/src/components/grid/grid.d.ts.map +0 -1
- package/dist/src/components/grid/index.d.ts +0 -2
- package/dist/src/components/grid/index.d.ts.map +0 -1
- package/dist/src/components/input/index.d.ts +0 -19
- package/dist/src/components/input/index.d.ts.map +0 -1
- package/dist/src/components/input/input-area.d.ts +0 -83
- package/dist/src/components/input/input-area.d.ts.map +0 -1
- package/dist/src/components/input/input.d.ts +0 -175
- package/dist/src/components/input/input.d.ts.map +0 -1
- package/dist/src/components/input-group/context.d.ts +0 -96
- package/dist/src/components/input-group/context.d.ts.map +0 -1
- package/dist/src/components/input-group/index.d.ts +0 -2
- package/dist/src/components/input-group/index.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-addon.d.ts +0 -15
- package/dist/src/components/input-group/input-group-addon.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-button.d.ts +0 -36
- package/dist/src/components/input-group/input-group-button.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-input.d.ts +0 -9
- package/dist/src/components/input-group/input-group-input.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-suffix.d.ts +0 -13
- package/dist/src/components/input-group/input-group-suffix.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group.d.ts +0 -43
- package/dist/src/components/input-group/input-group.d.ts.map +0 -1
- package/dist/src/components/label/index.d.ts +0 -2
- package/dist/src/components/label/index.d.ts.map +0 -1
- package/dist/src/components/label/label.d.ts +0 -67
- package/dist/src/components/label/label.d.ts.map +0 -1
- package/dist/src/components/layer-card/index.d.ts +0 -2
- package/dist/src/components/layer-card/index.d.ts.map +0 -1
- package/dist/src/components/layer-card/layer-card.d.ts +0 -60
- package/dist/src/components/layer-card/layer-card.d.ts.map +0 -1
- package/dist/src/components/link/index.d.ts +0 -2
- package/dist/src/components/link/index.d.ts.map +0 -1
- package/dist/src/components/link/link.d.ts +0 -66
- package/dist/src/components/link/link.d.ts.map +0 -1
- package/dist/src/components/loader/index.d.ts +0 -3
- package/dist/src/components/loader/index.d.ts.map +0 -1
- package/dist/src/components/loader/loader.d.ts +0 -70
- package/dist/src/components/loader/loader.d.ts.map +0 -1
- package/dist/src/components/loader/skeleton-line.d.ts +0 -11
- package/dist/src/components/loader/skeleton-line.d.ts.map +0 -1
- package/dist/src/components/menubar/index.d.ts +0 -3
- package/dist/src/components/menubar/index.d.ts.map +0 -1
- package/dist/src/components/menubar/menubar.d.ts +0 -66
- package/dist/src/components/menubar/menubar.d.ts.map +0 -1
- package/dist/src/components/menubar/use-menu-navigation.d.ts +0 -8
- package/dist/src/components/menubar/use-menu-navigation.d.ts.map +0 -1
- package/dist/src/components/meter/index.d.ts +0 -2
- package/dist/src/components/meter/index.d.ts.map +0 -1
- package/dist/src/components/meter/meter.d.ts +0 -44
- package/dist/src/components/meter/meter.d.ts.map +0 -1
- package/dist/src/components/pagination/index.d.ts +0 -2
- package/dist/src/components/pagination/index.d.ts.map +0 -1
- package/dist/src/components/pagination/pagination.d.ts +0 -241
- package/dist/src/components/pagination/pagination.d.ts.map +0 -1
- package/dist/src/components/popover/index.d.ts +0 -3
- package/dist/src/components/popover/index.d.ts.map +0 -1
- package/dist/src/components/popover/popover.d.ts +0 -178
- package/dist/src/components/popover/popover.d.ts.map +0 -1
- package/dist/src/components/radio/index.d.ts +0 -2
- package/dist/src/components/radio/index.d.ts.map +0 -1
- package/dist/src/components/radio/radio.d.ts +0 -277
- package/dist/src/components/radio/radio.d.ts.map +0 -1
- package/dist/src/components/radio/radio.type-spec.d.ts +0 -12
- package/dist/src/components/radio/radio.type-spec.d.ts.map +0 -1
- package/dist/src/components/select/index.d.ts +0 -2
- package/dist/src/components/select/index.d.ts.map +0 -1
- package/dist/src/components/select/select.d.ts +0 -288
- package/dist/src/components/select/select.d.ts.map +0 -1
- package/dist/src/components/sensitive-input/index.d.ts +0 -2
- package/dist/src/components/sensitive-input/index.d.ts.map +0 -1
- package/dist/src/components/sensitive-input/sensitive-input.d.ts +0 -94
- package/dist/src/components/sensitive-input/sensitive-input.d.ts.map +0 -1
- package/dist/src/components/sidebar/index.d.ts +0 -2
- package/dist/src/components/sidebar/index.d.ts.map +0 -1
- package/dist/src/components/sidebar/sidebar.d.ts +0 -583
- package/dist/src/components/sidebar/sidebar.d.ts.map +0 -1
- package/dist/src/components/surface/index.d.ts +0 -5
- package/dist/src/components/surface/index.d.ts.map +0 -1
- package/dist/src/components/surface/surface.d.ts +0 -64
- package/dist/src/components/surface/surface.d.ts.map +0 -1
- package/dist/src/components/switch/index.d.ts +0 -2
- package/dist/src/components/switch/index.d.ts.map +0 -1
- package/dist/src/components/switch/switch.d.ts +0 -197
- package/dist/src/components/switch/switch.d.ts.map +0 -1
- package/dist/src/components/table/index.d.ts +0 -2
- package/dist/src/components/table/index.d.ts.map +0 -1
- package/dist/src/components/table/table.d.ts +0 -138
- package/dist/src/components/table/table.d.ts.map +0 -1
- package/dist/src/components/table-of-contents/index.d.ts +0 -2
- package/dist/src/components/table-of-contents/index.d.ts.map +0 -1
- package/dist/src/components/table-of-contents/table-of-contents.d.ts +0 -72
- package/dist/src/components/table-of-contents/table-of-contents.d.ts.map +0 -1
- package/dist/src/components/tabs/index.d.ts +0 -3
- package/dist/src/components/tabs/index.d.ts.map +0 -1
- package/dist/src/components/tabs/tabs.d.ts +0 -116
- package/dist/src/components/tabs/tabs.d.ts.map +0 -1
- package/dist/src/components/text/index.d.ts +0 -2
- package/dist/src/components/text/index.d.ts.map +0 -1
- package/dist/src/components/text/text.d.ts +0 -214
- package/dist/src/components/text/text.d.ts.map +0 -1
- package/dist/src/components/text/text.type-spec.d.ts +0 -44
- package/dist/src/components/text/text.type-spec.d.ts.map +0 -1
- package/dist/src/components/toast/index.d.ts +0 -5
- package/dist/src/components/toast/index.d.ts.map +0 -1
- package/dist/src/components/toast/toast.d.ts +0 -197
- package/dist/src/components/toast/toast.d.ts.map +0 -1
- package/dist/src/components/toolbar/index.d.ts +0 -2
- package/dist/src/components/toolbar/index.d.ts.map +0 -1
- package/dist/src/components/toolbar/toolbar.d.ts +0 -50
- package/dist/src/components/toolbar/toolbar.d.ts.map +0 -1
- package/dist/src/components/tooltip/index.d.ts +0 -2
- package/dist/src/components/tooltip/index.d.ts.map +0 -1
- package/dist/src/components/tooltip/tooltip.d.ts +0 -108
- package/dist/src/components/tooltip/tooltip.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -85
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/primitives/accordion.d.ts +0 -13
- package/dist/src/primitives/accordion.d.ts.map +0 -1
- package/dist/src/primitives/alert-dialog.d.ts +0 -13
- package/dist/src/primitives/alert-dialog.d.ts.map +0 -1
- package/dist/src/primitives/autocomplete.d.ts +0 -13
- package/dist/src/primitives/autocomplete.d.ts.map +0 -1
- package/dist/src/primitives/avatar.d.ts +0 -13
- package/dist/src/primitives/avatar.d.ts.map +0 -1
- package/dist/src/primitives/button.d.ts +0 -13
- package/dist/src/primitives/button.d.ts.map +0 -1
- package/dist/src/primitives/checkbox-group.d.ts +0 -13
- package/dist/src/primitives/checkbox-group.d.ts.map +0 -1
- package/dist/src/primitives/checkbox.d.ts +0 -13
- package/dist/src/primitives/checkbox.d.ts.map +0 -1
- package/dist/src/primitives/collapsible.d.ts +0 -13
- package/dist/src/primitives/collapsible.d.ts.map +0 -1
- package/dist/src/primitives/combobox.d.ts +0 -13
- package/dist/src/primitives/combobox.d.ts.map +0 -1
- package/dist/src/primitives/context-menu.d.ts +0 -13
- package/dist/src/primitives/context-menu.d.ts.map +0 -1
- package/dist/src/primitives/csp-provider.d.ts +0 -13
- package/dist/src/primitives/csp-provider.d.ts.map +0 -1
- package/dist/src/primitives/dialog.d.ts +0 -13
- package/dist/src/primitives/dialog.d.ts.map +0 -1
- package/dist/src/primitives/direction-provider.d.ts +0 -13
- package/dist/src/primitives/direction-provider.d.ts.map +0 -1
- package/dist/src/primitives/drawer.d.ts +0 -13
- package/dist/src/primitives/drawer.d.ts.map +0 -1
- package/dist/src/primitives/field.d.ts +0 -13
- package/dist/src/primitives/field.d.ts.map +0 -1
- package/dist/src/primitives/fieldset.d.ts +0 -13
- package/dist/src/primitives/fieldset.d.ts.map +0 -1
- package/dist/src/primitives/form.d.ts +0 -13
- package/dist/src/primitives/form.d.ts.map +0 -1
- package/dist/src/primitives/index.d.ts +0 -56
- package/dist/src/primitives/index.d.ts.map +0 -1
- package/dist/src/primitives/input.d.ts +0 -13
- package/dist/src/primitives/input.d.ts.map +0 -1
- package/dist/src/primitives/menu.d.ts +0 -13
- package/dist/src/primitives/menu.d.ts.map +0 -1
- package/dist/src/primitives/menubar.d.ts +0 -13
- package/dist/src/primitives/menubar.d.ts.map +0 -1
- package/dist/src/primitives/meter.d.ts +0 -13
- package/dist/src/primitives/meter.d.ts.map +0 -1
- package/dist/src/primitives/navigation-menu.d.ts +0 -13
- package/dist/src/primitives/navigation-menu.d.ts.map +0 -1
- package/dist/src/primitives/number-field.d.ts +0 -13
- package/dist/src/primitives/number-field.d.ts.map +0 -1
- package/dist/src/primitives/otp-field.d.ts +0 -14
- package/dist/src/primitives/otp-field.d.ts.map +0 -1
- package/dist/src/primitives/popover.d.ts +0 -13
- package/dist/src/primitives/popover.d.ts.map +0 -1
- package/dist/src/primitives/preview-card.d.ts +0 -13
- package/dist/src/primitives/preview-card.d.ts.map +0 -1
- package/dist/src/primitives/progress.d.ts +0 -13
- package/dist/src/primitives/progress.d.ts.map +0 -1
- package/dist/src/primitives/radio-group.d.ts +0 -13
- package/dist/src/primitives/radio-group.d.ts.map +0 -1
- package/dist/src/primitives/radio.d.ts +0 -13
- package/dist/src/primitives/radio.d.ts.map +0 -1
- package/dist/src/primitives/scroll-area.d.ts +0 -13
- package/dist/src/primitives/scroll-area.d.ts.map +0 -1
- package/dist/src/primitives/select.d.ts +0 -13
- package/dist/src/primitives/select.d.ts.map +0 -1
- package/dist/src/primitives/separator.d.ts +0 -13
- package/dist/src/primitives/separator.d.ts.map +0 -1
- package/dist/src/primitives/slider.d.ts +0 -13
- package/dist/src/primitives/slider.d.ts.map +0 -1
- package/dist/src/primitives/switch.d.ts +0 -13
- package/dist/src/primitives/switch.d.ts.map +0 -1
- package/dist/src/primitives/tabs.d.ts +0 -13
- package/dist/src/primitives/tabs.d.ts.map +0 -1
- package/dist/src/primitives/toast.d.ts +0 -13
- package/dist/src/primitives/toast.d.ts.map +0 -1
- package/dist/src/primitives/toggle-group.d.ts +0 -13
- package/dist/src/primitives/toggle-group.d.ts.map +0 -1
- package/dist/src/primitives/toggle.d.ts +0 -13
- package/dist/src/primitives/toggle.d.ts.map +0 -1
- package/dist/src/primitives/toolbar.d.ts +0 -13
- package/dist/src/primitives/toolbar.d.ts.map +0 -1
- package/dist/src/primitives/tooltip.d.ts +0 -13
- package/dist/src/primitives/tooltip.d.ts.map +0 -1
- package/dist/src/registry/index.d.ts +0 -8
- package/dist/src/registry/index.d.ts.map +0 -1
- package/dist/src/registry/types.d.ts +0 -191
- package/dist/src/registry/types.d.ts.map +0 -1
- package/dist/src/utils/cn.d.ts +0 -3
- package/dist/src/utils/cn.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -4
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/link-provider.d.ts +0 -66
- package/dist/src/utils/link-provider.d.ts.map +0 -1
- package/dist/src/utils/portal-provider.d.ts +0 -56
- package/dist/src/utils/portal-provider.d.ts.map +0 -1
- package/dist/src/utils/prop-examples.d.ts +0 -36
- package/dist/src/utils/prop-examples.d.ts.map +0 -1
- package/dist/src/utils/resolve-variant.d.ts +0 -27
- package/dist/src/utils/resolve-variant.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,3083 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as cn } from "./vendor-styling-da1xibnxfkjmtglr.js";
|
|
3
|
+
import { a as TooltipTrigger, i as TooltipPortal, n as TooltipPositioner, s as TooltipRoot, t as TooltipPopup } from "./TooltipPopup-ehusafczcky9jvae.js";
|
|
4
|
+
import { t as SkeletonLine } from "./skeleton-line-f6sju1dxawm8h9tg.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { forwardRef, memo, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
//#region src/components/chart/Color.ts
|
|
8
|
+
/**
|
|
9
|
+
* Semantic colors for light mode — used to convey meaning (status, severity)
|
|
10
|
+
* rather than just distinguishing series. Use via `ChartPalette.semantic()`.
|
|
11
|
+
*/
|
|
12
|
+
var ChartSemanticLightColors = /* @__PURE__ */ function(ChartSemanticLightColors) {
|
|
13
|
+
ChartSemanticLightColors["Attention"] = "#FC574A";
|
|
14
|
+
ChartSemanticLightColors["Warning"] = "#F8A054";
|
|
15
|
+
ChartSemanticLightColors["Success"] = "#00A63E";
|
|
16
|
+
ChartSemanticLightColors["Neutral"] = "#B9D6FF";
|
|
17
|
+
ChartSemanticLightColors["Disabled"] = "#CBCBCB";
|
|
18
|
+
ChartSemanticLightColors["Skeleton"] = "#DDDDDD";
|
|
19
|
+
return ChartSemanticLightColors;
|
|
20
|
+
}(ChartSemanticLightColors || {});
|
|
21
|
+
/**
|
|
22
|
+
* Semantic colors for dark mode
|
|
23
|
+
*/
|
|
24
|
+
var ChartSemanticDarkColors = /* @__PURE__ */ function(ChartSemanticDarkColors) {
|
|
25
|
+
ChartSemanticDarkColors["Attention"] = "#FC574A";
|
|
26
|
+
ChartSemanticDarkColors["Warning"] = "#F8A054";
|
|
27
|
+
ChartSemanticDarkColors["Success"] = "#00A63E";
|
|
28
|
+
ChartSemanticDarkColors["Neutral"] = "#8EC5FF";
|
|
29
|
+
ChartSemanticDarkColors["Disabled"] = "#878787";
|
|
30
|
+
ChartSemanticDarkColors["Skeleton"] = "#5C5C5C";
|
|
31
|
+
return ChartSemanticDarkColors;
|
|
32
|
+
}(ChartSemanticDarkColors || {});
|
|
33
|
+
/**
|
|
34
|
+
* Sequential color palettes for light mode with the colour in position #2 of the array as the base.
|
|
35
|
+
*/
|
|
36
|
+
const sequentialLight = { blues: [
|
|
37
|
+
"#E1EAF4",
|
|
38
|
+
"#8EBCF6",
|
|
39
|
+
"#4290F0",
|
|
40
|
+
"#0E58B4",
|
|
41
|
+
"#03254F"
|
|
42
|
+
] };
|
|
43
|
+
/**
|
|
44
|
+
* Sequential color palettes for dark mode. These are the reverse of the light mode palettes using the same base color (position 2).
|
|
45
|
+
*/
|
|
46
|
+
const sequentialDark = { blues: [
|
|
47
|
+
"#03254F",
|
|
48
|
+
"#0E58B4",
|
|
49
|
+
"#4290F0",
|
|
50
|
+
"#A6BFDD",
|
|
51
|
+
"#E1EAF4"
|
|
52
|
+
] };
|
|
53
|
+
/** Neutral land fill per mode; bubbles use the shared categorical palette. */
|
|
54
|
+
const mapAreaByMode = {
|
|
55
|
+
light: "#E5E7EB",
|
|
56
|
+
dark: "#2B2C31"
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Choropleth shading ramp per mode (ordered low → high), anchored on the shared
|
|
60
|
+
* chart blue `#4290F0` (same as BubbleMap and `categorical(0)`) so the maps read
|
|
61
|
+
* as one family. Every step stays clearly blue, and the low ends are kept
|
|
62
|
+
* distinct from the neutral no-data fill in both modes.
|
|
63
|
+
*/
|
|
64
|
+
const mapScaleByMode = {
|
|
65
|
+
light: [
|
|
66
|
+
"#C8DEFB",
|
|
67
|
+
"#8FBDF6",
|
|
68
|
+
"#4290F0",
|
|
69
|
+
"#1E60BE",
|
|
70
|
+
"#0A3A7A"
|
|
71
|
+
],
|
|
72
|
+
dark: [
|
|
73
|
+
"#26456C",
|
|
74
|
+
"#2C68BE",
|
|
75
|
+
"#4290F0",
|
|
76
|
+
"#79AEF4",
|
|
77
|
+
"#BBD6FA"
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Ordered list of categorical colors for light mode, indexed by series position.
|
|
82
|
+
* Used as the default ECharts color palette when `isDarkMode` is `false`.
|
|
83
|
+
*/
|
|
84
|
+
const CHART_LIGHT_COLORS = [
|
|
85
|
+
"#4290F0",
|
|
86
|
+
"#F5B647",
|
|
87
|
+
"#E8649D",
|
|
88
|
+
"#8D58EE",
|
|
89
|
+
"#50C3B6",
|
|
90
|
+
"#D37536"
|
|
91
|
+
];
|
|
92
|
+
/**
|
|
93
|
+
* Ordered list of categorical colors for dark mode, indexed by series position.
|
|
94
|
+
* Used as the default ECharts color palette when `isDarkMode` is `true`.
|
|
95
|
+
*/
|
|
96
|
+
const CHART_DARK_COLORS = [
|
|
97
|
+
"#4290F0",
|
|
98
|
+
"#EEB720",
|
|
99
|
+
"#E8649D",
|
|
100
|
+
"#8D58EE",
|
|
101
|
+
"#50C3B6",
|
|
102
|
+
"#D37536"
|
|
103
|
+
];
|
|
104
|
+
let ChartPalette;
|
|
105
|
+
(function(_ChartPalette) {
|
|
106
|
+
function semantic(name, isDarkMode = false) {
|
|
107
|
+
return isDarkMode ? ChartSemanticDarkColors[name] : ChartSemanticLightColors[name];
|
|
108
|
+
}
|
|
109
|
+
_ChartPalette.semantic = semantic;
|
|
110
|
+
function categorical(index, isDarkMode = false) {
|
|
111
|
+
return isDarkMode ? CHART_DARK_COLORS[index % CHART_DARK_COLORS.length] : CHART_LIGHT_COLORS[index % CHART_LIGHT_COLORS.length];
|
|
112
|
+
}
|
|
113
|
+
_ChartPalette.categorical = categorical;
|
|
114
|
+
function sequential(palette, isDarkMode = false) {
|
|
115
|
+
return isDarkMode ? [...sequentialDark[palette]] : [...sequentialLight[palette]];
|
|
116
|
+
}
|
|
117
|
+
_ChartPalette.sequential = sequential;
|
|
118
|
+
function text(variant, isDarkMode = false) {
|
|
119
|
+
const colors = {
|
|
120
|
+
light: {
|
|
121
|
+
primary: "#6B7280",
|
|
122
|
+
secondary: "#9CA3AF"
|
|
123
|
+
},
|
|
124
|
+
dark: {
|
|
125
|
+
primary: "#9CA3AF",
|
|
126
|
+
secondary: "#6B7280"
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
return isDarkMode ? colors.dark[variant] : colors.light[variant];
|
|
130
|
+
}
|
|
131
|
+
_ChartPalette.text = text;
|
|
132
|
+
function mapColors(isDarkMode = false) {
|
|
133
|
+
const mode = isDarkMode ? "dark" : "light";
|
|
134
|
+
return {
|
|
135
|
+
area: mapAreaByMode[mode],
|
|
136
|
+
bubble: categorical(0, isDarkMode),
|
|
137
|
+
scale: [...mapScaleByMode[mode]]
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
_ChartPalette.mapColors = mapColors;
|
|
141
|
+
})(ChartPalette || (ChartPalette = {}));
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/components/chart/EChart.tsx
|
|
144
|
+
const transformTooltip = (tooltipObj) => {
|
|
145
|
+
const { dangerousHtmlFormatter, ...restOfTooltip } = tooltipObj;
|
|
146
|
+
return {
|
|
147
|
+
...restOfTooltip,
|
|
148
|
+
formatter: dangerousHtmlFormatter
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
const prepareChartOptions = ({ options, isDarkMode }) => {
|
|
152
|
+
const withDefaults = {
|
|
153
|
+
backgroundColor: "transparent",
|
|
154
|
+
color: isDarkMode ? CHART_DARK_COLORS : CHART_LIGHT_COLORS,
|
|
155
|
+
...options
|
|
156
|
+
};
|
|
157
|
+
if (!withDefaults.tooltip) return withDefaults;
|
|
158
|
+
return {
|
|
159
|
+
...withDefaults,
|
|
160
|
+
tooltip: Array.isArray(withDefaults.tooltip) ? withDefaults.tooltip.map(transformTooltip) : transformTooltip(withDefaults.tooltip)
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Chart — a low-level wrapper around [Apache ECharts](https://echarts.apache.org).
|
|
165
|
+
*
|
|
166
|
+
* Manages the ECharts instance lifecycle (init, option updates, event binding,
|
|
167
|
+
* resize observation, and disposal). Exposes the raw `echarts.ECharts` instance
|
|
168
|
+
* via `ref` for imperative access when needed.
|
|
169
|
+
*
|
|
170
|
+
* Prefer `TimeseriesChart` for time-series data; use this component when you
|
|
171
|
+
* need full control over the ECharts option object.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```tsx
|
|
175
|
+
* import * as echarts from "echarts/core";
|
|
176
|
+
* import { BarChart } from "echarts/charts";
|
|
177
|
+
* import { GridComponent } from "echarts/components";
|
|
178
|
+
* import { CanvasRenderer } from "echarts/renderers";
|
|
179
|
+
*
|
|
180
|
+
* echarts.use([BarChart, GridComponent, CanvasRenderer]);
|
|
181
|
+
*
|
|
182
|
+
* <Chart
|
|
183
|
+
* echarts={echarts}
|
|
184
|
+
* options={{ xAxis: { data: ["A", "B"] }, yAxis: {}, series: [{ type: "bar", data: [1, 2] }] }}
|
|
185
|
+
* />
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
const Chart = forwardRef(function Chart({ echarts, options, optionUpdateBehavior, className, isDarkMode, height = 350, aspectRatio, onEvents }, ref) {
|
|
189
|
+
const elRef = useRef(null);
|
|
190
|
+
const chartRef = useRef(null);
|
|
191
|
+
const handlersRef = useRef({});
|
|
192
|
+
const wrappersRef = useRef({});
|
|
193
|
+
const boundEventsRef = useRef(/* @__PURE__ */ new Set());
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
if (!elRef.current) return;
|
|
196
|
+
const chart = echarts.init(elRef.current, isDarkMode ? "dark" : void 0);
|
|
197
|
+
chartRef.current = chart;
|
|
198
|
+
if (typeof ref === "function") ref(chart);
|
|
199
|
+
else if (ref) ref.current = chart;
|
|
200
|
+
return () => {
|
|
201
|
+
for (const event of boundEventsRef.current) {
|
|
202
|
+
const wrapper = wrappersRef.current[event];
|
|
203
|
+
if (wrapper) chart.off(event, wrapper);
|
|
204
|
+
}
|
|
205
|
+
boundEventsRef.current.clear();
|
|
206
|
+
if (typeof ref === "function") ref(null);
|
|
207
|
+
else if (ref) ref.current = null;
|
|
208
|
+
chartRef.current = null;
|
|
209
|
+
chart.dispose();
|
|
210
|
+
};
|
|
211
|
+
}, [elRef, isDarkMode]);
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
const chart = chartRef.current;
|
|
214
|
+
if (!chart) return;
|
|
215
|
+
chart.setOption(prepareChartOptions({
|
|
216
|
+
options,
|
|
217
|
+
isDarkMode
|
|
218
|
+
}), {
|
|
219
|
+
notMerge: false,
|
|
220
|
+
lazyUpdate: true,
|
|
221
|
+
...optionUpdateBehavior
|
|
222
|
+
});
|
|
223
|
+
}, [
|
|
224
|
+
isDarkMode,
|
|
225
|
+
optionUpdateBehavior,
|
|
226
|
+
options
|
|
227
|
+
]);
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
handlersRef.current = onEvents ?? {};
|
|
230
|
+
}, [onEvents]);
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
const chart = chartRef.current;
|
|
233
|
+
if (!chart) return;
|
|
234
|
+
const nextBound = /* @__PURE__ */ new Set();
|
|
235
|
+
for (const [event, handler] of Object.entries(onEvents ?? {})) {
|
|
236
|
+
if (typeof handler !== "function") continue;
|
|
237
|
+
nextBound.add(event);
|
|
238
|
+
if (!wrappersRef.current[event]) wrappersRef.current[event] = (params) => {
|
|
239
|
+
handlersRef.current[event]?.(params);
|
|
240
|
+
};
|
|
241
|
+
if (!boundEventsRef.current.has(event)) chart.on(event, wrappersRef.current[event]);
|
|
242
|
+
}
|
|
243
|
+
for (const event of boundEventsRef.current) {
|
|
244
|
+
if (nextBound.has(event)) continue;
|
|
245
|
+
const wrapper = wrappersRef.current[event];
|
|
246
|
+
if (wrapper) chart.off(event, wrapper);
|
|
247
|
+
}
|
|
248
|
+
boundEventsRef.current = nextBound;
|
|
249
|
+
}, [
|
|
250
|
+
echarts,
|
|
251
|
+
isDarkMode,
|
|
252
|
+
onEvents
|
|
253
|
+
]);
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
const chart = chartRef.current;
|
|
256
|
+
const el = elRef.current;
|
|
257
|
+
if (!chart || !el) return;
|
|
258
|
+
let isInitial = true;
|
|
259
|
+
const ro = new ResizeObserver(() => {
|
|
260
|
+
if (isInitial) {
|
|
261
|
+
isInitial = false;
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
chart.resize();
|
|
265
|
+
});
|
|
266
|
+
ro.observe(el);
|
|
267
|
+
return () => ro.disconnect();
|
|
268
|
+
}, []);
|
|
269
|
+
return /* @__PURE__ */ jsx("div", {
|
|
270
|
+
ref: elRef,
|
|
271
|
+
className: cn("w-full", className),
|
|
272
|
+
style: aspectRatio !== void 0 ? { aspectRatio: String(aspectRatio) } : { height },
|
|
273
|
+
tabIndex: options.aria?.enabled ? 0 : void 0,
|
|
274
|
+
role: options.aria?.enabled ? "img" : void 0
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
Chart.displayName = "Chart";
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/components/chart/timeseries-markers.ts
|
|
280
|
+
function buildTimeseriesMarkerAnnotations(clusters, style) {
|
|
281
|
+
if (clusters.length === 0) return void 0;
|
|
282
|
+
const labelStyle = {
|
|
283
|
+
backgroundColor: style.labelBackgroundColor,
|
|
284
|
+
padding: [2, 4],
|
|
285
|
+
borderRadius: 6,
|
|
286
|
+
shadowBlur: 8,
|
|
287
|
+
shadowColor: style.labelBackgroundColor
|
|
288
|
+
};
|
|
289
|
+
return { markLine: {
|
|
290
|
+
symbol: "none",
|
|
291
|
+
silent: false,
|
|
292
|
+
animation: false,
|
|
293
|
+
z: 10,
|
|
294
|
+
lineStyle: {
|
|
295
|
+
type: "dashed",
|
|
296
|
+
color: style.color,
|
|
297
|
+
width: 1
|
|
298
|
+
},
|
|
299
|
+
emphasis: { lineStyle: { width: 2 } },
|
|
300
|
+
blur: {
|
|
301
|
+
lineStyle: { opacity: 1 },
|
|
302
|
+
label: { opacity: 1 }
|
|
303
|
+
},
|
|
304
|
+
label: {
|
|
305
|
+
show: true,
|
|
306
|
+
formatter: (params) => params.name ?? "",
|
|
307
|
+
position: "insideEndTop",
|
|
308
|
+
color: style.color,
|
|
309
|
+
...labelStyle
|
|
310
|
+
},
|
|
311
|
+
data: clusters.map((cluster) => ({
|
|
312
|
+
name: cluster.label,
|
|
313
|
+
xAxis: cluster.timestamp,
|
|
314
|
+
lineStyle: {
|
|
315
|
+
type: cluster.lineStyle ?? "dashed",
|
|
316
|
+
color: cluster.color ?? style.color,
|
|
317
|
+
width: 1
|
|
318
|
+
},
|
|
319
|
+
emphasis: { lineStyle: { width: 2 } },
|
|
320
|
+
blur: {
|
|
321
|
+
lineStyle: { opacity: 1 },
|
|
322
|
+
label: { opacity: 1 }
|
|
323
|
+
},
|
|
324
|
+
label: {
|
|
325
|
+
show: Boolean(cluster.label),
|
|
326
|
+
color: cluster.color ?? style.color,
|
|
327
|
+
...labelStyle
|
|
328
|
+
},
|
|
329
|
+
tooltip: { marker: cluster }
|
|
330
|
+
}))
|
|
331
|
+
} };
|
|
332
|
+
}
|
|
333
|
+
function clusterTimeseriesMarkers(markers, interval) {
|
|
334
|
+
if (!markers?.length) return [];
|
|
335
|
+
const sorted = [...markers].sort((a, b) => a.timestamp - b.timestamp);
|
|
336
|
+
const clusters = [];
|
|
337
|
+
for (const marker of sorted) {
|
|
338
|
+
const previous = clusters.at(-1);
|
|
339
|
+
if (previous && marker.timestamp - previous[previous.length - 1].timestamp <= interval) previous.push(marker);
|
|
340
|
+
else clusters.push([marker]);
|
|
341
|
+
}
|
|
342
|
+
return clusters.map((cluster) => {
|
|
343
|
+
const first = cluster[0];
|
|
344
|
+
return {
|
|
345
|
+
timestamp: first.timestamp,
|
|
346
|
+
label: cluster.length === 1 ? first.label : `${cluster.length} changes`,
|
|
347
|
+
color: first.color,
|
|
348
|
+
lineStyle: first.lineStyle,
|
|
349
|
+
markers: cluster
|
|
350
|
+
};
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
function getApproximateMarkerClusterInterval(timestamps, tickCount) {
|
|
354
|
+
if (timestamps.length < 2) return 0;
|
|
355
|
+
return (Math.max(...timestamps) - Math.min(...timestamps)) / tickCount;
|
|
356
|
+
}
|
|
357
|
+
function getTimeseriesMarkerFromEvent(params) {
|
|
358
|
+
if (params.componentType !== "markLine") return;
|
|
359
|
+
return params.data?.tooltip?.marker;
|
|
360
|
+
}
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/components/chart/timeseries-tooltip.tsx
|
|
363
|
+
const TooltipContent = memo(function TooltipContent({ state, formatValue, formatTimestamp }) {
|
|
364
|
+
if (state.type === "marker") return /* @__PURE__ */ jsx(MarkerTooltipContent, {
|
|
365
|
+
state,
|
|
366
|
+
formatValue,
|
|
367
|
+
formatTimestamp
|
|
368
|
+
});
|
|
369
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
370
|
+
className: "mb-1 text-xs font-semibold text-kumo-default",
|
|
371
|
+
children: formatTimestamp(state.ts)
|
|
372
|
+
}), /* @__PURE__ */ jsx(SeriesTooltipRows, {
|
|
373
|
+
rows: state.rows,
|
|
374
|
+
hiddenCount: state.hiddenCount,
|
|
375
|
+
formatValue
|
|
376
|
+
})] });
|
|
377
|
+
});
|
|
378
|
+
function MarkerTooltipContent({ state, formatValue, formatTimestamp }) {
|
|
379
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
380
|
+
state.markers.length === 1 && /* @__PURE__ */ jsx("div", {
|
|
381
|
+
className: "mb-1 text-xs font-semibold text-kumo-default",
|
|
382
|
+
children: formatTimestamp(state.markers[0].timestamp)
|
|
383
|
+
}),
|
|
384
|
+
/* @__PURE__ */ jsx("div", {
|
|
385
|
+
className: "space-y-1",
|
|
386
|
+
children: state.markers.map((marker, index) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
387
|
+
className: "flex items-center gap-2 text-xs text-kumo-default",
|
|
388
|
+
children: [
|
|
389
|
+
/* @__PURE__ */ jsx("span", {
|
|
390
|
+
className: "h-3 w-3 shrink-0 rounded-full",
|
|
391
|
+
style: { backgroundColor: marker.color ?? state.color }
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ jsx("span", {
|
|
394
|
+
className: "font-medium",
|
|
395
|
+
children: marker.label ?? "Reference marker"
|
|
396
|
+
}),
|
|
397
|
+
state.markers.length > 1 && /* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: "text-kumo-subtle",
|
|
399
|
+
children: formatTimestamp(marker.timestamp)
|
|
400
|
+
})
|
|
401
|
+
]
|
|
402
|
+
}), marker.description && /* @__PURE__ */ jsx("div", {
|
|
403
|
+
className: "mt-0.5 ml-5 text-xs text-kumo-default",
|
|
404
|
+
children: marker.description
|
|
405
|
+
})] }, `${marker.timestamp}-${marker.label}-${index}`))
|
|
406
|
+
}),
|
|
407
|
+
state.rows.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
408
|
+
className: "mt-2 border-t border-kumo-line pt-2",
|
|
409
|
+
children: /* @__PURE__ */ jsx(SeriesTooltipRows, {
|
|
410
|
+
rows: state.rows,
|
|
411
|
+
hiddenCount: state.hiddenCount,
|
|
412
|
+
formatValue
|
|
413
|
+
})
|
|
414
|
+
})
|
|
415
|
+
] });
|
|
416
|
+
}
|
|
417
|
+
function SeriesTooltipRows({ rows, hiddenCount, formatValue }) {
|
|
418
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [rows.map((row) => /* @__PURE__ */ jsxs("div", {
|
|
419
|
+
className: "flex items-center justify-between gap-4 py-0.5",
|
|
420
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
421
|
+
className: "flex min-w-0 items-center gap-2",
|
|
422
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
423
|
+
className: "h-3 w-3 shrink-0 rounded-full",
|
|
424
|
+
style: { backgroundColor: row.color }
|
|
425
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
426
|
+
className: "truncate text-xs font-medium text-kumo-default",
|
|
427
|
+
title: row.name,
|
|
428
|
+
children: row.name
|
|
429
|
+
})]
|
|
430
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
431
|
+
className: "shrink-0 text-xs font-semibold text-kumo-default",
|
|
432
|
+
children: formatValue ? formatValue(row.value) : formatDefaultValue(row.value)
|
|
433
|
+
})]
|
|
434
|
+
}, row.name)), hiddenCount > 0 && /* @__PURE__ */ jsxs("div", {
|
|
435
|
+
className: "mt-1 text-xs text-kumo-subtle",
|
|
436
|
+
children: [
|
|
437
|
+
"+",
|
|
438
|
+
hiddenCount,
|
|
439
|
+
" more"
|
|
440
|
+
]
|
|
441
|
+
})] });
|
|
442
|
+
}
|
|
443
|
+
const defaultNumberFormat = new Intl.NumberFormat(void 0, { maximumFractionDigits: 3 });
|
|
444
|
+
function formatDefaultValue(value) {
|
|
445
|
+
if (Number.isInteger(value)) return String(value);
|
|
446
|
+
return defaultNumberFormat.format(value);
|
|
447
|
+
}
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/components/chart/timeseries-thresholds.ts
|
|
450
|
+
function buildTimeseriesThresholdAnnotations(thresholds) {
|
|
451
|
+
if (!thresholds?.length) return void 0;
|
|
452
|
+
return { markLine: {
|
|
453
|
+
symbol: "none",
|
|
454
|
+
silent: true,
|
|
455
|
+
animation: false,
|
|
456
|
+
z: 9,
|
|
457
|
+
lineStyle: {
|
|
458
|
+
type: "dashed",
|
|
459
|
+
width: 1
|
|
460
|
+
},
|
|
461
|
+
blur: {
|
|
462
|
+
lineStyle: { opacity: 1 },
|
|
463
|
+
label: { opacity: 1 }
|
|
464
|
+
},
|
|
465
|
+
label: {
|
|
466
|
+
show: true,
|
|
467
|
+
position: "insideEndTop",
|
|
468
|
+
formatter: (params) => params.name ?? ""
|
|
469
|
+
},
|
|
470
|
+
data: thresholds.map((threshold) => ({
|
|
471
|
+
name: threshold.label,
|
|
472
|
+
yAxis: threshold.value,
|
|
473
|
+
lineStyle: {
|
|
474
|
+
color: threshold.color,
|
|
475
|
+
width: 1,
|
|
476
|
+
type: "dashed"
|
|
477
|
+
},
|
|
478
|
+
blur: {
|
|
479
|
+
lineStyle: { opacity: 1 },
|
|
480
|
+
label: { opacity: 1 }
|
|
481
|
+
},
|
|
482
|
+
label: {
|
|
483
|
+
show: Boolean(threshold.label),
|
|
484
|
+
color: threshold.color
|
|
485
|
+
}
|
|
486
|
+
}))
|
|
487
|
+
} };
|
|
488
|
+
}
|
|
489
|
+
function getThresholdValueExtent(thresholds) {
|
|
490
|
+
if (!thresholds?.length) return void 0;
|
|
491
|
+
const values = thresholds.map((threshold) => threshold.value);
|
|
492
|
+
return {
|
|
493
|
+
min: Math.min(...values),
|
|
494
|
+
max: Math.max(...values)
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/components/chart/TimeseriesChart.tsx
|
|
499
|
+
const DEFAULT_X_AXIS_TICK_COUNT = 5;
|
|
500
|
+
/**
|
|
501
|
+
* TimeseriesChart — a time-series line or bar chart.
|
|
502
|
+
*
|
|
503
|
+
* Built on `Chart` (Apache ECharts) with opinionated defaults for time-series data:
|
|
504
|
+
* a time-typed x-axis, dashed lines for incomplete data periods, brush-based
|
|
505
|
+
* time range selection, and automatic tooltip deduplication.
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```tsx
|
|
509
|
+
* import * as echarts from "echarts/core";
|
|
510
|
+
* import { LineChart } from "echarts/charts";
|
|
511
|
+
* import { GridComponent, TooltipComponent, BrushComponent, ToolboxComponent } from "echarts/components";
|
|
512
|
+
* import { CanvasRenderer } from "echarts/renderers";
|
|
513
|
+
*
|
|
514
|
+
* echarts.use([LineChart, GridComponent, TooltipComponent, BrushComponent, ToolboxComponent, CanvasRenderer]);
|
|
515
|
+
*
|
|
516
|
+
* const [range, setRange] = useState<[number, number]>();
|
|
517
|
+
*
|
|
518
|
+
* <TimeseriesChart
|
|
519
|
+
* echarts={echarts}
|
|
520
|
+
* data={[{ name: "Requests", data: [[Date.now(), 42]], color: "#086FFF" }]}
|
|
521
|
+
* xAxisName="Time"
|
|
522
|
+
* xAxisTickFormat={(ts) => new Date(ts).toLocaleTimeString()}
|
|
523
|
+
* yAxisName="Count"
|
|
524
|
+
* yAxisTickFormat={(value) => `${value / 1000}k`}
|
|
525
|
+
* tooltipValueFormat={(value) => `${value.toFixed(2)} req/s`}
|
|
526
|
+
* onTimeRangeChange={(from, to) => setRange([from, to])}
|
|
527
|
+
* />
|
|
528
|
+
* ```
|
|
529
|
+
*/
|
|
530
|
+
const TimeseriesChart = forwardRef(function TimeseriesChart({ echarts, type = "line", data, markers, thresholds, xAxisName, xAxisTickCount, xAxisTickFormat, yAxisTickFormat, yAxisTickLabelFormat, yAxisName, yAxisTickCount, tooltipValueFormat, onTimeRangeChange, height = 350, incomplete, enableLegendSelection = false, isDarkMode, gradient, loading, ariaDescription, optionUpdateBehavior, tooltipMode = "all", tooltipMaxItems = 10, tooltipFollowCursor = "both", tooltipBoundary }, ref) {
|
|
531
|
+
const chartRef = useRef(null);
|
|
532
|
+
const containerRef = useRef(null);
|
|
533
|
+
const mergedRef = useCallback((instance) => {
|
|
534
|
+
chartRef.current = instance;
|
|
535
|
+
if (typeof ref === "function") ref(instance);
|
|
536
|
+
else if (ref) ref.current = instance;
|
|
537
|
+
}, [ref]);
|
|
538
|
+
const dataRef = useRef(data);
|
|
539
|
+
dataRef.current = data;
|
|
540
|
+
const legendSelectedRef = useRef(null);
|
|
541
|
+
useEffect(() => {
|
|
542
|
+
legendSelectedRef.current = null;
|
|
543
|
+
}, [enableLegendSelection, isDarkMode]);
|
|
544
|
+
const markerHoverRef = useRef(false);
|
|
545
|
+
const activeMarkerKeyRef = useRef(null);
|
|
546
|
+
const tooltipModeRef = useRef(tooltipMode);
|
|
547
|
+
tooltipModeRef.current = tooltipMode;
|
|
548
|
+
const tooltipMaxItemsRef = useRef(tooltipMaxItems);
|
|
549
|
+
tooltipMaxItemsRef.current = tooltipMaxItems;
|
|
550
|
+
const [tooltipState, setTooltipState] = useState(null);
|
|
551
|
+
const closeTooltip = useCallback(() => {
|
|
552
|
+
activeMarkerKeyRef.current = null;
|
|
553
|
+
markerHoverRef.current = false;
|
|
554
|
+
setTooltipState(null);
|
|
555
|
+
}, []);
|
|
556
|
+
const tooltipOpen = tooltipState !== null;
|
|
557
|
+
useEffect(() => {
|
|
558
|
+
if (!tooltipOpen) return;
|
|
559
|
+
if (typeof window === "undefined") return;
|
|
560
|
+
const closeWhenOutsideChart = (event) => {
|
|
561
|
+
const container = containerRef.current;
|
|
562
|
+
if (!container) return;
|
|
563
|
+
const rect = container.getBoundingClientRect();
|
|
564
|
+
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) closeTooltip();
|
|
565
|
+
};
|
|
566
|
+
window.addEventListener("mousemove", closeWhenOutsideChart);
|
|
567
|
+
return () => window.removeEventListener("mousemove", closeWhenOutsideChart);
|
|
568
|
+
}, [tooltipOpen, closeTooltip]);
|
|
569
|
+
const mousePosRef = useRef({
|
|
570
|
+
x: 0,
|
|
571
|
+
y: 0
|
|
572
|
+
});
|
|
573
|
+
useEffect(() => {
|
|
574
|
+
const container = containerRef.current;
|
|
575
|
+
if (!container) return;
|
|
576
|
+
const onMove = (e) => {
|
|
577
|
+
const rect = container.getBoundingClientRect();
|
|
578
|
+
mousePosRef.current = {
|
|
579
|
+
x: e.clientX - rect.left,
|
|
580
|
+
y: e.clientY - rect.top
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
container.addEventListener("mousemove", onMove);
|
|
584
|
+
return () => container.removeEventListener("mousemove", onMove);
|
|
585
|
+
}, []);
|
|
586
|
+
const incompleteBefore = incomplete?.before;
|
|
587
|
+
const incompleteAfter = incomplete?.after;
|
|
588
|
+
const markerColor = ChartPalette.text("primary", isDarkMode);
|
|
589
|
+
const axisTextColor = ChartPalette.text("primary", isDarkMode);
|
|
590
|
+
const gridLineColor = colorWithOpacity(axisTextColor, .2);
|
|
591
|
+
const markerLabelBackgroundColor = isDarkMode ? "rgba(0, 0, 0, 0.5)" : "rgba(255, 255, 255, 0.5)";
|
|
592
|
+
const options = useMemo(() => {
|
|
593
|
+
const transformSeries = [];
|
|
594
|
+
const seriesType = type === "bar" ? {
|
|
595
|
+
type: "bar",
|
|
596
|
+
stack: "total"
|
|
597
|
+
} : {
|
|
598
|
+
type: "line",
|
|
599
|
+
showSymbol: false
|
|
600
|
+
};
|
|
601
|
+
const thresholdAnnotations = buildTimeseriesThresholdAnnotations(thresholds);
|
|
602
|
+
const thresholdExtent = getThresholdValueExtent(thresholds);
|
|
603
|
+
const markerAnnotations = buildTimeseriesMarkerAnnotations(clusterTimeseriesMarkers(markers, getApproximateMarkerClusterInterval(getTimestamps(data, markers), xAxisTickCount ?? DEFAULT_X_AXIS_TICK_COUNT)), {
|
|
604
|
+
color: markerColor,
|
|
605
|
+
labelBackgroundColor: markerLabelBackgroundColor
|
|
606
|
+
});
|
|
607
|
+
for (const s of data) {
|
|
608
|
+
const incompleteBeforePoints = incompleteBefore && type === "line" ? s.data.filter((point) => point[0] <= incompleteBefore) : [];
|
|
609
|
+
const incompleteAfterPoints = incompleteAfter && type === "line" ? s.data.filter((point) => point[0] >= incompleteAfter) : [];
|
|
610
|
+
const completePoints = incompleteBeforePoints.length > 0 || incompleteAfterPoints.length > 0 ? s.data.slice(Math.max(0, incompleteBeforePoints.length - 1), Math.max(0, s.data.length - incompleteAfterPoints.length + 1)) : s.data;
|
|
611
|
+
const areaStyle = gradient && type === "line" ? { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
612
|
+
offset: 0,
|
|
613
|
+
color: colorWithOpacity(s.color, .4)
|
|
614
|
+
}, {
|
|
615
|
+
offset: 1,
|
|
616
|
+
color: colorWithOpacity(s.color, 0)
|
|
617
|
+
}]) } : void 0;
|
|
618
|
+
transformSeries.push({
|
|
619
|
+
data: completePoints,
|
|
620
|
+
color: s.color,
|
|
621
|
+
name: s.name,
|
|
622
|
+
emphasis: { focus: "series" },
|
|
623
|
+
...areaStyle ? { areaStyle } : {},
|
|
624
|
+
...seriesType
|
|
625
|
+
});
|
|
626
|
+
const incompleteSeriesConfig = {
|
|
627
|
+
color: s.color,
|
|
628
|
+
name: s.name,
|
|
629
|
+
type: "line",
|
|
630
|
+
lineStyle: { type: "dashed" },
|
|
631
|
+
showSymbol: false,
|
|
632
|
+
emphasis: { focus: "series" }
|
|
633
|
+
};
|
|
634
|
+
if (incompleteBeforePoints.length > 0) transformSeries.push({
|
|
635
|
+
...incompleteSeriesConfig,
|
|
636
|
+
data: incompleteBeforePoints
|
|
637
|
+
});
|
|
638
|
+
if (incompleteAfterPoints.length > 0) transformSeries.push({
|
|
639
|
+
...incompleteSeriesConfig,
|
|
640
|
+
data: incompleteAfterPoints
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
if (markerAnnotations) transformSeries.push({
|
|
644
|
+
data: [],
|
|
645
|
+
name: "Markers",
|
|
646
|
+
type: type === "bar" ? "bar" : "line",
|
|
647
|
+
animation: false,
|
|
648
|
+
markLine: markerAnnotations.markLine
|
|
649
|
+
});
|
|
650
|
+
if (thresholdAnnotations) transformSeries.push({
|
|
651
|
+
data: [],
|
|
652
|
+
name: "Thresholds",
|
|
653
|
+
type: type === "bar" ? "bar" : "line",
|
|
654
|
+
animation: false,
|
|
655
|
+
markLine: thresholdAnnotations.markLine
|
|
656
|
+
});
|
|
657
|
+
return {
|
|
658
|
+
aria: {
|
|
659
|
+
enabled: true,
|
|
660
|
+
...ariaDescription && { label: { description: ariaDescription } }
|
|
661
|
+
},
|
|
662
|
+
brush: {
|
|
663
|
+
xAxisIndex: "all",
|
|
664
|
+
brushType: "lineX",
|
|
665
|
+
brushMode: "single",
|
|
666
|
+
outOfBrush: { colorAlpha: .3 },
|
|
667
|
+
brushStyle: {
|
|
668
|
+
borderWidth: 1,
|
|
669
|
+
color: "rgba(120,140,180,0.3)",
|
|
670
|
+
borderColor: "rgba(120,140,180,0.8)"
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
tooltip: {
|
|
674
|
+
trigger: "axis",
|
|
675
|
+
showContent: false,
|
|
676
|
+
axisPointer: { type: "shadow" }
|
|
677
|
+
},
|
|
678
|
+
backgroundColor: "transparent",
|
|
679
|
+
toolbox: { show: false },
|
|
680
|
+
...enableLegendSelection ? { legend: { show: false } } : {},
|
|
681
|
+
xAxis: {
|
|
682
|
+
name: xAxisName,
|
|
683
|
+
nameLocation: "middle",
|
|
684
|
+
nameGap: 30,
|
|
685
|
+
nameTextStyle: { color: axisTextColor },
|
|
686
|
+
type: "time",
|
|
687
|
+
splitLine: { show: false },
|
|
688
|
+
axisLine: { show: false },
|
|
689
|
+
splitNumber: xAxisTickCount ?? DEFAULT_X_AXIS_TICK_COUNT,
|
|
690
|
+
axisLabel: {
|
|
691
|
+
color: axisTextColor,
|
|
692
|
+
...xAxisTickFormat && { formatter: (value) => xAxisTickFormat(value) }
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
yAxis: {
|
|
696
|
+
name: yAxisName,
|
|
697
|
+
nameLocation: "middle",
|
|
698
|
+
nameGap: 40,
|
|
699
|
+
nameTextStyle: { color: axisTextColor },
|
|
700
|
+
type: "value",
|
|
701
|
+
axisTick: { show: true },
|
|
702
|
+
axisLabel: {
|
|
703
|
+
margin: 15,
|
|
704
|
+
color: axisTextColor,
|
|
705
|
+
...yAxisTickFormat && { formatter: (value) => yAxisTickFormat(value) }
|
|
706
|
+
},
|
|
707
|
+
splitLine: {
|
|
708
|
+
show: true,
|
|
709
|
+
lineStyle: {
|
|
710
|
+
type: "dashed",
|
|
711
|
+
width: 1,
|
|
712
|
+
color: gridLineColor
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
splitNumber: yAxisTickCount,
|
|
716
|
+
...thresholdExtent && {
|
|
717
|
+
min: (value) => Math.min(value.min, thresholdExtent.min),
|
|
718
|
+
max: (value) => Math.max(value.max, thresholdExtent.max)
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
grid: {
|
|
722
|
+
left: yAxisName ? 30 : 24,
|
|
723
|
+
right: 24,
|
|
724
|
+
top: 24,
|
|
725
|
+
bottom: xAxisName ? 30 : 24
|
|
726
|
+
},
|
|
727
|
+
series: transformSeries
|
|
728
|
+
};
|
|
729
|
+
}, [
|
|
730
|
+
data,
|
|
731
|
+
xAxisName,
|
|
732
|
+
xAxisTickCount,
|
|
733
|
+
xAxisTickFormat,
|
|
734
|
+
yAxisTickFormat,
|
|
735
|
+
yAxisName,
|
|
736
|
+
yAxisTickCount,
|
|
737
|
+
incompleteBefore,
|
|
738
|
+
incompleteAfter,
|
|
739
|
+
type,
|
|
740
|
+
gradient,
|
|
741
|
+
enableLegendSelection,
|
|
742
|
+
echarts,
|
|
743
|
+
ariaDescription,
|
|
744
|
+
markers,
|
|
745
|
+
thresholds,
|
|
746
|
+
markerColor,
|
|
747
|
+
markerLabelBackgroundColor,
|
|
748
|
+
axisTextColor,
|
|
749
|
+
gridLineColor
|
|
750
|
+
]);
|
|
751
|
+
const events = useMemo(() => {
|
|
752
|
+
return {
|
|
753
|
+
updateaxispointer: (params) => {
|
|
754
|
+
if (markerHoverRef.current) return;
|
|
755
|
+
const ts = params?.axesInfo?.[0]?.value;
|
|
756
|
+
if (ts == null) return;
|
|
757
|
+
const allRows = getAllTooltipRowsAtTimestamp(dataRef.current, ts, legendSelectedRef.current);
|
|
758
|
+
let rows;
|
|
759
|
+
let hiddenCount = 0;
|
|
760
|
+
if (tooltipModeRef.current === "single") {
|
|
761
|
+
const chart = chartRef.current;
|
|
762
|
+
const cursorValue = chart ? chart.convertFromPixel("grid", [0, mousePosRef.current.y])?.[1] : null;
|
|
763
|
+
if (cursorValue != null && allRows.length > 0) rows = [allRows.reduce((best, row) => Math.abs(row.value - cursorValue) < Math.abs(best.value - cursorValue) ? row : best)];
|
|
764
|
+
else rows = allRows.slice(0, 1);
|
|
765
|
+
} else ({rows, hiddenCount} = limitTooltipRows(allRows, tooltipMaxItemsRef.current));
|
|
766
|
+
const nextState = {
|
|
767
|
+
type: "series",
|
|
768
|
+
ts,
|
|
769
|
+
rows,
|
|
770
|
+
hiddenCount
|
|
771
|
+
};
|
|
772
|
+
setTooltipState((prev) => {
|
|
773
|
+
if (isSameTooltipState(prev, nextState)) return prev;
|
|
774
|
+
return nextState;
|
|
775
|
+
});
|
|
776
|
+
},
|
|
777
|
+
mouseover: (params) => {
|
|
778
|
+
const marker = getTimeseriesMarkerFromEvent(params);
|
|
779
|
+
if (!marker) return;
|
|
780
|
+
const markerKey = `${marker.timestamp}-${marker.label ?? ""}`;
|
|
781
|
+
if (activeMarkerKeyRef.current === markerKey) return;
|
|
782
|
+
activeMarkerKeyRef.current = markerKey;
|
|
783
|
+
markerHoverRef.current = true;
|
|
784
|
+
chartRef.current?.dispatchAction({ type: "hideTip" });
|
|
785
|
+
chartRef.current?.dispatchAction({
|
|
786
|
+
type: "updateAxisPointer",
|
|
787
|
+
currTrigger: "leave"
|
|
788
|
+
});
|
|
789
|
+
const { rows, hiddenCount } = getTooltipRowsAtTimestamp(dataRef.current, marker.timestamp, legendSelectedRef.current, tooltipMaxItemsRef.current);
|
|
790
|
+
setTooltipState({
|
|
791
|
+
type: "marker",
|
|
792
|
+
ts: marker.timestamp,
|
|
793
|
+
color: marker.color ?? markerColor,
|
|
794
|
+
markers: marker.markers,
|
|
795
|
+
rows,
|
|
796
|
+
hiddenCount
|
|
797
|
+
});
|
|
798
|
+
},
|
|
799
|
+
mouseout: (params) => {
|
|
800
|
+
if (!getTimeseriesMarkerFromEvent(params)) return;
|
|
801
|
+
closeTooltip();
|
|
802
|
+
},
|
|
803
|
+
globalout: closeTooltip,
|
|
804
|
+
legendselectchanged: (params) => {
|
|
805
|
+
legendSelectedRef.current = params.selected;
|
|
806
|
+
},
|
|
807
|
+
legendselected: (params) => {
|
|
808
|
+
legendSelectedRef.current = params.selected;
|
|
809
|
+
},
|
|
810
|
+
legendunselected: (params) => {
|
|
811
|
+
legendSelectedRef.current = params.selected;
|
|
812
|
+
},
|
|
813
|
+
...onTimeRangeChange && { brushend: (params) => {
|
|
814
|
+
const range = params.areas[0].coordRange;
|
|
815
|
+
onTimeRangeChange(range[0], range[1]);
|
|
816
|
+
chartRef.current?.dispatchAction({
|
|
817
|
+
type: "brush",
|
|
818
|
+
areas: []
|
|
819
|
+
});
|
|
820
|
+
} }
|
|
821
|
+
};
|
|
822
|
+
}, [
|
|
823
|
+
onTimeRangeChange,
|
|
824
|
+
markerColor,
|
|
825
|
+
closeTooltip
|
|
826
|
+
]);
|
|
827
|
+
const hasTimeRangeCallback = !!onTimeRangeChange;
|
|
828
|
+
useEffect(() => {
|
|
829
|
+
const chart = chartRef.current;
|
|
830
|
+
if (chart && hasTimeRangeCallback) {
|
|
831
|
+
chart.dispatchAction({
|
|
832
|
+
type: "takeGlobalCursor",
|
|
833
|
+
key: "brush",
|
|
834
|
+
brushOption: {
|
|
835
|
+
brushType: "lineX",
|
|
836
|
+
brushMode: "single"
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
return () => {
|
|
840
|
+
chart.dispatchAction({
|
|
841
|
+
type: "takeGlobalCursor",
|
|
842
|
+
key: "brush",
|
|
843
|
+
brushOption: { brushType: false }
|
|
844
|
+
});
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
}, [
|
|
848
|
+
chartRef,
|
|
849
|
+
hasTimeRangeCallback,
|
|
850
|
+
loading,
|
|
851
|
+
optionUpdateBehavior?.notMerge ? options : void 0
|
|
852
|
+
]);
|
|
853
|
+
return /* @__PURE__ */ jsxs(TooltipRoot, {
|
|
854
|
+
open: tooltipOpen,
|
|
855
|
+
trackCursorAxis: tooltipFollowCursor,
|
|
856
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
857
|
+
render: /* @__PURE__ */ jsx("div", {
|
|
858
|
+
ref: containerRef,
|
|
859
|
+
className: "relative w-full",
|
|
860
|
+
style: { height },
|
|
861
|
+
"aria-busy": loading || void 0
|
|
862
|
+
}),
|
|
863
|
+
children: loading ? /* @__PURE__ */ jsx(ChartSkeletonLoader, {
|
|
864
|
+
height,
|
|
865
|
+
isDarkMode,
|
|
866
|
+
type
|
|
867
|
+
}) : /* @__PURE__ */ jsx(Chart, {
|
|
868
|
+
echarts,
|
|
869
|
+
ref: mergedRef,
|
|
870
|
+
options,
|
|
871
|
+
height,
|
|
872
|
+
isDarkMode,
|
|
873
|
+
onEvents: events,
|
|
874
|
+
optionUpdateBehavior
|
|
875
|
+
})
|
|
876
|
+
}), tooltipOpen && /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
877
|
+
side: "right",
|
|
878
|
+
align: "start",
|
|
879
|
+
sideOffset: 12,
|
|
880
|
+
collisionAvoidance: {
|
|
881
|
+
side: "flip",
|
|
882
|
+
align: "shift"
|
|
883
|
+
},
|
|
884
|
+
collisionBoundary: tooltipBoundary,
|
|
885
|
+
collisionPadding: 8,
|
|
886
|
+
children: /* @__PURE__ */ jsx(TooltipPopup, {
|
|
887
|
+
"data-mode": isDarkMode ? "dark" : "light",
|
|
888
|
+
className: "max-w-xs min-w-[150px] rounded-lg bg-kumo-base p-2 shadow-lg shadow-kumo-tip-shadow outline-1 outline-kumo-fill",
|
|
889
|
+
children: /* @__PURE__ */ jsx(TooltipContent, {
|
|
890
|
+
state: tooltipState,
|
|
891
|
+
formatValue: tooltipValueFormat ?? yAxisTickLabelFormat,
|
|
892
|
+
formatTimestamp
|
|
893
|
+
})
|
|
894
|
+
})
|
|
895
|
+
}) })]
|
|
896
|
+
});
|
|
897
|
+
});
|
|
898
|
+
TimeseriesChart.displayName = "TimeseriesChart";
|
|
899
|
+
/** Binary search for the value in `data` whose timestamp is closest to `ts`. */
|
|
900
|
+
function findNearest(data, ts) {
|
|
901
|
+
if (data.length === 0) return null;
|
|
902
|
+
let lo = 0, hi = data.length - 1;
|
|
903
|
+
while (lo < hi) {
|
|
904
|
+
const mid = lo + hi >> 1;
|
|
905
|
+
if (data[mid][0] < ts) lo = mid + 1;
|
|
906
|
+
else hi = mid;
|
|
907
|
+
}
|
|
908
|
+
if (lo > 0 && Math.abs(data[lo - 1][0] - ts) < Math.abs(data[lo][0] - ts)) lo--;
|
|
909
|
+
return data[lo][1];
|
|
910
|
+
}
|
|
911
|
+
function getTimestamps(data, markers) {
|
|
912
|
+
return [...data.flatMap((series) => series.data.map(([timestamp]) => timestamp)), ...markers?.map((marker) => marker.timestamp) ?? []];
|
|
913
|
+
}
|
|
914
|
+
function getAllTooltipRowsAtTimestamp(data, ts, legendSelected) {
|
|
915
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
916
|
+
const rows = [];
|
|
917
|
+
for (const s of data) {
|
|
918
|
+
if (seenNames.has(s.name)) continue;
|
|
919
|
+
if (legendSelected && legendSelected[s.name] === false) continue;
|
|
920
|
+
seenNames.add(s.name);
|
|
921
|
+
const value = findNearest(s.data, ts);
|
|
922
|
+
if (value != null) rows.push({
|
|
923
|
+
name: s.name,
|
|
924
|
+
value,
|
|
925
|
+
color: s.color
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
return rows.sort((a, b) => b.value - a.value);
|
|
929
|
+
}
|
|
930
|
+
function limitTooltipRows(rows, max) {
|
|
931
|
+
return {
|
|
932
|
+
rows: rows.slice(0, max),
|
|
933
|
+
hiddenCount: Math.max(0, rows.length - max)
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function getTooltipRowsAtTimestamp(data, ts, legendSelected, max) {
|
|
937
|
+
return limitTooltipRows(getAllTooltipRowsAtTimestamp(data, ts, legendSelected), max);
|
|
938
|
+
}
|
|
939
|
+
function isSameMarkerTooltipState(a, b) {
|
|
940
|
+
return a.ts === b.ts && a.color === b.color && a.hiddenCount === b.hiddenCount && a.rows.length === b.rows.length && isSameTooltipRows(a.rows, b.rows) && a.markers.length === b.markers.length && a.markers.every((marker, i) => {
|
|
941
|
+
const next = b.markers[i];
|
|
942
|
+
return marker.timestamp === next.timestamp && marker.label === next.label && marker.description === next.description && marker.color === next.color && marker.lineStyle === next.lineStyle;
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
/** Shallow-compare two tooltip states so React can skip renders when nothing changed. */
|
|
946
|
+
function isSameTooltipState(a, b) {
|
|
947
|
+
if (!a || a.type !== b.type) return false;
|
|
948
|
+
if (a.type === "marker" && b.type === "marker") return isSameMarkerTooltipState(a, b);
|
|
949
|
+
if (a.type !== "series" || b.type !== "series") return false;
|
|
950
|
+
if (a.ts !== b.ts || a.hiddenCount !== b.hiddenCount || a.rows.length !== b.rows.length) return false;
|
|
951
|
+
return isSameTooltipRows(a.rows, b.rows);
|
|
952
|
+
}
|
|
953
|
+
function isSameTooltipRows(a, b) {
|
|
954
|
+
return a.every((row, i) => {
|
|
955
|
+
const next = b[i];
|
|
956
|
+
return row.name === next.name && row.value === next.value && row.color === next.color;
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
/** Line/area or bar chart skeleton with a reduced-motion-aware shimmer. */
|
|
960
|
+
const CHART_LOADER_WIDTH = 400;
|
|
961
|
+
const CHART_LOADER_SAMPLES = 80;
|
|
962
|
+
const CHART_LOADER_BARS = 24;
|
|
963
|
+
const CHART_LOADER_BAR_GAP_RATIO = .35;
|
|
964
|
+
/**
|
|
965
|
+
* Sum of harmonics used to shape both the area line and the bar heights, so the
|
|
966
|
+
* two skeleton variants share the same calm, organic silhouette.
|
|
967
|
+
* Returns a value roughly in the range `[-1, 1]`.
|
|
968
|
+
*/
|
|
969
|
+
function chartLoaderWave(theta) {
|
|
970
|
+
return .45 * Math.sin(3 * theta) + .3 * Math.sin(5 * theta + .9) + .25 * Math.sin(7 * theta + 2.1);
|
|
971
|
+
}
|
|
972
|
+
function ChartSkeletonLoader({ height, isDarkMode, type = "line" }) {
|
|
973
|
+
const id = `kumo-chart-loader-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
974
|
+
const fillId = `${id}-fill`;
|
|
975
|
+
const shineId = `${id}-shine`;
|
|
976
|
+
const clipId = `${id}-clip`;
|
|
977
|
+
const color = ChartPalette.semantic("Skeleton", isDarkMode);
|
|
978
|
+
const strokeOpacity = isDarkMode ? .36 : .6;
|
|
979
|
+
const fillOpacity = isDarkMode ? .07 : .1;
|
|
980
|
+
const shineOpacity = isDarkMode ? .16 : .24;
|
|
981
|
+
const barFillOpacity = isDarkMode ? .12 : .16;
|
|
982
|
+
const slot = CHART_LOADER_WIDTH / CHART_LOADER_BARS;
|
|
983
|
+
const barW = slot * (1 - CHART_LOADER_BAR_GAP_RATIO);
|
|
984
|
+
const minBarH = height * .15;
|
|
985
|
+
const maxBarH = height * .85;
|
|
986
|
+
const bars = Array.from({ length: CHART_LOADER_BARS }, (_, i) => {
|
|
987
|
+
const norm = (chartLoaderWave((i + .5) / CHART_LOADER_BARS * 2 * Math.PI) + 1) / 2;
|
|
988
|
+
const barH = minBarH + norm * (maxBarH - minBarH);
|
|
989
|
+
return {
|
|
990
|
+
x: i * slot + (slot - barW) / 2,
|
|
991
|
+
y: height - barH,
|
|
992
|
+
w: barW,
|
|
993
|
+
h: barH
|
|
994
|
+
};
|
|
995
|
+
});
|
|
996
|
+
const mid = height / 2;
|
|
997
|
+
const amp = Math.min(height * .18, 40);
|
|
998
|
+
const lineD = Array.from({ length: 81 }, (_, i) => {
|
|
999
|
+
const x = i / CHART_LOADER_SAMPLES * CHART_LOADER_WIDTH;
|
|
1000
|
+
const theta = x / CHART_LOADER_WIDTH * 2 * Math.PI;
|
|
1001
|
+
const y = mid - chartLoaderWave(theta) * amp;
|
|
1002
|
+
return `${i === 0 ? "M" : "L"}${x.toFixed(2)},${y.toFixed(2)}`;
|
|
1003
|
+
}).join(" ");
|
|
1004
|
+
const areaD = `${lineD} L${CHART_LOADER_WIDTH},${height} L0,${height} Z`;
|
|
1005
|
+
const isBar = type === "bar";
|
|
1006
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1007
|
+
role: "status",
|
|
1008
|
+
"aria-label": "Loading chart",
|
|
1009
|
+
className: "absolute inset-0 overflow-hidden",
|
|
1010
|
+
style: { height },
|
|
1011
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
1012
|
+
"aria-hidden": "true",
|
|
1013
|
+
width: "100%",
|
|
1014
|
+
height,
|
|
1015
|
+
viewBox: `0 0 ${CHART_LOADER_WIDTH} ${height}`,
|
|
1016
|
+
preserveAspectRatio: "none",
|
|
1017
|
+
className: "block w-full",
|
|
1018
|
+
children: [
|
|
1019
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
1020
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
1021
|
+
id: fillId,
|
|
1022
|
+
x1: "0",
|
|
1023
|
+
y1: "0",
|
|
1024
|
+
x2: "0",
|
|
1025
|
+
y2: "1",
|
|
1026
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
1027
|
+
offset: "0%",
|
|
1028
|
+
stopColor: color,
|
|
1029
|
+
stopOpacity: fillOpacity
|
|
1030
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
1031
|
+
offset: "100%",
|
|
1032
|
+
stopColor: color,
|
|
1033
|
+
stopOpacity: "0"
|
|
1034
|
+
})]
|
|
1035
|
+
}),
|
|
1036
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
1037
|
+
id: shineId,
|
|
1038
|
+
x1: "0",
|
|
1039
|
+
y1: "0",
|
|
1040
|
+
x2: "1",
|
|
1041
|
+
y2: "0",
|
|
1042
|
+
children: [
|
|
1043
|
+
/* @__PURE__ */ jsx("stop", {
|
|
1044
|
+
offset: "0%",
|
|
1045
|
+
stopColor: color,
|
|
1046
|
+
stopOpacity: "0"
|
|
1047
|
+
}),
|
|
1048
|
+
/* @__PURE__ */ jsx("stop", {
|
|
1049
|
+
offset: "50%",
|
|
1050
|
+
stopColor: color,
|
|
1051
|
+
stopOpacity: shineOpacity
|
|
1052
|
+
}),
|
|
1053
|
+
/* @__PURE__ */ jsx("stop", {
|
|
1054
|
+
offset: "100%",
|
|
1055
|
+
stopColor: color,
|
|
1056
|
+
stopOpacity: "0"
|
|
1057
|
+
})
|
|
1058
|
+
]
|
|
1059
|
+
}),
|
|
1060
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
1061
|
+
id: clipId,
|
|
1062
|
+
children: isBar ? bars.map((b, i) => /* @__PURE__ */ jsx("rect", {
|
|
1063
|
+
x: b.x,
|
|
1064
|
+
y: b.y,
|
|
1065
|
+
width: b.w,
|
|
1066
|
+
height: b.h
|
|
1067
|
+
}, i)) : /* @__PURE__ */ jsx("path", { d: areaD })
|
|
1068
|
+
})
|
|
1069
|
+
] }),
|
|
1070
|
+
isBar ? bars.map((b, i) => /* @__PURE__ */ jsx("rect", {
|
|
1071
|
+
x: b.x,
|
|
1072
|
+
y: b.y,
|
|
1073
|
+
width: b.w,
|
|
1074
|
+
height: b.h,
|
|
1075
|
+
fill: color,
|
|
1076
|
+
fillOpacity: barFillOpacity,
|
|
1077
|
+
stroke: "none"
|
|
1078
|
+
}, i)) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
|
|
1079
|
+
d: areaD,
|
|
1080
|
+
fill: `url(#${fillId})`,
|
|
1081
|
+
stroke: "none"
|
|
1082
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1083
|
+
d: lineD,
|
|
1084
|
+
fill: "none",
|
|
1085
|
+
stroke: color,
|
|
1086
|
+
strokeOpacity,
|
|
1087
|
+
strokeWidth: "1",
|
|
1088
|
+
vectorEffect: "non-scaling-stroke"
|
|
1089
|
+
})] }),
|
|
1090
|
+
/* @__PURE__ */ jsx("g", {
|
|
1091
|
+
clipPath: `url(#${clipId})`,
|
|
1092
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
1093
|
+
className: "kumo-chart-shimmer",
|
|
1094
|
+
x: "0",
|
|
1095
|
+
y: "0",
|
|
1096
|
+
width: CHART_LOADER_WIDTH,
|
|
1097
|
+
height,
|
|
1098
|
+
fill: `url(#${shineId})`
|
|
1099
|
+
})
|
|
1100
|
+
})
|
|
1101
|
+
]
|
|
1102
|
+
})
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Returns an `rgba(r, g, b, alpha)` string for any hex or rgb(a) color input,
|
|
1107
|
+
* replacing whatever opacity was already present with the given `alpha` (0–1).
|
|
1108
|
+
*
|
|
1109
|
+
* Handles:
|
|
1110
|
+
* - 6-digit hex: `#RRGGBB`
|
|
1111
|
+
* - 8-digit hex: `#RRGGBBAA` ← strips existing alpha
|
|
1112
|
+
* - 3-digit hex: `#RGB`
|
|
1113
|
+
* - `rgb(r, g, b)`
|
|
1114
|
+
* - `rgba(r, g, b, a)` ← replaces existing alpha
|
|
1115
|
+
*/
|
|
1116
|
+
function colorWithOpacity(color, alpha) {
|
|
1117
|
+
const a = Math.max(0, Math.min(1, alpha));
|
|
1118
|
+
const rgbMatch = color.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
|
|
1119
|
+
if (rgbMatch) return `rgba(${rgbMatch[1]}, ${rgbMatch[2]}, ${rgbMatch[3]}, ${a})`;
|
|
1120
|
+
let hex = color.replace(/^#/, "");
|
|
1121
|
+
if (hex.length === 3) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
1122
|
+
if (hex.length === 8) hex = hex.slice(0, 6);
|
|
1123
|
+
return `rgba(${parseInt(hex.slice(0, 2), 16)}, ${parseInt(hex.slice(2, 4), 16)}, ${parseInt(hex.slice(4, 6), 16)}, ${a})`;
|
|
1124
|
+
}
|
|
1125
|
+
const tooltipDateFormat = new Intl.DateTimeFormat(void 0, {
|
|
1126
|
+
month: "short",
|
|
1127
|
+
day: "numeric",
|
|
1128
|
+
hour: "2-digit",
|
|
1129
|
+
minute: "2-digit",
|
|
1130
|
+
second: "2-digit",
|
|
1131
|
+
hour12: false
|
|
1132
|
+
});
|
|
1133
|
+
/**
|
|
1134
|
+
* Formats a timestamp for use in chart tooltips using the browser's locale.
|
|
1135
|
+
* Accepts a Unix timestamp in milliseconds, an ISO date string, or a `Date` object.
|
|
1136
|
+
*/
|
|
1137
|
+
function formatTimestamp(ts) {
|
|
1138
|
+
return tooltipDateFormat.format(new Date(ts));
|
|
1139
|
+
}
|
|
1140
|
+
//#endregion
|
|
1141
|
+
//#region src/components/chart/Legend.tsx
|
|
1142
|
+
const onInteractiveKeyDown = (event) => {
|
|
1143
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1144
|
+
event.preventDefault();
|
|
1145
|
+
event.currentTarget.click();
|
|
1146
|
+
};
|
|
1147
|
+
/**
|
|
1148
|
+
* Large legend item — stacked layout with a colored dot + series name on top
|
|
1149
|
+
* and a large value with an optional small unit below. Use for prominent
|
|
1150
|
+
* single-metric displays such as dashboard cards.
|
|
1151
|
+
*/
|
|
1152
|
+
function LargeItem({ color, value, name, unit, inactive, loading, onPointerEnter, onPointerLeave, onClick, className }) {
|
|
1153
|
+
if (loading) return /* @__PURE__ */ jsxs("div", {
|
|
1154
|
+
"aria-hidden": "true",
|
|
1155
|
+
className: cn("inline-flex min-w-42 flex-col gap-2 py-2", className),
|
|
1156
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1157
|
+
className: "flex items-center gap-2",
|
|
1158
|
+
children: [/* @__PURE__ */ jsx("span", { className: "inline-block size-2 rounded-full bg-kumo-fill" }), /* @__PURE__ */ jsx(SkeletonLine, { className: "h-3 w-[8ch]" })]
|
|
1159
|
+
}), /* @__PURE__ */ jsx(SkeletonLine, { className: "h-5 w-[5ch]" })]
|
|
1160
|
+
});
|
|
1161
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1162
|
+
role: "button",
|
|
1163
|
+
tabIndex: onClick ? 0 : -1,
|
|
1164
|
+
className: cn("inline-flex min-w-42 flex-col gap-2 py-2", { "cursor-pointer": !!onClick }, className),
|
|
1165
|
+
onPointerEnter,
|
|
1166
|
+
onPointerLeave,
|
|
1167
|
+
onClick,
|
|
1168
|
+
onKeyDown: onClick ? onInteractiveKeyDown : void 0,
|
|
1169
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1170
|
+
className: "flex items-center gap-2",
|
|
1171
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1172
|
+
className: cn("inline-block size-2 rounded-full", { "opacity-50": inactive }),
|
|
1173
|
+
style: { backgroundColor: color }
|
|
1174
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1175
|
+
className: cn("text-xs", { "opacity-50": inactive }),
|
|
1176
|
+
children: name
|
|
1177
|
+
})]
|
|
1178
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1179
|
+
className: "flex items-baseline gap-0.5",
|
|
1180
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1181
|
+
className: cn("text-lg leading-none font-medium", { "opacity-50": inactive }),
|
|
1182
|
+
children: value
|
|
1183
|
+
}), unit && /* @__PURE__ */ jsx("span", {
|
|
1184
|
+
className: cn("text-xs leading-none text-kumo-subtle", { "opacity-50": inactive }),
|
|
1185
|
+
children: unit
|
|
1186
|
+
})]
|
|
1187
|
+
})]
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Small legend item — inline layout with a colored dot, series name, and value
|
|
1192
|
+
* on a single row. Use for compact legends below or beside a chart.
|
|
1193
|
+
*/
|
|
1194
|
+
function SmallItem({ color, value, name, inactive, loading, onPointerEnter, onPointerLeave, onClick, className }) {
|
|
1195
|
+
if (loading) return /* @__PURE__ */ jsxs("div", {
|
|
1196
|
+
"aria-hidden": "true",
|
|
1197
|
+
className: cn("inline-flex h-4 items-center gap-2", className),
|
|
1198
|
+
children: [
|
|
1199
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block size-2 rounded-full bg-kumo-fill" }),
|
|
1200
|
+
/* @__PURE__ */ jsx(SkeletonLine, { className: "h-3 w-[5ch]" }),
|
|
1201
|
+
/* @__PURE__ */ jsx(SkeletonLine, { className: "h-3 w-[3ch]" })
|
|
1202
|
+
]
|
|
1203
|
+
});
|
|
1204
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1205
|
+
role: "button",
|
|
1206
|
+
tabIndex: onClick ? 0 : -1,
|
|
1207
|
+
className: cn("inline-flex h-4 items-center gap-2", { "cursor-pointer": !!onClick }, className),
|
|
1208
|
+
onPointerEnter,
|
|
1209
|
+
onPointerLeave,
|
|
1210
|
+
onClick,
|
|
1211
|
+
onKeyDown: onClick ? onInteractiveKeyDown : void 0,
|
|
1212
|
+
children: [
|
|
1213
|
+
/* @__PURE__ */ jsx("span", {
|
|
1214
|
+
className: cn("inline-block size-2 rounded-full", { "opacity-50": inactive }),
|
|
1215
|
+
style: { backgroundColor: color }
|
|
1216
|
+
}),
|
|
1217
|
+
/* @__PURE__ */ jsx("span", {
|
|
1218
|
+
className: cn("text-xs", { "opacity-50": inactive }),
|
|
1219
|
+
children: name
|
|
1220
|
+
}),
|
|
1221
|
+
/* @__PURE__ */ jsx("span", {
|
|
1222
|
+
className: cn("text-xs font-medium", { "opacity-50": inactive }),
|
|
1223
|
+
children: value
|
|
1224
|
+
})
|
|
1225
|
+
]
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* ChartLegend — pre-built legend item components for use alongside a chart.
|
|
1230
|
+
*
|
|
1231
|
+
* - `ChartLegend.SmallItem` — compact inline layout; suited for multi-series legends
|
|
1232
|
+
* - `ChartLegend.LargeItem` — stacked layout with a large value; suited for single-metric cards
|
|
1233
|
+
*
|
|
1234
|
+
* @example
|
|
1235
|
+
* ```tsx
|
|
1236
|
+
* <ChartLegend.SmallItem name="Requests" color="#086FFF" value="1,234" />
|
|
1237
|
+
* <ChartLegend.LargeItem name="Latency" color="#CF7EE9" value="42" unit="ms" inactive />
|
|
1238
|
+
*
|
|
1239
|
+
* // While data is loading, render skeleton placeholders:
|
|
1240
|
+
* <ChartLegend.SmallItem loading />
|
|
1241
|
+
* ```
|
|
1242
|
+
*/
|
|
1243
|
+
const ChartLegend = {
|
|
1244
|
+
SmallItem,
|
|
1245
|
+
LargeItem
|
|
1246
|
+
};
|
|
1247
|
+
//#endregion
|
|
1248
|
+
//#region src/components/chart/tooltip-utils.ts
|
|
1249
|
+
const defaultValueFormat = (value) => value.toLocaleString();
|
|
1250
|
+
/** Escape HTML special characters to prevent XSS in default tooltips. */
|
|
1251
|
+
const escapeHtml = (str) => str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region src/components/chart/SankeyChart.tsx
|
|
1254
|
+
function isTooltipParams(params) {
|
|
1255
|
+
return typeof params === "object" && params !== null;
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Escape ECharts rich text metacharacters to prevent formatting issues.
|
|
1259
|
+
* Rich text syntax uses {styleName|text}, so | and } must be escaped.
|
|
1260
|
+
*/
|
|
1261
|
+
const escapeRichText = (str) => str.replace(/[{}|]/g, (char) => `\\${char}`);
|
|
1262
|
+
/**
|
|
1263
|
+
* Sanitize a CSS color value to prevent injection attacks.
|
|
1264
|
+
* Only allows valid hex colors, rgb/rgba, hsl/hsla, and named colors.
|
|
1265
|
+
*/
|
|
1266
|
+
const sanitizeColor = (color) => {
|
|
1267
|
+
const fallback = "#666";
|
|
1268
|
+
if (!color || typeof color !== "string") return fallback;
|
|
1269
|
+
if (/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color)) return color;
|
|
1270
|
+
if (/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*[\d.]+\s*)?\)$/i.test(color)) return color;
|
|
1271
|
+
if (/^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*[\d.]+\s*)?\)$/i.test(color)) return color;
|
|
1272
|
+
if (/^[a-z]{3,20}$/i.test(color)) return color;
|
|
1273
|
+
return fallback;
|
|
1274
|
+
};
|
|
1275
|
+
function SankeyChart({ echarts, nodes, links, height = 400, nodeWidth = 8, nodePadding = 10, showTooltip: enableTooltip = true, showNodeValues, nodeLabelLayout = "stacked", formatValue = defaultValueFormat, tooltipFormatter, defaultNodeColor, left, right, linkColor = "gradient", linkOpacity = .5, className, isDarkMode, onNodeClick, onLinkClick }) {
|
|
1276
|
+
const hasNodeValues = nodes.some((n) => n.value !== void 0);
|
|
1277
|
+
const shouldShowValues = showNodeValues ?? hasNodeValues;
|
|
1278
|
+
const isInlineLayout = nodeLabelLayout === "inline";
|
|
1279
|
+
const options = useMemo(() => {
|
|
1280
|
+
const labelColor = ChartPalette.text("primary", isDarkMode);
|
|
1281
|
+
const secondaryColor = ChartPalette.text("secondary", isDarkMode);
|
|
1282
|
+
const nodeColors = nodes.map((node, index) => node.color ?? defaultNodeColor ?? ChartPalette.categorical(index, isDarkMode));
|
|
1283
|
+
const nodeDataMap = new Map(nodes.map((n, i) => [n.name, {
|
|
1284
|
+
...n,
|
|
1285
|
+
computedColor: nodeColors[i]
|
|
1286
|
+
}]));
|
|
1287
|
+
const echartsNodes = nodes.map((node, index) => ({
|
|
1288
|
+
name: node.name,
|
|
1289
|
+
value: node.value,
|
|
1290
|
+
itemStyle: { color: nodeColors[index] }
|
|
1291
|
+
}));
|
|
1292
|
+
const echartsLinks = links.map((link) => ({
|
|
1293
|
+
source: nodes[link.source]?.name ?? "",
|
|
1294
|
+
target: nodes[link.target]?.name ?? "",
|
|
1295
|
+
value: link.value
|
|
1296
|
+
}));
|
|
1297
|
+
return {
|
|
1298
|
+
backgroundColor: "transparent",
|
|
1299
|
+
animation: true,
|
|
1300
|
+
animationDuration: 500,
|
|
1301
|
+
animationDurationUpdate: 300,
|
|
1302
|
+
animationEasingUpdate: "cubicInOut",
|
|
1303
|
+
tooltip: enableTooltip ? {
|
|
1304
|
+
trigger: "item",
|
|
1305
|
+
triggerOn: "mousemove",
|
|
1306
|
+
dangerousHtmlFormatter: (params) => {
|
|
1307
|
+
if (!isTooltipParams(params)) return "";
|
|
1308
|
+
if (params.dataType === "node" && params.name) {
|
|
1309
|
+
const nodeData = nodeDataMap.get(params.name);
|
|
1310
|
+
const color = sanitizeColor(nodeData?.computedColor ?? params.color ?? "#666");
|
|
1311
|
+
if (tooltipFormatter) return tooltipFormatter({
|
|
1312
|
+
type: "node",
|
|
1313
|
+
name: params.name,
|
|
1314
|
+
node: nodeData,
|
|
1315
|
+
color
|
|
1316
|
+
});
|
|
1317
|
+
return `<div style="display:flex;align-items:center;gap:6px;"><span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${color}"></span><strong>${escapeHtml(params.name)}</strong></div>`;
|
|
1318
|
+
}
|
|
1319
|
+
if (params.dataType === "edge" && params.data) {
|
|
1320
|
+
const { source, target, value } = params.data;
|
|
1321
|
+
if (tooltipFormatter) return tooltipFormatter({
|
|
1322
|
+
type: "link",
|
|
1323
|
+
name: `${source} → ${target}`,
|
|
1324
|
+
link: {
|
|
1325
|
+
source: source ?? "",
|
|
1326
|
+
target: target ?? "",
|
|
1327
|
+
value: value ?? 0
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
const sourceNode = nodeDataMap.get(source ?? "");
|
|
1331
|
+
const targetNode = nodeDataMap.get(target ?? "");
|
|
1332
|
+
const sourceColor = sanitizeColor(sourceNode?.computedColor ?? "#666");
|
|
1333
|
+
const targetColor = sanitizeColor(targetNode?.computedColor ?? "#666");
|
|
1334
|
+
const safeSource = escapeHtml(source ?? "");
|
|
1335
|
+
const safeTarget = escapeHtml(target ?? "");
|
|
1336
|
+
return `<div style="display:flex;align-items:center;gap:6px;margin-bottom:4px;">
|
|
1337
|
+
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${sourceColor}"></span>
|
|
1338
|
+
<strong>${safeSource}</strong>
|
|
1339
|
+
<span style="color:${secondaryColor}">→</span>
|
|
1340
|
+
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${targetColor}"></span>
|
|
1341
|
+
<strong>${safeTarget}</strong>
|
|
1342
|
+
</div>
|
|
1343
|
+
<strong>${value !== void 0 ? escapeHtml(formatValue(value)) : ""}</strong>`;
|
|
1344
|
+
}
|
|
1345
|
+
return "";
|
|
1346
|
+
}
|
|
1347
|
+
} : void 0,
|
|
1348
|
+
series: [{
|
|
1349
|
+
type: "sankey",
|
|
1350
|
+
...left !== void 0 && { left },
|
|
1351
|
+
...right !== void 0 && { right },
|
|
1352
|
+
data: echartsNodes,
|
|
1353
|
+
links: echartsLinks,
|
|
1354
|
+
draggable: false,
|
|
1355
|
+
emphasis: { focus: "adjacency" },
|
|
1356
|
+
nodeWidth,
|
|
1357
|
+
nodeGap: nodePadding,
|
|
1358
|
+
lineStyle: {
|
|
1359
|
+
color: linkColor === "gradient" ? "source" : "#d1d5db",
|
|
1360
|
+
opacity: linkColor === "gradient" ? linkOpacity : .4,
|
|
1361
|
+
curveness: .5
|
|
1362
|
+
},
|
|
1363
|
+
label: {
|
|
1364
|
+
show: true,
|
|
1365
|
+
color: labelColor,
|
|
1366
|
+
fontSize: 12,
|
|
1367
|
+
formatter: shouldShowValues ? (params) => {
|
|
1368
|
+
const name = params.name ?? "";
|
|
1369
|
+
const nodeData = nodeDataMap.get(name);
|
|
1370
|
+
const safeName = escapeRichText(name);
|
|
1371
|
+
if (nodeData?.value !== void 0) {
|
|
1372
|
+
const formattedValue = escapeRichText(formatValue(nodeData.value));
|
|
1373
|
+
return isInlineLayout ? `{name|${safeName}} {value|${formattedValue}}` : `{value|${formattedValue}}\n{name|${safeName}}`;
|
|
1374
|
+
}
|
|
1375
|
+
return safeName;
|
|
1376
|
+
} : void 0,
|
|
1377
|
+
rich: shouldShowValues ? {
|
|
1378
|
+
value: {
|
|
1379
|
+
fontSize: 11,
|
|
1380
|
+
color: labelColor,
|
|
1381
|
+
lineHeight: isInlineLayout ? void 0 : 16
|
|
1382
|
+
},
|
|
1383
|
+
name: {
|
|
1384
|
+
fontSize: 12,
|
|
1385
|
+
color: labelColor,
|
|
1386
|
+
fontWeight: 700
|
|
1387
|
+
}
|
|
1388
|
+
} : void 0
|
|
1389
|
+
}
|
|
1390
|
+
}]
|
|
1391
|
+
};
|
|
1392
|
+
}, [
|
|
1393
|
+
nodes,
|
|
1394
|
+
links,
|
|
1395
|
+
enableTooltip,
|
|
1396
|
+
nodeWidth,
|
|
1397
|
+
nodePadding,
|
|
1398
|
+
defaultNodeColor,
|
|
1399
|
+
left,
|
|
1400
|
+
right,
|
|
1401
|
+
isDarkMode,
|
|
1402
|
+
linkColor,
|
|
1403
|
+
linkOpacity,
|
|
1404
|
+
shouldShowValues,
|
|
1405
|
+
isInlineLayout,
|
|
1406
|
+
formatValue,
|
|
1407
|
+
tooltipFormatter
|
|
1408
|
+
]);
|
|
1409
|
+
const handleClick = useCallback((params) => {
|
|
1410
|
+
if (params.dataType === "node" && onNodeClick && params.name) {
|
|
1411
|
+
const nodeIndex = nodes.findIndex((n) => n.name === params.name);
|
|
1412
|
+
onNodeClick({
|
|
1413
|
+
...nodeIndex >= 0 ? nodes[nodeIndex] : null,
|
|
1414
|
+
name: params.name
|
|
1415
|
+
});
|
|
1416
|
+
} else if (params.dataType === "edge" && onLinkClick && params.data) {
|
|
1417
|
+
const data = params.data;
|
|
1418
|
+
const source = typeof data === "object" && data !== null && "source" in data ? String(data.source) : "";
|
|
1419
|
+
const target = typeof data === "object" && data !== null && "target" in data ? String(data.target) : "";
|
|
1420
|
+
const sourceIndex = nodes.findIndex((n) => n.name === source);
|
|
1421
|
+
const targetIndex = nodes.findIndex((n) => n.name === target);
|
|
1422
|
+
if (sourceIndex === -1 || targetIndex === -1) return;
|
|
1423
|
+
const rawValue = params.value;
|
|
1424
|
+
const value = typeof rawValue === "number" ? rawValue : Array.isArray(rawValue) && typeof rawValue[0] === "number" ? rawValue[0] : 0;
|
|
1425
|
+
onLinkClick({
|
|
1426
|
+
...links.find((l) => l.source === sourceIndex && l.target === targetIndex),
|
|
1427
|
+
source: sourceIndex,
|
|
1428
|
+
target: targetIndex,
|
|
1429
|
+
value
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
}, [
|
|
1433
|
+
nodes,
|
|
1434
|
+
links,
|
|
1435
|
+
onNodeClick,
|
|
1436
|
+
onLinkClick
|
|
1437
|
+
]);
|
|
1438
|
+
return /* @__PURE__ */ jsx(Chart, {
|
|
1439
|
+
echarts,
|
|
1440
|
+
options,
|
|
1441
|
+
className,
|
|
1442
|
+
isDarkMode,
|
|
1443
|
+
height,
|
|
1444
|
+
onEvents: useMemo(() => ({ click: handleClick }), [handleClick])
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
SankeyChart.displayName = "SankeyChart";
|
|
1448
|
+
//#endregion
|
|
1449
|
+
//#region ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/fsum.js
|
|
1450
|
+
var Adder = class {
|
|
1451
|
+
constructor() {
|
|
1452
|
+
this._partials = /* @__PURE__ */ new Float64Array(32);
|
|
1453
|
+
this._n = 0;
|
|
1454
|
+
}
|
|
1455
|
+
add(x) {
|
|
1456
|
+
const p = this._partials;
|
|
1457
|
+
let i = 0;
|
|
1458
|
+
for (let j = 0; j < this._n && j < 32; j++) {
|
|
1459
|
+
const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
|
|
1460
|
+
if (lo) p[i++] = lo;
|
|
1461
|
+
x = hi;
|
|
1462
|
+
}
|
|
1463
|
+
p[i] = x;
|
|
1464
|
+
this._n = i + 1;
|
|
1465
|
+
return this;
|
|
1466
|
+
}
|
|
1467
|
+
valueOf() {
|
|
1468
|
+
const p = this._partials;
|
|
1469
|
+
let n = this._n, x, y, lo, hi = 0;
|
|
1470
|
+
if (n > 0) {
|
|
1471
|
+
hi = p[--n];
|
|
1472
|
+
while (n > 0) {
|
|
1473
|
+
x = hi;
|
|
1474
|
+
y = p[--n];
|
|
1475
|
+
hi = x + y;
|
|
1476
|
+
lo = y - (hi - x);
|
|
1477
|
+
if (lo) break;
|
|
1478
|
+
}
|
|
1479
|
+
if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) {
|
|
1480
|
+
y = lo * 2;
|
|
1481
|
+
x = hi + y;
|
|
1482
|
+
if (y == x - hi) hi = x;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
return hi;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
//#endregion
|
|
1489
|
+
//#region ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/merge.js
|
|
1490
|
+
function* flatten(arrays) {
|
|
1491
|
+
for (const array of arrays) yield* array;
|
|
1492
|
+
}
|
|
1493
|
+
function merge(arrays) {
|
|
1494
|
+
return Array.from(flatten(arrays));
|
|
1495
|
+
}
|
|
1496
|
+
//#endregion
|
|
1497
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/math.js
|
|
1498
|
+
var epsilon = 1e-6;
|
|
1499
|
+
var pi = Math.PI;
|
|
1500
|
+
var halfPi = pi / 2;
|
|
1501
|
+
var quarterPi = pi / 4;
|
|
1502
|
+
var tau = pi * 2;
|
|
1503
|
+
var degrees = 180 / pi;
|
|
1504
|
+
var radians = pi / 180;
|
|
1505
|
+
var abs = Math.abs;
|
|
1506
|
+
var atan = Math.atan;
|
|
1507
|
+
var atan2 = Math.atan2;
|
|
1508
|
+
var cos = Math.cos;
|
|
1509
|
+
var exp = Math.exp;
|
|
1510
|
+
var log = Math.log;
|
|
1511
|
+
var sin = Math.sin;
|
|
1512
|
+
var sign = Math.sign || function(x) {
|
|
1513
|
+
return x > 0 ? 1 : x < 0 ? -1 : 0;
|
|
1514
|
+
};
|
|
1515
|
+
var sqrt = Math.sqrt;
|
|
1516
|
+
var tan = Math.tan;
|
|
1517
|
+
function acos(x) {
|
|
1518
|
+
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
|
1519
|
+
}
|
|
1520
|
+
function asin(x) {
|
|
1521
|
+
return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
|
|
1522
|
+
}
|
|
1523
|
+
//#endregion
|
|
1524
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/noop.js
|
|
1525
|
+
function noop() {}
|
|
1526
|
+
//#endregion
|
|
1527
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/stream.js
|
|
1528
|
+
function streamGeometry(geometry, stream) {
|
|
1529
|
+
if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) streamGeometryType[geometry.type](geometry, stream);
|
|
1530
|
+
}
|
|
1531
|
+
var streamObjectType = {
|
|
1532
|
+
Feature: function(object, stream) {
|
|
1533
|
+
streamGeometry(object.geometry, stream);
|
|
1534
|
+
},
|
|
1535
|
+
FeatureCollection: function(object, stream) {
|
|
1536
|
+
var features = object.features, i = -1, n = features.length;
|
|
1537
|
+
while (++i < n) streamGeometry(features[i].geometry, stream);
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
var streamGeometryType = {
|
|
1541
|
+
Sphere: function(object, stream) {
|
|
1542
|
+
stream.sphere();
|
|
1543
|
+
},
|
|
1544
|
+
Point: function(object, stream) {
|
|
1545
|
+
object = object.coordinates;
|
|
1546
|
+
stream.point(object[0], object[1], object[2]);
|
|
1547
|
+
},
|
|
1548
|
+
MultiPoint: function(object, stream) {
|
|
1549
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
1550
|
+
while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);
|
|
1551
|
+
},
|
|
1552
|
+
LineString: function(object, stream) {
|
|
1553
|
+
streamLine(object.coordinates, stream, 0);
|
|
1554
|
+
},
|
|
1555
|
+
MultiLineString: function(object, stream) {
|
|
1556
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
1557
|
+
while (++i < n) streamLine(coordinates[i], stream, 0);
|
|
1558
|
+
},
|
|
1559
|
+
Polygon: function(object, stream) {
|
|
1560
|
+
streamPolygon(object.coordinates, stream);
|
|
1561
|
+
},
|
|
1562
|
+
MultiPolygon: function(object, stream) {
|
|
1563
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
1564
|
+
while (++i < n) streamPolygon(coordinates[i], stream);
|
|
1565
|
+
},
|
|
1566
|
+
GeometryCollection: function(object, stream) {
|
|
1567
|
+
var geometries = object.geometries, i = -1, n = geometries.length;
|
|
1568
|
+
while (++i < n) streamGeometry(geometries[i], stream);
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
function streamLine(coordinates, stream, closed) {
|
|
1572
|
+
var i = -1, n = coordinates.length - closed, coordinate;
|
|
1573
|
+
stream.lineStart();
|
|
1574
|
+
while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);
|
|
1575
|
+
stream.lineEnd();
|
|
1576
|
+
}
|
|
1577
|
+
function streamPolygon(coordinates, stream) {
|
|
1578
|
+
var i = -1, n = coordinates.length;
|
|
1579
|
+
stream.polygonStart();
|
|
1580
|
+
while (++i < n) streamLine(coordinates[i], stream, 1);
|
|
1581
|
+
stream.polygonEnd();
|
|
1582
|
+
}
|
|
1583
|
+
function stream_default(object, stream) {
|
|
1584
|
+
if (object && streamObjectType.hasOwnProperty(object.type)) streamObjectType[object.type](object, stream);
|
|
1585
|
+
else streamGeometry(object, stream);
|
|
1586
|
+
}
|
|
1587
|
+
//#endregion
|
|
1588
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/cartesian.js
|
|
1589
|
+
function spherical(cartesian) {
|
|
1590
|
+
return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];
|
|
1591
|
+
}
|
|
1592
|
+
function cartesian(spherical) {
|
|
1593
|
+
var lambda = spherical[0], phi = spherical[1], cosPhi = cos(phi);
|
|
1594
|
+
return [
|
|
1595
|
+
cosPhi * cos(lambda),
|
|
1596
|
+
cosPhi * sin(lambda),
|
|
1597
|
+
sin(phi)
|
|
1598
|
+
];
|
|
1599
|
+
}
|
|
1600
|
+
function cartesianDot(a, b) {
|
|
1601
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
1602
|
+
}
|
|
1603
|
+
function cartesianCross(a, b) {
|
|
1604
|
+
return [
|
|
1605
|
+
a[1] * b[2] - a[2] * b[1],
|
|
1606
|
+
a[2] * b[0] - a[0] * b[2],
|
|
1607
|
+
a[0] * b[1] - a[1] * b[0]
|
|
1608
|
+
];
|
|
1609
|
+
}
|
|
1610
|
+
function cartesianAddInPlace(a, b) {
|
|
1611
|
+
a[0] += b[0], a[1] += b[1], a[2] += b[2];
|
|
1612
|
+
}
|
|
1613
|
+
function cartesianScale(vector, k) {
|
|
1614
|
+
return [
|
|
1615
|
+
vector[0] * k,
|
|
1616
|
+
vector[1] * k,
|
|
1617
|
+
vector[2] * k
|
|
1618
|
+
];
|
|
1619
|
+
}
|
|
1620
|
+
function cartesianNormalizeInPlace(d) {
|
|
1621
|
+
var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
|
|
1622
|
+
d[0] /= l, d[1] /= l, d[2] /= l;
|
|
1623
|
+
}
|
|
1624
|
+
//#endregion
|
|
1625
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/compose.js
|
|
1626
|
+
function compose_default(a, b) {
|
|
1627
|
+
function compose(x, y) {
|
|
1628
|
+
return x = a(x, y), b(x[0], x[1]);
|
|
1629
|
+
}
|
|
1630
|
+
if (a.invert && b.invert) compose.invert = function(x, y) {
|
|
1631
|
+
return x = b.invert(x, y), x && a.invert(x[0], x[1]);
|
|
1632
|
+
};
|
|
1633
|
+
return compose;
|
|
1634
|
+
}
|
|
1635
|
+
//#endregion
|
|
1636
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/rotation.js
|
|
1637
|
+
function rotationIdentity(lambda, phi) {
|
|
1638
|
+
if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
|
|
1639
|
+
return [lambda, phi];
|
|
1640
|
+
}
|
|
1641
|
+
rotationIdentity.invert = rotationIdentity;
|
|
1642
|
+
function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
|
|
1643
|
+
return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
|
|
1644
|
+
}
|
|
1645
|
+
function forwardRotationLambda(deltaLambda) {
|
|
1646
|
+
return function(lambda, phi) {
|
|
1647
|
+
lambda += deltaLambda;
|
|
1648
|
+
if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
|
|
1649
|
+
return [lambda, phi];
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
function rotationLambda(deltaLambda) {
|
|
1653
|
+
var rotation = forwardRotationLambda(deltaLambda);
|
|
1654
|
+
rotation.invert = forwardRotationLambda(-deltaLambda);
|
|
1655
|
+
return rotation;
|
|
1656
|
+
}
|
|
1657
|
+
function rotationPhiGamma(deltaPhi, deltaGamma) {
|
|
1658
|
+
var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
|
|
1659
|
+
function rotation(lambda, phi) {
|
|
1660
|
+
var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
|
|
1661
|
+
return [atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), asin(k * cosDeltaGamma + y * sinDeltaGamma)];
|
|
1662
|
+
}
|
|
1663
|
+
rotation.invert = function(lambda, phi) {
|
|
1664
|
+
var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
|
|
1665
|
+
return [atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), asin(k * cosDeltaPhi - x * sinDeltaPhi)];
|
|
1666
|
+
};
|
|
1667
|
+
return rotation;
|
|
1668
|
+
}
|
|
1669
|
+
function rotation_default(rotate) {
|
|
1670
|
+
rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
|
|
1671
|
+
function forward(coordinates) {
|
|
1672
|
+
coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
|
|
1673
|
+
return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
|
|
1674
|
+
}
|
|
1675
|
+
forward.invert = function(coordinates) {
|
|
1676
|
+
coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
|
|
1677
|
+
return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
|
|
1678
|
+
};
|
|
1679
|
+
return forward;
|
|
1680
|
+
}
|
|
1681
|
+
//#endregion
|
|
1682
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/circle.js
|
|
1683
|
+
function circleStream(stream, radius, delta, direction, t0, t1) {
|
|
1684
|
+
if (!delta) return;
|
|
1685
|
+
var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
|
|
1686
|
+
if (t0 == null) {
|
|
1687
|
+
t0 = radius + direction * tau;
|
|
1688
|
+
t1 = radius - step / 2;
|
|
1689
|
+
} else {
|
|
1690
|
+
t0 = circleRadius(cosRadius, t0);
|
|
1691
|
+
t1 = circleRadius(cosRadius, t1);
|
|
1692
|
+
if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;
|
|
1693
|
+
}
|
|
1694
|
+
for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
|
|
1695
|
+
point = spherical([
|
|
1696
|
+
cosRadius,
|
|
1697
|
+
-sinRadius * cos(t),
|
|
1698
|
+
-sinRadius * sin(t)
|
|
1699
|
+
]);
|
|
1700
|
+
stream.point(point[0], point[1]);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
function circleRadius(cosRadius, point) {
|
|
1704
|
+
point = cartesian(point), point[0] -= cosRadius;
|
|
1705
|
+
cartesianNormalizeInPlace(point);
|
|
1706
|
+
var radius = acos(-point[1]);
|
|
1707
|
+
return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
|
|
1708
|
+
}
|
|
1709
|
+
//#endregion
|
|
1710
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/buffer.js
|
|
1711
|
+
function buffer_default() {
|
|
1712
|
+
var lines = [], line;
|
|
1713
|
+
return {
|
|
1714
|
+
point: function(x, y, m) {
|
|
1715
|
+
line.push([
|
|
1716
|
+
x,
|
|
1717
|
+
y,
|
|
1718
|
+
m
|
|
1719
|
+
]);
|
|
1720
|
+
},
|
|
1721
|
+
lineStart: function() {
|
|
1722
|
+
lines.push(line = []);
|
|
1723
|
+
},
|
|
1724
|
+
lineEnd: noop,
|
|
1725
|
+
rejoin: function() {
|
|
1726
|
+
if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
|
|
1727
|
+
},
|
|
1728
|
+
result: function() {
|
|
1729
|
+
var result = lines;
|
|
1730
|
+
lines = [];
|
|
1731
|
+
line = null;
|
|
1732
|
+
return result;
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
|
+
//#endregion
|
|
1737
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/pointEqual.js
|
|
1738
|
+
function pointEqual_default(a, b) {
|
|
1739
|
+
return abs(a[0] - b[0]) < 1e-6 && abs(a[1] - b[1]) < 1e-6;
|
|
1740
|
+
}
|
|
1741
|
+
//#endregion
|
|
1742
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/rejoin.js
|
|
1743
|
+
function Intersection(point, points, other, entry) {
|
|
1744
|
+
this.x = point;
|
|
1745
|
+
this.z = points;
|
|
1746
|
+
this.o = other;
|
|
1747
|
+
this.e = entry;
|
|
1748
|
+
this.v = false;
|
|
1749
|
+
this.n = this.p = null;
|
|
1750
|
+
}
|
|
1751
|
+
function rejoin_default(segments, compareIntersection, startInside, interpolate, stream) {
|
|
1752
|
+
var subject = [], clip = [], i, n;
|
|
1753
|
+
segments.forEach(function(segment) {
|
|
1754
|
+
if ((n = segment.length - 1) <= 0) return;
|
|
1755
|
+
var n, p0 = segment[0], p1 = segment[n], x;
|
|
1756
|
+
if (pointEqual_default(p0, p1)) {
|
|
1757
|
+
if (!p0[2] && !p1[2]) {
|
|
1758
|
+
stream.lineStart();
|
|
1759
|
+
for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);
|
|
1760
|
+
stream.lineEnd();
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
p1[0] += 2 * epsilon;
|
|
1764
|
+
}
|
|
1765
|
+
subject.push(x = new Intersection(p0, segment, null, true));
|
|
1766
|
+
clip.push(x.o = new Intersection(p0, null, x, false));
|
|
1767
|
+
subject.push(x = new Intersection(p1, segment, null, false));
|
|
1768
|
+
clip.push(x.o = new Intersection(p1, null, x, true));
|
|
1769
|
+
});
|
|
1770
|
+
if (!subject.length) return;
|
|
1771
|
+
clip.sort(compareIntersection);
|
|
1772
|
+
link(subject);
|
|
1773
|
+
link(clip);
|
|
1774
|
+
for (i = 0, n = clip.length; i < n; ++i) clip[i].e = startInside = !startInside;
|
|
1775
|
+
var start = subject[0], points, point;
|
|
1776
|
+
while (1) {
|
|
1777
|
+
var current = start, isSubject = true;
|
|
1778
|
+
while (current.v) if ((current = current.n) === start) return;
|
|
1779
|
+
points = current.z;
|
|
1780
|
+
stream.lineStart();
|
|
1781
|
+
do {
|
|
1782
|
+
current.v = current.o.v = true;
|
|
1783
|
+
if (current.e) {
|
|
1784
|
+
if (isSubject) for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);
|
|
1785
|
+
else interpolate(current.x, current.n.x, 1, stream);
|
|
1786
|
+
current = current.n;
|
|
1787
|
+
} else {
|
|
1788
|
+
if (isSubject) {
|
|
1789
|
+
points = current.p.z;
|
|
1790
|
+
for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);
|
|
1791
|
+
} else interpolate(current.x, current.p.x, -1, stream);
|
|
1792
|
+
current = current.p;
|
|
1793
|
+
}
|
|
1794
|
+
current = current.o;
|
|
1795
|
+
points = current.z;
|
|
1796
|
+
isSubject = !isSubject;
|
|
1797
|
+
} while (!current.v);
|
|
1798
|
+
stream.lineEnd();
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
function link(array) {
|
|
1802
|
+
if (!(n = array.length)) return;
|
|
1803
|
+
var n, i = 0, a = array[0], b;
|
|
1804
|
+
while (++i < n) {
|
|
1805
|
+
a.n = b = array[i];
|
|
1806
|
+
b.p = a;
|
|
1807
|
+
a = b;
|
|
1808
|
+
}
|
|
1809
|
+
a.n = b = array[0];
|
|
1810
|
+
b.p = a;
|
|
1811
|
+
}
|
|
1812
|
+
//#endregion
|
|
1813
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/polygonContains.js
|
|
1814
|
+
function longitude(point) {
|
|
1815
|
+
return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
|
|
1816
|
+
}
|
|
1817
|
+
function polygonContains_default(polygon, point) {
|
|
1818
|
+
var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [
|
|
1819
|
+
sin(lambda),
|
|
1820
|
+
-cos(lambda),
|
|
1821
|
+
0
|
|
1822
|
+
], angle = 0, winding = 0;
|
|
1823
|
+
var sum = new Adder();
|
|
1824
|
+
if (sinPhi === 1) phi = halfPi + epsilon;
|
|
1825
|
+
else if (sinPhi === -1) phi = -halfPi - epsilon;
|
|
1826
|
+
for (var i = 0, n = polygon.length; i < n; ++i) {
|
|
1827
|
+
if (!(m = (ring = polygon[i]).length)) continue;
|
|
1828
|
+
var ring, m, point0 = ring[m - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + quarterPi, sinPhi0 = sin(phi0), cosPhi0 = cos(phi0);
|
|
1829
|
+
for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
|
|
1830
|
+
var point1 = ring[j], lambda1 = longitude(point1), phi1 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi1), cosPhi1 = cos(phi1), delta = lambda1 - lambda0, sign = delta >= 0 ? 1 : -1, absDelta = sign * delta, antimeridian = absDelta > pi, k = sinPhi0 * sinPhi1;
|
|
1831
|
+
sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));
|
|
1832
|
+
angle += antimeridian ? delta + sign * tau : delta;
|
|
1833
|
+
if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
|
|
1834
|
+
var arc = cartesianCross(cartesian(point0), cartesian(point1));
|
|
1835
|
+
cartesianNormalizeInPlace(arc);
|
|
1836
|
+
var intersection = cartesianCross(normal, arc);
|
|
1837
|
+
cartesianNormalizeInPlace(intersection);
|
|
1838
|
+
var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
|
|
1839
|
+
if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) winding += antimeridian ^ delta >= 0 ? 1 : -1;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
return (angle < -1e-6 || angle < 1e-6 && sum < -1e-12) ^ winding & 1;
|
|
1844
|
+
}
|
|
1845
|
+
//#endregion
|
|
1846
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/index.js
|
|
1847
|
+
function clip_default(pointVisible, clipLine, interpolate, start) {
|
|
1848
|
+
return function(sink) {
|
|
1849
|
+
var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon, segments, ring;
|
|
1850
|
+
var clip = {
|
|
1851
|
+
point,
|
|
1852
|
+
lineStart,
|
|
1853
|
+
lineEnd,
|
|
1854
|
+
polygonStart: function() {
|
|
1855
|
+
clip.point = pointRing;
|
|
1856
|
+
clip.lineStart = ringStart;
|
|
1857
|
+
clip.lineEnd = ringEnd;
|
|
1858
|
+
segments = [];
|
|
1859
|
+
polygon = [];
|
|
1860
|
+
},
|
|
1861
|
+
polygonEnd: function() {
|
|
1862
|
+
clip.point = point;
|
|
1863
|
+
clip.lineStart = lineStart;
|
|
1864
|
+
clip.lineEnd = lineEnd;
|
|
1865
|
+
segments = merge(segments);
|
|
1866
|
+
var startInside = polygonContains_default(polygon, start);
|
|
1867
|
+
if (segments.length) {
|
|
1868
|
+
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
1869
|
+
rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
|
|
1870
|
+
} else if (startInside) {
|
|
1871
|
+
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
1872
|
+
sink.lineStart();
|
|
1873
|
+
interpolate(null, null, 1, sink);
|
|
1874
|
+
sink.lineEnd();
|
|
1875
|
+
}
|
|
1876
|
+
if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
|
|
1877
|
+
segments = polygon = null;
|
|
1878
|
+
},
|
|
1879
|
+
sphere: function() {
|
|
1880
|
+
sink.polygonStart();
|
|
1881
|
+
sink.lineStart();
|
|
1882
|
+
interpolate(null, null, 1, sink);
|
|
1883
|
+
sink.lineEnd();
|
|
1884
|
+
sink.polygonEnd();
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1887
|
+
function point(lambda, phi) {
|
|
1888
|
+
if (pointVisible(lambda, phi)) sink.point(lambda, phi);
|
|
1889
|
+
}
|
|
1890
|
+
function pointLine(lambda, phi) {
|
|
1891
|
+
line.point(lambda, phi);
|
|
1892
|
+
}
|
|
1893
|
+
function lineStart() {
|
|
1894
|
+
clip.point = pointLine;
|
|
1895
|
+
line.lineStart();
|
|
1896
|
+
}
|
|
1897
|
+
function lineEnd() {
|
|
1898
|
+
clip.point = point;
|
|
1899
|
+
line.lineEnd();
|
|
1900
|
+
}
|
|
1901
|
+
function pointRing(lambda, phi) {
|
|
1902
|
+
ring.push([lambda, phi]);
|
|
1903
|
+
ringSink.point(lambda, phi);
|
|
1904
|
+
}
|
|
1905
|
+
function ringStart() {
|
|
1906
|
+
ringSink.lineStart();
|
|
1907
|
+
ring = [];
|
|
1908
|
+
}
|
|
1909
|
+
function ringEnd() {
|
|
1910
|
+
pointRing(ring[0][0], ring[0][1]);
|
|
1911
|
+
ringSink.lineEnd();
|
|
1912
|
+
var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point;
|
|
1913
|
+
ring.pop();
|
|
1914
|
+
polygon.push(ring);
|
|
1915
|
+
ring = null;
|
|
1916
|
+
if (!n) return;
|
|
1917
|
+
if (clean & 1) {
|
|
1918
|
+
segment = ringSegments[0];
|
|
1919
|
+
if ((m = segment.length - 1) > 0) {
|
|
1920
|
+
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
1921
|
+
sink.lineStart();
|
|
1922
|
+
for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);
|
|
1923
|
+
sink.lineEnd();
|
|
1924
|
+
}
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1927
|
+
if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
|
|
1928
|
+
segments.push(ringSegments.filter(validSegment));
|
|
1929
|
+
}
|
|
1930
|
+
return clip;
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
function validSegment(segment) {
|
|
1934
|
+
return segment.length > 1;
|
|
1935
|
+
}
|
|
1936
|
+
function compareIntersection(a, b) {
|
|
1937
|
+
return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);
|
|
1938
|
+
}
|
|
1939
|
+
//#endregion
|
|
1940
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/antimeridian.js
|
|
1941
|
+
var antimeridian_default = clip_default(function() {
|
|
1942
|
+
return true;
|
|
1943
|
+
}, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi, -halfPi]);
|
|
1944
|
+
function clipAntimeridianLine(stream) {
|
|
1945
|
+
var lambda0 = NaN, phi0 = NaN, sign0 = NaN, clean;
|
|
1946
|
+
return {
|
|
1947
|
+
lineStart: function() {
|
|
1948
|
+
stream.lineStart();
|
|
1949
|
+
clean = 1;
|
|
1950
|
+
},
|
|
1951
|
+
point: function(lambda1, phi1) {
|
|
1952
|
+
var sign1 = lambda1 > 0 ? pi : -pi, delta = abs(lambda1 - lambda0);
|
|
1953
|
+
if (abs(delta - pi) < 1e-6) {
|
|
1954
|
+
stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);
|
|
1955
|
+
stream.point(sign0, phi0);
|
|
1956
|
+
stream.lineEnd();
|
|
1957
|
+
stream.lineStart();
|
|
1958
|
+
stream.point(sign1, phi0);
|
|
1959
|
+
stream.point(lambda1, phi0);
|
|
1960
|
+
clean = 0;
|
|
1961
|
+
} else if (sign0 !== sign1 && delta >= pi) {
|
|
1962
|
+
if (abs(lambda0 - sign0) < 1e-6) lambda0 -= sign0 * epsilon;
|
|
1963
|
+
if (abs(lambda1 - sign1) < 1e-6) lambda1 -= sign1 * epsilon;
|
|
1964
|
+
phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
|
|
1965
|
+
stream.point(sign0, phi0);
|
|
1966
|
+
stream.lineEnd();
|
|
1967
|
+
stream.lineStart();
|
|
1968
|
+
stream.point(sign1, phi0);
|
|
1969
|
+
clean = 0;
|
|
1970
|
+
}
|
|
1971
|
+
stream.point(lambda0 = lambda1, phi0 = phi1);
|
|
1972
|
+
sign0 = sign1;
|
|
1973
|
+
},
|
|
1974
|
+
lineEnd: function() {
|
|
1975
|
+
stream.lineEnd();
|
|
1976
|
+
lambda0 = phi0 = NaN;
|
|
1977
|
+
},
|
|
1978
|
+
clean: function() {
|
|
1979
|
+
return 2 - clean;
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
|
|
1984
|
+
var cosPhi0, cosPhi1, sinLambda0Lambda1 = sin(lambda0 - lambda1);
|
|
1985
|
+
return abs(sinLambda0Lambda1) > 1e-6 ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;
|
|
1986
|
+
}
|
|
1987
|
+
function clipAntimeridianInterpolate(from, to, direction, stream) {
|
|
1988
|
+
var phi;
|
|
1989
|
+
if (from == null) {
|
|
1990
|
+
phi = direction * halfPi;
|
|
1991
|
+
stream.point(-pi, phi);
|
|
1992
|
+
stream.point(0, phi);
|
|
1993
|
+
stream.point(pi, phi);
|
|
1994
|
+
stream.point(pi, 0);
|
|
1995
|
+
stream.point(pi, -phi);
|
|
1996
|
+
stream.point(0, -phi);
|
|
1997
|
+
stream.point(-pi, -phi);
|
|
1998
|
+
stream.point(-pi, 0);
|
|
1999
|
+
stream.point(-pi, phi);
|
|
2000
|
+
} else if (abs(from[0] - to[0]) > 1e-6) {
|
|
2001
|
+
var lambda = from[0] < to[0] ? pi : -pi;
|
|
2002
|
+
phi = direction * lambda / 2;
|
|
2003
|
+
stream.point(-lambda, phi);
|
|
2004
|
+
stream.point(0, phi);
|
|
2005
|
+
stream.point(lambda, phi);
|
|
2006
|
+
} else stream.point(to[0], to[1]);
|
|
2007
|
+
}
|
|
2008
|
+
//#endregion
|
|
2009
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/circle.js
|
|
2010
|
+
function circle_default(radius) {
|
|
2011
|
+
var cr = cos(radius), delta = 2 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
|
|
2012
|
+
function interpolate(from, to, direction, stream) {
|
|
2013
|
+
circleStream(stream, radius, delta, direction, from, to);
|
|
2014
|
+
}
|
|
2015
|
+
function visible(lambda, phi) {
|
|
2016
|
+
return cos(lambda) * cos(phi) > cr;
|
|
2017
|
+
}
|
|
2018
|
+
function clipLine(stream) {
|
|
2019
|
+
var point0, c0, v0, v00, clean;
|
|
2020
|
+
return {
|
|
2021
|
+
lineStart: function() {
|
|
2022
|
+
v00 = v0 = false;
|
|
2023
|
+
clean = 1;
|
|
2024
|
+
},
|
|
2025
|
+
point: function(lambda, phi) {
|
|
2026
|
+
var point1 = [lambda, phi], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
|
|
2027
|
+
if (!point0 && (v00 = v0 = v)) stream.lineStart();
|
|
2028
|
+
if (v !== v0) {
|
|
2029
|
+
point2 = intersect(point0, point1);
|
|
2030
|
+
if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2)) point1[2] = 1;
|
|
2031
|
+
}
|
|
2032
|
+
if (v !== v0) {
|
|
2033
|
+
clean = 0;
|
|
2034
|
+
if (v) {
|
|
2035
|
+
stream.lineStart();
|
|
2036
|
+
point2 = intersect(point1, point0);
|
|
2037
|
+
stream.point(point2[0], point2[1]);
|
|
2038
|
+
} else {
|
|
2039
|
+
point2 = intersect(point0, point1);
|
|
2040
|
+
stream.point(point2[0], point2[1], 2);
|
|
2041
|
+
stream.lineEnd();
|
|
2042
|
+
}
|
|
2043
|
+
point0 = point2;
|
|
2044
|
+
} else if (notHemisphere && point0 && smallRadius ^ v) {
|
|
2045
|
+
var t;
|
|
2046
|
+
if (!(c & c0) && (t = intersect(point1, point0, true))) {
|
|
2047
|
+
clean = 0;
|
|
2048
|
+
if (smallRadius) {
|
|
2049
|
+
stream.lineStart();
|
|
2050
|
+
stream.point(t[0][0], t[0][1]);
|
|
2051
|
+
stream.point(t[1][0], t[1][1]);
|
|
2052
|
+
stream.lineEnd();
|
|
2053
|
+
} else {
|
|
2054
|
+
stream.point(t[1][0], t[1][1]);
|
|
2055
|
+
stream.lineEnd();
|
|
2056
|
+
stream.lineStart();
|
|
2057
|
+
stream.point(t[0][0], t[0][1], 3);
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
if (v && (!point0 || !pointEqual_default(point0, point1))) stream.point(point1[0], point1[1]);
|
|
2062
|
+
point0 = point1, v0 = v, c0 = c;
|
|
2063
|
+
},
|
|
2064
|
+
lineEnd: function() {
|
|
2065
|
+
if (v0) stream.lineEnd();
|
|
2066
|
+
point0 = null;
|
|
2067
|
+
},
|
|
2068
|
+
clean: function() {
|
|
2069
|
+
return clean | (v00 && v0) << 1;
|
|
2070
|
+
}
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
function intersect(a, b, two) {
|
|
2074
|
+
var pa = cartesian(a), pb = cartesian(b);
|
|
2075
|
+
var n1 = [
|
|
2076
|
+
1,
|
|
2077
|
+
0,
|
|
2078
|
+
0
|
|
2079
|
+
], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
|
|
2080
|
+
if (!determinant) return !two && a;
|
|
2081
|
+
var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1);
|
|
2082
|
+
cartesianAddInPlace(A, cartesianScale(n2, c2));
|
|
2083
|
+
var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1);
|
|
2084
|
+
if (t2 < 0) return;
|
|
2085
|
+
var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu);
|
|
2086
|
+
cartesianAddInPlace(q, A);
|
|
2087
|
+
q = spherical(q);
|
|
2088
|
+
if (!two) return q;
|
|
2089
|
+
var lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1], z;
|
|
2090
|
+
if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;
|
|
2091
|
+
var delta = lambda1 - lambda0, polar = abs(delta - pi) < epsilon, meridian = polar || delta < 1e-6;
|
|
2092
|
+
if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;
|
|
2093
|
+
if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < 1e-6 ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
|
|
2094
|
+
var q1 = cartesianScale(u, (-w + t) / uu);
|
|
2095
|
+
cartesianAddInPlace(q1, A);
|
|
2096
|
+
return [q, spherical(q1)];
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
function code(lambda, phi) {
|
|
2100
|
+
var r = smallRadius ? radius : pi - radius, code = 0;
|
|
2101
|
+
if (lambda < -r) code |= 1;
|
|
2102
|
+
else if (lambda > r) code |= 2;
|
|
2103
|
+
if (phi < -r) code |= 4;
|
|
2104
|
+
else if (phi > r) code |= 8;
|
|
2105
|
+
return code;
|
|
2106
|
+
}
|
|
2107
|
+
return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
|
|
2108
|
+
}
|
|
2109
|
+
//#endregion
|
|
2110
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/line.js
|
|
2111
|
+
function line_default(a, b, x0, y0, x1, y1) {
|
|
2112
|
+
var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r = x0 - ax;
|
|
2113
|
+
if (!dx && r > 0) return;
|
|
2114
|
+
r /= dx;
|
|
2115
|
+
if (dx < 0) {
|
|
2116
|
+
if (r < t0) return;
|
|
2117
|
+
if (r < t1) t1 = r;
|
|
2118
|
+
} else if (dx > 0) {
|
|
2119
|
+
if (r > t1) return;
|
|
2120
|
+
if (r > t0) t0 = r;
|
|
2121
|
+
}
|
|
2122
|
+
r = x1 - ax;
|
|
2123
|
+
if (!dx && r < 0) return;
|
|
2124
|
+
r /= dx;
|
|
2125
|
+
if (dx < 0) {
|
|
2126
|
+
if (r > t1) return;
|
|
2127
|
+
if (r > t0) t0 = r;
|
|
2128
|
+
} else if (dx > 0) {
|
|
2129
|
+
if (r < t0) return;
|
|
2130
|
+
if (r < t1) t1 = r;
|
|
2131
|
+
}
|
|
2132
|
+
r = y0 - ay;
|
|
2133
|
+
if (!dy && r > 0) return;
|
|
2134
|
+
r /= dy;
|
|
2135
|
+
if (dy < 0) {
|
|
2136
|
+
if (r < t0) return;
|
|
2137
|
+
if (r < t1) t1 = r;
|
|
2138
|
+
} else if (dy > 0) {
|
|
2139
|
+
if (r > t1) return;
|
|
2140
|
+
if (r > t0) t0 = r;
|
|
2141
|
+
}
|
|
2142
|
+
r = y1 - ay;
|
|
2143
|
+
if (!dy && r < 0) return;
|
|
2144
|
+
r /= dy;
|
|
2145
|
+
if (dy < 0) {
|
|
2146
|
+
if (r > t1) return;
|
|
2147
|
+
if (r > t0) t0 = r;
|
|
2148
|
+
} else if (dy > 0) {
|
|
2149
|
+
if (r < t0) return;
|
|
2150
|
+
if (r < t1) t1 = r;
|
|
2151
|
+
}
|
|
2152
|
+
if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
|
|
2153
|
+
if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
|
|
2154
|
+
return true;
|
|
2155
|
+
}
|
|
2156
|
+
//#endregion
|
|
2157
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/rectangle.js
|
|
2158
|
+
var clipMax = 1e9;
|
|
2159
|
+
var clipMin = -clipMax;
|
|
2160
|
+
function clipRectangle(x0, y0, x1, y1) {
|
|
2161
|
+
function visible(x, y) {
|
|
2162
|
+
return x0 <= x && x <= x1 && y0 <= y && y <= y1;
|
|
2163
|
+
}
|
|
2164
|
+
function interpolate(from, to, direction, stream) {
|
|
2165
|
+
var a = 0, a1 = 0;
|
|
2166
|
+
if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) do
|
|
2167
|
+
stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
|
|
2168
|
+
while ((a = (a + direction + 4) % 4) !== a1);
|
|
2169
|
+
else stream.point(to[0], to[1]);
|
|
2170
|
+
}
|
|
2171
|
+
function corner(p, direction) {
|
|
2172
|
+
return abs(p[0] - x0) < 1e-6 ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < 1e-6 ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < 1e-6 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
|
|
2173
|
+
}
|
|
2174
|
+
function compareIntersection(a, b) {
|
|
2175
|
+
return comparePoint(a.x, b.x);
|
|
2176
|
+
}
|
|
2177
|
+
function comparePoint(a, b) {
|
|
2178
|
+
var ca = corner(a, 1), cb = corner(b, 1);
|
|
2179
|
+
return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
|
|
2180
|
+
}
|
|
2181
|
+
return function(stream) {
|
|
2182
|
+
var activeStream = stream, bufferStream = buffer_default(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean;
|
|
2183
|
+
var clipStream = {
|
|
2184
|
+
point,
|
|
2185
|
+
lineStart,
|
|
2186
|
+
lineEnd,
|
|
2187
|
+
polygonStart,
|
|
2188
|
+
polygonEnd
|
|
2189
|
+
};
|
|
2190
|
+
function point(x, y) {
|
|
2191
|
+
if (visible(x, y)) activeStream.point(x, y);
|
|
2192
|
+
}
|
|
2193
|
+
function polygonInside() {
|
|
2194
|
+
var winding = 0;
|
|
2195
|
+
for (var i = 0, n = polygon.length; i < n; ++i) for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {
|
|
2196
|
+
a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];
|
|
2197
|
+
if (a1 <= y1) {
|
|
2198
|
+
if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding;
|
|
2199
|
+
} else if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding;
|
|
2200
|
+
}
|
|
2201
|
+
return winding;
|
|
2202
|
+
}
|
|
2203
|
+
function polygonStart() {
|
|
2204
|
+
activeStream = bufferStream, segments = [], polygon = [], clean = true;
|
|
2205
|
+
}
|
|
2206
|
+
function polygonEnd() {
|
|
2207
|
+
var startInside = polygonInside(), cleanInside = clean && startInside, visible = (segments = merge(segments)).length;
|
|
2208
|
+
if (cleanInside || visible) {
|
|
2209
|
+
stream.polygonStart();
|
|
2210
|
+
if (cleanInside) {
|
|
2211
|
+
stream.lineStart();
|
|
2212
|
+
interpolate(null, null, 1, stream);
|
|
2213
|
+
stream.lineEnd();
|
|
2214
|
+
}
|
|
2215
|
+
if (visible) rejoin_default(segments, compareIntersection, startInside, interpolate, stream);
|
|
2216
|
+
stream.polygonEnd();
|
|
2217
|
+
}
|
|
2218
|
+
activeStream = stream, segments = polygon = ring = null;
|
|
2219
|
+
}
|
|
2220
|
+
function lineStart() {
|
|
2221
|
+
clipStream.point = linePoint;
|
|
2222
|
+
if (polygon) polygon.push(ring = []);
|
|
2223
|
+
first = true;
|
|
2224
|
+
v_ = false;
|
|
2225
|
+
x_ = y_ = NaN;
|
|
2226
|
+
}
|
|
2227
|
+
function lineEnd() {
|
|
2228
|
+
if (segments) {
|
|
2229
|
+
linePoint(x__, y__);
|
|
2230
|
+
if (v__ && v_) bufferStream.rejoin();
|
|
2231
|
+
segments.push(bufferStream.result());
|
|
2232
|
+
}
|
|
2233
|
+
clipStream.point = point;
|
|
2234
|
+
if (v_) activeStream.lineEnd();
|
|
2235
|
+
}
|
|
2236
|
+
function linePoint(x, y) {
|
|
2237
|
+
var v = visible(x, y);
|
|
2238
|
+
if (polygon) ring.push([x, y]);
|
|
2239
|
+
if (first) {
|
|
2240
|
+
x__ = x, y__ = y, v__ = v;
|
|
2241
|
+
first = false;
|
|
2242
|
+
if (v) {
|
|
2243
|
+
activeStream.lineStart();
|
|
2244
|
+
activeStream.point(x, y);
|
|
2245
|
+
}
|
|
2246
|
+
} else if (v && v_) activeStream.point(x, y);
|
|
2247
|
+
else {
|
|
2248
|
+
var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];
|
|
2249
|
+
if (line_default(a, b, x0, y0, x1, y1)) {
|
|
2250
|
+
if (!v_) {
|
|
2251
|
+
activeStream.lineStart();
|
|
2252
|
+
activeStream.point(a[0], a[1]);
|
|
2253
|
+
}
|
|
2254
|
+
activeStream.point(b[0], b[1]);
|
|
2255
|
+
if (!v) activeStream.lineEnd();
|
|
2256
|
+
clean = false;
|
|
2257
|
+
} else if (v) {
|
|
2258
|
+
activeStream.lineStart();
|
|
2259
|
+
activeStream.point(x, y);
|
|
2260
|
+
clean = false;
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
x_ = x, y_ = y, v_ = v;
|
|
2264
|
+
}
|
|
2265
|
+
return clipStream;
|
|
2266
|
+
};
|
|
2267
|
+
}
|
|
2268
|
+
//#endregion
|
|
2269
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/identity.js
|
|
2270
|
+
var identity_default = (x) => x;
|
|
2271
|
+
//#endregion
|
|
2272
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/bounds.js
|
|
2273
|
+
var x0 = Infinity;
|
|
2274
|
+
var y0 = x0;
|
|
2275
|
+
var x1 = -x0;
|
|
2276
|
+
var y1 = x1;
|
|
2277
|
+
var boundsStream = {
|
|
2278
|
+
point: boundsPoint,
|
|
2279
|
+
lineStart: noop,
|
|
2280
|
+
lineEnd: noop,
|
|
2281
|
+
polygonStart: noop,
|
|
2282
|
+
polygonEnd: noop,
|
|
2283
|
+
result: function() {
|
|
2284
|
+
var bounds = [[x0, y0], [x1, y1]];
|
|
2285
|
+
x1 = y1 = -(y0 = x0 = Infinity);
|
|
2286
|
+
return bounds;
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
function boundsPoint(x, y) {
|
|
2290
|
+
if (x < x0) x0 = x;
|
|
2291
|
+
if (x > x1) x1 = x;
|
|
2292
|
+
if (y < y0) y0 = y;
|
|
2293
|
+
if (y > y1) y1 = y;
|
|
2294
|
+
}
|
|
2295
|
+
//#endregion
|
|
2296
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/transform.js
|
|
2297
|
+
function transformer(methods) {
|
|
2298
|
+
return function(stream) {
|
|
2299
|
+
var s = new TransformStream();
|
|
2300
|
+
for (var key in methods) s[key] = methods[key];
|
|
2301
|
+
s.stream = stream;
|
|
2302
|
+
return s;
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
function TransformStream() {}
|
|
2306
|
+
TransformStream.prototype = {
|
|
2307
|
+
constructor: TransformStream,
|
|
2308
|
+
point: function(x, y) {
|
|
2309
|
+
this.stream.point(x, y);
|
|
2310
|
+
},
|
|
2311
|
+
sphere: function() {
|
|
2312
|
+
this.stream.sphere();
|
|
2313
|
+
},
|
|
2314
|
+
lineStart: function() {
|
|
2315
|
+
this.stream.lineStart();
|
|
2316
|
+
},
|
|
2317
|
+
lineEnd: function() {
|
|
2318
|
+
this.stream.lineEnd();
|
|
2319
|
+
},
|
|
2320
|
+
polygonStart: function() {
|
|
2321
|
+
this.stream.polygonStart();
|
|
2322
|
+
},
|
|
2323
|
+
polygonEnd: function() {
|
|
2324
|
+
this.stream.polygonEnd();
|
|
2325
|
+
}
|
|
2326
|
+
};
|
|
2327
|
+
//#endregion
|
|
2328
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/fit.js
|
|
2329
|
+
function fit(projection, fitBounds, object) {
|
|
2330
|
+
var clip = projection.clipExtent && projection.clipExtent();
|
|
2331
|
+
projection.scale(150).translate([0, 0]);
|
|
2332
|
+
if (clip != null) projection.clipExtent(null);
|
|
2333
|
+
stream_default(object, projection.stream(boundsStream));
|
|
2334
|
+
fitBounds(boundsStream.result());
|
|
2335
|
+
if (clip != null) projection.clipExtent(clip);
|
|
2336
|
+
return projection;
|
|
2337
|
+
}
|
|
2338
|
+
function fitExtent(projection, extent, object) {
|
|
2339
|
+
return fit(projection, function(b) {
|
|
2340
|
+
var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
|
|
2341
|
+
projection.scale(150 * k).translate([x, y]);
|
|
2342
|
+
}, object);
|
|
2343
|
+
}
|
|
2344
|
+
function fitSize(projection, size, object) {
|
|
2345
|
+
return fitExtent(projection, [[0, 0], size], object);
|
|
2346
|
+
}
|
|
2347
|
+
function fitWidth(projection, width, object) {
|
|
2348
|
+
return fit(projection, function(b) {
|
|
2349
|
+
var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1];
|
|
2350
|
+
projection.scale(150 * k).translate([x, y]);
|
|
2351
|
+
}, object);
|
|
2352
|
+
}
|
|
2353
|
+
function fitHeight(projection, height, object) {
|
|
2354
|
+
return fit(projection, function(b) {
|
|
2355
|
+
var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2;
|
|
2356
|
+
projection.scale(150 * k).translate([x, y]);
|
|
2357
|
+
}, object);
|
|
2358
|
+
}
|
|
2359
|
+
//#endregion
|
|
2360
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/resample.js
|
|
2361
|
+
var maxDepth = 16;
|
|
2362
|
+
var cosMinDistance = cos(30 * radians);
|
|
2363
|
+
function resample_default(project, delta2) {
|
|
2364
|
+
return +delta2 ? resample(project, delta2) : resampleNone(project);
|
|
2365
|
+
}
|
|
2366
|
+
function resampleNone(project) {
|
|
2367
|
+
return transformer({ point: function(x, y) {
|
|
2368
|
+
x = project(x, y);
|
|
2369
|
+
this.stream.point(x[0], x[1]);
|
|
2370
|
+
} });
|
|
2371
|
+
}
|
|
2372
|
+
function resample(project, delta2) {
|
|
2373
|
+
function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {
|
|
2374
|
+
var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
|
|
2375
|
+
if (d2 > 4 * delta2 && depth--) {
|
|
2376
|
+
var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda2 = abs(abs(c) - 1) < 1e-6 || abs(lambda0 - lambda1) < 1e-6 ? (lambda0 + lambda1) / 2 : atan2(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
|
|
2377
|
+
if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
|
|
2378
|
+
resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);
|
|
2379
|
+
stream.point(x2, y2);
|
|
2380
|
+
resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
return function(stream) {
|
|
2385
|
+
var lambda00, x00, y00, a00, b00, c00, lambda0, x0, y0, a0, b0, c0;
|
|
2386
|
+
var resampleStream = {
|
|
2387
|
+
point,
|
|
2388
|
+
lineStart,
|
|
2389
|
+
lineEnd,
|
|
2390
|
+
polygonStart: function() {
|
|
2391
|
+
stream.polygonStart();
|
|
2392
|
+
resampleStream.lineStart = ringStart;
|
|
2393
|
+
},
|
|
2394
|
+
polygonEnd: function() {
|
|
2395
|
+
stream.polygonEnd();
|
|
2396
|
+
resampleStream.lineStart = lineStart;
|
|
2397
|
+
}
|
|
2398
|
+
};
|
|
2399
|
+
function point(x, y) {
|
|
2400
|
+
x = project(x, y);
|
|
2401
|
+
stream.point(x[0], x[1]);
|
|
2402
|
+
}
|
|
2403
|
+
function lineStart() {
|
|
2404
|
+
x0 = NaN;
|
|
2405
|
+
resampleStream.point = linePoint;
|
|
2406
|
+
stream.lineStart();
|
|
2407
|
+
}
|
|
2408
|
+
function linePoint(lambda, phi) {
|
|
2409
|
+
var c = cartesian([lambda, phi]), p = project(lambda, phi);
|
|
2410
|
+
resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
|
|
2411
|
+
stream.point(x0, y0);
|
|
2412
|
+
}
|
|
2413
|
+
function lineEnd() {
|
|
2414
|
+
resampleStream.point = point;
|
|
2415
|
+
stream.lineEnd();
|
|
2416
|
+
}
|
|
2417
|
+
function ringStart() {
|
|
2418
|
+
lineStart();
|
|
2419
|
+
resampleStream.point = ringPoint;
|
|
2420
|
+
resampleStream.lineEnd = ringEnd;
|
|
2421
|
+
}
|
|
2422
|
+
function ringPoint(lambda, phi) {
|
|
2423
|
+
linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
|
|
2424
|
+
resampleStream.point = linePoint;
|
|
2425
|
+
}
|
|
2426
|
+
function ringEnd() {
|
|
2427
|
+
resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);
|
|
2428
|
+
resampleStream.lineEnd = lineEnd;
|
|
2429
|
+
lineEnd();
|
|
2430
|
+
}
|
|
2431
|
+
return resampleStream;
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
//#endregion
|
|
2435
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/index.js
|
|
2436
|
+
var transformRadians = transformer({ point: function(x, y) {
|
|
2437
|
+
this.stream.point(x * radians, y * radians);
|
|
2438
|
+
} });
|
|
2439
|
+
function transformRotate(rotate) {
|
|
2440
|
+
return transformer({ point: function(x, y) {
|
|
2441
|
+
var r = rotate(x, y);
|
|
2442
|
+
return this.stream.point(r[0], r[1]);
|
|
2443
|
+
} });
|
|
2444
|
+
}
|
|
2445
|
+
function scaleTranslate(k, dx, dy, sx, sy) {
|
|
2446
|
+
function transform(x, y) {
|
|
2447
|
+
x *= sx;
|
|
2448
|
+
y *= sy;
|
|
2449
|
+
return [dx + k * x, dy - k * y];
|
|
2450
|
+
}
|
|
2451
|
+
transform.invert = function(x, y) {
|
|
2452
|
+
return [(x - dx) / k * sx, (dy - y) / k * sy];
|
|
2453
|
+
};
|
|
2454
|
+
return transform;
|
|
2455
|
+
}
|
|
2456
|
+
function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
|
|
2457
|
+
if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);
|
|
2458
|
+
var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k;
|
|
2459
|
+
function transform(x, y) {
|
|
2460
|
+
x *= sx;
|
|
2461
|
+
y *= sy;
|
|
2462
|
+
return [a * x - b * y + dx, dy - b * x - a * y];
|
|
2463
|
+
}
|
|
2464
|
+
transform.invert = function(x, y) {
|
|
2465
|
+
return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
|
|
2466
|
+
};
|
|
2467
|
+
return transform;
|
|
2468
|
+
}
|
|
2469
|
+
function projection(project) {
|
|
2470
|
+
return projectionMutator(function() {
|
|
2471
|
+
return project;
|
|
2472
|
+
})();
|
|
2473
|
+
}
|
|
2474
|
+
function projectionMutator(projectAt) {
|
|
2475
|
+
var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = antimeridian_default, x0 = null, y0, x1, y1, postclip = identity_default, delta2 = .5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
|
|
2476
|
+
function projection(point) {
|
|
2477
|
+
return projectRotateTransform(point[0] * radians, point[1] * radians);
|
|
2478
|
+
}
|
|
2479
|
+
function invert(point) {
|
|
2480
|
+
point = projectRotateTransform.invert(point[0], point[1]);
|
|
2481
|
+
return point && [point[0] * degrees, point[1] * degrees];
|
|
2482
|
+
}
|
|
2483
|
+
projection.stream = function(stream) {
|
|
2484
|
+
return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
|
|
2485
|
+
};
|
|
2486
|
+
projection.preclip = function(_) {
|
|
2487
|
+
return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;
|
|
2488
|
+
};
|
|
2489
|
+
projection.postclip = function(_) {
|
|
2490
|
+
return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
|
|
2491
|
+
};
|
|
2492
|
+
projection.clipAngle = function(_) {
|
|
2493
|
+
return arguments.length ? (preclip = +_ ? circle_default(theta = _ * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
|
|
2494
|
+
};
|
|
2495
|
+
projection.clipExtent = function(_) {
|
|
2496
|
+
return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity_default) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
|
|
2497
|
+
};
|
|
2498
|
+
projection.scale = function(_) {
|
|
2499
|
+
return arguments.length ? (k = +_, recenter()) : k;
|
|
2500
|
+
};
|
|
2501
|
+
projection.translate = function(_) {
|
|
2502
|
+
return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
|
|
2503
|
+
};
|
|
2504
|
+
projection.center = function(_) {
|
|
2505
|
+
return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
|
|
2506
|
+
};
|
|
2507
|
+
projection.rotate = function(_) {
|
|
2508
|
+
return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [
|
|
2509
|
+
deltaLambda * degrees,
|
|
2510
|
+
deltaPhi * degrees,
|
|
2511
|
+
deltaGamma * degrees
|
|
2512
|
+
];
|
|
2513
|
+
};
|
|
2514
|
+
projection.angle = function(_) {
|
|
2515
|
+
return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;
|
|
2516
|
+
};
|
|
2517
|
+
projection.reflectX = function(_) {
|
|
2518
|
+
return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
|
|
2519
|
+
};
|
|
2520
|
+
projection.reflectY = function(_) {
|
|
2521
|
+
return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
|
|
2522
|
+
};
|
|
2523
|
+
projection.precision = function(_) {
|
|
2524
|
+
return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
|
|
2525
|
+
};
|
|
2526
|
+
projection.fitExtent = function(extent, object) {
|
|
2527
|
+
return fitExtent(projection, extent, object);
|
|
2528
|
+
};
|
|
2529
|
+
projection.fitSize = function(size, object) {
|
|
2530
|
+
return fitSize(projection, size, object);
|
|
2531
|
+
};
|
|
2532
|
+
projection.fitWidth = function(width, object) {
|
|
2533
|
+
return fitWidth(projection, width, object);
|
|
2534
|
+
};
|
|
2535
|
+
projection.fitHeight = function(height, object) {
|
|
2536
|
+
return fitHeight(projection, height, object);
|
|
2537
|
+
};
|
|
2538
|
+
function recenter() {
|
|
2539
|
+
var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);
|
|
2540
|
+
rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
|
|
2541
|
+
projectTransform = compose_default(project, transform);
|
|
2542
|
+
projectRotateTransform = compose_default(rotate, projectTransform);
|
|
2543
|
+
projectResample = resample_default(projectTransform, delta2);
|
|
2544
|
+
return reset();
|
|
2545
|
+
}
|
|
2546
|
+
function reset() {
|
|
2547
|
+
cache = cacheStream = null;
|
|
2548
|
+
return projection;
|
|
2549
|
+
}
|
|
2550
|
+
return function() {
|
|
2551
|
+
project = projectAt.apply(this, arguments);
|
|
2552
|
+
projection.invert = project.invert && invert;
|
|
2553
|
+
return recenter();
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
//#endregion
|
|
2557
|
+
//#region ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/mercator.js
|
|
2558
|
+
function mercatorRaw(lambda, phi) {
|
|
2559
|
+
return [lambda, log(tan((halfPi + phi) / 2))];
|
|
2560
|
+
}
|
|
2561
|
+
mercatorRaw.invert = function(x, y) {
|
|
2562
|
+
return [x, 2 * atan(exp(y)) - halfPi];
|
|
2563
|
+
};
|
|
2564
|
+
function mercator_default() {
|
|
2565
|
+
return mercatorProjection$1(mercatorRaw).scale(961 / tau);
|
|
2566
|
+
}
|
|
2567
|
+
function mercatorProjection$1(project) {
|
|
2568
|
+
var m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x0 = null, y0, x1, y1;
|
|
2569
|
+
m.scale = function(_) {
|
|
2570
|
+
return arguments.length ? (scale(_), reclip()) : scale();
|
|
2571
|
+
};
|
|
2572
|
+
m.translate = function(_) {
|
|
2573
|
+
return arguments.length ? (translate(_), reclip()) : translate();
|
|
2574
|
+
};
|
|
2575
|
+
m.center = function(_) {
|
|
2576
|
+
return arguments.length ? (center(_), reclip()) : center();
|
|
2577
|
+
};
|
|
2578
|
+
m.clipExtent = function(_) {
|
|
2579
|
+
return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];
|
|
2580
|
+
};
|
|
2581
|
+
function reclip() {
|
|
2582
|
+
var k = pi * scale(), t = m(rotation_default(m.rotate()).invert([0, 0]));
|
|
2583
|
+
return clipExtent(x0 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);
|
|
2584
|
+
}
|
|
2585
|
+
return reclip();
|
|
2586
|
+
}
|
|
2587
|
+
//#endregion
|
|
2588
|
+
//#region src/components/chart/Maps.tsx
|
|
2589
|
+
function resolve(row, accessor) {
|
|
2590
|
+
return typeof accessor === "function" ? accessor(row) : row[accessor];
|
|
2591
|
+
}
|
|
2592
|
+
function resolveStyle(row, style) {
|
|
2593
|
+
return typeof style === "function" ? style(row) : style;
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* Mercator's latitude cutoff. It stretches toward ±90° to infinity, so we clamp
|
|
2597
|
+
* at ±85.0511° — otherwise Antarctica projects to an unbounded height and the
|
|
2598
|
+
* whole map shrinks to fit. Renders the poles as a flat edge, like web maps do.
|
|
2599
|
+
*/
|
|
2600
|
+
const MERCATOR_MAX_LAT = 85.0511;
|
|
2601
|
+
/**
|
|
2602
|
+
* Default projection for all maps: latitude-clamped Mercator. A single shared
|
|
2603
|
+
* instance is fine - `project`/`unproject` are pure (no per-chart state).
|
|
2604
|
+
*/
|
|
2605
|
+
const mercatorProjection = mercator_default();
|
|
2606
|
+
const DEFAULT_PROJECTION = {
|
|
2607
|
+
project: (point) => {
|
|
2608
|
+
const lat = Math.max(-85.0511, Math.min(MERCATOR_MAX_LAT, point[1]));
|
|
2609
|
+
return mercatorProjection([point[0], lat]) ?? [0, 0];
|
|
2610
|
+
},
|
|
2611
|
+
unproject: (point) => mercatorProjection.invert?.(point) ?? [0, 0]
|
|
2612
|
+
};
|
|
2613
|
+
/**
|
|
2614
|
+
* Default displayed window as ECharts `boundingCoords`
|
|
2615
|
+
* (`[[west, north], [east, south]]`). Crops the empty Arctic and most of
|
|
2616
|
+
* Antarctica so the populated landmasses fill the container.
|
|
2617
|
+
*/
|
|
2618
|
+
const DEFAULT_BOUNDING_COORDS = [[-180, 80], [180, -58]];
|
|
2619
|
+
/**
|
|
2620
|
+
* Resolve the effective projection: `undefined` → the Mercator default,
|
|
2621
|
+
* `null` → none (raw plotting), otherwise the caller's projection.
|
|
2622
|
+
*/
|
|
2623
|
+
function resolveProjection(projection) {
|
|
2624
|
+
if (projection === null) return void 0;
|
|
2625
|
+
return projection ?? DEFAULT_PROJECTION;
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Aspect ratio (`width / height`) of the projected window, used to size the
|
|
2629
|
+
* container so the map fills it (ECharts contain-fits the map, so a mismatched
|
|
2630
|
+
* container letterboxes it).
|
|
2631
|
+
*
|
|
2632
|
+
* Measures width at the equator and height down the central meridian - exact
|
|
2633
|
+
* for cylindrical projections (Mercator/equirectangular/raw), close enough for
|
|
2634
|
+
* curved ones (at worst a small letterbox).
|
|
2635
|
+
*/
|
|
2636
|
+
function projectedAspect(projection, [[west, north], [east, south]]) {
|
|
2637
|
+
const project = projection ? projection.project : (p) => p;
|
|
2638
|
+
const midLat = Math.min(north, Math.max(south, 0));
|
|
2639
|
+
const w = Math.abs(project([east, midLat])[0] - project([west, midLat])[0]);
|
|
2640
|
+
const h = Math.abs(project([0, north])[1] - project([0, south])[1]);
|
|
2641
|
+
return w > 0 && h > 0 ? w / h : 16 / 9;
|
|
2642
|
+
}
|
|
2643
|
+
/** Furthest `roam` zoom-in, as a multiple of the auto-fit scale. */
|
|
2644
|
+
const MAX_ZOOM_FACTOR = 8;
|
|
2645
|
+
const geoJsonMapNames = /* @__PURE__ */ new WeakMap();
|
|
2646
|
+
function sanitizeMapName(name) {
|
|
2647
|
+
return name.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
2648
|
+
}
|
|
2649
|
+
function hashString(value) {
|
|
2650
|
+
let hash = 0;
|
|
2651
|
+
for (let i = 0; i < value.length; i++) hash = Math.imul(31, hash) + value.charCodeAt(i);
|
|
2652
|
+
return (hash >>> 0).toString(36);
|
|
2653
|
+
}
|
|
2654
|
+
function getMapName(geoJson, mapName) {
|
|
2655
|
+
if (mapName) return sanitizeMapName(mapName);
|
|
2656
|
+
const existing = geoJsonMapNames.get(geoJson);
|
|
2657
|
+
if (existing) return existing;
|
|
2658
|
+
const generated = `kumo-map-${hashString(JSON.stringify(geoJson))}`;
|
|
2659
|
+
geoJsonMapNames.set(geoJson, generated);
|
|
2660
|
+
return generated;
|
|
2661
|
+
}
|
|
2662
|
+
/** Build the `geo` coordinate-system config (land base for the bubbles). */
|
|
2663
|
+
function buildGeo(opts) {
|
|
2664
|
+
return {
|
|
2665
|
+
map: opts.mapName,
|
|
2666
|
+
nameProperty: "name",
|
|
2667
|
+
roam: opts.roam,
|
|
2668
|
+
...opts.roam ? { scaleLimit: {
|
|
2669
|
+
min: Math.min(1, opts.zoom),
|
|
2670
|
+
max: opts.zoom * MAX_ZOOM_FACTOR
|
|
2671
|
+
} } : {},
|
|
2672
|
+
center: opts.center,
|
|
2673
|
+
zoom: opts.zoom,
|
|
2674
|
+
boundingCoords: DEFAULT_BOUNDING_COORDS,
|
|
2675
|
+
...opts.projection ? { projection: opts.projection } : { aspectScale: 1 },
|
|
2676
|
+
silent: true,
|
|
2677
|
+
itemStyle: {
|
|
2678
|
+
areaColor: opts.areaColor,
|
|
2679
|
+
borderColor: opts.areaColor,
|
|
2680
|
+
borderWidth: .5
|
|
2681
|
+
},
|
|
2682
|
+
emphasis: { disabled: true }
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
/**
|
|
2686
|
+
* BubbleMap — proportional bubbles plotted by coordinate over a blank GeoJSON
|
|
2687
|
+
* base. Land is rendered seamlessly (no internal borders) so the bubbles read
|
|
2688
|
+
* clearly; bubble area is proportional to value (`minRadius`…`maxRadius`).
|
|
2689
|
+
*
|
|
2690
|
+
* @example
|
|
2691
|
+
* ```tsx
|
|
2692
|
+
* import * as echarts from "echarts/core";
|
|
2693
|
+
* import { MapChart, ScatterChart } from "echarts/charts";
|
|
2694
|
+
* import { TooltipComponent } from "echarts/components";
|
|
2695
|
+
* import { CanvasRenderer } from "echarts/renderers";
|
|
2696
|
+
* echarts.use([MapChart, ScatterChart, TooltipComponent, CanvasRenderer]);
|
|
2697
|
+
*
|
|
2698
|
+
* <BubbleMap
|
|
2699
|
+
* echarts={echarts}
|
|
2700
|
+
* geoJson={world}
|
|
2701
|
+
* data={colos}
|
|
2702
|
+
* lng="lon" lat="lat" name="iata" value="requests"
|
|
2703
|
+
* onBubbleHover={(c) => setHovered(c?.iata)}
|
|
2704
|
+
* />
|
|
2705
|
+
* ```
|
|
2706
|
+
*/
|
|
2707
|
+
function BubbleMapRoot({ echarts: ec, geoJson, mapName: mapNameProp, data, lng, lat, value, name, minRadius = 6, maxRadius = 26, bubbleSize, bubbleColor, bubbleBorderColor = "transparent", bubbleBorderWidth = 0, center, zoom = 1.25, roam = false, projection, showTooltip = true, valueFormat = defaultValueFormat, tooltipFormatter, onBubbleHover, onBubbleClick, aspectRatio, height, className, isDarkMode }, ref) {
|
|
2708
|
+
const mapName = useMemo(() => getMapName(geoJson, mapNameProp), [geoJson, mapNameProp]);
|
|
2709
|
+
useRegisterMap(ec, mapName, geoJson);
|
|
2710
|
+
const palette = useMemo(() => ChartPalette.mapColors(isDarkMode), [isDarkMode]);
|
|
2711
|
+
const centerX = center?.[0];
|
|
2712
|
+
const centerY = center?.[1];
|
|
2713
|
+
const geo = useMemo(() => buildGeo({
|
|
2714
|
+
mapName,
|
|
2715
|
+
areaColor: palette.area,
|
|
2716
|
+
center: centerX !== void 0 && centerY !== void 0 ? [centerX, centerY] : void 0,
|
|
2717
|
+
zoom,
|
|
2718
|
+
roam,
|
|
2719
|
+
projection: resolveProjection(projection)
|
|
2720
|
+
}), [
|
|
2721
|
+
mapName,
|
|
2722
|
+
geoJson,
|
|
2723
|
+
palette,
|
|
2724
|
+
centerX,
|
|
2725
|
+
centerY,
|
|
2726
|
+
zoom,
|
|
2727
|
+
roam,
|
|
2728
|
+
projection
|
|
2729
|
+
]);
|
|
2730
|
+
const resolvedAspect = useMemo(() => {
|
|
2731
|
+
if (height !== void 0) return void 0;
|
|
2732
|
+
return aspectRatio ?? projectedAspect(resolveProjection(projection), DEFAULT_BOUNDING_COORDS);
|
|
2733
|
+
}, [
|
|
2734
|
+
aspectRatio,
|
|
2735
|
+
height,
|
|
2736
|
+
projection
|
|
2737
|
+
]);
|
|
2738
|
+
const appliedGeoRef = useRef(void 0);
|
|
2739
|
+
const shouldIncludeGeo = appliedGeoRef.current !== geo;
|
|
2740
|
+
useEffect(() => {
|
|
2741
|
+
appliedGeoRef.current = geo;
|
|
2742
|
+
}, [geo]);
|
|
2743
|
+
const hoverRef = useRef(onBubbleHover);
|
|
2744
|
+
hoverRef.current = onBubbleHover;
|
|
2745
|
+
const mergedRef = useCallback((instance) => {
|
|
2746
|
+
if (typeof ref === "function") ref(instance);
|
|
2747
|
+
else if (ref) ref.current = instance;
|
|
2748
|
+
}, [ref]);
|
|
2749
|
+
const options = useMemo(() => {
|
|
2750
|
+
const values = data.map((row) => resolve(row, value));
|
|
2751
|
+
const vmax = values.length ? Math.max(...values) : 1;
|
|
2752
|
+
const radiusFor = (v) => {
|
|
2753
|
+
if (bubbleSize) return bubbleSize(v);
|
|
2754
|
+
if (vmax <= 0) return minRadius;
|
|
2755
|
+
return minRadius + Math.sqrt(Math.max(0, v) / vmax) * (maxRadius - minRadius);
|
|
2756
|
+
};
|
|
2757
|
+
const points = data.map((row) => {
|
|
2758
|
+
const v = resolve(row, value);
|
|
2759
|
+
return {
|
|
2760
|
+
name: name ? resolve(row, name) : void 0,
|
|
2761
|
+
value: [
|
|
2762
|
+
resolve(row, lng),
|
|
2763
|
+
resolve(row, lat),
|
|
2764
|
+
v
|
|
2765
|
+
],
|
|
2766
|
+
symbolSize: radiusFor(v),
|
|
2767
|
+
itemStyle: {
|
|
2768
|
+
color: bubbleColor ? resolveStyle(row, bubbleColor) : palette.bubble,
|
|
2769
|
+
borderColor: resolveStyle(row, bubbleBorderColor),
|
|
2770
|
+
borderWidth: resolveStyle(row, bubbleBorderWidth)
|
|
2771
|
+
},
|
|
2772
|
+
datum: row
|
|
2773
|
+
};
|
|
2774
|
+
});
|
|
2775
|
+
return {
|
|
2776
|
+
backgroundColor: "transparent",
|
|
2777
|
+
animation: true,
|
|
2778
|
+
animationDuration: 500,
|
|
2779
|
+
animationDurationUpdate: 0,
|
|
2780
|
+
...shouldIncludeGeo ? { geo } : {},
|
|
2781
|
+
tooltip: showTooltip ? {
|
|
2782
|
+
trigger: "item",
|
|
2783
|
+
triggerOn: "mousemove",
|
|
2784
|
+
backgroundColor: "var(--color-kumo-base)",
|
|
2785
|
+
borderColor: "var(--color-kumo-line)",
|
|
2786
|
+
borderWidth: 1,
|
|
2787
|
+
padding: 8,
|
|
2788
|
+
textStyle: {
|
|
2789
|
+
color: "var(--text-color-kumo-default)",
|
|
2790
|
+
fontSize: 13
|
|
2791
|
+
},
|
|
2792
|
+
extraCssText: "border-radius: 0.5rem;",
|
|
2793
|
+
dangerousHtmlFormatter: (params) => {
|
|
2794
|
+
const p = params;
|
|
2795
|
+
const row = p.data?.datum;
|
|
2796
|
+
if (tooltipFormatter && row !== void 0) return tooltipFormatter(row);
|
|
2797
|
+
const v = p.value?.[2];
|
|
2798
|
+
return `<div style="display:flex;flex-direction:column;gap:2px;">${p.name ? `<strong>${escapeHtml(p.name)}</strong>` : ""}${v !== void 0 ? `<span style="color:var(--text-color-kumo-subtle)">${escapeHtml(valueFormat(v))}</span>` : ""}</div>`;
|
|
2799
|
+
}
|
|
2800
|
+
} : void 0,
|
|
2801
|
+
series: [{
|
|
2802
|
+
id: "bubbles",
|
|
2803
|
+
type: "scatter",
|
|
2804
|
+
coordinateSystem: "geo",
|
|
2805
|
+
data: points,
|
|
2806
|
+
itemStyle: { opacity: .8 },
|
|
2807
|
+
emphasis: {
|
|
2808
|
+
scale: 1.2,
|
|
2809
|
+
itemStyle: { opacity: 1 }
|
|
2810
|
+
},
|
|
2811
|
+
z: 3
|
|
2812
|
+
}]
|
|
2813
|
+
};
|
|
2814
|
+
}, [
|
|
2815
|
+
palette,
|
|
2816
|
+
geo,
|
|
2817
|
+
shouldIncludeGeo,
|
|
2818
|
+
data,
|
|
2819
|
+
lng,
|
|
2820
|
+
lat,
|
|
2821
|
+
value,
|
|
2822
|
+
name,
|
|
2823
|
+
minRadius,
|
|
2824
|
+
maxRadius,
|
|
2825
|
+
bubbleSize,
|
|
2826
|
+
bubbleColor,
|
|
2827
|
+
bubbleBorderColor,
|
|
2828
|
+
bubbleBorderWidth,
|
|
2829
|
+
showTooltip,
|
|
2830
|
+
tooltipFormatter,
|
|
2831
|
+
valueFormat
|
|
2832
|
+
]);
|
|
2833
|
+
const handleMouseOver = useCallback((params) => {
|
|
2834
|
+
const datum = params.data?.datum;
|
|
2835
|
+
if (datum !== void 0) hoverRef.current?.(datum);
|
|
2836
|
+
}, []);
|
|
2837
|
+
const handleMouseOut = useCallback(() => {
|
|
2838
|
+
hoverRef.current?.(void 0);
|
|
2839
|
+
}, []);
|
|
2840
|
+
const handleClick = useCallback((params) => {
|
|
2841
|
+
const datum = params.data?.datum;
|
|
2842
|
+
if (datum !== void 0) onBubbleClick?.(datum);
|
|
2843
|
+
}, [onBubbleClick]);
|
|
2844
|
+
return /* @__PURE__ */ jsx(Chart, {
|
|
2845
|
+
echarts: ec,
|
|
2846
|
+
ref: mergedRef,
|
|
2847
|
+
options,
|
|
2848
|
+
className,
|
|
2849
|
+
isDarkMode,
|
|
2850
|
+
height,
|
|
2851
|
+
aspectRatio: resolvedAspect,
|
|
2852
|
+
onEvents: useMemo(() => ({
|
|
2853
|
+
...onBubbleHover ? {
|
|
2854
|
+
mouseover: handleMouseOver,
|
|
2855
|
+
mouseout: handleMouseOut,
|
|
2856
|
+
globalout: handleMouseOut
|
|
2857
|
+
} : {},
|
|
2858
|
+
...onBubbleClick ? { click: handleClick } : {}
|
|
2859
|
+
}), [
|
|
2860
|
+
onBubbleHover,
|
|
2861
|
+
handleMouseOver,
|
|
2862
|
+
handleMouseOut,
|
|
2863
|
+
handleClick,
|
|
2864
|
+
onBubbleClick
|
|
2865
|
+
])
|
|
2866
|
+
});
|
|
2867
|
+
}
|
|
2868
|
+
const BubbleMap = forwardRef(BubbleMapRoot);
|
|
2869
|
+
BubbleMap.displayName = "BubbleMap";
|
|
2870
|
+
/**
|
|
2871
|
+
* ChoroplethMap — shades GeoJSON regions by value, joining data rows to features
|
|
2872
|
+
* by `name`/`nameProperty`. A continuous `visualMap` legend maps value → colour.
|
|
2873
|
+
* Regions without a matching row render in `noDataColor`. For skewed data, scale
|
|
2874
|
+
* the `value` in the parent (e.g. log) before passing it in.
|
|
2875
|
+
*
|
|
2876
|
+
* @example
|
|
2877
|
+
* ```tsx
|
|
2878
|
+
* import * as echarts from "echarts/core";
|
|
2879
|
+
* import { MapChart } from "echarts/charts";
|
|
2880
|
+
* import { VisualMapComponent, TooltipComponent } from "echarts/components";
|
|
2881
|
+
* import { CanvasRenderer } from "echarts/renderers";
|
|
2882
|
+
* echarts.use([MapChart, VisualMapComponent, TooltipComponent, CanvasRenderer]);
|
|
2883
|
+
*
|
|
2884
|
+
* <ChoroplethMap
|
|
2885
|
+
* echarts={echarts}
|
|
2886
|
+
* geoJson={world}
|
|
2887
|
+
* data={countries}
|
|
2888
|
+
* name="country" value="requests"
|
|
2889
|
+
* />
|
|
2890
|
+
* ```
|
|
2891
|
+
*/
|
|
2892
|
+
function ChoroplethMapRoot({ echarts: ec, geoJson, mapName: mapNameProp, data, name, value, nameProperty = "name", colorRange, min, max, noDataColor, showLegend = false, showTooltip = true, valueFormat = defaultValueFormat, tooltipFormatter, onRegionHover, onRegionClick, center, zoom = 1.25, roam = false, projection, aspectRatio, height, className, isDarkMode }, ref) {
|
|
2893
|
+
const mapName = useMemo(() => getMapName(geoJson, mapNameProp), [geoJson, mapNameProp]);
|
|
2894
|
+
useRegisterMap(ec, mapName, geoJson);
|
|
2895
|
+
const palette = useMemo(() => ChartPalette.mapColors(isDarkMode), [isDarkMode]);
|
|
2896
|
+
const centerX = center?.[0];
|
|
2897
|
+
const centerY = center?.[1];
|
|
2898
|
+
const view = useMemo(() => ({
|
|
2899
|
+
roam,
|
|
2900
|
+
...roam ? { scaleLimit: {
|
|
2901
|
+
min: Math.min(1, zoom),
|
|
2902
|
+
max: zoom * MAX_ZOOM_FACTOR
|
|
2903
|
+
} } : {},
|
|
2904
|
+
center: centerX !== void 0 && centerY !== void 0 ? [centerX, centerY] : void 0,
|
|
2905
|
+
zoom,
|
|
2906
|
+
boundingCoords: DEFAULT_BOUNDING_COORDS,
|
|
2907
|
+
...resolveProjection(projection) ? { projection: resolveProjection(projection) } : { aspectScale: 1 }
|
|
2908
|
+
}), [
|
|
2909
|
+
centerX,
|
|
2910
|
+
centerY,
|
|
2911
|
+
zoom,
|
|
2912
|
+
roam,
|
|
2913
|
+
isDarkMode,
|
|
2914
|
+
projection
|
|
2915
|
+
]);
|
|
2916
|
+
const resolvedAspect = useMemo(() => {
|
|
2917
|
+
if (height !== void 0) return void 0;
|
|
2918
|
+
return aspectRatio ?? projectedAspect(resolveProjection(projection), DEFAULT_BOUNDING_COORDS);
|
|
2919
|
+
}, [
|
|
2920
|
+
aspectRatio,
|
|
2921
|
+
height,
|
|
2922
|
+
projection
|
|
2923
|
+
]);
|
|
2924
|
+
const appliedViewRef = useRef(void 0);
|
|
2925
|
+
const shouldIncludeView = appliedViewRef.current !== view;
|
|
2926
|
+
useEffect(() => {
|
|
2927
|
+
appliedViewRef.current = view;
|
|
2928
|
+
}, [view]);
|
|
2929
|
+
const hoverRef = useRef(onRegionHover);
|
|
2930
|
+
hoverRef.current = onRegionHover;
|
|
2931
|
+
const mergedRef = useCallback((instance) => {
|
|
2932
|
+
if (typeof ref === "function") ref(instance);
|
|
2933
|
+
else if (ref) ref.current = instance;
|
|
2934
|
+
}, [ref]);
|
|
2935
|
+
const options = useMemo(() => {
|
|
2936
|
+
const colors = colorRange ?? palette.scale;
|
|
2937
|
+
const noData = noDataColor ?? palette.area;
|
|
2938
|
+
const regions = data.map((row) => ({
|
|
2939
|
+
name: resolve(row, name),
|
|
2940
|
+
value: resolve(row, value),
|
|
2941
|
+
datum: row
|
|
2942
|
+
}));
|
|
2943
|
+
const values = regions.map((r) => r.value);
|
|
2944
|
+
const vmin = values.length ? Math.min(...values) : 0;
|
|
2945
|
+
const vmax = values.length ? Math.max(...values) : 1;
|
|
2946
|
+
return {
|
|
2947
|
+
backgroundColor: "transparent",
|
|
2948
|
+
animation: true,
|
|
2949
|
+
animationDuration: 500,
|
|
2950
|
+
animationDurationUpdate: 0,
|
|
2951
|
+
visualMap: {
|
|
2952
|
+
type: "continuous",
|
|
2953
|
+
show: showLegend,
|
|
2954
|
+
min: min ?? vmin,
|
|
2955
|
+
max: max ?? (vmax > vmin ? vmax : vmin + 1),
|
|
2956
|
+
calculable: false,
|
|
2957
|
+
hoverLink: false,
|
|
2958
|
+
inRange: { color: colors },
|
|
2959
|
+
orient: "horizontal",
|
|
2960
|
+
text: ["High", "Low"],
|
|
2961
|
+
left: 0,
|
|
2962
|
+
bottom: 8,
|
|
2963
|
+
textStyle: {
|
|
2964
|
+
color: ChartPalette.text("primary", isDarkMode),
|
|
2965
|
+
fontSize: 11
|
|
2966
|
+
}
|
|
2967
|
+
},
|
|
2968
|
+
tooltip: showTooltip ? {
|
|
2969
|
+
trigger: "item",
|
|
2970
|
+
triggerOn: "mousemove",
|
|
2971
|
+
backgroundColor: "var(--color-kumo-base)",
|
|
2972
|
+
borderColor: "var(--color-kumo-line)",
|
|
2973
|
+
borderWidth: 1,
|
|
2974
|
+
padding: 8,
|
|
2975
|
+
textStyle: {
|
|
2976
|
+
color: "var(--text-color-kumo-default)",
|
|
2977
|
+
fontSize: 13
|
|
2978
|
+
},
|
|
2979
|
+
extraCssText: "border-radius: 0.5rem;",
|
|
2980
|
+
dangerousHtmlFormatter: (params) => {
|
|
2981
|
+
const p = params;
|
|
2982
|
+
const row = p.data?.datum;
|
|
2983
|
+
if (row === void 0) return "";
|
|
2984
|
+
if (tooltipFormatter) return tooltipFormatter(row);
|
|
2985
|
+
const v = typeof p.value === "number" && !Number.isNaN(p.value) ? p.value : void 0;
|
|
2986
|
+
return `<div style="display:flex;flex-direction:column;gap:2px;">${p.name ? `<strong>${escapeHtml(p.name)}</strong>` : ""}${v !== void 0 ? `<span style="color:var(--text-color-kumo-subtle)">${escapeHtml(valueFormat(v))}</span>` : ""}</div>`;
|
|
2987
|
+
}
|
|
2988
|
+
} : void 0,
|
|
2989
|
+
series: [{
|
|
2990
|
+
id: "regions",
|
|
2991
|
+
type: "map",
|
|
2992
|
+
map: mapName,
|
|
2993
|
+
nameProperty,
|
|
2994
|
+
...shouldIncludeView ? view : {},
|
|
2995
|
+
data: regions,
|
|
2996
|
+
itemStyle: {
|
|
2997
|
+
areaColor: noData,
|
|
2998
|
+
borderColor: "transparent",
|
|
2999
|
+
borderWidth: 0
|
|
3000
|
+
},
|
|
3001
|
+
label: { show: false },
|
|
3002
|
+
emphasis: {
|
|
3003
|
+
focus: "self",
|
|
3004
|
+
label: { show: false },
|
|
3005
|
+
itemStyle: { areaColor: "inherit" }
|
|
3006
|
+
},
|
|
3007
|
+
blur: {
|
|
3008
|
+
label: { show: false },
|
|
3009
|
+
itemStyle: { opacity: .45 }
|
|
3010
|
+
},
|
|
3011
|
+
select: { disabled: true },
|
|
3012
|
+
z: 1
|
|
3013
|
+
}]
|
|
3014
|
+
};
|
|
3015
|
+
}, [
|
|
3016
|
+
isDarkMode,
|
|
3017
|
+
palette,
|
|
3018
|
+
geoJson,
|
|
3019
|
+
mapName,
|
|
3020
|
+
view,
|
|
3021
|
+
shouldIncludeView,
|
|
3022
|
+
data,
|
|
3023
|
+
name,
|
|
3024
|
+
value,
|
|
3025
|
+
nameProperty,
|
|
3026
|
+
colorRange,
|
|
3027
|
+
min,
|
|
3028
|
+
max,
|
|
3029
|
+
noDataColor,
|
|
3030
|
+
showLegend,
|
|
3031
|
+
showTooltip,
|
|
3032
|
+
tooltipFormatter,
|
|
3033
|
+
valueFormat
|
|
3034
|
+
]);
|
|
3035
|
+
const handleMouseOver = useCallback((params) => {
|
|
3036
|
+
const datum = params.data?.datum;
|
|
3037
|
+
if (datum !== void 0) hoverRef.current?.(datum);
|
|
3038
|
+
}, []);
|
|
3039
|
+
const handleMouseOut = useCallback(() => {
|
|
3040
|
+
hoverRef.current?.(void 0);
|
|
3041
|
+
}, []);
|
|
3042
|
+
const handleClick = useCallback((params) => {
|
|
3043
|
+
const datum = params.data?.datum;
|
|
3044
|
+
if (datum !== void 0) onRegionClick?.(datum);
|
|
3045
|
+
}, [onRegionClick]);
|
|
3046
|
+
return /* @__PURE__ */ jsx(Chart, {
|
|
3047
|
+
echarts: ec,
|
|
3048
|
+
ref: mergedRef,
|
|
3049
|
+
options,
|
|
3050
|
+
className,
|
|
3051
|
+
isDarkMode,
|
|
3052
|
+
height,
|
|
3053
|
+
aspectRatio: resolvedAspect,
|
|
3054
|
+
onEvents: useMemo(() => ({
|
|
3055
|
+
...onRegionHover ? {
|
|
3056
|
+
mouseover: handleMouseOver,
|
|
3057
|
+
mouseout: handleMouseOut,
|
|
3058
|
+
globalout: handleMouseOut
|
|
3059
|
+
} : {},
|
|
3060
|
+
...onRegionClick ? { click: handleClick } : {}
|
|
3061
|
+
}), [
|
|
3062
|
+
onRegionHover,
|
|
3063
|
+
handleMouseOver,
|
|
3064
|
+
handleMouseOut,
|
|
3065
|
+
handleClick,
|
|
3066
|
+
onRegionClick
|
|
3067
|
+
])
|
|
3068
|
+
});
|
|
3069
|
+
}
|
|
3070
|
+
const ChoroplethMap = forwardRef(ChoroplethMapRoot);
|
|
3071
|
+
ChoroplethMap.displayName = "ChoroplethMap";
|
|
3072
|
+
/** Register the GeoJSON with ECharts before the child Chart's setOption runs. */
|
|
3073
|
+
function useRegisterMap(ec, mapName, geoJson) {
|
|
3074
|
+
useLayoutEffect(() => {
|
|
3075
|
+
ec.registerMap(mapName, geoJson);
|
|
3076
|
+
}, [
|
|
3077
|
+
ec,
|
|
3078
|
+
mapName,
|
|
3079
|
+
geoJson
|
|
3080
|
+
]);
|
|
3081
|
+
}
|
|
3082
|
+
//#endregion
|
|
3083
|
+
export { TimeseriesChart as a, ChartLegend as i, ChoroplethMap as n, Chart as o, SankeyChart as r, ChartPalette as s, BubbleMap as t };
|