@kitn.ai/ui 0.28.0 → 0.29.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 +1 -1
- package/dist/agent-tooling/construct/public.d.ts +15 -0
- package/dist/agent-tooling/construct/schema.d.ts +111 -0
- package/dist/construct-cli.es.js +3 -3
- package/dist/construct.d.ts +5 -0
- package/dist/construct.js +327 -0
- package/dist/core-C8fzo39E.js +1 -12
- package/dist/engine-javascript-C1x7zo1_.js +1 -141
- package/dist/mcp.es.js +1 -1
- package/package.json +16 -16
- package/bin/route.test.js +0 -58
- package/src/agent-tooling/README.md +0 -192
- package/src/agent-tooling/archetypes.ts +0 -205
- package/src/agent-tooling/catalog/README.md +0 -676
- package/src/agent-tooling/catalog/catalog-types.ts +0 -231
- package/src/agent-tooling/catalog/fabrications.ts +0 -96
- package/src/agent-tooling/catalog/invariants.ts +0 -284
- package/src/agent-tooling/catalog/labs-titles.ts +0 -114
- package/src/agent-tooling/catalog/scenarios.ts +0 -87
- package/src/agent-tooling/catalog/surfaces.ts +0 -347
- package/src/agent-tooling/construct/cli-entry.ts +0 -8
- package/src/agent-tooling/construct/cli.ts +0 -147
- package/src/agent-tooling/construct/codegen.ts +0 -1635
- package/src/agent-tooling/construct/construct.v1.schema.json +0 -319
- package/src/agent-tooling/construct/dev.ts +0 -148
- package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +0 -7
- package/src/agent-tooling/construct/fixtures/ops-console.construct.json +0 -44
- package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +0 -32
- package/src/agent-tooling/construct/schema.ts +0 -452
- package/src/agent-tooling/integrations/anthropic.ts +0 -442
- package/src/agent-tooling/integrations/cloudflare.ts +0 -218
- package/src/agent-tooling/integrations/langgraph.ts +0 -133
- package/src/agent-tooling/integrations/mastra.ts +0 -182
- package/src/agent-tooling/integrations/mock.ts +0 -148
- package/src/agent-tooling/integrations/ollama.ts +0 -97
- package/src/agent-tooling/integrations/openai.ts +0 -95
- package/src/agent-tooling/integrations/openrouter.ts +0 -82
- package/src/agent-tooling/integrations/pi.ts +0 -176
- package/src/agent-tooling/integrations/pydantic-ai.ts +0 -108
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +0 -398
- package/src/agent-tooling/mcp/css-raw.d.ts +0 -12
- package/src/agent-tooling/mcp/manifest.ts +0 -422
- package/src/agent-tooling/mcp/server.ts +0 -116
- package/src/agent-tooling/mcp/stdio.ts +0 -18
- package/src/agent-tooling/mcp/tools/construct.ts +0 -130
- package/src/agent-tooling/mcp/tools/debug.ts +0 -621
- package/src/agent-tooling/mcp/tools/reference.ts +0 -980
- package/src/agent-tooling/mcp/tools/scaffold.ts +0 -6708
- package/src/agent-tooling/mcp/tools/theme.ts +0 -456
- package/src/agent-tooling/mcp/tools/types.ts +0 -14
- package/src/agent-tooling/mcp/validate-args.ts +0 -141
- package/src/agent-tooling/recipes/composed-thread.ts +0 -714
- package/src/agent-tooling/recipes/index.ts +0 -22
- package/src/agent-tooling/recipes/types.ts +0 -32
- package/src/agent-tooling/registry.ts +0 -132
- package/src/agent-tooling/route-emit.ts +0 -305
- package/src/agent-tooling/types.ts +0 -390
- package/src/components/artifact-card.tsx +0 -120
- package/src/components/artifact.tsx +0 -914
- package/src/components/attachment-types.ts +0 -66
- package/src/components/attachments.tsx +0 -536
- package/src/components/audio-visualizer/audio-visualizer.voice-fixture.ts +0 -257
- package/src/components/audio-visualizer/aurora.glsl.ts +0 -330
- package/src/components/audio-visualizer/fit-scale.ts +0 -112
- package/src/components/audio-visualizer/index.tsx +0 -528
- package/src/components/audio-visualizer/labs/lab-choreography.ts +0 -187
- package/src/components/audio-visualizer/labs/lab-shaders.ts +0 -363
- package/src/components/audio-visualizer/labs/lab-visualizer.tsx +0 -102
- package/src/components/audio-visualizer/shader-canvas.tsx +0 -876
- package/src/components/audio-visualizer/sizes.ts +0 -54
- package/src/components/audio-visualizer/variant-aurora.tsx +0 -305
- package/src/components/audio-visualizer/variant-bar.tsx +0 -175
- package/src/components/audio-visualizer/variant-custom.tsx +0 -344
- package/src/components/audio-visualizer/variant-grid.tsx +0 -175
- package/src/components/audio-visualizer/variant-radial.tsx +0 -163
- package/src/components/audio-visualizer/variant-wave.tsx +0 -130
- package/src/components/audio-visualizer/wave.glsl.ts +0 -130
- package/src/components/card-fallback.tsx +0 -60
- package/src/components/card-renderer.tsx +0 -220
- package/src/components/card.tsx +0 -212
- package/src/components/chain-of-thought.tsx +0 -348
- package/src/components/chat-container.tsx +0 -89
- package/src/components/chat-scope-picker.tsx +0 -57
- package/src/components/chat-thread.tsx +0 -1014
- package/src/components/checkpoint.tsx +0 -88
- package/src/components/choice-card.tsx +0 -743
- package/src/components/coachmark.tsx +0 -249
- package/src/components/code-block.tsx +0 -181
- package/src/components/composer-dom.ts +0 -159
- package/src/components/composer-highlight.ts +0 -242
- package/src/components/composer-history.ts +0 -82
- package/src/components/composer.tsx +0 -1075
- package/src/components/confirm-card.tsx +0 -402
- package/src/components/context.tsx +0 -377
- package/src/components/conversation-item.tsx +0 -241
- package/src/components/conversation-list.tsx +0 -429
- package/src/components/conversation-panel.tsx +0 -118
- package/src/components/dismissed-stub.tsx +0 -80
- package/src/components/embed.tsx +0 -200
- package/src/components/empty.tsx +0 -177
- package/src/components/feedback-bar.tsx +0 -166
- package/src/components/file-tree.tsx +0 -530
- package/src/components/file-upload.tsx +0 -167
- package/src/components/form-widgets.tsx +0 -525
- package/src/components/form.tsx +0 -1296
- package/src/components/home-panel.tsx +0 -159
- package/src/components/image.tsx +0 -65
- package/src/components/link-preview.tsx +0 -195
- package/src/components/loader.tsx +0 -367
- package/src/components/markdown.tsx +0 -162
- package/src/components/message-skills.tsx +0 -40
- package/src/components/message.tsx +0 -765
- package/src/components/model-switcher.tsx +0 -132
- package/src/components/prompt-input.tsx +0 -188
- package/src/components/prompt-suggestion.tsx +0 -150
- package/src/components/reasoning.tsx +0 -293
- package/src/components/response-compare-types.ts +0 -152
- package/src/components/response-compare.tsx +0 -455
- package/src/components/response-stream.tsx +0 -109
- package/src/components/screen.tsx +0 -181
- package/src/components/scroll-button.tsx +0 -93
- package/src/components/source.tsx +0 -192
- package/src/components/tasks-card.tsx +0 -801
- package/src/components/text-shimmer.tsx +0 -37
- package/src/components/thinking-bar.tsx +0 -50
- package/src/components/thread.tsx +0 -228
- package/src/components/toast.tsx +0 -503
- package/src/components/tool-classify.ts +0 -26
- package/src/components/tool-types.ts +0 -49
- package/src/components/tool.tsx +0 -190
- package/src/components/use-card-resolution.ts +0 -44
- package/src/components/voice-input.tsx +0 -222
- package/src/components/voice-output.tsx +0 -242
- package/src/components/widget-tab-bar.tsx +0 -73
- package/src/components/workspace-shell.tsx +0 -285
- package/src/diagnostics/hook.ts +0 -352
- package/src/diagnostics/index.ts +0 -82
- package/src/diagnostics/report-request.ts +0 -296
- package/src/elements/agent-card.tsx +0 -67
- package/src/elements/artifact.tsx +0 -194
- package/src/elements/attachments.tsx +0 -140
- package/src/elements/audio-visualizer.tsx +0 -227
- package/src/elements/autoloader.ts +0 -89
- package/src/elements/avatar.tsx +0 -33
- package/src/elements/badge.tsx +0 -32
- package/src/elements/button.tsx +0 -149
- package/src/elements/card.tsx +0 -133
- package/src/elements/cards.tsx +0 -266
- package/src/elements/chain-of-thought.tsx +0 -141
- package/src/elements/chat-scope-picker.tsx +0 -65
- package/src/elements/chat-types.ts +0 -102
- package/src/elements/chat-workspace.tsx +0 -188
- package/src/elements/chat.tsx +0 -304
- package/src/elements/checkbox-group.tsx +0 -164
- package/src/elements/checkbox.tsx +0 -134
- package/src/elements/checkpoint.tsx +0 -47
- package/src/elements/choice.tsx +0 -100
- package/src/elements/coachmark.tsx +0 -90
- package/src/elements/code-block.tsx +0 -60
- package/src/elements/command.tsx +0 -197
- package/src/elements/compare.tsx +0 -111
- package/src/elements/compiled.css +0 -2
- package/src/elements/composer.tsx +0 -162
- package/src/elements/confirm-card.tsx +0 -76
- package/src/elements/context-meter.tsx +0 -107
- package/src/elements/conversation-item.tsx +0 -120
- package/src/elements/conversation-list.tsx +0 -203
- package/src/elements/css.ts +0 -5
- package/src/elements/default-input.tsx +0 -392
- package/src/elements/define-entry.ts +0 -12
- package/src/elements/define.tsx +0 -563
- package/src/elements/diagnostic-events.ts +0 -114
- package/src/elements/dialog.tsx +0 -145
- package/src/elements/disclosure.ts +0 -95
- package/src/elements/dock.tsx +0 -215
- package/src/elements/dropdown.tsx +0 -123
- package/src/elements/editable-label.tsx +0 -140
- package/src/elements/element-data-types.ts +0 -152
- package/src/elements/element-diagnostics.ts +0 -392
- package/src/elements/element-manifest.json +0 -354
- package/src/elements/element-nonscalar.json +0 -187
- package/src/elements/element-types.d.ts +0 -4353
- package/src/elements/embed.tsx +0 -35
- package/src/elements/empty.tsx +0 -29
- package/src/elements/feedback-bar.tsx +0 -66
- package/src/elements/file-tree.tsx +0 -62
- package/src/elements/file-upload.tsx +0 -44
- package/src/elements/form.tsx +0 -94
- package/src/elements/hover-card.tsx +0 -80
- package/src/elements/icon.tsx +0 -41
- package/src/elements/image.tsx +0 -32
- package/src/elements/input.tsx +0 -492
- package/src/elements/kbd.tsx +0 -45
- package/src/elements/link-preview.tsx +0 -34
- package/src/elements/loader.tsx +0 -25
- package/src/elements/markdown.tsx +0 -38
- package/src/elements/menu.tsx +0 -241
- package/src/elements/message-skills.tsx +0 -83
- package/src/elements/message.tsx +0 -361
- package/src/elements/model-switcher.tsx +0 -121
- package/src/elements/nav.tsx +0 -87
- package/src/elements/notice.tsx +0 -53
- package/src/elements/pane-grid.tsx +0 -111
- package/src/elements/pane-group.tsx +0 -119
- package/src/elements/pane.tsx +0 -129
- package/src/elements/popover.tsx +0 -81
- package/src/elements/progress-bar.tsx +0 -39
- package/src/elements/prompt-dock.tsx +0 -82
- package/src/elements/prompt-input.tsx +0 -240
- package/src/elements/prompt-suggestions.tsx +0 -113
- package/src/elements/radio-group.tsx +0 -129
- package/src/elements/reasoning.tsx +0 -71
- package/src/elements/register-impl.ts +0 -148
- package/src/elements/register.ts +0 -76
- package/src/elements/remote.tsx +0 -225
- package/src/elements/resizable.globals.d.ts +0 -36
- package/src/elements/resizable.tsx +0 -704
- package/src/elements/response-stream.tsx +0 -40
- package/src/elements/screen.tsx +0 -90
- package/src/elements/scroll-area.tsx +0 -33
- package/src/elements/scroll-button.tsx +0 -179
- package/src/elements/search.tsx +0 -185
- package/src/elements/segmented.tsx +0 -129
- package/src/elements/select.tsx +0 -165
- package/src/elements/separator.tsx +0 -36
- package/src/elements/setting-item.tsx +0 -50
- package/src/elements/settings-group.tsx +0 -37
- package/src/elements/skeleton.tsx +0 -45
- package/src/elements/slider.tsx +0 -171
- package/src/elements/slot-text.ts +0 -73
- package/src/elements/slots.ts +0 -787
- package/src/elements/source.tsx +0 -126
- package/src/elements/status.tsx +0 -42
- package/src/elements/styles.css +0 -328
- package/src/elements/switch.tsx +0 -118
- package/src/elements/tabs.tsx +0 -95
- package/src/elements/tasks.tsx +0 -103
- package/src/elements/text-shimmer.tsx +0 -28
- package/src/elements/thinking-bar.tsx +0 -43
- package/src/elements/thread.tsx +0 -139
- package/src/elements/toast.tsx +0 -106
- package/src/elements/tool.tsx +0 -78
- package/src/elements/tooltip.tsx +0 -85
- package/src/elements/validate-messages.ts +0 -76
- package/src/elements/voice-input.tsx +0 -100
- package/src/elements/voice-output.tsx +0 -82
- package/src/index.ts +0 -430
- package/src/primitives/audio-bands.ts +0 -174
- package/src/primitives/card-component-types.ts +0 -63
- package/src/primitives/card-contract.ts +0 -80
- package/src/primitives/card-data-types.ts +0 -361
- package/src/primitives/card-host.tsx +0 -37
- package/src/primitives/card-recovery.ts +0 -160
- package/src/primitives/card-registry.tsx +0 -78
- package/src/primitives/card-resolution.ts +0 -36
- package/src/primitives/card-routing.ts +0 -85
- package/src/primitives/card-schemas/artifact.schema.json +0 -92
- package/src/primitives/card-schemas/card-envelope.schema.json +0 -14
- package/src/primitives/card-schemas/card-event.schema.json +0 -12
- package/src/primitives/card-schemas/choice.schema.json +0 -75
- package/src/primitives/card-schemas/confirm.schema.json +0 -65
- package/src/primitives/card-schemas/embed.schema.json +0 -63
- package/src/primitives/card-schemas/form.result.schema.json +0 -7
- package/src/primitives/card-schemas/form.schema.json +0 -53
- package/src/primitives/card-schemas/link.schema.json +0 -54
- package/src/primitives/card-schemas/tasks.result.schema.json +0 -16
- package/src/primitives/card-schemas/tasks.schema.json +0 -83
- package/src/primitives/card-tags.ts +0 -61
- package/src/primitives/card-validate-cards.ts +0 -255
- package/src/primitives/card-validate-schemas.ts +0 -58
- package/src/primitives/card-validate.ts +0 -131
- package/src/primitives/chat-config.tsx +0 -103
- package/src/primitives/composer-model.ts +0 -49
- package/src/primitives/composer-triggers.ts +0 -35
- package/src/primitives/controllable.ts +0 -21
- package/src/primitives/conversation-store.ts +0 -248
- package/src/primitives/create-kai-chat.ts +0 -66
- package/src/primitives/create-tween.ts +0 -266
- package/src/primitives/embed-providers.ts +0 -254
- package/src/primitives/field-mask.ts +0 -256
- package/src/primitives/field-semantics.ts +0 -115
- package/src/primitives/highlighter.ts +0 -157
- package/src/primitives/input-mask.ts +0 -853
- package/src/primitives/link-preview.ts +0 -87
- package/src/primitives/message-feedback.ts +0 -124
- package/src/primitives/pdf-preview.ts +0 -121
- package/src/primitives/toast-store.ts +0 -338
- package/src/primitives/url-scheme-policy.ts +0 -70
- package/src/primitives/use-audio-analysis.ts +0 -340
- package/src/primitives/use-auto-resize.ts +0 -31
- package/src/primitives/use-resize-observer.ts +0 -45
- package/src/primitives/use-sequencer.ts +0 -72
- package/src/primitives/use-speech-recognition.ts +0 -146
- package/src/primitives/use-stick-to-bottom.ts +0 -75
- package/src/primitives/use-text-stream.ts +0 -143
- package/src/primitives/use-voice-recorder.ts +0 -62
- package/src/primitives/visualizer-sequences.ts +0 -350
- package/src/remote/host-embed.ts +0 -345
- package/src/remote/index.ts +0 -2
- package/src/remote/origin.ts +0 -30
- package/src/remote/provider-runtime.ts +0 -262
- package/src/remote/provider.ts +0 -2
- package/src/remote/validate.ts +0 -22
- package/src/remote/version.ts +0 -12
- package/src/remote/wire.ts +0 -48
- package/src/schemas/from-tool-call.ts +0 -151
- package/src/schemas/index.ts +0 -341
- package/src/schemas/provider-subsets.ts +0 -538
- package/src/schemas/registry.ts +0 -355
- package/src/schemas/tool-defs.ts +0 -793
- package/src/solid.ts +0 -173
- package/src/state/index.ts +0 -44
- package/src/state/messages.ts +0 -53
- package/src/state/mock.ts +0 -297
- package/src/state/parts.ts +0 -295
- package/src/state/persistence.ts +0 -180
- package/src/state/stream.ts +0 -246
- package/src/state/suggestions.ts +0 -9
- package/src/state/threads.ts +0 -142
- package/src/test-utils/fake-clock.ts +0 -88
- package/src/types.ts +0 -95
- package/src/ui/action-icons.ts +0 -53
- package/src/ui/agent-card.tsx +0 -218
- package/src/ui/avatar.tsx +0 -23
- package/src/ui/badge.tsx +0 -21
- package/src/ui/button.tsx +0 -49
- package/src/ui/card.tsx +0 -245
- package/src/ui/checkbox-group.tsx +0 -153
- package/src/ui/checkbox.tsx +0 -63
- package/src/ui/collapsible.tsx +0 -163
- package/src/ui/command.tsx +0 -103
- package/src/ui/dialog.tsx +0 -223
- package/src/ui/dock.tsx +0 -630
- package/src/ui/dropdown.tsx +0 -636
- package/src/ui/editable-label.tsx +0 -112
- package/src/ui/hover-card.tsx +0 -345
- package/src/ui/icon.tsx +0 -167
- package/src/ui/input.tsx +0 -391
- package/src/ui/kbd.tsx +0 -118
- package/src/ui/nav.tsx +0 -282
- package/src/ui/notice.tsx +0 -84
- package/src/ui/overlay.tsx +0 -277
- package/src/ui/pane-grid.tsx +0 -117
- package/src/ui/pane-group.tsx +0 -291
- package/src/ui/pane.tsx +0 -193
- package/src/ui/popover.tsx +0 -106
- package/src/ui/progress-bar.tsx +0 -83
- package/src/ui/prompt-dock.tsx +0 -145
- package/src/ui/radio.tsx +0 -150
- package/src/ui/resizable.tsx +0 -693
- package/src/ui/scroll-area.tsx +0 -26
- package/src/ui/segmented.tsx +0 -109
- package/src/ui/select.tsx +0 -168
- package/src/ui/separator.tsx +0 -10
- package/src/ui/settings-group.tsx +0 -67
- package/src/ui/skeleton.tsx +0 -73
- package/src/ui/slider.tsx +0 -178
- package/src/ui/status.tsx +0 -48
- package/src/ui/switch.tsx +0 -119
- package/src/ui/tabs.tsx +0 -168
- package/src/ui/textarea.tsx +0 -21
- package/src/ui/tooltip.tsx +0 -118
- package/src/utils/cn.ts +0 -30
- package/src/wire/chunk.ts +0 -248
- package/src/wire/consume.ts +0 -599
- package/src/wire/diagnostics.ts +0 -727
- package/src/wire/encode-probe.ts +0 -214
- package/src/wire/encode.ts +0 -947
- package/src/wire/files.ts +0 -342
- package/src/wire/formats/anthropic.ts +0 -274
- package/src/wire/formats/openai.ts +0 -228
- package/src/wire/index.ts +0 -95
- package/src/wire/media-types.ts +0 -344
- package/src/wire/read.ts +0 -396
- package/src/wire/sink-helpers.ts +0 -50
- package/src/wire/sse.ts +0 -153
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { Show } from 'solid-js';
|
|
2
|
-
import { MoreHorizontal } from 'lucide-solid';
|
|
3
|
-
import { Dropdown, DropdownTrigger, DropdownContent, type DropdownController } from '../ui/dropdown';
|
|
4
|
-
import { renderIcon } from '../ui/icon';
|
|
5
|
-
import { cn } from '../utils/cn';
|
|
6
|
-
import { defineWebComponent } from './define';
|
|
7
|
-
import { wireDisclosure } from './disclosure';
|
|
8
|
-
|
|
9
|
-
interface Props extends Record<string, unknown> {
|
|
10
|
-
/** Built-in trigger: leading icon (a named icon like `"plus"`, an image
|
|
11
|
-
* URL/data-URI, or text). A slotted `slot="trigger"` overrides it. */
|
|
12
|
-
triggerIcon?: string;
|
|
13
|
-
/** Built-in trigger: a text label. This is the trigger's VISIBLE text, so it is
|
|
14
|
-
* also its accessible name, and `label` does not override it: an accessible
|
|
15
|
-
* name that does not contain the visible text is unreachable by speech input
|
|
16
|
-
* (WCAG 2.5.3, Label in Name). Same rule `kai-menu` follows. */
|
|
17
|
-
triggerLabel?: string;
|
|
18
|
-
/** Built-in trigger: a trailing icon (e.g. `"chevron-down"` for a select look). */
|
|
19
|
-
triggerIconTrailing?: string;
|
|
20
|
-
/** Accessible name for a trigger with no visible label. Ignored when
|
|
21
|
-
* `triggerLabel` is set, which is already the visible name. It DOES name a
|
|
22
|
-
* slotted `slot="trigger"`, which is VISUAL content with the name supplied
|
|
23
|
-
* separately: the same two-slot distinction `kai-menu` documents. */
|
|
24
|
-
label?: string;
|
|
25
|
-
/** Stretch the trigger to the full width of its container (a block row).
|
|
26
|
-
* Attribute: `full`. */
|
|
27
|
-
full?: boolean;
|
|
28
|
-
/** Drive/observe open state (Shoelace-style: settable + reflected to the `open`
|
|
29
|
-
* attribute, the menu still self-manages on click/keyboard). Set `el.open = true`,
|
|
30
|
-
* or `<kai-dropdown open>`; listen for `kai-open-change`. */
|
|
31
|
-
open?: boolean;
|
|
32
|
-
/** Initial open state on mount (uncontrolled seed). */
|
|
33
|
-
defaultOpen?: boolean;
|
|
34
|
-
/** Disable the trigger: click/keyboard and `show()` no longer open the menu. */
|
|
35
|
-
disabled?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** Events fired by `<kai-dropdown>`. */
|
|
39
|
-
interface Events {
|
|
40
|
-
/** The menu opened or closed (click, keyboard, Escape, outside-click, or a method). */
|
|
41
|
-
'kai-open-change': { open: boolean };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* `<kai-dropdown>` — a trigger plus a floating menu surface you fill yourself.
|
|
46
|
-
*
|
|
47
|
-
* The sibling of `<kai-menu>`, split by who owns the menu body: `kai-menu` renders
|
|
48
|
-
* a JSON `items` tree for you, this one gives you the surface and lets you slot
|
|
49
|
-
* ARBITRARY markup into it — the shape a framework consumer needs when the rows
|
|
50
|
-
* are their own components rather than data.
|
|
51
|
-
*
|
|
52
|
-
* ```html
|
|
53
|
-
* <kai-dropdown label="Row actions">
|
|
54
|
-
* <span slot="trigger">⋮</span>
|
|
55
|
-
* <div role="menuitem" tabindex="-1">Rename</div>
|
|
56
|
-
* <div role="menuitem" tabindex="-1">Duplicate</div>
|
|
57
|
-
* </kai-dropdown>
|
|
58
|
-
* ```
|
|
59
|
-
*
|
|
60
|
-
* The default slot is the menu body; `trigger` is the control it anchors to. It
|
|
61
|
-
* fires `kai-open-change` with `{ open }` on every change, accepts `open` /
|
|
62
|
-
* `defaultOpen` / `disabled`, and exposes `show()` / `hide()` / `toggle()`.
|
|
63
|
-
*
|
|
64
|
-
* KEYBOARD: give each row `role="menuitem"` and it joins roving focus. ArrowUp/Down,
|
|
65
|
-
* Home/End and typeahead reach SLOTTED rows because `menuItems()` in
|
|
66
|
-
* `../ui/dropdown.tsx` walks the flat tree rather than querying the shadow tree,
|
|
67
|
-
* which contains none of the light-DOM nodes a `<slot>` projects. Rows carrying
|
|
68
|
-
* `aria-disabled="true"` are skipped.
|
|
69
|
-
*/
|
|
70
|
-
defineWebComponent<Props, Events>('kai-dropdown', {
|
|
71
|
-
triggerIcon: undefined,
|
|
72
|
-
triggerLabel: undefined,
|
|
73
|
-
triggerIconTrailing: undefined,
|
|
74
|
-
label: undefined,
|
|
75
|
-
full: false,
|
|
76
|
-
open: undefined,
|
|
77
|
-
defaultOpen: undefined,
|
|
78
|
-
disabled: undefined,
|
|
79
|
-
}, (props, ctx) => {
|
|
80
|
-
const { flag } = ctx;
|
|
81
|
-
let api: DropdownController | undefined;
|
|
82
|
-
|
|
83
|
-
// The standard overlay surface: settable+reflecting `open`, kai-open-change,
|
|
84
|
-
// show/hide/toggle, disabled-gating. See ./disclosure.
|
|
85
|
-
wireDisclosure(ctx, () => api, () => props.open);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<>
|
|
89
|
-
{/* The host shrinks to the trigger by default (UA inline); `full` makes it a
|
|
90
|
-
block whose trigger fills the width — the kai-button/kai-menu pattern. */}
|
|
91
|
-
<style>{':host([full]){display:block}'}</style>
|
|
92
|
-
<Dropdown
|
|
93
|
-
defaultOpen={flag('defaultOpen')}
|
|
94
|
-
disabled={flag('disabled')}
|
|
95
|
-
controllerRef={(a) => (api = a)}
|
|
96
|
-
>
|
|
97
|
-
<DropdownTrigger
|
|
98
|
-
class={cn(
|
|
99
|
-
'inline-flex items-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
|
|
100
|
-
props.triggerLabel
|
|
101
|
-
? 'gap-1.5 px-2 py-1.5 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground'
|
|
102
|
-
: 'justify-center p-1.5 text-foreground hover:bg-muted',
|
|
103
|
-
flag('full') && 'w-full',
|
|
104
|
-
)}
|
|
105
|
-
// A visible `triggerLabel` IS the name, so `label` must not be layered
|
|
106
|
-
// over it: aria-label REPLACES the computed name, locking speech-input
|
|
107
|
-
// users out (WCAG 2.5.3). Same rule kai-menu and kai-button follow.
|
|
108
|
-
aria-label={props.triggerLabel ? undefined : (props.label ?? 'Open menu')}
|
|
109
|
-
>
|
|
110
|
-
<slot name="trigger">
|
|
111
|
-
<Show when={props.triggerIcon}>{renderIcon(props.triggerIcon, { class: 'size-4 shrink-0' })}</Show>
|
|
112
|
-
<Show when={props.triggerLabel}>{props.triggerLabel}</Show>
|
|
113
|
-
<Show when={props.triggerIconTrailing}>{renderIcon(props.triggerIconTrailing, { class: 'size-3.5 shrink-0 opacity-60' })}</Show>
|
|
114
|
-
<Show when={!props.triggerIcon && !props.triggerLabel}><MoreHorizontal class="size-4" /></Show>
|
|
115
|
-
</slot>
|
|
116
|
-
</DropdownTrigger>
|
|
117
|
-
<DropdownContent class="min-w-[10rem]">
|
|
118
|
-
<slot />
|
|
119
|
-
</DropdownContent>
|
|
120
|
-
</Dropdown>
|
|
121
|
-
</>
|
|
122
|
-
);
|
|
123
|
-
});
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { createEffect, createSignal, untrack } from 'solid-js';
|
|
2
|
-
import { defineWebComponent } from './define';
|
|
3
|
-
import { EditableLabel } from '../ui/editable-label';
|
|
4
|
-
|
|
5
|
-
interface Props extends Record<string, unknown> {
|
|
6
|
-
/** The label text. Settable and reflected to the `value` attribute. Read
|
|
7
|
-
* `el.value` for live state. */
|
|
8
|
-
value?: string;
|
|
9
|
-
/** Controlled edit state. `el.editing = true` opens the field; reflected to the
|
|
10
|
-
* `editing` attribute. */
|
|
11
|
-
editing?: boolean;
|
|
12
|
-
/** Placeholder shown while editing / when the value is empty. */
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
/** Disable entering edit mode. */
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Events fired by `<kai-editable-label>`. */
|
|
19
|
-
interface Events {
|
|
20
|
-
/** Committed a changed value (Enter / blur). */
|
|
21
|
-
'kai-rename': { value: string };
|
|
22
|
-
/** Edit was cancelled (Esc); the text is restored. */
|
|
23
|
-
'kai-cancel': Record<string, never>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* `<kai-editable-label>` — inline rename, built on `kai-input`. Shows `value` as
|
|
28
|
-
* text; double-click (or `el.edit()`, or `editing`) swaps in an autofocused
|
|
29
|
-
* field. Enter or blur commits → `kai-rename` (only when the value changed); Esc
|
|
30
|
-
* cancels → `kai-cancel` (the text is restored).
|
|
31
|
-
*
|
|
32
|
-
* ```html
|
|
33
|
-
* <kai-editable-label value="Project Alpha"></kai-editable-label>
|
|
34
|
-
* <script type="module">
|
|
35
|
-
* import '@kitn.ai/ui/elements';
|
|
36
|
-
* const label = document.querySelector('kai-editable-label');
|
|
37
|
-
* label.addEventListener('kai-rename', (e) => save(e.detail.value));
|
|
38
|
-
* label.edit(); // open the field programmatically
|
|
39
|
-
* </script>
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* Methods: `edit()`, `commit()`, `cancel()`. Restyle via `::part(text)` and
|
|
43
|
-
* `::part(input)`.
|
|
44
|
-
*/
|
|
45
|
-
defineWebComponent<Props, Events>('kai-editable-label', {
|
|
46
|
-
value: undefined,
|
|
47
|
-
editing: false,
|
|
48
|
-
placeholder: undefined,
|
|
49
|
-
disabled: false,
|
|
50
|
-
}, (props, ctx) => {
|
|
51
|
-
const { element, dispatch, flag, expose } = ctx;
|
|
52
|
-
|
|
53
|
-
// Controlled value, mirrored to the `value` attribute (the kai-segmented pattern).
|
|
54
|
-
const [value, setValue] = createSignal(
|
|
55
|
-
(props.value as string | undefined) ?? element.getAttribute('value') ?? '',
|
|
56
|
-
);
|
|
57
|
-
const coerce = (v: unknown): string =>
|
|
58
|
-
v == null ? (element.getAttribute('value') ?? '') : String(v);
|
|
59
|
-
Object.defineProperty(element, 'value', {
|
|
60
|
-
get: () => value(),
|
|
61
|
-
set: (v: unknown) => { const next = coerce(v); if (untrack(value) !== next) setValue(next); },
|
|
62
|
-
configurable: true,
|
|
63
|
-
enumerable: true,
|
|
64
|
-
});
|
|
65
|
-
createEffect(() => {
|
|
66
|
-
const v = value();
|
|
67
|
-
if (v) {
|
|
68
|
-
if (element.getAttribute('value') !== v) element.setAttribute('value', v);
|
|
69
|
-
} else if (element.hasAttribute('value')) {
|
|
70
|
-
element.removeAttribute('value');
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Edit state lives in the facade and drives the primitive. The methods map to
|
|
75
|
-
// the primitive's own gestures so every commit / cancel flows through its guarded
|
|
76
|
-
// Enter/Esc/blur handlers (no double-fire). Controlled `editing` rides the native
|
|
77
|
-
// solid-element prop/attribute: we follow it (so `el.editing = true` /
|
|
78
|
-
// `<kai-editable-label editing>` opens the field) and reflect it, but never
|
|
79
|
-
// override the property with a side-effecting `Object.defineProperty` — doing so
|
|
80
|
-
// fires the setter during solid-element's upgrade and corrupts the signal.
|
|
81
|
-
const [editing, setEditing] = createSignal(flag('editing'));
|
|
82
|
-
createEffect(() => setEditing(flag('editing')));
|
|
83
|
-
createEffect(() => {
|
|
84
|
-
if (editing()) {
|
|
85
|
-
if (!element.hasAttribute('editing')) element.setAttribute('editing', '');
|
|
86
|
-
} else if (element.hasAttribute('editing')) {
|
|
87
|
-
element.removeAttribute('editing');
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const getInput = (): HTMLInputElement | null =>
|
|
92
|
-
element.shadowRoot?.querySelector<HTMLInputElement>('input') ?? null;
|
|
93
|
-
|
|
94
|
-
const enter = () => { if (!flag('disabled')) setEditing(true); };
|
|
95
|
-
// Blur drives the primitive's blur-commit; Escape drives its cancel.
|
|
96
|
-
const commit = () => { getInput()?.blur(); };
|
|
97
|
-
const cancel = () => {
|
|
98
|
-
const input = getInput();
|
|
99
|
-
if (input) {
|
|
100
|
-
input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, composed: true }));
|
|
101
|
-
} else if (untrack(editing)) {
|
|
102
|
-
setEditing(false);
|
|
103
|
-
dispatch('kai-cancel', {});
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
expose({
|
|
108
|
-
/** Switch the label into its editing field, which autofocuses and selects the
|
|
109
|
-
* current text. Same entry point as a user double-click, and a no-op while
|
|
110
|
-
* `disabled`. Commit with `commit()` or by blurring, abandon with `cancel()`
|
|
111
|
-
* or Escape. */
|
|
112
|
-
edit: enter,
|
|
113
|
-
/** Close the field and keep what was typed, exactly as blurring it does.
|
|
114
|
-
* `kai-rename` fires only when the text actually changed, so committing an
|
|
115
|
-
* untouched field is silent. A no-op while the field is closed. */
|
|
116
|
-
commit,
|
|
117
|
-
/** Abandon the edit, exactly as Escape does: the original text is restored,
|
|
118
|
-
* the field closes and `kai-cancel` fires. `kai-rename` never fires, even if
|
|
119
|
-
* the field was edited. Also works when `editing` was set programmatically
|
|
120
|
-
* and the field has not rendered yet. */
|
|
121
|
-
cancel,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<>
|
|
126
|
-
<style>{':host{display:inline-flex}'}</style>
|
|
127
|
-
<EditableLabel
|
|
128
|
-
value={value()}
|
|
129
|
-
editing={editing()}
|
|
130
|
-
placeholder={props.placeholder as string | undefined}
|
|
131
|
-
disabled={flag('disabled')}
|
|
132
|
-
onRename={(next) => {
|
|
133
|
-
setEditing(false);
|
|
134
|
-
if (next !== untrack(value)) { setValue(next); dispatch('kai-rename', { value: next }); }
|
|
135
|
-
}}
|
|
136
|
-
onCancel={() => { setEditing(false); dispatch('kai-cancel', {}); }}
|
|
137
|
-
/>
|
|
138
|
-
</>
|
|
139
|
-
);
|
|
140
|
-
});
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The data shapes a consumer assigns to a `kai-*` element's array/object
|
|
3
|
-
* properties, when that shape has no Solid-layer twin they could import instead.
|
|
4
|
-
*
|
|
5
|
-
* WHY THIS FILE EXISTS. The generated `.d.ts` for `./elements` and the React
|
|
6
|
-
* wrappers expand every prop type STRUCTURALLY (see the `IMPORTS = {}` note in
|
|
7
|
-
* scripts/gen-element-api.mjs — self-contained declarations are what keeps a
|
|
8
|
-
* consumer's tsc from resolving library `.ts` source). That is right for the
|
|
9
|
-
* generated files, but it means a consumer who wants to name the shape — a
|
|
10
|
-
* `const items: … = [...]` in their own code, a helper that builds one — has no
|
|
11
|
-
* type to import and ends up writing
|
|
12
|
-
* `NonNullable<KaiCommandElementProps['items']>`. Every named element-prop type
|
|
13
|
-
* must therefore be reachable from the ROOT entry (`@kitn.ai/ui`), which is what
|
|
14
|
-
* a React / Vue / Svelte / vanilla consumer imports. Enforced by
|
|
15
|
-
* tests/elements/prop-types-exported.test.ts.
|
|
16
|
-
*
|
|
17
|
-
* These live in their own module (not in the facades that use them) because the
|
|
18
|
-
* facades compile to per-element side-effect entry points whose shipped
|
|
19
|
-
* declarations are `export {};` — a type re-exported from one of those would not
|
|
20
|
-
* resolve for a consumer. Types with a Solid twin (`TriggerDef`, `KaiNavItem`,
|
|
21
|
-
* `ChatThreadContextUsage`, …) stay in their own layer's module and are
|
|
22
|
-
* re-exported from `src/index.ts` directly.
|
|
23
|
-
*
|
|
24
|
-
* Type-only: fully erased by the build, so the root barrel pays nothing.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/** A single segment of `<kai-segmented>`.
|
|
28
|
-
*
|
|
29
|
-
* Distinct from the Solid `SegmentedOption`, whose `icon` is a JSX node: on the
|
|
30
|
-
* element, `icon` is an icon-NAME string (web-component-friendly) — a curated
|
|
31
|
-
* name (e.g. `"code"`), a URL/data-URI, or plain text — resolved to a glyph via
|
|
32
|
-
* the kit's icon renderer (the same path `kai-button`'s `icon` uses). */
|
|
33
|
-
export interface KaiSegmentedOption {
|
|
34
|
-
value: string;
|
|
35
|
-
label: string;
|
|
36
|
-
icon?: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** A single row of `<kai-radio-group>`.
|
|
40
|
-
*
|
|
41
|
-
* Distinct from the Solid `RadioOption`, whose `label` and `description` are JSX
|
|
42
|
-
* nodes: on the element both are plain strings, because an element property has to
|
|
43
|
-
* survive being assigned from HTML/React/Vue/Svelte with no framework in between. */
|
|
44
|
-
export interface KaiRadioOption {
|
|
45
|
-
value: string;
|
|
46
|
-
label: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
disabled?: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** A single row of `<kai-checkbox-group>`.
|
|
52
|
-
*
|
|
53
|
-
* Distinct from the Solid `CheckboxOption`, whose `value` is generic and whose
|
|
54
|
-
* `label` and `description` are JSX nodes: on the element all three are plain
|
|
55
|
-
* strings, because an element property has to survive being assigned from
|
|
56
|
-
* HTML/React/Vue/Svelte with no framework in between. Structurally identical to
|
|
57
|
-
* `KaiRadioOption`, and kept as its own name anyway: the two elements are free to
|
|
58
|
-
* diverge, and a consumer typing a checkbox list should not have to import the radio
|
|
59
|
-
* group's type to do it. */
|
|
60
|
-
export interface KaiCheckboxOption {
|
|
61
|
-
value: string;
|
|
62
|
-
label: string;
|
|
63
|
-
description?: string;
|
|
64
|
-
disabled?: boolean;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** A single choice in `<kai-select>`.
|
|
68
|
-
*
|
|
69
|
-
* Distinct from the Solid `SelectOption`, whose `value` is generic: on the element
|
|
70
|
-
* it is a string, because a native `<option>`'s value is a string and an element
|
|
71
|
-
* property has to survive being assigned from HTML/React/Vue/Svelte with no
|
|
72
|
-
* framework in between. `label` defaults to `value`. */
|
|
73
|
-
export interface KaiSelectOption {
|
|
74
|
-
value: string;
|
|
75
|
-
label?: string;
|
|
76
|
-
disabled?: boolean;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** A single citation in `<kai-sources>`' `sources` property. Also the shape
|
|
80
|
-
* `<kai-source>` light-DOM children are parsed into. */
|
|
81
|
-
export interface KaiSourceItem {
|
|
82
|
-
href: string;
|
|
83
|
-
title?: string;
|
|
84
|
-
description?: string;
|
|
85
|
-
label?: string;
|
|
86
|
-
showFavicon?: boolean;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** Token-usage data for `<kai-context>`' `context` property. */
|
|
90
|
-
export interface KaiContextUsage {
|
|
91
|
-
/** Tokens consumed so far in the context window (drives the meter fill). */
|
|
92
|
-
usedTokens: number;
|
|
93
|
-
/** The model's total context-window size in tokens. */
|
|
94
|
-
maxTokens: number;
|
|
95
|
-
/** Tokens attributed to the prompt/input, shown in the breakdown. */
|
|
96
|
-
inputTokens?: number;
|
|
97
|
-
/** Tokens attributed to the generated output, shown in the breakdown. */
|
|
98
|
-
outputTokens?: number;
|
|
99
|
-
/** Tokens attributed to reasoning/thinking, shown when present. */
|
|
100
|
-
reasoningTokens?: number;
|
|
101
|
-
/** Tokens served from prompt cache, shown when present. */
|
|
102
|
-
cacheTokens?: number;
|
|
103
|
-
/** Estimated cost in dollars for this usage, shown in the footer. */
|
|
104
|
-
estimatedCost?: number;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** One item in `<kai-menu>`'s `items` tree. */
|
|
108
|
-
export interface KaiMenuItem {
|
|
109
|
-
/** Emitted in `kai-select` for actionable items. */
|
|
110
|
-
id?: string;
|
|
111
|
-
label?: string;
|
|
112
|
-
/** Named icon (e.g. "paperclip"), image URL / data-URI, or plain text. */
|
|
113
|
-
icon?: string;
|
|
114
|
-
/** e.g. '⌘U' — shown right-aligned, muted. */
|
|
115
|
-
shortcut?: string;
|
|
116
|
-
/** Presence ⇒ a checkbox item (role=menuitemcheckbox). With `radioGroup` set,
|
|
117
|
-
* marks the SELECTED radio item in that group instead. */
|
|
118
|
-
checked?: boolean;
|
|
119
|
-
/** Membership in a single-select group (role=menuitemradio). Items sharing a
|
|
120
|
-
* `radioGroup` are mutually exclusive — the one with `checked: true` shows the
|
|
121
|
-
* checkmark; selecting one emits `{ id, radioGroup }` so the consumer moves
|
|
122
|
-
* the checkmark (the consumer owns state, like checkbox items). */
|
|
123
|
-
radioGroup?: string;
|
|
124
|
-
disabled?: boolean;
|
|
125
|
-
/** A divider (ignores other fields). */
|
|
126
|
-
separator?: boolean;
|
|
127
|
-
/** A non-interactive section label (uses `label`). */
|
|
128
|
-
heading?: boolean;
|
|
129
|
-
/** ⇒ a submenu. */
|
|
130
|
-
items?: KaiMenuItem[];
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* A single command/mention item for `<kai-command>`.
|
|
135
|
-
*
|
|
136
|
-
* Set `items` as a JS property (array ref) — not an HTML attribute.
|
|
137
|
-
*/
|
|
138
|
-
export interface KaiCommandItem {
|
|
139
|
-
/** Unique identifier emitted in `kai-select`. */
|
|
140
|
-
id: string;
|
|
141
|
-
/** Display name shown in the list row. */
|
|
142
|
-
label: string;
|
|
143
|
-
/** Named icon (e.g. "search"), image URL / data-URI, or plain text. */
|
|
144
|
-
icon?: string;
|
|
145
|
-
/** Muted supplementary text (e.g. a file path or a short description). */
|
|
146
|
-
description?: string;
|
|
147
|
-
/** Optional keyboard shortcut shown as right-aligned key caps; uses the
|
|
148
|
-
* kai-kbd `keys` syntax (e.g. "Mod+K", "Alt+1"). */
|
|
149
|
-
shortcut?: string;
|
|
150
|
-
/** Group name that buckets this item under a section header. */
|
|
151
|
-
group?: string;
|
|
152
|
-
}
|