@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,1705 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/command-line/commands/ls.ts
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
function getRegistryPath() {
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
return join(__dirname, "..", "..", "ai", "component-registry.json");
|
|
10
|
+
}
|
|
11
|
+
function loadRegistry() {
|
|
12
|
+
const registryPath = getRegistryPath();
|
|
13
|
+
const content = readFileSync(registryPath, "utf-8");
|
|
14
|
+
return JSON.parse(content);
|
|
15
|
+
}
|
|
16
|
+
function ls() {
|
|
17
|
+
try {
|
|
18
|
+
const registry = loadRegistry();
|
|
19
|
+
const components = Object.values(registry.components);
|
|
20
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const component of components) {
|
|
22
|
+
const category = component.category || "Other";
|
|
23
|
+
if (!byCategory.has(category)) {
|
|
24
|
+
byCategory.set(category, []);
|
|
25
|
+
}
|
|
26
|
+
byCategory.get(category).push(component);
|
|
27
|
+
}
|
|
28
|
+
const sortedCategories = [...byCategory.keys()].sort();
|
|
29
|
+
console.log(`Kumo Components (${components.length} total)
|
|
30
|
+
`);
|
|
31
|
+
for (const category of sortedCategories) {
|
|
32
|
+
const categoryComponents = [...byCategory.get(category)].sort(
|
|
33
|
+
(a, b) => a.name.localeCompare(b.name)
|
|
34
|
+
);
|
|
35
|
+
console.log(`${category}:`);
|
|
36
|
+
for (const component of categoryComponents) {
|
|
37
|
+
console.log(` ${component.name} - ${component.description}`);
|
|
38
|
+
}
|
|
39
|
+
console.log();
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
43
|
+
console.error(
|
|
44
|
+
"Error: Component registry not found. Run `pnpm codegen:registry` first."
|
|
45
|
+
);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/command-line/commands/doc.ts
|
|
53
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
54
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
55
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
56
|
+
function getRegistryPath2() {
|
|
57
|
+
const __dirname = dirname2(fileURLToPath2(import.meta.url));
|
|
58
|
+
return join2(__dirname, "..", "..", "ai", "component-registry.json");
|
|
59
|
+
}
|
|
60
|
+
function loadRegistry2() {
|
|
61
|
+
const registryPath = getRegistryPath2();
|
|
62
|
+
const content = readFileSync2(registryPath, "utf-8");
|
|
63
|
+
return JSON.parse(content);
|
|
64
|
+
}
|
|
65
|
+
function findComponent(registry, name) {
|
|
66
|
+
const lowerName = name.toLowerCase();
|
|
67
|
+
for (const [key, component] of Object.entries(registry.components)) {
|
|
68
|
+
if (key.toLowerCase() === lowerName) {
|
|
69
|
+
return component;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
function findSimilar(registry, name) {
|
|
75
|
+
const lowerName = name.toLowerCase();
|
|
76
|
+
const componentNames = Object.keys(registry.components);
|
|
77
|
+
return componentNames.filter(
|
|
78
|
+
(n) => n.toLowerCase().includes(lowerName) || lowerName.includes(n.toLowerCase())
|
|
79
|
+
).slice(0, 5);
|
|
80
|
+
}
|
|
81
|
+
function formatProp(name, prop) {
|
|
82
|
+
const parts = [];
|
|
83
|
+
let typeStr = prop.type;
|
|
84
|
+
if (prop.values && prop.values.length > 0) {
|
|
85
|
+
typeStr = prop.values.map((v) => `"${v}"`).join(" | ");
|
|
86
|
+
}
|
|
87
|
+
const required = prop.required === true || prop.optional === false;
|
|
88
|
+
const requiredStr = required ? "(required)" : "";
|
|
89
|
+
const defaultStr = prop.default ? `[default: ${prop.default}]` : "";
|
|
90
|
+
parts.push(` ${name}: ${typeStr} ${requiredStr} ${defaultStr}`.trim());
|
|
91
|
+
if (prop.description) {
|
|
92
|
+
parts.push(` ${prop.description}`);
|
|
93
|
+
}
|
|
94
|
+
if (prop.descriptions && Object.keys(prop.descriptions).length > 0) {
|
|
95
|
+
for (const [value, desc] of Object.entries(prop.descriptions)) {
|
|
96
|
+
parts.push(` - "${value}": ${desc}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return parts.join("\n");
|
|
100
|
+
}
|
|
101
|
+
function formatComponentDoc(component) {
|
|
102
|
+
const lines = [];
|
|
103
|
+
lines.push(`# ${component.name}
|
|
104
|
+
`);
|
|
105
|
+
lines.push(`${component.description}
|
|
106
|
+
`);
|
|
107
|
+
lines.push(
|
|
108
|
+
`**Import:** \`import { ${component.name} } from "${component.importPath}";\`
|
|
109
|
+
`
|
|
110
|
+
);
|
|
111
|
+
lines.push(`**Category:** ${component.category}
|
|
112
|
+
`);
|
|
113
|
+
const propEntries = Object.entries(component.props);
|
|
114
|
+
if (propEntries.length > 0) {
|
|
115
|
+
lines.push("## Props\n");
|
|
116
|
+
for (const [propName, propInfo] of propEntries) {
|
|
117
|
+
lines.push(formatProp(propName, propInfo));
|
|
118
|
+
lines.push("");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (component.subComponents) {
|
|
122
|
+
lines.push("## Sub-Components\n");
|
|
123
|
+
for (const [subName, subInfo] of Object.entries(component.subComponents)) {
|
|
124
|
+
lines.push(`### ${component.name}.${subName}`);
|
|
125
|
+
if (subInfo.description) {
|
|
126
|
+
lines.push(subInfo.description);
|
|
127
|
+
}
|
|
128
|
+
if (subInfo.renderElement) {
|
|
129
|
+
lines.push(`Renders: ${subInfo.renderElement}`);
|
|
130
|
+
}
|
|
131
|
+
if (subInfo.props) {
|
|
132
|
+
lines.push("Props:");
|
|
133
|
+
for (const [propName, propInfo] of Object.entries(subInfo.props)) {
|
|
134
|
+
const required = propInfo.required ? "(required)" : "";
|
|
135
|
+
lines.push(` - ${propName}: ${propInfo.type} ${required}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
lines.push("");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (component.examples && component.examples.length > 0) {
|
|
142
|
+
lines.push("## Examples\n");
|
|
143
|
+
for (const example of component.examples.slice(0, 3)) {
|
|
144
|
+
lines.push("```tsx");
|
|
145
|
+
lines.push(example);
|
|
146
|
+
lines.push("```\n");
|
|
147
|
+
}
|
|
148
|
+
if (component.examples.length > 3) {
|
|
149
|
+
lines.push(
|
|
150
|
+
`(${component.examples.length - 3} more examples available in Storybook)`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (component.colors && component.colors.length > 0) {
|
|
155
|
+
lines.push("\n## Semantic Tokens Used\n");
|
|
156
|
+
lines.push(component.colors.join(", "));
|
|
157
|
+
}
|
|
158
|
+
return lines.join("\n");
|
|
159
|
+
}
|
|
160
|
+
function docs() {
|
|
161
|
+
try {
|
|
162
|
+
const registry = loadRegistry2();
|
|
163
|
+
const components = Object.values(registry.components);
|
|
164
|
+
console.log(`# Kumo Component Documentation
|
|
165
|
+
`);
|
|
166
|
+
console.log(`${components.length} components available
|
|
167
|
+
`);
|
|
168
|
+
console.log("---\n");
|
|
169
|
+
for (const component of components) {
|
|
170
|
+
console.log(formatComponentDoc(component));
|
|
171
|
+
console.log("\n---\n");
|
|
172
|
+
}
|
|
173
|
+
} catch (error) {
|
|
174
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
175
|
+
console.error(
|
|
176
|
+
"Error: Component registry not found. Run `pnpm codegen:registry` first."
|
|
177
|
+
);
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function doc(componentName) {
|
|
184
|
+
if (!componentName) {
|
|
185
|
+
docs();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const registry = loadRegistry2();
|
|
190
|
+
const component = findComponent(registry, componentName);
|
|
191
|
+
if (!component) {
|
|
192
|
+
const similar = findSimilar(registry, componentName);
|
|
193
|
+
console.error(`Component "${componentName}" not found.`);
|
|
194
|
+
if (similar.length > 0) {
|
|
195
|
+
console.error(`
|
|
196
|
+
Did you mean: ${similar.join(", ")}?`);
|
|
197
|
+
}
|
|
198
|
+
console.error(`
|
|
199
|
+
Run "kumo ls" to see all available components.`);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
console.log(formatComponentDoc(component));
|
|
203
|
+
} catch (error) {
|
|
204
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
205
|
+
console.error(
|
|
206
|
+
"Error: Component registry not found. Run `pnpm codegen:registry` first."
|
|
207
|
+
);
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/command-line/commands/init.ts
|
|
215
|
+
import { createInterface } from "node:readline/promises";
|
|
216
|
+
|
|
217
|
+
// src/command-line/utils/config.ts
|
|
218
|
+
import { existsSync, readFileSync as readFileSync3, writeFileSync } from "node:fs";
|
|
219
|
+
import { join as join3 } from "node:path";
|
|
220
|
+
var DEFAULT_CONFIG = {
|
|
221
|
+
blocksDir: "src/components/kumo",
|
|
222
|
+
version: "1.0.0"
|
|
223
|
+
};
|
|
224
|
+
function readConfig(projectRoot = process.cwd()) {
|
|
225
|
+
const configPath = join3(projectRoot, "kumo.json");
|
|
226
|
+
if (!existsSync(configPath)) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
const content = readFileSync3(configPath, "utf-8");
|
|
231
|
+
const config = JSON.parse(content);
|
|
232
|
+
return {
|
|
233
|
+
...DEFAULT_CONFIG,
|
|
234
|
+
...config
|
|
235
|
+
};
|
|
236
|
+
} catch (error) {
|
|
237
|
+
throw new Error(
|
|
238
|
+
`Failed to parse kumo.json: ${error instanceof Error ? error.message : String(error)}`,
|
|
239
|
+
{ cause: error }
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function writeConfig(config, projectRoot = process.cwd()) {
|
|
244
|
+
const configPath = join3(projectRoot, "kumo.json");
|
|
245
|
+
const fullConfig = {
|
|
246
|
+
...DEFAULT_CONFIG,
|
|
247
|
+
...config
|
|
248
|
+
};
|
|
249
|
+
try {
|
|
250
|
+
const content = JSON.stringify(fullConfig, null, 2) + "\n";
|
|
251
|
+
writeFileSync(configPath, content, "utf-8");
|
|
252
|
+
} catch (error) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`Failed to write kumo.json: ${error instanceof Error ? error.message : String(error)}`,
|
|
255
|
+
{ cause: error }
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function configExists(projectRoot = process.cwd()) {
|
|
260
|
+
const configPath = join3(projectRoot, "kumo.json");
|
|
261
|
+
return existsSync(configPath);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// src/command-line/commands/init.ts
|
|
265
|
+
async function prompt(question, defaultValue) {
|
|
266
|
+
const rl = createInterface({
|
|
267
|
+
input: process.stdin,
|
|
268
|
+
output: process.stdout
|
|
269
|
+
});
|
|
270
|
+
try {
|
|
271
|
+
const suffix = defaultValue ? ` (${defaultValue})` : "";
|
|
272
|
+
const answer = await rl.question(`${question}${suffix}: `);
|
|
273
|
+
return answer.trim() || defaultValue || "";
|
|
274
|
+
} finally {
|
|
275
|
+
rl.close();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
async function confirm(question) {
|
|
279
|
+
const rl = createInterface({
|
|
280
|
+
input: process.stdin,
|
|
281
|
+
output: process.stdout
|
|
282
|
+
});
|
|
283
|
+
try {
|
|
284
|
+
const answer = await rl.question(`${question} (y/n): `);
|
|
285
|
+
return answer.trim().toLowerCase() === "y";
|
|
286
|
+
} finally {
|
|
287
|
+
rl.close();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
async function init() {
|
|
291
|
+
try {
|
|
292
|
+
const projectRoot = process.cwd();
|
|
293
|
+
if (configExists(projectRoot)) {
|
|
294
|
+
console.log("\u26A0\uFE0F kumo.json already exists in this directory.");
|
|
295
|
+
const shouldOverwrite = await confirm("Do you want to overwrite it?");
|
|
296
|
+
if (!shouldOverwrite) {
|
|
297
|
+
console.log("Initialization cancelled.");
|
|
298
|
+
process.exit(0);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
console.log("\n\u{1F680} Initializing Kumo configuration...\n");
|
|
302
|
+
const blocksDir = await prompt(
|
|
303
|
+
"Where should blocks be installed?",
|
|
304
|
+
DEFAULT_CONFIG.blocksDir
|
|
305
|
+
);
|
|
306
|
+
const config = {
|
|
307
|
+
blocksDir: blocksDir || DEFAULT_CONFIG.blocksDir,
|
|
308
|
+
version: DEFAULT_CONFIG.version
|
|
309
|
+
};
|
|
310
|
+
writeConfig(config, projectRoot);
|
|
311
|
+
console.log("\n\u2705 Created kumo.json with the following configuration:");
|
|
312
|
+
console.log(` \u{1F4C1} Blocks directory: ${config.blocksDir}`);
|
|
313
|
+
console.log("\nNext steps:");
|
|
314
|
+
console.log(" \u2022 Run `kumo blocks` to see available blocks");
|
|
315
|
+
console.log(" \u2022 Run `kumo add <block>` to install a block");
|
|
316
|
+
} catch (error) {
|
|
317
|
+
console.error("Error initializing configuration:", error);
|
|
318
|
+
process.exit(1);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// src/command-line/commands/blocks.ts
|
|
323
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
324
|
+
import { dirname as dirname3, join as join4 } from "node:path";
|
|
325
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
326
|
+
function getRegistryPath3() {
|
|
327
|
+
const __dirname = dirname3(fileURLToPath3(import.meta.url));
|
|
328
|
+
return join4(__dirname, "..", "..", "ai", "component-registry.json");
|
|
329
|
+
}
|
|
330
|
+
function loadRegistry3() {
|
|
331
|
+
const registryPath = getRegistryPath3();
|
|
332
|
+
const content = readFileSync4(registryPath, "utf-8");
|
|
333
|
+
return JSON.parse(content);
|
|
334
|
+
}
|
|
335
|
+
function blocks() {
|
|
336
|
+
try {
|
|
337
|
+
const registry = loadRegistry3();
|
|
338
|
+
if (!registry.blocks || Object.keys(registry.blocks).length === 0) {
|
|
339
|
+
console.log("No blocks available.");
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const blockList = Object.values(registry.blocks);
|
|
343
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
344
|
+
for (const block of blockList) {
|
|
345
|
+
const category = block.category || "Other";
|
|
346
|
+
if (!byCategory.has(category)) {
|
|
347
|
+
byCategory.set(category, []);
|
|
348
|
+
}
|
|
349
|
+
byCategory.get(category).push(block);
|
|
350
|
+
}
|
|
351
|
+
const sortedCategories = [...byCategory.keys()].sort();
|
|
352
|
+
console.log(`Kumo Blocks (${blockList.length} total)
|
|
353
|
+
`);
|
|
354
|
+
for (const category of sortedCategories) {
|
|
355
|
+
const categoryBlocks = [...byCategory.get(category)].sort(
|
|
356
|
+
(a, b) => a.name.localeCompare(b.name)
|
|
357
|
+
);
|
|
358
|
+
console.log(`${category}:`);
|
|
359
|
+
for (const block of categoryBlocks) {
|
|
360
|
+
console.log(` ${block.name} - ${block.description}`);
|
|
361
|
+
}
|
|
362
|
+
console.log();
|
|
363
|
+
}
|
|
364
|
+
console.log("To install a block, run:");
|
|
365
|
+
console.log(" kumo add <block-name>\n");
|
|
366
|
+
console.log("Example:");
|
|
367
|
+
console.log(" kumo add PageHeader");
|
|
368
|
+
} catch (error) {
|
|
369
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
370
|
+
console.error(
|
|
371
|
+
"Error: Component registry not found. Run `pnpm codegen:registry` first."
|
|
372
|
+
);
|
|
373
|
+
process.exit(1);
|
|
374
|
+
}
|
|
375
|
+
throw error;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/command-line/commands/add.ts
|
|
380
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
381
|
+
import { dirname as dirname4, join as join5, resolve, relative, isAbsolute } from "node:path";
|
|
382
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
383
|
+
|
|
384
|
+
// src/command-line/utils/transformer.ts
|
|
385
|
+
function parseImports(content) {
|
|
386
|
+
const importRegex = /import\s+(type\s+)?{([^}]+)}\s+from\s+["']([^"']+)["'];?/g;
|
|
387
|
+
const imports = [];
|
|
388
|
+
let match;
|
|
389
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
390
|
+
imports.push({
|
|
391
|
+
fullMatch: match[0],
|
|
392
|
+
imports: match[2],
|
|
393
|
+
path: match[3],
|
|
394
|
+
startIndex: match.index,
|
|
395
|
+
endIndex: match.index + match[0].length,
|
|
396
|
+
isTypeOnlyImport: match[1] !== void 0
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
return imports;
|
|
400
|
+
}
|
|
401
|
+
function shouldTransformToKumo(path) {
|
|
402
|
+
if (!path.startsWith("../")) {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
return path.includes("/components/") || path.includes("/utils/");
|
|
406
|
+
}
|
|
407
|
+
function parseImportItems(imports, isTypeOnlyImport) {
|
|
408
|
+
const items = imports.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
409
|
+
const valueImports = [];
|
|
410
|
+
const typeImports = [];
|
|
411
|
+
for (const item of items) {
|
|
412
|
+
if (isTypeOnlyImport || item.startsWith("type ")) {
|
|
413
|
+
const typeName = item.startsWith("type ") ? item.slice(5).trim() : item;
|
|
414
|
+
typeImports.push(typeName);
|
|
415
|
+
} else {
|
|
416
|
+
valueImports.push(item);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return { valueImports, typeImports };
|
|
420
|
+
}
|
|
421
|
+
function buildConsolidatedImport(valueImports, typeImports) {
|
|
422
|
+
const parts = [];
|
|
423
|
+
for (const item of valueImports) {
|
|
424
|
+
parts.push(item);
|
|
425
|
+
}
|
|
426
|
+
for (const item of typeImports) {
|
|
427
|
+
parts.push(`type ${item}`);
|
|
428
|
+
}
|
|
429
|
+
return `import { ${parts.join(", ")} } from "@fldr/ui";`;
|
|
430
|
+
}
|
|
431
|
+
function transformImports(content) {
|
|
432
|
+
const parsedImports = parseImports(content);
|
|
433
|
+
const kumoImports = [];
|
|
434
|
+
const nonKumoImports = [];
|
|
435
|
+
for (const imp of parsedImports) {
|
|
436
|
+
if (shouldTransformToKumo(imp.path)) {
|
|
437
|
+
kumoImports.push(imp);
|
|
438
|
+
} else {
|
|
439
|
+
nonKumoImports.push(imp);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (kumoImports.length === 0) {
|
|
443
|
+
return content;
|
|
444
|
+
}
|
|
445
|
+
const allValueImports = [];
|
|
446
|
+
const allTypeImports = [];
|
|
447
|
+
for (const imp of kumoImports) {
|
|
448
|
+
const { valueImports, typeImports } = parseImportItems(
|
|
449
|
+
imp.imports,
|
|
450
|
+
imp.isTypeOnlyImport
|
|
451
|
+
);
|
|
452
|
+
allValueImports.push(...valueImports);
|
|
453
|
+
allTypeImports.push(...typeImports);
|
|
454
|
+
}
|
|
455
|
+
const consolidatedImport = buildConsolidatedImport(
|
|
456
|
+
allValueImports,
|
|
457
|
+
allTypeImports
|
|
458
|
+
);
|
|
459
|
+
let result = content;
|
|
460
|
+
const sortedKumoImports = [...kumoImports].sort(
|
|
461
|
+
(a, b) => b.startIndex - a.startIndex
|
|
462
|
+
);
|
|
463
|
+
for (let i = 0; i < sortedKumoImports.length; i++) {
|
|
464
|
+
const imp = sortedKumoImports[i];
|
|
465
|
+
if (i === sortedKumoImports.length - 1) {
|
|
466
|
+
result = result.slice(0, imp.startIndex) + consolidatedImport + result.slice(imp.endIndex);
|
|
467
|
+
} else {
|
|
468
|
+
let startIndex = imp.startIndex;
|
|
469
|
+
let endIndex = imp.endIndex;
|
|
470
|
+
if (startIndex > 0 && result[startIndex - 1] === "\n") {
|
|
471
|
+
startIndex--;
|
|
472
|
+
}
|
|
473
|
+
result = result.slice(0, startIndex) + result.slice(endIndex);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return result;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// src/command-line/commands/add.ts
|
|
480
|
+
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
481
|
+
function getRegistryPath4() {
|
|
482
|
+
const __dirname = dirname4(fileURLToPath4(import.meta.url));
|
|
483
|
+
const possiblePaths = [
|
|
484
|
+
join5(__dirname, "..", "..", "ai", "component-registry.json"),
|
|
485
|
+
join5(__dirname, "..", "ai", "component-registry.json"),
|
|
486
|
+
join5(__dirname, "ai", "component-registry.json")
|
|
487
|
+
];
|
|
488
|
+
for (const path of possiblePaths) {
|
|
489
|
+
if (existsSync2(path)) {
|
|
490
|
+
return path;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
throw new Error(
|
|
494
|
+
"component-registry.json not found. Please regenerate with: pnpm codegen:registry"
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
function getBlocksSourcePath() {
|
|
498
|
+
const __dirname = dirname4(fileURLToPath4(import.meta.url));
|
|
499
|
+
const possiblePaths = [
|
|
500
|
+
join5(__dirname, "..", "..", "blocks-source"),
|
|
501
|
+
join5(__dirname, "..", "blocks-source"),
|
|
502
|
+
join5(__dirname, "blocks-source"),
|
|
503
|
+
// Fallback to old location for backwards compatibility during development
|
|
504
|
+
join5(__dirname, "..", "..", "src", "blocks"),
|
|
505
|
+
join5(__dirname, "..", "src", "blocks"),
|
|
506
|
+
join5(__dirname, "src", "blocks")
|
|
507
|
+
];
|
|
508
|
+
for (const path of possiblePaths) {
|
|
509
|
+
if (existsSync2(path)) {
|
|
510
|
+
return path;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
throw new Error(
|
|
514
|
+
"Blocks source directory not found. The package may be corrupted."
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
function loadRegistry4() {
|
|
518
|
+
const registryPath = getRegistryPath4();
|
|
519
|
+
const content = readFileSync5(registryPath, "utf-8");
|
|
520
|
+
return JSON.parse(content);
|
|
521
|
+
}
|
|
522
|
+
async function confirm2(message) {
|
|
523
|
+
const rl = createInterface2({
|
|
524
|
+
input: process.stdin,
|
|
525
|
+
output: process.stdout
|
|
526
|
+
});
|
|
527
|
+
const answer = await rl.question(`${message} (y/n): `);
|
|
528
|
+
rl.close();
|
|
529
|
+
return answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
|
|
530
|
+
}
|
|
531
|
+
async function add(blockName) {
|
|
532
|
+
if (!blockName) {
|
|
533
|
+
console.error("Error: Block name is required.");
|
|
534
|
+
console.log("\nUsage: kumo add <block-name>");
|
|
535
|
+
console.log("\nRun 'kumo blocks' to see available blocks.");
|
|
536
|
+
process.exit(1);
|
|
537
|
+
}
|
|
538
|
+
const config = readConfig();
|
|
539
|
+
if (!config) {
|
|
540
|
+
console.error(
|
|
541
|
+
"Error: kumo.json not found. Run 'kumo init' first to initialize the configuration."
|
|
542
|
+
);
|
|
543
|
+
process.exit(1);
|
|
544
|
+
}
|
|
545
|
+
let registry;
|
|
546
|
+
try {
|
|
547
|
+
registry = loadRegistry4();
|
|
548
|
+
} catch (error) {
|
|
549
|
+
const message = error instanceof Error ? error.message : "Component registry not found. Run `pnpm codegen:registry` first.";
|
|
550
|
+
console.error(`Error: ${message}`);
|
|
551
|
+
process.exit(1);
|
|
552
|
+
}
|
|
553
|
+
const block = registry.blocks?.[blockName];
|
|
554
|
+
if (!block) {
|
|
555
|
+
console.error(`Error: Block '${blockName}' not found.`);
|
|
556
|
+
console.log("\nRun 'kumo blocks' to see available blocks.");
|
|
557
|
+
process.exit(1);
|
|
558
|
+
}
|
|
559
|
+
let blocksSourcePath;
|
|
560
|
+
try {
|
|
561
|
+
blocksSourcePath = getBlocksSourcePath();
|
|
562
|
+
} catch (error) {
|
|
563
|
+
const message = error instanceof Error ? error.message : "Blocks source directory not found.";
|
|
564
|
+
console.error(`Error: ${message}`);
|
|
565
|
+
process.exit(1);
|
|
566
|
+
}
|
|
567
|
+
const projectRoot = process.cwd();
|
|
568
|
+
const targetDir = join5(projectRoot, config.blocksDir);
|
|
569
|
+
if (!existsSync2(targetDir)) {
|
|
570
|
+
mkdirSync(targetDir, { recursive: true });
|
|
571
|
+
console.log(`\u{1F4C1} Created directory: ${config.blocksDir}`);
|
|
572
|
+
}
|
|
573
|
+
const blockExists = block.files.some((file) => {
|
|
574
|
+
const targetPath = join5(targetDir, file);
|
|
575
|
+
return existsSync2(targetPath);
|
|
576
|
+
});
|
|
577
|
+
if (blockExists) {
|
|
578
|
+
console.log(
|
|
579
|
+
`\u26A0\uFE0F Block '${blockName}' already exists in ${config.blocksDir}`
|
|
580
|
+
);
|
|
581
|
+
const shouldOverwrite = await confirm2("Do you want to overwrite it?");
|
|
582
|
+
if (!shouldOverwrite) {
|
|
583
|
+
console.log("Installation cancelled.");
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
console.log(`\u{1F4E6} Installing block: ${blockName}`);
|
|
588
|
+
for (const file of block.files) {
|
|
589
|
+
const sourcePath = resolve(blocksSourcePath, file);
|
|
590
|
+
const targetPath = resolve(targetDir, file);
|
|
591
|
+
const relativeSource = relative(blocksSourcePath, sourcePath);
|
|
592
|
+
if (relativeSource.startsWith("..") || relativeSource.startsWith("/") || isAbsolute(relativeSource)) {
|
|
593
|
+
console.error(`Error: Invalid source path for file: ${file}`);
|
|
594
|
+
process.exit(1);
|
|
595
|
+
}
|
|
596
|
+
const relativeTarget = relative(targetDir, targetPath);
|
|
597
|
+
if (relativeTarget.startsWith("..") || relativeTarget.startsWith("/") || isAbsolute(relativeTarget)) {
|
|
598
|
+
console.error(`Error: Invalid target path for file: ${file}`);
|
|
599
|
+
process.exit(1);
|
|
600
|
+
}
|
|
601
|
+
const targetSubdir = dirname4(targetPath);
|
|
602
|
+
if (!existsSync2(targetSubdir)) {
|
|
603
|
+
mkdirSync(targetSubdir, { recursive: true });
|
|
604
|
+
}
|
|
605
|
+
const content = readFileSync5(sourcePath, "utf-8");
|
|
606
|
+
const transformed = transformImports(content);
|
|
607
|
+
writeFileSync2(targetPath, transformed, "utf-8");
|
|
608
|
+
console.log(` \u2705 ${file}`);
|
|
609
|
+
}
|
|
610
|
+
if (block.dependencies.length > 0) {
|
|
611
|
+
console.log(`
|
|
612
|
+
\u{1F4DA} This block depends on the following Kumo components:
|
|
613
|
+
`);
|
|
614
|
+
for (const dep of block.dependencies) {
|
|
615
|
+
console.log(` - ${dep} (from @fldr/ui)`);
|
|
616
|
+
}
|
|
617
|
+
console.log("\nMake sure @fldr/ui is installed in your project:");
|
|
618
|
+
console.log(" pnpm add @fldr/ui");
|
|
619
|
+
}
|
|
620
|
+
console.log(`
|
|
621
|
+
\u{1F389} Successfully installed ${blockName}!`);
|
|
622
|
+
console.log(`
|
|
623
|
+
You can now import it in your project:
|
|
624
|
+
`);
|
|
625
|
+
const blockFile = block.files[0].replace(/\.tsx?$/, "");
|
|
626
|
+
const importPath = join5(config.blocksDir, blockFile).replace(/\\/g, "/");
|
|
627
|
+
console.log(` import { ${blockName} } from "${importPath}";`);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// src/command-line/commands/migrate.ts
|
|
631
|
+
var PENDING_MIGRATIONS = {
|
|
632
|
+
text: {},
|
|
633
|
+
color: {}
|
|
634
|
+
};
|
|
635
|
+
var COLOR_PREFIXES = [
|
|
636
|
+
"bg",
|
|
637
|
+
"border",
|
|
638
|
+
"border-t",
|
|
639
|
+
"border-r",
|
|
640
|
+
"border-b",
|
|
641
|
+
"border-l",
|
|
642
|
+
"border-x",
|
|
643
|
+
"border-y",
|
|
644
|
+
"ring",
|
|
645
|
+
"ring-offset",
|
|
646
|
+
"outline",
|
|
647
|
+
"divide",
|
|
648
|
+
"shadow",
|
|
649
|
+
"accent",
|
|
650
|
+
"caret",
|
|
651
|
+
"fill",
|
|
652
|
+
"stroke",
|
|
653
|
+
"decoration",
|
|
654
|
+
"from",
|
|
655
|
+
"via",
|
|
656
|
+
"to"
|
|
657
|
+
];
|
|
658
|
+
var TEXT_PREFIXES = ["text"];
|
|
659
|
+
function hasPendingMigrations() {
|
|
660
|
+
return Object.values(PENDING_MIGRATIONS.text).some((v) => v !== "") || Object.values(PENDING_MIGRATIONS.color).some((v) => v !== "");
|
|
661
|
+
}
|
|
662
|
+
function generateClassMap(direction) {
|
|
663
|
+
const classMap = {};
|
|
664
|
+
for (const [oldName, newName] of Object.entries(PENDING_MIGRATIONS.text)) {
|
|
665
|
+
if (!newName) continue;
|
|
666
|
+
const [from, to] = direction === "to-new" ? [oldName, newName] : [newName, oldName];
|
|
667
|
+
for (const prefix of TEXT_PREFIXES) {
|
|
668
|
+
classMap[`${prefix}-${from}`] = `${prefix}-${to}`;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
for (const [oldName, newName] of Object.entries(PENDING_MIGRATIONS.color)) {
|
|
672
|
+
if (!newName) continue;
|
|
673
|
+
const [from, to] = direction === "to-new" ? [oldName, newName] : [newName, oldName];
|
|
674
|
+
for (const prefix of COLOR_PREFIXES) {
|
|
675
|
+
classMap[`${prefix}-${from}`] = `${prefix}-${to}`;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return classMap;
|
|
679
|
+
}
|
|
680
|
+
var MIGRATE_HELP = `
|
|
681
|
+
Kumo Token Migration Tool (for consumers)
|
|
682
|
+
|
|
683
|
+
When Kumo releases breaking changes to token names, use this command
|
|
684
|
+
to get the rename map for updating your codebase.
|
|
685
|
+
|
|
686
|
+
USAGE:
|
|
687
|
+
npx @fldr/ui migrate [options]
|
|
688
|
+
|
|
689
|
+
OPTIONS:
|
|
690
|
+
--json Output machine-readable JSON (default)
|
|
691
|
+
--classes Output as class-level mapping (bg-kumo-base -> bg-kumo-base)
|
|
692
|
+
--to-old Reverse mapping (new names -> old names)
|
|
693
|
+
--help Show this help message
|
|
694
|
+
|
|
695
|
+
EXAMPLES:
|
|
696
|
+
# Check if there are pending migrations
|
|
697
|
+
npx @fldr/ui migrate
|
|
698
|
+
|
|
699
|
+
# Get class-level mapping for sed/find-replace
|
|
700
|
+
npx @fldr/ui migrate --classes
|
|
701
|
+
|
|
702
|
+
# Get JSON for custom codemod
|
|
703
|
+
npx @fldr/ui migrate --json > rename-map.json
|
|
704
|
+
|
|
705
|
+
USING WITH sed:
|
|
706
|
+
npx @fldr/ui migrate --classes | grep "^bg-\\|^text-" | \\
|
|
707
|
+
while IFS= read -r line; do
|
|
708
|
+
old=$(echo "$line" | awk '{print $1}')
|
|
709
|
+
new=$(echo "$line" | awk '{print $3}')
|
|
710
|
+
find src -name '*.tsx' -exec sed -i '' "s/\\b$old\\b/$new/g" {} +
|
|
711
|
+
done
|
|
712
|
+
|
|
713
|
+
NOTE:
|
|
714
|
+
If no migrations are pending, you're up to date with the current version.
|
|
715
|
+
Migrations are only needed when upgrading to a new major/minor version
|
|
716
|
+
that includes breaking token name changes.
|
|
717
|
+
`;
|
|
718
|
+
function migrate(args) {
|
|
719
|
+
const showHelp = args.includes("--help") || args.includes("-h");
|
|
720
|
+
const outputClasses = args.includes("--classes");
|
|
721
|
+
const toOld = args.includes("--to-old");
|
|
722
|
+
if (showHelp) {
|
|
723
|
+
console.log(MIGRATE_HELP.trim());
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (!hasPendingMigrations()) {
|
|
727
|
+
const print = outputClasses ? console.log : console.error;
|
|
728
|
+
print("No pending token migrations.");
|
|
729
|
+
print("\nYour codebase is up to date with the current Kumo version.");
|
|
730
|
+
print("Token migrations are only needed when upgrading to versions");
|
|
731
|
+
print("that include breaking changes to token names.");
|
|
732
|
+
if (outputClasses) return;
|
|
733
|
+
}
|
|
734
|
+
const direction = toOld ? "to-old" : "to-new";
|
|
735
|
+
const classMap = generateClassMap(direction);
|
|
736
|
+
if (outputClasses) {
|
|
737
|
+
const maxKeyLen = Math.max(...Object.keys(classMap).map((k) => k.length));
|
|
738
|
+
console.log(`# Kumo Token Migration (${direction})`);
|
|
739
|
+
console.log(`# ${Object.keys(classMap).length} class mappings
|
|
740
|
+
`);
|
|
741
|
+
for (const [from, to] of Object.entries(classMap)) {
|
|
742
|
+
console.log(`${from.padEnd(maxKeyLen)} -> ${to}`);
|
|
743
|
+
}
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
const output = {
|
|
747
|
+
meta: {
|
|
748
|
+
description: "Kumo token class name migration map",
|
|
749
|
+
direction,
|
|
750
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
751
|
+
},
|
|
752
|
+
tokens: PENDING_MIGRATIONS,
|
|
753
|
+
classes: classMap
|
|
754
|
+
};
|
|
755
|
+
console.log(JSON.stringify(output, null, 2));
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// src/command-line/commands/ai.ts
|
|
759
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
760
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
761
|
+
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
762
|
+
function ai() {
|
|
763
|
+
const __dirname = dirname5(fileURLToPath5(import.meta.url));
|
|
764
|
+
const usagePath = join6(__dirname, "..", "..", "ai", "USAGE.md");
|
|
765
|
+
try {
|
|
766
|
+
const content = readFileSync6(usagePath, "utf-8");
|
|
767
|
+
console.log(content);
|
|
768
|
+
} catch {
|
|
769
|
+
console.error(
|
|
770
|
+
"Could not read ai/USAGE.md. Make sure you are running this from an installed @fldr/ui package."
|
|
771
|
+
);
|
|
772
|
+
process.exit(1);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// src/command-line/commands/theme.ts
|
|
777
|
+
import { writeFileSync as writeFileSync3 } from "node:fs";
|
|
778
|
+
import { resolve as resolve2 } from "node:path";
|
|
779
|
+
import { pathToFileURL } from "node:url";
|
|
780
|
+
|
|
781
|
+
// scripts/theme-generator/config.ts
|
|
782
|
+
var THEME_CONFIG = {
|
|
783
|
+
/**
|
|
784
|
+
* Text color tokens
|
|
785
|
+
* Used with: text-{token}
|
|
786
|
+
* CSS variable: --text-color-{token}
|
|
787
|
+
*/
|
|
788
|
+
text: {
|
|
789
|
+
"kumo-default": {
|
|
790
|
+
newName: "",
|
|
791
|
+
theme: {
|
|
792
|
+
kumo: {
|
|
793
|
+
light: "var(--color-neutral-900, oklch(21% 0.006 285.885))",
|
|
794
|
+
dark: "var(--color-neutral-100, oklch(97% 0 0))"
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
"kumo-inverse": {
|
|
799
|
+
newName: "",
|
|
800
|
+
theme: {
|
|
801
|
+
kumo: {
|
|
802
|
+
light: "var(--color-neutral-100, oklch(97% 0 0))",
|
|
803
|
+
dark: "var(--color-neutral-900, oklch(20.5% 0 0))"
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
"kumo-strong": {
|
|
808
|
+
newName: "",
|
|
809
|
+
theme: {
|
|
810
|
+
kumo: {
|
|
811
|
+
light: "var(--color-neutral-950, oklch(14.5% 0 0))",
|
|
812
|
+
// darker than default
|
|
813
|
+
dark: "var(--color-neutral-50, oklch(98.5% 0 0))"
|
|
814
|
+
// lighter than default
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
"kumo-subtle": {
|
|
819
|
+
newName: "",
|
|
820
|
+
theme: {
|
|
821
|
+
kumo: {
|
|
822
|
+
light: "var(--color-neutral-500, oklch(55.6% 0 0))",
|
|
823
|
+
// lighter than default
|
|
824
|
+
dark: "var(--color-neutral-400, oklch(70.8% 0 0))"
|
|
825
|
+
// darker than default
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
"kumo-inactive": {
|
|
830
|
+
newName: "",
|
|
831
|
+
theme: {
|
|
832
|
+
kumo: {
|
|
833
|
+
light: "var(--color-neutral-300, oklch(87% 0 0))",
|
|
834
|
+
// lighter than subtle
|
|
835
|
+
dark: "var(--color-neutral-600, oklch(43.9% 0 0))"
|
|
836
|
+
// darker than subtle
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
"kumo-placeholder": {
|
|
841
|
+
// in between subtle and inactive
|
|
842
|
+
newName: "",
|
|
843
|
+
theme: {
|
|
844
|
+
kumo: {
|
|
845
|
+
light: "var(--color-neutral-400, oklch(70.8% 0 0))",
|
|
846
|
+
dark: "var(--color-neutral-500, oklch(55.6% 0 0))"
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
},
|
|
850
|
+
"kumo-brand": {
|
|
851
|
+
newName: "",
|
|
852
|
+
theme: {
|
|
853
|
+
kumo: {
|
|
854
|
+
light: "#f6821f",
|
|
855
|
+
dark: "#f6821f"
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
},
|
|
859
|
+
"kumo-link": {
|
|
860
|
+
newName: "",
|
|
861
|
+
theme: {
|
|
862
|
+
kumo: {
|
|
863
|
+
light: "var(--color-blue-800, oklch(42.4% 0.199 265.638))",
|
|
864
|
+
dark: "var(--color-blue-400, oklch(70.7% 0.165 254.624))"
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
"kumo-info": {
|
|
869
|
+
newName: "",
|
|
870
|
+
theme: {
|
|
871
|
+
kumo: {
|
|
872
|
+
light: "var(--color-blue-800, oklch(42.4% 0.199 265.638))",
|
|
873
|
+
dark: "var(--color-blue-400, oklch(70.7% 0.165 254.624))"
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
"kumo-success": {
|
|
878
|
+
newName: "",
|
|
879
|
+
theme: {
|
|
880
|
+
kumo: {
|
|
881
|
+
light: "var(--color-emerald-800, oklch(43.2% 0.095 166.913))",
|
|
882
|
+
dark: "var(--color-emerald-200, oklch(90.5% 0.093 164.15))"
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
"kumo-danger": {
|
|
887
|
+
newName: "",
|
|
888
|
+
theme: {
|
|
889
|
+
kumo: {
|
|
890
|
+
light: "var(--color-red-700, oklch(50.5% 0.213 27.518))",
|
|
891
|
+
dark: "var(--color-red-400, oklch(70.4% 0.191 22.216))"
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
},
|
|
895
|
+
"kumo-warning": {
|
|
896
|
+
newName: "",
|
|
897
|
+
theme: {
|
|
898
|
+
kumo: {
|
|
899
|
+
light: "oklch(59.7% 0.144 57.5)",
|
|
900
|
+
dark: "var(--color-orange-400, oklch(75% 0.183 55.934))"
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
/*
|
|
905
|
+
* Badge text color tokens
|
|
906
|
+
* Subtle variants need colored text; inverted needs flipping text
|
|
907
|
+
*/
|
|
908
|
+
"kumo-badge-orange-subtle": {
|
|
909
|
+
newName: "",
|
|
910
|
+
description: "Text color for subtle orange badge",
|
|
911
|
+
theme: {
|
|
912
|
+
kumo: {
|
|
913
|
+
light: "var(--color-orange-800, oklch(47% 0.157 37.304))",
|
|
914
|
+
dark: "var(--color-orange-200, oklch(90.1% 0.076 70.697))"
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
"kumo-badge-teal-subtle": {
|
|
919
|
+
newName: "",
|
|
920
|
+
description: "Text color for subtle teal badge",
|
|
921
|
+
theme: {
|
|
922
|
+
kumo: {
|
|
923
|
+
light: "var(--color-teal-800, oklch(43.7% 0.078 188.216))",
|
|
924
|
+
dark: "var(--color-teal-200, oklch(91% 0.096 180.426))"
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
"kumo-badge-neutral-subtle": {
|
|
929
|
+
newName: "",
|
|
930
|
+
description: "Text color for subtle neutral badge",
|
|
931
|
+
theme: {
|
|
932
|
+
kumo: {
|
|
933
|
+
light: "var(--color-neutral-800, oklch(26.9% 0 0))",
|
|
934
|
+
dark: "var(--color-neutral-200, oklch(92.2% 0 0))"
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
"kumo-badge-inverted": {
|
|
939
|
+
newName: "",
|
|
940
|
+
description: "Text color for inverted badge (white in light, black in dark)",
|
|
941
|
+
theme: {
|
|
942
|
+
kumo: {
|
|
943
|
+
light: "var(--color-white, #fff)",
|
|
944
|
+
dark: "var(--color-black, #000)"
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
/**
|
|
950
|
+
* Color tokens
|
|
951
|
+
* Used with: bg-{token}, border-{token}, ring-{token}, etc.
|
|
952
|
+
* CSS variable: --color-{token}
|
|
953
|
+
*/
|
|
954
|
+
color: {
|
|
955
|
+
"kumo-canvas": {
|
|
956
|
+
newName: "",
|
|
957
|
+
theme: {
|
|
958
|
+
kumo: {
|
|
959
|
+
light: "var(--color-kumo-neutral-25, oklch(98.75% 0 0))",
|
|
960
|
+
dark: "var(--color-kumo-neutral-1000, oklch(10% 0 0))"
|
|
961
|
+
},
|
|
962
|
+
fedramp: {
|
|
963
|
+
light: "#5b697c",
|
|
964
|
+
dark: "#5b697c"
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
"kumo-elevated": {
|
|
969
|
+
newName: "",
|
|
970
|
+
theme: {
|
|
971
|
+
kumo: {
|
|
972
|
+
light: "var(--color-kumo-neutral-75, oklch(98% 0 0))",
|
|
973
|
+
dark: "var(--color-kumo-neutral-975, oklch(12% 0 0))"
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
"kumo-recessed": {
|
|
978
|
+
newName: "",
|
|
979
|
+
theme: {
|
|
980
|
+
kumo: {
|
|
981
|
+
light: "var(--color-kumo-neutral-125, oklch(96% 0 0))",
|
|
982
|
+
dark: "var(--color-kumo-neutral-950, oklch(15% 0 0))"
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
"kumo-base": {
|
|
987
|
+
newName: "",
|
|
988
|
+
theme: {
|
|
989
|
+
kumo: {
|
|
990
|
+
light: "var(--color-white, #fff)",
|
|
991
|
+
dark: "var(--color-kumo-neutral-925, oklch(17% 0 0))"
|
|
992
|
+
},
|
|
993
|
+
fedramp: {
|
|
994
|
+
light: "#5b697c",
|
|
995
|
+
dark: "#5b697c"
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
"kumo-tint": {
|
|
1000
|
+
newName: "",
|
|
1001
|
+
theme: {
|
|
1002
|
+
kumo: {
|
|
1003
|
+
light: "var(--color-neutral-100, oklch(97% 0 0))",
|
|
1004
|
+
dark: "var(--color-kumo-neutral-800, oklch(26.9% 0 0))"
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
"kumo-contrast": {
|
|
1009
|
+
newName: "",
|
|
1010
|
+
theme: {
|
|
1011
|
+
kumo: {
|
|
1012
|
+
light: "var(--color-kumo-neutral-975, oklch(8.5% 0 0))",
|
|
1013
|
+
dark: "var(--color-kumo-neutral-25, oklch(98.5% 0 0))"
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
"kumo-overlay": {
|
|
1018
|
+
newName: "",
|
|
1019
|
+
theme: {
|
|
1020
|
+
kumo: {
|
|
1021
|
+
light: "var(--color-kumo-neutral-50, oklch(97.5% 0 0))",
|
|
1022
|
+
dark: "var(--color-neutral-800, oklch(26.9% 0 0))"
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
"kumo-control": {
|
|
1027
|
+
newName: "",
|
|
1028
|
+
theme: {
|
|
1029
|
+
kumo: {
|
|
1030
|
+
light: "var(--color-white, #fff)",
|
|
1031
|
+
dark: "var(--color-neutral-900, oklch(21% 0.006 285.885))"
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
"kumo-interact": {
|
|
1036
|
+
newName: "",
|
|
1037
|
+
theme: {
|
|
1038
|
+
kumo: {
|
|
1039
|
+
light: "var(--color-neutral-300, oklch(87% 0 0))",
|
|
1040
|
+
dark: "var(--color-neutral-700, oklch(37.1% 0 0))"
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
"kumo-fill": {
|
|
1045
|
+
newName: "",
|
|
1046
|
+
theme: {
|
|
1047
|
+
kumo: {
|
|
1048
|
+
light: "var(--color-neutral-200, oklch(92.2% 0 0))",
|
|
1049
|
+
dark: "var(--color-neutral-800, oklch(26.9% 0 0))"
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
"kumo-fill-hover": {
|
|
1054
|
+
newName: "",
|
|
1055
|
+
theme: {
|
|
1056
|
+
kumo: {
|
|
1057
|
+
light: "var(--color-kumo-neutral-125, oklch(96.5% 0 0))",
|
|
1058
|
+
dark: "var(--color-neutral-800, oklch(37.1% 0 0))"
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
"kumo-brand": {
|
|
1063
|
+
newName: "",
|
|
1064
|
+
theme: {
|
|
1065
|
+
kumo: {
|
|
1066
|
+
light: "oklch(0.5772 0.2324 260)",
|
|
1067
|
+
dark: "color-mix(in oklch, oklch(0.5772 0.2324 260), black 10%)"
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1071
|
+
"kumo-brand-hover": {
|
|
1072
|
+
newName: "",
|
|
1073
|
+
theme: {
|
|
1074
|
+
kumo: {
|
|
1075
|
+
light: "var(--color-blue-700, oklch(48.8% 0.243 264.376))",
|
|
1076
|
+
dark: "var(--color-blue-700, oklch(48.8% 0.243 264.376))"
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
"kumo-line": {
|
|
1081
|
+
newName: "",
|
|
1082
|
+
theme: {
|
|
1083
|
+
kumo: {
|
|
1084
|
+
light: "oklch(14.5% 0 0 / 0.1)",
|
|
1085
|
+
dark: "var(--color-kumo-neutral-750, oklch(32% 0 0))"
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
"kumo-hairline": {
|
|
1090
|
+
newName: "",
|
|
1091
|
+
theme: {
|
|
1092
|
+
kumo: {
|
|
1093
|
+
light: "var(--color-kumo-neutral-150, oklch(93.5% 0 0))",
|
|
1094
|
+
dark: "var(--color-neutral-800, oklch(26.9% 0 0))"
|
|
1095
|
+
},
|
|
1096
|
+
fedramp: {
|
|
1097
|
+
light: "#c8d4e5",
|
|
1098
|
+
dark: "#c8d4e5"
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
"kumo-focus": {
|
|
1103
|
+
newName: "",
|
|
1104
|
+
description: "Primary focus ring/border color",
|
|
1105
|
+
theme: {
|
|
1106
|
+
kumo: {
|
|
1107
|
+
light: "var(--color-kumo-neutral-950, oklch(15% 0 0))",
|
|
1108
|
+
dark: "var(--color-kumo-neutral-150, oklch(93.5% 0 0))"
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
"kumo-shadow-edge": {
|
|
1113
|
+
newName: "",
|
|
1114
|
+
description: "Tight spread shadow color for control thumbs/knobs",
|
|
1115
|
+
theme: {
|
|
1116
|
+
kumo: {
|
|
1117
|
+
light: "oklch(0% 0 0 / 0.12)",
|
|
1118
|
+
dark: "oklch(100% 0 0 / 0.1)"
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
"kumo-shadow-drop": {
|
|
1123
|
+
newName: "",
|
|
1124
|
+
description: "Drop shadow color for control thumbs/knobs",
|
|
1125
|
+
theme: {
|
|
1126
|
+
kumo: {
|
|
1127
|
+
light: "oklch(0% 0 0 / 0.08)",
|
|
1128
|
+
dark: "oklch(0% 0 0 / 0.3)"
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
"kumo-arrow-edge": {
|
|
1133
|
+
newName: "",
|
|
1134
|
+
description: "Arrow border edge fill for popover/tooltip arrows (visible in light mode). Matches kumo-line so the arrow border aligns with the popup outline.",
|
|
1135
|
+
theme: {
|
|
1136
|
+
kumo: {
|
|
1137
|
+
light: "oklch(14.5% 0 0 / 0.1)",
|
|
1138
|
+
dark: "transparent"
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
"kumo-arrow-stroke": {
|
|
1143
|
+
newName: "",
|
|
1144
|
+
description: "Arrow border stroke fill for popover/tooltip arrows (visible in dark mode). Matches kumo-line so the arrow border aligns with the popup outline.",
|
|
1145
|
+
theme: {
|
|
1146
|
+
kumo: {
|
|
1147
|
+
light: "transparent",
|
|
1148
|
+
dark: "var(--color-kumo-neutral-750, oklch(32% 0 0))"
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
"kumo-info-tint": {
|
|
1153
|
+
newName: "",
|
|
1154
|
+
theme: {
|
|
1155
|
+
kumo: {
|
|
1156
|
+
light: "oklch(93.2% 0.032 255.6 / 0.45)",
|
|
1157
|
+
dark: "oklch(38.0% 0.145 265.5 / 0.22)"
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
"kumo-info": {
|
|
1162
|
+
newName: "",
|
|
1163
|
+
theme: {
|
|
1164
|
+
kumo: {
|
|
1165
|
+
light: "var(--color-blue-500, oklch(68.5% 0.169 237.323))",
|
|
1166
|
+
dark: "var(--color-blue-500, oklch(68.5% 0.169 237.323))"
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
"kumo-warning-tint": {
|
|
1171
|
+
newName: "",
|
|
1172
|
+
theme: {
|
|
1173
|
+
kumo: {
|
|
1174
|
+
light: "oklch(93.1% 0.107 94.6 / 0.20)",
|
|
1175
|
+
dark: "oklch(35.3% 0.079 65.0 / 0.37)"
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
},
|
|
1179
|
+
"kumo-warning": {
|
|
1180
|
+
newName: "",
|
|
1181
|
+
theme: {
|
|
1182
|
+
kumo: {
|
|
1183
|
+
light: "oklch(73.9% 0.177 58.2)",
|
|
1184
|
+
dark: "oklch(64.5% 0.168 50.0)"
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
"kumo-danger-tint": {
|
|
1189
|
+
newName: "",
|
|
1190
|
+
theme: {
|
|
1191
|
+
kumo: {
|
|
1192
|
+
light: "oklch(93.6% 0.032 17.7 / 0.42)",
|
|
1193
|
+
dark: "oklch(42.9% 0.176 28.7 / 0.17)"
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
"kumo-danger": {
|
|
1198
|
+
newName: "",
|
|
1199
|
+
// Aligned with fill.kumo-danger so `bg-kumo-danger` matches `fill-kumo-danger`.
|
|
1200
|
+
theme: {
|
|
1201
|
+
kumo: {
|
|
1202
|
+
light: "var(--color-red-500, oklch(63.7% 0.237 25.331))",
|
|
1203
|
+
dark: "var(--color-red-600, oklch(57.7% 0.245 27.325))"
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
1207
|
+
"kumo-success-tint": {
|
|
1208
|
+
newName: "",
|
|
1209
|
+
theme: {
|
|
1210
|
+
kumo: {
|
|
1211
|
+
light: "oklch(96.2% 0.043 156.7 / 0.57)",
|
|
1212
|
+
dark: "oklch(39.3% 0.096 152.3 / 0.20)"
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
"kumo-success": {
|
|
1217
|
+
newName: "",
|
|
1218
|
+
theme: {
|
|
1219
|
+
kumo: {
|
|
1220
|
+
light: "var(--color-emerald-600, oklch(59.6% 0.145 163.225))",
|
|
1221
|
+
dark: "var(--color-emerald-400, oklch(76.5% 0.177 163.223))"
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
/*
|
|
1226
|
+
* Banner background tokens
|
|
1227
|
+
* Pre-baked opacity per mode so banners don't need dark: overrides.
|
|
1228
|
+
* Mirrors the *-tint hues but tuned for the Banner component's surface contrast.
|
|
1229
|
+
*/
|
|
1230
|
+
"kumo-banner-info": {
|
|
1231
|
+
newName: "",
|
|
1232
|
+
description: "Info banner background (informational/default variant)",
|
|
1233
|
+
theme: {
|
|
1234
|
+
kumo: {
|
|
1235
|
+
light: "oklch(93.2% 0.032 255.585 / 0.7)",
|
|
1236
|
+
dark: "oklch(37.9% 0.146 265.522 / 0.5)"
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
},
|
|
1240
|
+
"kumo-banner-warning": {
|
|
1241
|
+
newName: "",
|
|
1242
|
+
description: "Warning banner background (alert variant)",
|
|
1243
|
+
theme: {
|
|
1244
|
+
kumo: {
|
|
1245
|
+
light: "var(--color-yellow-100, oklch(97.3% 0.071 103.193))",
|
|
1246
|
+
dark: "oklch(55.4% 0.135 66.442 / 0.5)"
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
/*
|
|
1251
|
+
* Badge color tokens
|
|
1252
|
+
* Solid variants: vivid background, white text
|
|
1253
|
+
* Subtle variants: tinted background, darker text (flips in dark mode)
|
|
1254
|
+
*/
|
|
1255
|
+
// Secondary
|
|
1256
|
+
"kumo-badge-secondary": {
|
|
1257
|
+
newName: "",
|
|
1258
|
+
description: "Secondary badge background",
|
|
1259
|
+
theme: {
|
|
1260
|
+
kumo: {
|
|
1261
|
+
light: "var(--color-kumo-neutral-125, oklch(96.5% 0 0))",
|
|
1262
|
+
dark: "var(--color-neutral-800, oklch(26.9% 0 0))"
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
// Red
|
|
1267
|
+
"kumo-badge-red": {
|
|
1268
|
+
newName: "",
|
|
1269
|
+
description: "Red badge background",
|
|
1270
|
+
theme: {
|
|
1271
|
+
kumo: {
|
|
1272
|
+
light: "var(--color-red-600, oklch(57.7% 0.245 27.325))",
|
|
1273
|
+
dark: "var(--color-red-700, oklch(50.5% 0.213 27.518))"
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
// Green
|
|
1278
|
+
"kumo-badge-green": {
|
|
1279
|
+
newName: "",
|
|
1280
|
+
description: "Green badge background",
|
|
1281
|
+
theme: {
|
|
1282
|
+
kumo: {
|
|
1283
|
+
light: "var(--color-emerald-600, oklch(59.6% 0.145 163.225))",
|
|
1284
|
+
dark: "var(--color-emerald-700, oklch(50.8% 0.118 165.612))"
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
// Orange
|
|
1289
|
+
"kumo-badge-orange": {
|
|
1290
|
+
newName: "",
|
|
1291
|
+
description: "Orange badge background",
|
|
1292
|
+
theme: {
|
|
1293
|
+
kumo: {
|
|
1294
|
+
light: "var(--color-orange-650, oklch(81.5% 0.197 76))",
|
|
1295
|
+
dark: "var(--color-orange-650, oklch(81.5% 0.197 76))"
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
// Purple
|
|
1300
|
+
"kumo-badge-purple": {
|
|
1301
|
+
newName: "",
|
|
1302
|
+
description: "Purple badge background",
|
|
1303
|
+
theme: {
|
|
1304
|
+
kumo: {
|
|
1305
|
+
light: "var(--color-purple-600, oklch(55.8% 0.288 302.321))",
|
|
1306
|
+
dark: "var(--color-purple-700, oklch(49.6% 0.265 301.924))"
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
// Teal
|
|
1311
|
+
"kumo-badge-teal": {
|
|
1312
|
+
newName: "",
|
|
1313
|
+
description: "Teal badge background",
|
|
1314
|
+
theme: {
|
|
1315
|
+
kumo: {
|
|
1316
|
+
light: "var(--color-teal-650, oklch(54.9% 0.096 184.565))",
|
|
1317
|
+
dark: "var(--color-teal-700, oklch(51.1% 0.096 186.391))"
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
// Blue
|
|
1322
|
+
"kumo-badge-blue": {
|
|
1323
|
+
newName: "",
|
|
1324
|
+
description: "Blue badge background",
|
|
1325
|
+
theme: {
|
|
1326
|
+
kumo: {
|
|
1327
|
+
light: "var(--color-blue-600, oklch(54.6% 0.245 262.881))",
|
|
1328
|
+
dark: "var(--color-blue-700, oklch(48.8% 0.243 264.376))"
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
// Neutral
|
|
1333
|
+
"kumo-badge-neutral": {
|
|
1334
|
+
newName: "",
|
|
1335
|
+
description: "Neutral badge background",
|
|
1336
|
+
theme: {
|
|
1337
|
+
kumo: {
|
|
1338
|
+
light: "var(--color-neutral-500, oklch(55.6% 0 0))",
|
|
1339
|
+
dark: "var(--color-neutral-600, oklch(43.9% 0 0))"
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
},
|
|
1343
|
+
// NOTE: kumo-badge-neutral-subtle omitted — same pair as kumo-fill.
|
|
1344
|
+
// Badge uses bg-kumo-fill instead.
|
|
1345
|
+
// Inverted
|
|
1346
|
+
"kumo-badge-inverted": {
|
|
1347
|
+
newName: "",
|
|
1348
|
+
description: "Inverted badge background (near-black in light, white in dark)",
|
|
1349
|
+
theme: {
|
|
1350
|
+
kumo: {
|
|
1351
|
+
light: "var(--color-neutral-950, oklch(14.5% 0 0))",
|
|
1352
|
+
dark: "var(--color-white, #fff)"
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
},
|
|
1357
|
+
/**
|
|
1358
|
+
* Typography tokens
|
|
1359
|
+
* Used with: text-{size} utilities
|
|
1360
|
+
* CSS variables: --text-{size}, --text-{size}--line-height
|
|
1361
|
+
*
|
|
1362
|
+
* Note: Typography is NOT theme-dependent (no light/dark mode).
|
|
1363
|
+
* Values are the same across color modes but may differ per theme.
|
|
1364
|
+
*/
|
|
1365
|
+
typography: {
|
|
1366
|
+
xs: {
|
|
1367
|
+
newName: "",
|
|
1368
|
+
theme: {
|
|
1369
|
+
kumo: "12px"
|
|
1370
|
+
}
|
|
1371
|
+
},
|
|
1372
|
+
"xs--line-height": {
|
|
1373
|
+
newName: "",
|
|
1374
|
+
theme: {
|
|
1375
|
+
kumo: "calc(1 / 0.75)"
|
|
1376
|
+
}
|
|
1377
|
+
},
|
|
1378
|
+
sm: {
|
|
1379
|
+
newName: "",
|
|
1380
|
+
theme: {
|
|
1381
|
+
kumo: "13px"
|
|
1382
|
+
}
|
|
1383
|
+
},
|
|
1384
|
+
"sm--line-height": {
|
|
1385
|
+
newName: "",
|
|
1386
|
+
theme: {
|
|
1387
|
+
kumo: "calc(1.25 / 0.875)"
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
base: {
|
|
1391
|
+
newName: "",
|
|
1392
|
+
theme: {
|
|
1393
|
+
kumo: "14px"
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
"base--line-height": {
|
|
1397
|
+
newName: "",
|
|
1398
|
+
theme: {
|
|
1399
|
+
kumo: "1.5"
|
|
1400
|
+
}
|
|
1401
|
+
},
|
|
1402
|
+
lg: {
|
|
1403
|
+
newName: "",
|
|
1404
|
+
theme: {
|
|
1405
|
+
kumo: "16px"
|
|
1406
|
+
}
|
|
1407
|
+
},
|
|
1408
|
+
"lg--line-height": {
|
|
1409
|
+
newName: "",
|
|
1410
|
+
theme: {
|
|
1411
|
+
kumo: "1.5"
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1417
|
+
// scripts/theme-generator/generate-css.ts
|
|
1418
|
+
var GENERATED_FILE_HEADER = `/**
|
|
1419
|
+
* AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
1420
|
+
*
|
|
1421
|
+
* This file is generated by the theme generator.
|
|
1422
|
+
* To modify tokens, edit: scripts/theme-generator/config.ts
|
|
1423
|
+
* Then run: pnpm codegen:themes
|
|
1424
|
+
*/
|
|
1425
|
+
|
|
1426
|
+
`;
|
|
1427
|
+
function lightDark(light, dark) {
|
|
1428
|
+
return `light-dark(
|
|
1429
|
+
${light},
|
|
1430
|
+
${dark}
|
|
1431
|
+
)`;
|
|
1432
|
+
}
|
|
1433
|
+
function pushModeScopedBaseVariables(lines, config, themeName, useNewNames, options = {}) {
|
|
1434
|
+
const textEntries = [];
|
|
1435
|
+
const colorEntries = [];
|
|
1436
|
+
for (const [tokenName, def] of Object.entries(config.text)) {
|
|
1437
|
+
const themeColors = def.theme[themeName];
|
|
1438
|
+
if (!themeColors) continue;
|
|
1439
|
+
const name = useNewNames ? def.newName : tokenName;
|
|
1440
|
+
textEntries.push({
|
|
1441
|
+
name,
|
|
1442
|
+
light: themeColors.light,
|
|
1443
|
+
dark: themeColors.dark
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
for (const [tokenName, def] of Object.entries(config.color)) {
|
|
1447
|
+
const themeColors = def.theme[themeName];
|
|
1448
|
+
if (!themeColors) continue;
|
|
1449
|
+
const name = useNewNames ? def.newName : tokenName;
|
|
1450
|
+
colorEntries.push({
|
|
1451
|
+
name,
|
|
1452
|
+
light: themeColors.light,
|
|
1453
|
+
dark: themeColors.dark
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
if (textEntries.length === 0 && colorEntries.length === 0) {
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
const themeSelector = `[data-theme="${themeName}"]`;
|
|
1460
|
+
const lightSelector = themeName === "kumo" ? `:root, ${themeSelector}` : `${themeSelector}`;
|
|
1461
|
+
const darkSelector = themeName === "kumo" ? `:root[data-mode="dark"], [data-mode="dark"]:not([data-theme]), [data-mode="dark"] [data-theme], [data-theme][data-mode="dark"], [data-theme] [data-mode="dark"]` : `[data-mode="dark"] ${themeSelector}, ${themeSelector}[data-mode="dark"], ${themeSelector} [data-mode="dark"]`;
|
|
1462
|
+
const ruleLines = [];
|
|
1463
|
+
ruleLines.push(`${lightSelector} {`);
|
|
1464
|
+
for (const entry of textEntries) {
|
|
1465
|
+
ruleLines.push(` --text-color-${entry.name}: ${entry.light};`);
|
|
1466
|
+
}
|
|
1467
|
+
for (const entry of colorEntries) {
|
|
1468
|
+
ruleLines.push(` --color-${entry.name}: ${entry.light};`);
|
|
1469
|
+
}
|
|
1470
|
+
ruleLines.push("}");
|
|
1471
|
+
ruleLines.push("");
|
|
1472
|
+
ruleLines.push(`${darkSelector} {`);
|
|
1473
|
+
for (const entry of textEntries) {
|
|
1474
|
+
ruleLines.push(` --text-color-${entry.name}: ${entry.dark};`);
|
|
1475
|
+
}
|
|
1476
|
+
for (const entry of colorEntries) {
|
|
1477
|
+
ruleLines.push(` --color-${entry.name}: ${entry.dark};`);
|
|
1478
|
+
}
|
|
1479
|
+
ruleLines.push("}");
|
|
1480
|
+
lines.push("");
|
|
1481
|
+
if (options.wrapInBaseLayer) {
|
|
1482
|
+
lines.push("@layer base {");
|
|
1483
|
+
for (const line of ruleLines) {
|
|
1484
|
+
lines.push(` ${line}`);
|
|
1485
|
+
}
|
|
1486
|
+
lines.push("}");
|
|
1487
|
+
return;
|
|
1488
|
+
}
|
|
1489
|
+
lines.push(...ruleLines);
|
|
1490
|
+
}
|
|
1491
|
+
function generateThemeOverrideCSS(config, themeName, useNewNames = false, header = GENERATED_FILE_HEADER) {
|
|
1492
|
+
if (themeName === "kumo") {
|
|
1493
|
+
throw new Error("Use generateKumoThemeCSS for the base kumo theme");
|
|
1494
|
+
}
|
|
1495
|
+
const overrides = [];
|
|
1496
|
+
for (const [tokenName, def] of Object.entries(config.text)) {
|
|
1497
|
+
const themeColors = def.theme[themeName];
|
|
1498
|
+
if (themeColors) {
|
|
1499
|
+
const name = useNewNames ? def.newName : tokenName;
|
|
1500
|
+
overrides.push(
|
|
1501
|
+
` --text-color-${name}: ${lightDark(themeColors.light, themeColors.dark)};`
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
for (const [tokenName, def] of Object.entries(config.color)) {
|
|
1506
|
+
const themeColors = def.theme[themeName];
|
|
1507
|
+
if (themeColors) {
|
|
1508
|
+
const name = useNewNames ? def.newName : tokenName;
|
|
1509
|
+
overrides.push(
|
|
1510
|
+
` --color-${name}: ${lightDark(themeColors.light, themeColors.dark)};`
|
|
1511
|
+
);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
if (config.typography) {
|
|
1515
|
+
for (const [tokenName, def] of Object.entries(config.typography)) {
|
|
1516
|
+
const themeValue = def.theme[themeName];
|
|
1517
|
+
if (themeValue) {
|
|
1518
|
+
const name = useNewNames && def.newName ? def.newName : tokenName;
|
|
1519
|
+
overrides.push(` --text-${name}: ${themeValue};`);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (overrides.length === 0) {
|
|
1524
|
+
return `${header}/* No overrides for ${themeName} theme */
|
|
1525
|
+
`;
|
|
1526
|
+
}
|
|
1527
|
+
const lines = [
|
|
1528
|
+
header,
|
|
1529
|
+
"@layer base {",
|
|
1530
|
+
` [data-theme="${themeName}"] {`,
|
|
1531
|
+
...overrides,
|
|
1532
|
+
" }",
|
|
1533
|
+
"}"
|
|
1534
|
+
];
|
|
1535
|
+
pushModeScopedBaseVariables(lines, config, themeName, useNewNames, {
|
|
1536
|
+
wrapInBaseLayer: true
|
|
1537
|
+
});
|
|
1538
|
+
return `${lines.join("\n")}
|
|
1539
|
+
`;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// src/theming/define-theme.ts
|
|
1543
|
+
var NAME = /^[a-z][a-z0-9-]*$/;
|
|
1544
|
+
var RESERVED = /* @__PURE__ */ new Set(["kumo", "fedramp"]);
|
|
1545
|
+
function assertKnown(group, keys, known) {
|
|
1546
|
+
const unknown = keys.filter((key) => !(key in known));
|
|
1547
|
+
if (unknown.length > 0) {
|
|
1548
|
+
throw new Error(`Unknown ${group} token(s): ${unknown.join(", ")}`);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
function generateThemeCSS(theme2) {
|
|
1552
|
+
const { name, text = {}, color = {}, typography = {} } = theme2;
|
|
1553
|
+
if (!NAME.test(name) || RESERVED.has(name)) {
|
|
1554
|
+
throw new Error(
|
|
1555
|
+
`Invalid theme name "${name}": use lowercase letters, digits and dashes, not kumo/fedramp`
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
assertKnown("text", Object.keys(text), THEME_CONFIG.text);
|
|
1559
|
+
assertKnown("color", Object.keys(color), THEME_CONFIG.color);
|
|
1560
|
+
assertKnown("typography", Object.keys(typography), THEME_CONFIG.typography);
|
|
1561
|
+
const config = { text: {}, color: {}, typography: {} };
|
|
1562
|
+
for (const [key, def] of Object.entries(THEME_CONFIG.text)) {
|
|
1563
|
+
config.text[key] = {
|
|
1564
|
+
...def,
|
|
1565
|
+
theme: { ...def.theme, [name]: text[key] }
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
for (const [key, def] of Object.entries(THEME_CONFIG.color)) {
|
|
1569
|
+
config.color[key] = {
|
|
1570
|
+
...def,
|
|
1571
|
+
theme: { ...def.theme, [name]: color[key] }
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
for (const [key, def] of Object.entries(THEME_CONFIG.typography)) {
|
|
1575
|
+
config.typography[key] = {
|
|
1576
|
+
...def,
|
|
1577
|
+
theme: { ...def.theme, [name]: typography[key] }
|
|
1578
|
+
};
|
|
1579
|
+
}
|
|
1580
|
+
return generateThemeOverrideCSS(
|
|
1581
|
+
config,
|
|
1582
|
+
name,
|
|
1583
|
+
false,
|
|
1584
|
+
`/* Kumo theme "${name}". Generated by generateThemeCSS(); edit the theme definition, not this file. */
|
|
1585
|
+
`
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
// src/command-line/commands/theme.ts
|
|
1590
|
+
var USAGE = "Usage: kumo theme <theme-file> [-o <out.css>]";
|
|
1591
|
+
function isTheme(value) {
|
|
1592
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1593
|
+
const v = value;
|
|
1594
|
+
return typeof v.name === "string" && ("text" in v || "color" in v || "typography" in v);
|
|
1595
|
+
}
|
|
1596
|
+
async function theme(args) {
|
|
1597
|
+
const file = args.find(
|
|
1598
|
+
(arg, i) => !arg.startsWith("-") && args[i - 1] !== "-o"
|
|
1599
|
+
);
|
|
1600
|
+
const outIndex = args.indexOf("-o");
|
|
1601
|
+
const out = outIndex === -1 ? void 0 : args[outIndex + 1];
|
|
1602
|
+
if (!file || outIndex !== -1 && !out) {
|
|
1603
|
+
console.error(USAGE);
|
|
1604
|
+
process.exit(1);
|
|
1605
|
+
}
|
|
1606
|
+
const mod = await import(pathToFileURL(resolve2(file)).href);
|
|
1607
|
+
const themes = Object.values(mod).filter(isTheme);
|
|
1608
|
+
if (themes.length === 0) {
|
|
1609
|
+
console.error(
|
|
1610
|
+
`No themes exported from ${file}. Export a defineTheme({ name, ... }) value.`
|
|
1611
|
+
);
|
|
1612
|
+
process.exit(1);
|
|
1613
|
+
}
|
|
1614
|
+
const css = themes.map(generateThemeCSS).join("\n");
|
|
1615
|
+
if (out) {
|
|
1616
|
+
writeFileSync3(out, css);
|
|
1617
|
+
console.error(`Wrote ${themes.map((t) => t.name).join(", ")} \u2192 ${out}`);
|
|
1618
|
+
} else {
|
|
1619
|
+
process.stdout.write(css);
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
// src/command-line/cli.ts
|
|
1624
|
+
var HELP = `
|
|
1625
|
+
Kumo CLI - Component registry and blocks distribution
|
|
1626
|
+
|
|
1627
|
+
BLOCKS:
|
|
1628
|
+
kumo init Initialize kumo.json configuration file
|
|
1629
|
+
kumo blocks List all available blocks for CLI installation
|
|
1630
|
+
kumo add <block> Install a block to your project
|
|
1631
|
+
|
|
1632
|
+
COMPONENT REGISTRY:
|
|
1633
|
+
kumo ls List all Kumo components with categories
|
|
1634
|
+
kumo doc <name> Get detailed documentation for a component
|
|
1635
|
+
kumo docs Get documentation for all components
|
|
1636
|
+
|
|
1637
|
+
MIGRATION:
|
|
1638
|
+
kumo migrate Export token rename map for codebase migration
|
|
1639
|
+
kumo migrate --classes Show class-level mappings (bg-kumo-base -> bg-kumo-base)
|
|
1640
|
+
kumo migrate --help Show migration help
|
|
1641
|
+
|
|
1642
|
+
THEMING:
|
|
1643
|
+
kumo theme <file> [-o out.css] Generate CSS from a defineTheme() module
|
|
1644
|
+
|
|
1645
|
+
AI:
|
|
1646
|
+
kumo ai Print the AI usage guide (component API reference)
|
|
1647
|
+
|
|
1648
|
+
GENERAL:
|
|
1649
|
+
kumo help Show this help message
|
|
1650
|
+
|
|
1651
|
+
Examples:
|
|
1652
|
+
kumo init
|
|
1653
|
+
kumo blocks
|
|
1654
|
+
kumo add PageHeader
|
|
1655
|
+
kumo ls
|
|
1656
|
+
kumo doc Button
|
|
1657
|
+
kumo docs
|
|
1658
|
+
kumo migrate --json > rename-map.json
|
|
1659
|
+
kumo theme ./acme-theme.ts -o src/acme-theme.css
|
|
1660
|
+
`;
|
|
1661
|
+
async function main() {
|
|
1662
|
+
const args = process.argv.slice(2);
|
|
1663
|
+
const command = args[0]?.toLowerCase();
|
|
1664
|
+
switch (command) {
|
|
1665
|
+
case "init":
|
|
1666
|
+
await init();
|
|
1667
|
+
break;
|
|
1668
|
+
case "blocks":
|
|
1669
|
+
blocks();
|
|
1670
|
+
break;
|
|
1671
|
+
case "add":
|
|
1672
|
+
await add(args[1]);
|
|
1673
|
+
break;
|
|
1674
|
+
case "ls":
|
|
1675
|
+
ls();
|
|
1676
|
+
break;
|
|
1677
|
+
case "doc":
|
|
1678
|
+
case "docs":
|
|
1679
|
+
doc(args[1]);
|
|
1680
|
+
break;
|
|
1681
|
+
case "theme":
|
|
1682
|
+
await theme(args.slice(1));
|
|
1683
|
+
break;
|
|
1684
|
+
case "migrate":
|
|
1685
|
+
migrate(args.slice(1));
|
|
1686
|
+
break;
|
|
1687
|
+
case "ai":
|
|
1688
|
+
ai();
|
|
1689
|
+
break;
|
|
1690
|
+
case "help":
|
|
1691
|
+
case "--help":
|
|
1692
|
+
case "-h":
|
|
1693
|
+
case void 0:
|
|
1694
|
+
console.log(HELP.trim());
|
|
1695
|
+
break;
|
|
1696
|
+
default:
|
|
1697
|
+
console.error(`Unknown command: ${command}`);
|
|
1698
|
+
console.log(HELP.trim());
|
|
1699
|
+
process.exit(1);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
main().catch((error) => {
|
|
1703
|
+
console.error(error);
|
|
1704
|
+
process.exit(1);
|
|
1705
|
+
});
|