@kerfjs/ui 5.0.0-beta.60 → 5.0.0-beta.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/ai/component-catalog.json +141 -24
- package/ai/component-composition-rules.json +8 -0
- package/ai/component-composition.d.ts +10 -0
- package/ai/component-composition.json +117 -8
- package/ai/component-composition.schema.json +21 -0
- package/ai/components/README.md +5 -4
- package/ai/components/chip.md +72 -0
- package/ai/components/grid.md +10 -7
- package/ai/components/list-item.md +10 -7
- package/ai/components/pane.md +3 -2
- package/ai/components/select.md +6 -2
- package/ai/components/tabs.md +8 -4
- package/ai/components/toolbar-text.md +2 -1
- package/ai/components/toolbar.md +3 -2
- package/ai/public-api-signatures-v1.md +116 -24
- package/ai/skill.md +24 -4
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/dist/app-tab.d.ts +12 -2
- package/dist/app-tab.js +1 -1
- package/dist/browser/chip.js +3 -0
- package/dist/catalog.js +8 -8
- package/dist/chip.d.ts +29 -0
- package/dist/chip.js +3 -0
- package/dist/chip.js.map +1 -0
- package/dist/{chunk-WPLIO5WJ.js → chunk-4MG3KXJM.js} +40 -5
- package/dist/chunk-4MG3KXJM.js.map +1 -0
- package/dist/{chunk-F7F7KRO2.js → chunk-4SQK27MR.js} +33 -18
- package/dist/chunk-4SQK27MR.js.map +1 -0
- package/dist/chunk-EAC4CDY7.js +57 -0
- package/dist/chunk-EAC4CDY7.js.map +1 -0
- package/dist/{chunk-T57AXDFM.js → chunk-ENGVYQPG.js} +4 -3
- package/dist/chunk-ENGVYQPG.js.map +1 -0
- package/dist/{chunk-5PESG2VP.js → chunk-KYDDCJXU.js} +4 -3
- package/dist/chunk-KYDDCJXU.js.map +1 -0
- package/dist/{chunk-MERWRTBG.js → chunk-N2DRU35S.js} +1 -1
- package/dist/chunk-N2DRU35S.js.map +1 -0
- package/dist/{chunk-EZVNC4J6.js → chunk-OD2VXAPL.js} +4 -1
- package/dist/chunk-OD2VXAPL.js.map +1 -0
- package/dist/{chunk-T66UNBXL.js → chunk-Q6YU3BT7.js} +11 -2
- package/dist/chunk-Q6YU3BT7.js.map +1 -0
- package/dist/{chunk-N3GKMPDW.js → chunk-RKTTF3L4.js} +3 -1
- package/dist/chunk-RKTTF3L4.js.map +1 -0
- package/dist/chunk-SWVW56CV.js +188 -0
- package/dist/chunk-SWVW56CV.js.map +1 -0
- package/dist/{chunk-46263QLK.js → chunk-UA6JW52D.js} +53 -7
- package/dist/chunk-UA6JW52D.js.map +1 -0
- package/dist/{chunk-AGXQQFKZ.js → chunk-UCKKT6KO.js} +13 -4
- package/dist/chunk-UCKKT6KO.js.map +1 -0
- package/dist/{chunk-3SXMEK3B.js → chunk-V3DX3K65.js} +1 -1
- package/dist/chunk-V3DX3K65.js.map +1 -0
- package/dist/{chunk-UWONG4QE.js → chunk-VCBTX62E.js} +11 -3
- package/dist/chunk-VCBTX62E.js.map +1 -0
- package/dist/{chunk-2OXQHM7I.js → chunk-X6ADHJNI.js} +45 -20
- package/dist/chunk-X6ADHJNI.js.map +1 -0
- package/dist/collapsible-panel.js +2 -2
- package/dist/grid.d.ts +13 -5
- package/dist/grid.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +17 -16
- package/dist/list-item.d.ts +11 -1
- package/dist/list-item.js +1 -1
- package/dist/nav-stack.d.ts +3 -1
- package/dist/nav-stack.js +1 -1
- package/dist/pane.d.ts +8 -3
- package/dist/pane.js +1 -1
- package/dist/popup-menu.d.ts +2 -2
- package/dist/popup-menu.js +1 -1
- package/dist/select-register.js +46 -0
- package/dist/select-register.js.map +1 -1
- package/dist/select.d.ts +16 -0
- package/dist/select.js +1 -1
- package/dist/split-view.d.ts +1 -1
- package/dist/split-view.js +1 -1
- package/dist/styles/app-tab.css +119 -0
- package/dist/styles/chip.css +118 -0
- package/dist/styles/grid.css +7 -0
- package/dist/styles/list-item.css +14 -9
- package/dist/styles/nav-stack.css +13 -0
- package/dist/styles/pane.css +33 -0
- package/dist/styles/popup-menu.css +2 -1
- package/dist/styles/resizable-region.css +9 -0
- package/dist/styles/segmented-control.css +2 -1
- package/dist/styles/select.css +45 -0
- package/dist/styles/split-view.css +6 -0
- package/dist/styles/styles.css +1 -0
- package/dist/styles/tab-bar.css +3 -0
- package/dist/styles/tab-scaffold.css +13 -0
- package/dist/styles/toolbar-text.css +15 -6
- package/dist/styles/toolbar.css +15 -5
- package/dist/styles/workbench.css +117 -93
- package/dist/tab-bar.d.ts +6 -2
- package/dist/tab-bar.js +1 -1
- package/dist/tab-scaffold.d.ts +3 -0
- package/dist/tab-scaffold.js +1 -0
- package/dist/tab-scaffold.js.map +1 -1
- package/dist/{token-search-field-CCke1yvQ.d.ts → token-search-field-DvgFLhLL.d.ts} +6 -2
- package/dist/token-search-field.d.ts +1 -1
- package/dist/token-search-model.d.ts +1 -1
- package/dist/token-search-model.js +1 -1
- package/dist/toolbar-text.d.ts +1 -1
- package/dist/toolbar-text.js +1 -1
- package/dist/toolbar.d.ts +2 -2
- package/dist/toolbar.js +1 -1
- package/dist/wire-catalog.js +1 -1
- package/dist/wire-tab-bars.js +1 -1
- package/dist/wire-token-search-fields.d.ts +1 -1
- package/dist/workbench.js +1 -1
- package/docs/accessibility.md +29 -3
- package/docs/collapsible-panel.md +4 -3
- package/docs/component-contract.md +5 -0
- package/docs/component-selection.md +92 -11
- package/docs/design/templates/segmented-control/equal-dark.svg +1 -1
- package/docs/design/templates/segmented-control/equal.svg +1 -1
- package/docs/design/templates/segmented-control/pill-small-dark.svg +1 -1
- package/docs/design/templates/segmented-control/pill-small.svg +1 -1
- package/docs/design/templates/segmented-control-dark.svg +1 -1
- package/docs/design/templates/segmented-control.svg +1 -1
- package/docs/layout.md +51 -9
- package/docs/nav-stack.md +5 -0
- package/docs/split-view.md +5 -0
- package/docs/sunken-panel.md +12 -0
- package/docs/tab-scaffold.md +5 -0
- package/docs/webawesome-theme.md +62 -0
- package/docs/workbench.md +22 -10
- package/llms.txt +40 -8
- package/package.json +7 -1
- package/dist/chunk-2OXQHM7I.js.map +0 -1
- package/dist/chunk-3SXMEK3B.js.map +0 -1
- package/dist/chunk-46263QLK.js.map +0 -1
- package/dist/chunk-5I7OHCIP.js +0 -96
- package/dist/chunk-5I7OHCIP.js.map +0 -1
- package/dist/chunk-5PESG2VP.js.map +0 -1
- package/dist/chunk-AGXQQFKZ.js.map +0 -1
- package/dist/chunk-EZVNC4J6.js.map +0 -1
- package/dist/chunk-F7F7KRO2.js.map +0 -1
- package/dist/chunk-MERWRTBG.js.map +0 -1
- package/dist/chunk-N3GKMPDW.js.map +0 -1
- package/dist/chunk-T57AXDFM.js.map +0 -1
- package/dist/chunk-T66UNBXL.js.map +0 -1
- package/dist/chunk-UWONG4QE.js.map +0 -1
- package/dist/chunk-WPLIO5WJ.js.map +0 -1
package/dist/app-tab.d.ts
CHANGED
|
@@ -9,15 +9,23 @@ type AppTabRootAttributes = Readonly<Record<`data-${string}`, string | undefined
|
|
|
9
9
|
'data-tab-dragging'?: never;
|
|
10
10
|
'data-tab-drop-position'?: never;
|
|
11
11
|
'data-attention'?: never;
|
|
12
|
+
'data-drop-target'?: never;
|
|
13
|
+
'data-name-overflow'?: never;
|
|
14
|
+
'data-pinned'?: never;
|
|
12
15
|
}>;
|
|
13
16
|
type AppTabPresentation = 'pill' | 'segmented' | 'icon-only';
|
|
14
17
|
type AppTabSize = 'default' | 'compact';
|
|
18
|
+
type AppTabNameOverflow = 'ellipsis' | 'visible';
|
|
15
19
|
interface AppTabProps {
|
|
16
20
|
id: string;
|
|
17
21
|
name: string;
|
|
18
22
|
selected?: boolean;
|
|
19
23
|
/** Emphasize the visible tab name with the attention color token. */
|
|
20
24
|
attention?: boolean;
|
|
25
|
+
/** Highlight this tab as the target of a drag over its content. */
|
|
26
|
+
dropTarget?: boolean;
|
|
27
|
+
/** Keep the leading tab visible within its TabBar tablist while peers scroll. */
|
|
28
|
+
pinned?: boolean;
|
|
21
29
|
closable?: boolean;
|
|
22
30
|
draggable?: boolean;
|
|
23
31
|
leading?: KerfUiContent;
|
|
@@ -28,6 +36,8 @@ interface AppTabProps {
|
|
|
28
36
|
size?: AppTabSize;
|
|
29
37
|
/** Maximum visible label width in CSS pixels before ellipsis. */
|
|
30
38
|
labelMaxWidth?: number;
|
|
39
|
+
/** Keep the full name visible for an inline loading treatment. */
|
|
40
|
+
nameOverflow?: AppTabNameOverflow;
|
|
31
41
|
/** Decorative dormant content for the close button. Must not contain interactive descendants. */
|
|
32
42
|
closeIcon?: SafeHtml;
|
|
33
43
|
selectAction?: string;
|
|
@@ -50,6 +60,6 @@ interface AppTabProps {
|
|
|
50
60
|
/** Native named-slot assignment when composed inside a web component. */
|
|
51
61
|
slot?: string;
|
|
52
62
|
}
|
|
53
|
-
declare function AppTab({ id, name, selected, attention, closable, draggable, leading, trailing, presentation, size, labelMaxWidth, closeIcon, selectAction, closeAction, className, placeholder, pending, rootAttributes, slot, }: AppTabProps): SafeHtml;
|
|
63
|
+
declare function AppTab({ id, name, selected, attention, dropTarget, pinned, closable, draggable, leading, trailing, presentation, size, labelMaxWidth, nameOverflow, closeIcon, selectAction, closeAction, className, placeholder, pending, rootAttributes, slot, }: AppTabProps): SafeHtml;
|
|
54
64
|
|
|
55
|
-
export { AppTab, type AppTabPresentation, type AppTabProps, type AppTabSize };
|
|
65
|
+
export { AppTab, type AppTabNameOverflow, type AppTabPresentation, type AppTabProps, type AppTabSize };
|
package/dist/app-tab.js
CHANGED
package/dist/catalog.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Workbench } from './chunk-
|
|
1
|
+
import { Workbench } from './chunk-X6ADHJNI.js';
|
|
2
2
|
|
|
3
|
-
import { PopupMenu } from './chunk-
|
|
3
|
+
import { PopupMenu } from './chunk-VCBTX62E.js';
|
|
4
4
|
|
|
5
5
|
import { Row } from './chunk-VZOFZPSO.js';
|
|
6
|
+
import { ListHeader } from './chunk-5Q3N6EV7.js';
|
|
7
|
+
import { Text } from './chunk-AUKT3KMG.js';
|
|
6
8
|
import { ListInsetText } from './chunk-DG6G5EPF.js';
|
|
7
|
-
import { ListItem } from './chunk-
|
|
9
|
+
import { ListItem } from './chunk-SWVW56CV.js';
|
|
8
10
|
import { List } from './chunk-NAPE7WUS.js';
|
|
9
11
|
|
|
10
|
-
import { ToolbarText } from './chunk-
|
|
12
|
+
import { ToolbarText } from './chunk-V3DX3K65.js';
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
|
|
14
|
-
import { ListHeader } from './chunk-5Q3N6EV7.js';
|
|
15
|
-
import { Text } from './chunk-AUKT3KMG.js';
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
import { ToolbarControlGroup, ToolbarActionLink } from './chunk-7JUBXOIV.js';
|
|
21
|
-
import { Toolbar } from './chunk-MERWRTBG.js';
|
|
22
20
|
|
|
21
|
+
import { ToolbarControlGroup, ToolbarActionLink } from './chunk-7JUBXOIV.js';
|
|
22
|
+
import { Toolbar } from './chunk-N2DRU35S.js';
|
|
23
23
|
import { LucideIcon } from './chunk-4R777DUZ.js';
|
|
24
24
|
import { filterDataAttributes } from './chunk-SRSJO5QE.js';
|
|
25
25
|
|
package/dist/chip.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SafeHtml } from 'kerfjs';
|
|
2
|
+
import { BadgeTone, BadgeAppearance, BadgeShape, BadgeSize } from './badge.js';
|
|
3
|
+
|
|
4
|
+
interface ChipCommonProps {
|
|
5
|
+
/** Visible, non-interactive chip content. */
|
|
6
|
+
children: SafeHtml | string | number;
|
|
7
|
+
tone?: BadgeTone;
|
|
8
|
+
appearance?: BadgeAppearance;
|
|
9
|
+
shape?: BadgeShape;
|
|
10
|
+
size?: BadgeSize;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Record identifier available to an application delegated action handler. */
|
|
13
|
+
itemId?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Native named-slot assignment when composed inside a web component. */
|
|
16
|
+
slot?: string;
|
|
17
|
+
}
|
|
18
|
+
/** A removable chip needs both a delegated action and a specific accessible name. */
|
|
19
|
+
type ChipProps = ChipCommonProps & ({
|
|
20
|
+
removeAction: string;
|
|
21
|
+
removeLabel: string;
|
|
22
|
+
} | {
|
|
23
|
+
removeAction?: never;
|
|
24
|
+
removeLabel?: never;
|
|
25
|
+
});
|
|
26
|
+
/** A short label with an optional native remove button. The application owns removal. */
|
|
27
|
+
declare function Chip({ children, tone, appearance, shape, size, disabled, itemId, className, slot, ...remove }: ChipProps): SafeHtml;
|
|
28
|
+
|
|
29
|
+
export { Chip, type ChipProps };
|
package/dist/chip.js
ADDED
package/dist/chip.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chip.js"}
|
|
@@ -22,6 +22,7 @@ function Select(props) {
|
|
|
22
22
|
presentation = "form",
|
|
23
23
|
size = "default",
|
|
24
24
|
triggerWidth,
|
|
25
|
+
caret = true,
|
|
25
26
|
focusRingOwner = "select",
|
|
26
27
|
labelMaxWidth,
|
|
27
28
|
slot
|
|
@@ -42,6 +43,7 @@ function Select(props) {
|
|
|
42
43
|
"data-presentation": presentation,
|
|
43
44
|
"data-size": size,
|
|
44
45
|
"data-trigger-width": triggerWidth,
|
|
46
|
+
"data-caret": caret ? void 0 : "false",
|
|
45
47
|
"data-selected-presentation": selectedPresentation,
|
|
46
48
|
"data-focus-ring-owner": focusRingOwner,
|
|
47
49
|
"aria-busy": "true",
|
|
@@ -66,8 +68,10 @@ function Select(props) {
|
|
|
66
68
|
}
|
|
67
69
|
);
|
|
68
70
|
}
|
|
69
|
-
const selected = multiple ? void 0 : choices.find((choice) => choice.value === values[0]);
|
|
70
|
-
const chosenCount = iconTrigger ? choices.filter(
|
|
71
|
+
const selected = multiple ? void 0 : choices.find((choice) => choice.value === values[0] && !choice.disabled);
|
|
72
|
+
const chosenCount = iconTrigger ? choices.filter(
|
|
73
|
+
(choice) => !choice.disabled && values.includes(choice.value)
|
|
74
|
+
).length : 0;
|
|
71
75
|
const icon = (choice, selectedIcon = false) => /* @__PURE__ */ jsx(
|
|
72
76
|
"span",
|
|
73
77
|
{
|
|
@@ -98,7 +102,9 @@ function Select(props) {
|
|
|
98
102
|
"wa-option",
|
|
99
103
|
{
|
|
100
104
|
value: choice.value,
|
|
101
|
-
selected: multiple && values.includes(choice.value),
|
|
105
|
+
selected: multiple && !choice.disabled && values.includes(choice.value),
|
|
106
|
+
disabled: choice.disabled,
|
|
107
|
+
title: choice.disabled ? choice.disabledReason : void 0,
|
|
102
108
|
children: [
|
|
103
109
|
choice.icon ? icon(choice) : null,
|
|
104
110
|
choice.label
|
|
@@ -123,6 +129,7 @@ function Select(props) {
|
|
|
123
129
|
"data-presentation": presentation,
|
|
124
130
|
"data-size": size,
|
|
125
131
|
"data-trigger-width": triggerWidth,
|
|
132
|
+
"data-caret": caret ? void 0 : "false",
|
|
126
133
|
"data-selected-presentation": selectedPresentation,
|
|
127
134
|
"data-focus-ring-owner": focusRingOwner,
|
|
128
135
|
name,
|
|
@@ -173,7 +180,35 @@ function Select(props) {
|
|
|
173
180
|
choices.filter((choice) => choice.group === group).map(option)
|
|
174
181
|
]
|
|
175
182
|
}
|
|
176
|
-
))
|
|
183
|
+
)),
|
|
184
|
+
props.multiple && (props.selectAllLabel || props.clearLabel) && /* @__PURE__ */ jsxs(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
class: "kui-select__actions",
|
|
188
|
+
role: "group",
|
|
189
|
+
"aria-label": label || ariaLabel,
|
|
190
|
+
children: [
|
|
191
|
+
props.selectAllLabel && /* @__PURE__ */ jsx(
|
|
192
|
+
"button",
|
|
193
|
+
{
|
|
194
|
+
class: "kui-select__action",
|
|
195
|
+
type: "button",
|
|
196
|
+
"data-select-action": "all",
|
|
197
|
+
children: props.selectAllLabel
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
props.clearLabel && /* @__PURE__ */ jsx(
|
|
201
|
+
"button",
|
|
202
|
+
{
|
|
203
|
+
class: "kui-select__action",
|
|
204
|
+
type: "button",
|
|
205
|
+
"data-select-action": "clear",
|
|
206
|
+
children: props.clearLabel
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
)
|
|
177
212
|
]
|
|
178
213
|
}
|
|
179
214
|
);
|
|
@@ -181,4 +216,4 @@ function Select(props) {
|
|
|
181
216
|
|
|
182
217
|
export { Select };
|
|
183
218
|
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
219
|
+
//# sourceMappingURL=chunk-4MG3KXJM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/select.tsx"],"names":[],"mappings":";;;;;;AAuIA,SAAS,aAAA,GAAgB;AACvB,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,OAAA,EAAQ,aAAA,EAAc,aAAA,EAAY,QACrC,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,0KAAA,EAA2K,CAAA,EACrL,CAAA;AAEJ;AAEO,SAAS,OAA6B,KAAA,EAA2B;AACtE,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA,GAAY,EAAA;AAAA,IACZ,eAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA,GAAW,KAAA;AAAA,IACX,OAAA,GAAU,KAAA;AAAA,IACV,WAAA,GAAc,KAAA;AAAA,IACd,YAAA,GAAe,MAAA;AAAA,IACf,IAAA,GAAO,SAAA;AAAA,IACP,YAAA;AAAA,IACA,KAAA,GAAQ,IAAA;AAAA,IACR,cAAA,GAAiB,QAAA;AAAA,IACjB,aAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,QAAA,GAAW,MAAM,QAAA,KAAa,IAAA;AACpC,EAAA,M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G,IAAA,EAAK,OAAA;AAAA,YACL,YAAA,EAAY,KAAA;AAAA,YAEZ,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,MAAA,EAAA,EAAK,KAAA,EAAM,yBAAA,EAA2B,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,cAC5C,OAAA,CAAQ,OAAO,CAAC,MAAA,KAAW,OAAO,KAAA,KAAU,KAAK,CAAA,CAAE,GAAA,CAAI,MAAM;AAAA;AAAA;AAAA,SAEjE,CAAA;AAAA,QACA,KAAA,CAAM,QAAA,KAAa,KAAA,CAAM,cAAA,IAAkB,MAAM,UAAA,CAAA,oBAChD,IAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAM,qBAAA;AAAA,YACN,IAAA,EAAK,OAAA;AAAA,YACL,cAAY,KAAA,IAAS,SAAA;AAAA,YAEpB,QAAA,EAAA;AAAA,cAAA,KAAA,CAAM,cAAA,oBACL,GAAA;AAAA,gBAAC,QAAA;AAAA,gBAAA;AAAA,kBACC,KAAA,EAAM,oBAAA;AAAA,kBACN,IAAA,EAAK,QAAA;AAAA,kBACL,oBAAA,EAAmB,KAAA;AAAA,kBAElB,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,eACT;AAAA,cAED,MAAM,UAAA,oBACL,GAAA;AAAA,gBAAC,QAAA;AAAA,gBAAA;AAAA,kBACC,KAAA,EAAM,oBAAA;AAAA,kBACN,IAAA,EAAK,QAAA;AAAA,kBACL,oBAAA,EAAmB,OAAA;AAAA,kBAElB,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA;AACT;AAAA;AAAA;AAEJ;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-4MG3KXJM.js","sourcesContent":["import type { SafeHtml } from 'kerfjs';\n\nimport { Badge } from './badge.js';\nimport { type CssForegroundColor, em } from './css-values.js';\nimport { LucideIcon, type LucideNode } from './lucide-icon.js';\nimport type { KerfUiContent } from './semantic-content.js';\nimport { Skeleton } from './skeleton.js';\n\nexport interface SelectChoice<Value extends string = string> {\n value: Value;\n label: string;\n icon?: LucideNode;\n iconName?: string;\n /**\n * Foreground color for the optional icon: a semantic foreground token such\n * as `uiColor('success-on-quiet')`, or an application-owned\n * `foregroundColorVar('--app-icon-color')`. Fill tokens such as\n * `uiColor('success-fill-quiet')` are pale background tints and do not\n * type-check.\n */\n color?: CssForegroundColor;\n group?: string;\n /** Keep an unavailable choice visible but prevent selection. */\n disabled?: boolean;\n /** Optional explanation exposed as the disabled option's native tooltip. */\n disabledReason?: string;\n /**\n * Draw a divider between this choice and the previous choice in the same\n * list. A group boundary is already a separator, so the first choice of a\n * group (or of the whole menu) never draws a second one.\n */\n separatorBefore?: boolean;\n}\n\ntype SelectAccessibleName =\n { label: string; ariaLabel?: string } | { label?: never; ariaLabel: string };\n\nexport type SelectPresentation = 'form' | 'toolbar-borderless' | 'navigation';\nexport type SelectSize = 'default' | 'compact';\nexport type SelectSelectedPresentation = 'label' | 'icon-only';\nexport type SelectFocusRingOwner = 'select' | 'group';\nexport type SelectTriggerWidth = 'fit-content' | 'max-content' | 'fill';\n\ninterface SelectBaseProps<Value extends string = string> {\n name: string;\n choices: readonly SelectChoice<Value>[];\n className?: string;\n /** Empty-value hint text shown in the closed control (the native select placeholder). */\n placeholderText?: string;\n /** Supporting text shown below the control and associated with its combobox. */\n hint?: string;\n disabled?: boolean;\n fitMenu?: boolean;\n /** Render as an unanimated loading skeleton: the label above a static, empty control box. */\n placeholder?: boolean;\n /** Form (default), borderless toolbar, or intrinsic navigation chrome. */\n presentation?: SelectPresentation;\n size?: SelectSize;\n /** Closed trigger width; omit to keep the presentation's default. */\n triggerWidth?: SelectTriggerWidth;\n /** Show the disclosure caret (default); omit it for a compact icon-only trigger. */\n caret?: boolean;\n /** Let an enclosing ToolbarControlGroup paint the composed focus ring. */\n focusRingOwner?: SelectFocusRingOwner;\n /** Maximum closed-control label width in CSS pixels before ellipsis. */\n labelMaxWidth?: number;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/** One chosen value (the default). */\nexport interface SelectSingleValueProps<Value extends string = string> {\n multiple?: false;\n value: NoInfer<Value>;\n renderSelected?: (choice: SelectChoice<Value>) => SafeHtml;\n /** Show only the selected choice icon while retaining the Select's accessible name. */\n selectedPresentation?: SelectSelectedPresentation;\n triggerIcon?: never;\n selectAllLabel?: never;\n clearLabel?: never;\n}\n\n/**\n * Any number of chosen values. The popup stays open while the person toggles\n * choices and closes on an outside click, Escape, or focus leaving; the closed\n * control summarizes the chosen labels in choice order.\n */\nexport interface SelectMultipleLabelProps<Value extends string = string> {\n multiple: true;\n value: readonly NoInfer<Value>[];\n renderSelected?: never;\n selectedPresentation?: 'label';\n triggerIcon?: never;\n /** Opt in to a footer action that selects every enabled choice. */\n selectAllLabel?: string;\n /** Opt in to a footer action that clears the current selection. */\n clearLabel?: string;\n}\n\n/**\n * A multiple Select drawn as an icon-only toolbar trigger, such as a\n * \"Filter by label\" funnel. No single choice is selected, so the trigger shows\n * a fixed `triggerIcon` naming the menu's purpose; while any choice is chosen\n * a count badge sits beside it, and the combobox's accessible name ends with\n * the chosen labels in choice order.\n */\nexport interface SelectMultipleIconProps<Value extends string = string> {\n multiple: true;\n value: readonly NoInfer<Value>[];\n renderSelected?: never;\n selectedPresentation: 'icon-only';\n /**\n * The trigger's fixed icon, typically a `LucideIcon` naming the menu's\n * purpose (a funnel for a filter), independent of the selection.\n */\n triggerIcon: KerfUiContent;\n /** Opt in to a footer action that selects every enabled choice. */\n selectAllLabel?: string;\n /** Opt in to a footer action that clears the current selection. */\n clearLabel?: string;\n}\n\nexport type SelectMultipleValueProps<Value extends string = string> =\n SelectMultipleLabelProps<Value> | SelectMultipleIconProps<Value>;\n\nexport type SelectProps<Value extends string = string> =\n SelectBaseProps<Value> &\n SelectAccessibleName &\n (SelectSingleValueProps<Value> | SelectMultipleValueProps<Value>);\n\n// The closed wa-select's disclosure glyph: Web Awesome's system `chevron-down`,\n// Font Awesome Free 7.0.0 by @fontawesome (https://fontawesome.com), licensed\n// CC BY 4.0 (https://fontawesome.com/license/free). The placeholder draws the\n// same path so the loading box matches the live control without registering\n// Web Awesome.\nfunction SelectChevron() {\n return (\n <svg viewBox=\"0 0 448 512\" aria-hidden=\"true\">\n <path d=\"M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"></path>\n </svg>\n );\n}\n\nexport function Select<Value extends string>(props: SelectProps<Value>) {\n const {\n name,\n label,\n ariaLabel,\n choices,\n className = '',\n placeholderText,\n hint,\n disabled = false,\n fitMenu = false,\n placeholder = false,\n presentation = 'form',\n size = 'default',\n triggerWidth,\n caret = true,\n focusRingOwner = 'select',\n labelMaxWidth,\n slot,\n } = props;\n const multiple = props.multiple === true;\n const values: readonly Value[] = props.multiple ? props.value : [props.value];\n const renderSelected = props.multiple ? undefined : props.renderSelected;\n const selectedPresentation: SelectSelectedPresentation =\n props.selectedPresentation ?? 'label';\n // A multiple icon-only trigger shows a fixed icon naming the menu's\n // purpose instead of a selected choice's icon.\n const iconTrigger =\n props.multiple && props.selectedPresentation === 'icon-only';\n const triggerIcon = iconTrigger ? props.triggerIcon : undefined;\n if (placeholder) {\n return (\n <div\n class={`kui-select kui-select--placeholder ${className}`.trim()}\n data-component=\"select\"\n data-placeholder=\"true\"\n data-presentation={presentation}\n data-size={size}\n data-trigger-width={triggerWidth}\n data-caret={caret ? undefined : 'false'}\n data-selected-presentation={selectedPresentation}\n data-focus-ring-owner={focusRingOwner}\n aria-busy=\"true\"\n style={\n labelMaxWidth === undefined\n ? undefined\n : `--kui-select-label-max-width:${labelMaxWidth}px`\n }\n slot={slot}\n >\n {label && <span class=\"kui-select__placeholder-label\">{label}</span>}\n <span\n class=\"kui-select__placeholder-box\"\n aria-label={ariaLabel}\n role=\"img\"\n >\n <Skeleton width={em(10)} />\n <span class=\"kui-select__placeholder-chevron\" aria-hidden=\"true\">\n <SelectChevron />\n </span>\n </span>\n {hint && <span class=\"kui-select__placeholder-hint\">{hint}</span>}\n </div>\n );\n }\n // A multiple Select summarizes its choices in the display text instead of\n // leading with one selected icon.\n const selected = multiple\n ? undefined\n : choices.find((choice) => choice.value === values[0] && !choice.disabled);\n const chosenCount = iconTrigger\n ? choices.filter(\n (choice) => !choice.disabled && values.includes(choice.value),\n ).length\n : 0;\n const icon = (choice: SelectChoice<Value>, selectedIcon = false) => (\n <span\n data-key={`${name}:${choice.value}:${selectedIcon ? 'selected' : 'option'}`}\n data-morph-skip\n slot=\"start\"\n class={`kui-select__icon${selectedIcon ? ' kui-select__icon--selected' : ''}`}\n style={choice.color ? `color:${choice.color}` : undefined}\n >\n {choice.icon ? (\n <LucideIcon\n icon={choice.icon}\n name={\n choice.iconName ?? choice.label.toLowerCase().replaceAll(' ', '-')\n }\n />\n ) : null}\n </span>\n );\n const option = (choice: SelectChoice<Value>, index: number) => (\n <>\n {/* Web Awesome sets the divider's role and aria-orientation on its\n host once, so a template that omits them would lose them to the\n next kerf re-render's morph for good. Render them explicitly, with\n the orientation it reflects (see the wa-select note below). */}\n {choice.separatorBefore && index > 0 && (\n <wa-divider\n orientation=\"horizontal\"\n role=\"separator\"\n aria-orientation=\"horizontal\"\n ></wa-divider>\n )}\n <wa-option\n value={choice.value}\n selected={multiple && !choice.disabled && values.includes(choice.value)}\n disabled={choice.disabled}\n title={choice.disabled ? choice.disabledReason : undefined}\n >\n {choice.icon ? icon(choice) : null}\n {choice.label}\n </wa-option>\n </>\n );\n const groups = [\n ...new Set(\n choices\n .map((choice) => choice.group)\n .filter((group): group is string => Boolean(group)),\n ),\n ];\n const ungrouped = choices.filter((choice) => !choice.group);\n // Web Awesome names its shadow combobox from the label, not the host's\n // aria-label. Keep ariaLabel-only names available without visible chrome.\n // A multiple Select's value is its selected options (the value attribute\n // holds only one string), kept in sync by @kerfjs/ui/select/register.\n // size/appearance/placement are Web Awesome's defaults, which it reflects\n // onto the host; rendering them keeps a re-render's morph from stripping\n // them and forcing a Lit update to put them back.\n return (\n <wa-select\n size=\"m\"\n appearance=\"outlined\"\n placement=\"bottom\"\n class={`kui-select${renderSelected ? ' kui-select--custom-selected' : ''}${fitMenu ? ' kui-select--fit-menu' : ''}${!label ? ' kui-select--label-hidden' : ''} ${className}`.trim()}\n data-component=\"select\"\n data-presentation={presentation}\n data-size={size}\n data-trigger-width={triggerWidth}\n data-caret={caret ? undefined : 'false'}\n data-selected-presentation={selectedPresentation}\n data-focus-ring-owner={focusRingOwner}\n name={name}\n label={label || ariaLabel}\n aria-label={ariaLabel}\n multiple={multiple}\n value={multiple ? undefined : values[0]}\n placeholder={placeholderText}\n hint={hint}\n disabled={disabled}\n style={\n labelMaxWidth === undefined\n ? undefined\n : `--kui-select-label-max-width:${labelMaxWidth}px`\n }\n slot={slot}\n >\n {iconTrigger && (\n <>\n {/* The accessible name ends with the chosen labels, which\n @kerfjs/ui/select/register writes into the summary. */}\n <span slot=\"label\" data-key={`${name}:trigger-label`}>\n {label || ariaLabel}\n <span class=\"kui-select__name-summary\" data-morph-skip></span>\n </span>\n <span\n data-key={`${name}:trigger-icon`}\n slot=\"start\"\n class=\"kui-select__icon kui-select__icon--selected kui-select__trigger-icon\"\n >\n {triggerIcon}\n </span>\n {chosenCount > 0 && (\n <Badge slot=\"end\" tone=\"brand\" size=\"compact\" ariaHidden>\n {chosenCount}\n </Badge>\n )}\n </>\n )}\n {selected &&\n (renderSelected ? (\n <span\n data-key={`${name}:${values[0]}:custom-selected`}\n slot=\"start\"\n class=\"kui-select__custom-selected\"\n >\n <span class=\"kui-select__custom-selected-content\">\n {renderSelected(selected)}\n </span>\n </span>\n ) : selected.icon ? (\n icon(selected, true)\n ) : null)}\n {ungrouped.map(option)}\n {groups.map((group, index) => (\n <div\n class={`kui-select__group${index > 0 || ungrouped.length > 0 ? ' kui-select__group--separated' : ''}`}\n role=\"group\"\n aria-label={group}\n >\n <span class=\"kui-select__group-title\">{group}</span>\n {choices.filter((choice) => choice.group === group).map(option)}\n </div>\n ))}\n {props.multiple && (props.selectAllLabel || props.clearLabel) && (\n <div\n class=\"kui-select__actions\"\n role=\"group\"\n aria-label={label || ariaLabel}\n >\n {props.selectAllLabel && (\n <button\n class=\"kui-select__action\"\n type=\"button\"\n data-select-action=\"all\"\n >\n {props.selectAllLabel}\n </button>\n )}\n {props.clearLabel && (\n <button\n class=\"kui-select__action\"\n type=\"button\"\n data-select-action=\"clear\"\n >\n {props.clearLabel}\n </button>\n )}\n </div>\n )}\n </wa-select>\n );\n}\n"]}
|
|
@@ -54,23 +54,27 @@ function createTokenSearchModel({
|
|
|
54
54
|
const suggestions = signal([]);
|
|
55
55
|
const result = signal(evaluate?.(state.value));
|
|
56
56
|
let activeStart;
|
|
57
|
+
let activeRule;
|
|
57
58
|
const refreshSuggestions = () => {
|
|
58
59
|
const match = activePattern?.exec(state.value.query);
|
|
59
60
|
const raw = match?.[1];
|
|
60
61
|
const separator = raw?.indexOf(":") ?? -1;
|
|
61
62
|
const rule = separator < 0 ? void 0 : byName.get(raw.slice(0, separator).toLowerCase());
|
|
63
|
+
activeRule = rule;
|
|
62
64
|
const input = separator < 0 ? "" : unquote(raw.slice(separator + 1));
|
|
63
65
|
activeStart = match && raw ? match.index + match[0].lastIndexOf(raw) : void 0;
|
|
64
|
-
suggestions.value = (rule?.suggest?.(input) ?? []).flatMap(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
suggestions.value = (rule?.suggest?.(input, state.value) ?? []).flatMap(
|
|
67
|
+
(candidate) => {
|
|
68
|
+
const value = typeof candidate === "string" ? candidate : candidate.value;
|
|
69
|
+
const token = resolve(`${rule.name}:${quote(value)}`, 0);
|
|
70
|
+
return token ? [
|
|
71
|
+
{
|
|
72
|
+
value: token.value,
|
|
73
|
+
label: typeof candidate === "string" ? token.label : candidate.label
|
|
74
|
+
}
|
|
75
|
+
] : [];
|
|
76
|
+
}
|
|
77
|
+
);
|
|
74
78
|
};
|
|
75
79
|
const publish = (next) => {
|
|
76
80
|
state.value = next;
|
|
@@ -78,7 +82,7 @@ function createTokenSearchModel({
|
|
|
78
82
|
refreshSuggestions();
|
|
79
83
|
};
|
|
80
84
|
refreshSuggestions();
|
|
81
|
-
const edit = (value,
|
|
85
|
+
const edit = (value, commit2 = false) => {
|
|
82
86
|
let query = "";
|
|
83
87
|
let cursor = 0;
|
|
84
88
|
const added = [];
|
|
@@ -87,7 +91,7 @@ function createTokenSearchModel({
|
|
|
87
91
|
const raw = match[1];
|
|
88
92
|
const start = match.index + match[0].lastIndexOf(raw);
|
|
89
93
|
const end = start + raw.length;
|
|
90
|
-
if (end === value.query.length && !
|
|
94
|
+
if (end === value.query.length && !commit2 && !/\s$/.test(value.query))
|
|
91
95
|
continue;
|
|
92
96
|
const token = resolve(raw, query.length + start - cursor);
|
|
93
97
|
if (!token) continue;
|
|
@@ -118,25 +122,36 @@ function createTokenSearchModel({
|
|
|
118
122
|
);
|
|
119
123
|
publish({ query, tokens });
|
|
120
124
|
};
|
|
121
|
-
const
|
|
122
|
-
if (!
|
|
123
|
-
return;
|
|
124
|
-
const token = resolve(value, activeStart);
|
|
125
|
-
if (!token) return;
|
|
125
|
+
const commitResolved = (token) => {
|
|
126
|
+
if (!token || activeStart === void 0) return;
|
|
126
127
|
const query = state.value.query.slice(0, activeStart);
|
|
127
128
|
publish({ query, tokens: [...state.value.tokens, token] });
|
|
128
129
|
};
|
|
130
|
+
const choose = (value) => {
|
|
131
|
+
if (activeStart === void 0 || !suggestions.value.some((suggestion) => suggestion.value === value))
|
|
132
|
+
return;
|
|
133
|
+
commitResolved(resolve(value, activeStart));
|
|
134
|
+
};
|
|
135
|
+
const commit = (value) => {
|
|
136
|
+
if (!activeRule || activeStart === void 0) return;
|
|
137
|
+
commitResolved(resolve(`${activeRule.name}:${quote(value)}`, activeStart));
|
|
138
|
+
};
|
|
129
139
|
return {
|
|
130
140
|
state,
|
|
131
141
|
editorRevision,
|
|
132
142
|
suggestions,
|
|
133
143
|
result,
|
|
134
144
|
edit,
|
|
145
|
+
replace(value) {
|
|
146
|
+
edit(value);
|
|
147
|
+
editorRevision.value++;
|
|
148
|
+
},
|
|
135
149
|
submit(value) {
|
|
136
150
|
edit(value, true);
|
|
137
151
|
onSubmit?.(state.value, result.value);
|
|
138
152
|
},
|
|
139
153
|
choose,
|
|
154
|
+
commit,
|
|
140
155
|
expandToken(value) {
|
|
141
156
|
const index = state.value.tokens.findIndex(
|
|
142
157
|
(token) => token.value === value
|
|
@@ -184,4 +199,4 @@ function createTokenSearchModel({
|
|
|
184
199
|
|
|
185
200
|
export { createTokenSearchModel };
|
|
186
201
|
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
202
|
+
//# sourceMappingURL=chunk-4SQK27MR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/token-search-model.ts"],"names":["commit"],"mappings":";;;AA+DA,IAAM,gBAAgB,CAAC,IAAA,KACrB,IAAA,CAAK,OAAA,CAAQ,uBAAuB,MAAM,CAAA;AAC5C,IAAM,QAAQ,CAAC,IAAA,KACb,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA,GACjB,CAAA,CAAA,EAAI,IAAA,CAAK,UAAA,CAAW,MAAM,MAAM,CAAA,CAAE,WAAW,GAAA,EAAK,KAAK,CAAC,CAAA,CAAA,CAAA,GACxD,IAAA;AACN,IAAM,UAAU,CAAC,IAAA,KACf,KAAK,UAAA,CAAW,GAAG,KAAK,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,GACrC,IAAA,CAAK,MAAM,CAAA,EAAG,EAAE,EAAE,OAAA,CAAQ,YAAA,EAAc,IAAI,CAAA,GAC5C,IAAA;AAGC,SAAS,sBAAA,CAAyC;AAAA,EACvD,QAAQ,EAAC;AAAA,EACT,UAAU,E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A;AAAA,QAC/B,CAAC,KAAA,KAAU,KAAA,CAAM,KAAA,KAAU;AAAA,OAC7B;AACA,MAAA,IAAI,QAAQ,CAAA,EAAG;AACf,MAAA,OAAA,CAAQ;AAAA,QACN,GAAG,KAAA,CAAM,KAAA;AAAA,QACT,MAAA,EAAQ,MAAM,KAAA,CAAM,MAAA,CAAO,OAAO,CAAC,CAAA,EAAG,EAAA,KAAO,EAAA,KAAO,KAAK;AAAA,OAC1D,CAAA;AAAA,IACH,CAAA;AAAA,IACA,KAAA,GAAQ;AACN,MAAA,OAAA,CAAQ,EAAE,KAAA,EAAO,EAAA,EAAI,MAAA,EAAQ,IAAI,CAAA;AACjC,MAAA,cAAA,CAAe,KAAA,EAAA;AAAA,IACjB,CAAA;AAAA,IACA,OAAA,GAAU;AACR,MAAA,WAAA,CAAY,QAAQ,EAAC;AAAA,IACvB;AAAA,GACF;AACF","file":"chunk-4SQK27MR.js","sourcesContent":["import { type Signal, signal } from 'kerfjs';\n\nimport type {\n TokenSearchFieldValue,\n TokenSearchToken,\n} from './token-search-field.js';\n\nexport interface TokenSearchRule {\n /** The word before `:` (for example `tag` or `status`). */\n name: string;\n /** Return a canonical value, or undefined to leave invalid input as text. */\n parse?: (input: string) => string | undefined;\n /** Label for a committed chip. Defaults to `name:input`. */\n label?: (value: string, input: string) => string;\n /** Suggestions for the unfinished value after `name:`, with current committed tokens. */\n suggest?: (\n input: string,\n state: TokenSearchState,\n ) => readonly (string | { value: string; label: string })[];\n}\n\nexport interface TokenSearchResolvedToken extends TokenSearchToken {\n kind: string;\n parsedValue: string;\n}\n\nexport interface TokenSearchState {\n query: string;\n tokens: TokenSearchResolvedToken[];\n}\n\nexport interface TokenSearchSuggestion {\n value: string;\n label: string;\n}\n\nexport interface TokenSearchModel<Result = unknown> {\n state: Signal<TokenSearchState>;\n /** Changes when a model action must replace DOM-owned editor text. */\n editorRevision: Signal<number>;\n suggestions: Signal<readonly TokenSearchSuggestion[]>;\n result: Signal<Result | undefined>;\n edit(value: TokenSearchFieldValue, commit?: boolean): void;\n /** Replace app-owned search state and rebuild the DOM-owned editor text. */\n replace(value: TokenSearchFieldValue): void;\n submit(value: TokenSearchFieldValue): void;\n choose(value: string): void;\n /** Commit a value for the active `name:` prefix, even when it is not suggested. */\n commit(value: string): void;\n expandToken(value: string): void;\n remove(value: string): void;\n clear(): void;\n dismiss(): void;\n}\n\nexport interface TokenSearchModelOptions<Result> {\n rules?: readonly TokenSearchRule[];\n initial?: TokenSearchFieldValue;\n /** Runs after every state change, including initial state. */\n evaluate?: (state: TokenSearchState) => Result;\n onSubmit?: (state: TokenSearchState, result: Result | undefined) => void;\n}\n\nconst escapePattern = (text: string) =>\n text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\nconst quote = (text: string) =>\n /[\\s()\"\\\\]/.test(text)\n ? `\"${text.replaceAll('\\\\', '\\\\\\\\').replaceAll('\"', '\\\\\"')}\"`\n : text;\nconst unquote = (text: string) =>\n text.startsWith('\"') && text.endsWith('\"')\n ? text.slice(1, -1).replace(/\\\\([\"\\\\])/g, '$1')\n : text;\n\n/** Opt-in state, token parsing, suggestions, and evaluation for TokenSearchField. */\nexport function createTokenSearchModel<Result = unknown>({\n rules = [],\n initial = { query: '', tokens: [] },\n evaluate,\n onSubmit,\n}: TokenSearchModelOptions<Result> = {}): TokenSearchModel<Result> {\n const byName = new Map(rules.map((rule) => [rule.name.toLowerCase(), rule]));\n if (\n byName.size !== rules.length ||\n rules.some((rule) => !/^[\\w-]+$/.test(rule.name))\n )\n throw new Error('Token search rule names must be unique words');\n const names = [...byName.keys()].map(escapePattern).join('|');\n const pattern = names\n ? new RegExp(\n `(?:^|[\\\\s(])((?:${names}):(?:\"(?:\\\\\\\\.|[^\"])*\"|[^\"\\\\s()][^\\\\s()]*))(?=$|[\\\\s)])`,\n 'gi',\n )\n : undefined;\n const activePattern = names\n ? new RegExp(\n `(?:^|[\\\\s(])((?:${names}):(?:\"(?:\\\\\\\\.|[^\"])*|[^\\\\s()]*))$`,\n 'i',\n )\n : undefined;\n\n const resolve = (\n raw: string,\n offset: number,\n ): TokenSearchResolvedToken | undefined => {\n const separator = raw.indexOf(':');\n const kind = raw.slice(0, separator).toLowerCase();\n const rule = byName.get(kind);\n if (!rule || separator < 0) return;\n const input = unquote(raw.slice(separator + 1));\n if (!input) return;\n const parsedValue = rule.parse ? rule.parse(input) : input;\n if (parsedValue === undefined) return;\n return {\n kind,\n parsedValue,\n value: `${kind}:${quote(input)}`,\n label: rule.label?.(parsedValue, input) ?? `${kind}:${input}`,\n offset,\n };\n };\n\n const rehydrate = (\n token: TokenSearchToken,\n ): TokenSearchResolvedToken | undefined => {\n const resolved = resolve(token.value, token.offset ?? 0);\n return resolved ? { ...resolved, ...token } : undefined;\n };\n\n const state = signal<TokenSearchState>({\n query: initial.query,\n tokens: initial.tokens.flatMap((token) => {\n const resolved = rehydrate(token);\n return resolved ? [resolved] : [];\n }),\n });\n const editorRevision = signal(0);\n const suggestions = signal<readonly TokenSearchSuggestion[]>([]);\n const result = signal<Result | undefined>(evaluate?.(state.value));\n let activeStart: number | undefined;\n let activeRule: TokenSearchRule | undefined;\n\n const refreshSuggestions = () => {\n const match = activePattern?.exec(state.value.query);\n const raw = match?.[1];\n const separator = raw?.indexOf(':') ?? -1;\n const rule =\n separator < 0\n ? undefined\n : byName.get(raw!.slice(0, separator).toLowerCase());\n activeRule = rule;\n const input = separator < 0 ? '' : unquote(raw!.slice(separator + 1));\n activeStart =\n match && raw ? match.index + match[0].lastIndexOf(raw) : undefined;\n suggestions.value = (rule?.suggest?.(input, state.value) ?? []).flatMap(\n (candidate) => {\n const value =\n typeof candidate === 'string' ? candidate : candidate.value;\n const token = resolve(`${rule!.name}:${quote(value)}`, 0);\n return token\n ? [\n {\n value: token.value,\n label:\n typeof candidate === 'string' ? token.label : candidate.label,\n },\n ]\n : [];\n },\n );\n };\n const publish = (next: TokenSearchState) => {\n state.value = next;\n result.value = evaluate?.(next);\n refreshSuggestions();\n };\n refreshSuggestions();\n\n const edit = (value: TokenSearchFieldValue, commit = false) => {\n let query = '';\n let cursor = 0;\n const added: TokenSearchResolvedToken[] = [];\n const removed: Array<{ start: number; end: number }> = [];\n for (const match of value.query.matchAll(pattern ?? /(?!) /g)) {\n const raw = match[1];\n const start = match.index + match[0].lastIndexOf(raw);\n const end = start + raw.length;\n if (end === value.query.length && !commit && !/\\s$/.test(value.query))\n continue;\n const token = resolve(raw, query.length + start - cursor);\n if (!token) continue;\n query += value.query.slice(cursor, start);\n token.offset = query.length;\n added.push(token);\n removed.push({ start, end });\n cursor = end;\n }\n const suffix = value.query.slice(cursor);\n query += added.length && /^\\s+$/.test(suffix) ? '' : suffix;\n const existing = value.tokens.flatMap((token) => {\n const resolved = rehydrate(token);\n if (!resolved) return [];\n const offset = token.offset ?? value.query.length;\n return [\n {\n ...resolved,\n offset:\n offset -\n removed.reduce(\n (total, range) =>\n total + Math.max(0, Math.min(offset, range.end) - range.start),\n 0,\n ),\n },\n ];\n });\n const tokens = [...existing, ...added].sort(\n (left, right) => (left.offset ?? 0) - (right.offset ?? 0),\n );\n publish({ query, tokens });\n };\n\n const commitResolved = (token: TokenSearchResolvedToken | undefined) => {\n if (!token || activeStart === undefined) return;\n const query = state.value.query.slice(0, activeStart);\n publish({ query, tokens: [...state.value.tokens, token] });\n };\n const choose = (value: string) => {\n if (\n activeStart === undefined ||\n !suggestions.value.some((suggestion) => suggestion.value === value)\n )\n return;\n commitResolved(resolve(value, activeStart));\n };\n const commit = (value: string) => {\n if (!activeRule || activeStart === undefined) return;\n commitResolved(resolve(`${activeRule.name}:${quote(value)}`, activeStart));\n };\n\n return {\n state,\n editorRevision,\n suggestions,\n result,\n edit,\n replace(value) {\n edit(value);\n editorRevision.value++;\n },\n submit(value) {\n edit(value, true);\n onSubmit?.(state.value, result.value);\n },\n choose,\n commit,\n expandToken(value) {\n const index = state.value.tokens.findIndex(\n (token) => token.value === value,\n );\n if (index < 0) return;\n const offset = Math.max(\n 0,\n Math.min(\n state.value.query.length,\n state.value.tokens[index].offset ?? state.value.query.length,\n ),\n );\n const insertion = `${value} `;\n publish({\n query: `${state.value.query.slice(0, offset)}${insertion}${state.value.query.slice(offset)}`,\n tokens: state.value.tokens.flatMap((token, at) =>\n at === index\n ? []\n : [\n {\n ...token,\n offset:\n (token.offset ?? 0) + (at > index ? insertion.length : 0),\n },\n ],\n ),\n });\n },\n remove(value) {\n const index = state.value.tokens.findIndex(\n (token) => token.value === value,\n );\n if (index < 0) return;\n publish({\n ...state.value,\n tokens: state.value.tokens.filter((_, at) => at !== index),\n });\n },\n clear() {\n publish({ query: '', tokens: [] });\n editorRevision.value++;\n },\n dismiss() {\n suggestions.value = [];\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'kerfjs/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
// src/chip.tsx
|
|
4
|
+
function Chip({
|
|
5
|
+
children,
|
|
6
|
+
tone = "neutral",
|
|
7
|
+
appearance = "quiet",
|
|
8
|
+
shape = "pill",
|
|
9
|
+
size = "default",
|
|
10
|
+
disabled = false,
|
|
11
|
+
itemId,
|
|
12
|
+
className = "",
|
|
13
|
+
slot,
|
|
14
|
+
...remove
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
class: `kui-chip ${className}`.trim(),
|
|
20
|
+
"data-component": "chip",
|
|
21
|
+
"data-tone": tone,
|
|
22
|
+
"data-appearance": appearance,
|
|
23
|
+
"data-shape": shape,
|
|
24
|
+
"data-size": size,
|
|
25
|
+
"data-disabled": disabled ? "" : void 0,
|
|
26
|
+
"data-item-id": itemId,
|
|
27
|
+
slot,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", { class: "kui-chip__label", children }),
|
|
30
|
+
remove.removeAction !== void 0 ? /* @__PURE__ */ jsx(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
class: "kui-chip__remove",
|
|
34
|
+
type: "button",
|
|
35
|
+
"data-action": remove.removeAction,
|
|
36
|
+
"aria-label": remove.removeLabel,
|
|
37
|
+
disabled,
|
|
38
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", width: "12", height: "12", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
39
|
+
"path",
|
|
40
|
+
{
|
|
41
|
+
d: "M3.5 3.5 12.5 12.5M12.5 3.5 3.5 12.5",
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
"stroke-width": "1.75",
|
|
45
|
+
"stroke-linecap": "round"
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
}
|
|
49
|
+
) : null
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { Chip };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=chunk-EAC4CDY7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chip.tsx"],"names":[],"mappings":";;;AAgCO,SAAS,IAAA,CAAK;AAAA,EACnB,QAAA;AAAA,EACA,IAAA,GAAO,SAAA;AAAA,EACP,UAAA,GAAa,OAAA;AAAA,EACb,KAAA,GAAQ,MAAA;AAAA,EACR,IAAA,GAAO,SAAA;AAAA,EACP,QAAA,GAAW,KAAA;AAAA,EACX,MAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,IAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAc;AACZ,EAAA,uBACE,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,CAAA,SAAA,EAAY,SAAS,CAAA,CAAA,CAAG,IAAA,EAAK;AAAA,MACpC,gBAAA,EAAe,MAAA;AAAA,MACf,WAAA,EAAW,IAAA;AAAA,MACX,iBAAA,EAAiB,UAAA;AAAA,MACjB,YAAA,EAAY,KAAA;AAAA,MACZ,WAAA,EAAW,IAAA;AAAA,MACX,eAAA,EAAe,WAAW,EAAA,GAAK,MAAA;AAAA,MAC/B,cAAA,EAAc,MAAA;AAAA,MACd,IAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,KAAA,EAAM,iBAAA,EAAmB,QAAA,EAAS,CAAA;AAAA,QACvC,MAAA,CAAO,iBAAiB,MAAA,mBACvB,GAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAM,kBAAA;AAAA,YACN,IAAA,EAAK,QAAA;AAAA,YACL,eAAa,MAAA,CAAO,YAAA;AAAA,YACpB,cAAY,MAAA,CAAO,WAAA;AAAA,YACnB,QAAA;AAAA,YAEA,QAAA,kBAAA,GAAA,CAAC,SAAI,OAAA,EAAQ,WAAA,EAAY,OAAM,IAAA,EAAK,MAAA,EAAO,IAAA,EAAK,aAAA,EAAY,MAAA,EAC1D,QAAA,kBAAA,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,CAAA,EAAE,sCAAA;AAAA,gBACF,IAAA,EAAK,MAAA;AAAA,gBACL,MAAA,EAAO,cAAA;AAAA,gBACP,cAAA,EAAa,MAAA;AAAA,gBACb,gBAAA,EAAe;AAAA;AAAA,aACjB,EACF;AAAA;AAAA,SACF,GACE;AAAA;AAAA;AAAA,GACN;AAEJ","file":"chunk-EAC4CDY7.js","sourcesContent":["import type { SafeHtml } from 'kerfjs';\n\nimport type {\n BadgeAppearance,\n BadgeShape,\n BadgeSize,\n BadgeTone,\n} from './badge.js';\n\ninterface ChipCommonProps {\n /** Visible, non-interactive chip content. */\n children: SafeHtml | string | number;\n tone?: BadgeTone;\n appearance?: BadgeAppearance;\n shape?: BadgeShape;\n size?: BadgeSize;\n disabled?: boolean;\n /** Record identifier available to an application delegated action handler. */\n itemId?: string;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/** A removable chip needs both a delegated action and a specific accessible name. */\nexport type ChipProps = ChipCommonProps &\n (\n | { removeAction: string; removeLabel: string }\n | { removeAction?: never; removeLabel?: never }\n );\n\n/** A short label with an optional native remove button. The application owns removal. */\nexport function Chip({\n children,\n tone = 'neutral',\n appearance = 'quiet',\n shape = 'pill',\n size = 'default',\n disabled = false,\n itemId,\n className = '',\n slot,\n ...remove\n}: ChipProps) {\n return (\n <span\n class={`kui-chip ${className}`.trim()}\n data-component=\"chip\"\n data-tone={tone}\n data-appearance={appearance}\n data-shape={shape}\n data-size={size}\n data-disabled={disabled ? '' : undefined}\n data-item-id={itemId}\n slot={slot}\n >\n <span class=\"kui-chip__label\">{children}</span>\n {remove.removeAction !== undefined ? (\n <button\n class=\"kui-chip__remove\"\n type=\"button\"\n data-action={remove.removeAction}\n aria-label={remove.removeLabel}\n disabled={disabled}\n >\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\">\n <path\n d=\"M3.5 3.5 12.5 12.5M12.5 3.5 3.5 12.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n />\n </svg>\n </button>\n ) : null}\n </span>\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Pane } from './chunk-OD2VXAPL.js';
|
|
1
2
|
import { isRelocatableGroup, ToolbarControlGroup } from './chunk-7JUBXOIV.js';
|
|
2
|
-
import { Toolbar } from './chunk-
|
|
3
|
-
import { Pane } from './chunk-EZVNC4J6.js';
|
|
3
|
+
import { Toolbar } from './chunk-N2DRU35S.js';
|
|
4
4
|
import { LucideIcon } from './chunk-4R777DUZ.js';
|
|
5
5
|
import { PanelLeftOpen, PanelLeftClose, PanelRightOpen, PanelRightClose, PanelBottomOpen, PanelBottomClose } from 'lucide';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'kerfjs/jsx-runtime';
|
|
@@ -67,6 +67,7 @@ function composedPanelBody({
|
|
|
67
67
|
separators: pane?.separators,
|
|
68
68
|
safeAreaEdges: pane?.safeAreaEdges,
|
|
69
69
|
chromeDividers: pane?.chromeDividers,
|
|
70
|
+
appearance: pane?.appearance,
|
|
70
71
|
children: content
|
|
71
72
|
}
|
|
72
73
|
);
|
|
@@ -92,4 +93,4 @@ function relocatedPanelGroups(toolbar, side, collapsed, attributes) {
|
|
|
92
93
|
|
|
93
94
|
export { collapsiblePanelToggleIcon, composedPanelBody, relocatedPanelGroups };
|
|
94
95
|
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
96
|
+
//# sourceMappingURL=chunk-ENGVYQPG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/panel-toolbar.tsx"],"names":[],"mappings":";;;;;;;AA2BO,SAAS,0BAAA,CACd,MACA,SAAA,EACkE;AAClE,EAAA,IAAI,IAAA,KAAS,MAAA;AACX,IAAA,OAAO,SAAA,GACH,EAAE,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,iBAAA,EAAkB,GAC/C,EAAE,IAAA,EAAM,cAAA,EAAgB,IAAA,EAAM,kBAAA,EAAmB;AACvD,EAAA,IAAI,IAAA,KAAS,OAAA;AACX,IAAA,OAAO,SAAA,GACH,EAAE,IAAA,EAAM,cAAA,EAAgB,IAAA,EAAM,kBAAA,EAAmB,GACjD,EAAE,IAAA,EAAM,eAAA,EAAiB,IAAA,EAAM,mBAAA,EAAoB;AACzD,EAAA,OAAO,SAAA,GACH,EAAE,IAAA,EAAM,eAAA,EAAiB,IAAA,EAAM,mBAAA,EAAoB,GACnD,EAAE,IAAA,EAAM,gBAAA,EAAkB,IAAA,EAAM,oBAAA,EAAqB;AAC3D;AAoDO,SAAS,gBAAA,CACd,IAAA,EACA,MAAA,EACA,SAAA,EACA,UAAA,EACU;AACV,EAAA,MAAM,KAAA,GAAQ,0BAAA,CAA2B,IAAA,EAAM,SAAS,CAAA;AACxD,EAAA,uBACE,GAAA,CAAC,uBAAoB,K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CAAQ,QAAQ,MAAM,CAAA;AACtB,EAAA,OAAA,CAAQ,QAAQ,QAAQ,CAAA;AACxB,EAAA,OAAO;AAAA,IACL,GAAG,MAAA;AAAA,IACH,OAAA,CAAQ,SACJ,gBAAA,CAAiB,IAAA,EAAM,QAAQ,MAAA,EAAQ,IAAA,EAAM,UAAU,CAAA,GACvD;AAAA,GACN,CAAE,OAAO,CAAC,KAAA,KAAU,UAAU,MAAA,IAAa,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,KAAK,CAAA;AAC9E","file":"chunk-ENGVYQPG.js","sourcesContent":["import type { SafeHtml } from 'kerfjs';\nimport {\n PanelBottomClose,\n PanelBottomOpen,\n PanelLeftClose,\n PanelLeftOpen,\n PanelRightClose,\n PanelRightOpen,\n} from 'lucide';\n\nimport { LucideIcon } from './lucide-icon.js';\nimport { Pane, type PaneConfig } from './pane.js';\nimport { isRelocatableGroup } from './panel-toolbar-group.js';\nimport type { KerfUiContent } from './semantic-content.js';\nimport { Toolbar, type ToolbarConfig } from './toolbar.js';\nimport { ToolbarControlGroup } from './toolbar-control-group.js';\n\n/** Which edge a collapsible panel docks to. */\nexport type PanelSide = 'left' | 'right' | 'bottom';\n\n/**\n * The standard collapse/expand icon for a panel `side` and `collapsed` state,\n * so every app's sidebars and drawers use one recognizable convention:\n * `PanelLeft*` for a left rail, `PanelRight*` for a right rail, `PanelBottom*`\n * for a bottom drawer — the `Close` glyph while open, the `Open` glyph while\n * collapsed. Exposed so an app can render its own toggle affordance.\n */\nexport function collapsiblePanelToggleIcon(\n side: PanelSide,\n collapsed: boolean,\n): { icon: Parameters<typeof LucideIcon>[0]['icon']; name: string } {\n if (side === 'left')\n return collapsed\n ? { icon: PanelLeftOpen, name: 'panel-left-open' }\n : { icon: PanelLeftClose, name: 'panel-left-close' };\n if (side === 'right')\n return collapsed\n ? { icon: PanelRightOpen, name: 'panel-right-open' }\n : { icon: PanelRightClose, name: 'panel-right-close' };\n return collapsed\n ? { icon: PanelBottomOpen, name: 'panel-bottom-open' }\n : { icon: PanelBottomClose, name: 'panel-bottom-close' };\n}\n\n/**\n * The standard collapse toggle a panel toolbar renders. The app handles the\n * button's `data-action` and flips its own `collapsed` flag.\n */\nexport interface PanelToggle {\n /** The `data-action` the toggle button carries. */\n action: string;\n /** The panel's short name, for the accessible \"Show …\" / \"Hide …\" label. */\n name: string;\n /** Accessible label while the panel is collapsed. Defaults to `Show {name}`. */\n showLabel?: string;\n /** Accessible label while the panel is open. Defaults to `Hide {name}`. */\n hideLabel?: string;\n}\n\n/**\n * A collapsible panel's top toolbar, composed so its groups follow the\n * panel's open state.\n *\n * - `title` precedes the `leading` zone. Groups may appear in any of the\n * `leading`, `center`, and `trailing` zones while the panel is open.\n * - Groups marked `relocateOnCollapse` move to the work area's toolbar while\n * the panel is collapsed, preserving their order across the three zones.\n * - `toggle` is always the last group: in the panel's toolbar while it is\n * open, and right after the relocated groups in the work area's toolbar\n * while it is collapsed.\n *\n * Relocated content renders in both places while the panel is collapsed (the\n * panel's copy is inert), so give it no `id`s. Pass groups directly or in\n * arrays so their render-time annotation remains available to the panel.\n *\n * The toolbar's configuration (`dividerSides`, `centerAlign`, `responsive`,\n * `responsiveAt`, `safeAreaEdges`) forwards to its `Toolbar`. It draws no\n * divider of its own: the panel's `Pane` draws the line under it while the\n * content is scrolled (its `chromeDividers`, wired by `wireScrollDividers`).\n */\nexport interface PanelToolbar extends ToolbarConfig {\n /** Accessible name of the panel's toolbar. */\n label: string;\n title?: KerfUiContent;\n leading?: KerfUiContent;\n center?: KerfUiContent;\n trailing?: KerfUiContent;\n toggle?: PanelToggle;\n}\n\n/** Owner-specific attributes a toggle button carries (its wiring hooks). */\nexport type PanelToggleAttributes = Readonly<Record<string, string>>;\n\n/** The standard toggle, alone in a borderless group. */\nexport function panelToggleGroup(\n side: PanelSide,\n toggle: PanelToggle,\n collapsed: boolean,\n attributes: PanelToggleAttributes,\n): SafeHtml {\n const glyph = collapsiblePanelToggleIcon(side, collapsed);\n return (\n <ToolbarControlGroup label={toggle.name} appearance=\"borderless\" single>\n <button\n type=\"button\"\n {...attributes}\n data-action={toggle.action}\n aria-expanded={String(!collapsed)}\n aria-label={\n collapsed\n ? (toggle.showLabel ?? `Show ${toggle.name}`)\n : (toggle.hideLabel ?? `Hide ${toggle.name}`)\n }\n >\n <LucideIcon icon={glyph.icon} name={glyph.name} />\n </button>\n </ToolbarControlGroup>\n );\n}\n\n/**\n * The panel's own toolbar: content keeps its chosen zones and the toggle trails.\n */\nexport function composedPanelToolbar(\n toolbar: PanelToolbar,\n side: PanelSide,\n collapsed: boolean,\n attributes: PanelToggleAttributes,\n): SafeHtml {\n return (\n <Toolbar\n label={toolbar.label}\n dividerSides={toolbar.dividerSides}\n centerAlign={toolbar.centerAlign}\n responsive={toolbar.responsive}\n responsiveAt={toolbar.responsiveAt}\n safeAreaEdges={toolbar.safeAreaEdges}\n center={toolbar.center}\n leading={\n <>\n {toolbar.title}\n {toolbar.leading}\n </>\n }\n trailing={\n <>\n {toolbar.trailing}\n {toolbar.toggle\n ? panelToggleGroup(side, toolbar.toggle, collapsed, attributes)\n : null}\n </>\n }\n />\n );\n}\n\n/**\n * A toolbar panel's body: its content in a `Pane` under its composed toolbar,\n * with its optional `footer` below. The panel's `pane` configuration forwards\n * to that `Pane`; an omitted or `undefined` field keeps the `Pane` default.\n */\nexport function composedPanelBody({\n toolbar,\n side,\n collapsed,\n attributes,\n pane,\n footer,\n content,\n}: {\n toolbar: PanelToolbar;\n side: PanelSide;\n collapsed: boolean;\n attributes: PanelToggleAttributes;\n pane: PaneConfig | undefined;\n footer: KerfUiContent;\n content: KerfUiContent;\n}): SafeHtml {\n return (\n <Pane\n header={composedPanelToolbar(toolbar, side, collapsed, attributes)}\n footer={footer}\n contentElement={pane?.contentElement}\n contentLabel={pane?.contentLabel}\n separators={pane?.separators}\n safeAreaEdges={pane?.safeAreaEdges}\n chromeDividers={pane?.chromeDividers}\n appearance={pane?.appearance}\n >\n {content}\n </Pane>\n );\n}\n\n/**\n * The groups a collapsed panel hands to the work area, in zone order, then its\n * toggle. Empty while the panel is open or has no toolbar.\n */\nexport function relocatedPanelGroups(\n toolbar: PanelToolbar | undefined,\n side: PanelSide,\n collapsed: boolean,\n attributes: PanelToggleAttributes,\n): KerfUiContent[] {\n if (!collapsed || !toolbar) return [];\n const groups: KerfUiContent[] = [];\n const collect = (content: KerfUiContent): void => {\n if (Array.isArray(content)) {\n for (const item of content) collect(item);\n } else if (isRelocatableGroup(content)) {\n groups.push(content);\n }\n };\n collect(toolbar.leading);\n collect(toolbar.center);\n collect(toolbar.trailing);\n return [\n ...groups,\n toolbar.toggle\n ? panelToggleGroup(side, toolbar.toggle, true, attributes)\n : null,\n ].filter((group) => group !== undefined && group !== null && group !== false);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ToolbarText } from './chunk-
|
|
1
|
+
import { ToolbarText } from './chunk-V3DX3K65.js';
|
|
2
2
|
import { ToolbarControlGroup } from './chunk-7JUBXOIV.js';
|
|
3
|
-
import { Toolbar } from './chunk-
|
|
3
|
+
import { Toolbar } from './chunk-N2DRU35S.js';
|
|
4
4
|
import { LucideIcon } from './chunk-4R777DUZ.js';
|
|
5
5
|
import { ChevronLeft } from 'lucide';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'kerfjs/jsx-runtime';
|
|
@@ -100,6 +100,7 @@ function NavStack({
|
|
|
100
100
|
"data-key": view.key,
|
|
101
101
|
"data-nav-key": view.key,
|
|
102
102
|
"data-nav-active": String(index === topIndex),
|
|
103
|
+
"data-appearance": view.appearance === "sunken" ? "sunken" : void 0,
|
|
103
104
|
"aria-hidden": String(index !== topIndex),
|
|
104
105
|
children: view.content
|
|
105
106
|
}
|
|
@@ -112,4 +113,4 @@ function NavStack({
|
|
|
112
113
|
|
|
113
114
|
export { NavStack };
|
|
114
115
|
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
116
|
+
//# sourceMappingURL=chunk-KYDDCJXU.js.map
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B,IAAA,EAAI;AAAA;AAAA;AACN,aAAA,EACF,CAAA;AAAA,YAEF,QAAQ,GAAA,EAAK,MAAA;AAAA,YACb,UAAU,GAAA,EAAK;AAAA;AAAA,SACjB,EACF,CAAA;AAAA,wBAEF,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,yBAAA,EAA0B,yBAAA,EAAuB,MACzD,QAAA,EAAA,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,EAAM,KAAA,qBAChB,GAAA;AAAA,UAAC,SAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAM,qBAAA;AAAA,YACN,YAAU,IAAA,CAAK,GAAA;AAAA,YACf,gBAAc,IAAA,CAAK,GAAA;AAAA,YACnB,iBAAA,EAAiB,MAAA,CAAO,KAAA,KAAU,QAAQ,CAAA;AAAA,YAC1C,iBAAA,EACE,IAAA,CAAK,UAAA,KAAe,QAAA,GAAW,QAAA,GAAW,MAAA;AAAA,YAE5C,aAAA,EAAa,MAAA,CAAO,KAAA,KAAU,QAAQ,CAAA;AAAA,YAErC,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA,SAET,CAAA,EACH,CAAA;AAAA,QAAA,CACE,GAAA,EAAK,aAAA,IAAiB,aAAA,qBACtB,GAAA,CAAC,QAAA,EAAA,EAAO,KAAA,EAAM,uBAAA,EAAwB,uBAAA,EAAqB,IAAA,EACxD,QAAA,EAAA,GAAA,EAAK,aAAA,IAAiB,aAAA,EACzB;AAAA;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-KYDDCJXU.js","sourcesContent":["import { ChevronLeft } from 'lucide';\n\nimport { LucideIcon } from './lucide-icon.js';\nimport type { PaneAppearance } from './pane.js';\nimport type { KerfUiContent } from './semantic-content.js';\nimport { Toolbar, type ToolbarConfig } from './toolbar.js';\nimport { ToolbarControlGroup } from './toolbar-control-group.js';\nimport {\n type HeadingLevel,\n ToolbarText,\n type ToolbarTextSize,\n} from './toolbar-text.js';\n\n/**\n * One entry in a {@link NavStack}. The app owns the stack as an array (usually a\n * signal); `NavStack` renders it and `wireNavStack` animates the transitions.\n */\nexport interface NavStackView {\n /** Stable identity for keyed reconcile and transition direction. */\n key: string;\n content: KerfUiContent;\n /** Background of this view's scrolling work surface. */\n appearance?: PaneAppearance;\n /** Title shown in the top toolbar for this view. */\n title?: string;\n /** Leading groups for this view's top toolbar, after the back control and before the title. */\n leading?: KerfUiContent;\n /** Center content for this view's top toolbar (placed per `toolbarConfig.centerAlign`). */\n center?: KerfUiContent;\n /** Trailing actions for this view's top toolbar. */\n toolbar?: KerfUiContent;\n /** Bottom toolbar for this view. Cross-fades with the top chrome on navigation. */\n bottomToolbar?: KerfUiContent;\n}\n\n/**\n * The top toolbar's configuration. Its `ToolbarConfig` forwards to the real\n * `Toolbar` the stack renders; by default that toolbar draws no divider and\n * claims the top and side safe-area edges the stack still touches.\n */\nexport interface NavStackToolbarConfig extends ToolbarConfig {\n /** Accessible name of the top toolbar (default: none). */\n label?: string;\n /** Size of the view title's `ToolbarText` (default `large`). */\n titleSize?: ToolbarTextSize;\n /** Expose the view title as a heading at this level (default: a plain span). */\n headingLevel?: HeadingLevel;\n}\n\nexport interface NavStackProps {\n id: string;\n /** Accessible name for the stack region. */\n label: string;\n /** The stack, root first; the last entry is the active top view. */\n views: NavStackView[];\n /** Accessible label for the icon-only back control (default \"Back\"). */\n backLabel?: string;\n /** The back control's icon (default a chevron-left `LucideIcon`). */\n backIcon?: KerfUiContent;\n /**\n * Visible text beside the back icon, such as the previous view's title\n * (default: icon only). When set, the text names the control and\n * `backLabel` is not used.\n */\n backText?: string;\n /** The top toolbar's configuration, forwarded to its `Toolbar`. */\n toolbarConfig?: NavStackToolbarConfig;\n /** Hide the top toolbar entirely (rare — a fully custom-chrome view). */\n hideToolbar?: boolean;\n /** Optional persistent bottom toolbar used when the active view does not provide one. */\n bottomToolbar?: KerfUiContent;\n /**\n * The line under the top chrome and over the bottom toolbar, where they\n * meet the active view. `scroll` (default) shows the chrome's line only\n * while the view's content is scrolled beneath it, and the bottom\n * toolbar's only while more content lies below — never when the content\n * fits — once `wireScrollDividers` (`@kerfjs/ui/wire-scroll-dividers`) is\n * wired above the stack; unwired, neither shows. `always` shows both\n * without the wiring; `none` neither, even when wired. The line is drawn\n * inside the chrome, so no state moves the chrome or the content. A\n * `toolbarConfig.dividerSides` edge is the Toolbar's own and is unaffected.\n */\n chromeDividers?: 'scroll' | 'always' | 'none';\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\nconst DEFAULT_SAFE_AREA_EDGES = [\n 'block-start',\n 'inline-start',\n 'inline-end',\n] as const;\n\n/**\n * A navigation stack (iOS-style push/pop). Renders every entry stacked, the last\n * one active; `@kerfjs/ui/wire-nav-stack`'s `wireNavStack` slides the content and\n * cross-fades the chrome across a change. Its top chrome is a real `Toolbar`: the\n * back control and title lead, the active view's `leading` / `center` / `toolbar`\n * content fills the zones, and `toolbarConfig` configures it. A single-pane\n * layout is a `NavStack` with one entry. See `docs/23-app-layouts.md` §3.1.\n */\nexport function NavStack({\n id,\n label,\n views,\n backLabel = 'Back',\n backIcon,\n backText,\n toolbarConfig = {},\n hideToolbar = false,\n bottomToolbar,\n chromeDividers = 'scroll',\n className = '',\n slot,\n}: NavStackProps) {\n const topIndex = views.length - 1;\n const top = views[topIndex];\n const canPop = views.length > 1;\n return (\n <section\n class={`kui-nav-stack ${className}`.trim()}\n id={id}\n data-component=\"nav-stack\"\n data-nav-stack-id={id}\n data-depth={String(views.length)}\n data-chrome-dividers={\n chromeDividers === 'always' || chromeDividers === 'none'\n ? chromeDividers\n : undefined\n }\n aria-label={label}\n slot={slot}\n >\n {!hideToolbar && (\n <div class=\"kui-nav-stack__chrome\" data-nav-stack-chrome>\n <Toolbar\n label={toolbarConfig.label}\n dividerSides={toolbarConfig.dividerSides}\n centerAlign={toolbarConfig.centerAlign}\n responsive={toolbarConfig.responsive}\n responsiveAt={toolbarConfig.responsiveAt}\n safeAreaEdges={\n toolbarConfig.safeAreaEdges ?? DEFAULT_SAFE_AREA_EDGES\n }\n leading={\n <>\n {canPop && (\n <ToolbarControlGroup\n appearance=\"borderless\"\n shape=\"rounded\"\n content={backText ? 'mixed' : 'icon'}\n single\n >\n <button\n type=\"button\"\n class=\"kui-nav-stack__back\"\n data-nav-back\n aria-label={backText ? undefined : backLabel}\n >\n {backIcon ?? (\n <LucideIcon\n icon={ChevronLeft}\n name=\"chevron-left\"\n className=\"kui-nav-stack__back-icon\"\n />\n )}\n {backText ? <span>{backText}</span> : null}\n </button>\n </ToolbarControlGroup>\n )}\n {top?.leading}\n <ToolbarText\n text={top?.title ?? ''}\n size={toolbarConfig.titleSize ?? 'large'}\n headingLevel={toolbarConfig.headingLevel}\n fill\n />\n </>\n }\n center={top?.center}\n trailing={top?.toolbar}\n />\n </div>\n )}\n <div class=\"kui-nav-stack__viewport\" data-nav-stack-viewport>\n {views.map((view, index) => (\n <article\n class=\"kui-nav-stack__view\"\n data-key={view.key}\n data-nav-key={view.key}\n data-nav-active={String(index === topIndex)}\n data-appearance={\n view.appearance === 'sunken' ? 'sunken' : undefined\n }\n aria-hidden={String(index !== topIndex)}\n >\n {view.content}\n </article>\n ))}\n </div>\n {(top?.bottomToolbar ?? bottomToolbar) && (\n <footer class=\"kui-nav-stack__bottom\" data-nav-stack-bottom>\n {top?.bottomToolbar ?? bottomToolbar}\n </footer>\n )}\n </section>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/toolbar.tsx"],"names":[],"mappings":";;;AAoEA,IAAM,KAAA,GAAQ,CACZ,KAAA,EACA,IAAA,KACI,OAAO,QAAA,CAAS,IAAI,IAAI,MAAA,GAAS,MAAA;AAEhC,SAAS,OAAA,CAAQ;AAAA,EACtB,OAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA,GAAe,EAAA;AAAA,EACf,WAAA,GAAc,QAAA;AAAA,EACd,UAAA,GAAa,MAAA;AAAA,EACb,YAAA,GAAe,QAAA;AAAA,EACf,aAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ;AACF,CAAA,EAAiB;AACf,EAAA,uBACE,IAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,CAAA,YAAA,EAAe,SAAS,CAAA,CAAA,CAAG,IAAA,EAAK;AAAA,MACvC,gBAAA,EAAe,SAAA;AAAA,MACf,iBAAe,YAAA,IAAgB,MAAA;AAAA,MAC/B,iBAAA,EAAiB,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAC,CAAA;AAAA,MACvC,mBAAA,EAAmB,WAAA;AAAA,MACnB,iBAAA,EAAiB,UAAA;AAAA,MACjB,oBAAA,EAAoB,YAAA;AAAA,MACpB,4BAAA,EAA4B,KAAA,CAAM,aAAA,EAAe,aAAa,CAAA;AAAA,MAC9D,0BAAA,EAA0B,KAAA,CAAM,aAAA,EAAe,WAAW,CAAA;AAAA,MAC1D,6BAAA,EAA6B,KAAA,CAAM,aAAA,EAAe,cAAc,CAAA;AAAA,MAChE,2BAAA,EAA2B,KAAA,CAAM,aAAA,EAAe,YAAY,CAAA;AAAA,MAC5D,YAAA,EAAY,KAAA;AAAA,MACZ,IAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,sBAAA,EAAwB,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,wBAC3C,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,qBAAA,EAAuB,QAAA,EAAA,MAAA,EAAO,CAAA;AAAA,wBACzC,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,uBAAA,EAAyB,QAAA,EAAA,QAAA,EAAS;AAAA;AAAA;AAAA,GAC/C;AAEJ","file":"chunk-N2DRU35S.js","sourcesContent":["import type { PaneSeparatorSide } from './pane.js';\nimport type { KerfUiContent } from './semantic-content.js';\nimport type { Sides } from './sides.js';\n\nexport interface ToolbarProps {\n leading?: KerfUiContent;\n center?: KerfUiContent;\n trailing?: KerfUiContent;\n label?: string;\n /**\n * Physical divider edges in canonical top/right/bottom/left order, drawn\n * always. Defaults to none: a toolbar pinned over or under scrolling content\n * gets its divider from the scroll state instead — a `Pane` draws the line\n * between its chrome and content while content is scrolled away beneath it,\n * and `wireScrollDividers` `targets` can name a toolbar as chrome, which\n * then draws its facing side the same way.\n */\n dividerSides?: Sides;\n /** `balanced` gives both side zones equal tracks, centering the middle zone on the toolbar even if only one side has controls. */\n centerAlign?: 'center' | 'stretch' | 'balanced';\n /**\n * Component-owned responsive layout; applications choose the policy rather\n * than restyling toolbar internals. Under every policy the trailing zone\n * wraps its groups instead of clipping an action, and the center zone keeps\n * its whole content width: when the zones do not fit one row, the leading\n * title truncates with an ellipsis rather than the center overlapping it.\n * - `none` keeps one row; the leading identity truncates first.\n * - `stack` stacks the zones at `responsiveAt`, wrapping stacked control\n * groups onto further rows.\n * - `wrap` keeps one row while every zone fits at its natural width, and\n * otherwise moves the trailing zone below a whole leading identity.\n * - `center-priority` gives an expanded center control the full row.\n * - `trailing-priority` moves an expanded trailing control to a full row\n * below the leading identity at `responsiveAt`.\n */\n responsive?:\n 'none' | 'stack' | 'wrap' | 'center-priority' | 'trailing-priority';\n /** Container width at which `stack` or `trailing-priority` activates. */\n responsiveAt?: 'compact' | 'narrow';\n /**\n * Screen edges this toolbar claims for device safe-area compensation, for an\n * app bar or bottom bar that sits directly at a screen edge rather than in a\n * Pane header or footer. Each listed side pads by the inset its surrounding\n * layout reports through `--kui-edge-inset-*`, or the full device inset when\n * nothing routes that edge, while the toolbar's box and dividers paint\n * through. Omitted, the toolbar pads only the inline edges an owner such as\n * a Pane header hands it, and never a block edge.\n */\n safeAreaEdges?: readonly PaneSeparatorSide[];\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/**\n * A toolbar's configuration, apart from its content: the props a composite\n * that renders a `Toolbar` for the app (a Workbench or CollapsiblePanel\n * toolbar) forwards, so the app configures that toolbar instead of styling it.\n */\nexport type ToolbarConfig = Pick<\n ToolbarProps,\n | 'dividerSides'\n | 'centerAlign'\n | 'responsive'\n | 'responsiveAt'\n | 'safeAreaEdges'\n>;\n\nconst claim = (\n edges: readonly PaneSeparatorSide[] | undefined,\n side: PaneSeparatorSide,\n) => (edges?.includes(side) ? 'true' : undefined);\n\nexport function Toolbar({\n leading,\n center,\n trailing,\n label,\n dividerSides = '',\n centerAlign = 'center',\n responsive = 'none',\n responsiveAt = 'narrow',\n safeAreaEdges,\n className = '',\n slot,\n}: ToolbarProps) {\n return (\n <header\n class={`kui-toolbar ${className}`.trim()}\n data-component=\"toolbar\"\n divider-sides={dividerSides || undefined}\n data-has-center={String(Boolean(center))}\n data-center-align={centerAlign}\n data-responsive={responsive}\n data-responsive-at={responsiveAt}\n data-safe-area-block-start={claim(safeAreaEdges, 'block-start')}\n data-safe-area-block-end={claim(safeAreaEdges, 'block-end')}\n data-safe-area-inline-start={claim(safeAreaEdges, 'inline-start')}\n data-safe-area-inline-end={claim(safeAreaEdges, 'inline-end')}\n aria-label={label}\n slot={slot}\n >\n <div class=\"kui-toolbar__leading\">{leading}</div>\n <div class=\"kui-toolbar__center\">{center}</div>\n <div class=\"kui-toolbar__trailing\">{trailing}</div>\n </header>\n );\n}\n\nexport type { Sides } from './sides.js';\n"]}
|