@zyncat/ui 0.10.0 → 0.12.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/README.md +135 -40
- package/dist/alert.css +126 -121
- package/dist/alert.js +12 -14
- package/dist/alert.js.map +1 -1
- package/dist/avatar-group.js.map +1 -1
- package/dist/avatar.css +179 -174
- package/dist/avatar.js.map +1 -1
- package/dist/badge.css +166 -160
- package/dist/badge.js +1 -1
- package/dist/button.css +272 -246
- package/dist/button.js +1 -1
- package/dist/checkbox.css +158 -153
- package/dist/checkbox.js +2 -2
- package/dist/{chunk-UXONUUPI.js → chunk-227ZW4V7.js} +40 -32
- package/dist/chunk-227ZW4V7.js.map +1 -0
- package/dist/{chunk-2ERBBFZS.js → chunk-3MPF7FZV.js} +2 -2
- package/dist/chunk-3MPF7FZV.js.map +1 -0
- package/dist/{chunk-OMHQ4U4J.js → chunk-43M6GQ4Q.js} +86 -79
- package/dist/chunk-43M6GQ4Q.js.map +1 -0
- package/dist/{chunk-7SZCJ7WI.js → chunk-45R4Z5XN.js} +3 -3
- package/dist/chunk-45R4Z5XN.js.map +1 -0
- package/dist/{chunk-I4XQ4PV2.js → chunk-4BSHB7R3.js} +9 -7
- package/dist/chunk-4BSHB7R3.js.map +1 -0
- package/dist/{chunk-YGGCQNNU.js → chunk-4C5RZXBT.js} +33 -34
- package/dist/chunk-4C5RZXBT.js.map +1 -0
- package/dist/{chunk-2QWJ6FAX.js → chunk-5PZ43DCG.js} +31 -15
- package/dist/chunk-5PZ43DCG.js.map +1 -0
- package/dist/{chunk-S5ZTZANS.js → chunk-7IZJERGA.js} +35 -12
- package/dist/chunk-7IZJERGA.js.map +1 -0
- package/dist/{chunk-ZCOUPPTI.js → chunk-A5WTZACK.js} +22 -12
- package/dist/chunk-A5WTZACK.js.map +1 -0
- package/dist/{chunk-64UU4LGU.js → chunk-AADAJL7D.js} +3 -3
- package/dist/{chunk-64UU4LGU.js.map → chunk-AADAJL7D.js.map} +1 -1
- package/dist/{chunk-FTOAUJL5.js → chunk-CF4QHO4N.js} +21 -11
- package/dist/chunk-CF4QHO4N.js.map +1 -0
- package/dist/{chunk-WM5J5TDI.js → chunk-CNWTIMIP.js} +13 -17
- package/dist/chunk-CNWTIMIP.js.map +1 -0
- package/dist/{chunk-356HZMT4.js → chunk-DDRSMHN4.js} +31 -22
- package/dist/chunk-DDRSMHN4.js.map +1 -0
- package/dist/{chunk-VTJTGVZZ.js → chunk-DMX2F6B4.js} +2 -2
- package/dist/chunk-DMX2F6B4.js.map +1 -0
- package/dist/{chunk-3SBCBYB7.js → chunk-EAI4POPB.js} +2 -2
- package/dist/{chunk-3SBCBYB7.js.map → chunk-EAI4POPB.js.map} +1 -1
- package/dist/{chunk-Y7AJQVWJ.js → chunk-EF6RPXU7.js} +17 -15
- package/dist/chunk-EF6RPXU7.js.map +1 -0
- package/dist/{chunk-K5X2GCXU.js → chunk-FONOS5RN.js} +14 -15
- package/dist/chunk-FONOS5RN.js.map +1 -0
- package/dist/{chunk-PMECHR3A.js → chunk-FQEHSKEI.js} +2 -2
- package/dist/chunk-FQEHSKEI.js.map +1 -0
- package/dist/chunk-HDSFWZ7L.js +12 -0
- package/dist/chunk-HDSFWZ7L.js.map +1 -0
- package/dist/{chunk-2F5PITAO.js → chunk-HY5MPISE.js} +2 -2
- package/dist/chunk-HY5MPISE.js.map +1 -0
- package/dist/{chunk-QDK66S4G.js → chunk-I45AU6KH.js} +3 -3
- package/dist/chunk-I45AU6KH.js.map +1 -0
- package/dist/{chunk-YGCVWGUG.js → chunk-IJS7TPGV.js} +153 -46
- package/dist/chunk-IJS7TPGV.js.map +1 -0
- package/dist/{chunk-62P3KD57.js → chunk-IUQAUBVM.js} +18 -11
- package/dist/chunk-IUQAUBVM.js.map +1 -0
- package/dist/chunk-JY6A2ZJZ.js +44 -0
- package/dist/chunk-JY6A2ZJZ.js.map +1 -0
- package/dist/{chunk-XWUWYSCT.js → chunk-M43IOM5C.js} +20 -10
- package/dist/chunk-M43IOM5C.js.map +1 -0
- package/dist/{chunk-S7B34VGN.js → chunk-OWNMRMPN.js} +3 -3
- package/dist/{chunk-S7B34VGN.js.map → chunk-OWNMRMPN.js.map} +1 -1
- package/dist/chunk-RFRE4WKX.js +22 -0
- package/dist/chunk-RFRE4WKX.js.map +1 -0
- package/dist/{chunk-NNXJCLTV.js → chunk-RJFGWJ4W.js} +2 -2
- package/dist/chunk-RJFGWJ4W.js.map +1 -0
- package/dist/{chunk-NEF5XAHG.js → chunk-TUTXXC3W.js} +4 -4
- package/dist/chunk-TUTXXC3W.js.map +1 -0
- package/dist/chunk-TVYH4AN7.js +70 -0
- package/dist/chunk-TVYH4AN7.js.map +1 -0
- package/dist/{chunk-RCONNA7I.js → chunk-VAXCXZ53.js} +34 -22
- package/dist/chunk-VAXCXZ53.js.map +1 -0
- package/dist/chunk-XNIYSAMJ.js +52 -0
- package/dist/chunk-XNIYSAMJ.js.map +1 -0
- package/dist/{chunk-CONSWNIV.js → chunk-Y2YA7QRF.js} +6 -6
- package/dist/chunk-Y2YA7QRF.js.map +1 -0
- package/dist/cli.js +1809 -0
- package/dist/collapse.css +70 -61
- package/dist/collapse.js +2 -2
- package/dist/confetti.css +45 -0
- package/dist/confetti.js +540 -0
- package/dist/confetti.js.map +1 -0
- package/dist/count-badge.js +3 -3
- package/dist/count-badge.js.map +1 -1
- package/dist/date-field.js +24 -19
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +563 -559
- package/dist/date-range-field.js +58 -41
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +24 -19
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +176 -172
- package/dist/dialog.js +30 -19
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +65 -0
- package/dist/dropdown.css +65 -0
- package/dist/dropdown.js +350 -0
- package/dist/dropdown.js.map +1 -0
- package/dist/emoji-picker.js +713 -0
- package/dist/emoji-picker.js.map +1 -0
- package/dist/facebook-feed.css +880 -0
- package/dist/facebook-feed.js +697 -0
- package/dist/facebook-feed.js.map +1 -0
- package/dist/flow-field.css +49 -0
- package/dist/flow-field.js +269 -0
- package/dist/flow-field.js.map +1 -0
- package/dist/glide.js +3 -3
- package/dist/icon.css +34 -30
- package/dist/input.css +296 -318
- package/dist/instagram-feed.css +378 -0
- package/dist/instagram-feed.js +272 -0
- package/dist/instagram-feed.js.map +1 -0
- package/dist/lens.css +119 -0
- package/dist/lens.js +307 -0
- package/dist/lens.js.map +1 -0
- package/dist/mcp.js +379 -184
- package/dist/menu-surface.css +127 -0
- package/dist/modal.css +11 -7
- package/dist/modal.js +24 -17
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +84 -0
- package/dist/morphing-text.js +256 -0
- package/dist/morphing-text.js.map +1 -0
- package/dist/motion-devtools.css +237 -233
- package/dist/motion-devtools.js +7 -6
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +20 -17
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +11 -7
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +58 -59
- package/dist/odometer.js +109 -0
- package/dist/odometer.js.map +1 -0
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +24 -20
- package/dist/pagination.css +42 -38
- package/dist/pagination.js +6 -12
- package/dist/pagination.js.map +1 -1
- package/dist/popover.css +69 -65
- package/dist/popover.js +12 -10
- package/dist/radio-group.css +275 -276
- package/dist/radio-group.js +70 -95
- package/dist/radio-group.js.map +1 -1
- package/dist/select.css +291 -386
- package/dist/select.js +18 -15
- package/dist/select.js.map +1 -1
- package/dist/sheet.css +47 -23
- package/dist/sheet.js +11 -10
- package/dist/status-badge.js +3 -3
- package/dist/status-badge.js.map +1 -1
- package/dist/styles.css +221 -0
- package/dist/support-rail.css +421 -0
- package/dist/support-rail.js +243 -0
- package/dist/support-rail.js.map +1 -0
- package/dist/table.css +333 -323
- package/dist/table.js +32 -21
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +163 -156
- package/dist/tabs.js +26 -20
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +209 -231
- package/dist/tag.js +11 -10
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +7 -67
- package/dist/text-field.js.map +1 -1
- package/dist/textarea.css +205 -211
- package/dist/textarea.js +12 -12
- package/dist/textarea.js.map +1 -1
- package/dist/theme.js +69 -0
- package/dist/theme.js.map +1 -0
- package/dist/tiktok.css +662 -0
- package/dist/tiktok.js +494 -0
- package/dist/tiktok.js.map +1 -0
- package/dist/time-field.js +6 -6
- package/dist/time-field.js.map +1 -1
- package/dist/toast.css +237 -233
- package/dist/toast.js +43 -47
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +1 -1
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +139 -135
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +79 -78
- package/dist/tooltip.js +50 -60
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +13 -0
- package/dist/{alert.d.ts → types/components/composites/alert/Alert.d.ts} +13 -15
- package/dist/{date-field.d.ts → types/components/composites/date-picker/DateField.d.ts} +4 -10
- package/dist/types/components/composites/date-picker/DateRangeField.d.ts +21 -0
- package/dist/{datetime-field.d.ts → types/components/composites/date-picker/DateTimeField.d.ts} +4 -10
- package/dist/{time-field.d.ts → types/components/composites/date-picker/TimeField.d.ts} +5 -11
- package/dist/types/components/composites/date-picker/calendar-panel.d.ts +16 -0
- package/dist/types/components/composites/date-picker/date-utils.d.ts +12 -0
- package/dist/types/components/composites/date-picker/field-shell.d.ts +46 -0
- package/dist/types/components/composites/date-picker/range-panel.d.ts +24 -0
- package/dist/types/components/composites/date-picker/time-core.d.ts +14 -0
- package/dist/types/components/composites/date-picker/use-day-focus.d.ts +2 -0
- package/dist/{dialog.d.ts → types/components/composites/dialog/Dialog.d.ts} +10 -11
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +37 -0
- package/dist/types/components/composites/dropdown/menu-panel.d.ts +7 -0
- package/dist/types/components/composites/dropdown/types.d.ts +71 -0
- package/dist/types/components/composites/emoji-picker/EmojiPickerPanel.d.ts +45 -0
- package/dist/types/components/composites/emoji-picker/category-icons.d.ts +9 -0
- package/dist/types/components/composites/emoji-picker/data.d.ts +33 -0
- package/dist/types/components/composites/emoji-picker/dom.d.ts +19 -0
- package/dist/types/components/composites/emoji-picker/getEmojiUrl.d.ts +2 -0
- package/dist/types/components/composites/emoji-picker/navigation.d.ts +7 -0
- package/dist/types/components/composites/emoji-picker/picker.d.ts +20 -0
- package/dist/types/components/composites/emoji-picker/react/category-bar.d.ts +6 -0
- package/dist/types/components/composites/emoji-picker/react/useEmojiPicker.d.ts +50 -0
- package/dist/types/components/composites/emoji-picker/scaffold.d.ts +8 -0
- package/dist/types/components/composites/emoji-picker/search.d.ts +1 -0
- package/dist/types/components/composites/emoji-picker/types.d.ts +13 -0
- package/dist/{modal.d.ts → types/components/composites/modal/Modal.d.ts} +10 -11
- package/dist/{pagination.d.ts → types/components/composites/pagination/Pagination.d.ts} +5 -8
- package/dist/{popover.d.ts → types/components/composites/popover/Popover.d.ts} +11 -14
- package/dist/{multi-select.d.ts → types/components/composites/select/MultiSelect.d.ts} +12 -11
- package/dist/{select.d.ts → types/components/composites/select/Select.d.ts} +16 -14
- package/dist/types/components/composites/select/core/index.d.ts +4 -0
- package/dist/types/components/composites/select/core/menu.d.ts +13 -0
- package/dist/types/components/composites/select/core/panel.d.ts +18 -0
- package/dist/types/components/composites/select/core/trigger.d.ts +16 -0
- package/dist/{types-SGMShK7R.d.ts → types/components/composites/select/core/types.d.ts} +13 -6
- package/dist/types/components/composites/select/core/use-listbox.d.ts +42 -0
- package/dist/{sheet.d.ts → types/components/composites/sheet/Sheet.d.ts} +10 -11
- package/dist/types/components/composites/sheet/use-sheet-drag.d.ts +13 -0
- package/dist/{table.d.ts → types/components/composites/table/Table.d.ts} +12 -12
- package/dist/{tabs.d.ts → types/components/composites/tabs/Tabs.d.ts} +13 -13
- package/dist/types/components/composites/toast/Toast.d.ts +10 -0
- package/dist/{toast-store.d.ts → types/components/composites/toast/toast-store.d.ts} +12 -14
- package/dist/{tooltip.d.ts → types/components/composites/tooltip/Tooltip.d.ts} +6 -10
- package/dist/types/components/composites/tooltip/tooltip-host.d.ts +1 -0
- package/dist/types/components/composites/tooltip/tooltip-store.d.ts +29 -0
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +41 -0
- package/dist/types/components/dev/MotionDevtools.d.ts +24 -0
- package/dist/types/components/dev/slowmo-engine.d.ts +27 -0
- package/dist/types/components/expressive/confetti/Confetti.d.ts +43 -0
- package/dist/types/components/expressive/facebook-feed/FacebookFeed.d.ts +73 -0
- package/dist/types/components/expressive/facebook-feed/chrome.d.ts +30 -0
- package/dist/types/components/expressive/facebook-feed/icons.d.ts +21 -0
- package/dist/types/components/expressive/facebook-feed/post.d.ts +25 -0
- package/dist/types/components/expressive/facebook-feed/reel.d.ts +26 -0
- package/dist/types/components/expressive/facebook-feed/story.d.ts +20 -0
- package/dist/types/components/expressive/flow-field/FlowField.d.ts +23 -0
- package/dist/types/components/expressive/instagram-feed/InstagramFeed.d.ts +59 -0
- package/dist/types/components/expressive/lens/Lens.d.ts +23 -0
- package/dist/types/components/expressive/morphing-text/MorphingText.d.ts +21 -0
- package/dist/types/components/expressive/odometer/Odometer.d.ts +21 -0
- package/dist/types/components/expressive/tiktok/TikTok.d.ts +85 -0
- package/dist/types/components/expressive/tiktok/glyphs.d.ts +40 -0
- package/dist/types/components/expressive/typing-lines/TypingLines.d.ts +25 -0
- package/dist/types/components/expressive/weight-field/WeightField.d.ts +19 -0
- package/dist/types/components/expressive/youtube/YouTube.d.ts +73 -0
- package/dist/types/components/expressive/youtube/format.d.ts +2 -0
- package/dist/types/components/expressive/youtube/glyphs.d.ts +16 -0
- package/dist/types/components/expressive/youtube/media.d.ts +8 -0
- package/dist/types/components/expressive/youtube/post.d.ts +19 -0
- package/dist/types/components/expressive/youtube/short.d.ts +18 -0
- package/dist/types/components/expressive/youtube/video.d.ts +14 -0
- package/dist/types/components/internal/collection/collection.d.ts +19 -0
- package/dist/types/components/internal/glass/glint.d.ts +1 -0
- package/dist/types/components/internal/hooks/use-controllable.d.ts +1 -0
- package/dist/types/components/internal/hooks/use-media-query.d.ts +1 -0
- package/dist/types/components/internal/hooks/use-scroll-edges.d.ts +10 -0
- package/dist/types/components/internal/hooks/use-typeahead.d.ts +5 -0
- package/dist/types/components/internal/icon/Icon.d.ts +33 -0
- package/dist/types/components/internal/icon/IconSlot.d.ts +7 -0
- package/dist/types/components/internal/menu/menu-row.d.ts +11 -0
- package/dist/types/components/internal/overlay/focus.d.ts +8 -0
- package/dist/types/components/internal/overlay/layer.d.ts +38 -0
- package/dist/types/components/internal/overlay/modal.d.ts +18 -0
- package/dist/types/components/internal/overlay/position.d.ts +14 -0
- package/dist/types/components/internal/support/types.d.ts +15 -0
- package/dist/types/components/internal/utils/activation.d.ts +23 -0
- package/dist/types/components/internal/utils/cx.d.ts +1 -0
- package/dist/types/components/internal/utils/token-px.d.ts +1 -0
- package/dist/{avatar.d.ts → types/components/primitives/avatar/Avatar.d.ts} +10 -12
- package/dist/{avatar-group.d.ts → types/components/primitives/avatar/AvatarGroup.d.ts} +7 -9
- package/dist/{badge.d.ts → types/components/primitives/badge/Badge.d.ts} +8 -10
- package/dist/types/components/primitives/badge/CountBadge.d.ts +8 -0
- package/dist/types/components/primitives/badge/StatusBadge.d.ts +15 -0
- package/dist/types/components/primitives/badge/digit-strip.d.ts +5 -0
- package/dist/{button.d.ts → types/components/primitives/button/Button.d.ts} +6 -8
- package/dist/{checkbox.d.ts → types/components/primitives/checkbox/Checkbox.d.ts} +6 -8
- package/dist/types/components/primitives/checkbox/check-glyph.d.ts +6 -0
- package/dist/{collapse.d.ts → types/components/primitives/collapse/Collapse.d.ts} +12 -13
- package/dist/types/components/primitives/collapse/collapse.typecheck.d.ts +2 -0
- package/dist/{number-field.d.ts → types/components/primitives/input/NumberField.d.ts} +7 -9
- package/dist/{otp-field.d.ts → types/components/primitives/input/OtpField.d.ts} +6 -8
- package/dist/{text-field.d.ts → types/components/primitives/input/TextField.d.ts} +7 -9
- package/dist/types/components/primitives/input/field-chrome.d.ts +45 -0
- package/dist/{radio-group.d.ts → types/components/primitives/radio-group/RadioGroup.d.ts} +8 -10
- package/dist/{tag.d.ts → types/components/primitives/tag/Tag.d.ts} +9 -12
- package/dist/{toggle-tag.d.ts → types/components/primitives/tag/ToggleTag.d.ts} +7 -8
- package/dist/{textarea.d.ts → types/components/primitives/textarea/Textarea.d.ts} +7 -9
- package/dist/{toggle.d.ts → types/components/primitives/toggle/Toggle.d.ts} +6 -8
- package/dist/{dom-props-C0jrllBw.d.ts → types/dom-props.d.ts} +1 -3
- package/dist/types/engine/animate.d.ts +30 -0
- package/dist/types/engine/drag.d.ts +17 -0
- package/dist/types/engine/ease.d.ts +15 -0
- package/dist/types/engine/flip.d.ts +18 -0
- package/dist/types/engine/index.d.ts +4 -0
- package/dist/types/engine/loop.d.ts +9 -0
- package/dist/types/motion/element.d.ts +17 -0
- package/dist/types/motion/flip.d.ts +4 -0
- package/dist/types/motion/glide.d.ts +11 -0
- package/dist/types/motion/motion-timing.d.ts +16 -0
- package/dist/types/motion/presence-context.d.ts +11 -0
- package/dist/types/motion/presence.d.ts +12 -0
- package/dist/types/motion/presets.d.ts +6 -0
- package/dist/{timing-7JA_zQHP.d.ts → types/motion/timing.d.ts} +9 -9
- package/dist/types/motion/use-motion.d.ts +17 -0
- package/dist/types/tokens/component-styles.generated.d.ts +262 -0
- package/dist/{motion-scale-Canq4stZ.d.ts → types/tokens/motion-scale.d.ts} +4 -4
- package/dist/{motion-tokens.d.ts → types/tokens/motion-tokens.d.ts} +9 -9
- package/dist/types/tokens/theme-tokens.generated.d.ts +1249 -0
- package/dist/types/tokens/theme.d.ts +12 -0
- package/dist/typing-lines.css +92 -0
- package/dist/typing-lines.js +139 -0
- package/dist/typing-lines.js.map +1 -0
- package/dist/weight-field.css +84 -0
- package/dist/weight-field.js +17 -0
- package/dist/weight-field.js.map +1 -0
- package/dist/youtube.css +611 -0
- package/dist/youtube.js +814 -0
- package/dist/youtube.js.map +1 -0
- package/package.json +155 -49
- package/skills/zyncat-ui/SKILL.md +95 -0
- package/skills/zyncat-ui/references/components.md +85 -0
- package/skills/zyncat-ui/references/recipes.md +171 -0
- package/skills/zyncat-ui/references/theming.md +83 -0
- package/src/components/composites/alert/Alert.tsx +13 -11
- package/src/components/composites/alert/Alert.usage.md +15 -0
- package/src/components/composites/alert/alert.css +126 -121
- package/src/components/composites/date-picker/DateField.tsx +7 -2
- package/src/components/composites/date-picker/DateField.usage.md +10 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +18 -16
- package/src/components/composites/date-picker/DateRangeField.usage.md +10 -0
- package/src/components/composites/date-picker/DateTimeField.tsx +10 -5
- package/src/components/composites/date-picker/DateTimeField.usage.md +12 -0
- package/src/components/composites/date-picker/TimeField.tsx +3 -1
- package/src/components/composites/date-picker/TimeField.usage.md +12 -0
- package/src/components/composites/date-picker/calendar-panel.tsx +15 -10
- package/src/components/composites/date-picker/date-picker.css +563 -559
- package/src/components/composites/date-picker/field-shell.tsx +9 -3
- package/src/components/composites/date-picker/range-panel.tsx +23 -8
- package/src/components/composites/date-picker/time-core.tsx +2 -0
- package/src/components/composites/dialog/Dialog.tsx +30 -15
- package/src/components/composites/dialog/Dialog.usage.md +17 -0
- package/src/components/composites/dialog/dialog.css +176 -172
- package/src/components/composites/dropdown/Dropdown.tsx +184 -0
- package/src/components/composites/dropdown/Dropdown.usage.md +19 -0
- package/src/components/composites/dropdown/dropdown.css +65 -0
- package/src/components/composites/dropdown/menu-panel.tsx +255 -0
- package/src/components/composites/dropdown/types.ts +95 -0
- package/src/components/composites/emoji-picker/EmojiPickerPanel.tsx +153 -0
- package/src/components/composites/emoji-picker/EmojiPickerPanel.usage.md +26 -0
- package/src/components/composites/emoji-picker/category-icons.ts +29 -0
- package/src/components/composites/emoji-picker/data.ts +83 -0
- package/src/components/composites/emoji-picker/dom.ts +79 -0
- package/src/components/composites/emoji-picker/getEmojiUrl.ts +17 -0
- package/src/components/composites/emoji-picker/navigation.ts +86 -0
- package/src/components/composites/emoji-picker/picker.ts +169 -0
- package/src/components/composites/emoji-picker/react/category-bar.tsx +77 -0
- package/src/components/composites/emoji-picker/react/useEmojiPicker.ts +139 -0
- package/src/components/composites/emoji-picker/scaffold.ts +74 -0
- package/src/components/composites/emoji-picker/search.ts +79 -0
- package/src/components/composites/emoji-picker/styles.css +221 -0
- package/src/components/composites/emoji-picker/types.ts +14 -0
- package/src/components/composites/modal/Modal.tsx +24 -13
- package/src/components/composites/modal/Modal.usage.md +24 -0
- package/src/components/composites/modal/modal.css +11 -7
- package/src/components/composites/pagination/Pagination.tsx +6 -11
- package/src/components/composites/pagination/Pagination.usage.md +12 -0
- package/src/components/composites/pagination/pagination.css +42 -38
- package/src/components/composites/popover/Popover.tsx +22 -7
- package/src/components/composites/popover/Popover.usage.md +15 -0
- package/src/components/composites/popover/popover.css +69 -65
- package/src/components/composites/select/MultiSelect.tsx +13 -5
- package/src/components/composites/select/MultiSelect.usage.md +12 -0
- package/src/components/composites/select/Select.tsx +23 -7
- package/src/components/composites/select/Select.usage.md +20 -0
- package/src/components/composites/select/core/index.ts +1 -1
- package/src/components/composites/select/core/menu.tsx +8 -6
- package/src/components/composites/select/core/panel.tsx +25 -26
- package/src/components/composites/select/core/trigger.tsx +36 -24
- package/src/components/composites/select/core/types.ts +17 -15
- package/src/components/composites/select/core/use-listbox.ts +22 -21
- package/src/components/composites/select/select.css +291 -386
- package/src/components/composites/sheet/Sheet.tsx +28 -18
- package/src/components/composites/sheet/Sheet.usage.md +15 -0
- package/src/components/composites/sheet/sheet.css +47 -23
- package/src/components/composites/sheet/use-sheet-drag.ts +19 -15
- package/src/components/composites/table/Table.tsx +17 -6
- package/src/components/composites/table/Table.usage.md +19 -0
- package/src/components/composites/table/table.css +333 -323
- package/src/components/composites/tabs/Tabs.tsx +31 -23
- package/src/components/composites/tabs/Tabs.usage.md +13 -0
- package/src/components/composites/tabs/tabs.css +163 -156
- package/src/components/composites/toast/Toast.tsx +48 -51
- package/src/components/composites/toast/Toast.usage.md +23 -0
- package/src/components/composites/toast/toast-store.usage.md +16 -0
- package/src/components/composites/toast/toast.css +237 -233
- package/src/components/composites/tooltip/Tooltip.tsx +13 -8
- package/src/components/composites/tooltip/Tooltip.usage.md +14 -0
- package/src/components/composites/tooltip/tooltip-host.tsx +29 -61
- package/src/components/composites/tooltip/tooltip-store.ts +10 -0
- package/src/components/composites/tooltip/tooltip.css +79 -78
- package/src/components/compound/support-rail/SupportRail.tsx +343 -0
- package/src/components/compound/support-rail/SupportRail.usage.md +18 -0
- package/src/components/compound/support-rail/support-rail.css +421 -0
- package/src/components/dev/MotionDevtools.tsx +3 -1
- package/src/components/dev/MotionDevtools.usage.md +16 -0
- package/src/components/dev/motion-devtools.css +237 -233
- package/src/components/expressive/confetti/Confetti.tsx +727 -0
- package/src/components/expressive/confetti/Confetti.usage.md +18 -0
- package/src/components/expressive/confetti/confetti.css +45 -0
- package/src/components/expressive/facebook-feed/FacebookFeed.tsx +200 -0
- package/src/components/expressive/facebook-feed/FacebookFeed.usage.md +18 -0
- package/src/components/expressive/facebook-feed/chrome.tsx +120 -0
- package/src/components/expressive/facebook-feed/facebook-feed.css +880 -0
- package/src/components/expressive/facebook-feed/icons.tsx +145 -0
- package/src/components/expressive/facebook-feed/post.tsx +213 -0
- package/src/components/expressive/facebook-feed/reel.tsx +199 -0
- package/src/components/expressive/facebook-feed/story.tsx +132 -0
- package/src/components/expressive/flow-field/FlowField.tsx +348 -0
- package/src/components/expressive/flow-field/FlowField.usage.md +19 -0
- package/src/components/expressive/flow-field/flow-field.css +49 -0
- package/src/components/expressive/instagram-feed/InstagramFeed.tsx +374 -0
- package/src/components/expressive/instagram-feed/InstagramFeed.usage.md +18 -0
- package/src/components/expressive/instagram-feed/instagram-feed.css +378 -0
- package/src/components/expressive/lens/Lens.tsx +415 -0
- package/src/components/expressive/lens/Lens.usage.md +20 -0
- package/src/components/expressive/lens/lens.css +119 -0
- package/src/components/expressive/morphing-text/MorphingText.tsx +328 -0
- package/src/components/expressive/morphing-text/MorphingText.usage.md +19 -0
- package/src/components/expressive/morphing-text/morphing-text.css +84 -0
- package/src/components/expressive/odometer/Odometer.tsx +158 -0
- package/src/components/expressive/odometer/Odometer.usage.md +17 -0
- package/src/components/expressive/odometer/odometer.css +61 -0
- package/src/components/expressive/tiktok/TikTok.tsx +542 -0
- package/src/components/expressive/tiktok/TikTok.usage.md +17 -0
- package/src/components/expressive/tiktok/glyphs.tsx +163 -0
- package/src/components/expressive/tiktok/tiktok.css +662 -0
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/TypingLines.usage.md +17 -0
- package/src/components/expressive/typing-lines/typing-lines.css +92 -0
- package/src/components/expressive/weight-field/WeightField.tsx +41 -0
- package/src/components/expressive/weight-field/WeightField.usage.md +20 -0
- package/src/components/expressive/weight-field/weight-field.css +84 -0
- package/src/components/expressive/youtube/YouTube.tsx +192 -0
- package/src/components/expressive/youtube/YouTube.usage.md +18 -0
- package/src/components/expressive/youtube/format.ts +22 -0
- package/src/components/expressive/youtube/glyphs.tsx +235 -0
- package/src/components/expressive/youtube/media.tsx +18 -0
- package/src/components/expressive/youtube/post.tsx +282 -0
- package/src/components/expressive/youtube/short.tsx +212 -0
- package/src/components/expressive/youtube/video.tsx +75 -0
- package/src/components/expressive/youtube/youtube.css +611 -0
- package/src/components/internal/collection/collection.ts +44 -0
- package/src/components/internal/glass/glass.css +88 -84
- package/src/components/internal/hooks/use-media-query.ts +20 -0
- package/src/components/internal/hooks/use-typeahead.ts +28 -0
- package/src/components/internal/icon/Icon.tsx +2 -0
- package/src/components/internal/icon/IconSlot.tsx +2 -0
- package/src/components/internal/icon/icon.css +34 -30
- package/src/components/internal/menu/menu-row.tsx +34 -0
- package/src/components/internal/menu/menu-surface.css +127 -0
- package/src/components/internal/overlay/focus.ts +26 -10
- package/src/components/internal/overlay/layer.tsx +50 -19
- package/src/components/internal/overlay/modal.tsx +14 -12
- package/src/components/internal/overlay/overlay.css +24 -20
- package/src/components/internal/overlay/position.ts +19 -9
- package/src/components/internal/overlay/trigger.css +13 -0
- package/src/components/internal/support/types.ts +16 -0
- package/src/components/internal/utils/activation.ts +78 -0
- package/src/components/primitives/avatar/Avatar.tsx +2 -0
- package/src/components/primitives/avatar/Avatar.usage.md +12 -0
- package/src/components/primitives/avatar/AvatarGroup.tsx +3 -1
- package/src/components/primitives/avatar/AvatarGroup.usage.md +15 -0
- package/src/components/primitives/avatar/avatar.css +179 -174
- package/src/components/primitives/badge/Badge.tsx +3 -1
- package/src/components/primitives/badge/Badge.usage.md +14 -0
- package/src/components/primitives/badge/CountBadge.tsx +2 -2
- package/src/components/primitives/badge/CountBadge.usage.md +13 -0
- package/src/components/primitives/badge/StatusBadge.tsx +3 -1
- package/src/components/primitives/badge/StatusBadge.usage.md +14 -0
- package/src/components/primitives/badge/badge.css +166 -160
- package/src/components/primitives/badge/digit-strip.css +65 -0
- package/src/components/primitives/badge/{odometer.tsx → digit-strip.tsx} +3 -3
- package/src/components/primitives/button/Button.tsx +2 -0
- package/src/components/primitives/button/Button.usage.md +14 -0
- package/src/components/primitives/button/button.css +272 -246
- package/src/components/primitives/checkbox/Checkbox.tsx +3 -1
- package/src/components/primitives/checkbox/Checkbox.usage.md +12 -0
- package/src/components/primitives/checkbox/check-glyph.tsx +1 -0
- package/src/components/primitives/checkbox/checkbox.css +158 -153
- package/src/components/primitives/collapse/Collapse.tsx +3 -1
- package/src/components/primitives/collapse/Collapse.usage.md +17 -0
- package/src/components/primitives/collapse/collapse.css +70 -61
- package/src/components/primitives/collapse/collapse.typecheck.tsx +2 -0
- package/src/components/primitives/input/NumberField.tsx +18 -5
- package/src/components/primitives/input/NumberField.usage.md +12 -0
- package/src/components/primitives/input/OtpField.tsx +2 -0
- package/src/components/primitives/input/OtpField.usage.md +12 -0
- package/src/components/primitives/input/TextField.tsx +16 -4
- package/src/components/primitives/input/TextField.usage.md +13 -0
- package/src/components/primitives/input/field-chrome.tsx +11 -2
- package/src/components/primitives/input/input.css +296 -318
- package/src/components/primitives/radio-group/RadioGroup.tsx +20 -44
- package/src/components/primitives/radio-group/RadioGroup.usage.md +13 -0
- package/src/components/primitives/radio-group/radio-group.css +275 -276
- package/src/components/primitives/tag/Tag.tsx +10 -6
- package/src/components/primitives/tag/Tag.usage.md +14 -0
- package/src/components/primitives/tag/ToggleTag.tsx +4 -2
- package/src/components/primitives/tag/ToggleTag.usage.md +14 -0
- package/src/components/primitives/tag/tag.css +209 -231
- package/src/components/primitives/textarea/Textarea.tsx +17 -7
- package/src/components/primitives/textarea/Textarea.usage.md +12 -0
- package/src/components/primitives/textarea/textarea.css +205 -211
- package/src/components/primitives/toggle/Toggle.tsx +3 -1
- package/src/components/primitives/toggle/Toggle.usage.md +12 -0
- package/src/components/primitives/toggle/toggle.css +139 -135
- package/src/engine/animate.ts +40 -13
- package/src/engine/ease.ts +1 -0
- package/src/engine/flip.ts +32 -15
- package/src/engine/index.ts +2 -1
- package/src/engine/loop.ts +97 -0
- package/src/mcp/server.ts +315 -221
- package/src/motion/element.tsx +1 -0
- package/src/motion/flip.ts +29 -10
- package/src/motion/glide.tsx +11 -14
- package/src/motion/glide.usage.md +15 -0
- package/src/motion/motion-timing.ts +3 -3
- package/src/motion/presence.tsx +38 -21
- package/src/motion/presets.ts +13 -0
- package/src/motion/timing.ts +1 -0
- package/src/motion/use-motion.ts +16 -3
- package/src/styles.css +5 -0
- package/src/tokens/avatar.css +20 -16
- package/src/tokens/color.css +67 -56
- package/src/tokens/component-styles.generated.ts +270 -0
- package/src/tokens/elevation.css +28 -17
- package/src/tokens/fonts.css +1 -1
- package/src/tokens/glass.css +19 -15
- package/src/tokens/icons.css +8 -4
- package/src/tokens/layers.css +9 -4
- package/src/tokens/motion-scale.ts +4 -0
- package/src/tokens/motion-tokens.ts +42 -12
- package/src/tokens/motion-tokens.usage.md +16 -0
- package/src/tokens/motion.css +63 -45
- package/src/tokens/radius.css +12 -8
- package/src/tokens/semantic.css +62 -54
- package/src/tokens/spacing.css +25 -21
- package/src/tokens/theme-tokens.generated.ts +1278 -0
- package/src/tokens/theme.tsx +83 -0
- package/src/tokens/theme.usage.md +36 -0
- package/src/tokens/typography.css +53 -49
- package/dist/chunk-2ERBBFZS.js.map +0 -1
- package/dist/chunk-2F5PITAO.js.map +0 -1
- package/dist/chunk-2QWJ6FAX.js.map +0 -1
- package/dist/chunk-356HZMT4.js.map +0 -1
- package/dist/chunk-62P3KD57.js.map +0 -1
- package/dist/chunk-7SZCJ7WI.js.map +0 -1
- package/dist/chunk-CONSWNIV.js.map +0 -1
- package/dist/chunk-FTOAUJL5.js.map +0 -1
- package/dist/chunk-I4XQ4PV2.js.map +0 -1
- package/dist/chunk-K5X2GCXU.js.map +0 -1
- package/dist/chunk-NEF5XAHG.js.map +0 -1
- package/dist/chunk-NNXJCLTV.js.map +0 -1
- package/dist/chunk-OMHQ4U4J.js.map +0 -1
- package/dist/chunk-PMECHR3A.js.map +0 -1
- package/dist/chunk-QDK66S4G.js.map +0 -1
- package/dist/chunk-RCONNA7I.js.map +0 -1
- package/dist/chunk-S5ZTZANS.js.map +0 -1
- package/dist/chunk-UXONUUPI.js.map +0 -1
- package/dist/chunk-VTJTGVZZ.js.map +0 -1
- package/dist/chunk-WM5J5TDI.js.map +0 -1
- package/dist/chunk-XWUWYSCT.js.map +0 -1
- package/dist/chunk-Y7AJQVWJ.js.map +0 -1
- package/dist/chunk-YGCVWGUG.js.map +0 -1
- package/dist/chunk-YGGCQNNU.js.map +0 -1
- package/dist/chunk-ZCOUPPTI.js.map +0 -1
- package/dist/count-badge.d.ts +0 -13
- package/dist/date-range-field.d.ts +0 -33
- package/dist/field-chrome-CMPOQSLs.d.ts +0 -28
- package/dist/field-shell-Cuda-feL.d.ts +0 -24
- package/dist/glide.d.ts +0 -15
- package/dist/motion-devtools.d.ts +0 -51
- package/dist/status-badge.d.ts +0 -19
- package/dist/toast.d.ts +0 -12
- package/llms.txt +0 -220
- package/src/components/primitives/badge/odometer.css +0 -62
package/dist/cli.js
ADDED
|
@@ -0,0 +1,1809 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
// ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
29
|
+
var require_src = __commonJS({
|
|
30
|
+
"../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
31
|
+
"use strict";
|
|
32
|
+
var ESC2 = "\x1B";
|
|
33
|
+
var CSI2 = `${ESC2}[`;
|
|
34
|
+
var beep = "\x07";
|
|
35
|
+
var cursor3 = {
|
|
36
|
+
to(x, y) {
|
|
37
|
+
if (!y) return `${CSI2}${x + 1}G`;
|
|
38
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
39
|
+
},
|
|
40
|
+
move(x, y) {
|
|
41
|
+
let ret = "";
|
|
42
|
+
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
43
|
+
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
44
|
+
if (y < 0) ret += `${CSI2}${-y}A`;
|
|
45
|
+
else if (y > 0) ret += `${CSI2}${y}B`;
|
|
46
|
+
return ret;
|
|
47
|
+
},
|
|
48
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
49
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
50
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
51
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
52
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
53
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
54
|
+
left: `${CSI2}G`,
|
|
55
|
+
hide: `${CSI2}?25l`,
|
|
56
|
+
show: `${CSI2}?25h`,
|
|
57
|
+
save: `${ESC2}7`,
|
|
58
|
+
restore: `${ESC2}8`
|
|
59
|
+
};
|
|
60
|
+
var scroll = {
|
|
61
|
+
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
62
|
+
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
63
|
+
};
|
|
64
|
+
var erase3 = {
|
|
65
|
+
screen: `${CSI2}2J`,
|
|
66
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
67
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
68
|
+
line: `${CSI2}2K`,
|
|
69
|
+
lineEnd: `${CSI2}K`,
|
|
70
|
+
lineStart: `${CSI2}1K`,
|
|
71
|
+
lines(count) {
|
|
72
|
+
let clear = "";
|
|
73
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
74
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
75
|
+
if (count)
|
|
76
|
+
clear += cursor3.left;
|
|
77
|
+
return clear;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
85
|
+
var require_picocolors = __commonJS({
|
|
86
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
87
|
+
"use strict";
|
|
88
|
+
var p = process || {};
|
|
89
|
+
var argv = p.argv || [];
|
|
90
|
+
var env2 = p.env || {};
|
|
91
|
+
var isColorSupported = !(!!env2.NO_COLOR || argv.includes("--no-color")) && (!!env2.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
|
|
92
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
93
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
94
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
95
|
+
};
|
|
96
|
+
var replaceClose = (string, close, replace, index) => {
|
|
97
|
+
let result = "", cursor3 = 0;
|
|
98
|
+
do {
|
|
99
|
+
result += string.substring(cursor3, index) + replace;
|
|
100
|
+
cursor3 = index + close.length;
|
|
101
|
+
index = string.indexOf(close, cursor3);
|
|
102
|
+
} while (~index);
|
|
103
|
+
return result + string.substring(cursor3);
|
|
104
|
+
};
|
|
105
|
+
var createColors = (enabled = isColorSupported) => {
|
|
106
|
+
let f = enabled ? formatter : () => String;
|
|
107
|
+
return {
|
|
108
|
+
isColorSupported: enabled,
|
|
109
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
110
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
111
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
112
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
113
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
114
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
115
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
116
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
117
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
118
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
119
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
120
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
121
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
122
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
123
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
124
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
125
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
126
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
127
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
128
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
129
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
130
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
131
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
132
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
133
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
134
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
135
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
136
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
137
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
138
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
139
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
140
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
141
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
142
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
143
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
144
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
145
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
146
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
147
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
148
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
149
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
module.exports = createColors();
|
|
153
|
+
module.exports.createColors = createColors;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// src/detect.ts
|
|
158
|
+
import { spawnSync } from "child_process";
|
|
159
|
+
import { existsSync, readFileSync } from "fs";
|
|
160
|
+
import { dirname, join } from "path";
|
|
161
|
+
import { fileURLToPath } from "url";
|
|
162
|
+
var PACKAGE_MANAGERS = ["pnpm", "npm", "yarn", "bun"];
|
|
163
|
+
function readJson(path) {
|
|
164
|
+
try {
|
|
165
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
166
|
+
} catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
var OWN_NAMES = /* @__PURE__ */ new Set(["@zyncat/ui", "zyncat-ui"]);
|
|
171
|
+
function findOwnRoot() {
|
|
172
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
173
|
+
for (; ; ) {
|
|
174
|
+
const pkg = readJson(join(dir, "package.json"));
|
|
175
|
+
if (pkg?.name && OWN_NAMES.has(pkg.name)) return { root: dir, version: pkg.version ?? "0.0.0" };
|
|
176
|
+
const parent = dirname(dir);
|
|
177
|
+
if (parent === dir) throw new Error("zyncat-ui package root not found");
|
|
178
|
+
dir = parent;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
var LOCKFILES = [
|
|
182
|
+
["pnpm-lock.yaml", "pnpm"],
|
|
183
|
+
["yarn.lock", "yarn"],
|
|
184
|
+
["bun.lock", "bun"],
|
|
185
|
+
["bun.lockb", "bun"],
|
|
186
|
+
["package-lock.json", "npm"]
|
|
187
|
+
];
|
|
188
|
+
function lockfilePm(start) {
|
|
189
|
+
for (let dir = start; ; dir = dirname(dir)) {
|
|
190
|
+
for (const [file, pm] of LOCKFILES) if (existsSync(join(dir, file))) return pm;
|
|
191
|
+
if (existsSync(join(dir, ".git")) || dirname(dir) === dir) return null;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function userAgentPm() {
|
|
195
|
+
const agent = process.env.npm_config_user_agent ?? "";
|
|
196
|
+
const name = agent.split("/")[0];
|
|
197
|
+
return PACKAGE_MANAGERS.includes(name) ? name : null;
|
|
198
|
+
}
|
|
199
|
+
function detectPm(cwd, targetPkg) {
|
|
200
|
+
const fromLockfile = lockfilePm(cwd);
|
|
201
|
+
if (fromLockfile) return fromLockfile;
|
|
202
|
+
const fromField = targetPkg?.packageManager?.split("@")[0];
|
|
203
|
+
if (PACKAGE_MANAGERS.includes(fromField)) return fromField;
|
|
204
|
+
return userAgentPm();
|
|
205
|
+
}
|
|
206
|
+
function pmVersion(pm) {
|
|
207
|
+
const result = spawnSync(pm, ["--version"], { encoding: "utf8", shell: process.platform === "win32", timeout: 5e3 });
|
|
208
|
+
const version2 = result.stdout?.trim().split("\n").at(-1);
|
|
209
|
+
return result.status === 0 && version2 ? version2 : null;
|
|
210
|
+
}
|
|
211
|
+
function majorOf(range) {
|
|
212
|
+
const match = range?.match(/\d+/);
|
|
213
|
+
return match ? Number(match[0]) : null;
|
|
214
|
+
}
|
|
215
|
+
function installedVersion(cwd, name) {
|
|
216
|
+
return readJson(join(cwd, "node_modules", name, "package.json"))?.version ?? null;
|
|
217
|
+
}
|
|
218
|
+
var ENTRY_CANDIDATES = [
|
|
219
|
+
"app/layout.tsx",
|
|
220
|
+
"app/layout.jsx",
|
|
221
|
+
"src/app/layout.tsx",
|
|
222
|
+
"src/app/layout.jsx",
|
|
223
|
+
"src/main.tsx",
|
|
224
|
+
"src/main.jsx",
|
|
225
|
+
"src/index.tsx",
|
|
226
|
+
"src/index.jsx",
|
|
227
|
+
"app/root.tsx",
|
|
228
|
+
"src/root.tsx"
|
|
229
|
+
];
|
|
230
|
+
function findAppEntry(cwd) {
|
|
231
|
+
for (const candidate of ENTRY_CANDIDATES) if (existsSync(join(cwd, candidate))) return candidate;
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/init.ts
|
|
236
|
+
import { cpSync, existsSync as existsSync3, mkdirSync, readdirSync as readdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
237
|
+
import { join as join3 } from "path";
|
|
238
|
+
|
|
239
|
+
// ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
|
|
240
|
+
import { styleText } from "util";
|
|
241
|
+
import { stdout, stdin } from "process";
|
|
242
|
+
import * as l from "readline";
|
|
243
|
+
import l__default from "readline";
|
|
244
|
+
|
|
245
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
246
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
247
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
248
|
+
return (input) => {
|
|
249
|
+
let surrogatePairsNr = 0;
|
|
250
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
251
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
252
|
+
surrogatePairsNr += 1;
|
|
253
|
+
}
|
|
254
|
+
return input.length - surrogatePairsNr;
|
|
255
|
+
};
|
|
256
|
+
})();
|
|
257
|
+
var isFullWidth = (x) => {
|
|
258
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
259
|
+
};
|
|
260
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
261
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
265
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
266
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
267
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
268
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
269
|
+
var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
270
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
271
|
+
var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
272
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
273
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
274
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
275
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
276
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
277
|
+
const ANSI_WIDTH = 0;
|
|
278
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
279
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
280
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
281
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
282
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
283
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
284
|
+
const PARSE_BLOCKS = [
|
|
285
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
286
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
287
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
288
|
+
[TAB_RE, TAB_WIDTH],
|
|
289
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
290
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
291
|
+
];
|
|
292
|
+
let indexPrev = 0;
|
|
293
|
+
let index = 0;
|
|
294
|
+
let length = input.length;
|
|
295
|
+
let lengthExtra = 0;
|
|
296
|
+
let truncationEnabled = false;
|
|
297
|
+
let truncationIndex = length;
|
|
298
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
299
|
+
let unmatchedStart = 0;
|
|
300
|
+
let unmatchedEnd = 0;
|
|
301
|
+
let width = 0;
|
|
302
|
+
let widthExtra = 0;
|
|
303
|
+
outer: while (true) {
|
|
304
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
305
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
306
|
+
lengthExtra = 0;
|
|
307
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
308
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
309
|
+
if (isFullWidth(codePoint)) {
|
|
310
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
311
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
312
|
+
widthExtra = WIDE_WIDTH;
|
|
313
|
+
} else {
|
|
314
|
+
widthExtra = REGULAR_WIDTH;
|
|
315
|
+
}
|
|
316
|
+
if (width + widthExtra > truncationLimit) {
|
|
317
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
318
|
+
}
|
|
319
|
+
if (width + widthExtra > LIMIT) {
|
|
320
|
+
truncationEnabled = true;
|
|
321
|
+
break outer;
|
|
322
|
+
}
|
|
323
|
+
lengthExtra += char.length;
|
|
324
|
+
width += widthExtra;
|
|
325
|
+
}
|
|
326
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
327
|
+
}
|
|
328
|
+
if (index >= length) {
|
|
329
|
+
break outer;
|
|
330
|
+
}
|
|
331
|
+
for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
|
|
332
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
333
|
+
BLOCK_RE.lastIndex = index;
|
|
334
|
+
if (BLOCK_RE.test(input)) {
|
|
335
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
336
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
337
|
+
if (width + widthExtra > truncationLimit) {
|
|
338
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
339
|
+
}
|
|
340
|
+
if (width + widthExtra > LIMIT) {
|
|
341
|
+
truncationEnabled = true;
|
|
342
|
+
break outer;
|
|
343
|
+
}
|
|
344
|
+
width += widthExtra;
|
|
345
|
+
unmatchedStart = indexPrev;
|
|
346
|
+
unmatchedEnd = index;
|
|
347
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
348
|
+
continue outer;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
index += 1;
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
355
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
356
|
+
truncated: truncationEnabled,
|
|
357
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
var dist_default = getStringTruncatedWidth;
|
|
361
|
+
|
|
362
|
+
// ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
363
|
+
var NO_TRUNCATION2 = {
|
|
364
|
+
limit: Infinity,
|
|
365
|
+
ellipsis: "",
|
|
366
|
+
ellipsisWidth: 0
|
|
367
|
+
};
|
|
368
|
+
var fastStringWidth = (input, options = {}) => {
|
|
369
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
370
|
+
};
|
|
371
|
+
var dist_default2 = fastStringWidth;
|
|
372
|
+
|
|
373
|
+
// ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
374
|
+
var ESC = "\x1B";
|
|
375
|
+
var CSI = "\x9B";
|
|
376
|
+
var END_CODE = 39;
|
|
377
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
378
|
+
var ANSI_CSI = "[";
|
|
379
|
+
var ANSI_OSC = "]";
|
|
380
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
381
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
382
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
383
|
+
var getClosingCode = (openingCode) => {
|
|
384
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
385
|
+
return 39;
|
|
386
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
387
|
+
return 39;
|
|
388
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
389
|
+
return 49;
|
|
390
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
391
|
+
return 49;
|
|
392
|
+
if (openingCode === 1 || openingCode === 2)
|
|
393
|
+
return 22;
|
|
394
|
+
if (openingCode === 3)
|
|
395
|
+
return 23;
|
|
396
|
+
if (openingCode === 4)
|
|
397
|
+
return 24;
|
|
398
|
+
if (openingCode === 7)
|
|
399
|
+
return 27;
|
|
400
|
+
if (openingCode === 8)
|
|
401
|
+
return 28;
|
|
402
|
+
if (openingCode === 9)
|
|
403
|
+
return 29;
|
|
404
|
+
if (openingCode === 0)
|
|
405
|
+
return 0;
|
|
406
|
+
return void 0;
|
|
407
|
+
};
|
|
408
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
409
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
410
|
+
var wrapWord = (rows, word, columns) => {
|
|
411
|
+
const characters = word[Symbol.iterator]();
|
|
412
|
+
let isInsideEscape = false;
|
|
413
|
+
let isInsideLinkEscape = false;
|
|
414
|
+
let lastRow = rows.at(-1);
|
|
415
|
+
let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
|
|
416
|
+
let currentCharacter = characters.next();
|
|
417
|
+
let nextCharacter = characters.next();
|
|
418
|
+
let rawCharacterIndex = 0;
|
|
419
|
+
while (!currentCharacter.done) {
|
|
420
|
+
const character = currentCharacter.value;
|
|
421
|
+
const characterLength = dist_default2(character);
|
|
422
|
+
if (visible + characterLength <= columns) {
|
|
423
|
+
rows[rows.length - 1] += character;
|
|
424
|
+
} else {
|
|
425
|
+
rows.push(character);
|
|
426
|
+
visible = 0;
|
|
427
|
+
}
|
|
428
|
+
if (character === ESC || character === CSI) {
|
|
429
|
+
isInsideEscape = true;
|
|
430
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
431
|
+
}
|
|
432
|
+
if (isInsideEscape) {
|
|
433
|
+
if (isInsideLinkEscape) {
|
|
434
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
435
|
+
isInsideEscape = false;
|
|
436
|
+
isInsideLinkEscape = false;
|
|
437
|
+
}
|
|
438
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
439
|
+
isInsideEscape = false;
|
|
440
|
+
}
|
|
441
|
+
} else {
|
|
442
|
+
visible += characterLength;
|
|
443
|
+
if (visible === columns && !nextCharacter.done) {
|
|
444
|
+
rows.push("");
|
|
445
|
+
visible = 0;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
currentCharacter = nextCharacter;
|
|
449
|
+
nextCharacter = characters.next();
|
|
450
|
+
rawCharacterIndex += character.length;
|
|
451
|
+
}
|
|
452
|
+
lastRow = rows.at(-1);
|
|
453
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
454
|
+
rows[rows.length - 2] += rows.pop();
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
458
|
+
const words = string.split(" ");
|
|
459
|
+
let last = words.length;
|
|
460
|
+
while (last) {
|
|
461
|
+
if (dist_default2(words[last - 1])) {
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
last--;
|
|
465
|
+
}
|
|
466
|
+
if (last === words.length) {
|
|
467
|
+
return string;
|
|
468
|
+
}
|
|
469
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
470
|
+
};
|
|
471
|
+
var exec = (string, columns, options = {}) => {
|
|
472
|
+
if (options.trim !== false && string.trim() === "") {
|
|
473
|
+
return "";
|
|
474
|
+
}
|
|
475
|
+
let returnValue = "";
|
|
476
|
+
let escapeCode;
|
|
477
|
+
let escapeUrl;
|
|
478
|
+
const words = string.split(" ");
|
|
479
|
+
let rows = [""];
|
|
480
|
+
let rowLength = 0;
|
|
481
|
+
for (let index = 0; index < words.length; index++) {
|
|
482
|
+
const word = words[index];
|
|
483
|
+
if (options.trim !== false) {
|
|
484
|
+
const row2 = rows.at(-1) ?? "";
|
|
485
|
+
const trimmed = row2.trimStart();
|
|
486
|
+
if (row2.length !== trimmed.length) {
|
|
487
|
+
rows[rows.length - 1] = trimmed;
|
|
488
|
+
rowLength = dist_default2(trimmed);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (index !== 0) {
|
|
492
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
493
|
+
rows.push("");
|
|
494
|
+
rowLength = 0;
|
|
495
|
+
}
|
|
496
|
+
if (rowLength || options.trim === false) {
|
|
497
|
+
rows[rows.length - 1] += " ";
|
|
498
|
+
rowLength++;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const wordLength = dist_default2(word);
|
|
502
|
+
if (options.hard && wordLength > columns) {
|
|
503
|
+
const remainingColumns = columns - rowLength;
|
|
504
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
505
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
506
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
507
|
+
rows.push("");
|
|
508
|
+
}
|
|
509
|
+
wrapWord(rows, word, columns);
|
|
510
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
514
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
515
|
+
wrapWord(rows, word, columns);
|
|
516
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
rows.push("");
|
|
520
|
+
rowLength = 0;
|
|
521
|
+
}
|
|
522
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
523
|
+
wrapWord(rows, word, columns);
|
|
524
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
rows[rows.length - 1] += word;
|
|
528
|
+
rowLength += wordLength;
|
|
529
|
+
}
|
|
530
|
+
if (options.trim !== false) {
|
|
531
|
+
rows = rows.map((row2) => stringVisibleTrimSpacesRight(row2));
|
|
532
|
+
}
|
|
533
|
+
const preString = rows.join("\n");
|
|
534
|
+
let inSurrogate = false;
|
|
535
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
536
|
+
const character = preString[i2];
|
|
537
|
+
returnValue += character;
|
|
538
|
+
if (!inSurrogate) {
|
|
539
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
540
|
+
if (inSurrogate) {
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
} else {
|
|
544
|
+
inSurrogate = false;
|
|
545
|
+
}
|
|
546
|
+
if (character === ESC || character === CSI) {
|
|
547
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
548
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
549
|
+
const groups = groupsResult?.groups;
|
|
550
|
+
if (groups?.code !== void 0) {
|
|
551
|
+
const code = Number.parseFloat(groups.code);
|
|
552
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
553
|
+
} else if (groups?.uri !== void 0) {
|
|
554
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (preString[i2 + 1] === "\n") {
|
|
558
|
+
if (escapeUrl) {
|
|
559
|
+
returnValue += wrapAnsiHyperlink("");
|
|
560
|
+
}
|
|
561
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
562
|
+
if (escapeCode && closingCode) {
|
|
563
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
564
|
+
}
|
|
565
|
+
} else if (character === "\n") {
|
|
566
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
567
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
568
|
+
}
|
|
569
|
+
if (escapeUrl) {
|
|
570
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return returnValue;
|
|
575
|
+
};
|
|
576
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
577
|
+
function wrapAnsi(string, columns, options) {
|
|
578
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
|
|
582
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
583
|
+
import { ReadStream } from "tty";
|
|
584
|
+
function findCursor(s, o, l2) {
|
|
585
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
586
|
+
return s;
|
|
587
|
+
const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
588
|
+
return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
|
|
589
|
+
}
|
|
590
|
+
var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
591
|
+
var t = [
|
|
592
|
+
"January",
|
|
593
|
+
"February",
|
|
594
|
+
"March",
|
|
595
|
+
"April",
|
|
596
|
+
"May",
|
|
597
|
+
"June",
|
|
598
|
+
"July",
|
|
599
|
+
"August",
|
|
600
|
+
"September",
|
|
601
|
+
"October",
|
|
602
|
+
"November",
|
|
603
|
+
"December"
|
|
604
|
+
];
|
|
605
|
+
var settings = {
|
|
606
|
+
actions: new Set(a$1),
|
|
607
|
+
aliases: /* @__PURE__ */ new Map([
|
|
608
|
+
// vim support
|
|
609
|
+
["k", "up"],
|
|
610
|
+
["j", "down"],
|
|
611
|
+
["h", "left"],
|
|
612
|
+
["l", "right"],
|
|
613
|
+
["", "cancel"],
|
|
614
|
+
// opinionated defaults!
|
|
615
|
+
["escape", "cancel"]
|
|
616
|
+
]),
|
|
617
|
+
messages: {
|
|
618
|
+
cancel: "Canceled",
|
|
619
|
+
error: "Something went wrong"
|
|
620
|
+
},
|
|
621
|
+
withGuide: true,
|
|
622
|
+
date: {
|
|
623
|
+
monthNames: [...t],
|
|
624
|
+
messages: {
|
|
625
|
+
required: "Please enter a valid date",
|
|
626
|
+
invalidMonth: "There are only 12 months in a year",
|
|
627
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
628
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
629
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
function isActionKey(n3, e) {
|
|
634
|
+
if (typeof n3 == "string")
|
|
635
|
+
return settings.aliases.get(n3) === e;
|
|
636
|
+
for (const s of n3)
|
|
637
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
638
|
+
return true;
|
|
639
|
+
return false;
|
|
640
|
+
}
|
|
641
|
+
function diffLines(i2, s) {
|
|
642
|
+
if (i2 === s) return;
|
|
643
|
+
const e = i2.split(`
|
|
644
|
+
`), t2 = s.split(`
|
|
645
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
646
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
647
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
648
|
+
return {
|
|
649
|
+
lines: f,
|
|
650
|
+
numLinesBefore: e.length,
|
|
651
|
+
numLinesAfter: t2.length,
|
|
652
|
+
numLines: r2
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
var R = globalThis.process.platform.startsWith("win");
|
|
656
|
+
var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
657
|
+
function isCancel(e) {
|
|
658
|
+
return e === CANCEL_SYMBOL;
|
|
659
|
+
}
|
|
660
|
+
function setRawMode(e, r2) {
|
|
661
|
+
const o = e;
|
|
662
|
+
o.isTTY && o.setRawMode(r2);
|
|
663
|
+
}
|
|
664
|
+
function block({
|
|
665
|
+
input: e = stdin,
|
|
666
|
+
output: r2 = stdout,
|
|
667
|
+
overwrite: o = true,
|
|
668
|
+
hideCursor: t2 = true
|
|
669
|
+
} = {}) {
|
|
670
|
+
const s = l.createInterface({
|
|
671
|
+
input: e,
|
|
672
|
+
output: r2,
|
|
673
|
+
prompt: "",
|
|
674
|
+
tabSize: 1
|
|
675
|
+
});
|
|
676
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
677
|
+
const n3 = (f, { name: a2, sequence: p }) => {
|
|
678
|
+
const c2 = String(f);
|
|
679
|
+
if (isActionKey([c2, a2, p], "cancel")) {
|
|
680
|
+
t2 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
if (!o) return;
|
|
684
|
+
const i2 = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
|
|
685
|
+
l.moveCursor(r2, i2, m, () => {
|
|
686
|
+
l.clearLine(r2, 1, () => {
|
|
687
|
+
e.once("keypress", n3);
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
};
|
|
691
|
+
return t2 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", n3), () => {
|
|
692
|
+
e.off("keypress", n3), t2 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
696
|
+
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
697
|
+
function wrapTextWithPrefix(e, r2, o, t2 = o, s = o, n3) {
|
|
698
|
+
const f = getColumns(e ?? stdout);
|
|
699
|
+
return wrapAnsi(r2, f - o.length, {
|
|
700
|
+
hard: true,
|
|
701
|
+
trim: false
|
|
702
|
+
}).split(`
|
|
703
|
+
`).map((c2, i2, m) => {
|
|
704
|
+
const d = n3 ? n3(c2, i2) : c2;
|
|
705
|
+
return i2 === 0 ? `${t2}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
706
|
+
}).join(`
|
|
707
|
+
`);
|
|
708
|
+
}
|
|
709
|
+
function runValidation(e, n3) {
|
|
710
|
+
if ("~standard" in e) {
|
|
711
|
+
const a2 = e["~standard"].validate(n3);
|
|
712
|
+
if (a2 instanceof Promise)
|
|
713
|
+
throw new TypeError(
|
|
714
|
+
"Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic."
|
|
715
|
+
);
|
|
716
|
+
return a2.issues?.at(0)?.message;
|
|
717
|
+
}
|
|
718
|
+
return e(n3);
|
|
719
|
+
}
|
|
720
|
+
var V = class {
|
|
721
|
+
input;
|
|
722
|
+
output;
|
|
723
|
+
_abortSignal;
|
|
724
|
+
rl;
|
|
725
|
+
opts;
|
|
726
|
+
_render;
|
|
727
|
+
_track = false;
|
|
728
|
+
_prevFrame = "";
|
|
729
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
730
|
+
_cursor = 0;
|
|
731
|
+
state = "initial";
|
|
732
|
+
error = "";
|
|
733
|
+
value;
|
|
734
|
+
userInput = "";
|
|
735
|
+
constructor(t2, e = true) {
|
|
736
|
+
const { input: i2 = stdin, output: n3 = stdout, render: s, signal: r2, ...o } = t2;
|
|
737
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r2, this.input = i2, this.output = n3;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Unsubscribe all listeners
|
|
741
|
+
*/
|
|
742
|
+
unsubscribe() {
|
|
743
|
+
this._subscribers.clear();
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Set a subscriber with opts
|
|
747
|
+
* @param event - The event name
|
|
748
|
+
*/
|
|
749
|
+
setSubscriber(t2, e) {
|
|
750
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
751
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Subscribe to an event
|
|
755
|
+
* @param event - The event name
|
|
756
|
+
* @param cb - The callback
|
|
757
|
+
*/
|
|
758
|
+
on(t2, e) {
|
|
759
|
+
this.setSubscriber(t2, { cb: e });
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Subscribe to an event once
|
|
763
|
+
* @param event - The event name
|
|
764
|
+
* @param cb - The callback
|
|
765
|
+
*/
|
|
766
|
+
once(t2, e) {
|
|
767
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Emit an event with data
|
|
771
|
+
* @param event - The event name
|
|
772
|
+
* @param data - The data to pass to the callback
|
|
773
|
+
*/
|
|
774
|
+
emit(t2, ...e) {
|
|
775
|
+
const i2 = this._subscribers.get(t2) ?? [], n3 = [];
|
|
776
|
+
for (const s of i2)
|
|
777
|
+
s.cb(...e), s.once && n3.push(() => i2.splice(i2.indexOf(s), 1));
|
|
778
|
+
for (const s of n3)
|
|
779
|
+
s();
|
|
780
|
+
}
|
|
781
|
+
prompt() {
|
|
782
|
+
return new Promise((t2) => {
|
|
783
|
+
if (this._abortSignal) {
|
|
784
|
+
if (this._abortSignal.aborted)
|
|
785
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
786
|
+
this._abortSignal.addEventListener(
|
|
787
|
+
"abort",
|
|
788
|
+
() => {
|
|
789
|
+
this.state = "cancel", this.close();
|
|
790
|
+
},
|
|
791
|
+
{ once: true }
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
this.rl = l__default.createInterface({
|
|
795
|
+
input: this.input,
|
|
796
|
+
tabSize: 2,
|
|
797
|
+
prompt: "",
|
|
798
|
+
escapeCodeTimeout: 50,
|
|
799
|
+
terminal: true
|
|
800
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
801
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
802
|
+
}), this.once("cancel", () => {
|
|
803
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
_isActionKey(t2, e) {
|
|
808
|
+
return t2 === " ";
|
|
809
|
+
}
|
|
810
|
+
_shouldSubmit(t2, e) {
|
|
811
|
+
return true;
|
|
812
|
+
}
|
|
813
|
+
_setValue(t2) {
|
|
814
|
+
this.value = t2, this.emit("value", this.value);
|
|
815
|
+
}
|
|
816
|
+
_setUserInput(t2, e) {
|
|
817
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
818
|
+
}
|
|
819
|
+
_clearUserInput() {
|
|
820
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
821
|
+
}
|
|
822
|
+
onKeypress(t2, e) {
|
|
823
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
824
|
+
if (this.opts.validate) {
|
|
825
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
826
|
+
i2 && (this.error = i2 instanceof Error ? i2.message : i2, this.state = "error", this.rl?.write(this.userInput));
|
|
827
|
+
}
|
|
828
|
+
this.state !== "error" && (this.state = "submit");
|
|
829
|
+
}
|
|
830
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
831
|
+
}
|
|
832
|
+
close() {
|
|
833
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
834
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
835
|
+
}
|
|
836
|
+
restoreCursor() {
|
|
837
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
838
|
+
`).length - 1;
|
|
839
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
840
|
+
}
|
|
841
|
+
render() {
|
|
842
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
843
|
+
hard: true,
|
|
844
|
+
trim: false
|
|
845
|
+
});
|
|
846
|
+
if (t2 !== this._prevFrame) {
|
|
847
|
+
if (this.state === "initial")
|
|
848
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
849
|
+
else {
|
|
850
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
851
|
+
if (this.restoreCursor(), e) {
|
|
852
|
+
const n3 = Math.max(0, e.numLinesAfter - i2), s = Math.max(0, e.numLinesBefore - i2);
|
|
853
|
+
let r2 = e.lines.find((o) => o >= n3);
|
|
854
|
+
if (r2 === void 0) {
|
|
855
|
+
this._prevFrame = t2;
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
if (e.lines.length === 1) {
|
|
859
|
+
this.output.write(import_sisteransi.cursor.move(0, r2 - s)), this.output.write(import_sisteransi.erase.lines(1));
|
|
860
|
+
const o = t2.split(`
|
|
861
|
+
`);
|
|
862
|
+
this.output.write(o[r2]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - r2 - 1));
|
|
863
|
+
return;
|
|
864
|
+
} else if (e.lines.length > 1) {
|
|
865
|
+
if (n3 < s)
|
|
866
|
+
r2 = n3;
|
|
867
|
+
else {
|
|
868
|
+
const h2 = r2 - s;
|
|
869
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
870
|
+
}
|
|
871
|
+
this.output.write(import_sisteransi.erase.down());
|
|
872
|
+
const f = t2.split(`
|
|
873
|
+
`).slice(r2);
|
|
874
|
+
this.output.write(f.join(`
|
|
875
|
+
`)), this._prevFrame = t2;
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
this.output.write(import_sisteransi.erase.down());
|
|
880
|
+
}
|
|
881
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
var r = class extends V {
|
|
886
|
+
get cursor() {
|
|
887
|
+
return this.value ? 0 : 1;
|
|
888
|
+
}
|
|
889
|
+
get _value() {
|
|
890
|
+
return this.cursor === 0;
|
|
891
|
+
}
|
|
892
|
+
constructor(t2) {
|
|
893
|
+
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
894
|
+
this.value = this._value;
|
|
895
|
+
}), this.on("confirm", (i2) => {
|
|
896
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
897
|
+
}), this.on("cursor", () => {
|
|
898
|
+
this.value = !this.value;
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
var n$1 = class n extends V {
|
|
903
|
+
options;
|
|
904
|
+
cursor = 0;
|
|
905
|
+
get _selectedValue() {
|
|
906
|
+
return this.options[this.cursor];
|
|
907
|
+
}
|
|
908
|
+
changeValue() {
|
|
909
|
+
const e = this._selectedValue;
|
|
910
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
911
|
+
}
|
|
912
|
+
constructor(e) {
|
|
913
|
+
super(e, false), this.options = e.options;
|
|
914
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
915
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
916
|
+
switch (s) {
|
|
917
|
+
case "left":
|
|
918
|
+
case "up":
|
|
919
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
920
|
+
break;
|
|
921
|
+
case "down":
|
|
922
|
+
case "right":
|
|
923
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
this.changeValue();
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
// ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
|
|
932
|
+
import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
933
|
+
import process$1 from "process";
|
|
934
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
935
|
+
import { existsSync as existsSync2, lstatSync, readdirSync } from "fs";
|
|
936
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
937
|
+
function isUnicodeSupported() {
|
|
938
|
+
if (process$1.platform !== "win32") {
|
|
939
|
+
return process$1.env.TERM !== "linux";
|
|
940
|
+
}
|
|
941
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
942
|
+
}
|
|
943
|
+
var unicode = isUnicodeSupported();
|
|
944
|
+
var isCI = () => process.env.CI === "true";
|
|
945
|
+
var unicodeOr = (o, e) => unicode ? o : e;
|
|
946
|
+
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
947
|
+
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
948
|
+
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
949
|
+
var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
950
|
+
var S_BAR_START = unicodeOr("\u250C", "T");
|
|
951
|
+
var S_BAR = unicodeOr("\u2502", "|");
|
|
952
|
+
var S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
953
|
+
var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
954
|
+
var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
955
|
+
var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
956
|
+
var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
957
|
+
var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
958
|
+
var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
959
|
+
var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
960
|
+
var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
961
|
+
var S_BAR_H = unicodeOr("\u2500", "-");
|
|
962
|
+
var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
963
|
+
var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
964
|
+
var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
965
|
+
var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
966
|
+
var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
967
|
+
var S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
968
|
+
var S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
969
|
+
var S_WARN = unicodeOr("\u25B2", "!");
|
|
970
|
+
var S_ERROR = unicodeOr("\u25A0", "x");
|
|
971
|
+
var symbol = (o) => {
|
|
972
|
+
switch (o) {
|
|
973
|
+
case "initial":
|
|
974
|
+
case "active":
|
|
975
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
976
|
+
case "cancel":
|
|
977
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
978
|
+
case "error":
|
|
979
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
980
|
+
case "submit":
|
|
981
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
var symbolBar = (o) => {
|
|
985
|
+
switch (o) {
|
|
986
|
+
case "initial":
|
|
987
|
+
case "active":
|
|
988
|
+
return styleText2("cyan", S_BAR);
|
|
989
|
+
case "cancel":
|
|
990
|
+
return styleText2("red", S_BAR);
|
|
991
|
+
case "error":
|
|
992
|
+
return styleText2("yellow", S_BAR);
|
|
993
|
+
case "submit":
|
|
994
|
+
return styleText2("green", S_BAR);
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
function formatInstructionFooter(o, e) {
|
|
998
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
999
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
1000
|
+
}
|
|
1001
|
+
var I = (l2, e, w, p, b, C = false) => {
|
|
1002
|
+
let r2 = e, O = 0;
|
|
1003
|
+
if (C)
|
|
1004
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
1005
|
+
const m = l2[i2];
|
|
1006
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
1007
|
+
}
|
|
1008
|
+
else
|
|
1009
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
1010
|
+
const m = l2[i2];
|
|
1011
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
1012
|
+
}
|
|
1013
|
+
return { lineCount: r2, removals: O };
|
|
1014
|
+
};
|
|
1015
|
+
var limitOptions = ({
|
|
1016
|
+
cursor: l2,
|
|
1017
|
+
options: e,
|
|
1018
|
+
style: w,
|
|
1019
|
+
output: p = process.stdout,
|
|
1020
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
1021
|
+
columnPadding: C = 0,
|
|
1022
|
+
rowPadding: r2 = 4
|
|
1023
|
+
}) => {
|
|
1024
|
+
const i2 = getColumns(p) - C, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
1025
|
+
let f = 0;
|
|
1026
|
+
l2 >= a2 - 3 && (f = Math.max(
|
|
1027
|
+
Math.min(l2 - a2 + 3, e.length - a2),
|
|
1028
|
+
0
|
|
1029
|
+
));
|
|
1030
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
1031
|
+
const W2 = Math.min(
|
|
1032
|
+
f + a2,
|
|
1033
|
+
e.length
|
|
1034
|
+
), s = [];
|
|
1035
|
+
let g = 0;
|
|
1036
|
+
d && g++, c2 && g++;
|
|
1037
|
+
const T = f + (d ? 1 : 0), y = W2 - (c2 ? 1 : 0);
|
|
1038
|
+
for (let t2 = T; t2 < y; t2++) {
|
|
1039
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
1040
|
+
hard: true,
|
|
1041
|
+
trim: false
|
|
1042
|
+
}).split(`
|
|
1043
|
+
`);
|
|
1044
|
+
s.push(h2), g += h2.length;
|
|
1045
|
+
}
|
|
1046
|
+
if (g > v) {
|
|
1047
|
+
let t2 = 0, n3 = 0, o = g;
|
|
1048
|
+
const h2 = l2 - T;
|
|
1049
|
+
let u3 = v;
|
|
1050
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
1051
|
+
s,
|
|
1052
|
+
o,
|
|
1053
|
+
h2 + 1,
|
|
1054
|
+
s.length,
|
|
1055
|
+
u3,
|
|
1056
|
+
true
|
|
1057
|
+
);
|
|
1058
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
|
|
1059
|
+
}
|
|
1060
|
+
const x = [];
|
|
1061
|
+
d && x.push(M);
|
|
1062
|
+
for (const t2 of s)
|
|
1063
|
+
for (const n3 of t2)
|
|
1064
|
+
x.push(n3);
|
|
1065
|
+
return c2 && x.push(M), x;
|
|
1066
|
+
};
|
|
1067
|
+
var confirm = (i2) => {
|
|
1068
|
+
const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
|
|
1069
|
+
return new r({
|
|
1070
|
+
active: a2,
|
|
1071
|
+
inactive: s,
|
|
1072
|
+
signal: i2.signal,
|
|
1073
|
+
input: i2.input,
|
|
1074
|
+
output: i2.output,
|
|
1075
|
+
initialValue: i2.initialValue ?? true,
|
|
1076
|
+
render() {
|
|
1077
|
+
const e = i2.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1078
|
+
i2.output,
|
|
1079
|
+
i2.message,
|
|
1080
|
+
l2,
|
|
1081
|
+
u3
|
|
1082
|
+
), o = `${e ? `${styleText2("gray", S_BAR)}
|
|
1083
|
+
` : ""}${f}
|
|
1084
|
+
`, c2 = this.value ? a2 : s;
|
|
1085
|
+
switch (this.state) {
|
|
1086
|
+
case "submit": {
|
|
1087
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1088
|
+
return `${o}${r2}${styleText2("dim", c2)}`;
|
|
1089
|
+
}
|
|
1090
|
+
case "cancel": {
|
|
1091
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1092
|
+
return `${o}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
|
|
1093
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1094
|
+
}
|
|
1095
|
+
default: {
|
|
1096
|
+
const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
|
|
1097
|
+
return `${o}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i2.vertical ? e ? `
|
|
1098
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
1099
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
|
|
1100
|
+
${g}
|
|
1101
|
+
`;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}).prompt();
|
|
1106
|
+
};
|
|
1107
|
+
var MULTISELECT_INSTRUCTIONS = [
|
|
1108
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1109
|
+
`${styleText2("dim", "Space:")} select`,
|
|
1110
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1111
|
+
];
|
|
1112
|
+
var log = {
|
|
1113
|
+
message: (s = [], {
|
|
1114
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1115
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1116
|
+
output: m = process.stdout,
|
|
1117
|
+
spacing: l2 = 1,
|
|
1118
|
+
withGuide: c2
|
|
1119
|
+
} = {}) => {
|
|
1120
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1121
|
+
for (let i2 = 0; i2 < l2; i2++)
|
|
1122
|
+
t2.push(f);
|
|
1123
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
1124
|
+
`);
|
|
1125
|
+
if (g.length > 0) {
|
|
1126
|
+
const [i2, ...y] = g;
|
|
1127
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1128
|
+
for (const p of y)
|
|
1129
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1130
|
+
}
|
|
1131
|
+
m.write(`${t2.join(`
|
|
1132
|
+
`)}
|
|
1133
|
+
`);
|
|
1134
|
+
},
|
|
1135
|
+
info: (s, e) => {
|
|
1136
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1137
|
+
},
|
|
1138
|
+
success: (s, e) => {
|
|
1139
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1140
|
+
},
|
|
1141
|
+
step: (s, e) => {
|
|
1142
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1143
|
+
},
|
|
1144
|
+
warn: (s, e) => {
|
|
1145
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1146
|
+
},
|
|
1147
|
+
/** alias for `log.warn()`. */
|
|
1148
|
+
warning: (s, e) => {
|
|
1149
|
+
log.warn(s, e);
|
|
1150
|
+
},
|
|
1151
|
+
error: (s, e) => {
|
|
1152
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
var cancel = (o = "", t2) => {
|
|
1156
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1157
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
1158
|
+
|
|
1159
|
+
`);
|
|
1160
|
+
};
|
|
1161
|
+
var intro = (o = "", t2) => {
|
|
1162
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
1163
|
+
i2.write(`${e}${o}
|
|
1164
|
+
`);
|
|
1165
|
+
};
|
|
1166
|
+
var outro = (o = "", t2) => {
|
|
1167
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1168
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1169
|
+
i2.write(`${e}${o}
|
|
1170
|
+
|
|
1171
|
+
`);
|
|
1172
|
+
};
|
|
1173
|
+
var W = (l2) => styleText2("magenta", l2);
|
|
1174
|
+
var spinner = ({
|
|
1175
|
+
indicator: l2 = "dots",
|
|
1176
|
+
onCancel: h2,
|
|
1177
|
+
output: n3 = process.stdout,
|
|
1178
|
+
cancelMessage: G,
|
|
1179
|
+
errorMessage: O,
|
|
1180
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1181
|
+
delay: F = unicode ? 80 : 120,
|
|
1182
|
+
signal: m,
|
|
1183
|
+
...I2
|
|
1184
|
+
} = {}) => {
|
|
1185
|
+
const u3 = isCI();
|
|
1186
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
1187
|
+
const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
|
|
1188
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
1189
|
+
S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
|
|
1190
|
+
}, f = () => g(2), i2 = () => g(1), A = () => {
|
|
1191
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m && m.addEventListener("abort", i2);
|
|
1192
|
+
}, H = () => {
|
|
1193
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m && m.removeEventListener("abort", i2);
|
|
1194
|
+
}, y = () => {
|
|
1195
|
+
if (p === void 0) return;
|
|
1196
|
+
u3 && n3.write(`
|
|
1197
|
+
`);
|
|
1198
|
+
const r2 = wrapAnsi(p, x, {
|
|
1199
|
+
hard: true,
|
|
1200
|
+
trim: false
|
|
1201
|
+
}).split(`
|
|
1202
|
+
`);
|
|
1203
|
+
r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
|
|
1204
|
+
}, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
1205
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
|
|
1206
|
+
return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
|
|
1207
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1208
|
+
d = true, M = block({ output: n3 }), s = C(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
1209
|
+
`);
|
|
1210
|
+
let r2 = 0, t2 = 0;
|
|
1211
|
+
A(), T = setInterval(() => {
|
|
1212
|
+
if (u3 && s === p)
|
|
1213
|
+
return;
|
|
1214
|
+
y(), p = s;
|
|
1215
|
+
const o = k(E[r2]);
|
|
1216
|
+
let v;
|
|
1217
|
+
if (u3)
|
|
1218
|
+
v = `${o} ${s}...`;
|
|
1219
|
+
else if (l2 === "timer")
|
|
1220
|
+
v = `${o} ${s} ${_(w)}`;
|
|
1221
|
+
else {
|
|
1222
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
1223
|
+
v = `${o} ${s}${B}`;
|
|
1224
|
+
}
|
|
1225
|
+
const j = wrapAnsi(v, x, {
|
|
1226
|
+
hard: true,
|
|
1227
|
+
trim: false
|
|
1228
|
+
});
|
|
1229
|
+
n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
1230
|
+
}, F);
|
|
1231
|
+
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1232
|
+
if (!d) return;
|
|
1233
|
+
d = false, clearInterval(T), y();
|
|
1234
|
+
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1235
|
+
s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
|
|
1236
|
+
`) : n3.write(`${o} ${s}
|
|
1237
|
+
`)), H(), M();
|
|
1238
|
+
};
|
|
1239
|
+
return {
|
|
1240
|
+
start: P,
|
|
1241
|
+
stop: (e = "") => a2(e, 0),
|
|
1242
|
+
message: (e = "") => {
|
|
1243
|
+
s = C(e ?? s);
|
|
1244
|
+
},
|
|
1245
|
+
cancel: (e = "") => a2(e, 1),
|
|
1246
|
+
error: (e = "") => a2(e, 2),
|
|
1247
|
+
clear: () => a2("", 0, true),
|
|
1248
|
+
get isCancelled() {
|
|
1249
|
+
return S;
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
};
|
|
1253
|
+
var u2 = {
|
|
1254
|
+
light: unicodeOr("\u2500", "-"),
|
|
1255
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1256
|
+
block: unicodeOr("\u2588", "#")
|
|
1257
|
+
};
|
|
1258
|
+
var SELECT_INSTRUCTIONS = [
|
|
1259
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1260
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1261
|
+
];
|
|
1262
|
+
var c = (t2, o) => t2.includes(`
|
|
1263
|
+
`) ? t2.split(`
|
|
1264
|
+
`).map((d) => o(d)).join(`
|
|
1265
|
+
`) : o(t2);
|
|
1266
|
+
var select = (t2) => {
|
|
1267
|
+
const o = (n3, m) => {
|
|
1268
|
+
if (n3 === void 0)
|
|
1269
|
+
return "";
|
|
1270
|
+
const s = n3.label ?? String(n3.value);
|
|
1271
|
+
switch (m) {
|
|
1272
|
+
case "disabled":
|
|
1273
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1274
|
+
case "selected":
|
|
1275
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1276
|
+
case "active":
|
|
1277
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1278
|
+
case "cancelled":
|
|
1279
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1280
|
+
default:
|
|
1281
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1282
|
+
}
|
|
1283
|
+
}, d = t2.showInstructions ?? true;
|
|
1284
|
+
return new n$1({
|
|
1285
|
+
options: t2.options,
|
|
1286
|
+
signal: t2.signal,
|
|
1287
|
+
input: t2.input,
|
|
1288
|
+
output: t2.output,
|
|
1289
|
+
initialValue: t2.initialValue,
|
|
1290
|
+
render() {
|
|
1291
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1292
|
+
t2.output,
|
|
1293
|
+
t2.message,
|
|
1294
|
+
s,
|
|
1295
|
+
m
|
|
1296
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1297
|
+
` : ""}${i2}
|
|
1298
|
+
`;
|
|
1299
|
+
switch (this.state) {
|
|
1300
|
+
case "submit": {
|
|
1301
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1302
|
+
t2.output,
|
|
1303
|
+
o(this.options[this.cursor], "selected"),
|
|
1304
|
+
r2
|
|
1305
|
+
);
|
|
1306
|
+
return `${u3}${a2}`;
|
|
1307
|
+
}
|
|
1308
|
+
case "cancel": {
|
|
1309
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1310
|
+
t2.output,
|
|
1311
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1312
|
+
r2
|
|
1313
|
+
);
|
|
1314
|
+
return `${u3}${a2}${n3 ? `
|
|
1315
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1316
|
+
}
|
|
1317
|
+
default: {
|
|
1318
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1319
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
|
|
1320
|
+
`), f = p.length + 1;
|
|
1321
|
+
return `${u3}${r2}${limitOptions({
|
|
1322
|
+
output: t2.output,
|
|
1323
|
+
cursor: this.cursor,
|
|
1324
|
+
options: this.options,
|
|
1325
|
+
maxItems: t2.maxItems,
|
|
1326
|
+
columnPadding: r2.length,
|
|
1327
|
+
rowPadding: a2 + f,
|
|
1328
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1329
|
+
}).join(`
|
|
1330
|
+
${r2}`)}
|
|
1331
|
+
${b}
|
|
1332
|
+
`;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}).prompt();
|
|
1337
|
+
};
|
|
1338
|
+
var i = `${styleText2("gray", S_BAR)} `;
|
|
1339
|
+
|
|
1340
|
+
// src/install.ts
|
|
1341
|
+
import { spawn } from "child_process";
|
|
1342
|
+
var PM_ADD = {
|
|
1343
|
+
pnpm: ["add"],
|
|
1344
|
+
npm: ["install", "--no-fund", "--no-audit"],
|
|
1345
|
+
yarn: ["add"],
|
|
1346
|
+
bun: ["add"]
|
|
1347
|
+
};
|
|
1348
|
+
var PM_RESTORE = {
|
|
1349
|
+
pnpm: ["install"],
|
|
1350
|
+
npm: ["install", "--no-fund", "--no-audit"],
|
|
1351
|
+
yarn: ["install"],
|
|
1352
|
+
bun: ["install"]
|
|
1353
|
+
};
|
|
1354
|
+
function runInstall(pm, specs, cwd, onProgress) {
|
|
1355
|
+
const base = specs.length ? PM_ADD[pm] : PM_RESTORE[pm];
|
|
1356
|
+
const args = [...base, ...specs];
|
|
1357
|
+
if (pm === "pnpm") args.push("--reporter=ndjson");
|
|
1358
|
+
const startedAt = performance.now();
|
|
1359
|
+
const child = spawn(pm, args, { cwd, shell: process.platform === "win32", stdio: ["ignore", "pipe", "pipe"] });
|
|
1360
|
+
const progress = {
|
|
1361
|
+
stage: "resolving",
|
|
1362
|
+
resolved: 0,
|
|
1363
|
+
satisfied: 0,
|
|
1364
|
+
fetchingId: null,
|
|
1365
|
+
fetchingSize: 0,
|
|
1366
|
+
fetchingDone: 0
|
|
1367
|
+
};
|
|
1368
|
+
let added = 0;
|
|
1369
|
+
const roots = [];
|
|
1370
|
+
const errors = [];
|
|
1371
|
+
const tail = [];
|
|
1372
|
+
let cancelled = false;
|
|
1373
|
+
const keepTail = (chunk) => {
|
|
1374
|
+
for (const line of chunk.split("\n")) if (line.trim()) tail.push(line);
|
|
1375
|
+
if (tail.length > 20) tail.splice(0, tail.length - 20);
|
|
1376
|
+
};
|
|
1377
|
+
const onEvent = (event) => {
|
|
1378
|
+
const name = event.name;
|
|
1379
|
+
if (name === "pnpm:progress") {
|
|
1380
|
+
const status = event.status;
|
|
1381
|
+
if (status === "resolved") progress.resolved++;
|
|
1382
|
+
if (status === "fetched" || status === "found_in_store" || status === "found_in_local_dir") {
|
|
1383
|
+
progress.satisfied++;
|
|
1384
|
+
if (event.packageId === progress.fetchingId) progress.fetchingId = null;
|
|
1385
|
+
if (progress.stage === "resolving") progress.stage = "fetching";
|
|
1386
|
+
}
|
|
1387
|
+
} else if (name === "pnpm:fetching-progress") {
|
|
1388
|
+
if (event.status === "started") {
|
|
1389
|
+
progress.fetchingId = String(event.packageId ?? "");
|
|
1390
|
+
progress.fetchingSize = Number(event.size ?? 0);
|
|
1391
|
+
progress.fetchingDone = 0;
|
|
1392
|
+
} else if (event.status === "in_progress" && event.packageId === progress.fetchingId) {
|
|
1393
|
+
progress.fetchingDone = Number(event.downloaded ?? 0);
|
|
1394
|
+
}
|
|
1395
|
+
} else if (name === "pnpm:stage") {
|
|
1396
|
+
if (event.stage === "importing_started") progress.stage = "linking";
|
|
1397
|
+
} else if (name === "pnpm:stats") {
|
|
1398
|
+
if (typeof event.added === "number") added += event.added;
|
|
1399
|
+
} else if (name === "pnpm:root") {
|
|
1400
|
+
const info = event.added;
|
|
1401
|
+
if (info?.name && info.version) roots.push({ name: info.name, version: info.version });
|
|
1402
|
+
} else if (event.level === "error") {
|
|
1403
|
+
const err = event.err;
|
|
1404
|
+
errors.push(String(err?.message ?? event.message ?? JSON.stringify(event)));
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
let buffer = "";
|
|
1408
|
+
child.stdout.setEncoding("utf8");
|
|
1409
|
+
child.stdout.on("data", (chunk) => {
|
|
1410
|
+
if (pm !== "pnpm") {
|
|
1411
|
+
keepTail(chunk);
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
buffer += chunk;
|
|
1415
|
+
const lines = buffer.split("\n");
|
|
1416
|
+
buffer = lines.pop() ?? "";
|
|
1417
|
+
for (const line of lines) {
|
|
1418
|
+
if (!line.startsWith("{")) continue;
|
|
1419
|
+
try {
|
|
1420
|
+
onEvent(JSON.parse(line));
|
|
1421
|
+
} catch {
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
onProgress(progress);
|
|
1425
|
+
});
|
|
1426
|
+
child.stderr.setEncoding("utf8");
|
|
1427
|
+
child.stderr.on("data", keepTail);
|
|
1428
|
+
const done = new Promise((resolve, reject) => {
|
|
1429
|
+
child.on("error", (error) => reject({ code: 1, detail: [error.message] }));
|
|
1430
|
+
child.on("close", (code) => {
|
|
1431
|
+
if (cancelled) return;
|
|
1432
|
+
if (code === 0) resolve({ added, roots, ms: performance.now() - startedAt });
|
|
1433
|
+
else reject({ code: code ?? 1, detail: errors.length ? errors : tail });
|
|
1434
|
+
});
|
|
1435
|
+
});
|
|
1436
|
+
return {
|
|
1437
|
+
done,
|
|
1438
|
+
cancel: () => {
|
|
1439
|
+
cancelled = true;
|
|
1440
|
+
child.kill("SIGTERM");
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
// src/palette.ts
|
|
1446
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
1447
|
+
var env = process.env;
|
|
1448
|
+
var truecolor = import_picocolors.default.isColorSupported && (/truecolor|24bit/i.test(env.COLORTERM ?? "") || env.TERM === "xterm-kitty");
|
|
1449
|
+
var hexToRgb = (hex) => [
|
|
1450
|
+
parseInt(hex.slice(1, 3), 16),
|
|
1451
|
+
parseInt(hex.slice(3, 5), 16),
|
|
1452
|
+
parseInt(hex.slice(5, 7), 16)
|
|
1453
|
+
];
|
|
1454
|
+
var rgbToHex = ([r2, g, b]) => `#${[r2, g, b].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("")}`;
|
|
1455
|
+
function fg(hex, fallback = import_picocolors.default.cyan) {
|
|
1456
|
+
if (!truecolor) return import_picocolors.default.isColorSupported ? fallback : (text) => text;
|
|
1457
|
+
const [r2, g, b] = hexToRgb(hex);
|
|
1458
|
+
return (text) => `\x1B[38;2;${r2};${g};${b}m${text}\x1B[39m`;
|
|
1459
|
+
}
|
|
1460
|
+
function lerpHex(from, to, t2) {
|
|
1461
|
+
const a2 = hexToRgb(from);
|
|
1462
|
+
const b = hexToRgb(to);
|
|
1463
|
+
return rgbToHex([a2[0] + (b[0] - a2[0]) * t2, a2[1] + (b[1] - a2[1]) * t2, a2[2] + (b[2] - a2[2]) * t2]);
|
|
1464
|
+
}
|
|
1465
|
+
var teal = { 200: "#a4e5e7", 300: "#6dcfd1", 400: "#28b5b9", 500: "#009ea3", 600: "#00888c" };
|
|
1466
|
+
var accent = fg(teal[400]);
|
|
1467
|
+
var accentDeep = fg(teal[500]);
|
|
1468
|
+
var accentBright = fg(teal[300]);
|
|
1469
|
+
var { dim, bold, red, yellow } = import_picocolors.default;
|
|
1470
|
+
function gradientText(text, from, to) {
|
|
1471
|
+
if (!truecolor) return import_picocolors.default.isColorSupported ? import_picocolors.default.cyan(text) : text;
|
|
1472
|
+
const chars = [...text];
|
|
1473
|
+
const span = Math.max(1, chars.length - 1);
|
|
1474
|
+
return chars.map((char, i2) => fg(lerpHex(from, to, i2 / span))(char)).join("");
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// src/ui.ts
|
|
1478
|
+
var SPINNER_FRAMES = unicode ? ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"] : ["-", "\\", "|", "/"];
|
|
1479
|
+
var SPINNER_DELAY = 80;
|
|
1480
|
+
var check = accent(unicodeOr("\u2713", "+"));
|
|
1481
|
+
var skip = dim(unicodeOr("\u25CC", "o"));
|
|
1482
|
+
var arrow = dim(unicodeOr("\u2192", "->"));
|
|
1483
|
+
var BAR_FILLED = unicodeOr("\u2501", "=");
|
|
1484
|
+
var BAR_HALF = unicodeOr("\u2578", "-");
|
|
1485
|
+
var BAR_REST = unicodeOr("\u2500", "-");
|
|
1486
|
+
function wordmark(version2) {
|
|
1487
|
+
return `${gradientText("zyncat", teal[300], teal[500])} ${bold("ui")} ${dim(`v${version2}`)}`;
|
|
1488
|
+
}
|
|
1489
|
+
var SHIMMER_TAIL = 14;
|
|
1490
|
+
function shimmer(text, tick) {
|
|
1491
|
+
const chars = [...text];
|
|
1492
|
+
const head = tick * 1.5 % (chars.length + SHIMMER_TAIL);
|
|
1493
|
+
return chars.map((char, i2) => {
|
|
1494
|
+
if (char === " ") return char;
|
|
1495
|
+
const distance = Math.abs(i2 - head);
|
|
1496
|
+
if (distance < 1) return accentBright(char);
|
|
1497
|
+
if (distance < 2.5) return accent(char);
|
|
1498
|
+
if (distance < 4) return accentDeep(char);
|
|
1499
|
+
return dim(char);
|
|
1500
|
+
}).join("");
|
|
1501
|
+
}
|
|
1502
|
+
function styleFrame(frame) {
|
|
1503
|
+
return accent(frame);
|
|
1504
|
+
}
|
|
1505
|
+
function bar(ratio, width = 22) {
|
|
1506
|
+
const clamped = Math.min(1, Math.max(0, ratio));
|
|
1507
|
+
const cells = clamped * width;
|
|
1508
|
+
const filled = Math.floor(cells);
|
|
1509
|
+
const half = cells - filled >= 0.5 && filled < width;
|
|
1510
|
+
let out = "";
|
|
1511
|
+
for (let i2 = 0; i2 < filled; i2++)
|
|
1512
|
+
out += fg(lerpHex(teal[500], teal[300], filled <= 1 ? 1 : i2 / (filled - 1)))(BAR_FILLED);
|
|
1513
|
+
if (half) out += accentDeep(BAR_HALF);
|
|
1514
|
+
out += dim(BAR_REST.repeat(width - filled - (half ? 1 : 0)));
|
|
1515
|
+
return out;
|
|
1516
|
+
}
|
|
1517
|
+
function kilobytes(bytes) {
|
|
1518
|
+
if (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
1519
|
+
return `${Math.max(1, Math.round(bytes / 1024))} kB`;
|
|
1520
|
+
}
|
|
1521
|
+
function seconds(ms) {
|
|
1522
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
1523
|
+
}
|
|
1524
|
+
var LABEL_WIDTH = 13;
|
|
1525
|
+
function row(label, value) {
|
|
1526
|
+
return `${label.padEnd(LABEL_WIDTH)} ${dim(value)}`;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
// src/init.ts
|
|
1530
|
+
var PACKAGE = "@zyncat/ui";
|
|
1531
|
+
var MCP_SERVER_ENTRY = { command: "node", args: ["./node_modules/@zyncat/ui/dist/mcp.js"] };
|
|
1532
|
+
var STYLES_IMPORT = "import '@zyncat/ui/styles.css';";
|
|
1533
|
+
var DOCS_URL = "https://ui.zyncat.app";
|
|
1534
|
+
var THEME_STARTER = `import { defineTheme } from '@zyncat/ui/theme';
|
|
1535
|
+
|
|
1536
|
+
export const base = defineTheme({
|
|
1537
|
+
color: { accent: 'oklch(0.63 0.118 198)' },
|
|
1538
|
+
});
|
|
1539
|
+
|
|
1540
|
+
export const dark = defineTheme({
|
|
1541
|
+
color: { bgApp: 'oklch(0.19 0.008 198)', textBody: 'oklch(0.92 0.004 198)' },
|
|
1542
|
+
});
|
|
1543
|
+
`;
|
|
1544
|
+
var interactive = () => Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
1545
|
+
function bail(message, hint) {
|
|
1546
|
+
log.error(message);
|
|
1547
|
+
if (hint) log.message(dim(hint), { spacing: 0 });
|
|
1548
|
+
outro(red("Nothing was changed."));
|
|
1549
|
+
process.exit(1);
|
|
1550
|
+
}
|
|
1551
|
+
async function pickPm(cwd, targetPkg, flags) {
|
|
1552
|
+
if (flags.pm) return flags.pm;
|
|
1553
|
+
const detected = detectPm(cwd, targetPkg);
|
|
1554
|
+
if (detected) return detected;
|
|
1555
|
+
if (!interactive() || flags.yes) return "npm";
|
|
1556
|
+
const choice = await select({
|
|
1557
|
+
message: "No lockfile found - which package manager runs this project?",
|
|
1558
|
+
options: PACKAGE_MANAGERS.map((pm) => ({ value: pm, label: pm }))
|
|
1559
|
+
});
|
|
1560
|
+
if (isCancel(choice)) {
|
|
1561
|
+
cancel("Cancelled - nothing was changed.");
|
|
1562
|
+
process.exit(130);
|
|
1563
|
+
}
|
|
1564
|
+
return choice;
|
|
1565
|
+
}
|
|
1566
|
+
async function planInstall(cwd, targetPkg, flags) {
|
|
1567
|
+
const deps = { ...targetPkg.dependencies, ...targetPkg.devDependencies };
|
|
1568
|
+
const specs = [];
|
|
1569
|
+
let reactNote = null;
|
|
1570
|
+
const hasPackage = PACKAGE in deps;
|
|
1571
|
+
const packageOnDisk = installedVersion(cwd, PACKAGE) !== null;
|
|
1572
|
+
if (!hasPackage) specs.push(PACKAGE);
|
|
1573
|
+
if (!("react" in deps)) {
|
|
1574
|
+
specs.push("react", "react-dom");
|
|
1575
|
+
} else {
|
|
1576
|
+
const major = majorOf(deps.react) ?? majorOf(installedVersion(cwd, "react") ?? void 0);
|
|
1577
|
+
if (major !== null && major < 19) {
|
|
1578
|
+
let upgrade = flags.yes;
|
|
1579
|
+
if (!flags.yes && interactive()) {
|
|
1580
|
+
const answer = await confirm({
|
|
1581
|
+
message: `React ${major} is installed, and ${PACKAGE} needs React 19. Upgrade react and react-dom?`
|
|
1582
|
+
});
|
|
1583
|
+
if (isCancel(answer)) {
|
|
1584
|
+
cancel("Cancelled - nothing was changed.");
|
|
1585
|
+
process.exit(130);
|
|
1586
|
+
}
|
|
1587
|
+
upgrade = answer;
|
|
1588
|
+
}
|
|
1589
|
+
if (upgrade) specs.push("react@^19", "react-dom@^19");
|
|
1590
|
+
else reactNote = `React ${major} stays as it is - ${PACKAGE} requires React 19, so upgrade before shipping.`;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
return { specs, restore: hasPackage && !packageOnDisk, reactNote };
|
|
1594
|
+
}
|
|
1595
|
+
function renderProgress(pm, progress, tick) {
|
|
1596
|
+
if (pm !== "pnpm") return shimmer(`Installing with ${pm}`, tick);
|
|
1597
|
+
if (!progress || progress.stage === "resolving") {
|
|
1598
|
+
const found = progress?.resolved ? dim(` ${progress.resolved} found`) : "";
|
|
1599
|
+
return `${shimmer("Resolving dependencies", tick)}${found}`;
|
|
1600
|
+
}
|
|
1601
|
+
if (progress.stage === "linking") return `${shimmer("Linking packages", tick)} ${bar(1)}`;
|
|
1602
|
+
const ratio = progress.resolved ? progress.satisfied / progress.resolved : 0;
|
|
1603
|
+
const counts = dim(`${progress.satisfied}/${progress.resolved}`);
|
|
1604
|
+
let current = "";
|
|
1605
|
+
if (progress.fetchingId && progress.fetchingSize) {
|
|
1606
|
+
const name = progress.fetchingId.split("@").slice(0, -1).join("@") || progress.fetchingId;
|
|
1607
|
+
const bytes = progress.fetchingDone ? `${kilobytes(progress.fetchingDone)} / ${kilobytes(progress.fetchingSize)}` : kilobytes(progress.fetchingSize);
|
|
1608
|
+
current = dim(` \xB7 ${name} ${bytes}`);
|
|
1609
|
+
}
|
|
1610
|
+
return `${shimmer("Fetching packages", tick)} ${bar(ratio)} ${counts}${current}`;
|
|
1611
|
+
}
|
|
1612
|
+
async function installPhase(pm, plan, cwd) {
|
|
1613
|
+
if (!plan.specs.length && !plan.restore) {
|
|
1614
|
+
const version2 = installedVersion(cwd, PACKAGE);
|
|
1615
|
+
log.message(`${bold(PACKAGE)} ${dim(`${version2} already installed`)}`, { symbol: check });
|
|
1616
|
+
return null;
|
|
1617
|
+
}
|
|
1618
|
+
const live = interactive();
|
|
1619
|
+
const spin = spinner({ indicator: "timer", frames: SPINNER_FRAMES, delay: SPINNER_DELAY, styleFrame });
|
|
1620
|
+
let progress = null;
|
|
1621
|
+
let tick = 0;
|
|
1622
|
+
const handle = runInstall(pm, plan.restore ? [] : plan.specs, cwd, (latest) => {
|
|
1623
|
+
progress = latest;
|
|
1624
|
+
});
|
|
1625
|
+
let interval;
|
|
1626
|
+
if (live) {
|
|
1627
|
+
spin.start(renderProgress(pm, progress, tick));
|
|
1628
|
+
interval = setInterval(() => {
|
|
1629
|
+
tick++;
|
|
1630
|
+
spin.message(renderProgress(pm, progress, tick));
|
|
1631
|
+
}, SPINNER_DELAY);
|
|
1632
|
+
} else {
|
|
1633
|
+
log.message(
|
|
1634
|
+
dim(plan.restore ? `Restoring node_modules with ${pm}` : `Installing ${plan.specs.join(" ")} with ${pm}`)
|
|
1635
|
+
);
|
|
1636
|
+
}
|
|
1637
|
+
const finish = () => {
|
|
1638
|
+
if (interval) clearInterval(interval);
|
|
1639
|
+
if (live) spin.clear();
|
|
1640
|
+
};
|
|
1641
|
+
const cancelInstall = () => {
|
|
1642
|
+
handle.cancel();
|
|
1643
|
+
finish();
|
|
1644
|
+
cancel("Cancelled - the install was stopped before it finished.");
|
|
1645
|
+
process.exit(130);
|
|
1646
|
+
};
|
|
1647
|
+
if (live) process.once("SIGINT", cancelInstall);
|
|
1648
|
+
try {
|
|
1649
|
+
const result = await handle.done;
|
|
1650
|
+
if (live) process.removeListener("SIGINT", cancelInstall);
|
|
1651
|
+
finish();
|
|
1652
|
+
const version2 = result.roots.find((entry) => entry.name === PACKAGE)?.version ?? installedVersion(cwd, PACKAGE);
|
|
1653
|
+
const react = result.roots.find((entry) => entry.name === "react");
|
|
1654
|
+
const parts = [
|
|
1655
|
+
`${bold(PACKAGE)} ${dim(version2 ?? "")}`.trimEnd(),
|
|
1656
|
+
result.added ? dim(`${result.added} package${result.added === 1 ? "" : "s"}`) : "",
|
|
1657
|
+
react ? dim(`react ${react.version}`) : "",
|
|
1658
|
+
dim(seconds(result.ms))
|
|
1659
|
+
].filter(Boolean);
|
|
1660
|
+
return { line: parts.join(dim(" \xB7 ")) };
|
|
1661
|
+
} catch (failure) {
|
|
1662
|
+
if (live) process.removeListener("SIGINT", cancelInstall);
|
|
1663
|
+
finish();
|
|
1664
|
+
const { detail } = failure;
|
|
1665
|
+
log.error(`${pm} could not finish the install.`);
|
|
1666
|
+
for (const line of detail.slice(-12)) log.message(dim(line), { spacing: 0 });
|
|
1667
|
+
outro(red("Fix the install error above, then re-run init."));
|
|
1668
|
+
process.exit(1);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
function sourceRoot(cwd, ownRoot) {
|
|
1672
|
+
const installed = join3(cwd, "node_modules", PACKAGE);
|
|
1673
|
+
if (existsSync3(join3(installed, "skills"))) return installed;
|
|
1674
|
+
return ownRoot;
|
|
1675
|
+
}
|
|
1676
|
+
function wireSkill(cwd, packageRoot) {
|
|
1677
|
+
const source = join3(packageRoot, "skills");
|
|
1678
|
+
if (!existsSync3(source)) bail(`No skills/ directory found in the installed ${PACKAGE} - reinstall the package.`);
|
|
1679
|
+
const dest = join3(cwd, ".claude/skills");
|
|
1680
|
+
const existed = existsSync3(join3(dest, "zyncat-ui"));
|
|
1681
|
+
mkdirSync(dest, { recursive: true });
|
|
1682
|
+
for (const name of readdirSync2(source))
|
|
1683
|
+
cpSync(join3(source, name), join3(dest, name), { recursive: true, force: true });
|
|
1684
|
+
return row("Agent skill", `.claude/skills/zyncat-ui \xB7 ${existed ? "refreshed" : "installed"}`);
|
|
1685
|
+
}
|
|
1686
|
+
function wireMcp(cwd) {
|
|
1687
|
+
const path = join3(cwd, ".mcp.json");
|
|
1688
|
+
let config = {};
|
|
1689
|
+
if (existsSync3(path)) {
|
|
1690
|
+
const parsed = readJson(path);
|
|
1691
|
+
if (!parsed) bail(`.mcp.json exists but is not valid JSON - fix it, then re-run init.`);
|
|
1692
|
+
config = parsed;
|
|
1693
|
+
}
|
|
1694
|
+
const existed = JSON.stringify(config.mcpServers?.["zyncat-ui"]) === JSON.stringify(MCP_SERVER_ENTRY);
|
|
1695
|
+
config.mcpServers = { ...config.mcpServers, "zyncat-ui": MCP_SERVER_ENTRY };
|
|
1696
|
+
writeFileSync(path, `${JSON.stringify(config, null, 2)}
|
|
1697
|
+
`);
|
|
1698
|
+
return row("MCP server", existed ? ".mcp.json \xB7 kept" : `.mcp.json ${arrow} zyncat-ui`);
|
|
1699
|
+
}
|
|
1700
|
+
function wireTheme(cwd) {
|
|
1701
|
+
const file = existsSync3(join3(cwd, "tsconfig.json")) ? "zyncat.theme.ts" : "zyncat.theme.js";
|
|
1702
|
+
const path = join3(cwd, file);
|
|
1703
|
+
if (existsSync3(path)) return row("Typed theme", `${file} \xB7 kept`);
|
|
1704
|
+
writeFileSync(path, THEME_STARTER);
|
|
1705
|
+
return row("Typed theme", `${file} \xB7 created`);
|
|
1706
|
+
}
|
|
1707
|
+
function wireStyles(cwd) {
|
|
1708
|
+
const entry = findAppEntry(cwd);
|
|
1709
|
+
if (!entry) return { line: `${row("Stylesheet", "no app entry found \xB7 add the import yourself")}`, manual: true };
|
|
1710
|
+
const path = join3(cwd, entry);
|
|
1711
|
+
const text = readFileSync2(path, "utf8");
|
|
1712
|
+
if (text.includes("@zyncat/ui/styles.css"))
|
|
1713
|
+
return { line: row("Stylesheet", `${entry} \xB7 already imported`), manual: false };
|
|
1714
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
1715
|
+
const lines = text.split(eol);
|
|
1716
|
+
let at = 0;
|
|
1717
|
+
while (at < lines.length && (lines[at].trim() === "" || /^(['"])use [\w-]+\1;?$/.test(lines[at].trim()))) at++;
|
|
1718
|
+
lines.splice(at, 0, STYLES_IMPORT);
|
|
1719
|
+
writeFileSync(path, lines.join(eol));
|
|
1720
|
+
return { line: row("Stylesheet", `${entry} \xB7 import added`), manual: false };
|
|
1721
|
+
}
|
|
1722
|
+
async function init(flags) {
|
|
1723
|
+
const startedAt = performance.now();
|
|
1724
|
+
const { root: ownRoot, version: version2 } = findOwnRoot();
|
|
1725
|
+
const cwd = process.cwd();
|
|
1726
|
+
intro(wordmark(version2));
|
|
1727
|
+
const targetPkgPath = join3(cwd, "package.json");
|
|
1728
|
+
const targetPkg = readJson(targetPkgPath);
|
|
1729
|
+
if (!targetPkg) {
|
|
1730
|
+
bail(
|
|
1731
|
+
"No package.json here - init sets up an existing React app.",
|
|
1732
|
+
`Create one first (pnpm create vite my-app, pnpm create next-app my-app), then run init inside it.`
|
|
1733
|
+
);
|
|
1734
|
+
}
|
|
1735
|
+
if (targetPkg.name === PACKAGE || targetPkg.name === "zyncat-ui") {
|
|
1736
|
+
bail("This is the zyncat-ui repository - init sets up a consumer project.");
|
|
1737
|
+
}
|
|
1738
|
+
const pm = await pickPm(cwd, targetPkg, flags);
|
|
1739
|
+
const pmVer = pmVersion(pm);
|
|
1740
|
+
const project = targetPkg.name ?? "unnamed project";
|
|
1741
|
+
log.message(dim(`${project} \xB7 ${pm}${pmVer ? ` ${pmVer}` : ""}`));
|
|
1742
|
+
const plan = await planInstall(cwd, targetPkg, flags);
|
|
1743
|
+
const installed = await installPhase(pm, plan, cwd);
|
|
1744
|
+
if (installed) log.message(installed.line, { symbol: check });
|
|
1745
|
+
if (plan.reactNote) log.warn(plan.reactNote);
|
|
1746
|
+
const packageRoot = sourceRoot(cwd, ownRoot);
|
|
1747
|
+
const lines = [wireSkill(cwd, packageRoot), wireMcp(cwd), wireTheme(cwd)];
|
|
1748
|
+
const styles = wireStyles(cwd);
|
|
1749
|
+
lines.push(styles.line);
|
|
1750
|
+
for (const [index, line] of lines.entries())
|
|
1751
|
+
log.message(line, {
|
|
1752
|
+
symbol: styles.manual && index === lines.length - 1 ? skip : check,
|
|
1753
|
+
spacing: index === 0 ? 1 : 0
|
|
1754
|
+
});
|
|
1755
|
+
if (styles.manual)
|
|
1756
|
+
log.message(dim(`Put ${STYLES_IMPORT} at your app root, above your own stylesheets.`), { spacing: 0 });
|
|
1757
|
+
log.message(`${dim("Docs")} ${arrow} ${accentDeep(DOCS_URL)}`);
|
|
1758
|
+
outro(`${bold(`Ready in ${seconds(performance.now() - startedAt)}.`)} Restart your agent session to load the skill.`);
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
// src/cli.ts
|
|
1762
|
+
function parseFlags(args) {
|
|
1763
|
+
const flags = { yes: false };
|
|
1764
|
+
for (let i2 = 0; i2 < args.length; i2++) {
|
|
1765
|
+
const arg = args[i2];
|
|
1766
|
+
if (arg === "--yes" || arg === "-y") flags.yes = true;
|
|
1767
|
+
else if (arg === "--pm" || arg.startsWith("--pm=")) {
|
|
1768
|
+
const value = arg.includes("=") ? arg.split("=")[1] : args[++i2];
|
|
1769
|
+
if (!PACKAGE_MANAGERS.includes(value)) return null;
|
|
1770
|
+
flags.pm = value;
|
|
1771
|
+
} else return null;
|
|
1772
|
+
}
|
|
1773
|
+
return flags;
|
|
1774
|
+
}
|
|
1775
|
+
function help(version2) {
|
|
1776
|
+
const lines = [
|
|
1777
|
+
"",
|
|
1778
|
+
` ${wordmark(version2)}`,
|
|
1779
|
+
"",
|
|
1780
|
+
` ${dim("Sets up @zyncat/ui in a React project: installs the package,")}`,
|
|
1781
|
+
` ${dim("the agent skill, the MCP server, a typed theme and the stylesheet.")}`,
|
|
1782
|
+
"",
|
|
1783
|
+
` ${bold("Usage")}`,
|
|
1784
|
+
` zyncat-ui init ${dim("[flags]")}`,
|
|
1785
|
+
"",
|
|
1786
|
+
` ${bold("Flags")}`,
|
|
1787
|
+
` --yes, -y ${dim("accept every default, never prompt")}`,
|
|
1788
|
+
` --pm <name> ${dim(`force the package manager (${PACKAGE_MANAGERS.join(", ")})`)}`,
|
|
1789
|
+
"",
|
|
1790
|
+
` ${dim("Docs")} ${arrow} ${accentDeep("https://ui.zyncat.app")}`,
|
|
1791
|
+
""
|
|
1792
|
+
];
|
|
1793
|
+
return lines.join("\n");
|
|
1794
|
+
}
|
|
1795
|
+
var [command, ...rest] = process.argv.slice(2);
|
|
1796
|
+
var { version } = findOwnRoot();
|
|
1797
|
+
if (command === "--version" || command === "-v") {
|
|
1798
|
+
console.log(version);
|
|
1799
|
+
} else if (command === "init") {
|
|
1800
|
+
const flags = parseFlags(rest);
|
|
1801
|
+
if (!flags) {
|
|
1802
|
+
console.error(help(version));
|
|
1803
|
+
process.exit(1);
|
|
1804
|
+
}
|
|
1805
|
+
await init(flags);
|
|
1806
|
+
} else {
|
|
1807
|
+
console.log(help(version));
|
|
1808
|
+
process.exit(command ? 1 : 0);
|
|
1809
|
+
}
|