@k2b/ui 0.63.0 → 0.65.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/dist/browser/actions/DragAndDrop.js +26 -5
- package/dist/browser/actions/DragAndDrop.js.map +1 -1
- package/dist/browser/actions/DropOverlay.js +76 -0
- package/dist/browser/actions/DropOverlay.js.map +1 -0
- package/dist/browser/actions/SortableList.js +338 -85
- package/dist/browser/actions/SortableList.js.map +1 -1
- package/dist/browser/actions/drag-and-drop-keyboard.js +211 -0
- package/dist/browser/actions/drag-and-drop-keyboard.js.map +1 -0
- package/dist/browser/actions/drag-and-drop-messages.js +21 -25
- package/dist/browser/actions/drag-and-drop-messages.js.map +1 -1
- package/dist/browser/actions/drag-and-drop.js +206 -184
- package/dist/browser/actions/drag-and-drop.js.map +1 -1
- package/dist/browser/actions/drop-overlay-pages.js +54 -0
- package/dist/browser/actions/drop-overlay-pages.js.map +1 -0
- package/dist/browser/actions/drop-overlay-view.js +318 -0
- package/dist/browser/actions/drop-overlay-view.js.map +1 -0
- package/dist/browser/actions/index.js +4 -2
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/actions/preload-when-idle.js +15 -0
- package/dist/browser/actions/preload-when-idle.js.map +1 -0
- package/dist/browser/actions/sortable-board.js +107 -0
- package/dist/browser/actions/sortable-board.js.map +1 -0
- package/dist/browser/actions/sortable-keyboard.js +202 -0
- package/dist/browser/actions/sortable-keyboard.js.map +1 -0
- package/dist/browser/actions/sortable-list-messages.js +23 -11
- package/dist/browser/actions/sortable-list-messages.js.map +1 -1
- package/dist/browser/actions/sortable-place.js +26 -0
- package/dist/browser/actions/sortable-place.js.map +1 -0
- package/dist/browser/chat/ChatDecision.js +499 -463
- package/dist/browser/chat/ChatDecision.js.map +1 -1
- package/dist/browser/chat/ChatDecisionField.js +311 -0
- package/dist/browser/chat/ChatDecisionField.js.map +1 -0
- package/dist/browser/chat/index.js +2 -0
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/chat/types.js.map +1 -1
- package/dist/browser/chat-decision-field.js +6 -0
- package/dist/browser/chat-decision-field.js.map +1 -0
- package/dist/browser/content/DataTable.js +81 -48
- package/dist/browser/content/DataTable.js.map +1 -1
- package/dist/browser/content/MessageRow.js +139 -115
- package/dist/browser/content/MessageRow.js.map +1 -1
- package/dist/browser/feedback/dialog-core.js +57 -11
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/inputs/DatePicker.js +369 -716
- package/dist/browser/inputs/DatePicker.js.map +1 -1
- package/dist/browser/inputs/FileInputs.js +1 -1
- package/dist/browser/inputs/FileInputs.js.map +1 -1
- package/dist/browser/inputs/NumberInput.js +125 -46
- package/dist/browser/inputs/NumberInput.js.map +1 -1
- package/dist/browser/inputs/PeriodPicker.js +9 -4
- package/dist/browser/inputs/PeriodPicker.js.map +1 -1
- package/dist/browser/inputs/TextInput.js +3 -3
- package/dist/browser/inputs/TextInput.js.map +1 -1
- package/dist/browser/inputs/date-picker-panel.js +420 -0
- package/dist/browser/inputs/date-picker-panel.js.map +1 -0
- package/dist/browser/inputs/image-crop.js +1 -1
- package/dist/browser/inputs/image-crop.js.map +1 -1
- package/dist/browser/inputs/image-tools.js +4 -0
- package/dist/browser/inputs/image-tools.js.map +1 -0
- package/dist/browser/inputs/input-messages.js +8 -2
- package/dist/browser/inputs/input-messages.js.map +1 -1
- package/dist/ssr/actions/DragAndDrop.js +26 -5
- package/dist/ssr/actions/DragAndDrop.js.map +1 -1
- package/dist/ssr/actions/DropOverlay.js +69 -0
- package/dist/ssr/actions/DropOverlay.js.map +1 -0
- package/dist/ssr/actions/SortableList.js +293 -71
- package/dist/ssr/actions/SortableList.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop-keyboard.js +211 -0
- package/dist/ssr/actions/drag-and-drop-keyboard.js.map +1 -0
- package/dist/ssr/actions/drag-and-drop-messages.js +21 -25
- package/dist/ssr/actions/drag-and-drop-messages.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop.js +206 -184
- package/dist/ssr/actions/drag-and-drop.js.map +1 -1
- package/dist/ssr/actions/drop-overlay-pages.js +54 -0
- package/dist/ssr/actions/drop-overlay-pages.js.map +1 -0
- package/dist/ssr/actions/drop-overlay-view.js +225 -0
- package/dist/ssr/actions/drop-overlay-view.js.map +1 -0
- package/dist/ssr/actions/index.js +4 -2
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/actions/preload-when-idle.js +15 -0
- package/dist/ssr/actions/preload-when-idle.js.map +1 -0
- package/dist/ssr/actions/sortable-board.js +107 -0
- package/dist/ssr/actions/sortable-board.js.map +1 -0
- package/dist/ssr/actions/sortable-keyboard.js +202 -0
- package/dist/ssr/actions/sortable-keyboard.js.map +1 -0
- package/dist/ssr/actions/sortable-list-messages.js +23 -11
- package/dist/ssr/actions/sortable-list-messages.js.map +1 -1
- package/dist/ssr/actions/sortable-place.js +26 -0
- package/dist/ssr/actions/sortable-place.js.map +1 -0
- package/dist/ssr/chat/ChatDecision.js +256 -228
- package/dist/ssr/chat/ChatDecision.js.map +1 -1
- package/dist/ssr/chat/ChatDecisionField.js +206 -0
- package/dist/ssr/chat/ChatDecisionField.js.map +1 -0
- package/dist/ssr/chat/index.js +2 -0
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/chat/types.js.map +1 -1
- package/dist/ssr/chat-decision-field.js +6 -0
- package/dist/ssr/chat-decision-field.js.map +1 -0
- package/dist/ssr/content/DataTable.js +56 -23
- package/dist/ssr/content/DataTable.js.map +1 -1
- package/dist/ssr/content/MessageRow.js +30 -10
- package/dist/ssr/content/MessageRow.js.map +1 -1
- package/dist/ssr/feedback/dialog-core.js +57 -11
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/inputs/DatePicker.js +94 -263
- package/dist/ssr/inputs/DatePicker.js.map +1 -1
- package/dist/ssr/inputs/FileInputs.js +1 -1
- package/dist/ssr/inputs/FileInputs.js.map +1 -1
- package/dist/ssr/inputs/NumberInput.js +114 -44
- package/dist/ssr/inputs/NumberInput.js.map +1 -1
- package/dist/ssr/inputs/PeriodPicker.js +9 -4
- package/dist/ssr/inputs/PeriodPicker.js.map +1 -1
- package/dist/ssr/inputs/TextInput.js +3 -3
- package/dist/ssr/inputs/TextInput.js.map +1 -1
- package/dist/ssr/inputs/date-picker-panel.js +233 -0
- package/dist/ssr/inputs/date-picker-panel.js.map +1 -0
- package/dist/ssr/inputs/image-crop.js +1 -1
- package/dist/ssr/inputs/image-crop.js.map +1 -1
- package/dist/ssr/inputs/image-tools.js +4 -0
- package/dist/ssr/inputs/image-tools.js.map +1 -0
- package/dist/ssr/inputs/input-messages.js +8 -2
- package/dist/ssr/inputs/input-messages.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/DragAndDrop.d.ts +17 -2
- package/dist/types/actions/DropOverlay.d.ts +46 -0
- package/dist/types/actions/SortableList.d.ts +36 -6
- package/dist/types/actions/drag-and-drop-keyboard.d.ts +4 -0
- package/dist/types/actions/drag-and-drop-messages.d.ts +8 -10
- package/dist/types/actions/drag-and-drop.d.ts +62 -4
- package/dist/types/actions/drop-overlay-pages.d.ts +22 -0
- package/dist/types/actions/drop-overlay-view.d.ts +12 -0
- package/dist/types/actions/index.d.ts +8 -4
- package/dist/types/actions/preload-when-idle.d.ts +5 -0
- package/dist/types/actions/sortable-board.d.ts +69 -0
- package/dist/types/actions/sortable-keyboard.d.ts +7 -0
- package/dist/types/actions/sortable-list-messages.d.ts +10 -3
- package/dist/types/actions/sortable-place.d.ts +16 -0
- package/dist/types/chat/ChatDecision.d.ts +28 -4
- package/dist/types/chat/ChatDecisionField.d.ts +45 -0
- package/dist/types/chat/index.d.ts +1 -0
- package/dist/types/chat/types.d.ts +9 -0
- package/dist/types/chat-decision-field.d.ts +5 -0
- package/dist/types/content/MessageRow.d.ts +11 -0
- package/dist/types/inputs/DatePicker.d.ts +3 -21
- package/dist/types/inputs/TextInput.d.ts +2 -0
- package/dist/types/inputs/date-picker-panel.d.ts +29 -0
- package/dist/types/inputs/image-tools.d.ts +1 -0
- package/dist/types/inputs/input-messages.d.ts +4 -1
- package/package.json +9 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["chat/types.ts"],"sourcesContent":["import type { JSX } from \"solid-js\";\nimport type { EmojiSkinTone } from \"../inputs/emoji/emoji-index\";\n\nexport type ChatRole = \"user\" | \"assistant\" | \"system\" | \"tool\";\n\nexport type ChatMessageStatus = \"pending\" | \"streaming\" | \"complete\" | \"error\";\n\n/** `warning` marks a partial result or an outcome that is not yet known. */\nexport type ChatActivityTone = \"neutral\" | \"ai\" | \"success\" | \"warning\" | \"danger\";\n\n/** `open` asks; `sending` while the answer is on its way; `decided` once answered; `expired` when it ran out. */\nexport type ChatDecisionState = \"open\" | \"sending\" | \"decided\" | \"expired\";\n\n/** One answer of a question. Set the question's state in `onSelect` before awaiting anything, so it collapses at once. */\nexport type ChatDecisionAnswer = {\n label: string;\n /** Icon class, for example `ti ti-send`. */\n icon?: string;\n /**\n * The answer was given and Cloud works on it for an unknown time, such as switching something on while the question\n * stays in place. A shimmer runs over the filled button and it takes no second press. Only `confirm` reads it.\n */\n busy?: boolean;\n /** A returned promise holds every answer of the question until it settles; then they work again while it stays open. */\n onSelect: () => void | Promise<void>;\n};\n\n/**\n * A quiet fact in the answer row, such as when the question expires; `success` and `warning` colour it as a result,\n * `ai` as work Gustav does by himself, such as a revision that waits or runs.\n */\nexport type ChatDecisionFact = { text: string; icon: string; tone?: \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"ai\" };\n\n/** Why a question is asked, or why its main answer is off. */\nexport type ChatDecisionReason = {\n text: JSX.Element;\n /** Icon class; the text after it starts 1.5rem from the edge. */\n icon?: string;\n /** `danger` for deletions, `warning` for outside content and limits. */\n tone?: \"neutral\" | \"danger\" | \"warning\";\n};\n\nexport type ChatOutcomeTone = \"running\" | \"done\" | \"off\" | \"waiting\" | \"warning\" | \"error\";\n\n/** One text of an outcome flow. */\nexport type ChatOutcomeLine = {\n tone: ChatOutcomeTone;\n /** What happened, as one sentence, usually with `ReferenceChip`s. */\n text: JSX.Element;\n /** A quiet second sentence, such as \"You declined.\" */\n detail?: JSX.Element;\n /** A formatted time after the text. */\n time?: string;\n /** Replaces the tone's icon, for example `ti ti-clock-x` for an expired question. */\n icon?: string;\n /** One text link after the line, such as \"Ask again\". */\n action?: { label: string; onSelect: () => void | Promise<void> };\n /** Small buttons under the line. Shown while this line is current; otherwise hidden but still reserving their row. */\n actions?: JSX.Element;\n};\n\ntype ChatActionBase = {\n id: string;\n label: string;\n icon?: string;\n variant?: \"danger\";\n disabled?: boolean;\n /** Why the action is off. An icon-only action shows it as its tooltip while `disabled`. */\n disabledReason?: string;\n /** Toggle state for persistent message actions such as feedback. */\n pressed?: boolean;\n /** Semantic foreground for selected feedback actions, without a persistent background. */\n pressedTone?: \"success\" | \"danger\";\n /** With inline actions, listed in the trailing \"More\" menu instead of as its own icon button. */\n overflow?: boolean;\n};\n\n/** Exactly one executable behavior for every chat action. */\nexport type ChatAction = ChatActionBase &\n ({ onSelect: () => void | Promise<void>; copyText?: never } | { copyText: string; onSelect?: never });\n\nexport type ChatAttachment = {\n id: string;\n name: string;\n size?: number;\n kind?: \"file\" | \"image\" | \"resource\";\n icon?: string;\n previewUrl?: string;\n alt?: string;\n /** Optional destination represented by this attachment. */\n href?: string;\n /** Opaque application-owned payload returned unchanged with ChatSubmitInput. */\n data?: unknown;\n /** Optional application-owned action presented below the attachment label. */\n action?: ChatAction;\n /**\n * Upload progress in percent while the attachment uploads, such as a draft that saves its files before sending. The\n * line below the label shows a ring and the percentage instead of `action`.\n */\n progress?: number;\n};\n\nexport type ChatUsage = {\n input?: number;\n output?: number;\n total?: number;\n};\n\nexport type ChatContextUsageData = {\n usage?: ChatUsage | null;\n loopUsage?: ChatUsage | null;\n contextWindow?: number;\n modelLabel?: string;\n /** One short line under the context bar, such as what happens when the context is full. */\n note?: JSX.Element;\n};\n\n/**\n * One application-owned part of the usage control, such as a budget. The control keeps one ring: it shows the highest\n * share of all parts and turns to the warning colour once a part reaches its `warnAt`.\n */\nexport type ChatUsageSection = {\n id: string;\n /** Heading in the details, such as \"Your budget\". */\n title: string;\n /** Used share in percent, or null while it is not known. */\n percent?: number | null;\n /** Share from which this part warns. Defaults to 80. */\n warnAt?: number;\n /** Short text after the heading, such as \"86% used\". */\n value?: string;\n /** This part in the trigger's accessible label, such as \"Budget 86% used\". */\n summary: string;\n /** Details below the heading: bars, `dl` rows, `p` notes, and `.k2b-chat-usage__row` lines with a small action. */\n content?: JSX.Element;\n /** Runs each time the details open, for example to refresh this part. */\n onOpen?: () => void;\n};\n\nexport type ChatModelOption = {\n id: string;\n label: string;\n description?: string;\n image?: string;\n icon?: string;\n capabilities?: readonly string[];\n};\n\nexport type ChatComposerState = \"idle\" | \"submitting\" | \"running\" | \"stopping\";\n\nexport type ChatSubmitIntent = \"send\" | \"steer\" | \"queue\";\n\nexport type ChatSubmitInput = {\n intent: ChatSubmitIntent;\n text: string;\n attachments: readonly ChatAttachment[];\n mentions?: readonly ChatMention[];\n};\n\n/** Ranges use UTF-16 offsets into the untrimmed composer text. Payloads stay application-owned. */\nexport type ChatMention = { start: number; end: number; attachment: ChatAttachment };\n\n/**\n * Live dictation as the caller runs it: `listening` while speech arrives, `refining` after the stop until the refined\n * text replaced it, `refined` afterwards, `unrefined` when the raw text stays, and `interrupted` when the connection\n * ended early and the text so far stays.\n */\nexport type ChatDictationState = \"listening\" | \"refining\" | \"refined\" | \"unrefined\" | \"interrupted\";\n\n/** The composer's microphone. Dictation comes first; a voice message is the deliberate second action. */\nexport type ChatComposerMicrophone = {\n /** A tap starts or stops live dictation. Without it, a tap opens the microphone menu. */\n onDictate?: () => void;\n /** Holding the microphone, or \"Record voice message\" in its menu. Omit it where recording is not available. */\n onVoiceMessage?: () => void;\n /** The dictation state, shown on the microphone and in the hint line. */\n dictation?: ChatDictationState | null;\n /** Offered as \"Restore original\" while `dictation` is `refined`. */\n onRestoreOriginal?: () => void;\n disabled?: boolean;\n};\n\n/**\n * The composer's emoji button and `:shortcode` completion. Typing a colon and two letters suggests emoji by their\n * English or German name or GitHub shortcode; a complete `:thumbsup:` becomes 👍 when its closing colon is typed.\n */\nexport type ChatComposerEmoji = {\n /** Opens the emoji choice next to `anchor`, usually `EmojiPicker.Popover`; `insert` puts the chosen text at the caret. */\n onOpen: (context: { anchor: HTMLElement; insert: (text: string) => void }) => void;\n /** The skin tone of completed emoji that have one, as in the picker. */\n skinTone?: EmojiSkinTone;\n /** Called with each emoji the completion inserted, for example to remember it with `rememberEmoji`. */\n onPick?: (emoji: string) => void;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["chat/types.ts"],"sourcesContent":["import type { JSX } from \"solid-js\";\nimport type { EmojiSkinTone } from \"../inputs/emoji/emoji-index\";\n\nexport type ChatRole = \"user\" | \"assistant\" | \"system\" | \"tool\";\n\nexport type ChatMessageStatus = \"pending\" | \"streaming\" | \"complete\" | \"error\";\n\n/** `warning` marks a partial result or an outcome that is not yet known. */\nexport type ChatActivityTone = \"neutral\" | \"ai\" | \"success\" | \"warning\" | \"danger\";\n\n/** `open` asks; `sending` while the answer is on its way; `decided` once answered; `expired` when it ran out. */\nexport type ChatDecisionState = \"open\" | \"sending\" | \"decided\" | \"expired\";\n\n/** One answer of a question. Set the question's state in `onSelect` before awaiting anything, so it collapses at once. */\nexport type ChatDecisionAnswer = {\n label: string;\n /** Icon class, for example `ti ti-send`. */\n icon?: string;\n /**\n * The answer was given and Cloud works on it for an unknown time, such as switching something on while the question\n * stays in place. A shimmer runs over the filled button and it takes no second press. Only `confirm` reads it.\n */\n busy?: boolean;\n /**\n * The other labels this answer can take while its question stays open, such as \"Saving …\" and \"Try again\" beside\n * \"Save\". All of them share one cell, so the button keeps the width of the widest and a switch moves nothing. Read\n * by the answers of `ChatDecisionField`.\n */\n alternates?: readonly { label: string; icon?: string }[];\n /** A returned promise holds every answer of the question until it settles; then they work again while it stays open. */\n onSelect: () => void | Promise<void>;\n};\n\n/**\n * A quiet fact in the answer row, such as when the question expires; `success` and `warning` colour it as a result,\n * `ai` as work Gustav does by himself, such as a revision that waits or runs.\n */\nexport type ChatDecisionFact = { text: string; icon: string; tone?: \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"ai\" };\n\n/** Why a question is asked, or why its main answer is off. */\nexport type ChatDecisionReason = {\n text: JSX.Element;\n /** Icon class; the text after it starts 1.5rem from the edge. */\n icon?: string;\n /** `danger` for deletions, `warning` for outside content and limits. */\n tone?: \"neutral\" | \"danger\" | \"warning\";\n};\n\nexport type ChatOutcomeTone = \"running\" | \"done\" | \"off\" | \"waiting\" | \"warning\" | \"error\";\n\n/** One text of an outcome flow. */\nexport type ChatOutcomeLine = {\n tone: ChatOutcomeTone;\n /** What happened, as one sentence, usually with `ReferenceChip`s. */\n text: JSX.Element;\n /** A quiet second sentence, such as \"You declined.\" */\n detail?: JSX.Element;\n /** A formatted time after the text. */\n time?: string;\n /** Replaces the tone's icon, for example `ti ti-clock-x` for an expired question. */\n icon?: string;\n /** One text link after the line, such as \"Ask again\". */\n action?: { label: string; onSelect: () => void | Promise<void> };\n /** Small buttons under the line. Shown while this line is current; otherwise hidden but still reserving their row. */\n actions?: JSX.Element;\n};\n\ntype ChatActionBase = {\n id: string;\n label: string;\n icon?: string;\n variant?: \"danger\";\n disabled?: boolean;\n /** Why the action is off. An icon-only action shows it as its tooltip while `disabled`. */\n disabledReason?: string;\n /** Toggle state for persistent message actions such as feedback. */\n pressed?: boolean;\n /** Semantic foreground for selected feedback actions, without a persistent background. */\n pressedTone?: \"success\" | \"danger\";\n /** With inline actions, listed in the trailing \"More\" menu instead of as its own icon button. */\n overflow?: boolean;\n};\n\n/** Exactly one executable behavior for every chat action. */\nexport type ChatAction = ChatActionBase &\n ({ onSelect: () => void | Promise<void>; copyText?: never } | { copyText: string; onSelect?: never });\n\nexport type ChatAttachment = {\n id: string;\n name: string;\n size?: number;\n kind?: \"file\" | \"image\" | \"resource\";\n icon?: string;\n previewUrl?: string;\n alt?: string;\n /** Optional destination represented by this attachment. */\n href?: string;\n /** Opaque application-owned payload returned unchanged with ChatSubmitInput. */\n data?: unknown;\n /** Optional application-owned action presented below the attachment label. */\n action?: ChatAction;\n /**\n * Upload progress in percent while the attachment uploads, such as a draft that saves its files before sending. The\n * line below the label shows a ring and the percentage instead of `action`.\n */\n progress?: number;\n};\n\nexport type ChatUsage = {\n input?: number;\n output?: number;\n total?: number;\n};\n\nexport type ChatContextUsageData = {\n usage?: ChatUsage | null;\n loopUsage?: ChatUsage | null;\n contextWindow?: number;\n modelLabel?: string;\n /** One short line under the context bar, such as what happens when the context is full. */\n note?: JSX.Element;\n};\n\n/**\n * One application-owned part of the usage control, such as a budget. The control keeps one ring: it shows the highest\n * share of all parts and turns to the warning colour once a part reaches its `warnAt`.\n */\nexport type ChatUsageSection = {\n id: string;\n /** Heading in the details, such as \"Your budget\". */\n title: string;\n /** Used share in percent, or null while it is not known. */\n percent?: number | null;\n /** Share from which this part warns. Defaults to 80. */\n warnAt?: number;\n /** Short text after the heading, such as \"86% used\". */\n value?: string;\n /** This part in the trigger's accessible label, such as \"Budget 86% used\". */\n summary: string;\n /** Details below the heading: bars, `dl` rows, `p` notes, and `.k2b-chat-usage__row` lines with a small action. */\n content?: JSX.Element;\n /** Runs each time the details open, for example to refresh this part. */\n onOpen?: () => void;\n};\n\nexport type ChatModelOption = {\n id: string;\n label: string;\n description?: string;\n image?: string;\n icon?: string;\n capabilities?: readonly string[];\n};\n\nexport type ChatComposerState = \"idle\" | \"submitting\" | \"running\" | \"stopping\";\n\nexport type ChatSubmitIntent = \"send\" | \"steer\" | \"queue\";\n\nexport type ChatSubmitInput = {\n intent: ChatSubmitIntent;\n text: string;\n attachments: readonly ChatAttachment[];\n mentions?: readonly ChatMention[];\n};\n\n/** Ranges use UTF-16 offsets into the untrimmed composer text. Payloads stay application-owned. */\nexport type ChatMention = { start: number; end: number; attachment: ChatAttachment };\n\n/**\n * Live dictation as the caller runs it: `listening` while speech arrives, `refining` after the stop until the refined\n * text replaced it, `refined` afterwards, `unrefined` when the raw text stays, and `interrupted` when the connection\n * ended early and the text so far stays.\n */\nexport type ChatDictationState = \"listening\" | \"refining\" | \"refined\" | \"unrefined\" | \"interrupted\";\n\n/** The composer's microphone. Dictation comes first; a voice message is the deliberate second action. */\nexport type ChatComposerMicrophone = {\n /** A tap starts or stops live dictation. Without it, a tap opens the microphone menu. */\n onDictate?: () => void;\n /** Holding the microphone, or \"Record voice message\" in its menu. Omit it where recording is not available. */\n onVoiceMessage?: () => void;\n /** The dictation state, shown on the microphone and in the hint line. */\n dictation?: ChatDictationState | null;\n /** Offered as \"Restore original\" while `dictation` is `refined`. */\n onRestoreOriginal?: () => void;\n disabled?: boolean;\n};\n\n/**\n * The composer's emoji button and `:shortcode` completion. Typing a colon and two letters suggests emoji by their\n * English or German name or GitHub shortcode; a complete `:thumbsup:` becomes 👍 when its closing colon is typed.\n */\nexport type ChatComposerEmoji = {\n /** Opens the emoji choice next to `anchor`, usually `EmojiPicker.Popover`; `insert` puts the chosen text at the caret. */\n onOpen: (context: { anchor: HTMLElement; insert: (text: string) => void }) => void;\n /** The skin tone of completed emoji that have one, as in the picker. */\n skinTone?: EmojiSkinTone;\n /** Called with each emoji the completion inserted, for example to remember it with `rememberEmoji`. */\n onPick?: (emoji: string) => void;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A separate entry for code that loads a question with a field on demand. Imported from here, it stays out of an
|
|
3
|
+
* island's first JavaScript, because the main entry no longer has to keep it.
|
|
4
|
+
*/
|
|
5
|
+
export { ChatDecisionField } from "./chat/ChatDecisionField";
|
|
6
|
+
//# sourceMappingURL=chat-decision-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["chat-decision-field.ts"],"sourcesContent":["/**\n * A separate entry for code that loads a question with a field on demand. Imported from here, it stays out of an\n * island's first JavaScript, because the main entry no longer has to keep it.\n */\nexport { ChatDecisionField, type ChatDecisionFieldProps } from \"./chat/ChatDecisionField\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,QAAqC,0BAA0B","ignoreList":[]}
|
|
@@ -64,6 +64,21 @@ import { formatTableNumber, groupRows, isEmptyCell, isNumericColumnType, readTab
|
|
|
64
64
|
import { useDataTableMessages } from "./data-table-messages";
|
|
65
65
|
import { FlowAmount } from "./FlowAmount";
|
|
66
66
|
import { LoadMore } from "./LoadMore";
|
|
67
|
+
const isPlainObject = value => {
|
|
68
|
+
if (typeof value !== "object" || value === null) return false;
|
|
69
|
+
const prototype = Object.getPrototypeOf(value);
|
|
70
|
+
return prototype === Object.prototype || prototype === null;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/** Equal plain data (objects, arrays, dates, primitives); anything else is equal only as the same value. */
|
|
74
|
+
const sameData = (a, b) => {
|
|
75
|
+
if (Object.is(a, b)) return true;
|
|
76
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
|
|
77
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((item, index) => sameData(item, b[index]));
|
|
78
|
+
if (!isPlainObject(a) || !isPlainObject(b)) return false;
|
|
79
|
+
const keys = Object.keys(a);
|
|
80
|
+
return keys.length === Object.keys(b).length && keys.every(key => Object.hasOwn(b, key) && sameData(a[key], b[key]));
|
|
81
|
+
};
|
|
67
82
|
const DataTablePanelContext = createContext();
|
|
68
83
|
const defaultRender = (value, locale, numbers, messages) => {
|
|
69
84
|
if (value === null || value === undefined || value === "") return "—";
|
|
@@ -131,6 +146,8 @@ function DataTableRoot(props) {
|
|
|
131
146
|
const rowCount = createMemo(() => props.rows.length);
|
|
132
147
|
const loadingRows = () => Math.min(50, Math.max(1, Math.trunc(Number.isNaN(props.loadingRows) ? 5 : props.loadingRows ?? 5)));
|
|
133
148
|
const rowId = row => props.getRowId?.(row);
|
|
149
|
+
/** A row's identity: its id where the table has one, else the row object. */
|
|
150
|
+
const rowKey = row => rowId(row) ?? row;
|
|
134
151
|
const isInteractive = () => !!props.selection || !!props.onRowClick || !!props.onRowDoubleClick;
|
|
135
152
|
const shouldHoverRows = () => props.hoverRows ?? isInteractive();
|
|
136
153
|
const labelledBy = () => props.ariaLabelledBy ?? (panel?.hasHeading() ? panel.headingId : undefined);
|
|
@@ -229,10 +246,11 @@ function DataTableRoot(props) {
|
|
|
229
246
|
const headerColumns = createMemo(() => detailsPriority() ? [...props.columns, null] : props.columns);
|
|
230
247
|
const hiddenColumns = () => props.columns.filter(col => priorityAttr(col));
|
|
231
248
|
const columnCount = () => props.columns.length + (detailsPriority() ? 1 : 0);
|
|
249
|
+
// Keyed by row id where there is one, so a details line stays open when the rows arrive as new objects.
|
|
232
250
|
const [openDetails, setOpenDetails] = createSignal(new Set());
|
|
233
|
-
const toggleDetails =
|
|
251
|
+
const toggleDetails = key => setOpenDetails(open => {
|
|
234
252
|
const next = new Set(open);
|
|
235
|
-
if (!next.delete(
|
|
253
|
+
if (!next.delete(key)) next.add(key);
|
|
236
254
|
return next;
|
|
237
255
|
});
|
|
238
256
|
/** A bar column fills its track at `max`, or else at its largest value. */
|
|
@@ -456,20 +474,24 @@ function DataTableRoot(props) {
|
|
|
456
474
|
|
|
457
475
|
/** `last` marks the final row of its body when details rows follow every row, so the frame keeps the only edge. */
|
|
458
476
|
const renderRow = (row, last) => {
|
|
459
|
-
const id = () => rowId(row);
|
|
477
|
+
const id = () => rowId(row());
|
|
460
478
|
const isSelected = () => props.selection ? props.selection.selected().has(id() ?? "") : props.selectedRowId && id() === props.selectedRowId;
|
|
461
479
|
const detailsId = `k2b-data-table-${createUniqueId()}-details`;
|
|
462
|
-
const open = () => openDetails().has(row);
|
|
480
|
+
const open = () => openDetails().has(rowKey(row()));
|
|
481
|
+
// Cells render from the row's content: a refresh with an equal new object keeps their elements and the focus in them.
|
|
482
|
+
const content = createMemo(row, row(), {
|
|
483
|
+
equals: sameData
|
|
484
|
+
});
|
|
463
485
|
return [(() => {
|
|
464
486
|
var _el$14 = _$getNextElement(_tmpl$0),
|
|
465
487
|
_el$18 = _el$14.firstChild,
|
|
466
488
|
[_el$19, _co$3] = _$getNextMarker(_el$18.nextSibling),
|
|
467
489
|
_el$20 = _el$19.nextSibling,
|
|
468
490
|
[_el$21, _co$4] = _$getNextMarker(_el$20.nextSibling);
|
|
469
|
-
_el$14.$$keydown = e => onRowKeyDown(e, row);
|
|
470
|
-
_el$14.$$contextmenu = () => props.onRowContextMenu?.(row);
|
|
471
|
-
_el$14.$$dblclick = event => onRowDoubleClick(event, row);
|
|
472
|
-
_el$14.$$click = event => onRowClick(event, row);
|
|
491
|
+
_el$14.$$keydown = e => onRowKeyDown(e, row());
|
|
492
|
+
_el$14.$$contextmenu = () => props.onRowContextMenu?.(row());
|
|
493
|
+
_el$14.$$dblclick = event => onRowDoubleClick(event, row());
|
|
494
|
+
_el$14.$$click = event => onRowClick(event, row());
|
|
473
495
|
_el$14.addEventListener("focus", () => {
|
|
474
496
|
const key = id();
|
|
475
497
|
if (key !== undefined) props.selection?.markFocused(key);
|
|
@@ -483,12 +505,12 @@ function DataTableRoot(props) {
|
|
|
483
505
|
return props.columns;
|
|
484
506
|
},
|
|
485
507
|
children: (col, index) => {
|
|
486
|
-
const value = () => valueOf(
|
|
508
|
+
const value = () => valueOf(content(), col);
|
|
487
509
|
return (() => {
|
|
488
510
|
var _el$25 = _$getNextElement(_tmpl$10),
|
|
489
511
|
_el$26 = _el$25.firstChild;
|
|
490
512
|
_el$25.addEventListener("mouseenter", () => setHoveredColumnIfEnabled(index()));
|
|
491
|
-
_$insert(_el$26, () => cellContent(
|
|
513
|
+
_$insert(_el$26, () => cellContent(content(), col, value()));
|
|
492
514
|
_$effect(_p$ => {
|
|
493
515
|
var _v$16 = `${col.cellClass ?? ""} ${col.class ?? ""}`,
|
|
494
516
|
_v$17 = nowrapAttr(col),
|
|
@@ -529,7 +551,7 @@ function DataTableRoot(props) {
|
|
|
529
551
|
var _el$15 = _$getNextElement(_tmpl$9),
|
|
530
552
|
_el$16 = _el$15.firstChild,
|
|
531
553
|
_el$17 = _el$16.firstChild;
|
|
532
|
-
_el$16.$$click = () => toggleDetails(row);
|
|
554
|
+
_el$16.$$click = () => toggleDetails(rowKey(row()));
|
|
533
555
|
_$setAttribute(_el$16, "aria-controls", detailsId);
|
|
534
556
|
_$effect(_p$ => {
|
|
535
557
|
var _v$5 = open(),
|
|
@@ -549,7 +571,7 @@ function DataTableRoot(props) {
|
|
|
549
571
|
}
|
|
550
572
|
}), _el$21, _co$4);
|
|
551
573
|
_$effect(_p$ => {
|
|
552
|
-
var _v$8 = `k2b-data-table__row ${rowClass(row)}`,
|
|
574
|
+
var _v$8 = `k2b-data-table__row ${rowClass(row())}`,
|
|
553
575
|
_v$9 = shouldHoverRows() ? "true" : undefined,
|
|
554
576
|
_v$0 = shouldHoverRows() && isInteractive() ? "true" : undefined,
|
|
555
577
|
_v$1 = isSelected() ? "true" : undefined,
|
|
@@ -596,7 +618,7 @@ function DataTableRoot(props) {
|
|
|
596
618
|
_el$28 = _el$27.firstChild,
|
|
597
619
|
_el$29 = _el$28.nextSibling;
|
|
598
620
|
_$insert(_el$28, () => detailLabel(col));
|
|
599
|
-
_$insert(_el$29, () => cellContent(
|
|
621
|
+
_$insert(_el$29, () => cellContent(content(), col, valueOf(content(), col)));
|
|
600
622
|
_$effect(() => _$setAttribute(_el$27, "data-priority", priorityAttr(col)));
|
|
601
623
|
return _el$27;
|
|
602
624
|
})()
|
|
@@ -615,6 +637,24 @@ function DataTableRoot(props) {
|
|
|
615
637
|
}
|
|
616
638
|
})];
|
|
617
639
|
};
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Rows keyed by `getRowId` where the table has it: a row whose id stays keeps its element, its focus and its open
|
|
643
|
+
* details when the rows arrive as new objects, and its cells follow the current object in place.
|
|
644
|
+
*/
|
|
645
|
+
const renderRows = rows => {
|
|
646
|
+
// Read the rows once per change: a caller may pass `rows={x().slice(…)}`, and every row reads the list.
|
|
647
|
+
const list = createMemo(rows);
|
|
648
|
+
return _$createComponent(For, {
|
|
649
|
+
get each() {
|
|
650
|
+
return list().map(rowKey);
|
|
651
|
+
},
|
|
652
|
+
children: (_, index) => {
|
|
653
|
+
const row = createMemo(previous => list()[index()] ?? previous, list()[index()]);
|
|
654
|
+
return renderRow(row, () => index() === list().length - 1);
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
};
|
|
618
658
|
onMount(() => {
|
|
619
659
|
// Measured once before the overlay hides it, so a table that overflows sideways keeps the height of its first frame.
|
|
620
660
|
if (scrollRef) setNativeLane(Math.max(0, scrollRef.offsetHeight - scrollRef.clientHeight));
|
|
@@ -882,12 +922,7 @@ function DataTableRoot(props) {
|
|
|
882
922
|
[_el$69, _co$11] = _$getNextMarker(_el$68.nextSibling),
|
|
883
923
|
_el$70 = _el$69.nextSibling,
|
|
884
924
|
[_el$71, _co$12] = _$getNextMarker(_el$70.nextSibling);
|
|
885
|
-
_$insert(_el$65,
|
|
886
|
-
get each() {
|
|
887
|
-
return props.rows;
|
|
888
|
-
},
|
|
889
|
-
children: (row, index) => renderRow(row, () => index() === props.rows.length - 1)
|
|
890
|
-
}), _el$69, _co$11);
|
|
925
|
+
_$insert(_el$65, () => renderRows(() => props.rows), _el$69, _co$11);
|
|
891
926
|
_$insert(_el$65, _$createComponent(Show, {
|
|
892
927
|
get when() {
|
|
893
928
|
return props.fillHeight;
|
|
@@ -904,36 +939,34 @@ function DataTableRoot(props) {
|
|
|
904
939
|
},
|
|
905
940
|
children: list => [_$createComponent(For, {
|
|
906
941
|
get each() {
|
|
907
|
-
return list();
|
|
942
|
+
return list().map(group => group.key);
|
|
908
943
|
},
|
|
909
|
-
children:
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
_el$
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
})
|
|
934
|
-
|
|
935
|
-
return _el$75;
|
|
936
|
-
})()
|
|
944
|
+
children: (_, groupIndex) => {
|
|
945
|
+
const group = createMemo(previous => list()[groupIndex()] ?? previous, list()[groupIndex()]);
|
|
946
|
+
return (() => {
|
|
947
|
+
var _el$75 = _$getNextElement(_tmpl$27),
|
|
948
|
+
_el$76 = _el$75.firstChild,
|
|
949
|
+
_el$77 = _el$76.firstChild,
|
|
950
|
+
_el$84 = _el$77.firstChild,
|
|
951
|
+
[_el$85, _co$14] = _$getNextMarker(_el$84.nextSibling),
|
|
952
|
+
_el$78 = _el$85.nextSibling,
|
|
953
|
+
_el$79 = _el$78.firstChild,
|
|
954
|
+
_el$80 = _el$79.nextSibling,
|
|
955
|
+
_el$81 = _el$80.firstChild,
|
|
956
|
+
_el$82 = _el$81.nextSibling,
|
|
957
|
+
[_el$83, _co$13] = _$getNextMarker(_el$82.nextSibling),
|
|
958
|
+
_el$86 = _el$76.nextSibling,
|
|
959
|
+
[_el$87, _co$15] = _$getNextMarker(_el$86.nextSibling);
|
|
960
|
+
_$insert(_el$77, () => group().label || "—", _el$85, _co$14);
|
|
961
|
+
_$insert(_el$79, () => group().rows.length);
|
|
962
|
+
_$insert(_el$80, () => dataTableMessages().rowCount({
|
|
963
|
+
count: group().rows.length
|
|
964
|
+
}), _el$83, _co$13);
|
|
965
|
+
_$insert(_el$75, () => renderRows(() => group().rows), _el$87, _co$15);
|
|
966
|
+
_$effect(() => _$setAttribute(_el$77, "colspan", columnCount()));
|
|
967
|
+
return _el$75;
|
|
968
|
+
})();
|
|
969
|
+
}
|
|
937
970
|
}), _$createComponent(Show, {
|
|
938
971
|
get when() {
|
|
939
972
|
return props.fillHeight;
|