@lostgradient/cinder 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +9 -9
- package/components.json +2 -143
- package/dist/components/access-gate/index.js +379 -327
- package/dist/components/alert-dialog/index.js +170 -172
- package/dist/components/confirm-dialog/index.js +170 -172
- package/dist/components/drawer/index.js +11 -11
- package/dist/components/focus-trap/index.d.ts +1 -0
- package/dist/components/focus-trap/index.js +171 -1
- package/dist/components/icons/index.d.ts +80 -1
- package/dist/components/icons/index.js +1256 -0
- package/dist/components/markdown-editor/index.js +170 -170
- package/dist/components/modal/index.js +20 -20
- package/dist/components/review-editor/index.js +170 -187
- package/dist/components/sheet/index.js +11 -11
- package/dist/components/sidebar/index.js +37 -37
- package/dist/index.d.ts +0 -8
- package/dist/index.js +23202 -30164
- package/dist/server/components/access-gate/index.js +7 -10
- package/dist/server/components/alert-dialog/index.js +4 -4
- package/dist/server/components/approval-card/index.js +6 -6
- package/dist/server/components/autocomplete/index.js +4 -4
- package/dist/server/components/choice-grid/index.js +2 -2
- package/dist/server/components/color-field/index.js +2 -2
- package/dist/server/components/combobox/index.js +3 -3
- package/dist/server/components/command-item/index.js +3 -5
- package/dist/server/components/command-menu/index.js +3 -5
- package/dist/server/components/confirm-dialog/index.js +4 -4
- package/dist/server/components/context-menu/index.js +7 -7
- package/dist/server/components/data-table/index.js +3 -3
- package/dist/server/components/date-picker/index.js +4 -4
- package/dist/server/components/date-range-field/index.js +4 -4
- package/dist/server/components/diff-viewer/index.js +9 -11
- package/dist/server/components/drawer/index.js +4 -4
- package/dist/server/components/dropdown/index.js +7 -7
- package/dist/server/components/faceted-filter-bar/index.js +2 -2
- package/dist/server/components/focus-trap/index.js +7 -2
- package/dist/server/components/icons/index.js +156 -0
- package/dist/server/components/inline-loading/index.js +1 -1
- package/dist/server/components/json-schema-editor/index.js +11 -13
- package/dist/server/components/load-more/index.js +2 -3
- package/dist/server/components/markdown-editor/index.js +13 -12
- package/dist/server/components/menu-bar/index.js +4 -4
- package/dist/server/components/modal/index.js +4 -4
- package/dist/server/components/popover/index.js +3 -3
- package/dist/server/components/review-editor/index.js +169 -122
- package/dist/server/components/schedule-builder/index.js +5 -5
- package/dist/server/components/schema-form/index.js +1 -1
- package/dist/server/components/segment/index.js +3 -3
- package/dist/server/components/segmented-control/index.js +4 -4
- package/dist/server/components/selection-popover/index.js +3 -3
- package/dist/server/components/sheet/index.js +3 -3
- package/dist/server/components/sidebar/index.js +4 -4
- package/dist/server/components/table/index.js +3 -3
- package/dist/server/components/tag-input/index.js +2 -2
- package/dist/server/index.js +272 -316
- package/dist/server/{index.server-dwwqssey.js → index.server-0qh3v3nq.js} +1 -1
- package/dist/server/index.server-25wmev4e.js +2 -0
- package/dist/server/{index.server-zdm63dt8.js → index.server-2c56kqws.js} +107 -25
- package/dist/server/{index.server-y4n8vc08.js → index.server-2pc5cv6c.js} +1 -1
- package/dist/server/{index.server-1vsv7ngz.js → index.server-3g76h7z7.js} +12 -2
- package/dist/server/{index.server-xz99aed4.js → index.server-45n4s30n.js} +12 -12
- package/dist/server/{index.server-zzd5wpbw.js → index.server-4dfs3xwn.js} +1 -1
- package/dist/server/{index.server-vhyjjx9z.js → index.server-4jkqgp17.js} +7 -9
- package/dist/server/{index.server-bmxbsk4y.js → index.server-51sxnete.js} +18 -18
- package/dist/server/{index.server-1bwvsnjk.js → index.server-6rv1rfwq.js} +37 -14
- package/dist/server/{index.server-np3c7kx0.js → index.server-7798gc22.js} +1 -1
- package/dist/server/{index.server-2m1kenak.js → index.server-7kjw6qw5.js} +1 -1
- package/dist/server/{index.server-tfftb7hs.js → index.server-7zpzspk6.js} +1 -1
- package/dist/server/{index.server-7yvpb6z7.js → index.server-894t97kv.js} +4 -4
- package/dist/server/{index.server-47v2fhp4.js → index.server-8b35ekqg.js} +1 -1
- package/dist/server/{index.server-j5hn2qds.js → index.server-8nm871y8.js} +80 -30
- package/dist/server/{index.server-h0cvwvhy.js → index.server-9drzqktm.js} +1 -1
- package/dist/server/{index.server-x9s4m9eg.js → index.server-agsdwg53.js} +1 -1
- package/dist/server/{index.server-hpeavvnq.js → index.server-b4gp066a.js} +1 -1
- package/dist/server/{index.server-gkazv439.js → index.server-bf7d81b4.js} +7 -7
- package/dist/server/{index.server-krqvnt6p.js → index.server-d4ft97bx.js} +4 -2
- package/dist/server/{index.server-t1x9h8cb.js → index.server-dg19y3m7.js} +1 -1
- package/dist/server/{index.server-jt1twhgk.js → index.server-dq0k0qf6.js} +10 -10
- package/dist/server/{index.server-pxq277t5.js → index.server-frb9e55d.js} +1 -1
- package/dist/server/{index.server-9kz37z89.js → index.server-g3726bja.js} +1 -1
- package/dist/server/index.server-gyzmkrnz.js +2 -0
- package/dist/server/{index.server-mr68brd6.js → index.server-jgdtsvz2.js} +1 -1
- package/dist/server/{index.server-p56xxef1.js → index.server-m8ya4p7w.js} +1 -1
- package/dist/server/{index.server-1nq7z1qw.js → index.server-mda2y5g6.js} +1 -1
- package/dist/server/{index.server-jdcq5zza.js → index.server-mehav5vs.js} +7 -7
- package/dist/server/{index.server-e89qfamd.js → index.server-mknhgg07.js} +4 -4
- package/dist/server/{index.server-j570vb03.js → index.server-mvjzcna5.js} +1 -1
- package/dist/server/index.server-n4jxy52q.js +2 -0
- package/dist/server/{index.server-h89zk5ev.js → index.server-ne4gzxvz.js} +7 -7
- package/dist/server/{index.server-eftvmq3f.js → index.server-pfbzz3x7.js} +1 -1
- package/dist/server/{index.server-zrh23kty.js → index.server-pyjzfjfn.js} +1 -1
- package/dist/server/{index.server-rga8sc7j.js → index.server-q1d48s9t.js} +40 -36
- package/dist/server/{index.server-46cjwcqw.js → index.server-qv0kkre4.js} +5 -5
- package/dist/server/{index.server-yhzydqxe.js → index.server-r82zjq88.js} +5 -5
- package/dist/server/{index.server-9ykk1kbg.js → index.server-rbd5ys4z.js} +1 -1
- package/dist/server/{index.server-tcay903b.js → index.server-tnecnach.js} +4 -4
- package/dist/server/{index.server-9ra3xv88.js → index.server-x66zvjfc.js} +9 -9
- package/dist/server/{index.server-6sh11ap6.js → index.server-y4kfz0er.js} +1 -1
- package/dist/server/{index.server-n82rcv0m.js → index.server-z721a5gp.js} +4 -4
- package/dist/server/{index.server-mm1xa3kr.js → index.server-zdhv33ph.js} +51 -20
- package/dist/server/{index.server-t3hknp1c.js → index.server-zm04d9eq.js} +4 -4
- package/dist/server/{index.server-nx9c2ep1.js → index.server-zncgb7mw.js} +2 -2
- package/package.json +14 -135
- package/src/components/focus-trap/index.ts +1 -0
- package/src/components/icons/index.ts +82 -40
- package/src/index.ts +0 -34
- package/src/styles/components.css +0 -4
- package/dist/components/chat/adapter/chat-adapter.d.ts +0 -123
- package/dist/components/chat/adapter/index.d.ts +0 -8
- package/dist/components/chat/artifact/artifact-panel.svelte.d.ts +0 -15
- package/dist/components/chat/artifact/artifact-viewer.svelte.d.ts +0 -10
- package/dist/components/chat/artifact/chat-artifact-layout.svelte.d.ts +0 -23
- package/dist/components/chat/artifact/index.d.ts +0 -3
- package/dist/components/chat/builders.d.ts +0 -25
- package/dist/components/chat/chat.css +0 -16
- package/dist/components/chat/chat.css.d.ts +0 -1
- package/dist/components/chat/chat.schema.d.ts +0 -3
- package/dist/components/chat/chat.schema.js +0 -366
- package/dist/components/chat/chat.svelte.d.ts +0 -31
- package/dist/components/chat/chat.types.d.ts +0 -268
- package/dist/components/chat/chat.variables.d.ts +0 -2
- package/dist/components/chat/chat.variables.js +0 -61
- package/dist/components/chat/container/chat-events.d.ts +0 -22
- package/dist/components/chat/container/chat-history-trigger.svelte.d.ts +0 -15
- package/dist/components/chat/container/chat-jump-controls.svelte.d.ts +0 -24
- package/dist/components/chat/container/chat-participant-typing.svelte.d.ts +0 -31
- package/dist/components/chat/container/chat-search-bar.svelte.d.ts +0 -38
- package/dist/components/chat/container/chat-status-announcer.svelte.d.ts +0 -21
- package/dist/components/chat/container/chat.svelte.d.ts +0 -17
- package/dist/components/chat/container/index.d.ts +0 -12
- package/dist/components/chat/container/scroll-utilities.d.ts +0 -119
- package/dist/components/chat/container/use-chat-disclosure-state.svelte.d.ts +0 -58
- package/dist/components/chat/container/use-chat-keyboard-nav.svelte.d.ts +0 -57
- package/dist/components/chat/container/use-chat-message-groups.svelte.d.ts +0 -74
- package/dist/components/chat/container/use-chat-read-receipts.svelte.d.ts +0 -51
- package/dist/components/chat/container/use-chat-scroll-state.svelte.d.ts +0 -111
- package/dist/components/chat/container/use-chat-search.svelte.d.ts +0 -82
- package/dist/components/chat/container/use-chat-typing-indicator.svelte.d.ts +0 -76
- package/dist/components/chat/container/use-chat-unread-state.svelte.d.ts +0 -80
- package/dist/components/chat/container/use-chat-virtualizer.svelte.d.ts +0 -47
- package/dist/components/chat/conversation-model.d.ts +0 -16
- package/dist/components/chat/export/conversation-export-actions.svelte.d.ts +0 -17
- package/dist/components/chat/export/index.d.ts +0 -8
- package/dist/components/chat/index.d.ts +0 -23
- package/dist/components/chat/index.js +0 -11305
- package/dist/components/chat/input/attachment-kind.d.ts +0 -10
- package/dist/components/chat/input/chat-attachment-preview.svelte.d.ts +0 -8
- package/dist/components/chat/input/chat-attachment-serialization.d.ts +0 -9
- package/dist/components/chat/input/chat-attachment.d.ts +0 -11
- package/dist/components/chat/input/chat-input.svelte.d.ts +0 -79
- package/dist/components/chat/input/index.d.ts +0 -5
- package/dist/components/chat/message/chat-date-separator.svelte.d.ts +0 -12
- package/dist/components/chat/message/chat-message-parts-renderer.svelte.d.ts +0 -4
- package/dist/components/chat/message/chat-message-parts.d.ts +0 -96
- package/dist/components/chat/message/chat-message.svelte.d.ts +0 -91
- package/dist/components/chat/message/chat-read-receipt.svelte.d.ts +0 -27
- package/dist/components/chat/message/image-lightbox.svelte.d.ts +0 -17
- package/dist/components/chat/message/index.d.ts +0 -6
- package/dist/components/chat/message/markdown-preview.svelte.d.ts +0 -8
- package/dist/components/chat/message/message-attachments.svelte.d.ts +0 -17
- package/dist/components/chat/message/message-content.svelte.d.ts +0 -18
- package/dist/components/chat/message/parts/image-part.svelte.d.ts +0 -17
- package/dist/components/chat/message/parts/markdown-part.svelte.d.ts +0 -8
- package/dist/components/chat/message/parts/reasoning-part.svelte.d.ts +0 -12
- package/dist/components/chat/message/parts/step-part.svelte.d.ts +0 -8
- package/dist/components/chat/message/parts/suggestion-part.svelte.d.ts +0 -18
- package/dist/components/chat/message/parts/tool-approval-part.svelte.d.ts +0 -12
- package/dist/components/chat/message/parts/tool-call-part.svelte.d.ts +0 -12
- package/dist/components/chat/message/parts/tool-result-part.svelte.d.ts +0 -8
- package/dist/components/chat/message/tool-call-group.svelte.d.ts +0 -15
- package/dist/components/chat/message/tool-payload-code.svelte.d.ts +0 -9
- package/dist/components/chat/utilities/conversation.d.ts +0 -12
- package/dist/components/chat/utilities/index.d.ts +0 -9
- package/dist/components/chat/utilities/types.d.ts +0 -262
- package/dist/components/chat/utilities/utilities.d.ts +0 -140
- package/dist/components/chat-composer-popover/chat-composer-popover-filter.d.ts +0 -11
- package/dist/components/chat-composer-popover/chat-composer-popover.css +0 -7
- package/dist/components/chat-composer-popover/chat-composer-popover.css.d.ts +0 -1
- package/dist/components/chat-composer-popover/chat-composer-popover.schema.d.ts +0 -3
- package/dist/components/chat-composer-popover/chat-composer-popover.schema.js +0 -150
- package/dist/components/chat-composer-popover/chat-composer-popover.svelte.d.ts +0 -46
- package/dist/components/chat-composer-popover/chat-composer-popover.types.d.ts +0 -77
- package/dist/components/chat-composer-popover/chat-composer-popover.variables.d.ts +0 -2
- package/dist/components/chat-composer-popover/chat-composer-popover.variables.js +0 -61
- package/dist/components/chat-composer-popover/index.d.ts +0 -6
- package/dist/components/chat-composer-popover/index.js +0 -3285
- package/dist/components/chat-conversation-header/chat-conversation-header.css +0 -51
- package/dist/components/chat-conversation-header/chat-conversation-header.css.d.ts +0 -1
- package/dist/components/chat-conversation-header/chat-conversation-header.schema.d.ts +0 -3
- package/dist/components/chat-conversation-header/chat-conversation-header.schema.js +0 -94
- package/dist/components/chat-conversation-header/chat-conversation-header.svelte.d.ts +0 -19
- package/dist/components/chat-conversation-header/chat-conversation-header.types.d.ts +0 -18
- package/dist/components/chat-conversation-header/chat-conversation-header.variables.d.ts +0 -2
- package/dist/components/chat-conversation-header/chat-conversation-header.variables.js +0 -61
- package/dist/components/chat-conversation-header/index.d.ts +0 -5
- package/dist/components/chat-conversation-header/index.js +0 -4278
- package/dist/components/chat-conversation-list/chat-conversation-list.css +0 -127
- package/dist/components/chat-conversation-list/chat-conversation-list.css.d.ts +0 -1
- package/dist/components/chat-conversation-list/chat-conversation-list.schema.d.ts +0 -3
- package/dist/components/chat-conversation-list/chat-conversation-list.schema.js +0 -105
- package/dist/components/chat-conversation-list/chat-conversation-list.svelte.d.ts +0 -21
- package/dist/components/chat-conversation-list/chat-conversation-list.types.d.ts +0 -17
- package/dist/components/chat-conversation-list/chat-conversation-list.variables.d.ts +0 -2
- package/dist/components/chat-conversation-list/chat-conversation-list.variables.js +0 -61
- package/dist/components/chat-conversation-list/conversation-summary.d.ts +0 -30
- package/dist/components/chat-conversation-list/index.d.ts +0 -6
- package/dist/components/chat-conversation-list/index.js +0 -536
- package/dist/server/components/chat/index.js +0 -121
- package/dist/server/components/chat-composer-popover/index.js +0 -26
- package/dist/server/components/chat-conversation-header/index.js +0 -41
- package/dist/server/components/chat-conversation-list/index.js +0 -19
- package/dist/server/index.server-2bbwajb2.js +0 -54
- package/dist/server/index.server-2hqrv7ca.js +0 -9
- package/dist/server/index.server-67qgdypc.js +0 -9
- package/dist/server/index.server-6hnfzc7f.js +0 -263
- package/dist/server/index.server-8rmtb8vx.js +0 -175
- package/dist/server/index.server-a59y47rw.js +0 -59
- package/dist/server/index.server-bfkka7x4.js +0 -2
- package/dist/server/index.server-f2me5abn.js +0 -4230
- package/dist/server/index.server-kb6w1a7c.js +0 -27
- package/dist/server/index.server-nphtb2ey.js +0 -76
- package/dist/server/index.server-qkfd0qa7.js +0 -2
- package/dist/server/index.server-rf67m8v5.js +0 -2
- package/dist/server/index.server-rqe5bqgm.js +0 -37
- package/dist/server/index.server-xtjjmsyq.js +0 -315
- package/dist/server/index.server-yq9evnp4.js +0 -38
- package/dist/server/index.server-z1qvwaem.js +0 -74
- package/dist/server/index.server-z7hxtqs1.js +0 -83
- package/src/components/chat/adapter/chat-adapter.ts +0 -132
- package/src/components/chat/adapter/index.ts +0 -15
- package/src/components/chat/artifact/artifact-panel.svelte +0 -112
- package/src/components/chat/artifact/artifact-viewer.svelte +0 -101
- package/src/components/chat/artifact/chat-artifact-layout.svelte +0 -56
- package/src/components/chat/artifact/index.ts +0 -3
- package/src/components/chat/builders.ts +0 -464
- package/src/components/chat/chat.css +0 -16
- package/src/components/chat/chat.examples.json +0 -61
- package/src/components/chat/chat.schema.json +0 -290
- package/src/components/chat/chat.schema.ts +0 -335
- package/src/components/chat/chat.svelte +0 -67
- package/src/components/chat/chat.types.ts +0 -284
- package/src/components/chat/chat.variables.json +0 -1
- package/src/components/chat/chat.variables.ts +0 -3
- package/src/components/chat/container/chat-events.ts +0 -26
- package/src/components/chat/container/chat-history-trigger.svelte +0 -95
- package/src/components/chat/container/chat-jump-controls.svelte +0 -191
- package/src/components/chat/container/chat-participant-typing.svelte +0 -128
- package/src/components/chat/container/chat-search-bar.svelte +0 -219
- package/src/components/chat/container/chat-status-announcer.svelte +0 -22
- package/src/components/chat/container/chat.svelte +0 -1879
- package/src/components/chat/container/index.ts +0 -64
- package/src/components/chat/container/scroll-utilities.ts +0 -204
- package/src/components/chat/container/use-chat-disclosure-state.svelte.ts +0 -62
- package/src/components/chat/container/use-chat-keyboard-nav.svelte.ts +0 -153
- package/src/components/chat/container/use-chat-message-groups.svelte.ts +0 -146
- package/src/components/chat/container/use-chat-read-receipts.svelte.ts +0 -62
- package/src/components/chat/container/use-chat-scroll-state.svelte.ts +0 -292
- package/src/components/chat/container/use-chat-search.svelte.ts +0 -116
- package/src/components/chat/container/use-chat-typing-indicator.svelte.ts +0 -153
- package/src/components/chat/container/use-chat-unread-state.svelte.ts +0 -170
- package/src/components/chat/container/use-chat-virtualizer.svelte.ts +0 -260
- package/src/components/chat/conversation-model.ts +0 -45
- package/src/components/chat/export/conversation-export-actions.svelte +0 -174
- package/src/components/chat/export/index.ts +0 -9
- package/src/components/chat/index.ts +0 -138
- package/src/components/chat/input/attachment-kind.ts +0 -28
- package/src/components/chat/input/chat-attachment-preview.svelte +0 -223
- package/src/components/chat/input/chat-attachment-serialization.ts +0 -63
- package/src/components/chat/input/chat-attachment.ts +0 -12
- package/src/components/chat/input/chat-input.svelte +0 -810
- package/src/components/chat/input/index.ts +0 -9
- package/src/components/chat/message/chat-date-separator.svelte +0 -87
- package/src/components/chat/message/chat-message-parts-renderer.svelte +0 -139
- package/src/components/chat/message/chat-message-parts.ts +0 -163
- package/src/components/chat/message/chat-message.svelte +0 -861
- package/src/components/chat/message/chat-read-receipt.svelte +0 -85
- package/src/components/chat/message/image-lightbox.svelte +0 -255
- package/src/components/chat/message/index.ts +0 -6
- package/src/components/chat/message/markdown-preview.svelte +0 -77
- package/src/components/chat/message/message-attachments.svelte +0 -178
- package/src/components/chat/message/message-content.svelte +0 -132
- package/src/components/chat/message/parts/image-part.svelte +0 -11
- package/src/components/chat/message/parts/markdown-part.svelte +0 -17
- package/src/components/chat/message/parts/reasoning-part.svelte +0 -274
- package/src/components/chat/message/parts/step-part.svelte +0 -127
- package/src/components/chat/message/parts/suggestion-part.svelte +0 -83
- package/src/components/chat/message/parts/tool-approval-part.svelte +0 -298
- package/src/components/chat/message/parts/tool-call-part.svelte +0 -19
- package/src/components/chat/message/parts/tool-result-part.svelte +0 -65
- package/src/components/chat/message/tool-call-group.svelte +0 -274
- package/src/components/chat/message/tool-payload-code.svelte +0 -35
- package/src/components/chat/utilities/conversation.ts +0 -44
- package/src/components/chat/utilities/index.ts +0 -33
- package/src/components/chat/utilities/types.ts +0 -288
- package/src/components/chat/utilities/utilities.ts +0 -507
- package/src/components/chat-composer-popover/chat-composer-popover-filter.ts +0 -68
- package/src/components/chat-composer-popover/chat-composer-popover.css +0 -7
- package/src/components/chat-composer-popover/chat-composer-popover.examples.json +0 -13
- package/src/components/chat-composer-popover/chat-composer-popover.schema.json +0 -90
- package/src/components/chat-composer-popover/chat-composer-popover.schema.ts +0 -95
- package/src/components/chat-composer-popover/chat-composer-popover.svelte +0 -234
- package/src/components/chat-composer-popover/chat-composer-popover.types.ts +0 -88
- package/src/components/chat-composer-popover/chat-composer-popover.variables.json +0 -1
- package/src/components/chat-composer-popover/chat-composer-popover.variables.ts +0 -3
- package/src/components/chat-composer-popover/index.ts +0 -19
- package/src/components/chat-conversation-header/chat-conversation-header.css +0 -51
- package/src/components/chat-conversation-header/chat-conversation-header.examples.json +0 -13
- package/src/components/chat-conversation-header/chat-conversation-header.schema.json +0 -34
- package/src/components/chat-conversation-header/chat-conversation-header.schema.ts +0 -38
- package/src/components/chat-conversation-header/chat-conversation-header.svelte +0 -49
- package/src/components/chat-conversation-header/chat-conversation-header.types.ts +0 -20
- package/src/components/chat-conversation-header/chat-conversation-header.variables.json +0 -1
- package/src/components/chat-conversation-header/chat-conversation-header.variables.ts +0 -3
- package/src/components/chat-conversation-header/index.ts +0 -9
- package/src/components/chat-conversation-list/chat-conversation-list.css +0 -127
- package/src/components/chat-conversation-list/chat-conversation-list.examples.json +0 -13
- package/src/components/chat-conversation-list/chat-conversation-list.schema.json +0 -45
- package/src/components/chat-conversation-list/chat-conversation-list.schema.ts +0 -52
- package/src/components/chat-conversation-list/chat-conversation-list.svelte +0 -75
- package/src/components/chat-conversation-list/chat-conversation-list.types.ts +0 -18
- package/src/components/chat-conversation-list/chat-conversation-list.variables.json +0 -1
- package/src/components/chat-conversation-list/chat-conversation-list.variables.ts +0 -3
- package/src/components/chat-conversation-list/conversation-summary.ts +0 -88
- package/src/components/chat-conversation-list/index.ts +0 -11
|
@@ -1,810 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
export {};
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
/**
|
|
7
|
-
* ChatInput is a ChatGPT/Claude-style chat composer.
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Uses a native textarea composer so Chat does not require the rich editor bundle
|
|
11
|
-
* - Keyboard shortcuts: Enter to send, Shift+Enter for newline
|
|
12
|
-
* - IME-aware: composition input (Japanese/Chinese/Korean) won't trigger send
|
|
13
|
-
* - File attachments (images, code, documents) via paste, drag-drop, or file picker
|
|
14
|
-
* - Blocks whitespace-only submit
|
|
15
|
-
* - Works standalone or with SvelteKit form actions
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```svelte
|
|
19
|
-
* <ChatInput
|
|
20
|
-
* id="chat"
|
|
21
|
-
* bind:value={message}
|
|
22
|
-
* onsubmit={(msg, attachments) => sendMessage(msg, attachments)}
|
|
23
|
-
* />
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
import { onDestroy } from 'svelte';
|
|
27
|
-
import { classNames } from '../../../utilities/class-names.ts';
|
|
28
|
-
import { useAnnouncer } from '../../../utilities/use-announcer.svelte.ts';
|
|
29
|
-
import { createIdFactory, useStableId } from '../../../utilities/id-factory.ts';
|
|
30
|
-
import ArrowUp from 'lucide-svelte/icons/arrow-up';
|
|
31
|
-
import Paperclip from 'lucide-svelte/icons/paperclip';
|
|
32
|
-
import Square from 'lucide-svelte/icons/square';
|
|
33
|
-
import X from 'lucide-svelte/icons/x';
|
|
34
|
-
import Button from '../../button/button.svelte';
|
|
35
|
-
import { deriveAttachmentKind } from './attachment-kind.js';
|
|
36
|
-
import ChatAttachmentPreview from './chat-attachment-preview.svelte';
|
|
37
|
-
// Per-instance fallback factory for attachments whose file metadata is unavailable
|
|
38
|
-
// AND as a collision-disambiguation counter when two files share identical metadata.
|
|
39
|
-
const attachmentIdFactory = createIdFactory('attachment');
|
|
40
|
-
// Tracks hash-derived IDs used in this instance so collisions (same name/size/mtime)
|
|
41
|
-
// get a unique suffix rather than a duplicate DOM ID.
|
|
42
|
-
const usedAttachmentIds = new Set();
|
|
43
|
-
let { id, value = $bindable(''), placeholder = 'Type a message...', composerLabel = 'Message', composerRole, composerAriaExpanded, composerAriaControls, composerAriaActiveDescendant, composerAriaAutocomplete, disabled = false, sending = false, error, class: className, action, name = 'content', clearOnSubmit = true, allowAttachments = true, maxFileSize = 10 * 1024 * 1024, // 10MB
|
|
44
|
-
acceptedTypes = [
|
|
45
|
-
'image/*',
|
|
46
|
-
'text/*',
|
|
47
|
-
'application/json',
|
|
48
|
-
'application/pdf',
|
|
49
|
-
'application/javascript',
|
|
50
|
-
'application/typescript',
|
|
51
|
-
'application/xml',
|
|
52
|
-
'application/yaml',
|
|
53
|
-
'application/x-yaml',
|
|
54
|
-
// Keep in sync with CODE_MIME_TYPES in attachment-kind.ts
|
|
55
|
-
'application/x-sh',
|
|
56
|
-
'application/sql',
|
|
57
|
-
'application/toml',
|
|
58
|
-
], onsubmit, onstop, oncomposerinput, oncomposerkeydown, oncomposerselectionchange, oncomposerblur, onattachmentadd, onattachmentremove, onattachmentfailure, actions, ...rest } = $props();
|
|
59
|
-
const resolvedComposerLabel = $derived(composerLabel.trim() || 'Message');
|
|
60
|
-
// Derived: show stop button when sending and onstop is provided
|
|
61
|
-
const showStopButton = $derived(sending && onstop !== undefined);
|
|
62
|
-
// Refs
|
|
63
|
-
let formElement = $state(null);
|
|
64
|
-
let editorElement = $state(null);
|
|
65
|
-
let fileInputRef = $state(null);
|
|
66
|
-
// Internal state
|
|
67
|
-
let attachments = $state([]);
|
|
68
|
-
let isDragOver = $state(false);
|
|
69
|
-
let isComposing = $state(false);
|
|
70
|
-
// Screen reader announcements
|
|
71
|
-
const announcer = useAnnouncer();
|
|
72
|
-
// Derived state
|
|
73
|
-
const errorId = $derived(`${id}-error`);
|
|
74
|
-
const hintId = $derived(`${id}-hint`);
|
|
75
|
-
const shortcutDescriptionId = $derived(`${id}-shortcut-description`);
|
|
76
|
-
const isWhitespaceOnly = $derived(value.trim().length === 0);
|
|
77
|
-
const hasPendingAttachments = $derived(attachments.some((a) => a.status === 'pending' || a.status === 'uploading'));
|
|
78
|
-
// Allow submit when text is present, even if some attachments errored.
|
|
79
|
-
// Only block on pending/uploading attachments (they're not yet ready to send).
|
|
80
|
-
const canSubmit = $derived(!isWhitespaceOnly && !disabled && !sending && !hasPendingAttachments);
|
|
81
|
-
// Determine if we're in form action mode
|
|
82
|
-
const isFormActionMode = $derived(!!action);
|
|
83
|
-
// =========================================================================
|
|
84
|
-
// Attachment Handling
|
|
85
|
-
// =========================================================================
|
|
86
|
-
function isValidType(file) {
|
|
87
|
-
return acceptedTypes.some((type) => {
|
|
88
|
-
if (type.endsWith('/*')) {
|
|
89
|
-
const category = type.slice(0, -2);
|
|
90
|
-
return file.type.startsWith(category);
|
|
91
|
-
}
|
|
92
|
-
return file.type === type;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
const KIND_LABELS = {
|
|
96
|
-
image: 'Image',
|
|
97
|
-
code: 'Code file',
|
|
98
|
-
document: 'Document',
|
|
99
|
-
};
|
|
100
|
-
function addAttachment(file) {
|
|
101
|
-
// Type validation
|
|
102
|
-
if (!isValidType(file)) {
|
|
103
|
-
onattachmentfailure?.(file, `Invalid file type: ${file.type}. Accepted types: ${acceptedTypes.join(', ')}.`);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
// Size validation
|
|
107
|
-
if (file.size > maxFileSize) {
|
|
108
|
-
const maxSizeMB = Math.round(maxFileSize / (1024 * 1024));
|
|
109
|
-
onattachmentfailure?.(file, `File exceeds ${maxSizeMB}MB limit`);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const kind = deriveAttachmentKind(file.type);
|
|
113
|
-
// Derive a stable ID from the file's identity metadata so repeated snapshot
|
|
114
|
-
// renders of the same attachment produce the same DOM ID. Fall back to the
|
|
115
|
-
// per-instance counter when lastModified is absent (e.g. synthetic File objects
|
|
116
|
-
// constructed in tests with lastModified = 0).
|
|
117
|
-
// If two different files hash to the same ID (identical name/size/mtime),
|
|
118
|
-
// append the counter-factory suffix to guarantee document-level uniqueness.
|
|
119
|
-
let attachmentId = file.lastModified !== 0
|
|
120
|
-
? useStableId(`${file.name}\0${file.size}\0${file.lastModified}`)
|
|
121
|
-
: attachmentIdFactory.next();
|
|
122
|
-
if (usedAttachmentIds.has(attachmentId)) {
|
|
123
|
-
attachmentId = `${attachmentId}-${attachmentIdFactory.next()}`;
|
|
124
|
-
}
|
|
125
|
-
usedAttachmentIds.add(attachmentId);
|
|
126
|
-
const attachment = {
|
|
127
|
-
id: attachmentId,
|
|
128
|
-
file,
|
|
129
|
-
previewUrl: URL.createObjectURL(file),
|
|
130
|
-
kind,
|
|
131
|
-
status: kind === 'code' ? 'pending' : 'ready',
|
|
132
|
-
};
|
|
133
|
-
attachments = [...attachments, attachment];
|
|
134
|
-
onattachmentadd?.(attachment);
|
|
135
|
-
announcer.announce(`${KIND_LABELS[kind]} attached: ${file.name}`);
|
|
136
|
-
// Fire-and-forget text extraction for code files
|
|
137
|
-
if (kind === 'code') {
|
|
138
|
-
file.text().then((text) => {
|
|
139
|
-
attachments = attachments.map((a) => a.id === attachment.id ? { ...a, textContent: text, status: 'ready' } : a);
|
|
140
|
-
}, () => {
|
|
141
|
-
attachments = attachments.map((a) => a.id === attachment.id
|
|
142
|
-
? { ...a, status: 'error', error: 'Failed to read file' }
|
|
143
|
-
: a);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function removeAttachment(attachmentId) {
|
|
148
|
-
const attachment = attachments.find((a) => a.id === attachmentId);
|
|
149
|
-
if (attachment) {
|
|
150
|
-
URL.revokeObjectURL(attachment.previewUrl);
|
|
151
|
-
attachments = attachments.filter((a) => a.id !== attachmentId);
|
|
152
|
-
onattachmentremove?.(attachment);
|
|
153
|
-
announcer.announce(`${KIND_LABELS[attachment.kind]} removed`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function handleFileSelect(event) {
|
|
157
|
-
const input = event.target;
|
|
158
|
-
const files = input.files;
|
|
159
|
-
if (files) {
|
|
160
|
-
Array.from(files).forEach(addAttachment);
|
|
161
|
-
}
|
|
162
|
-
// Reset input for re-selection of same file
|
|
163
|
-
input.value = '';
|
|
164
|
-
}
|
|
165
|
-
function handlePaste(event) {
|
|
166
|
-
if (!allowAttachments)
|
|
167
|
-
return;
|
|
168
|
-
const items = event.clipboardData?.items;
|
|
169
|
-
if (!items)
|
|
170
|
-
return;
|
|
171
|
-
// Collect all files from clipboard
|
|
172
|
-
const files = [];
|
|
173
|
-
for (const item of items) {
|
|
174
|
-
if (item.kind === 'file') {
|
|
175
|
-
const file = item.getAsFile();
|
|
176
|
-
if (file) {
|
|
177
|
-
files.push(file);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// If we have files, prevent default and let addAttachment handle all validation
|
|
182
|
-
// (including calling onattachmentfailure for invalid types/sizes)
|
|
183
|
-
if (files.length > 0) {
|
|
184
|
-
event.preventDefault();
|
|
185
|
-
files.forEach(addAttachment);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function handleDrop(event) {
|
|
189
|
-
isDragOver = false;
|
|
190
|
-
if (!allowAttachments)
|
|
191
|
-
return;
|
|
192
|
-
// Prevent default (browser opening/downloading the file) and stop propagation
|
|
193
|
-
// only when attachments are enabled and we are actually handling the drop.
|
|
194
|
-
// When attachments are disabled, the event bubbles and the browser's default
|
|
195
|
-
// behavior is preserved.
|
|
196
|
-
event.preventDefault();
|
|
197
|
-
event.stopPropagation();
|
|
198
|
-
const files = event.dataTransfer?.files;
|
|
199
|
-
if (files) {
|
|
200
|
-
// Let addAttachment handle all validation (type and size)
|
|
201
|
-
Array.from(files).forEach(addAttachment);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function handleDragOver(event) {
|
|
205
|
-
if (!allowAttachments)
|
|
206
|
-
return;
|
|
207
|
-
event.preventDefault();
|
|
208
|
-
isDragOver = true;
|
|
209
|
-
}
|
|
210
|
-
function handleDragLeave(event) {
|
|
211
|
-
// Only set isDragOver to false if we're leaving the form entirely
|
|
212
|
-
if (!formElement?.contains(event.relatedTarget)) {
|
|
213
|
-
isDragOver = false;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
// =========================================================================
|
|
217
|
-
// Form Submission
|
|
218
|
-
// =========================================================================
|
|
219
|
-
function handleSubmit(event) {
|
|
220
|
-
if (!canSubmit) {
|
|
221
|
-
event.preventDefault();
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
// Get the latest content directly from the textarea to avoid bind update lag.
|
|
225
|
-
// The bound `value` may be stale if the user typed and pressed Enter quickly.
|
|
226
|
-
const latestContent = editorElement?.value ?? value;
|
|
227
|
-
const trimmedContent = latestContent.trim();
|
|
228
|
-
// Re-check for whitespace-only after getting latest content
|
|
229
|
-
if (trimmedContent.length === 0) {
|
|
230
|
-
event.preventDefault();
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const message = {
|
|
234
|
-
role: 'user',
|
|
235
|
-
content: trimmedContent,
|
|
236
|
-
};
|
|
237
|
-
const readyAttachments = attachments.filter((a) => a.status === 'ready');
|
|
238
|
-
// Call onsubmit callback
|
|
239
|
-
onsubmit?.(message, readyAttachments);
|
|
240
|
-
// In standalone mode, prevent default form submission
|
|
241
|
-
if (!isFormActionMode) {
|
|
242
|
-
event.preventDefault();
|
|
243
|
-
if (clearOnSubmit) {
|
|
244
|
-
// Clear state
|
|
245
|
-
value = '';
|
|
246
|
-
attachments.forEach((a) => URL.revokeObjectURL(a.previewUrl));
|
|
247
|
-
attachments = [];
|
|
248
|
-
}
|
|
249
|
-
// Restore focus to editor
|
|
250
|
-
editorElement?.focus();
|
|
251
|
-
announcer.announce('Message sent');
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
// In form action mode, sync the bound value with trimmed content
|
|
255
|
-
// so the hidden input sends the same content as the callback.
|
|
256
|
-
// This fixes debounce lag and ensures consistent data.
|
|
257
|
-
value = trimmedContent;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
// =========================================================================
|
|
261
|
-
// Keyboard Handling
|
|
262
|
-
// =========================================================================
|
|
263
|
-
function handleKeyDown(event) {
|
|
264
|
-
// Ignore keydown events during IME composition (e.g., Japanese/Chinese/Korean input).
|
|
265
|
-
// During composition, Enter confirms the candidate, not sends the message.
|
|
266
|
-
if (event.isComposing || isComposing) {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
if (event.target === editorElement) {
|
|
270
|
-
oncomposerkeydown?.(event);
|
|
271
|
-
if (event.defaultPrevented) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
// Shift+Enter: Newline (let editor handle it)
|
|
276
|
-
if (event.key === 'Enter' && event.shiftKey) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
// Enter (no modifiers): Submit
|
|
280
|
-
if (event.key === 'Enter' && !event.metaKey && !event.ctrlKey && !event.altKey) {
|
|
281
|
-
event.preventDefault();
|
|
282
|
-
if (canSubmit) {
|
|
283
|
-
formElement?.requestSubmit();
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
function handleCompositionStart() {
|
|
288
|
-
isComposing = true;
|
|
289
|
-
}
|
|
290
|
-
function handleCompositionEnd() {
|
|
291
|
-
isComposing = false;
|
|
292
|
-
}
|
|
293
|
-
// Fires after `bind:value` has already applied the textarea's new value
|
|
294
|
-
// (Svelte merges the binding's own input listener with this handler on the
|
|
295
|
-
// same event), so `value` here is always current — never one keystroke stale.
|
|
296
|
-
function handleInput(event) {
|
|
297
|
-
oncomposerinput?.(value, event);
|
|
298
|
-
}
|
|
299
|
-
// =========================================================================
|
|
300
|
-
// Imperative API
|
|
301
|
-
// =========================================================================
|
|
302
|
-
export function focus() {
|
|
303
|
-
editorElement?.focus();
|
|
304
|
-
}
|
|
305
|
-
export function clear() {
|
|
306
|
-
value = '';
|
|
307
|
-
attachments.forEach((a) => URL.revokeObjectURL(a.previewUrl));
|
|
308
|
-
attachments = [];
|
|
309
|
-
}
|
|
310
|
-
export function getAttachments() {
|
|
311
|
-
return [...attachments];
|
|
312
|
-
}
|
|
313
|
-
export function getValue() {
|
|
314
|
-
return value;
|
|
315
|
-
}
|
|
316
|
-
export function getEditorElement() {
|
|
317
|
-
return editorElement;
|
|
318
|
-
}
|
|
319
|
-
export function addFiles(files) {
|
|
320
|
-
if (!allowAttachments)
|
|
321
|
-
return;
|
|
322
|
-
files.forEach(addAttachment);
|
|
323
|
-
}
|
|
324
|
-
// =========================================================================
|
|
325
|
-
// Cleanup
|
|
326
|
-
// =========================================================================
|
|
327
|
-
onDestroy(() => {
|
|
328
|
-
attachments.forEach((a) => URL.revokeObjectURL(a.previewUrl));
|
|
329
|
-
});
|
|
330
|
-
</script>
|
|
331
|
-
|
|
332
|
-
<form
|
|
333
|
-
bind:this={formElement}
|
|
334
|
-
class={classNames('chat-input', isDragOver && 'chat-input-dragover', className)}
|
|
335
|
-
method="POST"
|
|
336
|
-
{action}
|
|
337
|
-
onsubmit={handleSubmit}
|
|
338
|
-
onpaste={handlePaste}
|
|
339
|
-
ondrop={handleDrop}
|
|
340
|
-
ondragover={handleDragOver}
|
|
341
|
-
ondragleave={handleDragLeave}
|
|
342
|
-
oncompositionstart={handleCompositionStart}
|
|
343
|
-
oncompositionend={handleCompositionEnd}
|
|
344
|
-
aria-label="Chat message composer"
|
|
345
|
-
aria-busy={sending || undefined}
|
|
346
|
-
{...rest}
|
|
347
|
-
>
|
|
348
|
-
<!-- Hidden input for form action mode -->
|
|
349
|
-
{#if isFormActionMode}
|
|
350
|
-
<input type="hidden" {name} {value} />
|
|
351
|
-
{/if}
|
|
352
|
-
|
|
353
|
-
<!-- Attachment previews -->
|
|
354
|
-
{#if attachments.length > 0}
|
|
355
|
-
<div class="chat-input-attachments" role="list" aria-label="Attached files">
|
|
356
|
-
{#each attachments as attachment (attachment.id)}
|
|
357
|
-
<div class="chat-input-attachment-wrapper" role="listitem">
|
|
358
|
-
<ChatAttachmentPreview {attachment} />
|
|
359
|
-
<button
|
|
360
|
-
type="button"
|
|
361
|
-
class="chat-input-attachment-remove"
|
|
362
|
-
onclick={() => removeAttachment(attachment.id)}
|
|
363
|
-
aria-label={`Remove ${attachment.file.name}`}
|
|
364
|
-
>
|
|
365
|
-
<X class="cinder-icon-xs" />
|
|
366
|
-
</button>
|
|
367
|
-
</div>
|
|
368
|
-
{/each}
|
|
369
|
-
</div>
|
|
370
|
-
{/if}
|
|
371
|
-
|
|
372
|
-
<!-- Editor area -->
|
|
373
|
-
<div class="chat-input-editor-container">
|
|
374
|
-
<textarea
|
|
375
|
-
bind:this={editorElement}
|
|
376
|
-
id={`${id}-editor`}
|
|
377
|
-
bind:value
|
|
378
|
-
onkeydown={handleKeyDown}
|
|
379
|
-
oninput={handleInput}
|
|
380
|
-
onpointerup={oncomposerselectionchange}
|
|
381
|
-
onselect={oncomposerselectionchange}
|
|
382
|
-
onblur={oncomposerblur}
|
|
383
|
-
{placeholder}
|
|
384
|
-
role={composerRole}
|
|
385
|
-
aria-label={resolvedComposerLabel}
|
|
386
|
-
aria-expanded={composerAriaExpanded}
|
|
387
|
-
aria-controls={composerAriaControls}
|
|
388
|
-
aria-activedescendant={composerAriaActiveDescendant}
|
|
389
|
-
aria-autocomplete={composerAriaAutocomplete}
|
|
390
|
-
{disabled}
|
|
391
|
-
readonly={sending}
|
|
392
|
-
class="chat-input-editor"
|
|
393
|
-
aria-describedby={shortcutDescriptionId}
|
|
394
|
-
rows="1"
|
|
395
|
-
></textarea>
|
|
396
|
-
</div>
|
|
397
|
-
|
|
398
|
-
<!-- Footer with actions -->
|
|
399
|
-
<div class="chat-input-footer">
|
|
400
|
-
<div class="chat-input-footer-left">
|
|
401
|
-
{#if allowAttachments}
|
|
402
|
-
<input
|
|
403
|
-
bind:this={fileInputRef}
|
|
404
|
-
id={`${id}-file-picker`}
|
|
405
|
-
type="file"
|
|
406
|
-
accept={acceptedTypes.join(',')}
|
|
407
|
-
multiple
|
|
408
|
-
class="sr-only"
|
|
409
|
-
onchange={handleFileSelect}
|
|
410
|
-
aria-label="Attach files"
|
|
411
|
-
tabindex={-1}
|
|
412
|
-
/>
|
|
413
|
-
<Button
|
|
414
|
-
type="button"
|
|
415
|
-
variant="ghost"
|
|
416
|
-
size="sm"
|
|
417
|
-
onclick={() => fileInputRef?.click()}
|
|
418
|
-
disabled={disabled || sending}
|
|
419
|
-
aria-label="Attach file"
|
|
420
|
-
>
|
|
421
|
-
<Paperclip class="cinder-icon-sm" />
|
|
422
|
-
</Button>
|
|
423
|
-
{/if}
|
|
424
|
-
|
|
425
|
-
<!-- Visually hidden shortcut description: always in the accessibility tree even when hint is container-queried away -->
|
|
426
|
-
<span id={shortcutDescriptionId} class="sr-only">
|
|
427
|
-
{#if showStopButton}
|
|
428
|
-
Response is streaming. Use the stop button to stop generation.
|
|
429
|
-
{:else}
|
|
430
|
-
Press Enter to send, Shift+Enter for newline
|
|
431
|
-
{/if}
|
|
432
|
-
</span>
|
|
433
|
-
{#if !showStopButton}
|
|
434
|
-
<span id={hintId} class="chat-input-hint" aria-hidden="true">
|
|
435
|
-
<kbd>Enter</kbd> to send, <kbd>Shift</kbd>+<kbd>Enter</kbd> for newline
|
|
436
|
-
</span>
|
|
437
|
-
{/if}
|
|
438
|
-
</div>
|
|
439
|
-
|
|
440
|
-
<div class="chat-input-footer-right">
|
|
441
|
-
{#if actions}
|
|
442
|
-
{@render actions()}
|
|
443
|
-
{/if}
|
|
444
|
-
|
|
445
|
-
{#if showStopButton}
|
|
446
|
-
<!-- Stop button: replaces send button during streaming when onstop is provided -->
|
|
447
|
-
<button
|
|
448
|
-
type="button"
|
|
449
|
-
class="chat-input-send"
|
|
450
|
-
data-stop
|
|
451
|
-
onclick={onstop}
|
|
452
|
-
aria-label="Stop generating"
|
|
453
|
-
aria-describedby={shortcutDescriptionId}
|
|
454
|
-
>
|
|
455
|
-
<Square class="cinder-icon-sm" />
|
|
456
|
-
</button>
|
|
457
|
-
{:else}
|
|
458
|
-
<!-- Send button: shows spinner when sending (without onstop), otherwise arrow -->
|
|
459
|
-
<button
|
|
460
|
-
type="submit"
|
|
461
|
-
class="chat-input-send"
|
|
462
|
-
disabled={!canSubmit}
|
|
463
|
-
aria-label={sending ? 'Sending message' : 'Send message'}
|
|
464
|
-
aria-describedby={shortcutDescriptionId}
|
|
465
|
-
>
|
|
466
|
-
{#if sending}
|
|
467
|
-
<svg
|
|
468
|
-
class="chat-input-spinner"
|
|
469
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
470
|
-
fill="none"
|
|
471
|
-
viewBox="0 0 24 24"
|
|
472
|
-
aria-hidden="true"
|
|
473
|
-
>
|
|
474
|
-
<circle
|
|
475
|
-
class="spinner-track"
|
|
476
|
-
cx="12"
|
|
477
|
-
cy="12"
|
|
478
|
-
r="10"
|
|
479
|
-
stroke="currentColor"
|
|
480
|
-
stroke-width="4"
|
|
481
|
-
></circle>
|
|
482
|
-
<path
|
|
483
|
-
class="spinner-head"
|
|
484
|
-
fill="currentColor"
|
|
485
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
486
|
-
></path>
|
|
487
|
-
</svg>
|
|
488
|
-
{:else}
|
|
489
|
-
<ArrowUp class="cinder-icon-sm" />
|
|
490
|
-
{/if}
|
|
491
|
-
</button>
|
|
492
|
-
{/if}
|
|
493
|
-
</div>
|
|
494
|
-
</div>
|
|
495
|
-
|
|
496
|
-
<!-- Error display -->
|
|
497
|
-
{#if error}
|
|
498
|
-
<p id={errorId} class="chat-input-error" role="alert">
|
|
499
|
-
{error}
|
|
500
|
-
</p>
|
|
501
|
-
{/if}
|
|
502
|
-
|
|
503
|
-
<!-- Screen reader announcements -->
|
|
504
|
-
<div aria-live="polite" aria-atomic="true" class="sr-only">
|
|
505
|
-
{announcer.message}
|
|
506
|
-
</div>
|
|
507
|
-
</form>
|
|
508
|
-
|
|
509
|
-
<style>
|
|
510
|
-
.chat-input {
|
|
511
|
-
container-type: inline-size;
|
|
512
|
-
display: flex;
|
|
513
|
-
flex-direction: column;
|
|
514
|
-
gap: var(--cinder-space-2);
|
|
515
|
-
background: var(--cinder-surface);
|
|
516
|
-
border: 1px solid var(--cinder-border);
|
|
517
|
-
border-radius: var(--cinder-radius-lg);
|
|
518
|
-
padding: var(--cinder-space-3);
|
|
519
|
-
transition: border-color var(--cinder-duration-fast) var(--cinder-ease-standard);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
.chat-input:focus-within {
|
|
523
|
-
border-color: var(--cinder-accent);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
.chat-input-dragover {
|
|
527
|
-
border-style: dashed;
|
|
528
|
-
border-color: var(--cinder-accent);
|
|
529
|
-
background: color-mix(in oklch, var(--cinder-accent), transparent 95%);
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/* Attachment previews */
|
|
533
|
-
.chat-input-attachments {
|
|
534
|
-
display: flex;
|
|
535
|
-
flex-wrap: wrap;
|
|
536
|
-
gap: var(--cinder-space-2);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
/* Wrapper allows remove button to extend beyond image bounds without clipping */
|
|
540
|
-
.chat-input-attachment-wrapper {
|
|
541
|
-
position: relative;
|
|
542
|
-
/* Add padding to accommodate the extended touch target.
|
|
543
|
-
The remove button below is absolutely positioned with physical `right`
|
|
544
|
-
to anchor at the visual top-right corner of the image in both LTR and
|
|
545
|
-
RTL, so the wrapper's accommodating padding must also be physical to
|
|
546
|
-
match. Using padding-inline-end would flip in RTL while the button
|
|
547
|
-
stayed anchored right, causing overflow/clipping. */
|
|
548
|
-
padding-top: var(--cinder-space-2);
|
|
549
|
-
/* stylelint-disable-next-line csstools/use-logical */
|
|
550
|
-
padding-right: var(--cinder-space-2);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
.chat-input-attachment-remove {
|
|
554
|
-
position: absolute;
|
|
555
|
-
/* Position so visual center aligns with top-right corner of image.
|
|
556
|
-
Wrapper has 8px padding, button is 44px (22px to center).
|
|
557
|
-
To center button at image corner: padding - (button_size / 2) = 8px - 22px = -14px */
|
|
558
|
-
top: calc(var(--cinder-space-2) - var(--cinder-touch-target-min) / 2);
|
|
559
|
-
right: calc(var(--cinder-space-2) - var(--cinder-touch-target-min) / 2);
|
|
560
|
-
display: flex;
|
|
561
|
-
align-items: center;
|
|
562
|
-
justify-content: center;
|
|
563
|
-
/* WCAG 2.2 AA compliant touch target with visual icon inside */
|
|
564
|
-
width: var(--cinder-touch-target-min);
|
|
565
|
-
height: var(--cinder-touch-target-min);
|
|
566
|
-
padding: 0;
|
|
567
|
-
/* Transparent background with centered visible circle */
|
|
568
|
-
background: transparent;
|
|
569
|
-
border: none;
|
|
570
|
-
border-radius: var(--cinder-radius-full);
|
|
571
|
-
cursor: pointer;
|
|
572
|
-
color: white;
|
|
573
|
-
opacity: 0;
|
|
574
|
-
transition:
|
|
575
|
-
opacity var(--cinder-duration-fast) var(--cinder-ease-standard),
|
|
576
|
-
background var(--cinder-duration-fast) var(--cinder-ease-standard);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/* Visible circular background - smaller than touch target, centered */
|
|
580
|
-
.chat-input-attachment-remove::before {
|
|
581
|
-
content: '';
|
|
582
|
-
position: absolute;
|
|
583
|
-
top: 50%;
|
|
584
|
-
left: 50%;
|
|
585
|
-
width: 1.25rem;
|
|
586
|
-
height: 1.25rem;
|
|
587
|
-
background: oklch(0% 0 0 / 70%);
|
|
588
|
-
border-radius: var(--cinder-radius-full);
|
|
589
|
-
transform: translate(-50%, -50%);
|
|
590
|
-
transition: background var(--cinder-duration-fast) var(--cinder-ease-standard);
|
|
591
|
-
z-index: -1;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
@media (hover: hover) {
|
|
595
|
-
.chat-input-attachment-remove:hover::before {
|
|
596
|
-
background: var(--cinder-danger);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
.chat-input-attachment-wrapper:hover .chat-input-attachment-remove,
|
|
601
|
-
.chat-input-attachment-wrapper:focus-within .chat-input-attachment-remove {
|
|
602
|
-
opacity: 1;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/* The button is a 44px touch target but the visible chip is the centered
|
|
606
|
-
1.25rem `::before` circle. Paint the ring on the visible circle so it hugs
|
|
607
|
-
the chip rather than the oversized hit area. */
|
|
608
|
-
.chat-input-attachment-remove:focus-visible {
|
|
609
|
-
opacity: 1;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
.chat-input-attachment-remove:focus-visible::before {
|
|
613
|
-
box-shadow: inset 0 0 0 var(--cinder-ring-width)
|
|
614
|
-
var(--_cinder-chat-input-attachment-remove-ring, var(--cinder-ring-color));
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
@media (forced-colors: active) {
|
|
618
|
-
/* Forced-colors strips the box-shadow ring, so repaint a system-color
|
|
619
|
-
outline directly on the visible `::before` circle (which is round via
|
|
620
|
-
border-radius: full, so the outline follows the chip). Painting on the
|
|
621
|
-
circle itself avoids depending on fragile parent-to-pseudo offset math. */
|
|
622
|
-
.chat-input-attachment-remove:focus-visible::before {
|
|
623
|
-
box-shadow: none;
|
|
624
|
-
outline: var(--cinder-ring-width) solid ButtonText;
|
|
625
|
-
outline-offset: var(--cinder-ring-offset);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
/* Touch devices: always show remove button */
|
|
630
|
-
@media (hover: none) {
|
|
631
|
-
.chat-input-attachment-remove {
|
|
632
|
-
opacity: 1;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
/* Editor container */
|
|
637
|
-
.chat-input-editor-container {
|
|
638
|
-
min-height: 2.5rem;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
.chat-input-editor {
|
|
642
|
-
display: block;
|
|
643
|
-
width: 100%;
|
|
644
|
-
min-height: 2.5rem;
|
|
645
|
-
max-height: 12rem;
|
|
646
|
-
padding: var(--cinder-space-1) var(--cinder-space-3);
|
|
647
|
-
resize: none;
|
|
648
|
-
field-sizing: content;
|
|
649
|
-
overflow-y: auto;
|
|
650
|
-
font: inherit;
|
|
651
|
-
line-height: var(--cinder-leading-normal);
|
|
652
|
-
color: var(--cinder-text);
|
|
653
|
-
background: transparent;
|
|
654
|
-
border: none;
|
|
655
|
-
border-radius: 0;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
.chat-input-editor::placeholder {
|
|
659
|
-
color: var(--cinder-text-subtle);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
.chat-input-editor:focus {
|
|
663
|
-
outline: none;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
.chat-input-editor:read-only,
|
|
667
|
-
.chat-input-editor:disabled {
|
|
668
|
-
color: var(--cinder-text-muted);
|
|
669
|
-
cursor: not-allowed;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
/* Footer */
|
|
673
|
-
.chat-input-footer {
|
|
674
|
-
display: flex;
|
|
675
|
-
align-items: flex-end;
|
|
676
|
-
justify-content: space-between;
|
|
677
|
-
gap: var(--cinder-space-2);
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
.chat-input-footer-left,
|
|
681
|
-
.chat-input-footer-right {
|
|
682
|
-
display: flex;
|
|
683
|
-
align-items: flex-end;
|
|
684
|
-
gap: var(--cinder-space-2);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
.chat-input-hint {
|
|
688
|
-
font-size: var(--cinder-text-xs);
|
|
689
|
-
color: var(--cinder-text-subtle);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
.chat-input-hint kbd {
|
|
693
|
-
display: inline-flex;
|
|
694
|
-
align-items: center;
|
|
695
|
-
justify-content: center;
|
|
696
|
-
min-width: 1.25rem;
|
|
697
|
-
height: 1.25rem;
|
|
698
|
-
padding: 0 var(--cinder-space-1);
|
|
699
|
-
font-family: inherit;
|
|
700
|
-
font-size: var(--cinder-text-xs);
|
|
701
|
-
color: var(--cinder-text);
|
|
702
|
-
background: var(--cinder-surface-raised);
|
|
703
|
-
border: 1px solid var(--cinder-border);
|
|
704
|
-
border-radius: var(--cinder-radius-sm);
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
/* Hide hint on narrow containers */
|
|
708
|
-
@container (max-width: 320px) {
|
|
709
|
-
.chat-input-hint {
|
|
710
|
-
display: none;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/* Send button - circular icon button
|
|
715
|
-
* Uses --cinder-touch-target-min (44px) for WCAG 2.2 AA touch target compliance */
|
|
716
|
-
.chat-input-send {
|
|
717
|
-
display: flex;
|
|
718
|
-
align-items: center;
|
|
719
|
-
justify-content: center;
|
|
720
|
-
width: var(--cinder-touch-target-min);
|
|
721
|
-
height: var(--cinder-touch-target-min);
|
|
722
|
-
padding: 0;
|
|
723
|
-
border: none;
|
|
724
|
-
border-radius: var(--cinder-radius-full);
|
|
725
|
-
background: var(--cinder-accent);
|
|
726
|
-
color: var(--cinder-accent-contrast);
|
|
727
|
-
cursor: pointer;
|
|
728
|
-
transition:
|
|
729
|
-
background var(--cinder-duration-fast) var(--cinder-ease-standard),
|
|
730
|
-
transform var(--cinder-duration-fast) var(--cinder-ease-standard);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
@media (hover: hover) {
|
|
734
|
-
.chat-input-send:hover:not(:disabled) {
|
|
735
|
-
background: color-mix(in oklch, var(--cinder-accent), black 15%);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
.chat-input-send:active:not(:disabled) {
|
|
740
|
-
transform: scale(0.95);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
.chat-input-send:disabled {
|
|
744
|
-
background: var(--cinder-surface-inset);
|
|
745
|
-
color: var(--cinder-text-disabled);
|
|
746
|
-
cursor: not-allowed;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
.chat-input-send:focus-visible {
|
|
750
|
-
outline: var(--cinder-ring-width) solid transparent;
|
|
751
|
-
outline-offset: 3px;
|
|
752
|
-
box-shadow: var(--_cinder-focus-ring-shadow);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/* Stop button variant - danger-tinted to signal urgency during streaming */
|
|
756
|
-
.chat-input-send[data-stop] {
|
|
757
|
-
background: var(--cinder-color-danger-bg);
|
|
758
|
-
color: var(--cinder-color-danger-fg);
|
|
759
|
-
border: 1px solid var(--cinder-color-danger-border);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
@media (hover: hover) {
|
|
763
|
-
.chat-input-send[data-stop]:hover {
|
|
764
|
-
background: var(--cinder-color-danger-border);
|
|
765
|
-
border-color: var(--cinder-danger);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
@media (forced-colors: active) {
|
|
770
|
-
.chat-input-send:focus-visible {
|
|
771
|
-
outline: var(--cinder-ring-width) solid Highlight;
|
|
772
|
-
outline-offset: 3px;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
/* Spinner */
|
|
777
|
-
.chat-input-spinner {
|
|
778
|
-
width: 1rem;
|
|
779
|
-
height: 1rem;
|
|
780
|
-
animation: spin 1s linear infinite;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
.spinner-track {
|
|
784
|
-
opacity: 0.25;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
.spinner-head {
|
|
788
|
-
opacity: 0.75;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
/* Error */
|
|
792
|
-
.chat-input-error {
|
|
793
|
-
margin: 0;
|
|
794
|
-
font-size: var(--cinder-text-xs);
|
|
795
|
-
color: var(--cinder-danger);
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
/* Screen reader only */
|
|
799
|
-
.sr-only {
|
|
800
|
-
position: absolute;
|
|
801
|
-
width: 1px;
|
|
802
|
-
height: 1px;
|
|
803
|
-
padding: 0;
|
|
804
|
-
margin: -1px;
|
|
805
|
-
overflow: hidden;
|
|
806
|
-
clip: rect(0, 0, 0, 0);
|
|
807
|
-
white-space: nowrap;
|
|
808
|
-
border: 0;
|
|
809
|
-
}
|
|
810
|
-
</style>
|