@kerfjs/ui 5.0.0-beta.136 → 5.0.0-beta.138
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/ai/component-catalog.json +14 -4
- package/ai/component-composition-rules.json +7 -0
- package/ai/component-composition.json +18 -0
- package/ai/component-composition.schema.json +4 -0
- package/ai/components/empty-state.md +1 -0
- package/ai/components/text.md +7 -4
- package/ai/public-api-signatures-v1.md +37 -10
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/analyzer/index.d.mts +15 -1
- package/analyzer/index.mjs +227 -23
- package/analyzer/report.schema.json +26 -1
- package/dist/catalog.js +2 -2
- package/dist/{chunk-OW2ODKHN.js → chunk-44C2K6V6.js} +33 -9
- package/dist/chunk-44C2K6V6.js.map +1 -0
- package/dist/{chunk-AUYGZ3UP.js → chunk-D4KXWVNG.js} +2 -2
- package/dist/{chunk-AUYGZ3UP.js.map → chunk-D4KXWVNG.js.map} +1 -1
- package/dist/{chunk-LK3QJHVX.js → chunk-GP3G3ZY3.js} +1 -1
- package/dist/chunk-GP3G3ZY3.js.map +1 -0
- package/dist/{chunk-QNA27ABY.js → chunk-TNHJMOWJ.js} +4 -2
- package/dist/chunk-TNHJMOWJ.js.map +1 -0
- package/dist/{chunk-LSFPZR52.js → chunk-WBNUX4LA.js} +2 -2
- package/dist/{chunk-LSFPZR52.js.map → chunk-WBNUX4LA.js.map} +1 -1
- package/dist/{chunk-XZ253TGP.js → chunk-XZWEKC5F.js} +27 -5
- package/dist/chunk-XZWEKC5F.js.map +1 -0
- package/dist/column-explorer.js +1 -1
- package/dist/empty-state.d.ts +3 -1
- package/dist/empty-state.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/list-header.js +1 -1
- package/dist/message-composer.js +1 -1
- package/dist/split-middle-BNI0Rni-.d.ts +9 -0
- package/dist/styles/components/feedback/empty-state/empty-state.css +7 -0
- package/dist/styles/components/navigation/tab-bar-item/tab-bar-item.css +31 -1
- package/dist/styles/components/typography/text/text.css +59 -0
- package/dist/styles/empty-state.css +7 -0
- package/dist/styles/tab-bar-item.css +31 -1
- package/dist/styles/text.css +59 -0
- package/dist/tab-bar-item.d.ts +9 -4
- package/dist/tab-bar-item.js +1 -1
- package/dist/text.d.ts +24 -4
- package/dist/text.js +1 -1
- package/docs/component-selection.md +8 -1
- package/docs/design/sketch/Kerf-UI.sketch +0 -0
- package/docs/design/sketch/README.md +12 -10
- package/docs/design/sketch/unified/README.md +22 -9
- package/docs/design/sketch/unified/pages/advanced.png +0 -0
- package/docs/design/sketch/unified/pages/content.png +0 -0
- package/docs/design/sketch/unified/pages/toolbar.png +0 -0
- package/docs/design/sketch/unified/variant-link-investigation.md +45 -0
- package/docs/layout.md +7 -0
- package/docs/ui-analyzer.md +21 -6
- package/doctor/eslint-diagnostics.d.mts +4 -0
- package/doctor/eslint-diagnostics.mjs +13 -0
- package/doctor/index.mjs +3 -2
- package/package.json +1 -1
- package/dist/chunk-LK3QJHVX.js.map +0 -1
- package/dist/chunk-OW2ODKHN.js.map +0 -1
- package/dist/chunk-QNA27ABY.js.map +0 -1
- package/dist/chunk-XZ253TGP.js.map +0 -1
- package/dist/split-middle-De745N2j.d.ts +0 -7
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
--kui-empty-state-foreground: var(--kui-color-neutral-on-quiet);
|
|
3
3
|
--kui-empty-state-title: var(--kui-color-text);
|
|
4
4
|
display: grid;
|
|
5
|
+
grid-template-columns: minmax(0, 1fr);
|
|
5
6
|
width: min(
|
|
6
7
|
calc(100% - (2 * var(--kui-layout-inline-margin, 0.5rem))),
|
|
7
8
|
28rem
|
|
@@ -45,3 +46,9 @@
|
|
|
45
46
|
.kui-empty-state__action {
|
|
46
47
|
margin-block-start: var(--kui-space-xs);
|
|
47
48
|
}
|
|
49
|
+
.kui-empty-state__secondary {
|
|
50
|
+
justify-self: stretch;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
margin-block-start: var(--kui-space-xs);
|
|
53
|
+
text-align: start;
|
|
54
|
+
}
|
|
@@ -183,12 +183,42 @@
|
|
|
183
183
|
}
|
|
184
184
|
.kui-tab-bar-item__name-head {
|
|
185
185
|
flex: 0 1 auto;
|
|
186
|
-
min-width:
|
|
186
|
+
min-width: 1em;
|
|
187
187
|
overflow: hidden;
|
|
188
188
|
text-overflow: ellipsis;
|
|
189
189
|
}
|
|
190
190
|
.kui-tab-bar-item__name-tail {
|
|
191
191
|
flex: 0 0 auto;
|
|
192
|
+
max-width: calc(100% - 1em);
|
|
193
|
+
overflow: hidden;
|
|
194
|
+
text-overflow: ellipsis;
|
|
195
|
+
}
|
|
196
|
+
.kui-tab-bar-item[data-name-truncate-priority="suffix"]
|
|
197
|
+
.kui-tab-bar-item__name-head {
|
|
198
|
+
position: relative;
|
|
199
|
+
min-width: 0;
|
|
200
|
+
}
|
|
201
|
+
.kui-tab-bar-item__name-head-sizer {
|
|
202
|
+
visibility: hidden;
|
|
203
|
+
}
|
|
204
|
+
.kui-tab-bar-item__name-head-clip {
|
|
205
|
+
position: absolute;
|
|
206
|
+
inset: 0;
|
|
207
|
+
overflow: hidden;
|
|
208
|
+
text-overflow: ellipsis;
|
|
209
|
+
white-space: pre;
|
|
210
|
+
container: kui-tab-name-head / inline-size;
|
|
211
|
+
}
|
|
212
|
+
@container kui-tab-name-head (max-width: 0.8em) {
|
|
213
|
+
.kui-tab-bar-item__name-head-content {
|
|
214
|
+
opacity: 0;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
.kui-tab-bar-item[data-name-truncate-priority="suffix"]
|
|
218
|
+
.kui-tab-bar-item__name-tail {
|
|
219
|
+
max-width: none;
|
|
220
|
+
overflow: visible;
|
|
221
|
+
text-overflow: clip;
|
|
192
222
|
}
|
|
193
223
|
/* A visible name keeps the tab at its full width with no label cap. A tab
|
|
194
224
|
wider than its whole strip (KF-0M3ZPT) is the exception: it takes the
|
package/dist/styles/text.css
CHANGED
|
@@ -7,6 +7,35 @@
|
|
|
7
7
|
overflow-wrap: normal;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/* Mark keeps native inline flow and inherits the surrounding font, so matches
|
|
11
|
+
in code occupy the same glyph cells as unmarked text. */
|
|
12
|
+
.kui-text__mark {
|
|
13
|
+
color: var(--kui-color-warning-on-fill);
|
|
14
|
+
background: var(--kui-color-warning-fill-quiet);
|
|
15
|
+
border-radius: 2px;
|
|
16
|
+
box-decoration-break: clone;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.kui-text__mark[data-current="true"] {
|
|
20
|
+
color: var(--kui-color-warning-on-loud);
|
|
21
|
+
background: var(--kui-color-warning-fill-loud);
|
|
22
|
+
outline: 1px solid var(--kui-color-warning-border-loud);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (forced-colors: active) {
|
|
26
|
+
.kui-text__mark {
|
|
27
|
+
color: CanvasText;
|
|
28
|
+
background: Canvas;
|
|
29
|
+
outline: 1px solid Highlight;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.kui-text__mark[data-current="true"] {
|
|
33
|
+
color: HighlightText;
|
|
34
|
+
background: Highlight;
|
|
35
|
+
outline-color: Highlight;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
10
39
|
/* Native heading and paragraph typography belongs to Text. Web Awesome's
|
|
11
40
|
native.css supplies these rules when installed, but Text also works without
|
|
12
41
|
that optional stylesheet. Size props below still override the tag defaults. */
|
|
@@ -113,6 +142,36 @@ span.kui-text[data-wrap="truncate"] {
|
|
|
113
142
|
text-overflow: ellipsis;
|
|
114
143
|
}
|
|
115
144
|
|
|
145
|
+
.kui-text[data-truncate-priority="suffix"] .kui-text__truncate-head {
|
|
146
|
+
position: relative;
|
|
147
|
+
min-width: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.kui-text__truncate-head-sizer {
|
|
151
|
+
visibility: hidden;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.kui-text__truncate-head-clip {
|
|
155
|
+
position: absolute;
|
|
156
|
+
inset: 0;
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
text-overflow: ellipsis;
|
|
159
|
+
white-space: pre;
|
|
160
|
+
container: kui-text-head / inline-size;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@container kui-text-head (max-width: 0.8em) {
|
|
164
|
+
.kui-text__truncate-head-content {
|
|
165
|
+
opacity: 0;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.kui-text[data-truncate-priority="suffix"] .kui-text__truncate-tail {
|
|
170
|
+
max-width: none;
|
|
171
|
+
overflow: visible;
|
|
172
|
+
text-overflow: clip;
|
|
173
|
+
}
|
|
174
|
+
|
|
116
175
|
.kui-text__truncate-tail {
|
|
117
176
|
flex: 0 0 auto;
|
|
118
177
|
max-width: calc(100% - 1em);
|
package/dist/tab-bar-item.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafeHtml } from 'kerfjs';
|
|
2
2
|
import { K as KerfUiContent } from './semantic-content-BbzjvSu9.js';
|
|
3
|
-
import { M as MiddleTruncateKeep } from './split-middle-
|
|
3
|
+
import { M as MiddleTruncateKeep, a as MiddleTruncatePriority } from './split-middle-BNI0Rni-.js';
|
|
4
4
|
|
|
5
5
|
type TabBarItemRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
6
6
|
'data-component'?: never;
|
|
@@ -13,6 +13,7 @@ type TabBarItemRootAttributes = Readonly<Record<`data-${string}`, string | undef
|
|
|
13
13
|
'data-drop-target'?: never;
|
|
14
14
|
'data-name-overflow'?: never;
|
|
15
15
|
'data-name-truncate'?: never;
|
|
16
|
+
'data-name-truncate-priority'?: never;
|
|
16
17
|
'data-disabled'?: never;
|
|
17
18
|
}>;
|
|
18
19
|
type TabBarItemPresentation = 'pill' | 'segmented' | 'icon-only';
|
|
@@ -25,11 +26,13 @@ type TabBarItemNameOverflow = 'ellipsis' | 'visible';
|
|
|
25
26
|
*/
|
|
26
27
|
type TabBarItemNameTruncate = 'end' | 'middle' | 'start';
|
|
27
28
|
/**
|
|
28
|
-
* The suffix `nameTruncate="middle"`
|
|
29
|
+
* The suffix `nameTruncate="middle"` selects: a number of trailing
|
|
29
30
|
* characters, or `segment` (default) for the last path segment, or the last
|
|
30
31
|
* 10 characters when the name has no separator.
|
|
31
32
|
*/
|
|
32
33
|
type TabBarItemNameTruncateKeep = MiddleTruncateKeep;
|
|
34
|
+
/** Which part wins in a narrow middle-truncated tab; defaults to `head`. */
|
|
35
|
+
type TabBarItemNameTruncatePriority = MiddleTruncatePriority;
|
|
33
36
|
interface TabBarItemProps {
|
|
34
37
|
id: string;
|
|
35
38
|
name: string;
|
|
@@ -73,6 +76,8 @@ interface TabBarItemProps {
|
|
|
73
76
|
nameTruncate?: TabBarItemNameTruncate;
|
|
74
77
|
/** The suffix `nameTruncate="middle"` keeps (default `segment`). */
|
|
75
78
|
nameTruncateKeep?: TabBarItemNameTruncateKeep;
|
|
79
|
+
/** `head` (default) keeps a head sliver; `suffix` keeps the full suffix. */
|
|
80
|
+
nameTruncatePriority?: TabBarItemNameTruncatePriority;
|
|
76
81
|
/** Decorative dormant content for the close button. Must not contain interactive descendants. */
|
|
77
82
|
closeIcon?: SafeHtml;
|
|
78
83
|
selectAction?: string;
|
|
@@ -95,6 +100,6 @@ interface TabBarItemProps {
|
|
|
95
100
|
/** Native named-slot assignment when composed inside a web component. */
|
|
96
101
|
slot?: string;
|
|
97
102
|
}
|
|
98
|
-
declare function TabBarItem({ id, name, selected, disabled, tabId, panelId, attention, dropTarget, closable, draggable, leading, trailing, presentation, size, labelMaxWidth, nameOverflow, nameTruncate, nameTruncateKeep, closeIcon, selectAction, closeAction, className, placeholder, pending, rootAttributes, slot, }: TabBarItemProps): SafeHtml;
|
|
103
|
+
declare function TabBarItem({ id, name, selected, disabled, tabId, panelId, attention, dropTarget, closable, draggable, leading, trailing, presentation, size, labelMaxWidth, nameOverflow, nameTruncate, nameTruncateKeep, nameTruncatePriority, closeIcon, selectAction, closeAction, className, placeholder, pending, rootAttributes, slot, }: TabBarItemProps): SafeHtml;
|
|
99
104
|
|
|
100
|
-
export { TabBarItem, type TabBarItemNameOverflow, type TabBarItemNameTruncate, type TabBarItemNameTruncateKeep, type TabBarItemPresentation, type TabBarItemProps, type TabBarItemSize };
|
|
105
|
+
export { TabBarItem, type TabBarItemNameOverflow, type TabBarItemNameTruncate, type TabBarItemNameTruncateKeep, type TabBarItemNameTruncatePriority, type TabBarItemPresentation, type TabBarItemProps, type TabBarItemSize };
|
package/dist/tab-bar-item.js
CHANGED
package/dist/text.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as kerfjs from 'kerfjs';
|
|
2
|
+
import { SafeHtml } from 'kerfjs';
|
|
2
3
|
import { KerfBaseAttrs } from 'kerfjs/jsx-runtime';
|
|
3
4
|
import { K as KerfUiContent } from './semantic-content-BbzjvSu9.js';
|
|
4
5
|
import { R as RootDataAttributes } from './extension-attributes-CnqvBmj3.js';
|
|
5
6
|
import { S as Sides } from './sides-BPSWde0A.js';
|
|
6
7
|
import { CssForegroundColor } from './css-values.js';
|
|
7
|
-
import { M as MiddleTruncateKeep } from './split-middle-
|
|
8
|
+
import { M as MiddleTruncateKeep, a as MiddleTruncatePriority } from './split-middle-BNI0Rni-.js';
|
|
8
9
|
|
|
9
10
|
type FieldLabelProps = Omit<KerfBaseAttrs, 'children' | 'class' | 'className' | 'id'> & {
|
|
10
11
|
children: string;
|
|
@@ -42,10 +43,12 @@ type TextAlign = 'start' | 'center' | 'end';
|
|
|
42
43
|
*/
|
|
43
44
|
type TextTruncate = 'end' | 'middle' | 'start';
|
|
44
45
|
/**
|
|
45
|
-
* The suffix `truncate="middle"`
|
|
46
|
+
* The suffix `truncate="middle"` selects: a number of trailing
|
|
46
47
|
* characters, or `segment` for the last path segment with its separator.
|
|
47
48
|
*/
|
|
48
49
|
type TextTruncateKeep = MiddleTruncateKeep;
|
|
50
|
+
/** Which part wins in a narrow middle-truncated box; defaults to `head`. */
|
|
51
|
+
type TextTruncatePriority = MiddleTruncatePriority;
|
|
49
52
|
type TextContent = KerfUiContent | string | number | readonly TextContent[];
|
|
50
53
|
type TextCommonProps = Omit<KerfBaseAttrs, 'children' | 'class' | 'className' | 'id' | 'lang'> & {
|
|
51
54
|
/**
|
|
@@ -103,12 +106,14 @@ type TextProps = TextCommonProps & ({
|
|
|
103
106
|
maxLines?: number;
|
|
104
107
|
truncate?: never;
|
|
105
108
|
truncateKeep?: never;
|
|
109
|
+
truncatePriority?: never;
|
|
106
110
|
} | {
|
|
107
111
|
/** Keep one line without an ellipsis. */
|
|
108
112
|
wrap: 'nowrap';
|
|
109
113
|
maxLines?: never;
|
|
110
114
|
truncate?: never;
|
|
111
115
|
truncateKeep?: never;
|
|
116
|
+
truncatePriority?: never;
|
|
112
117
|
} | {
|
|
113
118
|
/** Keep one line with an ellipsis. */
|
|
114
119
|
wrap: 'truncate';
|
|
@@ -125,12 +130,27 @@ type TextProps = TextCommonProps & ({
|
|
|
125
130
|
* `\\` separator).
|
|
126
131
|
*/
|
|
127
132
|
truncateKeep?: TextTruncateKeep;
|
|
133
|
+
/**
|
|
134
|
+
* Narrow-box policy for `truncate="middle"`: `head` (default)
|
|
135
|
+
* reserves a head sliver and ellipsizes the suffix; `suffix` keeps
|
|
136
|
+
* the suffix whole while the head shrinks to an ellipsis or nothing.
|
|
137
|
+
*/
|
|
138
|
+
truncatePriority?: TextTruncatePriority;
|
|
128
139
|
});
|
|
129
140
|
/**
|
|
130
141
|
* Semantic heading, paragraph, or inline text. Block variants use the standard
|
|
131
142
|
* content-item padding; `span` adds no box geometry.
|
|
132
143
|
* All ordinary native heading/paragraph attributes pass through to the element.
|
|
133
144
|
*/
|
|
134
|
-
declare function Text({ variant: Variant, tone, weight, color, size, font, border, flush, controlMargins, lineHeight, align, live, ariaLabel, rootAttributes, wrap, maxLines, truncate, truncateKeep, children, class: classValue, className, style, ...attributes }: TextProps):
|
|
145
|
+
declare function Text({ variant: Variant, tone, weight, color, size, font, border, flush, controlMargins, lineHeight, align, live, ariaLabel, rootAttributes, wrap, maxLines, truncate, truncateKeep, truncatePriority, children, class: classValue, className, style, ...attributes }: TextProps): SafeHtml;
|
|
146
|
+
|
|
147
|
+
interface MarkProps {
|
|
148
|
+
/** Matched content; inherits the surrounding font, including code typography. */
|
|
149
|
+
children: SafeHtml | string | number;
|
|
150
|
+
/** Emphasize the active result among otherwise quiet matches. */
|
|
151
|
+
current?: boolean;
|
|
152
|
+
}
|
|
153
|
+
/** A native text highlight for find-in-content results. */
|
|
154
|
+
declare function Mark({ children, current }: MarkProps): SafeHtml;
|
|
135
155
|
|
|
136
|
-
export { FieldLabel, type FieldLabelProps, Sides, Text, type TextAlign, type TextBorder, type TextContent, type TextFont, type TextLineHeight, type TextProps, type TextSize, type TextTone, type TextTruncate, type TextTruncateKeep, type TextVariant, type TextWeight, type TextWrap };
|
|
156
|
+
export { FieldLabel, type FieldLabelProps, Mark, type MarkProps, Sides, Text, type TextAlign, type TextBorder, type TextContent, type TextFont, type TextLineHeight, type TextProps, type TextSize, type TextTone, type TextTruncate, type TextTruncateKeep, type TextTruncatePriority, type TextVariant, type TextWeight, type TextWrap };
|
package/dist/text.js
CHANGED
|
@@ -438,6 +438,10 @@ resets native margins. Center short status copy with `Text align="center"`
|
|
|
438
438
|
(`end` aligns a trailing value) instead of setting `text-align` on `.kui-text`. `ValueTable density="compact"` reduces row padding and
|
|
439
439
|
gap. Its `--kui-value-table-row-columns`, `--kui-value-table-row-padding-block`,
|
|
440
440
|
and `--kui-value-table-row-gap` tokens support a specific metadata layout.
|
|
441
|
+
For find-in-content, wrap each matched span in `Mark` from `@kerfjs/ui/text`
|
|
442
|
+
and set `current` on the active result. It renders native `<mark>` with quiet
|
|
443
|
+
and stronger states, including inside monospaced `Text` or `<code>`; the app
|
|
444
|
+
still owns match ranges, navigation, and the result count announcement.
|
|
441
445
|
Use `ToolbarText size="xsmall"` for a dense rail heading. Use
|
|
442
446
|
`size="xlarge-fixed"` for a toolbar heading at the fixed 20px step; `xlarge`
|
|
443
447
|
retains the responsive page-title clamp. Pass `headingLevel` when the text is
|
|
@@ -467,7 +471,10 @@ instead of the default ellipsis; a visible-name tab wider than its whole strip
|
|
|
467
471
|
falls back to an ellipsis with the full name as its title. When tabs differ only at the end of their names
|
|
468
472
|
(a run id, a file path), set `nameTruncate="start"` to keep the tail, or
|
|
469
473
|
`nameTruncate="middle"` to keep the start and the last path segment
|
|
470
|
-
(`nameTruncateKeep` sets another suffix length).
|
|
474
|
+
(`nameTruncateKeep` sets another suffix length). By default a narrow middle
|
|
475
|
+
name keeps a sliver of the head and ellipsizes the suffix; set
|
|
476
|
+
`nameTruncatePriority="suffix"` when the suffix identifies the tab and must
|
|
477
|
+
stay whole. The suffix still needs to fit inside the name box. A `TabBar` owns its
|
|
471
478
|
scrolling strip; its public `--kui-tab-bar-strip-*` tokens configure strip
|
|
472
479
|
height, spacing, border, radius, background, and scroll inset without styling
|
|
473
480
|
its internal classes. `--kui-tab-bar-trailing-flex` controls the trailing zone.
|
|
Binary file
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# Kerf UI Sketch catalog
|
|
2
2
|
|
|
3
3
|
[Kerf-UI.sketch](Kerf-UI.sketch) is the one Kerf UI Sketch Library. It holds
|
|
4
|
-
all 328 editable light and dark Symbols for the 115 template variants, on one
|
|
4
|
+
all 328 editable light and dark Symbols in 35 linked Variant Sets for the 115 template variants, on one
|
|
5
5
|
page per family: Button, Form Controls, Advanced Inputs, Lists and Data,
|
|
6
6
|
Toolbars and Navigation, and Content and Feedback. Each page shows its light
|
|
7
7
|
masters beside its dark masters on a dark surface, ordered by Symbol name.
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
The component browser exposes a Variant Set per component; its inspector has
|
|
9
|
+
`State` and `Theme` properties. The 141 Color Variables are named
|
|
10
|
+
`Kerf/<Theme>/<Role>`. See the
|
|
10
11
|
[unified Library guide](unified/README.md) for its identity contract, build,
|
|
11
12
|
and verification. [Coverage](coverage.md) accounts for every source variant.
|
|
12
13
|
Source SVG sheets in [templates](../templates.md) are review material, not
|
|
@@ -15,10 +16,11 @@ substitutes for editable Symbols.
|
|
|
15
16
|
## Install and update
|
|
16
17
|
|
|
17
18
|
The Library was created with **Sketch 2026.3.1** and its shipped file was
|
|
18
|
-
reverified with **Sketch 2026.4** on
|
|
19
|
-
linked cross-family consumer instances
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
reverified with **Sketch 2026.4** on 26 November 2026: all 328 Symbols were
|
|
20
|
+
grouped into 35 Variant Sets, and 12 linked cross-family consumer instances
|
|
21
|
+
passed override, resize, and save/reopen checks. Six representative sets,
|
|
22
|
+
including both themes, retained their text overrides and widths after a Library
|
|
23
|
+
update. Kerf UI ships it as a Sketch Library: documents link its Symbols
|
|
22
24
|
and Color Variables, so a new release reaches every design that uses them.
|
|
23
25
|
|
|
24
26
|
To install:
|
|
@@ -40,15 +42,15 @@ To install:
|
|
|
40
42
|
4. In Sketch, open **Settings → Libraries**, choose **Add Library…**, and
|
|
41
43
|
select the copy.
|
|
42
44
|
|
|
43
|
-
To use it, insert a
|
|
44
|
-
|
|
45
|
+
To use it, insert a Variant Set from the component browser, then choose its
|
|
46
|
+
State and Theme in the inspector. Typing `Button` finds the Button set.
|
|
45
47
|
Kerf's Color Variables (`Kerf/<Theme>/<Role>`) appear in the color picker
|
|
46
48
|
under the Library's name.
|
|
47
49
|
|
|
48
50
|
To update, copy the newly published file over the same installed path. Sketch
|
|
49
51
|
then offers the Library update in any open document that uses it; accept it to
|
|
50
52
|
sync. Linked instances keep their overrides: the Library's document ID, Symbol
|
|
51
|
-
IDs, Text layer IDs, and Color Variable IDs stay the same across releases, and
|
|
53
|
+
IDs, Variant Set IDs, Text layer IDs, and Color Variable IDs stay the same across releases, and
|
|
52
54
|
the build fails if any of them changes. Don't add the new file as a second
|
|
53
55
|
Library alongside the old one. If the native format or supported Sketch version changes, this guide
|
|
54
56
|
and the unified guide must record the new verification result before
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
[Kerf-UI.sketch](../Kerf-UI.sketch) is the Library designers install. It is
|
|
4
4
|
rebuilt from the six family Libraries by `npm run sketch:library` and holds 328
|
|
5
5
|
Symbols, 141 Color Variables, and Button's 42 shared layer styles and 38 shared
|
|
6
|
-
text styles.
|
|
6
|
+
text styles. All 328 masters belong to 35 linked Variant Sets, one per
|
|
7
|
+
component across all six families.
|
|
7
8
|
|
|
8
9
|
## Pages and naming
|
|
9
10
|
|
|
@@ -14,8 +15,13 @@ surface so dark-theme masters stay legible. The page labels and the dark
|
|
|
14
15
|
surface are page layers outside every Symbol. [Page overviews](pages/) are
|
|
15
16
|
exported on each build.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
Family source Symbols use `Component / Variant / State / Theme`. The unified
|
|
19
|
+
Library groups them into a component Variant Set with `State` and `Theme`
|
|
20
|
+
properties. `State` joins the intermediate name segments with `·`, so
|
|
21
|
+
`Text Field / Labeled / Project Name / Light` becomes `Text Field` with
|
|
22
|
+
`State = Labeled · Project Name` and `Theme = Light`. Sketch renames its
|
|
23
|
+
child master to `Labeled · Project Name/Light`. Insert the Variant Set, then
|
|
24
|
+
choose its State and Theme in the inspector. Color Variables are named
|
|
19
25
|
`Kerf/<Theme>/<Role>`, for example `Kerf/Light/Text Quiet` or
|
|
20
26
|
`Kerf/Dark/Button Primary Brand Fill`. Where families agree on a role's color,
|
|
21
27
|
they share one variable. Six roles have different colors in different
|
|
@@ -35,6 +41,9 @@ releases:
|
|
|
35
41
|
These equal the family Library's IDs, which each family pipeline already
|
|
36
42
|
keeps stable. The merge copies each master and then sets its Symbol ID and
|
|
37
43
|
every layer's object ID back to the family values.
|
|
44
|
+
- **Variant Set IDs.** The first grouped build records them in the manifest;
|
|
45
|
+
later builds pin them to those values. Child Symbol identities stay stable
|
|
46
|
+
through grouping and save/reopen.
|
|
38
47
|
- **Color Variable IDs.** Each variable takes the ID of its first source
|
|
39
48
|
swatch in family order. A cross-document copy drops swatch references, so
|
|
40
49
|
the merge rebinds every fill, border, and text paint, and checks that each
|
|
@@ -57,13 +66,17 @@ npm run sketch:library -- sync
|
|
|
57
66
|
```
|
|
58
67
|
|
|
59
68
|
`npm run sketch:library` runs all three. `verify` opens the Library, checks
|
|
60
|
-
every family page,
|
|
61
|
-
|
|
69
|
+
every family page, 35 importable Variant Set references, and the corresponding
|
|
70
|
+
35 Symbol references (down from 328 before grouping), and builds a consumer
|
|
71
|
+
linked to one set per family with Light and Dark instances. Each instance gets
|
|
72
|
+
a text override and an 80px resize, and the
|
|
62
73
|
consumer is saved and reopened ([verification.json](https://github.com/brianwestphal/kerf/blob/main/ui/docs/design/sketch/unified/verification.json),
|
|
63
|
-
[consumer exports](https://github.com/brianwestphal/kerf/tree/main/ui/docs/design/sketch/unified/consumer-exports)).
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
[consumer exports](https://github.com/brianwestphal/kerf/tree/main/ui/docs/design/sketch/unified/consumer-exports)).
|
|
75
|
+
For Button's auto-sized masters, the test sets the instance to fixed horizontal
|
|
76
|
+
sizing before resizing. `sync` edits both themes of one representative set
|
|
77
|
+
per family under the same document ID, updates six detached-set consumers
|
|
78
|
+
through Sketch's libraries controller, and checks that the edit, overrides,
|
|
79
|
+
and resized widths survive save/reopen ([sync-verification.json](https://github.com/brianwestphal/kerf/blob/main/ui/docs/design/sketch/unified/sync-verification.json)).
|
|
67
80
|
|
|
68
81
|
Rebuild after any family Library changes. A Library with an unchanged set of
|
|
69
82
|
family masters rebuilds with identical IDs.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Variant Set library linkage (Sketch 2026.4)
|
|
2
|
+
|
|
3
|
+
The [repeatable investigation](../../../../scripts/sketch/catalog/variant-link-investigation.mjs)
|
|
4
|
+
uses disposable copies of the shipped `Kerf-UI.sketch`. Run it from `ui/` with
|
|
5
|
+
`node scripts/sketch/catalog/variant-link-investigation.mjs`; it writes the
|
|
6
|
+
[machine-readable report](variant-link-report.json). The shipped Library is
|
|
7
|
+
unchanged. The normal `npm run sketch:library -- sync` command writes the same
|
|
8
|
+
six-family check to [sync-verification.json](sync-verification.json).
|
|
9
|
+
|
|
10
|
+
## Linked import and update
|
|
11
|
+
|
|
12
|
+
`VariantSetReference.import()` creates a library-linked set. Keep that set
|
|
13
|
+
detached, choose a child master with
|
|
14
|
+
`getBestVariantMasterForConfiguration({ State, Theme })`, and place its instance
|
|
15
|
+
on the consumer page. The saved document retains a native
|
|
16
|
+
`foreignVariantSets` record. Six representative sets, one per family, each
|
|
17
|
+
kept Light and Dark text overrides and 80 px width changes through save/reopen,
|
|
18
|
+
then received a source text edit through Sketch's Library sync and kept both
|
|
19
|
+
overrides and widths through a second save/reopen. Button's auto-sized instances
|
|
20
|
+
require fixed horizontal sizing before the width change.
|
|
21
|
+
|
|
22
|
+
The child masters receive local Symbol IDs and individually return false for
|
|
23
|
+
`getLibrary()` and `foreignObject()`. The imported set's native foreign object
|
|
24
|
+
and the document's foreign Variant Set record carry the Library link. Placing
|
|
25
|
+
the imported set itself on the consumer page was tested in the earlier
|
|
26
|
+
[prototype](variant-prototype-report.json): its native sync reported current,
|
|
27
|
+
but placed instances did not receive the source text edit. Keep the set
|
|
28
|
+
detached and place instances only.
|
|
29
|
+
|
|
30
|
+
## Source identity and import surface
|
|
31
|
+
|
|
32
|
+
Grouping all 328 masters into 35 component sets preserved Symbol, master,
|
|
33
|
+
descendant, and Color Variable IDs after save/reopen. The unified
|
|
34
|
+
[manifest](symbol-manifest.json) pins each new Variant Set ID for subsequent
|
|
35
|
+
builds. Sketch presents each set as the import target and renames children by
|
|
36
|
+
their `State/Theme` configuration; the original family Symbol IDs remain the
|
|
37
|
+
source identity. Grouping reduced the individual importable Symbol reference
|
|
38
|
+
count from 328 to 35, while all 35 Variant Sets are importable. The production
|
|
39
|
+
verification asserts both counts. The earlier four-master prototype measured
|
|
40
|
+
the first reduction, from 328 to 325.
|
|
41
|
+
|
|
42
|
+
Sketch's [2026.4 API guide](https://developer.sketch.com/plugins/updates/new-in-sketch-20264)
|
|
43
|
+
documents Variant Set references. The [API reference](https://developer.sketch.com/reference/api/)
|
|
44
|
+
documents the imported Symbol and instance sizing APIs; the saved-document
|
|
45
|
+
and update checks above establish the behavior of this detached-set path.
|
package/docs/layout.md
CHANGED
|
@@ -792,6 +792,13 @@ none), or a number keeps that many trailing characters. `middle` needs string
|
|
|
792
792
|
or number children so it can split them. Both positions are for left-to-right
|
|
793
793
|
identifiers and paths, keep the whole value in the DOM in order for assistive
|
|
794
794
|
technology, and show it as the element's `title` unless you pass your own.
|
|
795
|
+
When the box is too narrow for both parts, `truncatePriority="head"` (default)
|
|
796
|
+
keeps a small piece of the head and ellipsizes the suffix. Set
|
|
797
|
+
`truncatePriority="suffix"` for an identity-bearing tail such as a run ID:
|
|
798
|
+
the suffix keeps its natural width while the head reduces to an ellipsis or
|
|
799
|
+
disappears. If the suffix alone exceeds the box, the box still clips it; give
|
|
800
|
+
identity suffixes enough width to fit. The property applies only to
|
|
801
|
+
`truncate="middle"`.
|
|
795
802
|
Never hand-roll these with `direction: rtl` or split spans in app CSS.
|
|
796
803
|
|
|
797
804
|
```tsx
|
package/docs/ui-analyzer.md
CHANGED
|
@@ -128,6 +128,12 @@ if (report.summary.errors) process.exitCode = 1;
|
|
|
128
128
|
For `KUI-L004` and `KUI-L007`, scroll and inset declarations belong to the
|
|
129
129
|
subject of each CSS selector. An ancestor class used only to qualify a
|
|
130
130
|
descendant selector is not treated as a scroll owner or inset source.
|
|
131
|
+
`KUI-L004` treats an inner element with its own nontransparent background,
|
|
132
|
+
nonzero border, or outline as a separate inset surface. Native input, select,
|
|
133
|
+
and textarea elements also own their inset. If CSS cannot express that boundary,
|
|
134
|
+
an application composition entry can declare `layout.geometry.role: "surface"`
|
|
135
|
+
for the inner class; zero borders and transparent backgrounds do not establish
|
|
136
|
+
a surface.
|
|
131
137
|
|
|
132
138
|
Errors are provable contract violations and make the command exit 1. Review
|
|
133
139
|
findings are deliberately heuristic and do not fail by default; pass
|
|
@@ -434,12 +440,21 @@ The JSON report schema is exported as
|
|
|
434
440
|
`@kerfjs/ui/analyzer/report.schema.json`.
|
|
435
441
|
|
|
436
442
|
Profile discovery, parsing, catalog-loading, and validation diagnostics retain
|
|
437
|
-
their stable `KUI-P###` ids in every output format and count as errors.
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
+
their stable `KUI-P###` ids in every output format and count as errors. A
|
|
444
|
+
profile exception naming a missing target (`KUI-P031`) or suppressing no
|
|
445
|
+
finding in an analyzed target (`KUI-P032`) is a warning. The doctor gates these
|
|
446
|
+
with `failOn: "warning"`; a partial scan does not judge exceptions for files it
|
|
447
|
+
did not analyze. JSON reports also list each suppressed finding in
|
|
448
|
+
`suppressed[]` with its exception id, source location, and consumer. The
|
|
449
|
+
`summary.suppressed` count retains its meaning: findings suppressed for every
|
|
450
|
+
consumer.
|
|
451
|
+
|
|
452
|
+
The analyzer classifies conditional and template class expressions when every
|
|
453
|
+
possible value is a finite set of application-owned class names. A template
|
|
454
|
+
substitution can use a string-literal union type, such as `'user' | 'assistant'`
|
|
455
|
+
for `message--${role}`. Unconstrained strings and expressions that can produce
|
|
456
|
+
Kerf or Web Awesome classes still receive a review finding. CSS values
|
|
457
|
+
expressed through public variables or `calc()` are
|
|
443
458
|
also left to their owning token contract rather than reverse-engineered.
|
|
444
459
|
|
|
445
460
|
## Narrow exceptions
|
|
@@ -26,3 +26,7 @@ export function projectConsumerCoreConfig(
|
|
|
26
26
|
config: ConsumerEslintConfigLike | undefined,
|
|
27
27
|
file: string,
|
|
28
28
|
): ProjectedConsumerCoreConfig | undefined;
|
|
29
|
+
|
|
30
|
+
export function groupConsumerCoreConfigs(
|
|
31
|
+
configs: (ProjectedConsumerCoreConfig | undefined)[],
|
|
32
|
+
): ProjectedConsumerCoreConfig[];
|
|
@@ -27,3 +27,16 @@ export function projectConsumerCoreConfig(config, file) {
|
|
|
27
27
|
...(globals ? { languageOptions: { globals } } : {}),
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
export function groupConsumerCoreConfigs(configs) {
|
|
32
|
+
const groups = new Map();
|
|
33
|
+
for (const config of configs) {
|
|
34
|
+
if (!config) continue;
|
|
35
|
+
const { files, ...projection } = config;
|
|
36
|
+
const key = JSON.stringify(projection);
|
|
37
|
+
const group = groups.get(key);
|
|
38
|
+
if (group) group.files.push(...files);
|
|
39
|
+
else groups.set(key, { ...projection, files: [...files] });
|
|
40
|
+
}
|
|
41
|
+
return [...groups.values()];
|
|
42
|
+
}
|
package/doctor/index.mjs
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
collectProjectGuidanceFiles,
|
|
35
35
|
} from './project-guidance-checks.mjs';
|
|
36
36
|
import {
|
|
37
|
+
groupConsumerCoreConfigs,
|
|
37
38
|
isForeignRuleDefinitionDiagnostic,
|
|
38
39
|
projectConsumerCoreConfig,
|
|
39
40
|
} from './eslint-diagnostics.mjs';
|
|
@@ -655,7 +656,7 @@ function normalizeAnalyzer(report) {
|
|
|
655
656
|
...report.profile.diagnostics.map((item) =>
|
|
656
657
|
normalizedDiagnostic({
|
|
657
658
|
id: item.code,
|
|
658
|
-
severity: 'error',
|
|
659
|
+
severity: item.severity ?? 'error',
|
|
659
660
|
stage: 'analyzer',
|
|
660
661
|
message: item.message,
|
|
661
662
|
location: { file: item.source, line: 1, column: 1, path: item.path },
|
|
@@ -1033,7 +1034,7 @@ async function runEslint({
|
|
|
1033
1034
|
),
|
|
1034
1035
|
),
|
|
1035
1036
|
);
|
|
1036
|
-
configs.push(...consumerCoreConfigs
|
|
1037
|
+
configs.push(...groupConsumerCoreConfigs(consumerCoreConfigs));
|
|
1037
1038
|
}
|
|
1038
1039
|
const eslint = new ESLint({
|
|
1039
1040
|
cwd: packageRoot,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/text/split-middle.ts"],"names":[],"mappings":";AAOA,IAAM,oBAAA,GAAuB,EAAA;AAGtB,SAAS,WAAA,CACd,MACA,IAAA,EACkB;AAClB,EAAA,IAAI,UAAA;AACJ,EAAA,IAAI,SAAS,SAAA,EAAW;AAEtB,IAAA,MAAM,SAAA,GAAY,SAAS,IAAA,CAAK,IAAI,IAAI,IAAA,CAAK,MAAA,GAAS,IAAI,IAAA,CAAK,MAAA;AAC/D,IAAA,MAAM,YAAY,IAAA,CAAK,GAAA;AAAA,MACrB,IAAA,CAAK,WAAA,CAAY,GAAA,EAAK,SAAA,GAAY,CAAC,CAAA;AAAA,MACnC,IAAA,CAAK,WAAA,CAAY,IAAA,EAAM,SAAA,GAAY,CAAC;AAAA,KACtC;AACA,IAAA,UAAA,GAAa,SAAA,GAAY,CAAA,GAAI,IAAA,CAAK,MAAA,GAAS,SAAA,GAAY,oBAAA;AAAA,EACzD,OAAO,UAAA,GAAa,IAAA;AACpB,EAAA,IAAI,cAAc,IAAA,CAAK,MAAA,EAAQ,OAAO,CAAC,MAAM,EAAE,CAAA;AAC/C,EAAA,OAAO,CAAC,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,CAAC,UAAU,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,CAAC,UAAU,CAAC,CAAA;AAC7D","file":"chunk-LK3QJHVX.js","sourcesContent":["/**\n * The suffix a middle truncation always keeps: a number of trailing\n * characters, or `segment` for the last path segment with its separator.\n */\nexport type MiddleTruncateKeep = number | 'segment';\n\n/** Characters a middle truncation keeps when the text has no path separator. */\nconst MIDDLE_FALLBACK_KEEP = 10;\n\n/** Split text into the shrinkable head and the always-kept tail. */\nexport function splitMiddle(\n text: string,\n keep: MiddleTruncateKeep,\n): [string, string] {\n let tailLength: number;\n if (keep === 'segment') {\n // Ignore one trailing separator so `src/lib/` keeps `/lib/`.\n const searchEnd = /[/\\\\]$/.test(text) ? text.length - 1 : text.length;\n const separator = Math.max(\n text.lastIndexOf('/', searchEnd - 1),\n text.lastIndexOf('\\\\', searchEnd - 1),\n );\n tailLength = separator > 0 ? text.length - separator : MIDDLE_FALLBACK_KEEP;\n } else tailLength = keep;\n if (tailLength >= text.length) return [text, ''];\n return [text.slice(0, -tailLength), text.slice(-tailLength)];\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/forms/field-label/field-label.tsx","../src/components/typography/text/text.tsx"],"names":["jsx"],"mappings":";;;;AAiBO,SAAS,UAAA,CAAW;AAAA,EACzB,QAAA;AAAA,EACA,EAAA;AAAA,EACA,OAAO,UAAA,GAAa,EAAA;AAAA,EACpB,SAAA,GAAY,EAAA;AAAA,EACZ,GAAG;AACL,CAAA,EAAoB;AAClB,EAAA,MAAM,OAAA,GAAU,CAAC,uBAAA,EAAyB,UAAA,EAAY,SAAS,EAC5D,MAAA,CAAO,OAAO,CAAA,CACd,IAAA,CAAK,GAAG,CAAA;AACX,EAAA,uBACE,GAAA,CAAC,SAAK,GAAG,UAAA,EAAY,IAAQ,KAAA,EAAO,OAAA,EAAS,gBAAA,EAAe,aAAA,EACzD,QAAA,EACH,CAAA;AAEJ;AC6GA,IAAM,uBAAA,uBAA8B,GAAA,CAAI;AAAA,EACtC,gBAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,sBAAA;AAAA,EACA,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF,CAAC,CAAA;AAOM,SAAS,IAAA,CAAK;AAAA,EACnB,SAAS,OAAA,GAAU,GAAA;AAAA,EACnB,IAAA,GAAO,SAAA;AAAA,EACP,MAAA,GAAS,SAAA;AAAA,EACT,KAAA;AAAA,EACA,IAAA,GAAO,SAAA;A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tB,KAAA,EAAO,CAAC,IAAA,EAAM,IAAI,CAAA;AAAA,EAClB;AACF,CAAA,EAGG;AAED,EAAA,MAAM,IAAA,GAAO,CAAC,IAAA,KAAkB,MAAA,mBAASA,GAAAA,CAAC,QAAA,EAAA,EAAQ,gBAAK,CAAA,GAAY,IAAA;AACnE,EAAA,uBACE,IAAA,CAAC,MAAA,EAAA,EAAK,KAAA,EAAM,2BAAA,EACV,QAAA,EAAA;AAAA,oBAAAA,IAAC,MAAA,EAAA,EAAK,KAAA,EAAM,yBAAA,EAA2B,QAAA,EAAA,IAAA,CAAK,IAAI,CAAA,EAAE,CAAA;AAAA,IACjD,IAAA,mBAAOA,GAAAA,CAAC,MAAA,EAAA,EAAK,OAAM,yBAAA,EAA2B,QAAA,EAAA,IAAA,CAAK,IAAI,CAAA,EAAE,CAAA,GAAU;AAAA,GAAA,EACtE,CAAA;AAEJ","file":"chunk-OW2ODKHN.js","sourcesContent":["import type { KerfBaseAttrs } from 'kerfjs/jsx-runtime';\n\nexport type FieldLabelProps = Omit<\n KerfBaseAttrs,\n 'children' | 'class' | 'className' | 'id'\n> & {\n children: string;\n /**\n * The label's id: what a group's `labelledBy` (a ChoiceChips or a preview\n * group's `aria-labelledby`) names, so the label is that group's name.\n */\n id?: string;\n class?: string;\n className?: string;\n};\n\n/** Visible field heading for a read-only preview; use its id with aria-labelledby on the preview group. */\nexport function FieldLabel({\n children,\n id,\n class: classValue = '',\n className = '',\n ...attributes\n}: FieldLabelProps) {\n const classes = ['kui-text__field-label', classValue, className]\n .filter(Boolean)\n .join(' ');\n return (\n <div {...attributes} id={id} class={classes} data-component=\"field-label\">\n {children}\n </div>\n );\n}\n","import type { KerfBaseAttrs } from 'kerfjs/jsx-runtime';\n\nimport type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport {\n filterDataAttributes,\n type RootDataAttributes,\n} from '../../../shared/dom/extension-attributes.js';\nimport type { Sides } from '../../../shared/layout/sides.js';\nimport type { CssForegroundColor } from '../../../shared/styles/css-values.js';\n\nexport {\n FieldLabel,\n type FieldLabelProps,\n} from '../../forms/field-label/field-label.js';\nimport {\n type MiddleTruncateKeep,\n splitMiddle,\n} from '../../../shared/text/split-middle.js';\n\nexport type TextVariant =\n 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';\nexport type TextTone = 'default' | 'quiet' | 'danger';\n/** `strong` marks the text as important with a `<strong>` element. */\nexport type TextWeight = 'regular' | 'strong';\n/**\n * `compact` (xs), `default` (the element's own size), `medium` (the 16px\n * body size, for a heading such as an in-list group title), `large`, or\n * `xlarge`.\n */\nexport type TextSize = 'compact' | 'default' | 'medium' | 'large' | 'xlarge';\nexport type TextFont = 'default' | 'monospace';\nexport type TextBorder = 'transparent' | 'none';\nexport type TextLineHeight = 'default' | 'tight';\nexport type TextWrap = 'normal' | 'anywhere' | 'nowrap' | 'truncate';\n/** Inline alignment of the text's lines, in logical (writing-direction) terms. */\nexport type TextAlign = 'start' | 'center' | 'end';\n/**\n * Where `wrap=\"truncate\"` places its ellipsis: `end` (default) keeps the\n * start, `start` keeps the tail (branch names, the end of an identifier), and\n * `middle` keeps both the start and a suffix (file paths).\n */\nexport type TextTruncate = 'end' | 'middle' | 'start';\n/**\n * The suffix `truncate=\"middle\"` always keeps: a number of trailing\n * characters, or `segment` for the last path segment with its separator.\n */\nexport type TextTruncateKeep = MiddleTruncateKeep;\n\nexport type TextContent =\n KerfUiContent | string | number | readonly TextContent[];\n\ntype TextCommonProps = Omit<\n KerfBaseAttrs,\n 'children' | 'class' | 'className' | 'id' | 'lang'\n> & {\n /**\n * The element's id, for a link or `aria-*` reference to target (a\n * `ListItemLink href=\"#…\"` destination, for example).\n */\n id?: string;\n /** The text's language (`lang`), when it differs from the page's (KF-AC7AFR). */\n lang?: string;\n /**\n * An accessible name for the element (`aria-label`), such as a named\n * example paragraph (KF-AC7AFR). Visible text names most Text already.\n */\n ariaLabel?: string;\n /** Native heading, paragraph, or inline span element to render. Defaults to `p`. */\n variant?: TextVariant;\n /** Semantic foreground treatment. Defaults to the inherited foreground. */\n tone?: TextTone;\n /**\n * `strong` wraps the text in `<strong>`, for a title or key phrase that\n * matters more than its neighbors. Defaults to `regular`.\n */\n weight?: TextWeight;\n /** Foreground color; overrides tone when supplied, or inherits when omitted. */\n color?: CssForegroundColor;\n /** Text sizing independent of the native semantic element. */\n size?: TextSize;\n /** Font family independent of the native semantic element. */\n font?: TextFont;\n /** Transparent alignment border or no border when embedded in owner chrome. */\n border?: TextBorder;\n /** Add the shared control gutter outside selected physical edges. */\n controlMargins?: Sides;\n /** Remove the block variant's item padding and border in compact content. */\n flush?: boolean;\n /** Use compact leading for short dialog or metadata copy. */\n lineHeight?: TextLineHeight;\n /** Inline alignment of the lines (default `start`), for centered status copy. */\n align?: TextAlign;\n /**\n * Announce changes to this text as a live region (`aria-live`), for a\n * status or result readout that updates without moving focus.\n */\n live?: 'polite' | 'assertive';\n /** Application `data-*` metadata (test hooks, row keys); Text's own stay protected. */\n rootAttributes?: RootDataAttributes;\n children: TextContent;\n class?: string;\n className?: string;\n};\n\nexport type TextProps = TextCommonProps &\n (\n | {\n /** Wrap normally or break long unbroken strings. Defaults to normal. */\n wrap?: 'normal' | 'anywhere';\n /** Cap wrapped text to this positive number of lines. */\n maxLines?: number;\n truncate?: never;\n truncateKeep?: never;\n }\n | {\n /** Keep one line without an ellipsis. */\n wrap: 'nowrap';\n maxLines?: never;\n truncate?: never;\n truncateKeep?: never;\n }\n | {\n /** Keep one line with an ellipsis. */\n wrap: 'truncate';\n maxLines?: never;\n /**\n * Where the ellipsis goes (default `end`). `start` and `middle` are\n * for left-to-right identifiers and paths, and `middle` requires\n * string or number children so it can split them.\n */\n truncate?: TextTruncate;\n /**\n * The suffix `truncate=\"middle\"` keeps (default `segment`: the last\n * path segment, or the last 10 characters when there is no `/` or\n * `\\\\` separator).\n */\n truncateKeep?: TextTruncateKeep;\n }\n );\n\n/** Attributes Text writes itself, which `rootAttributes` cannot replace. */\nconst textProtectedAttributes = new Set([\n 'data-component',\n 'data-tone',\n 'data-size',\n 'data-font',\n 'data-border',\n 'data-control-margins',\n 'data-flush',\n 'data-line-height',\n 'data-align',\n 'data-wrap',\n 'data-max-lines',\n 'data-truncate',\n]);\n\n/**\n * Semantic heading, paragraph, or inline text. Block variants use the standard\n * content-item padding; `span` adds no box geometry.\n * All ordinary native heading/paragraph attributes pass through to the element.\n */\nexport function Text({\n variant: Variant = 'p',\n tone = 'default',\n weight = 'regular',\n color,\n size = 'default',\n font = 'default',\n border = 'transparent',\n flush = false,\n controlMargins = '',\n lineHeight = 'default',\n align = 'start',\n live,\n ariaLabel,\n rootAttributes = {},\n wrap = 'normal',\n maxLines,\n truncate,\n truncateKeep,\n children,\n class: classValue = '',\n className = '',\n style,\n ...attributes\n}: TextProps) {\n if (\n maxLines !== undefined &&\n (!Number.isSafeInteger(maxLines) ||\n maxLines < 1 ||\n wrap === 'nowrap' ||\n wrap === 'truncate')\n )\n throw new RangeError(\n 'Text maxLines requires a positive integer and wrapping',\n );\n const position = truncate ?? 'end';\n if (\n (truncate !== undefined && wrap !== 'truncate') ||\n !['end', 'middle', 'start'].includes(position)\n )\n throw new RangeError(\n 'Text truncate requires wrap=\"truncate\" and one of end, middle, or start',\n );\n if (\n truncateKeep !== undefined &&\n (position !== 'middle' ||\n (truncateKeep !== 'segment' &&\n (!Number.isSafeInteger(truncateKeep) || truncateKeep < 1)))\n )\n throw new RangeError(\n 'Text truncateKeep requires truncate=\"middle\" and a positive integer or \"segment\"',\n );\n const textValue =\n typeof children === 'string' || typeof children === 'number'\n ? String(children)\n : undefined;\n if (position === 'middle' && textValue === undefined)\n throw new TypeError(\n 'Text truncate=\"middle\" requires string or number children',\n );\n // Visually clipped start/middle text keeps its full value in the DOM; the\n // title shows it to pointer users unless the app supplied its own.\n const title =\n attributes.title === undefined && position !== 'end'\n ? textValue\n : attributes.title;\n const classes = ['kui-text', classValue, className].filter(Boolean).join(' ');\n return (\n <Variant\n {...filterDataAttributes(rootAttributes, textProtectedAttributes)}\n {...attributes}\n aria-live={live ?? attributes['aria-live']}\n aria-label={ariaLabel ?? attributes['aria-label']}\n class={classes}\n data-component=\"text\"\n data-tone={tone}\n data-size={size}\n data-font={font}\n data-border={border}\n data-control-margins={controlMargins || undefined}\n data-flush={flush ? 'true' : undefined}\n data-line-height={lineHeight === 'tight' ? 'tight' : undefined}\n data-align={align === 'start' ? undefined : align}\n data-wrap={wrap === 'normal' ? undefined : wrap}\n data-max-lines={maxLines === undefined ? undefined : String(maxLines)}\n data-truncate={position === 'end' ? undefined : position}\n title={title}\n style={\n color === undefined\n ? style\n : `${style === undefined || style === null ? '' : `${style};`}color:${color}`\n }\n >\n {textBody(\n position,\n children,\n textValue,\n truncateKeep,\n maxLines,\n weight === 'strong',\n )}\n </Variant>\n );\n}\n\n/** U+200E LEFT-TO-RIGHT MARK. */\nconst LRM = '\\u200E';\n\n/** The element's content for its truncation position or line cap. */\nfunction textBody(\n position: TextTruncate,\n children: TextContent,\n textValue: string | undefined,\n truncateKeep: TextTruncateKeep | undefined,\n maxLines: number | undefined,\n strong: boolean,\n): TextContent {\n const content = strong ? <strong>{children}</strong> : children;\n switch (position) {\n case 'start':\n // KF-FM2NWN: left-to-right marks keep the text's own order and edge\n // punctuation in the right-to-left clip box. An isolating `dir=\"ltr\"`\n // span would too, but WebKit then draws no leading ellipsis once the\n // text has a space.\n return (\n <span class=\"kui-text__truncate-start\">\n {LRM}\n {content}\n {LRM}\n </span>\n );\n case 'middle':\n return (\n <TruncateMiddle\n parts={splitMiddle(textValue!, truncateKeep ?? 'segment')}\n strong={strong}\n />\n );\n case 'end':\n return maxLines === undefined ? (\n content\n ) : (\n <span\n class=\"kui-text__clamp\"\n style={`--_kui-text-max-lines:${maxLines}`}\n >\n {content}\n </span>\n );\n }\n}\n\nfunction TruncateMiddle({\n parts: [head, tail],\n strong,\n}: {\n parts: [string, string];\n strong: boolean;\n}) {\n // A strong middle truncation keeps its two shrinking parts and marks each.\n const mark = (part: string) => (strong ? <strong>{part}</strong> : part);\n return (\n <span class=\"kui-text__truncate-middle\">\n <span class=\"kui-text__truncate-head\">{mark(head)}</span>\n {tail ? <span class=\"kui-text__truncate-tail\">{mark(tail)}</span> : ''}\n </span>\n );\n}\n\nexport type { Sides } from '../../../shared/layout/sides.js';\n"]}
|