@asanchez-sa/abby 0.0.0-stage → 0.1.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 +217 -2
- package/dist/_virtual/_rolldown/runtime.js +26 -0
- package/dist/agents/approvals.d.ts +46 -0
- package/dist/agents/approvals.js +58 -0
- package/dist/agents/changes.d.ts +21 -0
- package/dist/agents/changes.js +21 -0
- package/dist/agents/hooks.d.ts +20 -0
- package/dist/agents/hooks.js +58 -0
- package/dist/agents/index.d.ts +11 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/run-tool.d.ts +44 -0
- package/dist/agents/run-tool.js +79 -0
- package/dist/agents/ui-sdk.d.ts +5 -0
- package/dist/agents/ui-sdk.js +3 -0
- package/dist/behaviors/canvas/index.d.ts +2 -0
- package/dist/behaviors/canvas/index.js +1 -0
- package/dist/behaviors/canvas/ui-sdk.d.ts +2 -0
- package/dist/behaviors/canvas/ui-sdk.js +1 -0
- package/dist/behaviors/drag-and-drop/index.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/index.js +1 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.js +1 -0
- package/dist/behaviors/dragging/index.d.ts +2 -0
- package/dist/behaviors/dragging/index.js +1 -0
- package/dist/behaviors/dragging/ui-sdk.d.ts +2 -0
- package/dist/behaviors/dragging/ui-sdk.js +1 -0
- package/dist/behaviors/focus/index.d.ts +2 -0
- package/dist/behaviors/focus/index.js +1 -0
- package/dist/behaviors/focus/ui-sdk.d.ts +2 -0
- package/dist/behaviors/focus/ui-sdk.js +1 -0
- package/dist/behaviors/lists/index.d.ts +3 -0
- package/dist/behaviors/lists/index.js +3 -0
- package/dist/behaviors/lists/ui-sdk.d.ts +3 -0
- package/dist/behaviors/lists/ui-sdk.js +3 -0
- package/dist/behaviors/popups/index.d.ts +3 -0
- package/dist/behaviors/popups/index.js +3 -0
- package/dist/behaviors/popups/ui-sdk.d.ts +3 -0
- package/dist/behaviors/popups/ui-sdk.js +3 -0
- package/dist/behaviors/preferences/index.d.ts +3 -0
- package/dist/behaviors/preferences/index.js +3 -0
- package/dist/behaviors/preferences/ui-sdk.d.ts +3 -0
- package/dist/behaviors/preferences/ui-sdk.js +3 -0
- package/dist/behaviors/selection/index.d.ts +3 -0
- package/dist/behaviors/selection/index.js +3 -0
- package/dist/behaviors/selection/indicator.d.ts +13 -0
- package/dist/behaviors/selection/indicator.js +20 -0
- package/dist/behaviors/selection/ui-sdk.d.ts +2 -0
- package/dist/behaviors/selection/ui-sdk.js +1 -0
- package/dist/behaviors/transitions/index.d.ts +3 -0
- package/dist/behaviors/transitions/index.js +3 -0
- package/dist/behaviors/transitions/ui-sdk.d.ts +3 -0
- package/dist/behaviors/transitions/ui-sdk.js +3 -0
- package/dist/behaviors/trees/index.d.ts +2 -0
- package/dist/behaviors/trees/index.js +1 -0
- package/dist/behaviors/trees/ui-sdk.d.ts +2 -0
- package/dist/behaviors/trees/ui-sdk.js +1 -0
- package/dist/components/accordion/accordion.d.ts +13 -0
- package/dist/components/accordion/accordion.js +165 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.js +131 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +15 -0
- package/dist/components/alert-dialog/alert-dialog.js +257 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +57 -0
- package/dist/components/attachment/attachment.d.ts +48 -0
- package/dist/components/attachment/attachment.js +372 -0
- package/dist/components/autocomplete/autocomplete.d.ts +32 -0
- package/dist/components/autocomplete/autocomplete.js +466 -0
- package/dist/components/avatar/avatar.d.ts +6 -0
- package/dist/components/avatar/avatar.js +100 -0
- package/dist/components/avatar-group/avatar-group.d.ts +9 -0
- package/dist/components/avatar-group/avatar-group.js +75 -0
- package/dist/components/badge/badge.d.ts +15 -0
- package/dist/components/badge/badge.js +31 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.js +279 -0
- package/dist/components/bubble/bubble.d.ts +26 -0
- package/dist/components/bubble/bubble.js +173 -0
- package/dist/components/button/button.d.ts +18 -0
- package/dist/components/button/button.js +91 -0
- package/dist/components/button-group/button-group.d.ts +15 -0
- package/dist/components/button-group/button-group.js +71 -0
- package/dist/components/calendar/calendar.d.ts +29 -0
- package/dist/components/calendar/calendar.js +453 -0
- package/dist/components/card/card.d.ts +14 -0
- package/dist/components/card/card.js +213 -0
- package/dist/components/carousel/carousel.d.ts +16 -0
- package/dist/components/carousel/carousel.js +364 -0
- package/dist/components/chain-of-thought/chain-of-thought.d.ts +72 -0
- package/dist/components/chain-of-thought/chain-of-thought.js +491 -0
- package/dist/components/chat/chat.d.ts +48 -0
- package/dist/components/chat/chat.js +207 -0
- package/dist/components/checkbox/checkbox.d.ts +10 -0
- package/dist/components/checkbox/checkbox.js +118 -0
- package/dist/components/checkpoint/checkpoint.d.ts +24 -0
- package/dist/components/checkpoint/checkpoint.js +178 -0
- package/dist/components/choice-cards/choice-cards.d.ts +38 -0
- package/dist/components/choice-cards/choice-cards.js +255 -0
- package/dist/components/code-block/code-block.d.ts +58 -0
- package/dist/components/code-block/code-block.js +506 -0
- package/dist/components/code-block/highlighter.js +96 -0
- package/dist/components/code-block/use-highlighted-code.d.ts +11 -0
- package/dist/components/code-block/use-highlighted-code.js +54 -0
- package/dist/components/collapsible/collapsible.d.ts +10 -0
- package/dist/components/collapsible/collapsible.js +92 -0
- package/dist/components/color-picker/color-picker.d.ts +17 -0
- package/dist/components/color-picker/color-picker.js +395 -0
- package/dist/components/combobox/combobox.d.ts +54 -0
- package/dist/components/combobox/combobox.js +683 -0
- package/dist/components/command/command.d.ts +23 -0
- package/dist/components/command/command.js +373 -0
- package/dist/components/command-dock/command-dock.d.ts +118 -0
- package/dist/components/command-dock/command-dock.js +944 -0
- package/dist/components/confirmation/confirmation.d.ts +58 -0
- package/dist/components/confirmation/confirmation.js +181 -0
- package/dist/components/context/context.d.ts +82 -0
- package/dist/components/context/context.js +490 -0
- package/dist/components/date-input/date-input.d.ts +16 -0
- package/dist/components/date-input/date-input.js +89 -0
- package/dist/components/date-picker/date-picker.d.ts +28 -0
- package/dist/components/date-picker/date-picker.js +361 -0
- package/dist/components/dialog/dialog.d.ts +14 -0
- package/dist/components/dialog/dialog.js +261 -0
- package/dist/components/drawer/drawer.d.ts +16 -0
- package/dist/components/drawer/drawer.js +309 -0
- package/dist/components/empty/empty.d.ts +18 -0
- package/dist/components/empty/empty.js +192 -0
- package/dist/components/field/field.d.ts +15 -0
- package/dist/components/field/field.js +261 -0
- package/dist/components/file-input/file-input.d.ts +12 -0
- package/dist/components/file-input/file-input.js +216 -0
- package/dist/components/file-tree/file-tree.d.ts +45 -0
- package/dist/components/file-tree/file-tree.js +283 -0
- package/dist/components/hover-card/hover-card.d.ts +10 -0
- package/dist/components/hover-card/hover-card.js +118 -0
- package/dist/components/icon/icon.d.ts +14 -0
- package/dist/components/icon/icon.js +60 -0
- package/dist/components/image-cropper/image-cropper.d.ts +15 -0
- package/dist/components/image-cropper/image-cropper.js +334 -0
- package/dist/components/inline-citation/inline-citation.d.ts +46 -0
- package/dist/components/inline-citation/inline-citation.js +269 -0
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +43 -0
- package/dist/components/input-group/input-group.d.ts +42 -0
- package/dist/components/input-group/input-group.js +192 -0
- package/dist/components/item/item.d.ts +32 -0
- package/dist/components/item/item.js +394 -0
- package/dist/components/kbd/kbd.d.ts +9 -0
- package/dist/components/kbd/kbd.js +75 -0
- package/dist/components/label/label.d.ts +6 -0
- package/dist/components/label/label.js +40 -0
- package/dist/components/link/link.d.ts +21 -0
- package/dist/components/link/link.js +126 -0
- package/dist/components/listbox/listbox.d.ts +20 -0
- package/dist/components/listbox/listbox.js +199 -0
- package/dist/components/marker/marker.d.ts +11 -0
- package/dist/components/marker/marker.js +88 -0
- package/dist/components/menu/menu.d.ts +38 -0
- package/dist/components/menu/menu.js +553 -0
- package/dist/components/menubar/menubar.d.ts +9 -0
- package/dist/components/menubar/menubar.js +47 -0
- package/dist/components/message/message.d.ts +44 -0
- package/dist/components/message/message.js +328 -0
- package/dist/components/message-scroller/message-scroller.d.ts +111 -0
- package/dist/components/message-scroller/message-scroller.js +957 -0
- package/dist/components/meter/meter.d.ts +8 -0
- package/dist/components/meter/meter.js +162 -0
- package/dist/components/model-selector/model-selector.d.ts +155 -0
- package/dist/components/model-selector/model-selector.js +905 -0
- package/dist/components/native-select/native-select.d.ts +27 -0
- package/dist/components/native-select/native-select.js +226 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +29 -0
- package/dist/components/navigation-menu/navigation-menu.js +318 -0
- package/dist/components/not-label.js +9 -0
- package/dist/components/note-editor/blocks.d.ts +22 -0
- package/dist/components/note-editor/blocks.js +245 -0
- package/dist/components/note-editor/diff.d.ts +19 -0
- package/dist/components/note-editor/diff.js +64 -0
- package/dist/components/note-editor/editor.js +249 -0
- package/dist/components/note-editor/note-editor.d.ts +109 -0
- package/dist/components/note-editor/note-editor.js +954 -0
- package/dist/components/note-editor/parts/comments.d.ts +24 -0
- package/dist/components/note-editor/parts/comments.js +336 -0
- package/dist/components/note-editor/parts/header.d.ts +25 -0
- package/dist/components/note-editor/parts/header.js +263 -0
- package/dist/components/note-editor/parts/history.d.ts +56 -0
- package/dist/components/note-editor/parts/history.js +409 -0
- package/dist/components/note-editor/parts/presence.d.ts +31 -0
- package/dist/components/note-editor/parts/presence.js +140 -0
- package/dist/components/note-editor/parts/suggestions.d.ts +45 -0
- package/dist/components/note-editor/parts/suggestions.js +316 -0
- package/dist/components/note-editor/parts/toolbar.d.ts +38 -0
- package/dist/components/note-editor/parts/toolbar.js +683 -0
- package/dist/components/note-editor/people.d.ts +84 -0
- package/dist/components/note-editor/people.js +276 -0
- package/dist/components/note-editor/person.d.ts +11 -0
- package/dist/components/note-editor/person.js +15 -0
- package/dist/components/note-place/note-place.d.ts +42 -0
- package/dist/components/note-place/note-place.js +256 -0
- package/dist/components/note-status/note-status.d.ts +59 -0
- package/dist/components/note-status/note-status.js +380 -0
- package/dist/components/number-input/number-input.d.ts +12 -0
- package/dist/components/number-input/number-input.js +252 -0
- package/dist/components/otp-input/otp-input.d.ts +12 -0
- package/dist/components/otp-input/otp-input.js +136 -0
- package/dist/components/pagination/pagination.d.ts +23 -0
- package/dist/components/pagination/pagination.js +218 -0
- package/dist/components/password-input/password-input.d.ts +11 -0
- package/dist/components/password-input/password-input.js +117 -0
- package/dist/components/plan/plan.d.ts +51 -0
- package/dist/components/plan/plan.js +320 -0
- package/dist/components/popover/popover.d.ts +16 -0
- package/dist/components/popover/popover.js +268 -0
- package/dist/components/preferences/preferences.d.ts +5 -0
- package/dist/components/preferences/preferences.js +18 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +162 -0
- package/dist/components/prompt-input/prompt-input.d.ts +247 -0
- package/dist/components/prompt-input/prompt-input.js +1367 -0
- package/dist/components/questionnaire/questionnaire.d.ts +174 -0
- package/dist/components/questionnaire/questionnaire.js +1628 -0
- package/dist/components/queue/queue.d.ts +82 -0
- package/dist/components/queue/queue.js +471 -0
- package/dist/components/radio/radio.d.ts +7 -0
- package/dist/components/radio/radio.js +101 -0
- package/dist/components/rating/rating.d.ts +10 -0
- package/dist/components/rating/rating.js +95 -0
- package/dist/components/reasoning/reasoning.d.ts +50 -0
- package/dist/components/reasoning/reasoning.js +233 -0
- package/dist/components/resizable/resizable.d.ts +6 -0
- package/dist/components/resizable/resizable.js +100 -0
- package/dist/components/scroll-area/scroll-area.d.ts +17 -0
- package/dist/components/scroll-area/scroll-area.js +211 -0
- package/dist/components/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/segmented-control/segmented-control.js +142 -0
- package/dist/components/select/select.d.ts +43 -0
- package/dist/components/select/select.js +577 -0
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.js +38 -0
- package/dist/components/sheet/sheet.d.ts +24 -0
- package/dist/components/sheet/sheet.js +330 -0
- package/dist/components/sidebar/sidebar.d.ts +138 -0
- package/dist/components/sidebar/sidebar.js +1374 -0
- package/dist/components/skeleton/skeleton.d.ts +4 -0
- package/dist/components/skeleton/skeleton.js +40 -0
- package/dist/components/slider/slider.d.ts +9 -0
- package/dist/components/slider/slider.js +193 -0
- package/dist/components/sources/sources.d.ts +35 -0
- package/dist/components/sources/sources.js +209 -0
- package/dist/components/spinner/spinner.d.ts +11 -0
- package/dist/components/spinner/spinner.js +59 -0
- package/dist/components/stack-trace/parse-stack-trace.d.ts +21 -0
- package/dist/components/stack-trace/parse-stack-trace.js +61 -0
- package/dist/components/stack-trace/stack-trace.d.ts +79 -0
- package/dist/components/stack-trace/stack-trace.js +434 -0
- package/dist/components/subagent/subagent.d.ts +71 -0
- package/dist/components/subagent/subagent.js +450 -0
- package/dist/components/suggestion/suggestion.d.ts +21 -0
- package/dist/components/suggestion/suggestion.js +130 -0
- package/dist/components/switch/switch.d.ts +6 -0
- package/dist/components/switch/switch.js +70 -0
- package/dist/components/table/table.d.ts +19 -0
- package/dist/components/table/table.js +284 -0
- package/dist/components/table-of-contents/spy.js +84 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +92 -0
- package/dist/components/table-of-contents/table-of-contents.js +787 -0
- package/dist/components/tabs/tabs.d.ts +25 -0
- package/dist/components/tabs/tabs.js +273 -0
- package/dist/components/task/task.d.ts +40 -0
- package/dist/components/task/task.js +262 -0
- package/dist/components/terminal/terminal.d.ts +82 -0
- package/dist/components/terminal/terminal.js +457 -0
- package/dist/components/test-results/test-results.d.ts +127 -0
- package/dist/components/test-results/test-results.js +687 -0
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/textarea/textarea.js +43 -0
- package/dist/components/time-input/time-input.d.ts +7 -0
- package/dist/components/time-input/time-input.js +82 -0
- package/dist/components/timeline/timeline.d.ts +19 -0
- package/dist/components/timeline/timeline.js +247 -0
- package/dist/components/toast/toast.d.ts +12 -0
- package/dist/components/toast/toast.js +285 -0
- package/dist/components/toggle/toggle.d.ts +15 -0
- package/dist/components/toggle/toggle.js +137 -0
- package/dist/components/token-input/token-input.d.ts +7 -0
- package/dist/components/token-input/token-input.js +117 -0
- package/dist/components/tool/tool.d.ts +66 -0
- package/dist/components/tool/tool.js +413 -0
- package/dist/components/toolbar/toolbar.d.ts +91 -0
- package/dist/components/toolbar/toolbar.js +655 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +97 -0
- package/dist/components/trace/trace.d.ts +31 -0
- package/dist/components/trace/trace.js +309 -0
- package/dist/components/tree/tree.d.ts +13 -0
- package/dist/components/tree/tree.js +258 -0
- package/dist/components/trigger-menu/trigger-menu.d.ts +30 -0
- package/dist/components/trigger-menu/trigger-menu.js +352 -0
- package/dist/components/usage/usage.d.ts +132 -0
- package/dist/components/usage/usage.js +1368 -0
- package/dist/components/waterfall/waterfall.d.ts +20 -0
- package/dist/components/waterfall/waterfall.js +360 -0
- package/dist/components/week-strip/week-strip.d.ts +177 -0
- package/dist/components/week-strip/week-strip.js +1081 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +27 -0
- package/dist/core/ui-sdk.d.ts +3 -0
- package/dist/core/ui-sdk.js +3 -0
- package/dist/core/use-primitive-state.d.ts +14 -0
- package/dist/core/use-primitive-state.js +25 -0
- package/dist/styles/LICENSE-shadcn.md +21 -0
- package/dist/styles/color-scheme.css +32 -0
- package/dist/styles/components.css +303 -0
- package/dist/styles/index.css +41 -0
- package/dist/styles/tokens.css +474 -0
- package/dist/styles/typeset/shadcn.css +506 -0
- package/dist/styles/typeset.css +70 -0
- package/dist/styles/utilities.css +555 -0
- package/dist/tools/observe/index.d.ts +2 -0
- package/dist/tools/observe/index.js +3 -0
- package/dist/tools/observe/ui-sdk.d.ts +1 -0
- package/dist/tools/observe/ui-sdk.js +2 -0
- package/dist/tools/testing/check-agent.d.ts +28 -0
- package/dist/tools/testing/check-agent.js +42 -0
- package/dist/tools/testing/index.d.ts +4 -0
- package/dist/tools/testing/index.js +4 -0
- package/dist/tools/testing/ui-sdk.d.ts +1 -0
- package/dist/tools/testing/ui-sdk.js +2 -0
- package/dist/utilities/cn/index.d.ts +12 -0
- package/dist/utilities/cn/index.js +47 -0
- package/dist/utilities/color/index.d.ts +2 -0
- package/dist/utilities/color/index.js +3 -0
- package/dist/utilities/color/ui-sdk.d.ts +1 -0
- package/dist/utilities/color/ui-sdk.js +2 -0
- package/dist/utilities/date/index.d.ts +2 -0
- package/dist/utilities/date/index.js +6 -0
- package/dist/utilities/date/ui-sdk.d.ts +1 -0
- package/dist/utilities/date/ui-sdk.js +2 -0
- package/dist/utilities/image/index.d.ts +2 -0
- package/dist/utilities/image/index.js +3 -0
- package/dist/utilities/image/ui-sdk.d.ts +1 -0
- package/dist/utilities/image/ui-sdk.js +2 -0
- package/dist/utilities/mobile/index.d.ts +2 -0
- package/dist/utilities/mobile/index.js +1 -0
- package/dist/utilities/mobile/ui-sdk.d.ts +2 -0
- package/dist/utilities/mobile/ui-sdk.js +1 -0
- package/dist/utilities/number/index.d.ts +2 -0
- package/dist/utilities/number/index.js +3 -0
- package/dist/utilities/number/ui-sdk.d.ts +1 -0
- package/dist/utilities/number/ui-sdk.js +2 -0
- package/dist/utilities/platform/index.d.ts +3 -0
- package/dist/utilities/platform/index.js +14 -0
- package/dist/utilities/platform/ui-sdk.d.ts +3 -0
- package/dist/utilities/platform/ui-sdk.js +3 -0
- package/dist/utilities/storage/index.d.ts +2 -0
- package/dist/utilities/storage/index.js +1 -0
- package/dist/utilities/storage/ui-sdk.d.ts +2 -0
- package/dist/utilities/storage/ui-sdk.js +1 -0
- package/dist/utilities/text/index.d.ts +3 -0
- package/dist/utilities/text/index.js +3 -0
- package/dist/utilities/text/ui-sdk.d.ts +3 -0
- package/dist/utilities/text/ui-sdk.js +3 -0
- package/package.json +192 -4
- package/skills/agent-ready-ui/SKILL.md +229 -0
- package/skills/blocks/SKILL.md +262 -0
- package/skills/compose-screens/SKILL.md +354 -0
- package/skills/note-editor/SKILL.md +493 -0
- package/skills/note-status/SKILL.md +295 -0
- package/skills/setup/SKILL.md +136 -0
- package/skills/theming/SKILL.md +216 -0
- package/src/blocks/notes/adapters.ts +77 -0
- package/src/blocks/notes/data.ts +508 -0
- package/src/blocks/notes/notes-block.tsx +244 -0
- package/src/blocks/notes/parts/home.tsx +219 -0
- package/src/blocks/notes/parts/no-access.tsx +84 -0
- package/src/blocks/notes/parts/note-screen.tsx +412 -0
- package/src/blocks/notes/parts/notes-sidebar.tsx +277 -0
- package/src/blocks/notes/parts/panels.tsx +393 -0
- package/src/blocks/notes/parts/place.ts +15 -0
- package/src/blocks/notes/parts/review-dialog.tsx +159 -0
- package/src/blocks/notes/parts/share.tsx +172 -0
- package/src/blocks/notes/texts.ts +135 -0
- package/src/blocks/shell/adapters.ts +69 -0
- package/src/blocks/shell/data.ts +281 -0
- package/src/blocks/shell/parts/compose.tsx +292 -0
- package/src/blocks/shell/parts/home.tsx +203 -0
- package/src/blocks/shell/parts/marks.tsx +144 -0
- package/src/blocks/shell/parts/rail.tsx +166 -0
- package/src/blocks/shell/parts/rooms-column.tsx +326 -0
- package/src/blocks/shell/shell-block.tsx +210 -0
- package/src/blocks/shell/texts.ts +80 -0
|
@@ -0,0 +1,905 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createChange, definePrimitive } from "../../core/ui-sdk.js";
|
|
3
|
+
import { usePrimitiveState } from "../../core/use-primitive-state.js";
|
|
4
|
+
import { core_exports } from "../../core/index.js";
|
|
5
|
+
import { markPlaced } from "../../behaviors/selection/indicator.js";
|
|
6
|
+
import "../../behaviors/selection/index.js";
|
|
7
|
+
import { cn, cnState } from "../../utilities/cn/index.js";
|
|
8
|
+
import { inputGroupButtonVariants } from "../input-group/input-group.js";
|
|
9
|
+
import { Menu, MenuContent, MenuGroupLabel, MenuItemIndicator, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuTrigger, createMenuController } from "../menu/menu.js";
|
|
10
|
+
import { c } from "react/compiler-runtime";
|
|
11
|
+
import { Fragment, createContext, use, useId, useState } from "react";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
// src/components/model-selector/model-selector.tsx
|
|
14
|
+
const TRIGGER = "[data-slot=\"menu-trigger\"]";
|
|
15
|
+
/**
|
|
16
|
+
* A value picked from a few choices. The selector is one; a setting that
|
|
17
|
+
* shares its menu, like the effort next to the model, is another of its own.
|
|
18
|
+
* Not exported: its inferred type names ui-sdk types that aren't public, so
|
|
19
|
+
* the declaration build can't describe it from another module.
|
|
20
|
+
*/
|
|
21
|
+
const definePicker = (name) => definePrimitive({
|
|
22
|
+
name,
|
|
23
|
+
options: {
|
|
24
|
+
value: "string",
|
|
25
|
+
defaultValue: "string",
|
|
26
|
+
onValueChange: "callback",
|
|
27
|
+
items: "value",
|
|
28
|
+
menu: "value"
|
|
29
|
+
},
|
|
30
|
+
controlled: ["value"],
|
|
31
|
+
state: (options) => ({
|
|
32
|
+
value: options.value ?? options.defaultValue ?? null,
|
|
33
|
+
items: options.items,
|
|
34
|
+
disabled: false
|
|
35
|
+
}),
|
|
36
|
+
sync: (options) => ({
|
|
37
|
+
...options.value === void 0 ? {} : { value: options.value },
|
|
38
|
+
items: options.items
|
|
39
|
+
}),
|
|
40
|
+
api: (context) => {
|
|
41
|
+
const change = createChange(context);
|
|
42
|
+
const pick = (value, details) => change("value", value, details);
|
|
43
|
+
return {
|
|
44
|
+
/** Selects a value, as a press on its item does. False when the app refused it. */
|
|
45
|
+
pick,
|
|
46
|
+
setValue: (value) => {
|
|
47
|
+
if (!context.store.get().disabled) pick(value, { reason: "imperative" });
|
|
48
|
+
},
|
|
49
|
+
setOpen: (open) => {
|
|
50
|
+
context.options().menu?.setOpen(open);
|
|
51
|
+
},
|
|
52
|
+
watch: (root) => {
|
|
53
|
+
const read = () => {
|
|
54
|
+
const trigger = root.querySelector(TRIGGER);
|
|
55
|
+
const disabled = !!trigger && (trigger.matches(":disabled") || trigger.getAttribute("aria-disabled") === "true");
|
|
56
|
+
if (disabled !== context.store.get().disabled) context.store.set({ disabled });
|
|
57
|
+
};
|
|
58
|
+
read();
|
|
59
|
+
const observer = new MutationObserver(read);
|
|
60
|
+
observer.observe(root, {
|
|
61
|
+
childList: true,
|
|
62
|
+
subtree: true,
|
|
63
|
+
attributes: true,
|
|
64
|
+
attributeFilter: ["disabled", "aria-disabled"]
|
|
65
|
+
});
|
|
66
|
+
return () => observer.disconnect();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
slots: (slot) => ({
|
|
71
|
+
root: slot({
|
|
72
|
+
attrs: (state) => ({ "data-disabled": state.disabled ? "" : void 0 }),
|
|
73
|
+
bind: (el, part) => part.api.watch(el)
|
|
74
|
+
}),
|
|
75
|
+
mark: slot({}),
|
|
76
|
+
item: slot({ props: {
|
|
77
|
+
value: "key",
|
|
78
|
+
disabled: "boolean"
|
|
79
|
+
} })
|
|
80
|
+
}),
|
|
81
|
+
agent: {
|
|
82
|
+
actions: ["setValue"],
|
|
83
|
+
closed: true
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const modelSelector = definePicker("model-selector");
|
|
87
|
+
const modelSelectorSetting = definePicker("model-selector-setting");
|
|
88
|
+
const ModelSelectorContext = createContext(null);
|
|
89
|
+
function useScope() {
|
|
90
|
+
const scope = use(ModelSelectorContext);
|
|
91
|
+
if (!scope) throw new Error("ModelSelector's parts must be used within ModelSelector.");
|
|
92
|
+
return scope;
|
|
93
|
+
}
|
|
94
|
+
/** The selected value and its setter. Call it inside a `ModelSelector`. */
|
|
95
|
+
function useModelSelector() {
|
|
96
|
+
const $ = c(5);
|
|
97
|
+
const { handle } = useScope();
|
|
98
|
+
const { value } = usePrimitiveState(handle);
|
|
99
|
+
let t0;
|
|
100
|
+
if ($[0] !== handle) {
|
|
101
|
+
t0 = (next, details) => {
|
|
102
|
+
const { reason, event, source } = details;
|
|
103
|
+
if (!handle.api.pick(next, {
|
|
104
|
+
reason,
|
|
105
|
+
event,
|
|
106
|
+
source
|
|
107
|
+
})) details.cancel?.();
|
|
108
|
+
};
|
|
109
|
+
$[0] = handle;
|
|
110
|
+
$[1] = t0;
|
|
111
|
+
} else t0 = $[1];
|
|
112
|
+
let t1;
|
|
113
|
+
if ($[2] !== t0 || $[3] !== value) {
|
|
114
|
+
t1 = {
|
|
115
|
+
value,
|
|
116
|
+
onValueChange: t0
|
|
117
|
+
};
|
|
118
|
+
$[2] = t0;
|
|
119
|
+
$[3] = value;
|
|
120
|
+
$[4] = t1;
|
|
121
|
+
} else t1 = $[4];
|
|
122
|
+
return t1;
|
|
123
|
+
}
|
|
124
|
+
function ModelSelectorMark() {
|
|
125
|
+
const $ = c(2);
|
|
126
|
+
let t0;
|
|
127
|
+
let t1;
|
|
128
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
129
|
+
t0 = {};
|
|
130
|
+
t1 = { className: "pointer-events-none absolute size-0" };
|
|
131
|
+
$[0] = t0;
|
|
132
|
+
$[1] = t1;
|
|
133
|
+
} else {
|
|
134
|
+
t0 = $[0];
|
|
135
|
+
t1 = $[1];
|
|
136
|
+
}
|
|
137
|
+
return (0, core_exports.usePart)(modelSelector, "mark", t0, t1, "span");
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The menu and its one value, shared by every `ModelSelectorGroup` inside. It
|
|
141
|
+
* takes Menu's props (`open`, `onOpenChange`, `controller`…). An agent sets
|
|
142
|
+
* the value with `setValue`, by an item's label or its value.
|
|
143
|
+
*/
|
|
144
|
+
function ModelSelector(t0) {
|
|
145
|
+
const $ = c(31);
|
|
146
|
+
let ariaLabel;
|
|
147
|
+
let ariaLabelledBy;
|
|
148
|
+
let controller;
|
|
149
|
+
let defaultValue;
|
|
150
|
+
let items;
|
|
151
|
+
let onValueChange;
|
|
152
|
+
let props;
|
|
153
|
+
let value;
|
|
154
|
+
if ($[0] !== t0) {
|
|
155
|
+
({value, defaultValue, onValueChange, items, controller, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props} = t0);
|
|
156
|
+
$[0] = t0;
|
|
157
|
+
$[1] = ariaLabel;
|
|
158
|
+
$[2] = ariaLabelledBy;
|
|
159
|
+
$[3] = controller;
|
|
160
|
+
$[4] = defaultValue;
|
|
161
|
+
$[5] = items;
|
|
162
|
+
$[6] = onValueChange;
|
|
163
|
+
$[7] = props;
|
|
164
|
+
$[8] = value;
|
|
165
|
+
} else {
|
|
166
|
+
ariaLabel = $[1];
|
|
167
|
+
ariaLabelledBy = $[2];
|
|
168
|
+
controller = $[3];
|
|
169
|
+
defaultValue = $[4];
|
|
170
|
+
items = $[5];
|
|
171
|
+
onValueChange = $[6];
|
|
172
|
+
props = $[7];
|
|
173
|
+
value = $[8];
|
|
174
|
+
}
|
|
175
|
+
const [own] = useState(_temp);
|
|
176
|
+
const menu = controller ?? own;
|
|
177
|
+
const triggerId = useId();
|
|
178
|
+
let t1;
|
|
179
|
+
if ($[9] !== defaultValue || $[10] !== items || $[11] !== menu || $[12] !== onValueChange || $[13] !== value) {
|
|
180
|
+
t1 = {
|
|
181
|
+
value,
|
|
182
|
+
defaultValue,
|
|
183
|
+
onValueChange,
|
|
184
|
+
items,
|
|
185
|
+
menu
|
|
186
|
+
};
|
|
187
|
+
$[9] = defaultValue;
|
|
188
|
+
$[10] = items;
|
|
189
|
+
$[11] = menu;
|
|
190
|
+
$[12] = onValueChange;
|
|
191
|
+
$[13] = value;
|
|
192
|
+
$[14] = t1;
|
|
193
|
+
} else t1 = $[14];
|
|
194
|
+
const handle = (0, core_exports.usePrimitive)(modelSelector, t1);
|
|
195
|
+
let t2;
|
|
196
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
197
|
+
t2 = {};
|
|
198
|
+
$[15] = t2;
|
|
199
|
+
} else t2 = $[15];
|
|
200
|
+
const t3 = ariaLabel ? ariaLabelledBy : ariaLabelledBy ?? triggerId;
|
|
201
|
+
let t4;
|
|
202
|
+
if ($[16] !== handle || $[17] !== items || $[18] !== triggerId) {
|
|
203
|
+
t4 = {
|
|
204
|
+
handle,
|
|
205
|
+
items,
|
|
206
|
+
triggerId
|
|
207
|
+
};
|
|
208
|
+
$[16] = handle;
|
|
209
|
+
$[17] = items;
|
|
210
|
+
$[18] = triggerId;
|
|
211
|
+
$[19] = t4;
|
|
212
|
+
} else t4 = $[19];
|
|
213
|
+
let t5;
|
|
214
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
215
|
+
t5 = /* @__PURE__ */ jsx(ModelSelectorMark, {});
|
|
216
|
+
$[20] = t5;
|
|
217
|
+
} else t5 = $[20];
|
|
218
|
+
let t6;
|
|
219
|
+
if ($[21] !== menu || $[22] !== props) {
|
|
220
|
+
t6 = /* @__PURE__ */ jsx(Menu, {
|
|
221
|
+
controller: menu,
|
|
222
|
+
...props
|
|
223
|
+
});
|
|
224
|
+
$[21] = menu;
|
|
225
|
+
$[22] = props;
|
|
226
|
+
$[23] = t6;
|
|
227
|
+
} else t6 = $[23];
|
|
228
|
+
let t7;
|
|
229
|
+
if ($[24] !== t4 || $[25] !== t6) {
|
|
230
|
+
t7 = /* @__PURE__ */ jsxs(ModelSelectorContext, {
|
|
231
|
+
value: t4,
|
|
232
|
+
children: [t5, t6]
|
|
233
|
+
});
|
|
234
|
+
$[24] = t4;
|
|
235
|
+
$[25] = t6;
|
|
236
|
+
$[26] = t7;
|
|
237
|
+
} else t7 = $[26];
|
|
238
|
+
let t8;
|
|
239
|
+
if ($[27] !== ariaLabel || $[28] !== t3 || $[29] !== t7) {
|
|
240
|
+
t8 = {
|
|
241
|
+
role: "group",
|
|
242
|
+
"aria-label": ariaLabel,
|
|
243
|
+
"aria-labelledby": t3,
|
|
244
|
+
className: "contents",
|
|
245
|
+
children: t7
|
|
246
|
+
};
|
|
247
|
+
$[27] = ariaLabel;
|
|
248
|
+
$[28] = t3;
|
|
249
|
+
$[29] = t7;
|
|
250
|
+
$[30] = t8;
|
|
251
|
+
} else t8 = $[30];
|
|
252
|
+
return (0, core_exports.usePart)(handle, "root", t2, t8, "div");
|
|
253
|
+
}
|
|
254
|
+
function _temp() {
|
|
255
|
+
return createMenuController();
|
|
256
|
+
}
|
|
257
|
+
const SettingsContext = createContext({});
|
|
258
|
+
function SettingMark() {
|
|
259
|
+
const $ = c(2);
|
|
260
|
+
let t0;
|
|
261
|
+
let t1;
|
|
262
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
263
|
+
t0 = {};
|
|
264
|
+
t1 = { className: "pointer-events-none absolute size-0" };
|
|
265
|
+
$[0] = t0;
|
|
266
|
+
$[1] = t1;
|
|
267
|
+
} else {
|
|
268
|
+
t0 = $[0];
|
|
269
|
+
t1 = $[1];
|
|
270
|
+
}
|
|
271
|
+
return (0, core_exports.usePart)(modelSelectorSetting, "mark", t0, t1, "span");
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* A second value chosen in a selector's menu, like how hard the model thinks:
|
|
275
|
+
* wrap the `ModelSelector` in it and put a `ModelSelectorSegments` with its
|
|
276
|
+
* `name` in the menu. An agent sees it as a control of its own, named by
|
|
277
|
+
* `aria-label`, whose choices it reads and sets without opening the menu.
|
|
278
|
+
*/
|
|
279
|
+
function ModelSelectorSetting(t0) {
|
|
280
|
+
const $ = c(20);
|
|
281
|
+
const { name, value, defaultValue, onValueChange, items, "aria-label": ariaLabel, children } = t0;
|
|
282
|
+
const settings = use(SettingsContext);
|
|
283
|
+
let t1;
|
|
284
|
+
if ($[0] !== defaultValue || $[1] !== items || $[2] !== onValueChange || $[3] !== value) {
|
|
285
|
+
t1 = {
|
|
286
|
+
value,
|
|
287
|
+
defaultValue,
|
|
288
|
+
onValueChange,
|
|
289
|
+
items
|
|
290
|
+
};
|
|
291
|
+
$[0] = defaultValue;
|
|
292
|
+
$[1] = items;
|
|
293
|
+
$[2] = onValueChange;
|
|
294
|
+
$[3] = value;
|
|
295
|
+
$[4] = t1;
|
|
296
|
+
} else t1 = $[4];
|
|
297
|
+
const handle = (0, core_exports.usePrimitive)(modelSelectorSetting, t1);
|
|
298
|
+
let t2;
|
|
299
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
300
|
+
t2 = {};
|
|
301
|
+
$[5] = t2;
|
|
302
|
+
} else t2 = $[5];
|
|
303
|
+
let t3;
|
|
304
|
+
if ($[6] !== handle || $[7] !== items) {
|
|
305
|
+
t3 = {
|
|
306
|
+
handle,
|
|
307
|
+
items
|
|
308
|
+
};
|
|
309
|
+
$[6] = handle;
|
|
310
|
+
$[7] = items;
|
|
311
|
+
$[8] = t3;
|
|
312
|
+
} else t3 = $[8];
|
|
313
|
+
let t4;
|
|
314
|
+
if ($[9] !== name || $[10] !== settings || $[11] !== t3) {
|
|
315
|
+
t4 = {
|
|
316
|
+
...settings,
|
|
317
|
+
[name]: t3
|
|
318
|
+
};
|
|
319
|
+
$[9] = name;
|
|
320
|
+
$[10] = settings;
|
|
321
|
+
$[11] = t3;
|
|
322
|
+
$[12] = t4;
|
|
323
|
+
} else t4 = $[12];
|
|
324
|
+
let t5;
|
|
325
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
326
|
+
t5 = /* @__PURE__ */ jsx(SettingMark, {});
|
|
327
|
+
$[13] = t5;
|
|
328
|
+
} else t5 = $[13];
|
|
329
|
+
let t6;
|
|
330
|
+
if ($[14] !== children || $[15] !== t4) {
|
|
331
|
+
t6 = /* @__PURE__ */ jsxs(SettingsContext, {
|
|
332
|
+
value: t4,
|
|
333
|
+
children: [t5, children]
|
|
334
|
+
});
|
|
335
|
+
$[14] = children;
|
|
336
|
+
$[15] = t4;
|
|
337
|
+
$[16] = t6;
|
|
338
|
+
} else t6 = $[16];
|
|
339
|
+
let t7;
|
|
340
|
+
if ($[17] !== ariaLabel || $[18] !== t6) {
|
|
341
|
+
t7 = {
|
|
342
|
+
role: "group",
|
|
343
|
+
"aria-label": ariaLabel,
|
|
344
|
+
className: "contents",
|
|
345
|
+
children: t6
|
|
346
|
+
};
|
|
347
|
+
$[17] = ariaLabel;
|
|
348
|
+
$[18] = t6;
|
|
349
|
+
$[19] = t7;
|
|
350
|
+
} else t7 = $[19];
|
|
351
|
+
return (0, core_exports.usePart)(handle, "root", t2, t7, "div");
|
|
352
|
+
}
|
|
353
|
+
const segmentClasses = ["flex-1 justify-center rounded-full px-2 py-0 font-medium text-muted-foreground data-checked:text-foreground data-highlighted:bg-transparent data-highlighted:text-foreground", "group-not-has-[[data-placed]]/segments:data-checked:bg-background group-not-has-[[data-placed]]/segments:data-checked:shadow-sm group-not-has-[[data-placed]]/segments:data-checked:ring-1 group-not-has-[[data-placed]]/segments:data-checked:ring-border"].join(" ");
|
|
354
|
+
/**
|
|
355
|
+
* Keeps the track's `--segment-left` and `--segment-width` on its checked
|
|
356
|
+
* segment, as the segmented control's indicator does: measured from the
|
|
357
|
+
* layout, so the popup's opening scale doesn't skew it. A ref callback, whose
|
|
358
|
+
* cleanup stops watching.
|
|
359
|
+
*/
|
|
360
|
+
function followChecked(track) {
|
|
361
|
+
if (!track) return;
|
|
362
|
+
const place = () => {
|
|
363
|
+
const checked = track.querySelector("[data-slot=\"menu-radio-item\"][data-checked]");
|
|
364
|
+
if (!checked) {
|
|
365
|
+
track.style.removeProperty("--segment-left");
|
|
366
|
+
track.style.removeProperty("--segment-width");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
track.style.setProperty("--segment-left", `${checked.offsetLeft}px`);
|
|
370
|
+
track.style.setProperty("--segment-width", `${checked.offsetWidth}px`);
|
|
371
|
+
};
|
|
372
|
+
place();
|
|
373
|
+
const checks = new MutationObserver(place);
|
|
374
|
+
checks.observe(track, {
|
|
375
|
+
subtree: true,
|
|
376
|
+
attributes: true,
|
|
377
|
+
attributeFilter: ["data-checked"]
|
|
378
|
+
});
|
|
379
|
+
const sizes = new ResizeObserver(place);
|
|
380
|
+
sizes.observe(track);
|
|
381
|
+
return () => {
|
|
382
|
+
checks.disconnect();
|
|
383
|
+
sizes.disconnect();
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* A setting's choices as segments in a track, in the selector's menu. Picking
|
|
388
|
+
* one keeps the menu open, so the model can be chosen next. The arrow keys
|
|
389
|
+
* move through them like the menu's other items.
|
|
390
|
+
*/
|
|
391
|
+
function ModelSelectorSegments(t0) {
|
|
392
|
+
const $ = c(25);
|
|
393
|
+
let className;
|
|
394
|
+
let heading;
|
|
395
|
+
let hint;
|
|
396
|
+
let props;
|
|
397
|
+
let setting;
|
|
398
|
+
if ($[0] !== t0) {
|
|
399
|
+
({setting, heading, hint, className, ...props} = t0);
|
|
400
|
+
$[0] = t0;
|
|
401
|
+
$[1] = className;
|
|
402
|
+
$[2] = heading;
|
|
403
|
+
$[3] = hint;
|
|
404
|
+
$[4] = props;
|
|
405
|
+
$[5] = setting;
|
|
406
|
+
} else {
|
|
407
|
+
className = $[1];
|
|
408
|
+
heading = $[2];
|
|
409
|
+
hint = $[3];
|
|
410
|
+
props = $[4];
|
|
411
|
+
setting = $[5];
|
|
412
|
+
}
|
|
413
|
+
const scope = use(SettingsContext)[setting];
|
|
414
|
+
if (!scope) throw new Error(`ModelSelectorSegments needs a ModelSelectorSetting named "${setting}".`);
|
|
415
|
+
const { value } = usePrimitiveState(scope.handle);
|
|
416
|
+
let t1;
|
|
417
|
+
if ($[6] !== scope.handle.api) {
|
|
418
|
+
t1 = (next, details) => {
|
|
419
|
+
const { event, source } = details;
|
|
420
|
+
if (!scope.handle.api.pick(next, {
|
|
421
|
+
reason: "item-press",
|
|
422
|
+
event,
|
|
423
|
+
source
|
|
424
|
+
})) details.cancel?.();
|
|
425
|
+
};
|
|
426
|
+
$[6] = scope.handle.api;
|
|
427
|
+
$[7] = t1;
|
|
428
|
+
} else t1 = $[7];
|
|
429
|
+
let t2;
|
|
430
|
+
if ($[8] !== className) {
|
|
431
|
+
t2 = cnState("gap-1.5 px-1 pt-1 pb-0.5", className);
|
|
432
|
+
$[8] = className;
|
|
433
|
+
$[9] = t2;
|
|
434
|
+
} else t2 = $[9];
|
|
435
|
+
let t3;
|
|
436
|
+
if ($[10] !== heading || $[11] !== hint) {
|
|
437
|
+
t3 = (heading !== void 0 || hint !== void 0) && /* @__PURE__ */ jsxs("div", {
|
|
438
|
+
className: "flex items-center justify-between gap-2 px-1 text-sm",
|
|
439
|
+
children: [heading !== void 0 && /* @__PURE__ */ jsx(MenuGroupLabel, {
|
|
440
|
+
className: "p-0 text-sm text-muted-foreground",
|
|
441
|
+
children: heading
|
|
442
|
+
}), hint !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
443
|
+
className: "ms-auto text-subtle",
|
|
444
|
+
children: hint
|
|
445
|
+
})]
|
|
446
|
+
});
|
|
447
|
+
$[10] = heading;
|
|
448
|
+
$[11] = hint;
|
|
449
|
+
$[12] = t3;
|
|
450
|
+
} else t3 = $[12];
|
|
451
|
+
let t4;
|
|
452
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
453
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
454
|
+
ref: markPlaced,
|
|
455
|
+
"aria-hidden": true,
|
|
456
|
+
"data-slot": "model-selector-segments-indicator",
|
|
457
|
+
className: "pointer-events-none absolute top-1 bottom-1 left-0 -z-1 hidden w-(--segment-width) translate-x-(--segment-left) rounded-full bg-background shadow-sm ring-1 ring-border group-[[style*=--segment-width]]/segments:block motion-safe:data-placed:transition-[translate,width] motion-safe:data-placed:duration-popup motion-safe:data-placed:ease-in-out"
|
|
458
|
+
});
|
|
459
|
+
$[13] = t4;
|
|
460
|
+
} else t4 = $[13];
|
|
461
|
+
let t5;
|
|
462
|
+
if ($[14] !== scope.items) {
|
|
463
|
+
t5 = scope.items.map(_temp2);
|
|
464
|
+
$[14] = scope.items;
|
|
465
|
+
$[15] = t5;
|
|
466
|
+
} else t5 = $[15];
|
|
467
|
+
let t6;
|
|
468
|
+
if ($[16] !== t5) {
|
|
469
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
470
|
+
ref: followChecked,
|
|
471
|
+
"data-slot": "model-selector-segments",
|
|
472
|
+
className: "group/segments relative isolate flex h-9 items-stretch rounded-full bg-muted p-1 ring-1 ring-border",
|
|
473
|
+
children: [t4, t5]
|
|
474
|
+
});
|
|
475
|
+
$[16] = t5;
|
|
476
|
+
$[17] = t6;
|
|
477
|
+
} else t6 = $[17];
|
|
478
|
+
let t7;
|
|
479
|
+
if ($[18] !== props || $[19] !== t1 || $[20] !== t2 || $[21] !== t3 || $[22] !== t6 || $[23] !== value) {
|
|
480
|
+
t7 = /* @__PURE__ */ jsxs(MenuRadioGroup, {
|
|
481
|
+
value,
|
|
482
|
+
onValueChange: t1,
|
|
483
|
+
className: t2,
|
|
484
|
+
...props,
|
|
485
|
+
children: [t3, t6]
|
|
486
|
+
});
|
|
487
|
+
$[18] = props;
|
|
488
|
+
$[19] = t1;
|
|
489
|
+
$[20] = t2;
|
|
490
|
+
$[21] = t3;
|
|
491
|
+
$[22] = t6;
|
|
492
|
+
$[23] = value;
|
|
493
|
+
$[24] = t7;
|
|
494
|
+
} else t7 = $[24];
|
|
495
|
+
return t7;
|
|
496
|
+
}
|
|
497
|
+
function _temp2(item) {
|
|
498
|
+
return /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
499
|
+
value: item.value,
|
|
500
|
+
disabled: item.disabled,
|
|
501
|
+
closeOnSelect: false,
|
|
502
|
+
className: segmentClasses,
|
|
503
|
+
children: item.label
|
|
504
|
+
}, item.value);
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* The button that opens the menu, sized for a prompt input's footer: a quiet
|
|
508
|
+
* pill that takes a fill while its menu is open, with its last icon, the
|
|
509
|
+
* chevron, turned over. Its children are what it shows, usually a logo, the
|
|
510
|
+
* selected item's name and a chevron. When they don't say what the value is
|
|
511
|
+
* for, name it with an `aria-label`.
|
|
512
|
+
*/
|
|
513
|
+
function ModelSelectorTrigger(t0) {
|
|
514
|
+
const $ = c(11);
|
|
515
|
+
let className;
|
|
516
|
+
let props;
|
|
517
|
+
let t1;
|
|
518
|
+
if ($[0] !== t0) {
|
|
519
|
+
({variant: t1, className, ...props} = t0);
|
|
520
|
+
$[0] = t0;
|
|
521
|
+
$[1] = className;
|
|
522
|
+
$[2] = props;
|
|
523
|
+
$[3] = t1;
|
|
524
|
+
} else {
|
|
525
|
+
className = $[1];
|
|
526
|
+
props = $[2];
|
|
527
|
+
t1 = $[3];
|
|
528
|
+
}
|
|
529
|
+
const variant = t1 === void 0 ? "ghost" : t1;
|
|
530
|
+
const { triggerId } = useScope();
|
|
531
|
+
let t2;
|
|
532
|
+
if ($[4] !== className || $[5] !== variant) {
|
|
533
|
+
t2 = cnState([
|
|
534
|
+
inputGroupButtonVariants({
|
|
535
|
+
variant,
|
|
536
|
+
size: "sm"
|
|
537
|
+
}),
|
|
538
|
+
"rounded-full font-normal data-open:bg-accent",
|
|
539
|
+
"[&>[data-slot=icon]:last-child]:text-subtle [&>[data-slot=icon]:last-child]:transition-[rotate] [&>[data-slot=icon]:last-child]:duration-quick [&>[data-slot=icon]:last-child]:ease-out data-open:[&>[data-slot=icon]:last-child]:rotate-180 motion-reduce:[&>[data-slot=icon]:last-child]:transition-none"
|
|
540
|
+
], className);
|
|
541
|
+
$[4] = className;
|
|
542
|
+
$[5] = variant;
|
|
543
|
+
$[6] = t2;
|
|
544
|
+
} else t2 = $[6];
|
|
545
|
+
let t3;
|
|
546
|
+
if ($[7] !== props || $[8] !== t2 || $[9] !== triggerId) {
|
|
547
|
+
t3 = /* @__PURE__ */ jsx(MenuTrigger, {
|
|
548
|
+
id: triggerId,
|
|
549
|
+
"data-agent-hidden": "",
|
|
550
|
+
className: t2,
|
|
551
|
+
...props
|
|
552
|
+
});
|
|
553
|
+
$[7] = props;
|
|
554
|
+
$[8] = t2;
|
|
555
|
+
$[9] = triggerId;
|
|
556
|
+
$[10] = t3;
|
|
557
|
+
} else t3 = $[10];
|
|
558
|
+
return t3;
|
|
559
|
+
}
|
|
560
|
+
/** The selector's `items` as groups: loose choices that follow each other share one. */
|
|
561
|
+
function groupsOf(items) {
|
|
562
|
+
const groups = [];
|
|
563
|
+
let loose;
|
|
564
|
+
for (const item of items) if ("type" in item) {
|
|
565
|
+
loose = void 0;
|
|
566
|
+
groups.push({
|
|
567
|
+
label: item.label,
|
|
568
|
+
items: [...item.items]
|
|
569
|
+
});
|
|
570
|
+
} else if (loose) loose.push(item);
|
|
571
|
+
else {
|
|
572
|
+
loose = [item];
|
|
573
|
+
groups.push({ items: loose });
|
|
574
|
+
}
|
|
575
|
+
return groups;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* The menu's popup. It holds `ModelSelectorGroup`s, with separators between
|
|
579
|
+
* them. Without children it renders the selector's `items`.
|
|
580
|
+
*/
|
|
581
|
+
function ModelSelectorContent(t0) {
|
|
582
|
+
const $ = c(15);
|
|
583
|
+
let children;
|
|
584
|
+
let className;
|
|
585
|
+
let props;
|
|
586
|
+
let t1;
|
|
587
|
+
if ($[0] !== t0) {
|
|
588
|
+
({align: t1, className, children, ...props} = t0);
|
|
589
|
+
$[0] = t0;
|
|
590
|
+
$[1] = children;
|
|
591
|
+
$[2] = className;
|
|
592
|
+
$[3] = props;
|
|
593
|
+
$[4] = t1;
|
|
594
|
+
} else {
|
|
595
|
+
children = $[1];
|
|
596
|
+
className = $[2];
|
|
597
|
+
props = $[3];
|
|
598
|
+
t1 = $[4];
|
|
599
|
+
}
|
|
600
|
+
const align = t1 === void 0 ? "start" : t1;
|
|
601
|
+
const { items } = useScope();
|
|
602
|
+
let t2;
|
|
603
|
+
if ($[5] !== className) {
|
|
604
|
+
t2 = cnState("min-w-36", className);
|
|
605
|
+
$[5] = className;
|
|
606
|
+
$[6] = t2;
|
|
607
|
+
} else t2 = $[6];
|
|
608
|
+
let t3;
|
|
609
|
+
if ($[7] !== children || $[8] !== items) {
|
|
610
|
+
t3 = children ?? (items && groupsOf(items).map(_temp4));
|
|
611
|
+
$[7] = children;
|
|
612
|
+
$[8] = items;
|
|
613
|
+
$[9] = t3;
|
|
614
|
+
} else t3 = $[9];
|
|
615
|
+
let t4;
|
|
616
|
+
if ($[10] !== align || $[11] !== props || $[12] !== t2 || $[13] !== t3) {
|
|
617
|
+
t4 = /* @__PURE__ */ jsx(MenuContent, {
|
|
618
|
+
align,
|
|
619
|
+
className: t2,
|
|
620
|
+
...props,
|
|
621
|
+
children: t3
|
|
622
|
+
});
|
|
623
|
+
$[10] = align;
|
|
624
|
+
$[11] = props;
|
|
625
|
+
$[12] = t2;
|
|
626
|
+
$[13] = t3;
|
|
627
|
+
$[14] = t4;
|
|
628
|
+
} else t4 = $[14];
|
|
629
|
+
return t4;
|
|
630
|
+
}
|
|
631
|
+
function _temp4(group, index) {
|
|
632
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [index > 0 && /* @__PURE__ */ jsx(ModelSelectorSeparator, {}), /* @__PURE__ */ jsx(ModelSelectorGroup, {
|
|
633
|
+
heading: group.label,
|
|
634
|
+
children: group.items.map(_temp3)
|
|
635
|
+
})] }, index);
|
|
636
|
+
}
|
|
637
|
+
function _temp3(item) {
|
|
638
|
+
return /* @__PURE__ */ jsx(ModelSelectorItem, {
|
|
639
|
+
value: item.value,
|
|
640
|
+
disabled: item.disabled,
|
|
641
|
+
children: item.label
|
|
642
|
+
}, item.value);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* A set of items under an optional `heading`. Every item sits in a group, and
|
|
646
|
+
* every group of a selector chooses the same value: a group whose items don't
|
|
647
|
+
* hold it has nothing checked.
|
|
648
|
+
*/
|
|
649
|
+
function ModelSelectorGroup(t0) {
|
|
650
|
+
const $ = c(12);
|
|
651
|
+
let children;
|
|
652
|
+
let heading;
|
|
653
|
+
let props;
|
|
654
|
+
if ($[0] !== t0) {
|
|
655
|
+
({heading, children, ...props} = t0);
|
|
656
|
+
$[0] = t0;
|
|
657
|
+
$[1] = children;
|
|
658
|
+
$[2] = heading;
|
|
659
|
+
$[3] = props;
|
|
660
|
+
} else {
|
|
661
|
+
children = $[1];
|
|
662
|
+
heading = $[2];
|
|
663
|
+
props = $[3];
|
|
664
|
+
}
|
|
665
|
+
const { value, onValueChange } = useModelSelector();
|
|
666
|
+
let t1;
|
|
667
|
+
if ($[4] !== heading) {
|
|
668
|
+
t1 = heading !== void 0 && /* @__PURE__ */ jsx(MenuGroupLabel, { children: heading });
|
|
669
|
+
$[4] = heading;
|
|
670
|
+
$[5] = t1;
|
|
671
|
+
} else t1 = $[5];
|
|
672
|
+
let t2;
|
|
673
|
+
if ($[6] !== children || $[7] !== onValueChange || $[8] !== props || $[9] !== t1 || $[10] !== value) {
|
|
674
|
+
t2 = /* @__PURE__ */ jsxs(MenuRadioGroup, {
|
|
675
|
+
value,
|
|
676
|
+
onValueChange,
|
|
677
|
+
...props,
|
|
678
|
+
children: [t1, children]
|
|
679
|
+
});
|
|
680
|
+
$[6] = children;
|
|
681
|
+
$[7] = onValueChange;
|
|
682
|
+
$[8] = props;
|
|
683
|
+
$[9] = t1;
|
|
684
|
+
$[10] = value;
|
|
685
|
+
$[11] = t2;
|
|
686
|
+
} else t2 = $[11];
|
|
687
|
+
return t2;
|
|
688
|
+
}
|
|
689
|
+
const itemClasses = "has-data-[slot=model-selector-description]:gap-3 has-data-[slot=model-selector-description]:py-2 [&>[data-slot=icon]]:size-5";
|
|
690
|
+
/**
|
|
691
|
+
* One choice. Picking it closes the menu, and the selected one shows a check.
|
|
692
|
+
* With a `ModelSelectorDescription` inside its `ModelSelectorName` it is two
|
|
693
|
+
* lines tall; give it a `label` with the name alone for typeahead.
|
|
694
|
+
*/
|
|
695
|
+
function ModelSelectorItem(t0) {
|
|
696
|
+
const $ = c(20);
|
|
697
|
+
let children;
|
|
698
|
+
let className;
|
|
699
|
+
let props;
|
|
700
|
+
let t1;
|
|
701
|
+
if ($[0] !== t0) {
|
|
702
|
+
({closeOnSelect: t1, className, children, ...props} = t0);
|
|
703
|
+
$[0] = t0;
|
|
704
|
+
$[1] = children;
|
|
705
|
+
$[2] = className;
|
|
706
|
+
$[3] = props;
|
|
707
|
+
$[4] = t1;
|
|
708
|
+
} else {
|
|
709
|
+
children = $[1];
|
|
710
|
+
className = $[2];
|
|
711
|
+
props = $[3];
|
|
712
|
+
t1 = $[4];
|
|
713
|
+
}
|
|
714
|
+
const closeOnSelect = t1 === void 0 ? true : t1;
|
|
715
|
+
let t2;
|
|
716
|
+
if ($[5] !== props.disabled || $[6] !== props.value) {
|
|
717
|
+
t2 = {
|
|
718
|
+
value: props.value,
|
|
719
|
+
disabled: props.disabled
|
|
720
|
+
};
|
|
721
|
+
$[5] = props.disabled;
|
|
722
|
+
$[6] = props.value;
|
|
723
|
+
$[7] = t2;
|
|
724
|
+
} else t2 = $[7];
|
|
725
|
+
let t3;
|
|
726
|
+
if ($[8] !== className) {
|
|
727
|
+
t3 = cnState(itemClasses, className);
|
|
728
|
+
$[8] = className;
|
|
729
|
+
$[9] = t3;
|
|
730
|
+
} else t3 = $[9];
|
|
731
|
+
let t4;
|
|
732
|
+
if ($[10] !== closeOnSelect || $[11] !== props || $[12] !== t3) {
|
|
733
|
+
t4 = /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
734
|
+
closeOnSelect,
|
|
735
|
+
className: t3,
|
|
736
|
+
...props
|
|
737
|
+
});
|
|
738
|
+
$[10] = closeOnSelect;
|
|
739
|
+
$[11] = props;
|
|
740
|
+
$[12] = t3;
|
|
741
|
+
$[13] = t4;
|
|
742
|
+
} else t4 = $[13];
|
|
743
|
+
let t5;
|
|
744
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
745
|
+
t5 = /* @__PURE__ */ jsx(MenuItemIndicator, {});
|
|
746
|
+
$[14] = t5;
|
|
747
|
+
} else t5 = $[14];
|
|
748
|
+
let t6;
|
|
749
|
+
if ($[15] !== children) {
|
|
750
|
+
t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [children, t5] });
|
|
751
|
+
$[15] = children;
|
|
752
|
+
$[16] = t6;
|
|
753
|
+
} else t6 = $[16];
|
|
754
|
+
let t7;
|
|
755
|
+
if ($[17] !== t4 || $[18] !== t6) {
|
|
756
|
+
t7 = {
|
|
757
|
+
render: t4,
|
|
758
|
+
children: t6
|
|
759
|
+
};
|
|
760
|
+
$[17] = t4;
|
|
761
|
+
$[18] = t6;
|
|
762
|
+
$[19] = t7;
|
|
763
|
+
} else t7 = $[19];
|
|
764
|
+
return (0, core_exports.usePart)(modelSelector, "item", t2, t7, "div");
|
|
765
|
+
}
|
|
766
|
+
/** A line between two groups, from one edge of the popup to the other. */
|
|
767
|
+
function ModelSelectorSeparator(props) {
|
|
768
|
+
const $ = c(2);
|
|
769
|
+
let t0;
|
|
770
|
+
if ($[0] !== props) {
|
|
771
|
+
t0 = /* @__PURE__ */ jsx(MenuSeparator, { ...props });
|
|
772
|
+
$[0] = props;
|
|
773
|
+
$[1] = t0;
|
|
774
|
+
} else t0 = $[1];
|
|
775
|
+
return t0;
|
|
776
|
+
}
|
|
777
|
+
/** A key hint at the end of an item. */
|
|
778
|
+
function ModelSelectorShortcut(props) {
|
|
779
|
+
const $ = c(2);
|
|
780
|
+
let t0;
|
|
781
|
+
if ($[0] !== props) {
|
|
782
|
+
t0 = /* @__PURE__ */ jsx(MenuShortcut, { ...props });
|
|
783
|
+
$[0] = props;
|
|
784
|
+
$[1] = t0;
|
|
785
|
+
} else t0 = $[1];
|
|
786
|
+
return t0;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* A provider's logo, loaded from models.dev unless it is given a `src`. It is
|
|
790
|
+
* decorative next to the model's name; give it an `alt` when it stands alone.
|
|
791
|
+
*/
|
|
792
|
+
function ModelSelectorLogo({ provider, src = `https://models.dev/logos/${provider}.svg`, alt = "", className, ...props }) {
|
|
793
|
+
return /* @__PURE__ */ jsx("img", {
|
|
794
|
+
"data-slot": "model-selector-logo",
|
|
795
|
+
width: 12,
|
|
796
|
+
height: 12,
|
|
797
|
+
...props,
|
|
798
|
+
src,
|
|
799
|
+
alt,
|
|
800
|
+
className: cn("size-3 shrink-0 dark:invert", className)
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
/** The logos of the providers that serve one model, overlapped. */
|
|
804
|
+
function ModelSelectorLogoGroup(t0) {
|
|
805
|
+
const $ = c(8);
|
|
806
|
+
let className;
|
|
807
|
+
let props;
|
|
808
|
+
if ($[0] !== t0) {
|
|
809
|
+
({className, ...props} = t0);
|
|
810
|
+
$[0] = t0;
|
|
811
|
+
$[1] = className;
|
|
812
|
+
$[2] = props;
|
|
813
|
+
} else {
|
|
814
|
+
className = $[1];
|
|
815
|
+
props = $[2];
|
|
816
|
+
}
|
|
817
|
+
let t1;
|
|
818
|
+
if ($[3] !== className) {
|
|
819
|
+
t1 = cn("flex shrink-0 items-center -space-x-1 *:[img]:rounded-full *:[img]:bg-background *:[img]:p-px *:[img]:ring-1 *:[img]:ring-border dark:*:[img]:bg-foreground", className);
|
|
820
|
+
$[3] = className;
|
|
821
|
+
$[4] = t1;
|
|
822
|
+
} else t1 = $[4];
|
|
823
|
+
let t2;
|
|
824
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
825
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
826
|
+
"data-slot": "model-selector-logo-group",
|
|
827
|
+
className: t1,
|
|
828
|
+
...props
|
|
829
|
+
});
|
|
830
|
+
$[5] = props;
|
|
831
|
+
$[6] = t1;
|
|
832
|
+
$[7] = t2;
|
|
833
|
+
} else t2 = $[7];
|
|
834
|
+
return t2;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* A model's name, cut short when it doesn't fit. A `ModelSelectorDescription`
|
|
838
|
+
* inside it goes on a second line.
|
|
839
|
+
*/
|
|
840
|
+
function ModelSelectorName(t0) {
|
|
841
|
+
const $ = c(8);
|
|
842
|
+
let className;
|
|
843
|
+
let props;
|
|
844
|
+
if ($[0] !== t0) {
|
|
845
|
+
({className, ...props} = t0);
|
|
846
|
+
$[0] = t0;
|
|
847
|
+
$[1] = className;
|
|
848
|
+
$[2] = props;
|
|
849
|
+
} else {
|
|
850
|
+
className = $[1];
|
|
851
|
+
props = $[2];
|
|
852
|
+
}
|
|
853
|
+
let t1;
|
|
854
|
+
if ($[3] !== className) {
|
|
855
|
+
t1 = cn("min-w-0 flex-1 truncate text-start has-data-[slot=model-selector-description]:flex has-data-[slot=model-selector-description]:flex-col", className);
|
|
856
|
+
$[3] = className;
|
|
857
|
+
$[4] = t1;
|
|
858
|
+
} else t1 = $[4];
|
|
859
|
+
let t2;
|
|
860
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
861
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
862
|
+
"data-slot": "model-selector-name",
|
|
863
|
+
className: t1,
|
|
864
|
+
...props
|
|
865
|
+
});
|
|
866
|
+
$[5] = props;
|
|
867
|
+
$[6] = t1;
|
|
868
|
+
$[7] = t2;
|
|
869
|
+
} else t2 = $[7];
|
|
870
|
+
return t2;
|
|
871
|
+
}
|
|
872
|
+
/** What a model is for, like "Fastest for quick answers", under its name. */
|
|
873
|
+
function ModelSelectorDescription(t0) {
|
|
874
|
+
const $ = c(8);
|
|
875
|
+
let className;
|
|
876
|
+
let props;
|
|
877
|
+
if ($[0] !== t0) {
|
|
878
|
+
({className, ...props} = t0);
|
|
879
|
+
$[0] = t0;
|
|
880
|
+
$[1] = className;
|
|
881
|
+
$[2] = props;
|
|
882
|
+
} else {
|
|
883
|
+
className = $[1];
|
|
884
|
+
props = $[2];
|
|
885
|
+
}
|
|
886
|
+
let t1;
|
|
887
|
+
if ($[3] !== className) {
|
|
888
|
+
t1 = cn("truncate text-xs text-muted-foreground", className);
|
|
889
|
+
$[3] = className;
|
|
890
|
+
$[4] = t1;
|
|
891
|
+
} else t1 = $[4];
|
|
892
|
+
let t2;
|
|
893
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
894
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
895
|
+
"data-slot": "model-selector-description",
|
|
896
|
+
className: t1,
|
|
897
|
+
...props
|
|
898
|
+
});
|
|
899
|
+
$[5] = props;
|
|
900
|
+
$[6] = t1;
|
|
901
|
+
$[7] = t2;
|
|
902
|
+
} else t2 = $[7];
|
|
903
|
+
return t2;
|
|
904
|
+
}
|
|
905
|
+
export { ModelSelector, ModelSelectorContent, ModelSelectorDescription, ModelSelectorGroup, ModelSelectorItem, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorName, ModelSelectorSegments, ModelSelectorSeparator, ModelSelectorSetting, ModelSelectorShortcut, ModelSelectorTrigger, createMenuController as createModelSelectorController, useModelSelector };
|