@fldr/ui 0.0.0-stage → 0.3.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 +2366 -0
- package/LICENSE +21 -0
- package/README.md +488 -2
- package/ai/USAGE.md +216 -0
- package/ai/component-registry.json +8694 -0
- package/ai/component-registry.md +11933 -0
- package/ai/schemas.ts +1239 -0
- package/bin/kumo.js +36 -0
- package/dist/.build-complete +1 -0
- package/dist/ai/schemas.d.ts +3229 -0
- package/dist/ai/schemas.js +5963 -0
- package/dist/blocks-source/delete-resource/delete-resource.test.tsx +21 -0
- package/dist/blocks-source/delete-resource/delete-resource.tsx +219 -0
- package/dist/blocks-source/page-header/page-header.tsx +99 -0
- package/dist/blocks-source/resource-list/resource-list.test.tsx +28 -0
- package/dist/blocks-source/resource-list/resource-list.tsx +66 -0
- package/dist/button-DzavLWXm.d.ts +227 -0
- package/dist/catalog.d.ts +380 -0
- package/dist/catalog.js +387 -0
- package/dist/chunks/AccordionPanelDataAttributes-mmrmkky28u1010l5.js +457 -0
- package/dist/chunks/AlertDialogTrigger-l1r1gbxcky1xq889.js +24 -0
- package/dist/chunks/AlertDialogTriggerDataAttributes-go49qon601catpgn.js +56 -0
- package/dist/chunks/AutocompleteItem-36ysm5nwbsd0snr6.js +70 -0
- package/dist/chunks/AutocompleteItemDataAttributes-n5rigpf0s9ylnwi3.js +232 -0
- package/dist/chunks/AutocompleteSeparator-bnqeqh7i983d92gx.js +12 -0
- package/dist/chunks/AvatarImageDataAttributes-jw70u384c83lhqfp.js +247 -0
- package/dist/chunks/ButtonDataAttributes-nceand1fi7lvnmkb.js +35 -0
- package/dist/chunks/CSPContext-iv67i0qqhihg8mur.js +11 -0
- package/dist/chunks/CSPProvider-finau3a8hnc9o2td.js +24 -0
- package/dist/chunks/CheckboxGroup-581mfftu99wvjb3a.js +190 -0
- package/dist/chunks/CheckboxGroupContext-jf1bt3znvqlhrql6.js +10 -0
- package/dist/chunks/CheckboxGroupDataAttributes-nskqcxts64symbvf.js +10 -0
- package/dist/chunks/CheckboxIndicator-i13dmhacfgqo328c.js +414 -0
- package/dist/chunks/CheckboxIndicatorDataAttributes-3p29ju7nkczz1l2y.js +85 -0
- package/dist/chunks/CollapsiblePanel-md5suzmtnsyz1kab.js +178 -0
- package/dist/chunks/CollapsibleRootDataAttributes-bynmgxmt4jikaoha.js +36 -0
- package/dist/chunks/ComboboxClear-ioejwvtnmqanph88.js +294 -0
- package/dist/chunks/ComboboxClearDataAttributes-lo0enstdmrqpywsy.js +402 -0
- package/dist/chunks/ComboboxEmpty-gkt1y5b81a4983v7.js +1950 -0
- package/dist/chunks/ComboboxItemIndicatorDataAttributes-iku7l9ig0ve09an4.js +259 -0
- package/dist/chunks/ComboboxPopup-n8cbgys9st446j1i.js +205 -0
- package/dist/chunks/CompositeItem-kepwg8jtvgap06o6.js +20 -0
- package/dist/chunks/CompositeList-gwuaf6d14s4da0j0.js +182 -0
- package/dist/chunks/CompositeListContext-bejvmlu39hsfjzgu.js +15 -0
- package/dist/chunks/CompositeRoot-dnlkb27uw4g5aocf.js +223 -0
- package/dist/chunks/CompositeRootContext-obm54j7y6s86qwhq.js +12 -0
- package/dist/chunks/ContextMenuTriggerDataAttributes-xwozccynxv6pk5s0.js +237 -0
- package/dist/chunks/DialogBackdropDataAttributes-jwqxd6jla03xh8ke.js +28 -0
- package/dist/chunks/DialogCloseDataAttributes-12m7gwh3i6fd7d05.js +76 -0
- package/dist/chunks/DialogPopup-n6w7b389e7bs0472.js +133 -0
- package/dist/chunks/DialogRoot-hkkqj7vcjpkx8qk8.js +16 -0
- package/dist/chunks/DialogTrigger-kpugfkbfswqrus4u.js +142 -0
- package/dist/chunks/DialogTriggerDataAttributes-bp9bu13cvwuddh5b.js +18 -0
- package/dist/chunks/DialogViewportDataAttributes-mma9emv1edsc1vuy.js +78 -0
- package/dist/chunks/DirectionContext-kpby968j030psajn.js +10 -0
- package/dist/chunks/DirectionProvider-cg0pwzgdyg6r73r6.js +21 -0
- package/dist/chunks/DrawerViewport-mzqpwvqtylnad8ib.js +1532 -0
- package/dist/chunks/DrawerViewportDataAttributes-dd9593zm9fl9vcsm.js +1072 -0
- package/dist/chunks/FieldControl-hjj2tcqruozadgdi.js +122 -0
- package/dist/chunks/FieldDescription-orix2gepowrp5ni4.js +122 -0
- package/dist/chunks/FieldItemContext-ohsf45im6xhpay40.js +10 -0
- package/dist/chunks/FieldItemDataAttributes-m52srx69pispz49i.js +283 -0
- package/dist/chunks/FieldLabel-fjc7tdis7rcbq8o4.js +353 -0
- package/dist/chunks/FieldsetLegend-gl9z9eezr0xg9zr7.js +61 -0
- package/dist/chunks/FieldsetLegendDataAttributes-fn20251jxjqkpkxm.js +17 -0
- package/dist/chunks/FieldsetRootContext-fphwizvcm55ydg94.js +12 -0
- package/dist/chunks/FloatingPortalLite-j7dsy7gokbxdoe1i.js +25 -0
- package/dist/chunks/FloatingRootStore-men6ufp3a2b296fh.js +840 -0
- package/dist/chunks/FloatingTree-kiyzavvaum442o1s.js +115 -0
- package/dist/chunks/Form-oz425k7r4abea8o4.js +113 -0
- package/dist/chunks/FormContext-jv19engyccpf6xcl.js +18 -0
- package/dist/chunks/Input-ozudotydd679ly63.js +20 -0
- package/dist/chunks/InputDataAttributes-oy8t6q5y5t8ik02j.js +42 -0
- package/dist/chunks/ItemIndicator-cvf8cw5fv5l3cd8j.js +37 -0
- package/dist/chunks/LabelableContext-dz4wz3lu3lgqusu7.js +135 -0
- package/dist/chunks/ListboxSeparator-skazx18vzzj7i9zp.js +21 -0
- package/dist/chunks/MenuClearDataAttributes-fo0pekd36n56mdxu.js +1645 -0
- package/dist/chunks/MenuSubmenuTrigger-hm5xbgik6aq95x35.js +1976 -0
- package/dist/chunks/MenuSubmenuTriggerDataAttributes-gdfxdjymgmnaxdds.js +372 -0
- package/dist/chunks/MenuTrigger-dlfvicsaggss0o9m.js +265 -0
- package/dist/chunks/Menubar-ja5int05ihjj0ra4.js +116 -0
- package/dist/chunks/MenubarContext-ooz0h08i55c8oip5.js +12 -0
- package/dist/chunks/MeterLabel-cykbkvqys5263z05.js +148 -0
- package/dist/chunks/NavigationMenuIconDataAttributes-l82pkpm61d0meqxf.js +1654 -0
- package/dist/chunks/NullStore-my62xo2vfcfkerri.js +110 -0
- package/dist/chunks/NumberFieldScrubAreaCursorDataAttributes-k2lsbk35svshnwf5.js +1493 -0
- package/dist/chunks/OTPFieldInputDataAttributes-gvgtu2gg85kgjzwr.js +683 -0
- package/dist/chunks/PopoverViewport-peh28i8q4hqfjy97.js +713 -0
- package/dist/chunks/PopoverViewportDataAttributes-gplhq9d7ffp9q8u3.js +329 -0
- package/dist/chunks/PrehydrationScript-hs2je3mndbxuts7w.js +78 -0
- package/dist/chunks/PreviewCardViewportDataAttributes-bgfwmyshey7fx6nr.js +914 -0
- package/dist/chunks/ProgressLabelDataAttributes-j8mutcz11ei0ohvj.js +287 -0
- package/dist/chunks/RadioGroup-kioqngmmuo7a1lfa.js +163 -0
- package/dist/chunks/RadioGroupContext-dr6uihsj7oky0eol.js +10 -0
- package/dist/chunks/RadioGroupDataAttributes-dpdr6xe4ve204qwb.js +10 -0
- package/dist/chunks/RadioIndicator-bhxqih8wzv7hyrec.js +299 -0
- package/dist/chunks/RadioIndicatorDataAttributes-n5yupp5psifu0d4f.js +80 -0
- package/dist/chunks/ScrollAreaThumb-hxig41yn4lrurd3o.js +928 -0
- package/dist/chunks/ScrollAreaThumbDataAttributes-gup5wfxvqye6jj27.js +137 -0
- package/dist/chunks/SelectScrollUpArrowDataAttributes-fce5i1afjkb0necr.js +473 -0
- package/dist/chunks/SelectSeparator-nnak70azojox8b2b.js +1632 -0
- package/dist/chunks/Separator-fhwve0tfny3tht3a.js +24 -0
- package/dist/chunks/SeparatorDataAttributes-ch6e63bas7zflw00.js +11 -0
- package/dist/chunks/SliderIndicator-h1o3qbrvr8x0t4t2.js +1171 -0
- package/dist/chunks/SliderIndicatorDataAttributes-ff2f1cjealif5nvo.js +240 -0
- package/dist/chunks/SwitchRoot-m4t2tq5zn5wibyxk.js +244 -0
- package/dist/chunks/SwitchThumbDataAttributes-f95ld864on9y6ptk.js +90 -0
- package/dist/chunks/TabsList-n5n93rxr4sy704u8.js +664 -0
- package/dist/chunks/TabsListDataAttributes-e03a7kbubuf02z1l.js +183 -0
- package/dist/chunks/ToastArrowDataAttributes-jbnvz3kp6a35slgj.js +136 -0
- package/dist/chunks/ToggleDataAttributes-jl9ojyvwgrvefke6.js +103 -0
- package/dist/chunks/ToggleGroupContext-hg8zbkgqpscqhz83.js +10 -0
- package/dist/chunks/ToggleGroupDataAttributes-n1dwona1alvabstl.js +102 -0
- package/dist/chunks/ToolbarGroupContext-eawva8xkxb4osbxb.js +10 -0
- package/dist/chunks/ToolbarInput-kyxl1be0p3cyuayp.js +174 -0
- package/dist/chunks/ToolbarInputDataAttributes-n4a18a4km735du04.js +150 -0
- package/dist/chunks/ToolbarRootContext-difqbj720teyt8lu.js +12 -0
- package/dist/chunks/TooltipPopup-furysmeyb68uycbz.js +839 -0
- package/dist/chunks/TooltipProvider-hyans0ens4axh1y8.js +61 -0
- package/dist/chunks/TooltipViewportDataAttributes-gkwbezdq40ssuevg.js +312 -0
- package/dist/chunks/adaptiveOriginMiddleware-m9tqzw58wya9sdds.js +51 -0
- package/dist/chunks/addEventListener-ku3x23446prmd1kz.js +13 -0
- package/dist/chunks/areArraysEqual-nnpg93s9g7aqcaoh.js +15 -0
- package/dist/chunks/autocomplete-gdd9aruremdgdvx7.js +152 -0
- package/dist/chunks/badge-gca8xfu79ne55d5k.js +165 -0
- package/dist/chunks/banner-mo1xl9ww734kgsqh.js +269 -0
- package/dist/chunks/breadcrumbs-z1jo40oxlw8e4eh4.js +159 -0
- package/dist/chunks/button-group-biv43ksvaipc3p5n.js +59 -0
- package/dist/chunks/button-hzvowfkbathmx8yg.js +274 -0
- package/dist/chunks/chart-dgh98nbzo2sux2bs.js +3985 -0
- package/dist/chunks/checkbox-eifiwbw34xwsikvf.js +211 -0
- package/dist/chunks/clamp-rcpupxvhqrn8uuyf.js +7 -0
- package/dist/chunks/clipboard-text-oukrnke1s3kebk3y.js +209 -0
- package/dist/chunks/cloudflare-logo-d8mid9xr190h78cu.js +186 -0
- package/dist/chunks/code-hp2x28uiufmk3elz.js +94 -0
- package/dist/chunks/collapsible-ic6813hc4yv5s5hv.js +185 -0
- package/dist/chunks/combobox-mzvobpvalz2gnpli.js +321 -0
- package/dist/chunks/command-palette-d45ueqbuxygu87ir.js +507 -0
- package/dist/chunks/composite-c11t1ok72s3cggjc.js +90 -0
- package/dist/chunks/constants-l10cgj6pyqg27jod.js +5 -0
- package/dist/chunks/createBaseUIEventDetails-nvee6bghv2reeqdb.js +50 -0
- package/dist/chunks/createItems-n07tfwx89cdoar18.js +323 -0
- package/dist/chunks/createToastManager-cxjmn4jx3ejh85fs.js +1225 -0
- package/dist/chunks/date-picker-ija2bz17ai6ypnao.js +6865 -0
- package/dist/chunks/date-range-picker-oivlshld01jbel29.js +336 -0
- package/dist/chunks/dialog-g7wavhkdv2gplwq9.js +173 -0
- package/dist/chunks/dropdown-m5a8nwer5hpvnkfk.js +384 -0
- package/dist/chunks/empty-e0onzpyokyl6h9bp.js +96 -0
- package/dist/chunks/engine-hzmefiqm63hu0c7i.js +10 -0
- package/dist/chunks/error-lbnic2b20qr3mukp.js +6 -0
- package/dist/chunks/field-fowmq5smvp17pnqe.js +75 -0
- package/dist/chunks/flow-fak0fyldoaozd32s.js +10290 -0
- package/dist/chunks/formatNumber-b4kjdsebslm2b3t0.js +21 -0
- package/dist/chunks/getCssDimensions-gckwdrp86f73cv51.js +21 -0
- package/dist/chunks/getElementTransform-cz3jyftv0x5io95f.js +38 -0
- package/dist/chunks/getFiniteAnimations-jwd833ybtz81j5f0.js +13 -0
- package/dist/chunks/getHighlightReason-fhc53kq6qakcct9s.js +15 -0
- package/dist/chunks/getPseudoElementBounds-csuw8kwsoeyxd5tv.js +37 -0
- package/dist/chunks/grid-nwiczrab3r4w0zr2.js +118 -0
- package/dist/chunks/highlighter-mouttug0tu8xg1i8.js +1364 -0
- package/dist/chunks/index.parts-db9pzsm9rrs9tp0t.js +200 -0
- package/dist/chunks/index.parts-ggacwr0yakuemead.js +24 -0
- package/dist/chunks/index.parts-pcg3pmf3yyro841t.js +13 -0
- package/dist/chunks/inertValue-n09gkjvwwa1kddov.js +9 -0
- package/dist/chunks/inline-copy-text-izxpvnrtebcqlquf.js +104 -0
- package/dist/chunks/input-group-h9fepskc84e1h11n.js +457 -0
- package/dist/chunks/input-kfi46426y22ocoo4.js +85 -0
- package/dist/chunks/input-m2tfec2viezoz9hh.js +146 -0
- package/dist/chunks/isElementDisabled-dyqutxpzdfppbohx.js +7 -0
- package/dist/chunks/itemEquality-ki3x4tzdhjlqjey6.js +56 -0
- package/dist/chunks/label-f18fnpbv85jddo4q.js +76 -0
- package/dist/chunks/layer-card-lsmeuqic9i1isv2b.js +74 -0
- package/dist/chunks/layer-dialog-ejtz9s7bbfhjk1md.js +414 -0
- package/dist/chunks/link-h84bkh8eem39p529.js +112 -0
- package/dist/chunks/link-provider-kbwllpbo24fvgioj.js +60 -0
- package/dist/chunks/loader-kv5nk8j8tsuesxqo.js +87 -0
- package/dist/chunks/locale-provider-j4ii538ntyok36r6.js +50 -0
- package/dist/chunks/menubar-gzlyhmmc4i24prn1.js +106 -0
- package/dist/chunks/mergeCleanups-nw73c6jfwl5tyhw4.js +15 -0
- package/dist/chunks/meter-poh8jpe0qtq6mvee.js +35 -0
- package/dist/chunks/pagination-lmogkvvtu19mnr7f.js +296 -0
- package/dist/chunks/popover-nqrt3ykqv6sic8pz.js +206 -0
- package/dist/chunks/popupHandle-dk3ixgc8flr7v971.js +177 -0
- package/dist/chunks/popupStoreUtils-czfnxn051xakask5.js +868 -0
- package/dist/chunks/portal-provider-eveknxf26oudn7pp.js +63 -0
- package/dist/chunks/radio-nf717i5ypsga9zdh.js +204 -0
- package/dist/chunks/reason-parts-hssx64rmlxyn6gw5.js +40 -0
- package/dist/chunks/resolve-variant-l6x5ksfrjtu4m66l.js +35 -0
- package/dist/chunks/resolveAriaLabelledBy-knaucrjrjwnk7tvs.js +10 -0
- package/dist/chunks/resolveValueLabel-ntacnb58mhka5gg0.js +70 -0
- package/dist/chunks/rolldown-runtime-hi7ti5xiuxsegr96.js +18 -0
- package/dist/chunks/safePolygon-ep4133qogeu5vjf3.js +661 -0
- package/dist/chunks/safeReact-ek77ilng4ekk7mgz.js +18 -0
- package/dist/chunks/scrollable-k784b35i80aolmvg.js +29 -0
- package/dist/chunks/select-lnekz415wm4v6d6m.js +279 -0
- package/dist/chunks/sensitive-input-dvwlnntm7rdudwp0.js +252 -0
- package/dist/chunks/serializeValue-d1otz2i7h5tygrwf.js +13 -0
- package/dist/chunks/sidebar-mhlgvpawixxoey2k.js +1466 -0
- package/dist/chunks/skeleton-line-kmhnp0lx3rxhioxa.js +74 -0
- package/dist/chunks/slider-e395gihi5cjd62ss.js +87 -0
- package/dist/chunks/stringifyLocale-gbxouqj7ol627jxh.js +9 -0
- package/dist/chunks/styles-eb8bvypmayf578jf.js +35 -0
- package/dist/chunks/surface-jr8x5hy0gucjk5ig.js +30 -0
- package/dist/chunks/switch-nc8thi7ogd51m3gi.js +202 -0
- package/dist/chunks/table-ngl1b5yc8mcur662.js +238 -0
- package/dist/chunks/table-of-contents-gkjv9ck8etbz64ej.js +234 -0
- package/dist/chunks/tabs-o59bv7348nh2gppm.js +280 -0
- package/dist/chunks/tag-input-lbx9yzt33d4wu07o.js +156 -0
- package/dist/chunks/text-nqum95flcp07ac9s.js +126 -0
- package/dist/chunks/toast-ljpenshot856xqq4.js +341 -0
- package/dist/chunks/toolbar-kh6pc12ii7b6dv1x.js +141 -0
- package/dist/chunks/tooltip-bcymn9bfyz29fvji.js +92 -0
- package/dist/chunks/unwrap-lazy-element-hzbdkmujhd7iksau.js +45 -0
- package/dist/chunks/use-copy-feedback-gl55ghst0csvpv4j.js +55 -0
- package/dist/chunks/useAnchoredPopupScrollLock-msm8tzkewysnunut.js +31 -0
- package/dist/chunks/useAnimationFrame-k9lqdj9quln3sd85.js +87 -0
- package/dist/chunks/useAriaLabelledBy-j3j9jqlr9ukyk08s.js +36 -0
- package/dist/chunks/useBaseUiId-nk4k7nj9h1cy76ny.js +13 -0
- package/dist/chunks/useButton-lklvdzuhvj22bx07.js +186 -0
- package/dist/chunks/useClick-pcbkcc7r620v1smu.js +87 -0
- package/dist/chunks/useCollapsiblePanel-lrfsgx21ds36cwlp.js +415 -0
- package/dist/chunks/useCompositeItem-2juex3zh9gyrs8e9.js +31 -0
- package/dist/chunks/useCompositeListItem-ekwo2j2rjkggg7xj.js +54 -0
- package/dist/chunks/useControlled-i3srnkxy598s0au9.js +52 -0
- package/dist/chunks/useFieldValidation-oe16jiigp971yrzr.js +224 -0
- package/dist/chunks/useFloatingRootContext-k676b6m7f80bdapd.js +51 -0
- package/dist/chunks/useFocus-mn7a9t9v6fnlb4mf.js +124 -0
- package/dist/chunks/useId-82z8yqlmc1hy1c5t.js +50 -0
- package/dist/chunks/useInitialLiveRegionTextMutation-nl2hus7zx1h7ggno.js +86 -0
- package/dist/chunks/useLabel-me6zzfvkypo458pi.js +58 -0
- package/dist/chunks/useLabelableId-bjeh6q3pgrqjb7er.js +56 -0
- package/dist/chunks/useListNavigation-hpddbd0cc9pvt461.js +441 -0
- package/dist/chunks/useOnMount-gxggz1m0n869s6r0.js +12 -0
- package/dist/chunks/useOpenChangeComplete-edtabjwqmechsyv6.js +129 -0
- package/dist/chunks/usePopupHandleStore-gawjmfjf1xdgiph3.js +27 -0
- package/dist/chunks/usePopupViewport-l6w01iohvzloghy8.js +367 -0
- package/dist/chunks/usePositioner-mzvgnazldqvy44z2.js +580 -0
- package/dist/chunks/usePressAndHold-k9ynk78pgf677kpx.js +179 -0
- package/dist/chunks/usePreviousValue-o6swt5tb7xhpdu4e.js +21 -0
- package/dist/chunks/useRegisterFieldControl-m1stc9l9y4cndf0k.js +40 -0
- package/dist/chunks/useRegisteredLabelId-b7u9ygya03448zzn.js +16 -0
- package/dist/chunks/useRender-h9ktka9xt4obdv6y.js +13 -0
- package/dist/chunks/useRenderDialogRoot-bsqrqpc1ddau7xg4.js +312 -0
- package/dist/chunks/useRenderElement-nkklxbq1rp7h2kw0.js +436 -0
- package/dist/chunks/useScrollLock-le7ajwlt7oh6fzxi.js +877 -0
- package/dist/chunks/useSetFieldFocused-fbvj7gcv67dqfkp0.js +35 -0
- package/dist/chunks/useStableCallback-le5qgj6p9l04729n.js +38 -0
- package/dist/chunks/useSwipeDismiss-e8tfxzlp05p86mgb.js +697 -0
- package/dist/chunks/useTimeout-f0ayn2l2l9aop4l8.js +43 -0
- package/dist/chunks/useTransitionStatus-disysoblzgk34w14.js +74 -0
- package/dist/chunks/useTriggerFocusGuards-dyd3hb1m8en8ct50.js +40 -0
- package/dist/chunks/useTriggerSwitchTransition-hk5j36hd5dq2ok6w.js +62 -0
- package/dist/chunks/useTypeahead-kfdsw1ksl5bgvvzl.js +111 -0
- package/dist/chunks/useValueAsRef-dv0tmfr1xlpzdlru.js +27 -0
- package/dist/chunks/useValueChanged-fjssa2v6d4w8y332.js +15 -0
- package/dist/chunks/utils-o44zfmzz9z7uyj1v.js +18 -0
- package/dist/chunks/valueToPercent-djk2mqnihth2uvf6.js +7 -0
- package/dist/chunks/vendor-floating-ui-fqblx3wa0r71mjoo.js +1458 -0
- package/dist/chunks/vendor-styling-gs32v7xt5znc8kg0.js +1167 -0
- package/dist/chunks/vendor-utils-io8z5lsfxq8m2dcc.js +660 -0
- package/dist/chunks/visuallyHidden-kzzs9hbe93is3rci.js +25 -0
- package/dist/code/server.d.ts +11 -0
- package/dist/code/server.js +18 -0
- package/dist/code.d.ts +65 -0
- package/dist/code.js +232 -0
- package/dist/command-line/cli.js +1705 -0
- package/dist/command-line/commands/add.js +282 -0
- package/dist/command-line/commands/ai.js +22 -0
- package/dist/command-line/commands/blocks.js +61 -0
- package/dist/command-line/commands/doc.js +167 -0
- package/dist/command-line/commands/init.js +95 -0
- package/dist/command-line/commands/ls.js +53 -0
- package/dist/command-line/commands/theme.js +850 -0
- package/dist/components/autocomplete.d.ts +2 -0
- package/dist/components/autocomplete.js +3 -0
- package/dist/components/badge.d.ts +2 -0
- package/dist/components/badge.js +3 -0
- package/dist/components/banner.d.ts +2 -0
- package/dist/components/banner.js +3 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +3 -0
- package/dist/components/button-group.d.ts +2 -0
- package/dist/components/button-group.js +3 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +3 -0
- package/dist/components/chart.d.ts +2 -0
- package/dist/components/chart.js +3 -0
- package/dist/components/checkbox.d.ts +2 -0
- package/dist/components/checkbox.js +3 -0
- package/dist/components/clipboard-text.d.ts +2 -0
- package/dist/components/clipboard-text.js +3 -0
- package/dist/components/cloudflare-logo.d.ts +2 -0
- package/dist/components/cloudflare-logo.js +3 -0
- package/dist/components/code.d.ts +2 -0
- package/dist/components/code.js +3 -0
- package/dist/components/collapsible.d.ts +2 -0
- package/dist/components/collapsible.js +3 -0
- package/dist/components/combobox.d.ts +2 -0
- package/dist/components/combobox.js +3 -0
- package/dist/components/command-palette.d.ts +2 -0
- package/dist/components/command-palette.js +3 -0
- package/dist/components/date-picker.d.ts +2 -0
- package/dist/components/date-picker.js +3 -0
- package/dist/components/date-range-picker.d.ts +2 -0
- package/dist/components/date-range-picker.js +3 -0
- package/dist/components/dialog.d.ts +2 -0
- package/dist/components/dialog.js +3 -0
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +3 -0
- package/dist/components/empty.d.ts +2 -0
- package/dist/components/empty.js +3 -0
- package/dist/components/field.d.ts +2 -0
- package/dist/components/field.js +3 -0
- package/dist/components/flow.d.ts +2 -0
- package/dist/components/flow.js +3 -0
- package/dist/components/grid.d.ts +2 -0
- package/dist/components/grid.js +3 -0
- package/dist/components/inline-copy-text.d.ts +2 -0
- package/dist/components/inline-copy-text.js +3 -0
- package/dist/components/input-group.d.ts +2 -0
- package/dist/components/input-group.js +3 -0
- package/dist/components/input.d.ts +4 -0
- package/dist/components/input.js +5 -0
- package/dist/components/label.d.ts +2 -0
- package/dist/components/label.js +3 -0
- package/dist/components/layer-card.d.ts +2 -0
- package/dist/components/layer-card.js +3 -0
- package/dist/components/layer-dialog.d.ts +2 -0
- package/dist/components/layer-dialog.js +3 -0
- package/dist/components/link.d.ts +67 -0
- package/dist/components/link.js +3 -0
- package/dist/components/loader.d.ts +2 -0
- package/dist/components/loader.js +4 -0
- package/dist/components/menubar.d.ts +2 -0
- package/dist/components/menubar.js +3 -0
- package/dist/components/meter.d.ts +2 -0
- package/dist/components/meter.js +3 -0
- package/dist/components/pagination.d.ts +2 -0
- package/dist/components/pagination.js +3 -0
- package/dist/components/popover.d.ts +2 -0
- package/dist/components/popover.js +3 -0
- package/dist/components/radio.d.ts +2 -0
- package/dist/components/radio.js +3 -0
- package/dist/components/select.d.ts +2 -0
- package/dist/components/select.js +3 -0
- package/dist/components/sensitive-input.d.ts +2 -0
- package/dist/components/sensitive-input.js +3 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +3 -0
- package/dist/components/slider.d.ts +2 -0
- package/dist/components/slider.js +3 -0
- package/dist/components/surface.d.ts +2 -0
- package/dist/components/surface.js +3 -0
- package/dist/components/switch.d.ts +2 -0
- package/dist/components/switch.js +3 -0
- package/dist/components/table-of-contents.d.ts +2 -0
- package/dist/components/table-of-contents.js +3 -0
- package/dist/components/table.d.ts +2 -0
- package/dist/components/table.js +3 -0
- package/dist/components/tabs.d.ts +2 -0
- package/dist/components/tabs.js +3 -0
- package/dist/components/tag-input.d.ts +2 -0
- package/dist/components/tag-input.js +3 -0
- package/dist/components/text.d.ts +2 -0
- package/dist/components/text.js +3 -0
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +4 -0
- package/dist/components/toolbar.d.ts +2 -0
- package/dist/components/toolbar.js +3 -0
- package/dist/components/tooltip.d.ts +2 -0
- package/dist/components/tooltip.js +3 -0
- package/dist/config-BKj6nyHa.d.ts +620 -0
- package/dist/field-DIjlHM8W.d.ts +91 -0
- package/dist/highlighter-BT3TakhJ.d.ts +13 -0
- package/dist/index-2jvVmJ8P.d.ts +46 -0
- package/dist/index-5PpauI_2.d.ts +85 -0
- package/dist/index-AMEc1MEg.d.ts +180 -0
- package/dist/index-AUC5xRcO.d.ts +236 -0
- package/dist/index-B7epkoHc.d.ts +72 -0
- package/dist/index-B9-RdY6D.d.ts +75 -0
- package/dist/index-BD-gTiEv.d.ts +71 -0
- package/dist/index-BK1tZgmP.d.ts +426 -0
- package/dist/index-BVgXnR1V.d.ts +137 -0
- package/dist/index-BW1HVU7T.d.ts +119 -0
- package/dist/index-BWe6haHU.d.ts +64 -0
- package/dist/index-BkTAB4wj.d.ts +673 -0
- package/dist/index-Bwhwpw_j.d.ts +189 -0
- package/dist/index-BzE0aNpx.d.ts +143 -0
- package/dist/index-C7RoG_CH.d.ts +57 -0
- package/dist/index-CE09bLNb.d.ts +72 -0
- package/dist/index-CJRe-8P-.d.ts +174 -0
- package/dist/index-CNL6VDYZ.d.ts +138 -0
- package/dist/index-CReGk3Dc.d.ts +91 -0
- package/dist/index-CU_lnxg7.d.ts +287 -0
- package/dist/index-CYoiniZ4.d.ts +135 -0
- package/dist/index-ClS-eFxE.d.ts +104 -0
- package/dist/index-CzIWigmH.d.ts +62 -0
- package/dist/index-CzTgKPh-.d.ts +105 -0
- package/dist/index-D2Gvly0i.d.ts +96 -0
- package/dist/index-DIV3riUd.d.ts +148 -0
- package/dist/index-DL1-uSuH.d.ts +1 -0
- package/dist/index-DYYiDxZs.d.ts +243 -0
- package/dist/index-DjSGDESy.d.ts +222 -0
- package/dist/index-Dmbgjww7.d.ts +157 -0
- package/dist/index-DwNMa4LN.d.ts +166 -0
- package/dist/index-Dx7hOWUc.d.ts +93 -0
- package/dist/index-DxOyYZaJ.d.ts +251 -0
- package/dist/index-NnHba-T1.d.ts +136 -0
- package/dist/index-RP_rt8vB.d.ts +140 -0
- package/dist/index-T1sSoiWG.d.ts +184 -0
- package/dist/index-aahL-0Zw.d.ts +60 -0
- package/dist/index-bBPKMepR.d.ts +73 -0
- package/dist/index-g-eFm1Bq.d.ts +877 -0
- package/dist/index-gYC6cQVO.d.ts +105 -0
- package/dist/index-lOWfpkxK.d.ts +118 -0
- package/dist/index-pjdgauIH.d.ts +170 -0
- package/dist/index-yK3Hayg_.d.ts +40 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +207 -0
- package/dist/input-BeWEb-jD.d.ts +122 -0
- package/dist/input-group-8gEtPiKw.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/locale-provider-CHMCQ0-J.d.ts +40 -0
- package/dist/panda.d.ts +25 -0
- package/dist/panda.js +32 -0
- package/dist/portal-provider-BAqPpq_a.d.ts +55 -0
- package/dist/primitives/accordion.d.ts +1 -0
- package/dist/primitives/accordion.js +3 -0
- package/dist/primitives/alert-dialog.d.ts +1 -0
- package/dist/primitives/alert-dialog.js +8 -0
- package/dist/primitives/autocomplete.d.ts +1 -0
- package/dist/primitives/autocomplete.js +6 -0
- package/dist/primitives/avatar.d.ts +1 -0
- package/dist/primitives/avatar.js +3 -0
- package/dist/primitives/button.d.ts +1 -0
- package/dist/primitives/button.js +3 -0
- package/dist/primitives/checkbox-group.d.ts +1 -0
- package/dist/primitives/checkbox-group.js +4 -0
- package/dist/primitives/checkbox.d.ts +1 -0
- package/dist/primitives/checkbox.js +4 -0
- package/dist/primitives/collapsible.d.ts +1 -0
- package/dist/primitives/collapsible.js +5 -0
- package/dist/primitives/combobox.d.ts +1 -0
- package/dist/primitives/combobox.js +6 -0
- package/dist/primitives/context-menu.d.ts +1 -0
- package/dist/primitives/context-menu.js +6 -0
- package/dist/primitives/csp-provider.d.ts +1 -0
- package/dist/primitives/csp-provider.js +3 -0
- package/dist/primitives/dialog.d.ts +1 -0
- package/dist/primitives/dialog.js +9 -0
- package/dist/primitives/direction-provider.d.ts +1 -0
- package/dist/primitives/direction-provider.js +4 -0
- package/dist/primitives/drawer.d.ts +1 -0
- package/dist/primitives/drawer.js +6 -0
- package/dist/primitives/field.d.ts +1 -0
- package/dist/primitives/field.js +4 -0
- package/dist/primitives/fieldset.d.ts +1 -0
- package/dist/primitives/fieldset.js +3 -0
- package/dist/primitives/form.d.ts +1 -0
- package/dist/primitives/form.js +3 -0
- package/dist/primitives/input.d.ts +1 -0
- package/dist/primitives/input.js +4 -0
- package/dist/primitives/menu.d.ts +1 -0
- package/dist/primitives/menu.js +6 -0
- package/dist/primitives/menubar.d.ts +1 -0
- package/dist/primitives/menubar.js +3 -0
- package/dist/primitives/meter.d.ts +1 -0
- package/dist/primitives/meter.js +3 -0
- package/dist/primitives/navigation-menu.d.ts +1 -0
- package/dist/primitives/navigation-menu.js +3 -0
- package/dist/primitives/number-field.d.ts +1 -0
- package/dist/primitives/number-field.js +3 -0
- package/dist/primitives/otp-field.d.ts +3 -0
- package/dist/primitives/otp-field.js +4 -0
- package/dist/primitives/popover.d.ts +1 -0
- package/dist/primitives/popover.js +3 -0
- package/dist/primitives/preview-card.d.ts +1 -0
- package/dist/primitives/preview-card.js +3 -0
- package/dist/primitives/progress.d.ts +1 -0
- package/dist/primitives/progress.js +3 -0
- package/dist/primitives/radio-group.d.ts +1 -0
- package/dist/primitives/radio-group.js +4 -0
- package/dist/primitives/radio.d.ts +1 -0
- package/dist/primitives/radio.js +4 -0
- package/dist/primitives/scroll-area.d.ts +1 -0
- package/dist/primitives/scroll-area.js +4 -0
- package/dist/primitives/select.d.ts +1 -0
- package/dist/primitives/select.js +5 -0
- package/dist/primitives/separator.d.ts +1 -0
- package/dist/primitives/separator.js +4 -0
- package/dist/primitives/slider.d.ts +1 -0
- package/dist/primitives/slider.js +4 -0
- package/dist/primitives/switch.d.ts +1 -0
- package/dist/primitives/switch.js +4 -0
- package/dist/primitives/tabs.d.ts +1 -0
- package/dist/primitives/tabs.js +4 -0
- package/dist/primitives/toast.d.ts +1 -0
- package/dist/primitives/toast.js +5 -0
- package/dist/primitives/toggle-group.d.ts +1 -0
- package/dist/primitives/toggle-group.js +3 -0
- package/dist/primitives/toggle.d.ts +1 -0
- package/dist/primitives/toggle.js +3 -0
- package/dist/primitives/toolbar.d.ts +1 -0
- package/dist/primitives/toolbar.js +3 -0
- package/dist/primitives/tooltip.d.ts +1 -0
- package/dist/primitives/tooltip.js +4 -0
- package/dist/primitives.d.ts +42 -0
- package/dist/primitives.js +71 -0
- package/dist/registry.d.ts +2 -0
- package/dist/registry.js +1 -0
- package/dist/scripts/theme-generator/config.d.ts +2 -0
- package/dist/scripts/theme-generator/config.js +487 -0
- package/dist/scripts/theme-generator/types.d.ts +2 -0
- package/dist/scripts/theme-generator/types.js +1 -0
- package/dist/styles/kumo-binding.css +491 -0
- package/dist/styles/kumo-standalone.css +2 -0
- package/dist/styles/kumo.css +135 -0
- package/dist/styles/theme-code.css +142 -0
- package/dist/styles/theme-fedramp.css +31 -0
- package/dist/styles/theme-fldr.css +481 -0
- package/dist/styles/theme-kumo.css +464 -0
- package/dist/text-CRRU2g-u.d.ts +183 -0
- package/dist/theming.d.ts +224 -0
- package/dist/theming.js +386 -0
- package/dist/tooltip-D_vhi1PN.d.ts +105 -0
- package/dist/types-CdzJnnIl.d.ts +193 -0
- package/dist/types-Cl4HuOrB.d.ts +84 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +7 -0
- package/package.json +481 -3
- package/scripts/component-registry/cache.ts +123 -0
- package/scripts/component-registry/discovery.ts +560 -0
- package/scripts/component-registry/example-cleanup.ts +168 -0
- package/scripts/component-registry/index.test.ts +1075 -0
- package/scripts/component-registry/index.ts +1065 -0
- package/scripts/component-registry/markdown-generator.ts +222 -0
- package/scripts/component-registry/metadata.ts +1030 -0
- package/scripts/component-registry/props-filter.ts +312 -0
- package/scripts/component-registry/schema-generator.ts +333 -0
- package/scripts/component-registry/sub-components.ts +393 -0
- package/scripts/component-registry/types.ts +158 -0
- package/scripts/component-registry/utils.ts +280 -0
- package/scripts/component-registry/variant-parser.ts +262 -0
- package/scripts/css-build.ts +107 -0
- package/scripts/format-generated.ts +12 -0
- package/scripts/generate-globe-land-mask.mjs +80 -0
- package/scripts/generate-primitives.ts +196 -0
- package/scripts/publish-fldr.ts +120 -0
- package/scripts/theme-generator/config.ts +666 -0
- package/scripts/theme-generator/generate-css.test.ts +30 -0
- package/scripts/theme-generator/generate-css.ts +352 -0
- package/scripts/theme-generator/index.ts +175 -0
- package/scripts/theme-generator/migrate.ts +560 -0
- package/scripts/theme-generator/types.ts +92 -0
|
@@ -0,0 +1,1364 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/internal/render.js
|
|
3
|
+
function renderTokenOutput(tokens, options, renderer) {
|
|
4
|
+
const rangeDecorations = [];
|
|
5
|
+
const lineDecorations = [];
|
|
6
|
+
for (const decoration of options.decorations || []) {
|
|
7
|
+
if (!decoration.range) {
|
|
8
|
+
lineDecorations.push(decoration);
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const [start, end] = decoration.range;
|
|
12
|
+
if (hasIntegerOffsets(start, end) && start < end) rangeDecorations.push(decoration);
|
|
13
|
+
}
|
|
14
|
+
const cursor = {
|
|
15
|
+
index: 0,
|
|
16
|
+
offset: 0,
|
|
17
|
+
boundaries: [0, 0]
|
|
18
|
+
};
|
|
19
|
+
if (!options.lineNumbers && !lineDecorations.length) return renderTokenSlice(tokens, 0, Infinity, rangeDecorations, cursor, renderer);
|
|
20
|
+
const code = tokens.map((token) => token.value).join("");
|
|
21
|
+
const nodes = [];
|
|
22
|
+
let start = 0;
|
|
23
|
+
for (let line = 1;; line++) {
|
|
24
|
+
const newline = code.indexOf("\n", start);
|
|
25
|
+
const end = newline < 0 ? code.length : newline;
|
|
26
|
+
const active = lineDecorations.filter((decoration) => includesLine(decoration.lines, line));
|
|
27
|
+
nodes.push(renderer.element(["th-line", ...active.flatMap((decoration) => splitClassNames(decoration.className))], lineData(active, line), renderTokenSlice(tokens, start, end, rangeDecorations, cursor, renderer)));
|
|
28
|
+
if (newline < 0) break;
|
|
29
|
+
nodes.push(renderer.text("\n"));
|
|
30
|
+
start = end + 1;
|
|
31
|
+
if (start === code.length) break;
|
|
32
|
+
}
|
|
33
|
+
return nodes;
|
|
34
|
+
}
|
|
35
|
+
function renderTokenSlice(tokens, start, end, decorations, cursor, renderer) {
|
|
36
|
+
const nodes = [];
|
|
37
|
+
for (; cursor.index < tokens.length; cursor.index++) {
|
|
38
|
+
const token = tokens[cursor.index];
|
|
39
|
+
const tokenStart = cursor.offset;
|
|
40
|
+
const tokenEnd = tokenStart + token.value.length;
|
|
41
|
+
const sliceStart = Math.max(start, tokenStart);
|
|
42
|
+
const sliceEnd = Math.min(end, tokenEnd);
|
|
43
|
+
if (sliceStart < sliceEnd) {
|
|
44
|
+
let sorted = cursor.boundaries;
|
|
45
|
+
sorted[0] = sliceStart;
|
|
46
|
+
sorted[1] = sliceEnd;
|
|
47
|
+
let boundaries;
|
|
48
|
+
for (const decoration of decorations) {
|
|
49
|
+
const [decorationStart, decorationEnd] = decoration.range;
|
|
50
|
+
if (decorationEnd <= sliceStart || decorationStart >= sliceEnd) continue;
|
|
51
|
+
boundaries ||= new Set(sorted);
|
|
52
|
+
boundaries.add(Math.max(sliceStart, decorationStart)).add(Math.min(sliceEnd, decorationEnd));
|
|
53
|
+
}
|
|
54
|
+
if (boundaries) sorted = [...boundaries].sort((a, b) => a - b);
|
|
55
|
+
for (let index = 0; index < sorted.length - 1; index++) {
|
|
56
|
+
const segmentStart = sorted[index];
|
|
57
|
+
const segmentEnd = sorted[index + 1];
|
|
58
|
+
let node = renderer.text(token.value.slice(segmentStart - tokenStart, segmentEnd - tokenStart));
|
|
59
|
+
if (token.className) node = renderer.token(token.className, node);
|
|
60
|
+
for (const decoration of decorations) {
|
|
61
|
+
if (decoration.range[0] > segmentStart || decoration.range[1] < segmentEnd) continue;
|
|
62
|
+
node = renderer.element(["th-decoration", ...splitClassNames(decoration.className)], stringifyData(decoration.data), [node]);
|
|
63
|
+
}
|
|
64
|
+
nodes.push(node);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (tokenEnd > end) break;
|
|
68
|
+
cursor.offset = tokenEnd;
|
|
69
|
+
}
|
|
70
|
+
return nodes;
|
|
71
|
+
}
|
|
72
|
+
function includesLine(lines, line) {
|
|
73
|
+
return typeof lines === "number" ? lines === line : line >= lines[0] && line <= lines[1];
|
|
74
|
+
}
|
|
75
|
+
function lineData(decorations, line) {
|
|
76
|
+
const data = Object.fromEntries(decorations.flatMap((decoration) => dataEntries(decoration.data)));
|
|
77
|
+
data.line = String(line);
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
80
|
+
function stringifyData(data) {
|
|
81
|
+
if (data) return Object.fromEntries(dataEntries(data));
|
|
82
|
+
}
|
|
83
|
+
function dataEntries(data) {
|
|
84
|
+
return Object.entries(data || {}).map(([key, value]) => [normalizeDataKey(key), String(value)]);
|
|
85
|
+
}
|
|
86
|
+
function normalizeDataKey(value) {
|
|
87
|
+
return value.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`).replace(/[^a-z0-9_.:-]/gi, "-");
|
|
88
|
+
}
|
|
89
|
+
function splitClassNames(className) {
|
|
90
|
+
return className?.match(/\S+/g) || [];
|
|
91
|
+
}
|
|
92
|
+
function hasIntegerOffsets(start, end) {
|
|
93
|
+
return Number.isInteger(start) && Number.isInteger(end);
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/core.js
|
|
97
|
+
function defineLanguage(definition) {
|
|
98
|
+
return definition;
|
|
99
|
+
}
|
|
100
|
+
function createHighlighter({ fallbackLanguage = "plaintext", languages }) {
|
|
101
|
+
const definitions = /* @__PURE__ */ new Map();
|
|
102
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
103
|
+
for (const definition of languages) {
|
|
104
|
+
const name = normalizeName(definition.name);
|
|
105
|
+
definitions.set(name, definition);
|
|
106
|
+
aliases.set(name, name);
|
|
107
|
+
for (const alias of definition.aliases || []) aliases.set(normalizeName(alias), name);
|
|
108
|
+
}
|
|
109
|
+
const fallback = normalizeName(fallbackLanguage);
|
|
110
|
+
function normalizeLanguage(lang) {
|
|
111
|
+
return aliases.get(normalizeName(lang || fallback)) || fallback;
|
|
112
|
+
}
|
|
113
|
+
function tokenizeRanges(code, lang, depth = 0) {
|
|
114
|
+
const definition = definitions.get(normalizeLanguage(lang));
|
|
115
|
+
if (!definition || depth > 24) return [];
|
|
116
|
+
return definition.tokenize(code, {
|
|
117
|
+
hasLanguage(candidate) {
|
|
118
|
+
const resolved = aliases.get(normalizeName(candidate));
|
|
119
|
+
return Boolean(resolved && definitions.has(resolved));
|
|
120
|
+
},
|
|
121
|
+
tokenize(embeddedCode, embeddedLanguage) {
|
|
122
|
+
return normalizeTokenRanges(embeddedCode.length, tokenizeRanges(embeddedCode, embeddedLanguage, depth + 1));
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function tokenize(code, options = {}) {
|
|
127
|
+
const lang = normalizeLanguage(options.lang);
|
|
128
|
+
const ranges = tokenizeRanges(code, lang);
|
|
129
|
+
return {
|
|
130
|
+
code,
|
|
131
|
+
lang,
|
|
132
|
+
tokens: normalizeTokenRanges(code.length, ranges, code)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function highlight(code, options = {}) {
|
|
136
|
+
const result = tokenize(code, options);
|
|
137
|
+
let innerHtml = "";
|
|
138
|
+
if (!options.lineNumbers && !options.decorations?.length) for (const token of result.tokens) {
|
|
139
|
+
const value = escapeHtml(token.value);
|
|
140
|
+
innerHtml += token.className ? renderHtmlToken(token.className, value) : value;
|
|
141
|
+
}
|
|
142
|
+
else innerHtml = renderTokenOutput(result.tokens, options, htmlRenderer).join("");
|
|
143
|
+
return {
|
|
144
|
+
...result,
|
|
145
|
+
html: `<pre class="th-code th-code--${escapeHtml(result.lang)}${options.lineNumbers ? " th-code--line-numbers" : ""}" data-language="${escapeHtml(result.lang)}"><code>${innerHtml}</code></pre>`
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function renderCodeBlockData({ code, decorations, lang, lineNumbers, title }) {
|
|
149
|
+
const copyText = code.trimEnd();
|
|
150
|
+
const result = highlight(copyText, {
|
|
151
|
+
decorations,
|
|
152
|
+
lang,
|
|
153
|
+
lineNumbers
|
|
154
|
+
});
|
|
155
|
+
return {
|
|
156
|
+
copyText,
|
|
157
|
+
htmlMarkup: result.html,
|
|
158
|
+
lang: result.lang,
|
|
159
|
+
title,
|
|
160
|
+
tokens: result.tokens
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
highlight,
|
|
165
|
+
highlightToHtml(code, options = {}) {
|
|
166
|
+
return highlight(code, options).html;
|
|
167
|
+
},
|
|
168
|
+
listLanguages() {
|
|
169
|
+
return [...definitions.keys()];
|
|
170
|
+
},
|
|
171
|
+
normalizeLanguage,
|
|
172
|
+
renderCodeBlockData,
|
|
173
|
+
tokenize
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function renderHtmlToken(className, child) {
|
|
177
|
+
return `<span class="th-token th-${escapeHtml(className)}">${child}</span>`;
|
|
178
|
+
}
|
|
179
|
+
const htmlRenderer = {
|
|
180
|
+
text: escapeHtml,
|
|
181
|
+
token: renderHtmlToken,
|
|
182
|
+
element(classNames, attributes, children) {
|
|
183
|
+
const className = escapeHtml(classNames.join(" "));
|
|
184
|
+
let data = "";
|
|
185
|
+
if (attributes) for (const [key, value] of Object.entries(attributes)) data += ` data-${key}="${escapeHtml(value)}"`;
|
|
186
|
+
return `<span${className ? ` class="${className}"` : ""}${data}>${children.join("")}</span>`;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const htmlEscapes = {
|
|
190
|
+
"&": "&",
|
|
191
|
+
"<": "<",
|
|
192
|
+
">": ">",
|
|
193
|
+
"\"": """,
|
|
194
|
+
"'": "'"
|
|
195
|
+
};
|
|
196
|
+
function escapeHtml(value) {
|
|
197
|
+
return /[&<>"']/.test(value) ? value.replace(/[&<>"']/g, (character) => htmlEscapes[character]) : value;
|
|
198
|
+
}
|
|
199
|
+
function normalizeName(value) {
|
|
200
|
+
return value.trim().toLowerCase();
|
|
201
|
+
}
|
|
202
|
+
function normalizeTokenRanges(codeLength, input, code) {
|
|
203
|
+
const ranges = [];
|
|
204
|
+
let sorted = true;
|
|
205
|
+
let previousStart = 0;
|
|
206
|
+
for (const candidate of input) {
|
|
207
|
+
if (!hasIntegerOffsets(candidate.start, candidate.end)) continue;
|
|
208
|
+
const start = Math.max(0, candidate.start);
|
|
209
|
+
const end = Math.min(codeLength, candidate.end);
|
|
210
|
+
if (start >= end) continue;
|
|
211
|
+
if (start < previousStart) sorted = false;
|
|
212
|
+
previousStart = start;
|
|
213
|
+
ranges.push({
|
|
214
|
+
className: candidate.className,
|
|
215
|
+
start,
|
|
216
|
+
end
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
if (!sorted) ranges.sort((a, b) => a.start - b.start);
|
|
220
|
+
const result = [];
|
|
221
|
+
let end = 0;
|
|
222
|
+
for (const candidate of ranges) {
|
|
223
|
+
const { start, className } = candidate;
|
|
224
|
+
if (start < end) continue;
|
|
225
|
+
if (code !== void 0 && start > end) result.push({ value: code.slice(end, start) });
|
|
226
|
+
end = candidate.end;
|
|
227
|
+
result.push(code === void 0 ? candidate : {
|
|
228
|
+
className,
|
|
229
|
+
value: code.slice(start, end)
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
if (code !== void 0 && (end < codeLength || !result.length)) result.push({ value: code.slice(end) });
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/internal/patterns.js
|
|
237
|
+
function patternTokenizer(patterns) {
|
|
238
|
+
return (code) => collectPatternRanges(code, patterns);
|
|
239
|
+
}
|
|
240
|
+
function collectPatternRanges(code, patterns, initial = [], occupied = new Uint8Array(code.length), ranges = [...initial]) {
|
|
241
|
+
for (const range of initial) occupied.fill(1, range.start, range.end);
|
|
242
|
+
for (const pattern of patterns) {
|
|
243
|
+
if (typeof pattern === "function") {
|
|
244
|
+
for (const range of pattern(code)) addRange(ranges, occupied, range);
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
const regex = globalRegex(pattern[0]);
|
|
248
|
+
const className = pattern[1];
|
|
249
|
+
const group = pattern[2] || 0;
|
|
250
|
+
const previousLastIndex = regex.lastIndex;
|
|
251
|
+
regex.lastIndex = 0;
|
|
252
|
+
try {
|
|
253
|
+
let match;
|
|
254
|
+
while (match = regex.exec(code)) {
|
|
255
|
+
const value = match[group];
|
|
256
|
+
if (!value) {
|
|
257
|
+
if (!match[0]) regex.lastIndex++;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const offset = group ? match[0].length - value.length : 0;
|
|
261
|
+
const start = match.index + offset;
|
|
262
|
+
addRange(ranges, occupied, {
|
|
263
|
+
start,
|
|
264
|
+
end: start + value.length,
|
|
265
|
+
className: typeof className === "function" ? className(match) : className
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
} finally {
|
|
269
|
+
regex.lastIndex = previousLastIndex;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return ranges;
|
|
273
|
+
}
|
|
274
|
+
function offsetRanges(ranges, offset) {
|
|
275
|
+
return ranges.map((range) => ({
|
|
276
|
+
...range,
|
|
277
|
+
start: range.start + offset,
|
|
278
|
+
end: range.end + offset
|
|
279
|
+
}));
|
|
280
|
+
}
|
|
281
|
+
function addRange(ranges, occupied, range) {
|
|
282
|
+
if (range.start >= range.end || range.start < 0 || range.end > occupied.length || hasOverlap(occupied, range.start, range.end)) return false;
|
|
283
|
+
ranges.push(range);
|
|
284
|
+
occupied.fill(1, range.start, range.end);
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
function globalRegex(regex) {
|
|
288
|
+
return regex.global ? regex : new RegExp(regex.source, `${regex.flags}g`);
|
|
289
|
+
}
|
|
290
|
+
function hasOverlap(occupied, start, end) {
|
|
291
|
+
for (let index = start; index < end; index++) if (occupied[index]) return true;
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/css.js
|
|
296
|
+
const css = defineLanguage({
|
|
297
|
+
name: "css",
|
|
298
|
+
tokenize: patternTokenizer([
|
|
299
|
+
[/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g, (match) => match[0].startsWith("/*") ? "comment" : "string"],
|
|
300
|
+
[/--[A-Za-z0-9_-]+/g, "variable"],
|
|
301
|
+
[
|
|
302
|
+
/(^|[}\n])\s*([^@{}\n][^{}\n]*)(?=\s*\{)/g,
|
|
303
|
+
"selector",
|
|
304
|
+
2
|
|
305
|
+
],
|
|
306
|
+
[
|
|
307
|
+
/(?:^|[;{]\s*)([A-Za-z-]+)(?=\s*:)/gm,
|
|
308
|
+
"property",
|
|
309
|
+
1
|
|
310
|
+
],
|
|
311
|
+
[/\b[A-Za-z-]+(?=\()/g, "function"],
|
|
312
|
+
[/\b\d+(?:\.\d+)?(?:px|rem|em|%|s|ms|vh|vw|deg)?\b/g, "number"]
|
|
313
|
+
])
|
|
314
|
+
});
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/diff.js
|
|
317
|
+
const diff = defineLanguage({
|
|
318
|
+
name: "diff",
|
|
319
|
+
aliases: ["patch"],
|
|
320
|
+
tokenize: patternTokenizer([
|
|
321
|
+
[/^(?:@@|diff |index |--- |\+\+\+ ).*$/gm, "meta"],
|
|
322
|
+
[/^-.*$/gm, "deleted"],
|
|
323
|
+
[/^\+.*$/gm, "inserted"]
|
|
324
|
+
])
|
|
325
|
+
});
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/internal/simple-language.js
|
|
328
|
+
function simpleLanguage(options, wordPatterns = regexWordPatterns, owned = false) {
|
|
329
|
+
let pending = options;
|
|
330
|
+
let tokenize;
|
|
331
|
+
return defineLanguage({
|
|
332
|
+
name: options.name,
|
|
333
|
+
aliases: options.aliases,
|
|
334
|
+
tokenize(code) {
|
|
335
|
+
if (!tokenize) {
|
|
336
|
+
tokenize = createSimpleTokenizer(pending, wordPatterns, owned);
|
|
337
|
+
pending = void 0;
|
|
338
|
+
}
|
|
339
|
+
return tokenize(code);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function createSimpleTokenizer(options, wordPatterns = regexWordPatterns, owned = false) {
|
|
344
|
+
const flags = options.insensitive ? "gmi" : "gm";
|
|
345
|
+
const lexical = new RegExp(`(${options.comments.source})|(?:${options.strings.source})`, flags);
|
|
346
|
+
const runtime = owned ? { nestedComments: options.nestedComments } : options;
|
|
347
|
+
const collectLexicalRanges = function(code) {
|
|
348
|
+
const ranges = [];
|
|
349
|
+
const previousLastIndex = lexical.lastIndex;
|
|
350
|
+
try {
|
|
351
|
+
lexical.lastIndex = 0;
|
|
352
|
+
let match;
|
|
353
|
+
while (match = lexical.exec(code)) {
|
|
354
|
+
if (!match[0].length) {
|
|
355
|
+
lexical.lastIndex = match.index + 1;
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
let end = match.index + match[0].length;
|
|
359
|
+
if (match[1] !== void 0) for (const [open, close] of runtime.nestedComments || []) {
|
|
360
|
+
if (!code.startsWith(open, match.index)) continue;
|
|
361
|
+
let cursor = match.index + open.length;
|
|
362
|
+
let depth = 1;
|
|
363
|
+
while (depth && cursor < code.length) if (code.startsWith(open, cursor)) {
|
|
364
|
+
depth++;
|
|
365
|
+
cursor += open.length;
|
|
366
|
+
} else if (code.startsWith(close, cursor)) {
|
|
367
|
+
depth--;
|
|
368
|
+
cursor += close.length;
|
|
369
|
+
} else cursor++;
|
|
370
|
+
end = cursor;
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
lexical.lastIndex = end;
|
|
374
|
+
ranges.push({
|
|
375
|
+
start: match.index,
|
|
376
|
+
end,
|
|
377
|
+
className: match[1] !== void 0 ? "comment" : "string"
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
} finally {
|
|
381
|
+
lexical.lastIndex = previousLastIndex;
|
|
382
|
+
}
|
|
383
|
+
return ranges;
|
|
384
|
+
};
|
|
385
|
+
const patterns = [];
|
|
386
|
+
patterns.push(...options.beforeWords || []);
|
|
387
|
+
const wordCharacters = options.wordCharacters || "\\w$";
|
|
388
|
+
patterns.push(...wordPatterns(options, flags, wordCharacters));
|
|
389
|
+
patterns.push(...options.rules || []);
|
|
390
|
+
if (options.numbers !== false) patterns.push([options.numbers || new RegExp(String.raw`(?<![\w.])(?:0[xX][\da-fA-F]+|0[bB][01]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)${options.numberSuffix || ""}(?![\w.])`, "g"), "number"]);
|
|
391
|
+
return (code) => {
|
|
392
|
+
const ranges = collectLexicalRanges(code);
|
|
393
|
+
return collectPatternRanges(code, patterns, ranges, void 0, ranges);
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function wordCategories(options) {
|
|
397
|
+
return [
|
|
398
|
+
["keyword", options.keywords],
|
|
399
|
+
["literal", options.literals],
|
|
400
|
+
["type", options.types]
|
|
401
|
+
];
|
|
402
|
+
}
|
|
403
|
+
function regexWordPatterns(options, flags, wordCharacters) {
|
|
404
|
+
const patterns = [];
|
|
405
|
+
for (const [className, words] of [
|
|
406
|
+
["keyword", options.keywords],
|
|
407
|
+
["literal", options.literals],
|
|
408
|
+
["type", options.types]
|
|
409
|
+
]) if (words) patterns.push([new RegExp(`(?<![${wordCharacters}])(?:${words.split(/\s+/).map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})(?![${wordCharacters}])`, flags), className]);
|
|
410
|
+
return patterns;
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/internal/word-language.js
|
|
414
|
+
function compiledWordLanguage(options) {
|
|
415
|
+
return simpleLanguage(options, options.insensitive ? void 0 : mapWordPatterns, true);
|
|
416
|
+
}
|
|
417
|
+
function mapWordPatterns(options, flags, wordCharacters) {
|
|
418
|
+
const known = /* @__PURE__ */ new Set();
|
|
419
|
+
const classes = /* @__PURE__ */ new Map();
|
|
420
|
+
for (const [className, words] of wordCategories(options)) if (words) for (const word of words.split(/\s+/)) {
|
|
421
|
+
if (known.has(word)) continue;
|
|
422
|
+
known.add(word);
|
|
423
|
+
if (className !== "keyword") classes.set(word, className);
|
|
424
|
+
}
|
|
425
|
+
return [[new RegExp(`(?<![${wordCharacters}])(?:${[...known].map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})(?![${wordCharacters}])`, flags), (match) => classes.get(match[0]) || "keyword"]];
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/graphql.js
|
|
429
|
+
const graphql = /* @__PURE__ */ compiledWordLanguage({
|
|
430
|
+
name: "graphql",
|
|
431
|
+
aliases: ["gql"],
|
|
432
|
+
comments: /#[^\r\n]*/,
|
|
433
|
+
strings: /"""[\s\S]*?(?:"""|(?![\s\S]))|"(?:\\[\s\S]|[^"\\])*(?:"|(?![\s\S]))/,
|
|
434
|
+
keywords: "directive enum fragment input interface mutation on query scalar schema subscription type union",
|
|
435
|
+
literals: "false null true",
|
|
436
|
+
beforeWords: [[/\$[A-Za-z_]\w*/g, "variable"], [/@[A-Za-z_]\w*/g, "attr"]]
|
|
437
|
+
});
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/internal/markup.js
|
|
440
|
+
const rawTextClosing = {
|
|
441
|
+
script: /<\/script(?=[\s/>])/gi,
|
|
442
|
+
style: /<\/style(?=[\s/>])/gi
|
|
443
|
+
};
|
|
444
|
+
function collectMarkupRanges(code, context, mode = "html") {
|
|
445
|
+
const ranges = [];
|
|
446
|
+
const regions = [];
|
|
447
|
+
let index = 0;
|
|
448
|
+
let lastTagEnd;
|
|
449
|
+
while ((index = code.indexOf("<", index)) >= 0) {
|
|
450
|
+
if (code.startsWith("<!--", index)) {
|
|
451
|
+
const close = code.indexOf("-->", index + 4);
|
|
452
|
+
const end = close < 0 ? code.length : close + 3;
|
|
453
|
+
ranges.push({
|
|
454
|
+
start: index,
|
|
455
|
+
end,
|
|
456
|
+
className: "comment"
|
|
457
|
+
});
|
|
458
|
+
index = end;
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
if (mode === "ejs" && code.startsWith("<%", index)) {
|
|
462
|
+
const close = code.indexOf("%>", index + 2);
|
|
463
|
+
const end = close < 0 ? code.length : close;
|
|
464
|
+
regions.push({
|
|
465
|
+
start: index + 2,
|
|
466
|
+
end,
|
|
467
|
+
lang: "js"
|
|
468
|
+
});
|
|
469
|
+
index = close < 0 ? code.length : close + 2;
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
const closing = code[index + 1] === "/";
|
|
473
|
+
const nameStart = index + (closing ? 2 : 1);
|
|
474
|
+
const nameMatch = /^[A-Za-z][\w:.-]*/.exec(code.slice(nameStart));
|
|
475
|
+
if (!nameMatch) {
|
|
476
|
+
index++;
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
const tagEnd = findTagEnd(code, nameStart + nameMatch[0].length, lastTagEnd ??= code.lastIndexOf(">"));
|
|
480
|
+
if (tagEnd < 0) {
|
|
481
|
+
index++;
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
const tagName = nameMatch[0].toLowerCase();
|
|
485
|
+
ranges.push({
|
|
486
|
+
start: nameStart,
|
|
487
|
+
end: nameStart + nameMatch[0].length,
|
|
488
|
+
className: "tag"
|
|
489
|
+
});
|
|
490
|
+
if (!closing) collectAttributes(code, nameStart + nameMatch[0].length, tagEnd, ranges);
|
|
491
|
+
if (!closing && (tagName === "script" || tagName === "style")) {
|
|
492
|
+
const rawTextClose = rawTextClosing[tagName];
|
|
493
|
+
rawTextClose.lastIndex = tagEnd + 1;
|
|
494
|
+
const contentEnd = rawTextClose.exec(code)?.index ?? code.length;
|
|
495
|
+
const lang = getEmbeddedLanguage(tagName, code.slice(index, tagEnd + 1));
|
|
496
|
+
regions.push({
|
|
497
|
+
start: tagEnd + 1,
|
|
498
|
+
end: contentEnd,
|
|
499
|
+
lang
|
|
500
|
+
});
|
|
501
|
+
index = contentEnd;
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
index = tagEnd + 1;
|
|
505
|
+
}
|
|
506
|
+
if (mode === "vue") collectDelimitedRegions(code, "{{", "}}", "js", regions);
|
|
507
|
+
if (mode === "svelte") collectBraceRegions(code, regions);
|
|
508
|
+
for (const region of regions) {
|
|
509
|
+
if (region.start >= region.end || !context.hasLanguage(region.lang)) continue;
|
|
510
|
+
for (const range of offsetRanges(context.tokenize(code.slice(region.start, region.end), region.lang), region.start)) ranges.push(range);
|
|
511
|
+
}
|
|
512
|
+
return ranges;
|
|
513
|
+
}
|
|
514
|
+
function collectAttributes(code, start, end, ranges) {
|
|
515
|
+
const source = code.slice(start, end);
|
|
516
|
+
const attributes = /\s([:@A-Za-z_][\w:.-]*)(?=\s*(?:=|\/?>))/g;
|
|
517
|
+
let match;
|
|
518
|
+
while (match = attributes.exec(source)) {
|
|
519
|
+
const offset = match[0].indexOf(match[1]);
|
|
520
|
+
const attributeStart = start + match.index + offset;
|
|
521
|
+
ranges.push({
|
|
522
|
+
start: attributeStart,
|
|
523
|
+
end: attributeStart + match[1].length,
|
|
524
|
+
className: "attr"
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
let index = start;
|
|
528
|
+
while (index < end) {
|
|
529
|
+
const quote = code[index];
|
|
530
|
+
if (quote !== "\"" && quote !== "'") {
|
|
531
|
+
index++;
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
const close = findQuoteEnd(code, index, quote, end);
|
|
535
|
+
ranges.push({
|
|
536
|
+
start: index,
|
|
537
|
+
end: close,
|
|
538
|
+
className: "string"
|
|
539
|
+
});
|
|
540
|
+
index = close;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
function getEmbeddedLanguage(tag, openingTag) {
|
|
544
|
+
if (tag === "style") return "css";
|
|
545
|
+
const lang = /\blang\s*=\s*["']?([\w-]+)/i.exec(openingTag)?.[1];
|
|
546
|
+
return lang === "ts" || lang === "typescript" ? "ts" : "js";
|
|
547
|
+
}
|
|
548
|
+
function collectDelimitedRegions(code, open, close, lang, regions) {
|
|
549
|
+
let index = 0;
|
|
550
|
+
while ((index = code.indexOf(open, index)) >= 0) {
|
|
551
|
+
const end = code.indexOf(close, index + open.length);
|
|
552
|
+
if (end < 0) return;
|
|
553
|
+
regions.push({
|
|
554
|
+
start: index + open.length,
|
|
555
|
+
end,
|
|
556
|
+
lang
|
|
557
|
+
});
|
|
558
|
+
index = end + close.length;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function collectBraceRegions(code, regions) {
|
|
562
|
+
let index = 0;
|
|
563
|
+
while (index < code.length) {
|
|
564
|
+
if (code[index] !== "{" || code[index + 1] === "#") {
|
|
565
|
+
index++;
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
const end = code.indexOf("}", index + 1);
|
|
569
|
+
if (end < 0) return;
|
|
570
|
+
regions.push({
|
|
571
|
+
start: index + 1,
|
|
572
|
+
end,
|
|
573
|
+
lang: "js"
|
|
574
|
+
});
|
|
575
|
+
index = end + 1;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
function findTagEnd(code, start, lastTagEnd) {
|
|
579
|
+
if (start > lastTagEnd) return -1;
|
|
580
|
+
let index = start;
|
|
581
|
+
while (index < code.length) if (code[index] === "\"" || code[index] === "'") index = findQuoteEnd(code, index, code[index], code.length);
|
|
582
|
+
else if (code[index] === ">") return index;
|
|
583
|
+
else index++;
|
|
584
|
+
return -1;
|
|
585
|
+
}
|
|
586
|
+
function findQuoteEnd(code, start, quote, limit) {
|
|
587
|
+
let index = start + 1;
|
|
588
|
+
while (index < limit) if (code[index] === "\\") index += 2;
|
|
589
|
+
else if (code[index] === quote) return index + 1;
|
|
590
|
+
else index++;
|
|
591
|
+
return limit;
|
|
592
|
+
}
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/html.js
|
|
595
|
+
const html = defineLanguage({
|
|
596
|
+
name: "html",
|
|
597
|
+
aliases: [
|
|
598
|
+
"htm",
|
|
599
|
+
"xml",
|
|
600
|
+
"angular-html"
|
|
601
|
+
],
|
|
602
|
+
tokenize: (code, context) => collectMarkupRanges(code, context)
|
|
603
|
+
});
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/internal/script.js
|
|
606
|
+
const semanticPatterns = [
|
|
607
|
+
[
|
|
608
|
+
/(?<!\.)\.([A-Za-z_$][\w$]*)/g,
|
|
609
|
+
"property",
|
|
610
|
+
1
|
|
611
|
+
],
|
|
612
|
+
[/@[A-Za-z_$][\w$]*/g, "function"],
|
|
613
|
+
[new RegExp(`\\b(?:abstract|as|asserts|async|await|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|infer|instanceof|interface|is|keyof|let|module|namespace|new|of|override|package|private|protected|public|readonly|return|satisfies|set|static|super|switch|this|throw|try|type|typeof|using|var|while|with|yield)\\b`, "g"), "keyword"],
|
|
614
|
+
[/\b(?:false|null|true|undefined|NaN|Infinity)\b/g, "literal"],
|
|
615
|
+
[/\b(?:0x[\da-f](?:_?[\da-f])*n?|0b[01](?:_?[01])*n?|0o[0-7](?:_?[0-7])*n?|\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:e[+-]?\d(?:_?\d)*)?n?)\b/gi, "number"],
|
|
616
|
+
[
|
|
617
|
+
/\bfunction\s*\*?\s*([A-Za-z_$][\w$]*)/g,
|
|
618
|
+
"function",
|
|
619
|
+
1
|
|
620
|
+
],
|
|
621
|
+
[
|
|
622
|
+
/(^|[^.A-Za-z0-9_$])([A-Za-z_$][\w$]*)(?=\s*\()/g,
|
|
623
|
+
"function",
|
|
624
|
+
2
|
|
625
|
+
],
|
|
626
|
+
[/\b(?:Array|Record|Promise|Readonly|Set|Map|WeakMap|WeakSet|string|number|boolean|bigint|symbol|object|unknown|never|void|any|[A-Z][A-Za-z0-9_$]*)\b/g, "type"]
|
|
627
|
+
];
|
|
628
|
+
function collectScriptRanges(code, jsx = false, jsxAtLineStart = false) {
|
|
629
|
+
const jsxText = jsx ? new Uint8Array(code.length) : void 0;
|
|
630
|
+
const initial = [];
|
|
631
|
+
collectScriptInitialRanges(code, jsx, jsxAtLineStart, jsxText, initial);
|
|
632
|
+
return collectPatternRanges(code, semanticPatterns, initial, jsxText);
|
|
633
|
+
}
|
|
634
|
+
function collectScriptInitialRanges(code, jsx, jsxAtLineStart, jsxText, ranges, index = 0, limit = code.length, tagBody = false) {
|
|
635
|
+
const objectBraces = [];
|
|
636
|
+
const expressions = [];
|
|
637
|
+
let jsxDepth = 0;
|
|
638
|
+
while (index < limit) {
|
|
639
|
+
const expression = expressions.at(-1);
|
|
640
|
+
const inJsxText = jsxDepth > (expression || 0);
|
|
641
|
+
const character = code[index];
|
|
642
|
+
const next = code[index + 1];
|
|
643
|
+
if (inJsxText) {
|
|
644
|
+
if (character === "{") {
|
|
645
|
+
expressions.push(jsxDepth);
|
|
646
|
+
index++;
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
if (character !== "<") {
|
|
650
|
+
const start = index;
|
|
651
|
+
while (index < code.length && code[index] !== "<" && code[index] !== "{") index++;
|
|
652
|
+
jsxText.fill(1, start, index);
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (tagBody && !expressions.length && !jsxDepth && character === ">") return index;
|
|
657
|
+
if (character === "/" && next === "/") {
|
|
658
|
+
const end = findLineEnd(code, index + 2);
|
|
659
|
+
ranges.push({
|
|
660
|
+
start: index,
|
|
661
|
+
end,
|
|
662
|
+
className: "comment"
|
|
663
|
+
});
|
|
664
|
+
index = end;
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
if (character === "/" && next === "*") {
|
|
668
|
+
const close = code.indexOf("*/", index + 2);
|
|
669
|
+
const end = close < 0 ? code.length : close + 2;
|
|
670
|
+
ranges.push({
|
|
671
|
+
start: index,
|
|
672
|
+
end,
|
|
673
|
+
className: "comment"
|
|
674
|
+
});
|
|
675
|
+
index = end;
|
|
676
|
+
continue;
|
|
677
|
+
}
|
|
678
|
+
if (character === "'" || character === "\"") {
|
|
679
|
+
const end = findQuotedEnd(code, index, character, tagBody && !expressions.length);
|
|
680
|
+
ranges.push({
|
|
681
|
+
start: index,
|
|
682
|
+
end,
|
|
683
|
+
className: "string"
|
|
684
|
+
});
|
|
685
|
+
index = end;
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
if (character === "`") {
|
|
689
|
+
index = collectTemplateRanges(code, index, ranges, jsx, jsxAtLineStart);
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
if (character === "/" && !(jsx && code[index - 1] === "<") && isRegexStart(code, index)) {
|
|
693
|
+
const end = findRegexEnd(code, index);
|
|
694
|
+
if (end > index + 1) {
|
|
695
|
+
ranges.push({
|
|
696
|
+
start: index,
|
|
697
|
+
end,
|
|
698
|
+
className: "literal"
|
|
699
|
+
});
|
|
700
|
+
index = end;
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if (character === "{") {
|
|
705
|
+
const before = previousCodeIndex(code, index, ranges);
|
|
706
|
+
let wordStart = before;
|
|
707
|
+
while (wordStart >= 0 && /[\w$]/.test(code[wordStart])) wordStart--;
|
|
708
|
+
const word = code.slice(wordStart + 1, before + 1);
|
|
709
|
+
objectBraces.push("=(:,[".includes(code[before] || "\0") || /^(?:return|yield|const|let|var)$/.test(word));
|
|
710
|
+
} else if (character === "}") objectBraces.pop();
|
|
711
|
+
else if (objectBraces.at(-1) && /[A-Za-z_$]/.test(character)) {
|
|
712
|
+
let end = index + 1;
|
|
713
|
+
while (end < limit && /[\w$]/.test(code[end])) end++;
|
|
714
|
+
const before = previousCodeIndex(code, index, ranges);
|
|
715
|
+
if ("{,;".includes(code[before] || "\0")) {
|
|
716
|
+
if (code[end + (code.slice(end).match(/^(?:\s|\/\*[\s\S]*?\*\/|\/\/[^\n]*(?:\n|$))*/)?.[0].length || 0)] === ":") ranges.push({
|
|
717
|
+
start: index,
|
|
718
|
+
end,
|
|
719
|
+
className: "property"
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
index = end;
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
if (!jsx) {
|
|
726
|
+
index++;
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
if (!inJsxText && character === "{" && (expressions.length || tagBody)) {
|
|
730
|
+
expressions.push(expressions.length ? expression : jsxDepth);
|
|
731
|
+
index++;
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
if (!inJsxText && expressions.length && character === "}") {
|
|
735
|
+
expressions.pop();
|
|
736
|
+
index++;
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
if (character !== "<") {
|
|
740
|
+
index++;
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
if (code.startsWith("</>", index)) {
|
|
744
|
+
jsxDepth--;
|
|
745
|
+
index += 3;
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
if (code.startsWith("<>", index) && (inJsxText || isJsxStart(code, index, jsxAtLineStart))) {
|
|
749
|
+
jsxDepth++;
|
|
750
|
+
index += 2;
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
const closing = code[index + 1] === "/";
|
|
754
|
+
const nameStart = index + (closing ? 2 : 1);
|
|
755
|
+
const nameMatch = /^[A-Za-z][\w:.-]*/.exec(code.slice(nameStart));
|
|
756
|
+
if (!nameMatch || !closing && !inJsxText && !isJsxStart(code, index, jsxAtLineStart)) {
|
|
757
|
+
index++;
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
const end = collectScriptInitialRanges(code, true, jsxAtLineStart, jsxText, ranges, nameStart + nameMatch[0].length, limit, true);
|
|
761
|
+
if (end < 0 || isTypeParameter(code, index, end, closing)) {
|
|
762
|
+
index++;
|
|
763
|
+
continue;
|
|
764
|
+
}
|
|
765
|
+
ranges.push({
|
|
766
|
+
start: nameStart,
|
|
767
|
+
end: nameStart + nameMatch[0].length,
|
|
768
|
+
className: "tag"
|
|
769
|
+
});
|
|
770
|
+
if (!closing) collectJsxAttributes(code, nameStart + nameMatch[0].length, end, ranges);
|
|
771
|
+
const selfClosing = /\/\s*$/.test(code.slice(nameStart, end));
|
|
772
|
+
if (closing) jsxDepth--;
|
|
773
|
+
else if (!selfClosing) jsxDepth++;
|
|
774
|
+
index = end + 1;
|
|
775
|
+
}
|
|
776
|
+
return -1;
|
|
777
|
+
}
|
|
778
|
+
function collectTemplateRanges(code, start, ranges, jsx, jsxAtLineStart) {
|
|
779
|
+
let segmentStart = start;
|
|
780
|
+
let index = start + 1;
|
|
781
|
+
while (index < code.length) {
|
|
782
|
+
if (code[index] === "\\") {
|
|
783
|
+
index += 2;
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
if (code[index] === "`") {
|
|
787
|
+
ranges.push({
|
|
788
|
+
start: segmentStart,
|
|
789
|
+
end: index + 1,
|
|
790
|
+
className: "string"
|
|
791
|
+
});
|
|
792
|
+
return index + 1;
|
|
793
|
+
}
|
|
794
|
+
if (code[index] === "$" && code[index + 1] === "{") {
|
|
795
|
+
if (segmentStart < index) ranges.push({
|
|
796
|
+
start: segmentStart,
|
|
797
|
+
end: index,
|
|
798
|
+
className: "string"
|
|
799
|
+
});
|
|
800
|
+
ranges.push({
|
|
801
|
+
start: index,
|
|
802
|
+
end: index + 2,
|
|
803
|
+
className: "operator"
|
|
804
|
+
});
|
|
805
|
+
const end = findInterpolationEnd(code, index + 2);
|
|
806
|
+
const expressionEnd = end < 0 ? code.length : end;
|
|
807
|
+
const expression = code.slice(index + 2, expressionEnd);
|
|
808
|
+
for (const range of offsetRanges(collectScriptRanges(expression, jsx, jsxAtLineStart), index + 2)) ranges.push(range);
|
|
809
|
+
if (end < 0) return code.length;
|
|
810
|
+
ranges.push({
|
|
811
|
+
start: end,
|
|
812
|
+
end: end + 1,
|
|
813
|
+
className: "operator"
|
|
814
|
+
});
|
|
815
|
+
index = end + 1;
|
|
816
|
+
segmentStart = index;
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
index++;
|
|
820
|
+
}
|
|
821
|
+
if (segmentStart < code.length) ranges.push({
|
|
822
|
+
start: segmentStart,
|
|
823
|
+
end: code.length,
|
|
824
|
+
className: "string"
|
|
825
|
+
});
|
|
826
|
+
return code.length;
|
|
827
|
+
}
|
|
828
|
+
function findInterpolationEnd(code, start) {
|
|
829
|
+
let depth = 1;
|
|
830
|
+
let index = start;
|
|
831
|
+
while (index < code.length) {
|
|
832
|
+
const character = code[index];
|
|
833
|
+
const next = code[index + 1];
|
|
834
|
+
if (character === "'" || character === "\"") {
|
|
835
|
+
index = findQuotedEnd(code, index, character);
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
if (character === "`") {
|
|
839
|
+
index = skipTemplate(code, index);
|
|
840
|
+
continue;
|
|
841
|
+
}
|
|
842
|
+
if (character === "/" && next === "/") {
|
|
843
|
+
index = findLineEnd(code, index + 2);
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
if (character === "/" && next === "*") {
|
|
847
|
+
const close = code.indexOf("*/", index + 2);
|
|
848
|
+
index = close < 0 ? code.length : close + 2;
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
if (character === "/" && isRegexStart(code, index)) {
|
|
852
|
+
index = findRegexEnd(code, index);
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
if (character === "{") depth++;
|
|
856
|
+
if (character === "}" && --depth === 0) return index;
|
|
857
|
+
index++;
|
|
858
|
+
}
|
|
859
|
+
return -1;
|
|
860
|
+
}
|
|
861
|
+
function skipTemplate(code, start) {
|
|
862
|
+
let index = start + 1;
|
|
863
|
+
while (index < code.length) if (code[index] === "\\") index += 2;
|
|
864
|
+
else if (code[index] === "`") return index + 1;
|
|
865
|
+
else if (code[index] === "$" && code[index + 1] === "{") {
|
|
866
|
+
const end = findInterpolationEnd(code, index + 2);
|
|
867
|
+
index = end < 0 ? code.length : end + 1;
|
|
868
|
+
} else index++;
|
|
869
|
+
return code.length;
|
|
870
|
+
}
|
|
871
|
+
function collectJsxAttributes(code, start, end, ranges) {
|
|
872
|
+
const source = code.slice(start, end);
|
|
873
|
+
const regex = /\s([:@A-Za-z_$][\w$:.-]*)(?=\s*(?:=|\/?>))/g;
|
|
874
|
+
let match;
|
|
875
|
+
while (match = regex.exec(source)) {
|
|
876
|
+
const attributeStart = start + match.index + 1;
|
|
877
|
+
ranges.push({
|
|
878
|
+
start: attributeStart,
|
|
879
|
+
end: attributeStart + match[1].length,
|
|
880
|
+
className: "attr"
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function isJsxStart(code, index, jsxAtLineStart) {
|
|
885
|
+
if (jsxAtLineStart && /^\s*$/.test(code.slice(code.lastIndexOf("\n", index - 1) + 1, index))) return true;
|
|
886
|
+
const before = code.slice(0, index).trimEnd();
|
|
887
|
+
if (!before) return true;
|
|
888
|
+
if (/\b(?:return|case|yield)$/.test(before)) return true;
|
|
889
|
+
return /(?:[=([{,:;!&|?]|>)$/.test(before);
|
|
890
|
+
}
|
|
891
|
+
function isTypeParameter(code, start, end, closing) {
|
|
892
|
+
if (closing) return false;
|
|
893
|
+
const inside = code.slice(start + 1, end);
|
|
894
|
+
const after = code.slice(end + 1).trimStart();
|
|
895
|
+
return /\s+extends\s+/.test(inside) || after[0] === "(" && !inside.trimEnd().endsWith("/");
|
|
896
|
+
}
|
|
897
|
+
function isRegexStart(code, index) {
|
|
898
|
+
const before = code.slice(0, index).trimEnd().slice(-11);
|
|
899
|
+
if (!before) return true;
|
|
900
|
+
if (/\b(?:case|delete|in|instanceof|of|return|throw|typeof|void|yield)$/.test(before)) return true;
|
|
901
|
+
return /[=([{,:;!&|?~+*%^<>-]$/.test(before);
|
|
902
|
+
}
|
|
903
|
+
function findRegexEnd(code, start) {
|
|
904
|
+
let inClass = false;
|
|
905
|
+
let index = start + 1;
|
|
906
|
+
while (index < code.length && code[index] !== "\n") if (code[index] === "\\") index += 2;
|
|
907
|
+
else if (code[index] === "[") {
|
|
908
|
+
inClass = true;
|
|
909
|
+
index++;
|
|
910
|
+
} else if (code[index] === "]") {
|
|
911
|
+
inClass = false;
|
|
912
|
+
index++;
|
|
913
|
+
} else if (code[index] === "/" && !inClass) {
|
|
914
|
+
index++;
|
|
915
|
+
while (/[a-z]/i.test(code[index] || "")) index++;
|
|
916
|
+
return index;
|
|
917
|
+
} else index++;
|
|
918
|
+
return start + 1;
|
|
919
|
+
}
|
|
920
|
+
function findQuotedEnd(code, start, quote, multiline = false) {
|
|
921
|
+
let index = start + 1;
|
|
922
|
+
while (index < code.length) if (code[index] === "\\") index += 2;
|
|
923
|
+
else if (code[index] === quote) return index + 1;
|
|
924
|
+
else if (!multiline && code[index] === "\n") return index;
|
|
925
|
+
else index++;
|
|
926
|
+
return code.length;
|
|
927
|
+
}
|
|
928
|
+
function findLineEnd(code, start) {
|
|
929
|
+
const end = code.indexOf("\n", start);
|
|
930
|
+
return end < 0 ? code.length : end;
|
|
931
|
+
}
|
|
932
|
+
function previousCodeIndex(code, index, ranges) {
|
|
933
|
+
let before = index - 1;
|
|
934
|
+
let rangeIndex = ranges.length - 1;
|
|
935
|
+
while (before >= 0) {
|
|
936
|
+
if (/\s/.test(code[before])) {
|
|
937
|
+
before--;
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
const range = ranges[rangeIndex];
|
|
941
|
+
if (range && range.end > before) {
|
|
942
|
+
rangeIndex--;
|
|
943
|
+
if (range.className === "comment" && range.start <= before) {
|
|
944
|
+
before = range.start - 1;
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
} else break;
|
|
948
|
+
}
|
|
949
|
+
return before;
|
|
950
|
+
}
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/js.js
|
|
953
|
+
const js = defineLanguage({
|
|
954
|
+
name: "js",
|
|
955
|
+
aliases: [
|
|
956
|
+
"javascript",
|
|
957
|
+
"mjs",
|
|
958
|
+
"cjs",
|
|
959
|
+
"js-vue"
|
|
960
|
+
],
|
|
961
|
+
tokenize: (code) => collectScriptRanges(code)
|
|
962
|
+
});
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/json.js
|
|
965
|
+
const json = defineLanguage({
|
|
966
|
+
name: "json",
|
|
967
|
+
aliases: [
|
|
968
|
+
"jsonc",
|
|
969
|
+
"json5",
|
|
970
|
+
"jsonl"
|
|
971
|
+
],
|
|
972
|
+
tokenize: patternTokenizer([
|
|
973
|
+
[/\/\/[^\n]*|\/\*[\s\S]*?\*\/|("(?:\\.|[^"\\])*")(?=\s*:)|"(?:\\.|[^"\\])*"/g, (match) => match[0].startsWith("//") || match[0].startsWith("/*") ? "comment" : match[1] ? "property" : "string"],
|
|
974
|
+
[/\b(?:false|null|true)\b/g, "literal"],
|
|
975
|
+
[/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/gi, "number"]
|
|
976
|
+
])
|
|
977
|
+
});
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/jsx.js
|
|
980
|
+
const jsx = defineLanguage({
|
|
981
|
+
name: "jsx",
|
|
982
|
+
tokenize: (code) => collectScriptRanges(code, true)
|
|
983
|
+
});
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/markdown.js
|
|
986
|
+
const markdown = defineLanguage({
|
|
987
|
+
name: "markdown",
|
|
988
|
+
aliases: ["md"],
|
|
989
|
+
tokenize(code, context) {
|
|
990
|
+
return collectPatternRanges(code, [
|
|
991
|
+
[/^#{1,6}\s.*$/gm, "heading"],
|
|
992
|
+
[/^.+\n(?:=+|-+)\s*$/gm, "heading"],
|
|
993
|
+
[/`[^`\n]+`/g, "code-inline"],
|
|
994
|
+
[/!?\[[^\]]+\]\([^)]+\)/g, "link"],
|
|
995
|
+
[/^\s{0,3}(?:>|[-*+] |\d+\. )/gm, "meta"]
|
|
996
|
+
], collectFencedCode(code, context));
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
function collectFencedCode(code, context) {
|
|
1000
|
+
const ranges = [];
|
|
1001
|
+
const opening = /^( {0,3})(`{3,}|~{3,})\s*([^\n]*)$/gm;
|
|
1002
|
+
let match;
|
|
1003
|
+
while (match = opening.exec(code)) {
|
|
1004
|
+
const marker = match[2];
|
|
1005
|
+
const contentStart = code.indexOf("\n", match.index + match[0].length);
|
|
1006
|
+
if (contentStart < 0) break;
|
|
1007
|
+
const closing = new RegExp(`^ {0,3}${marker[0]}{${marker.length},}\\s*$`, "gm");
|
|
1008
|
+
closing.lastIndex = contentStart + 1;
|
|
1009
|
+
const close = closing.exec(code);
|
|
1010
|
+
const contentEnd = close?.index ?? code.length;
|
|
1011
|
+
const info = match[3].trim().split(/\s+/)[0];
|
|
1012
|
+
const embedded = info && context.hasLanguage(info) ? offsetRanges(context.tokenize(code.slice(contentStart + 1, contentEnd), info), contentStart + 1) : [];
|
|
1013
|
+
ranges.push({
|
|
1014
|
+
start: match.index,
|
|
1015
|
+
end: contentStart,
|
|
1016
|
+
className: "meta"
|
|
1017
|
+
});
|
|
1018
|
+
fillCodeRange(contentStart + 1, contentEnd, embedded, ranges);
|
|
1019
|
+
if (close) ranges.push({
|
|
1020
|
+
start: close.index,
|
|
1021
|
+
end: close.index + close[0].length,
|
|
1022
|
+
className: "meta"
|
|
1023
|
+
});
|
|
1024
|
+
opening.lastIndex = close ? close.index + close[0].length : code.length;
|
|
1025
|
+
}
|
|
1026
|
+
return ranges;
|
|
1027
|
+
}
|
|
1028
|
+
function fillCodeRange(start, end, embedded, ranges) {
|
|
1029
|
+
let index = start;
|
|
1030
|
+
for (const range of embedded) {
|
|
1031
|
+
if (range.start > index) ranges.push({
|
|
1032
|
+
start: index,
|
|
1033
|
+
end: range.start,
|
|
1034
|
+
className: "code-inline"
|
|
1035
|
+
});
|
|
1036
|
+
ranges.push(range);
|
|
1037
|
+
index = range.end;
|
|
1038
|
+
}
|
|
1039
|
+
if (index < end) ranges.push({
|
|
1040
|
+
start: index,
|
|
1041
|
+
end,
|
|
1042
|
+
className: "code-inline"
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
//#endregion
|
|
1046
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/python.js
|
|
1047
|
+
const python = defineLanguage({
|
|
1048
|
+
name: "python",
|
|
1049
|
+
aliases: ["py"],
|
|
1050
|
+
tokenize: patternTokenizer([
|
|
1051
|
+
[/#[^\n]*|(?:br|rb|fr|rf|[rubf])?(?:"""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*')/gi, (match) => match[0].startsWith("#") ? "comment" : "string"],
|
|
1052
|
+
[/\b(?:and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/g, "keyword"],
|
|
1053
|
+
[/\b(?:False|None|True|NotImplemented|Ellipsis)\b/g, "literal"],
|
|
1054
|
+
[/@[A-Za-z_][\w.]*/g, "function"],
|
|
1055
|
+
[
|
|
1056
|
+
/\bdef\s+([A-Za-z_]\w*)/g,
|
|
1057
|
+
"function",
|
|
1058
|
+
1
|
|
1059
|
+
],
|
|
1060
|
+
[/\b(?:bool|bytes|dict|float|frozenset|int|list|object|set|str|tuple|type)\b/g, "type"],
|
|
1061
|
+
[/\b(?:0x[\da-f_]+|0b[01_]+|0o[0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:e[+-]?\d[\d_]*)?j?)\b/gi, "number"]
|
|
1062
|
+
])
|
|
1063
|
+
});
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/shell.js
|
|
1066
|
+
const shell = defineLanguage({
|
|
1067
|
+
name: "shell",
|
|
1068
|
+
aliases: [
|
|
1069
|
+
"bash",
|
|
1070
|
+
"sh",
|
|
1071
|
+
"zsh",
|
|
1072
|
+
"cmd",
|
|
1073
|
+
"console"
|
|
1074
|
+
],
|
|
1075
|
+
tokenize: patternTokenizer([
|
|
1076
|
+
collectShellLexicalRanges,
|
|
1077
|
+
[/\$[A-Za-z_][A-Za-z0-9_]*|\b[A-Z_][A-Z0-9_]*(?==)/g, "variable"],
|
|
1078
|
+
[/\b(?:case|do|done|elif|else|esac|export|fi|for|function|if|in|select|then|time|until|while)\b/g, "keyword"],
|
|
1079
|
+
[
|
|
1080
|
+
/(^|[\n;|&])\s*([A-Za-z0-9_./-]+)(?=\s|$)/g,
|
|
1081
|
+
"command",
|
|
1082
|
+
2
|
|
1083
|
+
]
|
|
1084
|
+
])
|
|
1085
|
+
});
|
|
1086
|
+
function collectShellLexicalRanges(code) {
|
|
1087
|
+
const heredocs = [];
|
|
1088
|
+
collectHeredocs(code, heredocs);
|
|
1089
|
+
const ranges = [...heredocs];
|
|
1090
|
+
let heredocIndex = 0;
|
|
1091
|
+
let index = 0;
|
|
1092
|
+
while (index < code.length) {
|
|
1093
|
+
while (heredocIndex < heredocs.length && heredocs[heredocIndex].end <= index) heredocIndex++;
|
|
1094
|
+
const heredoc = heredocs[heredocIndex];
|
|
1095
|
+
if (heredoc && heredoc.start <= index) {
|
|
1096
|
+
index = heredoc.end;
|
|
1097
|
+
continue;
|
|
1098
|
+
}
|
|
1099
|
+
const character = code[index];
|
|
1100
|
+
if (character === "\"" || character === "'") {
|
|
1101
|
+
const quote = character;
|
|
1102
|
+
let end = index + 1;
|
|
1103
|
+
while (end < code.length) if (code[end] === "\\" && quote === "\"") end += 2;
|
|
1104
|
+
else if (code[end] === quote) {
|
|
1105
|
+
end++;
|
|
1106
|
+
break;
|
|
1107
|
+
} else end++;
|
|
1108
|
+
end = Math.min(end, code.length);
|
|
1109
|
+
ranges.push({
|
|
1110
|
+
start: index,
|
|
1111
|
+
end,
|
|
1112
|
+
className: "string"
|
|
1113
|
+
});
|
|
1114
|
+
index = end;
|
|
1115
|
+
continue;
|
|
1116
|
+
}
|
|
1117
|
+
if (character === "$" && code[index + 1] === "{") {
|
|
1118
|
+
const close = code.indexOf("}", index + 2);
|
|
1119
|
+
const end = close < 0 ? code.length : close + 1;
|
|
1120
|
+
ranges.push({
|
|
1121
|
+
start: index,
|
|
1122
|
+
end,
|
|
1123
|
+
className: "variable"
|
|
1124
|
+
});
|
|
1125
|
+
index = end;
|
|
1126
|
+
continue;
|
|
1127
|
+
}
|
|
1128
|
+
if (character === "#" && (index === 0 || code[index - 1] === "\n" || /[\s;|&()]/.test(code[index - 1]))) {
|
|
1129
|
+
const newline = code.indexOf("\n", index);
|
|
1130
|
+
const end = newline < 0 ? code.length : newline;
|
|
1131
|
+
ranges.push({
|
|
1132
|
+
start: index,
|
|
1133
|
+
end,
|
|
1134
|
+
className: "comment"
|
|
1135
|
+
});
|
|
1136
|
+
index = end;
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
1139
|
+
index++;
|
|
1140
|
+
}
|
|
1141
|
+
return ranges;
|
|
1142
|
+
}
|
|
1143
|
+
function collectHeredocs(code, ranges) {
|
|
1144
|
+
const regex = /<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1/g;
|
|
1145
|
+
let match;
|
|
1146
|
+
while (match = regex.exec(code)) {
|
|
1147
|
+
if (code[match.index - 1] === "<" || isInsideQuote(code, match.index)) continue;
|
|
1148
|
+
const bodyStartLine = code.indexOf("\n", match.index + match[0].length);
|
|
1149
|
+
if (bodyStartLine < 0) continue;
|
|
1150
|
+
const bodyStart = bodyStartLine + 1;
|
|
1151
|
+
const closingMatch = new RegExp(`^\\t*${match[2]}\\s*$`, "m").exec(code.slice(bodyStart));
|
|
1152
|
+
if (!closingMatch) {
|
|
1153
|
+
ranges.push({
|
|
1154
|
+
start: bodyStart,
|
|
1155
|
+
end: code.length,
|
|
1156
|
+
className: "string"
|
|
1157
|
+
});
|
|
1158
|
+
continue;
|
|
1159
|
+
}
|
|
1160
|
+
const end = bodyStart + closingMatch.index;
|
|
1161
|
+
if (end > bodyStart) ranges.push({
|
|
1162
|
+
start: bodyStart,
|
|
1163
|
+
end,
|
|
1164
|
+
className: "string"
|
|
1165
|
+
});
|
|
1166
|
+
const closingStart = bodyStart + closingMatch.index;
|
|
1167
|
+
ranges.push({
|
|
1168
|
+
start: closingStart,
|
|
1169
|
+
end: closingStart + closingMatch[0].length,
|
|
1170
|
+
className: "meta"
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
function isInsideQuote(code, index) {
|
|
1175
|
+
const lineStart = code.lastIndexOf("\n", index - 1) + 1;
|
|
1176
|
+
let quote = "";
|
|
1177
|
+
for (let cursor = lineStart; cursor < index; cursor++) if (code[cursor] === "\\" && quote !== "'") cursor++;
|
|
1178
|
+
else if (quote && code[cursor] === quote) quote = "";
|
|
1179
|
+
else if (!quote && (code[cursor] === "\"" || code[cursor] === "'")) quote = code[cursor];
|
|
1180
|
+
return Boolean(quote);
|
|
1181
|
+
}
|
|
1182
|
+
//#endregion
|
|
1183
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/sql.js
|
|
1184
|
+
const sql = defineLanguage({
|
|
1185
|
+
name: "sql",
|
|
1186
|
+
tokenize: patternTokenizer([
|
|
1187
|
+
[/--[^\n]*|\/\*[\s\S]*?\*\/|'(?:''|[^'])*'|"(?:""|[^"])*"/g, (match) => match[0].startsWith("--") || match[0].startsWith("/*") ? "comment" : "string"],
|
|
1188
|
+
[/\b(?:add|all|alter|and|as|asc|begin|between|by|case|check|column|commit|constraint|create|cross|database|default|delete|desc|distinct|drop|else|end|exists|foreign|from|full|group|having|index|inner|insert|into|join|key|left|like|limit|not|null|on|or|order|outer|primary|references|returning|right|rollback|select|set|table|then|union|unique|update|using|values|view|when|where|with)\b/gi, "keyword"],
|
|
1189
|
+
[/\b(?:false|null|true)\b/gi, "literal"],
|
|
1190
|
+
[/\b\d+(?:\.\d+)?\b/g, "number"],
|
|
1191
|
+
[/\b[A-Za-z_][A-Za-z0-9_]*(?=\s*\()/g, "function"]
|
|
1192
|
+
])
|
|
1193
|
+
});
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/toml.js
|
|
1196
|
+
const toml = defineLanguage({
|
|
1197
|
+
name: "toml",
|
|
1198
|
+
tokenize: patternTokenizer([
|
|
1199
|
+
[/#[^\n]*|"""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g, (match) => match[0].startsWith("#") ? "comment" : "string"],
|
|
1200
|
+
[/^\s*\[\[?[^\]]+\]\]?/gm, "heading"],
|
|
1201
|
+
[
|
|
1202
|
+
/^\s*([A-Za-z0-9_.-]+)(?=\s*=)/gm,
|
|
1203
|
+
"property",
|
|
1204
|
+
1
|
|
1205
|
+
],
|
|
1206
|
+
[/\b(?:false|true)\b/g, "literal"],
|
|
1207
|
+
[/\b\d+(?:\.\d+)?\b/g, "number"]
|
|
1208
|
+
])
|
|
1209
|
+
});
|
|
1210
|
+
//#endregion
|
|
1211
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/ts.js
|
|
1212
|
+
const ts = defineLanguage({
|
|
1213
|
+
name: "ts",
|
|
1214
|
+
aliases: ["typescript", "angular-ts"],
|
|
1215
|
+
tokenize: (code) => collectScriptRanges(code)
|
|
1216
|
+
});
|
|
1217
|
+
//#endregion
|
|
1218
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/tsx.js
|
|
1219
|
+
const tsx = defineLanguage({
|
|
1220
|
+
name: "tsx",
|
|
1221
|
+
tokenize: (code) => collectScriptRanges(code, true)
|
|
1222
|
+
});
|
|
1223
|
+
//#endregion
|
|
1224
|
+
//#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/languages/yaml.js
|
|
1225
|
+
const yaml = defineLanguage({
|
|
1226
|
+
name: "yaml",
|
|
1227
|
+
aliases: ["yml"],
|
|
1228
|
+
tokenize(code) {
|
|
1229
|
+
const lexical = [...collectYamlBlockScalars(code), ...collectYamlLexicalRanges(code)];
|
|
1230
|
+
return collectPatternRanges(code, [
|
|
1231
|
+
[
|
|
1232
|
+
/^[ \t-]*([A-Za-z0-9_.-]+)(?=\s*:)/gm,
|
|
1233
|
+
"property",
|
|
1234
|
+
1
|
|
1235
|
+
],
|
|
1236
|
+
collectYamlValues,
|
|
1237
|
+
[/\b(?:false|null|true|yes|no|on|off|~)\b/gi, "literal"],
|
|
1238
|
+
[/\b\d+(?:\.\d+)?\b/g, "number"]
|
|
1239
|
+
], lexical);
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
function collectYamlBlockScalars(code) {
|
|
1243
|
+
const ranges = [];
|
|
1244
|
+
const opening = /^(\s*)[\w.-]+:\s*[>|][+-]?\s*(?:#.*)?$/gm;
|
|
1245
|
+
let match;
|
|
1246
|
+
while (match = opening.exec(code)) {
|
|
1247
|
+
const start = code.indexOf("\n", match.index + match[0].length);
|
|
1248
|
+
if (start < 0) continue;
|
|
1249
|
+
const indentation = match[1].length;
|
|
1250
|
+
let end = start + 1;
|
|
1251
|
+
while (end < code.length) {
|
|
1252
|
+
const lineEnd = code.indexOf("\n", end);
|
|
1253
|
+
const next = lineEnd < 0 ? code.length : lineEnd;
|
|
1254
|
+
const line = code.slice(end, next);
|
|
1255
|
+
const content = line.trimStart();
|
|
1256
|
+
if (content && line.length - content.length <= indentation) break;
|
|
1257
|
+
end = lineEnd < 0 ? code.length : lineEnd + 1;
|
|
1258
|
+
}
|
|
1259
|
+
if (end > start + 1) ranges.push({
|
|
1260
|
+
start: start + 1,
|
|
1261
|
+
end,
|
|
1262
|
+
className: "string"
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
return ranges;
|
|
1266
|
+
}
|
|
1267
|
+
function collectYamlLexicalRanges(code) {
|
|
1268
|
+
const ranges = [];
|
|
1269
|
+
let index = 0;
|
|
1270
|
+
while (index < code.length) {
|
|
1271
|
+
const character = code[index];
|
|
1272
|
+
if (character === "\"" || character === "'") {
|
|
1273
|
+
const quote = character;
|
|
1274
|
+
let end = index + 1;
|
|
1275
|
+
while (end < code.length && code[end] !== "\n") if (code[end] === "\\" && quote === "\"") end += 2;
|
|
1276
|
+
else if (code[end] === quote) {
|
|
1277
|
+
end++;
|
|
1278
|
+
break;
|
|
1279
|
+
} else end++;
|
|
1280
|
+
ranges.push({
|
|
1281
|
+
start: index,
|
|
1282
|
+
end,
|
|
1283
|
+
className: "string"
|
|
1284
|
+
});
|
|
1285
|
+
index = end;
|
|
1286
|
+
continue;
|
|
1287
|
+
}
|
|
1288
|
+
if (character === "#" && (index === 0 || code[index - 1] === "\n" || /\s/.test(code[index - 1]))) {
|
|
1289
|
+
const newline = code.indexOf("\n", index);
|
|
1290
|
+
const end = newline < 0 ? code.length : newline;
|
|
1291
|
+
ranges.push({
|
|
1292
|
+
start: index,
|
|
1293
|
+
end,
|
|
1294
|
+
className: "comment"
|
|
1295
|
+
});
|
|
1296
|
+
index = end;
|
|
1297
|
+
continue;
|
|
1298
|
+
}
|
|
1299
|
+
index++;
|
|
1300
|
+
}
|
|
1301
|
+
return ranges;
|
|
1302
|
+
}
|
|
1303
|
+
function collectYamlValues(code) {
|
|
1304
|
+
const ranges = [];
|
|
1305
|
+
const regex = /:\s*([^\n]*)/g;
|
|
1306
|
+
let match;
|
|
1307
|
+
while (match = regex.exec(code)) {
|
|
1308
|
+
const value = match[1];
|
|
1309
|
+
const trimmed = value.trimEnd();
|
|
1310
|
+
if (!trimmed) continue;
|
|
1311
|
+
const start = match.index + match[0].indexOf(value);
|
|
1312
|
+
let end = start + trimmed.length;
|
|
1313
|
+
const comment = /\s+#/.exec(trimmed);
|
|
1314
|
+
if (comment) end = start + comment.index;
|
|
1315
|
+
while (end > start && /\s/.test(code[end - 1])) end--;
|
|
1316
|
+
if (end > start) ranges.push({
|
|
1317
|
+
start,
|
|
1318
|
+
end,
|
|
1319
|
+
className: "string"
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
return ranges;
|
|
1323
|
+
}
|
|
1324
|
+
//#endregion
|
|
1325
|
+
//#region src/code/highlighter.ts
|
|
1326
|
+
/**
|
|
1327
|
+
* Kumo's shared highlighter. TanStack Highlight is synchronous, so there is
|
|
1328
|
+
* no provider or loading state: grammars are plain imports, created once.
|
|
1329
|
+
* Unknown languages render as escaped plain text.
|
|
1330
|
+
*/
|
|
1331
|
+
const highlighter = createHighlighter({ languages: [
|
|
1332
|
+
css,
|
|
1333
|
+
diff,
|
|
1334
|
+
graphql,
|
|
1335
|
+
html,
|
|
1336
|
+
js,
|
|
1337
|
+
json,
|
|
1338
|
+
jsx,
|
|
1339
|
+
markdown,
|
|
1340
|
+
python,
|
|
1341
|
+
shell,
|
|
1342
|
+
sql,
|
|
1343
|
+
toml,
|
|
1344
|
+
ts,
|
|
1345
|
+
tsx,
|
|
1346
|
+
yaml
|
|
1347
|
+
] });
|
|
1348
|
+
/** Highlight code to an HTML string (`<pre class="th-code">…</pre>`). Safe to call during SSR. */
|
|
1349
|
+
function highlightCode(code, lang, options = {}) {
|
|
1350
|
+
return highlighter.highlightToHtml(code, {
|
|
1351
|
+
lang,
|
|
1352
|
+
lineNumbers: options.lineNumbers,
|
|
1353
|
+
decorations: options.highlightLines?.map((line) => ({
|
|
1354
|
+
lines: line,
|
|
1355
|
+
className: "line-highlighted"
|
|
1356
|
+
}))
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
/** Resolve a language name or alias (`ts`, `bash`, `yml`) to the highlighter's canonical name. */
|
|
1360
|
+
function normalizeLanguage(lang) {
|
|
1361
|
+
return highlighter.normalizeLanguage(lang);
|
|
1362
|
+
}
|
|
1363
|
+
//#endregion
|
|
1364
|
+
export { normalizeLanguage as n, highlightCode as t };
|