@urbicon-ui/blocks 6.35.0 → 6.37.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/components/Chat/Chat/Chat.svelte +53 -0
- package/dist/components/Chat/Chat/Chat.svelte.d.ts +4 -0
- package/dist/components/Chat/Chat/chat.variants.d.ts +20 -0
- package/dist/components/Chat/Chat/chat.variants.js +15 -0
- package/dist/components/Chat/Chat/index.d.ts +47 -0
- package/dist/components/Chat/Chat/index.js +2 -0
- package/dist/components/Chat/ChatMessage/ChatMessage.svelte +342 -0
- package/dist/components/Chat/ChatMessage/ChatMessage.svelte.d.ts +4 -0
- package/dist/components/Chat/ChatMessage/chat-message.variants.d.ts +138 -0
- package/dist/components/Chat/ChatMessage/chat-message.variants.js +118 -0
- package/dist/components/Chat/ChatMessage/index.d.ts +102 -0
- package/dist/components/Chat/ChatMessage/index.js +2 -0
- package/dist/components/Chat/ChatMessageList/ChatMessageList.svelte +301 -0
- package/dist/components/Chat/ChatMessageList/ChatMessageList.svelte.d.ts +6 -0
- package/dist/components/Chat/ChatMessageList/chat-message-list.variants.d.ts +23 -0
- package/dist/components/Chat/ChatMessageList/chat-message-list.variants.js +32 -0
- package/dist/components/Chat/ChatMessageList/chat-scroll.d.ts +45 -0
- package/dist/components/Chat/ChatMessageList/chat-scroll.js +52 -0
- package/dist/components/Chat/ChatMessageList/index.d.ts +93 -0
- package/dist/components/Chat/ChatMessageList/index.js +3 -0
- package/dist/components/Chat/CitationChip/CitationChip.svelte +107 -0
- package/dist/components/Chat/CitationChip/CitationChip.svelte.d.ts +4 -0
- package/dist/components/Chat/CitationChip/citation-chip.variants.d.ts +40 -0
- package/dist/components/Chat/CitationChip/citation-chip.variants.js +42 -0
- package/dist/components/Chat/CitationChip/index.d.ts +69 -0
- package/dist/components/Chat/CitationChip/index.js +2 -0
- package/dist/components/Chat/CodeBlock/CodeBlock.svelte +120 -0
- package/dist/components/Chat/CodeBlock/CodeBlock.svelte.d.ts +4 -0
- package/dist/components/Chat/CodeBlock/code-block.variants.d.ts +40 -0
- package/dist/components/Chat/CodeBlock/code-block.variants.js +51 -0
- package/dist/components/Chat/CodeBlock/index.d.ts +55 -0
- package/dist/components/Chat/CodeBlock/index.js +2 -0
- package/dist/components/Chat/PromptInput/PromptInput.svelte +432 -0
- package/dist/components/Chat/PromptInput/PromptInput.svelte.d.ts +4 -0
- package/dist/components/Chat/PromptInput/index.d.ts +165 -0
- package/dist/components/Chat/PromptInput/index.js +2 -0
- package/dist/components/Chat/PromptInput/prompt-input.variants.d.ts +90 -0
- package/dist/components/Chat/PromptInput/prompt-input.variants.js +102 -0
- package/dist/components/Chat/ReasoningDisclosure/ReasoningDisclosure.svelte +107 -0
- package/dist/components/Chat/ReasoningDisclosure/ReasoningDisclosure.svelte.d.ts +4 -0
- package/dist/components/Chat/ReasoningDisclosure/index.d.ts +85 -0
- package/dist/components/Chat/ReasoningDisclosure/index.js +2 -0
- package/dist/components/Chat/ReasoningDisclosure/reasoning-disclosure.variants.d.ts +20 -0
- package/dist/components/Chat/ReasoningDisclosure/reasoning-disclosure.variants.js +31 -0
- package/dist/components/Chat/StreamingMarkdown/MdBlock.svelte +99 -0
- package/dist/components/Chat/StreamingMarkdown/MdBlock.svelte.d.ts +9 -0
- package/dist/components/Chat/StreamingMarkdown/MdInline.svelte +82 -0
- package/dist/components/Chat/StreamingMarkdown/MdInline.svelte.d.ts +9 -0
- package/dist/components/Chat/StreamingMarkdown/StreamingMarkdown.svelte +118 -0
- package/dist/components/Chat/StreamingMarkdown/StreamingMarkdown.svelte.d.ts +4 -0
- package/dist/components/Chat/StreamingMarkdown/index.d.ts +86 -0
- package/dist/components/Chat/StreamingMarkdown/index.js +2 -0
- package/dist/components/Chat/StreamingMarkdown/md-context.d.ts +58 -0
- package/dist/components/Chat/StreamingMarkdown/md-context.js +1 -0
- package/dist/components/Chat/StreamingMarkdown/streaming-markdown.variants.d.ts +145 -0
- package/dist/components/Chat/StreamingMarkdown/streaming-markdown.variants.js +73 -0
- package/dist/components/Chat/ToolCallCard/ToolCallCard.svelte +174 -0
- package/dist/components/Chat/ToolCallCard/ToolCallCard.svelte.d.ts +4 -0
- package/dist/components/Chat/ToolCallCard/index.d.ts +84 -0
- package/dist/components/Chat/ToolCallCard/index.js +2 -0
- package/dist/components/Chat/ToolCallCard/tool-call-card.variants.d.ts +38 -0
- package/dist/components/Chat/ToolCallCard/tool-call-card.variants.js +38 -0
- package/dist/components/Chat/chat.types.d.ts +82 -0
- package/dist/components/Chat/chat.types.js +7 -0
- package/dist/components/Chat/index.d.ts +22 -0
- package/dist/components/Chat/index.js +14 -0
- package/dist/components/Chat/markdown/blocks.d.ts +54 -0
- package/dist/components/Chat/markdown/blocks.js +462 -0
- package/dist/components/Chat/markdown/inline.d.ts +31 -0
- package/dist/components/Chat/markdown/inline.js +446 -0
- package/dist/components/Chat/markdown/repair.d.ts +23 -0
- package/dist/components/Chat/markdown/repair.js +337 -0
- package/dist/components/Chat/markdown/streaming-harness.d.ts +23 -0
- package/dist/components/Chat/markdown/streaming-harness.js +62 -0
- package/dist/components/Chat/markdown/types.d.ts +139 -0
- package/dist/components/Chat/markdown/types.js +13 -0
- package/dist/components/Chat/markdown/url-policy.d.ts +33 -0
- package/dist/components/Chat/markdown/url-policy.js +109 -0
- package/dist/components/FileUpload/FileUpload.svelte +35 -123
- package/dist/components/FileUpload/FileUpload.svelte.d.ts +1 -1
- package/dist/components/FileUpload/index.d.ts +2 -28
- package/dist/components/PinInput/PinInput.svelte +321 -0
- package/dist/components/PinInput/PinInput.svelte.d.ts +4 -0
- package/dist/components/PinInput/index.d.ts +98 -0
- package/dist/components/PinInput/index.js +2 -0
- package/dist/components/PinInput/pin-input.variants.d.ts +96 -0
- package/dist/components/PinInput/pin-input.variants.js +111 -0
- package/dist/components/QRCode/QRCode.svelte +107 -0
- package/dist/components/QRCode/QRCode.svelte.d.ts +4 -0
- package/dist/components/QRCode/index.d.ts +74 -0
- package/dist/components/QRCode/index.js +3 -0
- package/dist/components/QRCode/qr-code.variants.d.ts +25 -0
- package/dist/components/QRCode/qr-code.variants.js +24 -0
- package/dist/components/QRCode/qr-encode.d.ts +22 -0
- package/dist/components/QRCode/qr-encode.js +528 -0
- package/dist/components/TimeInput/TimeInput.svelte +521 -0
- package/dist/components/TimeInput/TimeInput.svelte.d.ts +4 -0
- package/dist/components/TimeInput/index.d.ts +93 -0
- package/dist/components/TimeInput/index.js +2 -0
- package/dist/components/TimeInput/time-input.variants.d.ts +131 -0
- package/dist/components/TimeInput/time-input.variants.js +120 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +4 -0
- package/dist/i18n/index.d.ts +18 -0
- package/dist/primitives/Collapsible/Collapsible.svelte +5 -0
- package/dist/primitives/SplitPane/SplitPane.svelte +293 -0
- package/dist/primitives/SplitPane/SplitPane.svelte.d.ts +4 -0
- package/dist/primitives/SplitPane/index.d.ts +88 -0
- package/dist/primitives/SplitPane/index.js +2 -0
- package/dist/primitives/SplitPane/split-pane.utils.d.ts +73 -0
- package/dist/primitives/SplitPane/split-pane.utils.js +94 -0
- package/dist/primitives/SplitPane/split-pane.variants.d.ts +40 -0
- package/dist/primitives/SplitPane/split-pane.variants.js +56 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +1 -0
- package/dist/translations/de.d.ts +6 -0
- package/dist/translations/de.js +6 -0
- package/dist/translations/en.d.ts +6 -0
- package/dist/translations/en.js +6 -0
- package/dist/utils/file-intake.d.ts +78 -0
- package/dist/utils/file-intake.js +144 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type SlotNames, type VariantProps } from '../../utils/variants.js';
|
|
2
|
+
export declare const timeInputVariants: ((props?: {
|
|
3
|
+
tier?: "commit" | "modify" | undefined;
|
|
4
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
6
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
readonly?: boolean | undefined;
|
|
9
|
+
messageType?: "error" | "helper" | undefined;
|
|
10
|
+
error?: boolean | undefined;
|
|
11
|
+
required?: boolean | undefined;
|
|
12
|
+
fullWidth?: boolean | undefined;
|
|
13
|
+
} | undefined) => {
|
|
14
|
+
wrapper: (props?: ({
|
|
15
|
+
tier?: "commit" | "modify" | undefined;
|
|
16
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
17
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
18
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
19
|
+
disabled?: boolean | undefined;
|
|
20
|
+
readonly?: boolean | undefined;
|
|
21
|
+
messageType?: "error" | "helper" | undefined;
|
|
22
|
+
error?: boolean | undefined;
|
|
23
|
+
required?: boolean | undefined;
|
|
24
|
+
fullWidth?: boolean | undefined;
|
|
25
|
+
} & {
|
|
26
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
27
|
+
}) | undefined) => string;
|
|
28
|
+
label: (props?: ({
|
|
29
|
+
tier?: "commit" | "modify" | undefined;
|
|
30
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
31
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
32
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
33
|
+
disabled?: boolean | undefined;
|
|
34
|
+
readonly?: boolean | undefined;
|
|
35
|
+
messageType?: "error" | "helper" | undefined;
|
|
36
|
+
error?: boolean | undefined;
|
|
37
|
+
required?: boolean | undefined;
|
|
38
|
+
fullWidth?: boolean | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
41
|
+
}) | undefined) => string;
|
|
42
|
+
field: (props?: ({
|
|
43
|
+
tier?: "commit" | "modify" | undefined;
|
|
44
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
45
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
46
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
47
|
+
disabled?: boolean | undefined;
|
|
48
|
+
readonly?: boolean | undefined;
|
|
49
|
+
messageType?: "error" | "helper" | undefined;
|
|
50
|
+
error?: boolean | undefined;
|
|
51
|
+
required?: boolean | undefined;
|
|
52
|
+
fullWidth?: boolean | undefined;
|
|
53
|
+
} & {
|
|
54
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
55
|
+
}) | undefined) => string;
|
|
56
|
+
icon: (props?: ({
|
|
57
|
+
tier?: "commit" | "modify" | undefined;
|
|
58
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
59
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
60
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
61
|
+
disabled?: boolean | undefined;
|
|
62
|
+
readonly?: boolean | undefined;
|
|
63
|
+
messageType?: "error" | "helper" | undefined;
|
|
64
|
+
error?: boolean | undefined;
|
|
65
|
+
required?: boolean | undefined;
|
|
66
|
+
fullWidth?: boolean | undefined;
|
|
67
|
+
} & {
|
|
68
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
69
|
+
}) | undefined) => string;
|
|
70
|
+
segment: (props?: ({
|
|
71
|
+
tier?: "commit" | "modify" | undefined;
|
|
72
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
73
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
74
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
75
|
+
disabled?: boolean | undefined;
|
|
76
|
+
readonly?: boolean | undefined;
|
|
77
|
+
messageType?: "error" | "helper" | undefined;
|
|
78
|
+
error?: boolean | undefined;
|
|
79
|
+
required?: boolean | undefined;
|
|
80
|
+
fullWidth?: boolean | undefined;
|
|
81
|
+
} & {
|
|
82
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
83
|
+
}) | undefined) => string;
|
|
84
|
+
separator: (props?: ({
|
|
85
|
+
tier?: "commit" | "modify" | undefined;
|
|
86
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
87
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
88
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
89
|
+
disabled?: boolean | undefined;
|
|
90
|
+
readonly?: boolean | undefined;
|
|
91
|
+
messageType?: "error" | "helper" | undefined;
|
|
92
|
+
error?: boolean | undefined;
|
|
93
|
+
required?: boolean | undefined;
|
|
94
|
+
fullWidth?: boolean | undefined;
|
|
95
|
+
} & {
|
|
96
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
97
|
+
}) | undefined) => string;
|
|
98
|
+
meridiem: (props?: ({
|
|
99
|
+
tier?: "commit" | "modify" | undefined;
|
|
100
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
101
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
102
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
103
|
+
disabled?: boolean | undefined;
|
|
104
|
+
readonly?: boolean | undefined;
|
|
105
|
+
messageType?: "error" | "helper" | undefined;
|
|
106
|
+
error?: boolean | undefined;
|
|
107
|
+
required?: boolean | undefined;
|
|
108
|
+
fullWidth?: boolean | undefined;
|
|
109
|
+
} & {
|
|
110
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
111
|
+
}) | undefined) => string;
|
|
112
|
+
message: (props?: ({
|
|
113
|
+
tier?: "commit" | "modify" | undefined;
|
|
114
|
+
variant?: "ghost" | "filled" | "outlined" | undefined;
|
|
115
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
116
|
+
intent?: "default" | "success" | "warning" | "danger" | undefined;
|
|
117
|
+
disabled?: boolean | undefined;
|
|
118
|
+
readonly?: boolean | undefined;
|
|
119
|
+
messageType?: "error" | "helper" | undefined;
|
|
120
|
+
error?: boolean | undefined;
|
|
121
|
+
required?: boolean | undefined;
|
|
122
|
+
fullWidth?: boolean | undefined;
|
|
123
|
+
} & {
|
|
124
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
125
|
+
}) | undefined) => string;
|
|
126
|
+
}) & {
|
|
127
|
+
readonly config: import("../../utils/variants.js").TVConfig;
|
|
128
|
+
};
|
|
129
|
+
export type TimeInputVariants = VariantProps<typeof timeInputVariants>;
|
|
130
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
131
|
+
export type TimeInputSlots = SlotNames<typeof timeInputVariants>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { tv } from '../../utils/variants.js';
|
|
2
|
+
export const timeInputVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
wrapper: ['flex flex-col gap-1.5 w-full'],
|
|
5
|
+
label: ['block font-medium text-text-secondary text-sm'],
|
|
6
|
+
// The bordered container reads as a single field; the segment inputs inside
|
|
7
|
+
// are borderless. The focus ring lives here via focus-within so tabbing
|
|
8
|
+
// between segments keeps the whole field lit.
|
|
9
|
+
field: [
|
|
10
|
+
'inline-flex items-center box-border w-fit',
|
|
11
|
+
'border text-text-primary bg-surface-base',
|
|
12
|
+
'transition-[color,background-color,border-color,box-shadow] duration-[var(--blocks-duration-fast)] ease-out',
|
|
13
|
+
'hover:border-border-default',
|
|
14
|
+
'focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20'
|
|
15
|
+
],
|
|
16
|
+
icon: ['pointer-events-none inline-flex items-center justify-center text-text-tertiary'],
|
|
17
|
+
segment: [
|
|
18
|
+
'bg-transparent text-center tabular-nums text-text-primary caret-transparent',
|
|
19
|
+
'border-0 outline-none p-0 rounded-sm',
|
|
20
|
+
'focus-visible:bg-primary-subtle',
|
|
21
|
+
'placeholder:text-text-quaternary',
|
|
22
|
+
'disabled:cursor-not-allowed'
|
|
23
|
+
],
|
|
24
|
+
separator: ['text-text-tertiary select-none'],
|
|
25
|
+
meridiem: [
|
|
26
|
+
'ml-1 font-medium text-text-secondary rounded-sm cursor-pointer select-none',
|
|
27
|
+
'hover:bg-surface-hover focus-visible:outline-none focus-visible:bg-primary-subtle',
|
|
28
|
+
'disabled:cursor-not-allowed disabled:opacity-50'
|
|
29
|
+
],
|
|
30
|
+
message: ['text-xs']
|
|
31
|
+
},
|
|
32
|
+
variants: {
|
|
33
|
+
// 3-tier semantic radius, default `modify` (soft field). Inherited from a
|
|
34
|
+
// wrapping <Toolbar tier="commit"> via TierContext.
|
|
35
|
+
tier: {
|
|
36
|
+
modify: { field: 'rounded-modify' },
|
|
37
|
+
commit: { field: 'rounded-commit' }
|
|
38
|
+
},
|
|
39
|
+
variant: {
|
|
40
|
+
outlined: { field: 'border-border-subtle' },
|
|
41
|
+
filled: {
|
|
42
|
+
field: 'bg-surface-interactive border-transparent hover:bg-surface-hover focus-within:bg-surface-base'
|
|
43
|
+
},
|
|
44
|
+
ghost: {
|
|
45
|
+
field: 'bg-transparent hover:bg-surface-subtle focus-within:bg-surface-base focus-within:border-border-subtle'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
sm: {
|
|
50
|
+
// `pointer-coarse:text-base` floors to 16px on touch to avoid iOS zoom.
|
|
51
|
+
field: 'h-8 px-2 gap-0.5 text-sm pointer-coarse:text-base',
|
|
52
|
+
segment: 'w-[2ch] text-sm pointer-coarse:text-base',
|
|
53
|
+
icon: 'mr-1.5 [&_svg]:w-3.5 [&_svg]:h-3.5',
|
|
54
|
+
meridiem: 'px-1 text-sm pointer-coarse:text-base'
|
|
55
|
+
},
|
|
56
|
+
md: {
|
|
57
|
+
field: 'h-10 px-3 gap-0.5 text-base',
|
|
58
|
+
segment: 'w-[2ch] text-base',
|
|
59
|
+
icon: 'mr-2 [&_svg]:w-4 [&_svg]:h-4',
|
|
60
|
+
meridiem: 'px-1 text-base'
|
|
61
|
+
},
|
|
62
|
+
lg: {
|
|
63
|
+
field: 'h-12 px-4 gap-1 text-lg',
|
|
64
|
+
segment: 'w-[2ch] text-lg',
|
|
65
|
+
icon: 'mr-2.5 [&_svg]:w-5 [&_svg]:h-5',
|
|
66
|
+
meridiem: 'px-1.5 text-lg'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
intent: {
|
|
70
|
+
default: {},
|
|
71
|
+
success: { field: 'border-success focus-within:border-success focus-within:ring-success/20' },
|
|
72
|
+
warning: { field: 'border-warning focus-within:border-warning focus-within:ring-warning/20' },
|
|
73
|
+
danger: { field: 'border-danger focus-within:border-danger focus-within:ring-danger/20' }
|
|
74
|
+
},
|
|
75
|
+
disabled: {
|
|
76
|
+
true: {
|
|
77
|
+
field: 'opacity-50 cursor-not-allowed bg-surface-disabled pointer-events-none',
|
|
78
|
+
label: 'text-text-disabled'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
readonly: {
|
|
82
|
+
true: { field: 'bg-surface-subtle' }
|
|
83
|
+
},
|
|
84
|
+
messageType: {
|
|
85
|
+
error: { message: 'text-danger' },
|
|
86
|
+
helper: { message: 'text-text-tertiary' }
|
|
87
|
+
},
|
|
88
|
+
error: {
|
|
89
|
+
true: {
|
|
90
|
+
field: 'border-danger focus-within:border-danger focus-within:ring-danger/20',
|
|
91
|
+
message: 'text-danger'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
required: {
|
|
95
|
+
true: { label: "after:content-['*'] after:ml-1 after:text-danger" }
|
|
96
|
+
},
|
|
97
|
+
fullWidth: {
|
|
98
|
+
true: { field: 'w-full justify-start' }
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
compoundVariants: [
|
|
102
|
+
{
|
|
103
|
+
variant: 'ghost',
|
|
104
|
+
error: false,
|
|
105
|
+
class: { field: 'border-transparent' }
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
defaultVariants: {
|
|
109
|
+
tier: 'modify',
|
|
110
|
+
variant: 'outlined',
|
|
111
|
+
size: 'md',
|
|
112
|
+
intent: 'default',
|
|
113
|
+
disabled: false,
|
|
114
|
+
readonly: false,
|
|
115
|
+
error: false,
|
|
116
|
+
required: false,
|
|
117
|
+
fullWidth: false,
|
|
118
|
+
messageType: 'helper'
|
|
119
|
+
}
|
|
120
|
+
});
|
|
@@ -6,6 +6,7 @@ export * from './BarChart/index.js';
|
|
|
6
6
|
export type { CalendarContext, CalendarEvent, CalendarEventCategory, CalendarHeaderProps, CalendarProps, CalendarSelection, CalendarSlotName, CalendarViewMode, DateRange, DayCellContext, EventItemContext, HeaderContext } from './Calendar/index.js';
|
|
7
7
|
export * from './Calendar/index.js';
|
|
8
8
|
export * from './ChartFrame/index.js';
|
|
9
|
+
export * from './Chat/index.js';
|
|
9
10
|
export * from './CommandPalette/index.js';
|
|
10
11
|
export type { CompositionBarIntent, CompositionBarProps, CompositionItem } from './CompositionBar/index.js';
|
|
11
12
|
export * from './CompositionBar/index.js';
|
|
@@ -20,10 +21,16 @@ export type { LocaleSwitcherProps } from './LocaleSwitcher/index.js';
|
|
|
20
21
|
export * from './LocaleSwitcher/index.js';
|
|
21
22
|
export type { NumberInputProps } from './NumberInput/index.js';
|
|
22
23
|
export * from './NumberInput/index.js';
|
|
24
|
+
export type { PinInputProps } from './PinInput/index.js';
|
|
25
|
+
export * from './PinInput/index.js';
|
|
23
26
|
export type { PlannerCellContext, PlannerDayContext, PlannerHeaderContext, PlannerProps, PlannerRange, PlannerSlotName, PlannerView } from './Planner/index.js';
|
|
24
27
|
export * from './Planner/index.js';
|
|
28
|
+
export type { QRCodeProps } from './QRCode/index.js';
|
|
29
|
+
export * from './QRCode/index.js';
|
|
25
30
|
export type { SankeyIntent, SankeyLaidOutLinkWithMeta, SankeyLaidOutNodeWithMeta, SankeyLink, SankeyNode, SankeyProps } from './Sankey/index.js';
|
|
26
31
|
export * from './Sankey/index.js';
|
|
27
32
|
export * from './SidebarLayout/index.js';
|
|
28
33
|
export * from './Sparkline/index.js';
|
|
29
34
|
export * from './ThemeSwitcher/index.js';
|
|
35
|
+
export type { TimeInputProps } from './TimeInput/index.js';
|
|
36
|
+
export * from './TimeInput/index.js';
|
package/dist/components/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './AreaChart/index.js';
|
|
|
5
5
|
export * from './BarChart/index.js';
|
|
6
6
|
export * from './Calendar/index.js';
|
|
7
7
|
export * from './ChartFrame/index.js';
|
|
8
|
+
export * from './Chat/index.js';
|
|
8
9
|
export * from './CommandPalette/index.js';
|
|
9
10
|
export * from './CompositionBar/index.js';
|
|
10
11
|
export * from './CurrencyInput/index.js';
|
|
@@ -16,8 +17,11 @@ export * from './Guide/index.js';
|
|
|
16
17
|
export * from './LineChart/index.js';
|
|
17
18
|
export * from './LocaleSwitcher/index.js';
|
|
18
19
|
export * from './NumberInput/index.js';
|
|
20
|
+
export * from './PinInput/index.js';
|
|
19
21
|
export * from './Planner/index.js';
|
|
22
|
+
export * from './QRCode/index.js';
|
|
20
23
|
export * from './Sankey/index.js';
|
|
21
24
|
export * from './SidebarLayout/index.js';
|
|
22
25
|
export * from './Sparkline/index.js';
|
|
23
26
|
export * from './ThemeSwitcher/index.js';
|
|
27
|
+
export * from './TimeInput/index.js';
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -68,8 +68,14 @@ export declare const blocksI18n: import("@urbicon-ui/i18n").PackageI18n<{
|
|
|
68
68
|
readonly maximum: "Maximum";
|
|
69
69
|
readonly minimum: "Minimum";
|
|
70
70
|
readonly pagination: "Page navigation";
|
|
71
|
+
readonly pinInputCell: "Character {{index}} of {{total}}";
|
|
71
72
|
readonly progress: "Progress";
|
|
73
|
+
readonly qrCode: "QR code";
|
|
72
74
|
readonly slider: "Slider";
|
|
75
|
+
readonly timeHours: "Hours";
|
|
76
|
+
readonly timeMinutes: "Minutes";
|
|
77
|
+
readonly timeSeconds: "Seconds";
|
|
78
|
+
readonly timeMeridiem: "AM or PM";
|
|
73
79
|
readonly toggle: "Toggle";
|
|
74
80
|
readonly toggleOptions: "Toggle options";
|
|
75
81
|
readonly removableBadge: "Removable badge";
|
|
@@ -271,8 +277,14 @@ export declare const useBlocksI18n: () => import("@urbicon-ui/i18n").TypedTransl
|
|
|
271
277
|
readonly maximum: "Maximum";
|
|
272
278
|
readonly minimum: "Minimum";
|
|
273
279
|
readonly pagination: "Page navigation";
|
|
280
|
+
readonly pinInputCell: "Character {{index}} of {{total}}";
|
|
274
281
|
readonly progress: "Progress";
|
|
282
|
+
readonly qrCode: "QR code";
|
|
275
283
|
readonly slider: "Slider";
|
|
284
|
+
readonly timeHours: "Hours";
|
|
285
|
+
readonly timeMinutes: "Minutes";
|
|
286
|
+
readonly timeSeconds: "Seconds";
|
|
287
|
+
readonly timeMeridiem: "AM or PM";
|
|
276
288
|
readonly toggle: "Toggle";
|
|
277
289
|
readonly toggleOptions: "Toggle options";
|
|
278
290
|
readonly removableBadge: "Removable badge";
|
|
@@ -483,8 +495,14 @@ declare const blocksTranslations: {
|
|
|
483
495
|
readonly maximum: "Maximum";
|
|
484
496
|
readonly minimum: "Minimum";
|
|
485
497
|
readonly pagination: "Page navigation";
|
|
498
|
+
readonly pinInputCell: "Character {{index}} of {{total}}";
|
|
486
499
|
readonly progress: "Progress";
|
|
500
|
+
readonly qrCode: "QR code";
|
|
487
501
|
readonly slider: "Slider";
|
|
502
|
+
readonly timeHours: "Hours";
|
|
503
|
+
readonly timeMinutes: "Minutes";
|
|
504
|
+
readonly timeSeconds: "Seconds";
|
|
505
|
+
readonly timeMeridiem: "AM or PM";
|
|
488
506
|
readonly toggle: "Toggle";
|
|
489
507
|
readonly toggleOptions: "Toggle options";
|
|
490
508
|
readonly removableBadge: "Removable badge";
|
|
@@ -109,10 +109,15 @@
|
|
|
109
109
|
</button>
|
|
110
110
|
{/if}
|
|
111
111
|
|
|
112
|
+
<!-- `inert` while collapsed (Popover's pattern): the clipped children stay
|
|
113
|
+
mounted for the grid-rows animation, so without it a keyboard user tabs
|
|
114
|
+
into invisible controls (e.g. a CodeBlock copy button inside a collapsed
|
|
115
|
+
ToolCallCard — WCAG 2.4.3/2.4.7) and the subtree stays in the a11y tree. -->
|
|
112
116
|
<div
|
|
113
117
|
id={contentId}
|
|
114
118
|
role="region"
|
|
115
119
|
aria-labelledby={triggerId}
|
|
120
|
+
inert={!isOpen}
|
|
116
121
|
class={unstyled
|
|
117
122
|
? (slotClasses?.content ?? '')
|
|
118
123
|
: styles.content({ class: slotClasses?.content })}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
import { mintRegistry } from '../../mint';
|
|
4
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
5
|
+
import type { SplitPaneProps } from './index';
|
|
6
|
+
import { clampRatio, parseLimit, ratioFromPointer, resolveDragRatio } from './split-pane.utils';
|
|
7
|
+
import { splitPaneVariants, type SplitPaneVariants } from './split-pane.variants';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
start,
|
|
11
|
+
end,
|
|
12
|
+
handle,
|
|
13
|
+
orientation = 'horizontal',
|
|
14
|
+
defaultRatio = 0.5,
|
|
15
|
+
ratio = $bindable(defaultRatio),
|
|
16
|
+
min = '10%',
|
|
17
|
+
max = '90%',
|
|
18
|
+
collapsible = false,
|
|
19
|
+
collapseThreshold = 48,
|
|
20
|
+
disabled = false,
|
|
21
|
+
onRatioChange,
|
|
22
|
+
onCollapsedChange,
|
|
23
|
+
handleLabel = 'Resize panes',
|
|
24
|
+
mint = 'none',
|
|
25
|
+
class: className = '',
|
|
26
|
+
unstyled: unstyledProp = false,
|
|
27
|
+
slotClasses: slotClassesProp = {},
|
|
28
|
+
preset,
|
|
29
|
+
...restProps
|
|
30
|
+
}: SplitPaneProps = $props();
|
|
31
|
+
|
|
32
|
+
const blocksConfig = getBlocksConfig();
|
|
33
|
+
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
34
|
+
|
|
35
|
+
// aria-controls needs a stable id for the first pane. `$props.id()` must be a
|
|
36
|
+
// top-level initializer (compiler rule) — SplitPane has no `id` prop, so the
|
|
37
|
+
// single-step form is enough.
|
|
38
|
+
const propsId = $props.id();
|
|
39
|
+
const startPaneId = `splitpane-${propsId}-start`;
|
|
40
|
+
|
|
41
|
+
// Slider performs NO right-to-left inversion in its pointer/keyboard handling
|
|
42
|
+
// (physical coordinates, ArrowRight = increase). SplitPane mirrors that role
|
|
43
|
+
// model exactly, so `rtl` stays false here. The geometry util still accepts an
|
|
44
|
+
// `rtl` flag (and is unit-tested for it) so a future house-wide RTL pass has
|
|
45
|
+
// one seam to wire — see the primitive's open issues.
|
|
46
|
+
const rtl = false;
|
|
47
|
+
|
|
48
|
+
let rootRef = $state<HTMLDivElement>();
|
|
49
|
+
let handleRef = $state<HTMLDivElement>();
|
|
50
|
+
let dragging = $state(false);
|
|
51
|
+
// Collapsed is DERIVED from the bindable ratio, never tracked separately —
|
|
52
|
+
// an external `bind:ratio` write must move this flag too, or the Enter
|
|
53
|
+
// toggle acts on stale state (review finding, P1 wave).
|
|
54
|
+
const collapsed = $derived(collapsible && ratio <= 0);
|
|
55
|
+
// Remembers the ratio to restore when re-expanding via Enter. Seeded once
|
|
56
|
+
// from the initial defaultRatio — `untrack` marks the one-time snapshot so it
|
|
57
|
+
// does not read as a missed reactive dependency.
|
|
58
|
+
let lastExpandedRatio = $state(untrack(() => defaultRatio));
|
|
59
|
+
|
|
60
|
+
// Keep the restore target fresh from every expanded ratio (interactive or
|
|
61
|
+
// consumer-driven), and fire onCollapsedChange on actual transitions of the
|
|
62
|
+
// derived flag — regardless of which side caused them.
|
|
63
|
+
let lastCollapsed = untrack(() => collapsed);
|
|
64
|
+
$effect(() => {
|
|
65
|
+
if (ratio > 0) lastExpandedRatio = ratio;
|
|
66
|
+
});
|
|
67
|
+
$effect(() => {
|
|
68
|
+
if (collapsed !== lastCollapsed) {
|
|
69
|
+
lastCollapsed = collapsed;
|
|
70
|
+
onCollapsedChange?.(collapsed);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// Last measured container size on the active axis — feeds px-limit resolution
|
|
74
|
+
// and the aria-value* bounds. Kept fresh via a ResizeObserver (no-op in jsdom).
|
|
75
|
+
let measuredPx = $state(0);
|
|
76
|
+
|
|
77
|
+
$effect(() => {
|
|
78
|
+
const el = rootRef;
|
|
79
|
+
if (!el) return;
|
|
80
|
+
const measure = () => {
|
|
81
|
+
const rect = el.getBoundingClientRect();
|
|
82
|
+
measuredPx = orientation === 'horizontal' ? rect.width : rect.height;
|
|
83
|
+
};
|
|
84
|
+
measure();
|
|
85
|
+
if (typeof ResizeObserver === 'undefined') return;
|
|
86
|
+
const ro = new ResizeObserver(measure);
|
|
87
|
+
ro.observe(el);
|
|
88
|
+
return () => ro.disconnect();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// mint is wired on the interactive element — the divider — exactly as Slider
|
|
92
|
+
// applies it to its track ref.
|
|
93
|
+
$effect(() => {
|
|
94
|
+
if (handleRef && mint && mint !== 'none' && !disabled) {
|
|
95
|
+
return mintRegistry.apply(handleRef, mint);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
function containerSize(): number {
|
|
100
|
+
if (!rootRef) return measuredPx;
|
|
101
|
+
const rect = rootRef.getBoundingClientRect();
|
|
102
|
+
const px = orientation === 'horizontal' ? rect.width : rect.height;
|
|
103
|
+
if (px > 0) measuredPx = px;
|
|
104
|
+
return px > 0 ? px : measuredPx;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function emitRatio(next: number) {
|
|
108
|
+
if (next !== ratio) {
|
|
109
|
+
ratio = next;
|
|
110
|
+
onRatioChange?.(next);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ─── Pointer drag ────────────────────────────────────────────────────────
|
|
115
|
+
// setPointerCapture routes every subsequent pointer event to the divider, so
|
|
116
|
+
// move/up listeners live on the divider itself — no window listeners, nothing
|
|
117
|
+
// to leak. Cancel restores the resting state.
|
|
118
|
+
function onHandlePointerDown(event: PointerEvent) {
|
|
119
|
+
if (disabled) return;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
handleRef?.focus();
|
|
122
|
+
handleRef?.setPointerCapture?.(event.pointerId);
|
|
123
|
+
dragging = true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function onHandlePointerMove(event: PointerEvent) {
|
|
127
|
+
if (!dragging || disabled || !rootRef) return;
|
|
128
|
+
const rect = rootRef.getBoundingClientRect();
|
|
129
|
+
const px = orientation === 'horizontal' ? rect.width : rect.height;
|
|
130
|
+
if (px > 0) measuredPx = px;
|
|
131
|
+
const clientPos = orientation === 'horizontal' ? event.clientX : event.clientY;
|
|
132
|
+
const raw = ratioFromPointer(clientPos, rect, orientation, rtl);
|
|
133
|
+
const resolved = resolveDragRatio(
|
|
134
|
+
raw,
|
|
135
|
+
px,
|
|
136
|
+
{ min, max, collapsible, collapseThreshold },
|
|
137
|
+
collapsed
|
|
138
|
+
);
|
|
139
|
+
emitRatio(resolved.ratio);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function endDrag(event: PointerEvent) {
|
|
143
|
+
if (!dragging) return;
|
|
144
|
+
handleRef?.releasePointerCapture?.(event.pointerId);
|
|
145
|
+
dragging = false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function onHandleDblClick() {
|
|
149
|
+
if (disabled) return;
|
|
150
|
+
emitRatio(clampRatio(defaultRatio, min, max, containerSize()));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ─── Keyboard ────────────────────────────────────────────────────────────
|
|
154
|
+
// Arrow keys map to the layout axis (horizontal → Left/Right, vertical →
|
|
155
|
+
// Up/Down): the "increase" key grows the first pane. ±2% default, ±10% with
|
|
156
|
+
// Shift; Home/End jump to the min/max limits. Enter follows the APG window
|
|
157
|
+
// splitter: with `collapsible` it toggles collapse, otherwise it restores
|
|
158
|
+
// defaultRatio — which also gives keyboard users the reset that double-click
|
|
159
|
+
// provides for pointers.
|
|
160
|
+
function onHandleKeydown(event: KeyboardEvent) {
|
|
161
|
+
if (disabled) return;
|
|
162
|
+
|
|
163
|
+
const px = containerSize();
|
|
164
|
+
const stepAmount = event.shiftKey ? 0.1 : 0.02;
|
|
165
|
+
const incKey = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
|
166
|
+
const decKey = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
|
167
|
+
|
|
168
|
+
switch (event.key) {
|
|
169
|
+
case incKey: {
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
emitRatio(clampRatio(ratio + stepAmount, min, max, px));
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
case decKey: {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
emitRatio(clampRatio(ratio - stepAmount, min, max, px));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
case 'Home': {
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
emitRatio(parseLimit(min, px) ?? 0);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
case 'End': {
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
emitRatio(parseLimit(max, px) ?? 1);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
case 'Enter': {
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
if (!collapsible) {
|
|
192
|
+
emitRatio(clampRatio(defaultRatio, min, max, px));
|
|
193
|
+
} else if (collapsed) {
|
|
194
|
+
const restore = lastExpandedRatio > 0 ? lastExpandedRatio : defaultRatio;
|
|
195
|
+
emitRatio(clampRatio(restore, min, max, px));
|
|
196
|
+
} else {
|
|
197
|
+
emitRatio(0);
|
|
198
|
+
}
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
default:
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const separatorOrientation = $derived(orientation === 'horizontal' ? 'vertical' : 'horizontal');
|
|
207
|
+
|
|
208
|
+
// The DISPLAYED ratio is always clamped into [min, max] (collapse being the
|
|
209
|
+
// one legitimate exception), so an out-of-window initial/controlled value or
|
|
210
|
+
// a container resize can never render the pane — or report aria-valuenow —
|
|
211
|
+
// outside the configured bounds. The bound `ratio` itself is left untouched
|
|
212
|
+
// (no write-backs from render state).
|
|
213
|
+
const effectiveRatio = $derived.by(() => {
|
|
214
|
+
const bounded = Math.max(0, Math.min(1, ratio));
|
|
215
|
+
if (collapsed) return 0;
|
|
216
|
+
return clampRatio(bounded, min, max, measuredPx);
|
|
217
|
+
});
|
|
218
|
+
const startBasisPct = $derived(effectiveRatio * 100);
|
|
219
|
+
|
|
220
|
+
const valueNow = $derived(Math.round(effectiveRatio * 100));
|
|
221
|
+
// With `collapsible`, 0 is a legitimate value of the separator's range —
|
|
222
|
+
// otherwise a collapsed pane would report valuenow below valuemin.
|
|
223
|
+
const valueMin = $derived(collapsible ? 0 : Math.round((parseLimit(min, measuredPx) ?? 0) * 100));
|
|
224
|
+
const valueMax = $derived(Math.round((parseLimit(max, measuredPx) ?? 1) * 100));
|
|
225
|
+
|
|
226
|
+
const variantProps: SplitPaneVariants = $derived({
|
|
227
|
+
orientation,
|
|
228
|
+
dragging: dragging || undefined,
|
|
229
|
+
disabled: disabled || undefined
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const styles = $derived(splitPaneVariants(variantProps));
|
|
233
|
+
const slotClasses = $derived(
|
|
234
|
+
resolveSlotClasses(blocksConfig, 'SplitPane', preset, variantProps, slotClassesProp)
|
|
235
|
+
);
|
|
236
|
+
</script>
|
|
237
|
+
|
|
238
|
+
<div
|
|
239
|
+
{...restProps}
|
|
240
|
+
bind:this={rootRef}
|
|
241
|
+
class={unstyled
|
|
242
|
+
? [slotClasses?.root, className].filter(Boolean).join(' ')
|
|
243
|
+
: styles.root({ class: [slotClasses?.root, className] })}
|
|
244
|
+
data-orientation={orientation}
|
|
245
|
+
data-dragging={dragging || undefined}
|
|
246
|
+
data-collapsed={collapsed || undefined}
|
|
247
|
+
>
|
|
248
|
+
<div
|
|
249
|
+
id={startPaneId}
|
|
250
|
+
class={unstyled
|
|
251
|
+
? (slotClasses?.startPane ?? '')
|
|
252
|
+
: styles.startPane({ class: slotClasses?.startPane })}
|
|
253
|
+
style="flex: 0 0 {startBasisPct}%"
|
|
254
|
+
>
|
|
255
|
+
{@render start()}
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
<!-- The divider is the ARIA "window splitter": role="separator" made focusable
|
|
259
|
+
(tabindex) with aria-value* + keyboard resize. Svelte's a11y rules treat
|
|
260
|
+
any separator as non-interactive; this pattern is the sanctioned exception. -->
|
|
261
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex, a11y_no_noninteractive_element_interactions -->
|
|
262
|
+
<div
|
|
263
|
+
bind:this={handleRef}
|
|
264
|
+
role="separator"
|
|
265
|
+
tabindex={disabled ? -1 : 0}
|
|
266
|
+
aria-label={handleLabel}
|
|
267
|
+
aria-controls={startPaneId}
|
|
268
|
+
aria-orientation={separatorOrientation}
|
|
269
|
+
aria-valuenow={valueNow}
|
|
270
|
+
aria-valuemin={valueMin}
|
|
271
|
+
aria-valuemax={valueMax}
|
|
272
|
+
aria-disabled={disabled || undefined}
|
|
273
|
+
data-dragging={dragging || undefined}
|
|
274
|
+
class={unstyled ? (slotClasses?.handle ?? '') : styles.handle({ class: slotClasses?.handle })}
|
|
275
|
+
onpointerdown={onHandlePointerDown}
|
|
276
|
+
onpointermove={onHandlePointerMove}
|
|
277
|
+
onpointerup={endDrag}
|
|
278
|
+
onpointercancel={endDrag}
|
|
279
|
+
ondblclick={onHandleDblClick}
|
|
280
|
+
onkeydown={onHandleKeydown}
|
|
281
|
+
>
|
|
282
|
+
{@render handle?.()}
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<div
|
|
286
|
+
class={unstyled
|
|
287
|
+
? (slotClasses?.endPane ?? '')
|
|
288
|
+
: styles.endPane({ class: slotClasses?.endPane })}
|
|
289
|
+
style="flex: 1 1 0%"
|
|
290
|
+
>
|
|
291
|
+
{@render end()}
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|