@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
package/analyzer/index.mjs
CHANGED
|
@@ -245,9 +245,9 @@ function diagnostic(ruleId, at, message, evidence, chain, adoption = false) {
|
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
function
|
|
248
|
+
function suppressingException(item, profile, root) {
|
|
249
249
|
const target = relative(root, item.location.file).replaceAll('\\', '/');
|
|
250
|
-
return (profile?.exceptions ?? []).
|
|
250
|
+
return (profile?.exceptions ?? []).find(
|
|
251
251
|
(exception) =>
|
|
252
252
|
exception.rules?.includes(item.ruleId) && exception.target === target,
|
|
253
253
|
);
|
|
@@ -303,9 +303,14 @@ function reachableStyleFacts(file, imports, styleFacts) {
|
|
|
303
303
|
const result = new Map();
|
|
304
304
|
for (const style of reachableStyleFiles(file, imports, styleFacts)) {
|
|
305
305
|
for (const [className, facts] of styleFacts.get(style)) {
|
|
306
|
-
const current = result.get(className) ?? {
|
|
306
|
+
const current = result.get(className) ?? {
|
|
307
|
+
scroll: false,
|
|
308
|
+
inset: false,
|
|
309
|
+
surface: false,
|
|
310
|
+
};
|
|
307
311
|
current.scroll ||= facts.scroll;
|
|
308
312
|
current.inset ||= facts.inset;
|
|
313
|
+
current.surface ||= facts.surface;
|
|
309
314
|
current.styled ??= facts.styled;
|
|
310
315
|
result.set(className, current);
|
|
311
316
|
}
|
|
@@ -981,6 +986,7 @@ async function inspectCss(
|
|
|
981
986
|
const record = cssFacts.get(className) ?? {
|
|
982
987
|
scroll: false,
|
|
983
988
|
inset: false,
|
|
989
|
+
surface: false,
|
|
984
990
|
};
|
|
985
991
|
record.styled ??= {
|
|
986
992
|
stylesheet: file,
|
|
@@ -1110,6 +1116,7 @@ async function inspectCss(
|
|
|
1110
1116
|
const record = cssFacts.get(className) ?? {
|
|
1111
1117
|
scroll: false,
|
|
1112
1118
|
inset: false,
|
|
1119
|
+
surface: false,
|
|
1113
1120
|
};
|
|
1114
1121
|
if (
|
|
1115
1122
|
/^overflow(?:-|$)/.test(decl.prop) &&
|
|
@@ -1118,13 +1125,73 @@ async function inspectCss(
|
|
|
1118
1125
|
record.scroll = true;
|
|
1119
1126
|
if (/^padding(?:-|$)/.test(decl.prop) && decl.value !== '0')
|
|
1120
1127
|
record.inset = true;
|
|
1128
|
+
if (
|
|
1129
|
+
/^(?:background(?:-color|-image)?|border(?:-(?:top|right|bottom|left))?|outline)$/.test(
|
|
1130
|
+
decl.prop,
|
|
1131
|
+
) &&
|
|
1132
|
+
!/^(?:0(?:px|rem|em)?(?:\s|$)|none\b|transparent\b|initial\b|inherit\b|unset\b|revert\b)/i.test(
|
|
1133
|
+
decl.value.trim(),
|
|
1134
|
+
)
|
|
1135
|
+
)
|
|
1136
|
+
record.surface = true;
|
|
1121
1137
|
cssFacts.set(className, record);
|
|
1122
1138
|
}
|
|
1123
1139
|
});
|
|
1124
1140
|
});
|
|
1125
1141
|
}
|
|
1126
1142
|
|
|
1127
|
-
function
|
|
1143
|
+
function finiteClassStrings(expression, finiteTypeValues, inTemplate = false) {
|
|
1144
|
+
if (!expression) return undefined;
|
|
1145
|
+
if (ts.isParenthesizedExpression(expression))
|
|
1146
|
+
return finiteClassStrings(
|
|
1147
|
+
expression.expression,
|
|
1148
|
+
finiteTypeValues,
|
|
1149
|
+
inTemplate,
|
|
1150
|
+
);
|
|
1151
|
+
if (ts.isStringLiteralLike(expression)) return [expression.text];
|
|
1152
|
+
if (ts.isConditionalExpression(expression)) {
|
|
1153
|
+
const yes = finiteClassStrings(
|
|
1154
|
+
expression.whenTrue,
|
|
1155
|
+
finiteTypeValues,
|
|
1156
|
+
inTemplate,
|
|
1157
|
+
);
|
|
1158
|
+
const no = finiteClassStrings(
|
|
1159
|
+
expression.whenFalse,
|
|
1160
|
+
finiteTypeValues,
|
|
1161
|
+
inTemplate,
|
|
1162
|
+
);
|
|
1163
|
+
return yes && no && yes.length + no.length <= 32
|
|
1164
|
+
? [...new Set([...yes, ...no])]
|
|
1165
|
+
: undefined;
|
|
1166
|
+
}
|
|
1167
|
+
const combine = (left, right) =>
|
|
1168
|
+
left && right && left.length * right.length <= 32
|
|
1169
|
+
? [...new Set(left.flatMap((a) => right.map((b) => a + b)))]
|
|
1170
|
+
: undefined;
|
|
1171
|
+
if (
|
|
1172
|
+
ts.isBinaryExpression(expression) &&
|
|
1173
|
+
expression.operatorToken.kind === ts.SyntaxKind.PlusToken
|
|
1174
|
+
)
|
|
1175
|
+
return combine(
|
|
1176
|
+
finiteClassStrings(expression.left, finiteTypeValues, inTemplate),
|
|
1177
|
+
finiteClassStrings(expression.right, finiteTypeValues, inTemplate),
|
|
1178
|
+
);
|
|
1179
|
+
if (ts.isTemplateExpression(expression)) {
|
|
1180
|
+
let values = [expression.head.text];
|
|
1181
|
+
for (const span of expression.templateSpans) {
|
|
1182
|
+
values = combine(
|
|
1183
|
+
values,
|
|
1184
|
+
finiteClassStrings(span.expression, finiteTypeValues, true),
|
|
1185
|
+
);
|
|
1186
|
+
values = combine(values, [span.literal.text]);
|
|
1187
|
+
if (!values) return undefined;
|
|
1188
|
+
}
|
|
1189
|
+
return values;
|
|
1190
|
+
}
|
|
1191
|
+
return inTemplate ? finiteTypeValues?.(expression) : undefined;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
function literalClasses(attribute, finiteTypeValues) {
|
|
1128
1195
|
if (!attribute?.initializer) return { values: [], dynamic: false };
|
|
1129
1196
|
const value = attribute.initializer;
|
|
1130
1197
|
if (ts.isStringLiteral(value))
|
|
@@ -1138,6 +1205,20 @@ function literalClasses(attribute) {
|
|
|
1138
1205
|
values: value.expression.text.split(/\s+/).filter(Boolean),
|
|
1139
1206
|
dynamic: false,
|
|
1140
1207
|
};
|
|
1208
|
+
if (ts.isJsxExpression(value) && value.expression) {
|
|
1209
|
+
const strings = finiteClassStrings(value.expression, finiteTypeValues);
|
|
1210
|
+
if (strings) {
|
|
1211
|
+
const values = [
|
|
1212
|
+
...new Set(
|
|
1213
|
+
strings.flatMap((item) => item.split(/\s+/).filter(Boolean)),
|
|
1214
|
+
),
|
|
1215
|
+
];
|
|
1216
|
+
return {
|
|
1217
|
+
values,
|
|
1218
|
+
dynamic: values.some((className) => /^(?:kui-|wa-)/.test(className)),
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1141
1222
|
return { values: [], dynamic: true };
|
|
1142
1223
|
}
|
|
1143
1224
|
|
|
@@ -1622,6 +1703,42 @@ function inspectTsx(
|
|
|
1622
1703
|
true,
|
|
1623
1704
|
ts.ScriptKind.TSX,
|
|
1624
1705
|
);
|
|
1706
|
+
let typedSource;
|
|
1707
|
+
let typeChecker;
|
|
1708
|
+
const finiteTypeValues = (expression) => {
|
|
1709
|
+
if (!typeChecker) {
|
|
1710
|
+
const program = ts.createProgram({
|
|
1711
|
+
rootNames: [file],
|
|
1712
|
+
options: { ...compilerOptions, noEmit: true, skipLibCheck: true },
|
|
1713
|
+
});
|
|
1714
|
+
typedSource = program.getSourceFile(file);
|
|
1715
|
+
typeChecker = program.getTypeChecker();
|
|
1716
|
+
}
|
|
1717
|
+
if (!typedSource) return undefined;
|
|
1718
|
+
const start = expression.getStart(source);
|
|
1719
|
+
const end = expression.getEnd();
|
|
1720
|
+
let typedNode;
|
|
1721
|
+
const find = (node) => {
|
|
1722
|
+
if (node.getStart(typedSource) === start && node.getEnd() === end) {
|
|
1723
|
+
typedNode = node;
|
|
1724
|
+
return;
|
|
1725
|
+
}
|
|
1726
|
+
ts.forEachChild(node, (child) => {
|
|
1727
|
+
if (!typedNode && child.pos <= start && child.end >= end) find(child);
|
|
1728
|
+
});
|
|
1729
|
+
};
|
|
1730
|
+
find(typedSource);
|
|
1731
|
+
if (!typedNode) return undefined;
|
|
1732
|
+
const type = typeChecker.getTypeAtLocation(typedNode);
|
|
1733
|
+
const members = type.isUnion() ? type.types : [type];
|
|
1734
|
+
if (members.length > 32) return undefined;
|
|
1735
|
+
const values = members.map((member) =>
|
|
1736
|
+
member.flags & ts.TypeFlags.StringLiteral ? member.value : undefined,
|
|
1737
|
+
);
|
|
1738
|
+
return values.every((value) => typeof value === 'string')
|
|
1739
|
+
? values
|
|
1740
|
+
: undefined;
|
|
1741
|
+
};
|
|
1625
1742
|
const imports = new Map();
|
|
1626
1743
|
const helperImports = new Map();
|
|
1627
1744
|
const namespaces = new Map();
|
|
@@ -1782,7 +1899,7 @@ function inspectTsx(
|
|
|
1782
1899
|
ts.isJsxAttribute(item) &&
|
|
1783
1900
|
['class', 'className'].includes(item.name.getText(source)),
|
|
1784
1901
|
);
|
|
1785
|
-
const classes = literalClasses(classAttribute);
|
|
1902
|
+
const classes = literalClasses(classAttribute, finiteTypeValues);
|
|
1786
1903
|
const at = location(file, opening, source);
|
|
1787
1904
|
if ((!entry && /^[a-z]/.test(tag)) || (componentMode && entry))
|
|
1788
1905
|
borrowedValues(
|
|
@@ -1866,6 +1983,15 @@ function inspectTsx(
|
|
|
1866
1983
|
const inset = classes.values.some(
|
|
1867
1984
|
(className) => cssFacts.get(className)?.inset,
|
|
1868
1985
|
);
|
|
1986
|
+
const surface =
|
|
1987
|
+
['input', 'select', 'textarea'].includes(tag) ||
|
|
1988
|
+
classes.values.some(
|
|
1989
|
+
(className) =>
|
|
1990
|
+
cssFacts.get(className)?.surface ||
|
|
1991
|
+
facts.classEntries
|
|
1992
|
+
.get(className)
|
|
1993
|
+
?.some((owner) => owner.layout?.geometry?.role === 'surface'),
|
|
1994
|
+
);
|
|
1869
1995
|
const parent = stack.at(-1);
|
|
1870
1996
|
if (scroll && parent?.scroll)
|
|
1871
1997
|
diagnostics.push(
|
|
@@ -1877,7 +2003,7 @@ function inspectTsx(
|
|
|
1877
2003
|
[parent.label, entry?.key ?? tag],
|
|
1878
2004
|
),
|
|
1879
2005
|
);
|
|
1880
|
-
if (inset && parent?.inset)
|
|
2006
|
+
if (inset && parent?.inset && !surface)
|
|
1881
2007
|
diagnostics.push(
|
|
1882
2008
|
diagnostic(
|
|
1883
2009
|
'KUI-L004',
|
|
@@ -2332,12 +2458,24 @@ function recordDiagnosticDecisions(
|
|
|
2332
2458
|
suppressed: false,
|
|
2333
2459
|
activeConsumers: new Set(),
|
|
2334
2460
|
suppressedConsumers: new Set(),
|
|
2461
|
+
suppressedMatches: new Map(),
|
|
2335
2462
|
};
|
|
2336
2463
|
const consumer =
|
|
2337
2464
|
relative(root, context.startDirectory).replaceAll('\\', '/') || '.';
|
|
2338
|
-
|
|
2465
|
+
const exception = suppressingException(
|
|
2466
|
+
item,
|
|
2467
|
+
context.profileResult.profile,
|
|
2468
|
+
workspaceRoot,
|
|
2469
|
+
);
|
|
2470
|
+
if (exception) {
|
|
2339
2471
|
decision.suppressed = true;
|
|
2340
2472
|
decision.suppressedConsumers.add(consumer);
|
|
2473
|
+
const source =
|
|
2474
|
+
context.profileResult.provenance[`$exceptions.${exception.id}`];
|
|
2475
|
+
decision.suppressedMatches.set(
|
|
2476
|
+
JSON.stringify([source, exception.id, consumer]),
|
|
2477
|
+
{ item, exceptionId: exception.id, consumer, source },
|
|
2478
|
+
);
|
|
2341
2479
|
} else {
|
|
2342
2480
|
decision.active = true;
|
|
2343
2481
|
decision.activeConsumers.add(consumer);
|
|
@@ -2488,13 +2626,23 @@ function resolveDiagnosticDecisions(diagnosticDecisions) {
|
|
|
2488
2626
|
const suppressed = [...diagnosticDecisions.values()].filter(
|
|
2489
2627
|
(decision) => !decision.active && decision.suppressed,
|
|
2490
2628
|
).length;
|
|
2629
|
+
const suppressedEntries = [...diagnosticDecisions.values()]
|
|
2630
|
+
.flatMap((decision) => [...decision.suppressedMatches.values()])
|
|
2631
|
+
.sort(
|
|
2632
|
+
(a, b) =>
|
|
2633
|
+
a.item.location.file.localeCompare(b.item.location.file) ||
|
|
2634
|
+
a.item.location.line - b.item.location.line ||
|
|
2635
|
+
a.item.ruleId.localeCompare(b.item.ruleId) ||
|
|
2636
|
+
a.exceptionId.localeCompare(b.exceptionId) ||
|
|
2637
|
+
a.consumer.localeCompare(b.consumer),
|
|
2638
|
+
);
|
|
2491
2639
|
active.sort(
|
|
2492
2640
|
(a, b) =>
|
|
2493
2641
|
a.location.file.localeCompare(b.location.file) ||
|
|
2494
2642
|
a.location.line - b.location.line ||
|
|
2495
2643
|
a.ruleId.localeCompare(b.ruleId),
|
|
2496
2644
|
);
|
|
2497
|
-
return { active, suppressed };
|
|
2645
|
+
return { active, suppressed, suppressedEntries };
|
|
2498
2646
|
}
|
|
2499
2647
|
|
|
2500
2648
|
// Phase 7 (reporting): the portable report — project-relative paths, the
|
|
@@ -2502,10 +2650,12 @@ function resolveDiagnosticDecisions(diagnosticDecisions) {
|
|
|
2502
2650
|
// diagnostics, and the summary counts.
|
|
2503
2651
|
async function buildAnalysisReport({
|
|
2504
2652
|
root,
|
|
2653
|
+
workspaceRoot,
|
|
2505
2654
|
files,
|
|
2506
2655
|
profileContexts,
|
|
2507
2656
|
active,
|
|
2508
2657
|
suppressed,
|
|
2658
|
+
suppressedEntries,
|
|
2509
2659
|
}) {
|
|
2510
2660
|
const portablePath = (file) => {
|
|
2511
2661
|
if (!file || !isAbsolute(file)) return file;
|
|
@@ -2523,22 +2673,66 @@ async function buildAnalysisReport({
|
|
|
2523
2673
|
),
|
|
2524
2674
|
];
|
|
2525
2675
|
const profilePackageRoot = dirname(profileFiles[0] ?? root);
|
|
2676
|
+
const usedExceptions = new Set(
|
|
2677
|
+
suppressedEntries.map(({ source, exceptionId }) =>
|
|
2678
|
+
JSON.stringify([source, exceptionId]),
|
|
2679
|
+
),
|
|
2680
|
+
);
|
|
2681
|
+
const analyzedFiles = new Set(files);
|
|
2682
|
+
const exceptionWarnings = [];
|
|
2683
|
+
const visitedExceptions = new Set();
|
|
2684
|
+
for (const { profileResult } of resolvedContexts)
|
|
2685
|
+
for (const [index, exception] of (
|
|
2686
|
+
profileResult.profile?.exceptions ?? []
|
|
2687
|
+
).entries()) {
|
|
2688
|
+
if (!exception?.id || typeof exception.target !== 'string') continue;
|
|
2689
|
+
const source = profileResult.provenance[`$exceptions.${exception.id}`];
|
|
2690
|
+
const key = JSON.stringify([source, exception.id]);
|
|
2691
|
+
if (visitedExceptions.has(key)) continue;
|
|
2692
|
+
visitedExceptions.add(key);
|
|
2693
|
+
const target = resolve(workspaceRoot, exception.target);
|
|
2694
|
+
const relativeTarget = relative(workspaceRoot, target);
|
|
2695
|
+
if (relativeTarget === '..' || relativeTarget.startsWith('../')) continue;
|
|
2696
|
+
const exists = await stat(target).then(
|
|
2697
|
+
(details) => details.isFile(),
|
|
2698
|
+
() => false,
|
|
2699
|
+
);
|
|
2700
|
+
if (!exists)
|
|
2701
|
+
exceptionWarnings.push({
|
|
2702
|
+
code: 'KUI-P031',
|
|
2703
|
+
severity: 'warning',
|
|
2704
|
+
source,
|
|
2705
|
+
path: `$.exceptions[${index}].target`,
|
|
2706
|
+
message: `Exception ${exception.id} names missing target ${exception.target}.`,
|
|
2707
|
+
});
|
|
2708
|
+
else if (analyzedFiles.has(target) && !usedExceptions.has(key))
|
|
2709
|
+
exceptionWarnings.push({
|
|
2710
|
+
code: 'KUI-P032',
|
|
2711
|
+
severity: 'warning',
|
|
2712
|
+
source,
|
|
2713
|
+
path: `$.exceptions[${index}]`,
|
|
2714
|
+
message: `Exception ${exception.id} suppressed no diagnostic in ${exception.target}.`,
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2526
2717
|
const portableMessage = (message) =>
|
|
2527
2718
|
String(message)
|
|
2528
2719
|
.replaceAll(root, '<repo-root>')
|
|
2529
2720
|
.replaceAll(profilePackageRoot, '<package-root>');
|
|
2530
2721
|
const profileDiagnostics = [
|
|
2531
2722
|
...new Map(
|
|
2532
|
-
|
|
2533
|
-
.flatMap(
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2723
|
+
[
|
|
2724
|
+
...resolvedContexts.flatMap(
|
|
2725
|
+
({ profileResult }) => profileResult.diagnostics ?? [],
|
|
2726
|
+
),
|
|
2727
|
+
...exceptionWarnings,
|
|
2728
|
+
].map((item) => [
|
|
2729
|
+
JSON.stringify([item.code, item.source, item.path, item.message]),
|
|
2730
|
+
{
|
|
2731
|
+
...item,
|
|
2732
|
+
source: portablePath(item.source),
|
|
2733
|
+
message: portableMessage(item.message),
|
|
2734
|
+
},
|
|
2735
|
+
]),
|
|
2542
2736
|
).values(),
|
|
2543
2737
|
];
|
|
2544
2738
|
return {
|
|
@@ -2565,10 +2759,18 @@ async function buildAnalysisReport({
|
|
|
2565
2759
|
}
|
|
2566
2760
|
: {}),
|
|
2567
2761
|
})),
|
|
2762
|
+
suppressed: suppressedEntries.map(({ item, exceptionId, consumer }) => ({
|
|
2763
|
+
ruleId: item.ruleId,
|
|
2764
|
+
location: { ...item.location, file: portablePath(item.location.file) },
|
|
2765
|
+
exceptionId,
|
|
2766
|
+
consumer,
|
|
2767
|
+
})),
|
|
2568
2768
|
summary: {
|
|
2569
2769
|
errors:
|
|
2570
2770
|
active.filter((item) => item.severity === 'error').length +
|
|
2571
|
-
profileDiagnostics.length,
|
|
2771
|
+
profileDiagnostics.filter((item) => item.severity !== 'warning').length,
|
|
2772
|
+
warnings: profileDiagnostics.filter((item) => item.severity === 'warning')
|
|
2773
|
+
.length,
|
|
2572
2774
|
review: active.filter((item) => item.severity === 'review').length,
|
|
2573
2775
|
suppressed,
|
|
2574
2776
|
},
|
|
@@ -2655,21 +2857,23 @@ export async function analyzeUiProject({
|
|
|
2655
2857
|
ownership,
|
|
2656
2858
|
ownershipContext,
|
|
2657
2859
|
});
|
|
2658
|
-
const { active, suppressed } =
|
|
2860
|
+
const { active, suppressed, suppressedEntries } =
|
|
2659
2861
|
resolveDiagnosticDecisions(diagnosticDecisions);
|
|
2660
2862
|
return buildAnalysisReport({
|
|
2661
2863
|
root,
|
|
2864
|
+
workspaceRoot,
|
|
2662
2865
|
files,
|
|
2663
2866
|
profileContexts,
|
|
2664
2867
|
active,
|
|
2665
2868
|
suppressed,
|
|
2869
|
+
suppressedEntries,
|
|
2666
2870
|
});
|
|
2667
2871
|
}
|
|
2668
2872
|
|
|
2669
2873
|
export function formatUiAnalysisText(report) {
|
|
2670
2874
|
const lines = report.profile.diagnostics.map(
|
|
2671
2875
|
(item) =>
|
|
2672
|
-
`${item.source ?? '<profile>'}:1:1 error ${item.code} ${item.message}`,
|
|
2876
|
+
`${item.source ?? '<profile>'}:1:1 ${item.severity ?? 'error'} ${item.code} ${item.message}`,
|
|
2673
2877
|
);
|
|
2674
2878
|
lines.push(
|
|
2675
2879
|
...report.diagnostics.map(
|
|
@@ -2678,7 +2882,7 @@ export function formatUiAnalysisText(report) {
|
|
|
2678
2882
|
),
|
|
2679
2883
|
);
|
|
2680
2884
|
lines.push(
|
|
2681
|
-
`Kerf UI analysis: ${report.summary.errors} error(s), ${report.summary.review} review finding(s), ${report.summary.suppressed} suppressed.`,
|
|
2885
|
+
`Kerf UI analysis: ${report.summary.errors} error(s), ${report.summary.warnings} warning(s), ${report.summary.review} review finding(s), ${report.summary.suppressed} suppressed.`,
|
|
2682
2886
|
);
|
|
2683
2887
|
return lines.join('\n');
|
|
2684
2888
|
}
|
|
@@ -2702,7 +2906,7 @@ export function formatUiAnalysisSarif(report) {
|
|
|
2702
2906
|
results: [
|
|
2703
2907
|
...report.profile.diagnostics.map((item) => ({
|
|
2704
2908
|
ruleId: item.code,
|
|
2705
|
-
level: 'error',
|
|
2909
|
+
level: item.severity === 'warning' ? 'warning' : 'error',
|
|
2706
2910
|
message: { text: item.message },
|
|
2707
2911
|
locations: [
|
|
2708
2912
|
{
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"files",
|
|
11
11
|
"profile",
|
|
12
12
|
"diagnostics",
|
|
13
|
+
"suppressed",
|
|
13
14
|
"summary"
|
|
14
15
|
],
|
|
15
16
|
"properties": {
|
|
@@ -51,11 +52,35 @@
|
|
|
51
52
|
"additionalProperties": false
|
|
52
53
|
}
|
|
53
54
|
},
|
|
55
|
+
"suppressed": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"items": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"required": ["ruleId", "location", "exceptionId", "consumer"],
|
|
60
|
+
"properties": {
|
|
61
|
+
"ruleId": { "pattern": "^KUI-L[0-9]{3}$" },
|
|
62
|
+
"location": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"required": ["file", "line", "column"],
|
|
65
|
+
"properties": {
|
|
66
|
+
"file": { "type": "string" },
|
|
67
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
68
|
+
"column": { "type": "integer", "minimum": 1 }
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": false
|
|
71
|
+
},
|
|
72
|
+
"exceptionId": { "type": "string" },
|
|
73
|
+
"consumer": { "type": "string" }
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": false
|
|
76
|
+
}
|
|
77
|
+
},
|
|
54
78
|
"summary": {
|
|
55
79
|
"type": "object",
|
|
56
|
-
"required": ["errors", "review", "suppressed"],
|
|
80
|
+
"required": ["errors", "warnings", "review", "suppressed"],
|
|
57
81
|
"properties": {
|
|
58
82
|
"errors": { "type": "integer", "minimum": 0 },
|
|
83
|
+
"warnings": { "type": "integer", "minimum": 0 },
|
|
59
84
|
"review": { "type": "integer", "minimum": 0 },
|
|
60
85
|
"suppressed": { "type": "integer", "minimum": 0 }
|
|
61
86
|
},
|
package/dist/catalog.js
CHANGED
|
@@ -28,8 +28,8 @@ import { ListItem } from './chunk-UWLJ7UEK.js';
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
import { ListHeader } from './chunk-
|
|
32
|
-
import { Text } from './chunk-
|
|
31
|
+
import { ListHeader } from './chunk-D4KXWVNG.js';
|
|
32
|
+
import { Text } from './chunk-44C2K6V6.js';
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { splitMiddle } from './chunk-
|
|
1
|
+
import { splitMiddle } from './chunk-GP3G3ZY3.js';
|
|
2
2
|
import { filterDataAttributes } from './chunk-BRDTP3RT.js';
|
|
3
|
-
import { jsx, jsxs } from 'kerfjs/jsx-runtime';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'kerfjs/jsx-runtime';
|
|
4
4
|
|
|
5
5
|
function FieldLabel({
|
|
6
6
|
children,
|
|
@@ -24,7 +24,8 @@ var textProtectedAttributes = /* @__PURE__ */ new Set([
|
|
|
24
24
|
"data-align",
|
|
25
25
|
"data-wrap",
|
|
26
26
|
"data-max-lines",
|
|
27
|
-
"data-truncate"
|
|
27
|
+
"data-truncate",
|
|
28
|
+
"data-truncate-priority"
|
|
28
29
|
]);
|
|
29
30
|
function Text({
|
|
30
31
|
variant: Variant = "p",
|
|
@@ -45,6 +46,7 @@ function Text({
|
|
|
45
46
|
maxLines,
|
|
46
47
|
truncate,
|
|
47
48
|
truncateKeep,
|
|
49
|
+
truncatePriority,
|
|
48
50
|
children,
|
|
49
51
|
class: classValue = "",
|
|
50
52
|
className = "",
|
|
@@ -64,6 +66,10 @@ function Text({
|
|
|
64
66
|
throw new RangeError(
|
|
65
67
|
'Text truncateKeep requires truncate="middle" and a positive integer or "segment"'
|
|
66
68
|
);
|
|
69
|
+
if (truncatePriority !== void 0 && (position !== "middle" || !["head", "suffix"].includes(truncatePriority)))
|
|
70
|
+
throw new RangeError(
|
|
71
|
+
'Text truncatePriority requires truncate="middle" and one of head or suffix'
|
|
72
|
+
);
|
|
67
73
|
const textValue = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
68
74
|
if (position === "middle" && textValue === void 0)
|
|
69
75
|
throw new TypeError(
|
|
@@ -91,6 +97,7 @@ function Text({
|
|
|
91
97
|
"data-wrap": wrap === "normal" ? void 0 : wrap,
|
|
92
98
|
"data-max-lines": maxLines === void 0 ? void 0 : String(maxLines),
|
|
93
99
|
"data-truncate": position === "end" ? void 0 : position,
|
|
100
|
+
"data-truncate-priority": position === "middle" && truncatePriority === "suffix" ? "suffix" : void 0,
|
|
94
101
|
title,
|
|
95
102
|
style: color === void 0 ? style : `${style === void 0 || style === null ? "" : `${style};`}color:${color}`,
|
|
96
103
|
children: textBody(
|
|
@@ -98,6 +105,7 @@ function Text({
|
|
|
98
105
|
children,
|
|
99
106
|
textValue,
|
|
100
107
|
truncateKeep,
|
|
108
|
+
truncatePriority,
|
|
101
109
|
maxLines,
|
|
102
110
|
weight === "strong"
|
|
103
111
|
)
|
|
@@ -105,7 +113,7 @@ function Text({
|
|
|
105
113
|
);
|
|
106
114
|
}
|
|
107
115
|
var LRM = "\u200E";
|
|
108
|
-
function textBody(position, children, textValue, truncateKeep, maxLines, strong) {
|
|
116
|
+
function textBody(position, children, textValue, truncateKeep, truncatePriority, maxLines, strong) {
|
|
109
117
|
const content = strong ? /* @__PURE__ */ jsx("strong", { children }) : children;
|
|
110
118
|
switch (position) {
|
|
111
119
|
case "start":
|
|
@@ -119,7 +127,8 @@ function textBody(position, children, textValue, truncateKeep, maxLines, strong)
|
|
|
119
127
|
TruncateMiddle,
|
|
120
128
|
{
|
|
121
129
|
parts: splitMiddle(textValue, truncateKeep ?? "segment"),
|
|
122
|
-
strong
|
|
130
|
+
strong,
|
|
131
|
+
suffixPriority: truncatePriority === "suffix"
|
|
123
132
|
}
|
|
124
133
|
);
|
|
125
134
|
case "end":
|
|
@@ -135,15 +144,30 @@ function textBody(position, children, textValue, truncateKeep, maxLines, strong)
|
|
|
135
144
|
}
|
|
136
145
|
function TruncateMiddle({
|
|
137
146
|
parts: [head, tail],
|
|
138
|
-
strong
|
|
147
|
+
strong,
|
|
148
|
+
suffixPriority
|
|
139
149
|
}) {
|
|
140
150
|
const mark = (part) => strong ? /* @__PURE__ */ jsx("strong", { children: part }) : part;
|
|
141
151
|
return /* @__PURE__ */ jsxs("span", { class: "kui-text__truncate-middle", children: [
|
|
142
|
-
/* @__PURE__ */ jsx("span", { class: "kui-text__truncate-head", children:
|
|
152
|
+
/* @__PURE__ */ jsx("span", { class: "kui-text__truncate-head", children: suffixPriority ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
153
|
+
/* @__PURE__ */ jsx("span", { class: "kui-text__truncate-head-sizer", "aria-hidden": "true", children: mark(head) }),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { class: "kui-text__truncate-head-clip", children: /* @__PURE__ */ jsx("span", { class: "kui-text__truncate-head-content", children: mark(head) }) })
|
|
155
|
+
] }) : mark(head) }),
|
|
143
156
|
tail ? /* @__PURE__ */ jsx("span", { class: "kui-text__truncate-tail", children: mark(tail) }) : ""
|
|
144
157
|
] });
|
|
145
158
|
}
|
|
159
|
+
function Mark({ children, current = false }) {
|
|
160
|
+
return /* @__PURE__ */ jsx(
|
|
161
|
+
"mark",
|
|
162
|
+
{
|
|
163
|
+
class: "kui-text__mark",
|
|
164
|
+
"data-current": current ? "true" : void 0,
|
|
165
|
+
"aria-current": current ? "true" : void 0,
|
|
166
|
+
children
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
146
170
|
|
|
147
|
-
export { FieldLabel, Text };
|
|
171
|
+
export { FieldLabel, Mark, Text };
|
|
148
172
|
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
173
|
+
//# sourceMappingURL=chunk-44C2K6V6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;ACyHA,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,eAAA;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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AM,yBAAA,EAA2B,QAAA,EAAA,IAAA,CAAK,IAAI,CAAA,EAAE,CAAA,GAAU;AAAA,GAAA,EACtE,CAAA;AAEJ;AAYO,SAAS,IAAA,CAAK,EAAE,QAAA,EAAU,OAAA,GAAU,OAAM,EAAc;AAC7D,EAAA,uBACEA,GAAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAM,gBAAA;AAAA,MACN,cAAA,EAAc,UAAU,MAAA,GAAS,MAAA;AAAA,MACjC,cAAA,EAAc,UAAU,MAAA,GAAS,MAAA;AAAA,MAEhC;AAAA;AAAA,GACH;AAEJ","file":"chunk-44C2K6V6.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 { SafeHtml } from 'kerfjs';\nimport 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 type MiddleTruncatePriority,\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\"` selects: a number of trailing\n * characters, or `segment` for the last path segment with its separator.\n */\nexport type TextTruncateKeep = MiddleTruncateKeep;\n/** Which part wins in a narrow middle-truncated box; defaults to `head`. */\nexport type TextTruncatePriority = MiddleTruncatePriority;\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 truncatePriority?: never;\n }\n | {\n /** Keep one line without an ellipsis. */\n wrap: 'nowrap';\n maxLines?: never;\n truncate?: never;\n truncateKeep?: never;\n truncatePriority?: 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 * Narrow-box policy for `truncate=\"middle\"`: `head` (default)\n * reserves a head sliver and ellipsizes the suffix; `suffix` keeps\n * the suffix whole while the head shrinks to an ellipsis or nothing.\n */\n truncatePriority?: TextTruncatePriority;\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 'data-truncate-priority',\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 truncatePriority,\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 if (\n truncatePriority !== undefined &&\n (position !== 'middle' || !['head', 'suffix'].includes(truncatePriority))\n )\n throw new RangeError(\n 'Text truncatePriority requires truncate=\"middle\" and one of head or suffix',\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 data-truncate-priority={\n position === 'middle' && truncatePriority === 'suffix'\n ? 'suffix'\n : undefined\n }\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 truncatePriority,\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 truncatePriority: TextTruncatePriority | 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 suffixPriority={truncatePriority === 'suffix'}\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 suffixPriority,\n}: {\n parts: [string, string];\n strong: boolean;\n suffixPriority: 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\">\n {suffixPriority ? (\n <>\n <span class=\"kui-text__truncate-head-sizer\" aria-hidden=\"true\">\n {mark(head)}\n </span>\n <span class=\"kui-text__truncate-head-clip\">\n <span class=\"kui-text__truncate-head-content\">{mark(head)}</span>\n </span>\n </>\n ) : (\n mark(head)\n )}\n </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\nexport interface MarkProps {\n /** Matched content; inherits the surrounding font, including code typography. */\n children: SafeHtml | string | number;\n /** Emphasize the active result among otherwise quiet matches. */\n current?: boolean;\n}\n\n/** A native text highlight for find-in-content results. */\nexport function Mark({ children, current = false }: MarkProps) {\n return (\n <mark\n class=\"kui-text__mark\"\n data-current={current ? 'true' : undefined}\n aria-current={current ? 'true' : undefined}\n >\n {children}\n </mark>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text } from './chunk-
|
|
1
|
+
import { Text } from './chunk-44C2K6V6.js';
|
|
2
2
|
import { Skeleton } from './chunk-LH7YRRY7.js';
|
|
3
3
|
import { DisclosureArrow } from './chunk-3UIZ36BP.js';
|
|
4
4
|
import { Badge } from './chunk-VHAYQGWR.js';
|
|
@@ -228,4 +228,4 @@ function ListHeader({
|
|
|
228
228
|
|
|
229
229
|
export { ListHeader };
|
|
230
230
|
|
|
231
|
-
//# sourceMappingURL=chunk-
|
|
231
|
+
//# sourceMappingURL=chunk-D4KXWVNG.js.map
|