@kerfjs/ui 5.0.0-beta.70 → 5.0.0-beta.71

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.
@@ -20,6 +20,7 @@ import {
20
20
  componentOwnershipFacts,
21
21
  contextualComponents,
22
22
  configurationFor,
23
+ ownsClassBlock,
23
24
  privateVariableOwner,
24
25
  reportGap,
25
26
  restyledComponents,
@@ -114,6 +115,13 @@ const adoptionRules = new Set([
114
115
  ]);
115
116
 
116
117
  const sourceExtensions = new Set(['.js', '.jsx', '.mjs', '.ts', '.tsx']);
118
+ function isTestModule(file) {
119
+ const path = file.replaceAll('\\', '/');
120
+ return (
121
+ /(?:^|\/)__tests__\//.test(path) ||
122
+ /\.(?:test|spec)\.(?:js|jsx|mjs|ts|tsx)$/.test(path)
123
+ );
124
+ }
117
125
  const spacingProperties = /^(?:margin|padding|gap|inset)(?:-|$)/;
118
126
  const approvedSpacing = new Set([0, 4, 8, 16, 24]);
119
127
  async function collectFiles(root, paths) {
@@ -441,6 +449,7 @@ function catalogFacts(entries) {
441
449
  const publicTokens = new Set();
442
450
  const publicParts = new Map();
443
451
  const classEntries = new Map();
452
+ const blockEntries = new Map();
444
453
  const exportEntries = new Map();
445
454
  const addExport = (name, entry) => {
446
455
  const candidates = exportEntries.get(name) ?? [];
@@ -453,11 +462,20 @@ function catalogFacts(entries) {
453
462
  const name = typeof item === 'string' ? item : item.name;
454
463
  if (isComponentExport(name)) addExport(name, entry);
455
464
  }
456
- for (const className of entry.boundaries?.publicClasses ?? []) {
465
+ for (const className of new Set(
466
+ [
467
+ entry.boundaries?.rootClass,
468
+ ...(entry.boundaries?.publicClasses ?? []),
469
+ ].filter(Boolean),
470
+ )) {
457
471
  publicClasses.add(className);
458
472
  const owners = classEntries.get(className) ?? [];
459
473
  owners.push(entry);
460
474
  classEntries.set(className, owners);
475
+ const block = bemBlock(className);
476
+ const blockOwners = blockEntries.get(block) ?? [];
477
+ if (!blockOwners.includes(entry)) blockOwners.push(entry);
478
+ blockEntries.set(block, blockOwners);
461
479
  }
462
480
  for (const token of entry.boundaries?.publicTokens ?? [])
463
481
  publicTokens.add(token);
@@ -473,6 +491,7 @@ function catalogFacts(entries) {
473
491
  publicTokens,
474
492
  publicParts,
475
493
  classEntries,
494
+ blockEntries,
476
495
  exportEntries,
477
496
  ownership: componentOwnershipFacts(entries),
478
497
  };
@@ -553,6 +572,46 @@ function inferOwnedClasses(entries, contents, imports) {
553
572
  });
554
573
  }
555
574
 
575
+ async function ownershipGroupEntries(groups, root, contents) {
576
+ if (!groups?.length) return [];
577
+ const manifest = JSON.parse(
578
+ await readFile(resolve(root, 'package.json'), 'utf8'),
579
+ );
580
+ return Promise.all(
581
+ groups.map(async (group, index) => {
582
+ const classes = new Set();
583
+ for (const style of group.styleSources) {
584
+ const file = resolve(root, style);
585
+ let css = contents.get(file);
586
+ if (css === undefined)
587
+ try {
588
+ css = await readFile(file, 'utf8');
589
+ } catch {
590
+ // A missing configured file owns no classes.
591
+ }
592
+ if (!css) continue;
593
+ try {
594
+ postcss.parse(css, { from: file }).walkRules((rule) => {
595
+ for (const name of subjectClasses(rule.selector)) classes.add(name);
596
+ });
597
+ } catch {
598
+ // The normal stylesheet pass reports malformed CSS.
599
+ }
600
+ }
601
+ return {
602
+ key: `${manifest.name}:ownership-group-${index + 1}`,
603
+ package: manifest.name,
604
+ id: `ownership-group-${index + 1}`,
605
+ name: `Ownership group ${index + 1}`,
606
+ catalogDirectory: root,
607
+ styleSources: group.styleSources,
608
+ ownershipGroupSources: group.sources,
609
+ boundaries: { publicClasses: [...classes] },
610
+ };
611
+ }),
612
+ );
613
+ }
614
+
556
615
  async function implicitOwnershipEntries(files, imports, root) {
557
616
  const found = [];
558
617
  const packages = new Map();
@@ -662,7 +721,7 @@ function inspectComponentOwnership(
662
721
  'KUI-L019',
663
722
  location(file, rule),
664
723
  via === 'descendant'
665
- ? `\`${name}\` reaches an unclassed descendant inside ${componentLabel(entry)} (${properties.join(', ')}); components own their styles. Configure it through ${configurationFor(entry)}. To place your own content in its context, style your own element. ${reportGap(entry)}`
724
+ ? `\`${name}\` reaches an unclassed descendant inside ${componentLabel(entry)} (${properties.join(', ')}); components own their styles. Use a child combinator or an own class to target your element, or configure the child through ${configurationFor(entry)}. ${reportGap(entry)}`
666
725
  : `\`${name}\` makes ${componentLabel(entry)} the subject of an application rule (${properties.join(', ')}); components own their styles. Configure it through ${configurationFor(entry)}. To place your own content in its context, style your own element (\`${name} > .your-element\`). ${reportGap(entry)}`,
667
726
  {
668
727
  selector: rule.selector,
@@ -675,12 +734,13 @@ function inspectComponentOwnership(
675
734
  adoption,
676
735
  ),
677
736
  );
678
- if (ownershipContext !== 'any' || !ownershipEvidence?.ownPackage) return;
737
+ if (ownershipContext === 'subject' || !ownershipEvidence?.ownPackage) return;
679
738
  for (const { entry, name, position } of contextualComponents(
680
739
  rule.selector,
681
740
  facts.ownership,
682
741
  isForeign,
683
742
  ownershipEvidence.ownPackage,
743
+ ownershipContext === 'any-package',
684
744
  )) {
685
745
  if (position === 'subject') continue;
686
746
  if (
@@ -693,7 +753,7 @@ function inspectComponentOwnership(
693
753
  diagnostic(
694
754
  'KUI-L019',
695
755
  location(file, rule),
696
- `\`${name}\` uses ${componentLabel(entry)} as ${position} selector context (${properties.join(', ')}); in strict component ownership, sibling classes cannot key this stylesheet. Configure the component through ${configurationFor(entry)}. ${reportGap(entry)}`,
756
+ `\`${name}\` uses ${componentLabel(entry)} as ${position} selector context (${properties.join(', ')}); foreign component handles cannot key this stylesheet in this ownership mode. Configure the component through ${configurationFor(entry)}. ${reportGap(entry)}`,
697
757
  {
698
758
  selector: rule.selector,
699
759
  component: entry.key,
@@ -995,8 +1055,10 @@ function literalClassValues(expression) {
995
1055
  function jsxOwnershipEvidence(style, facts, contents, root, compilerCache) {
996
1056
  const hooks = new Map();
997
1057
  const composedChildren = new Map();
1058
+ const composedDescendants = new Map();
998
1059
  const ambiguousHooks = new Set();
999
1060
  const ambiguousChildren = new Set();
1061
+ const ambiguousDescendants = new Set();
1000
1062
  const record = (map, ambiguous, key, entry) => {
1001
1063
  if (ambiguous.has(key)) return;
1002
1064
  if (map.has(key) && map.get(key).key !== entry.key) {
@@ -1021,6 +1083,27 @@ function jsxOwnershipEvidence(style, facts, contents, root, compilerCache) {
1021
1083
  true,
1022
1084
  ts.ScriptKind.TSX,
1023
1085
  );
1086
+ const localComponents = new Map();
1087
+ for (const statement of source.statements) {
1088
+ if (
1089
+ ts.isFunctionDeclaration(statement) &&
1090
+ statement.name &&
1091
+ statement.body
1092
+ )
1093
+ localComponents.set(statement.name.text, statement.body);
1094
+ if (!ts.isVariableStatement(statement)) continue;
1095
+ for (const declaration of statement.declarationList.declarations)
1096
+ if (
1097
+ ts.isIdentifier(declaration.name) &&
1098
+ declaration.initializer &&
1099
+ (ts.isArrowFunction(declaration.initializer) ||
1100
+ ts.isFunctionExpression(declaration.initializer))
1101
+ )
1102
+ localComponents.set(
1103
+ declaration.name.text,
1104
+ declaration.initializer.body,
1105
+ );
1106
+ }
1024
1107
  const imports = new Map();
1025
1108
  const namespaces = new Map();
1026
1109
  const compilerOptions = compilerOptionsFor(file, root, compilerCache);
@@ -1084,6 +1167,82 @@ function jsxOwnershipEvidence(style, facts, contents, root, compilerCache) {
1084
1167
  ['class', 'className'].includes(item.name.getText(source)),
1085
1168
  ),
1086
1169
  ).values;
1170
+ const returnedJsx = (body) => {
1171
+ if (!ts.isBlock(body)) return [body];
1172
+ const expressions = [];
1173
+ const visitReturns = (node) => {
1174
+ if (ts.isReturnStatement(node)) {
1175
+ if (node.expression) expressions.push(node.expression);
1176
+ return;
1177
+ }
1178
+ if (
1179
+ node !== body &&
1180
+ (ts.isFunctionDeclaration(node) ||
1181
+ ts.isFunctionExpression(node) ||
1182
+ ts.isArrowFunction(node))
1183
+ )
1184
+ return;
1185
+ ts.forEachChild(node, visitReturns);
1186
+ };
1187
+ visitReturns(body);
1188
+ return expressions;
1189
+ };
1190
+ const localReturns = (opening, seen) => {
1191
+ const name = opening.tagName.getText(source);
1192
+ const body = localComponents.get(name);
1193
+ if (!body || seen.has(name)) return undefined;
1194
+ return { name, expressions: returnedJsx(body) };
1195
+ };
1196
+ const composedBelow = (node, found, seen = new Set()) => {
1197
+ if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
1198
+ const opening = openingOf(node);
1199
+ const entry = entryFor(opening);
1200
+ if (entry) {
1201
+ for (const type of [
1202
+ entry.boundaries?.rootElement,
1203
+ ...(entry.boundaries?.descendantElements ?? []),
1204
+ ]) {
1205
+ if (!type) continue;
1206
+ const entries = found.get(type) ?? new Set();
1207
+ entries.add(entry);
1208
+ found.set(type, entries);
1209
+ }
1210
+ return;
1211
+ }
1212
+ const local = localReturns(opening, seen);
1213
+ if (local) {
1214
+ const next = new Set([...seen, local.name]);
1215
+ for (const expression of local.expressions)
1216
+ composedBelow(expression, found, next);
1217
+ return;
1218
+ }
1219
+ if (ts.isJsxElement(node))
1220
+ for (const child of node.children) composedBelow(child, found, seen);
1221
+ return;
1222
+ }
1223
+ if (ts.isJsxFragment(node)) {
1224
+ for (const child of node.children) composedBelow(child, found, seen);
1225
+ return;
1226
+ }
1227
+ ts.forEachChild(node, (child) => composedBelow(child, found, seen));
1228
+ };
1229
+ const expandedRoots = (node, seen = new Set()) => {
1230
+ if (ts.isJsxFragment(node))
1231
+ return node.children.flatMap((child) => expandedRoots(child, seen));
1232
+ if (!ts.isJsxElement(node) && !ts.isJsxSelfClosingElement(node)) {
1233
+ const roots = [];
1234
+ ts.forEachChild(node, (child) =>
1235
+ roots.push(...expandedRoots(child, seen)),
1236
+ );
1237
+ return roots;
1238
+ }
1239
+ const local = localReturns(openingOf(node), seen);
1240
+ if (!local) return [node];
1241
+ const next = new Set([...seen, local.name]);
1242
+ return local.expressions.flatMap((expression) =>
1243
+ expandedRoots(expression, next),
1244
+ );
1245
+ };
1087
1246
  const visit = (node) => {
1088
1247
  if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
1089
1248
  const opening = openingOf(node);
@@ -1093,23 +1252,39 @@ function jsxOwnershipEvidence(style, facts, contents, root, compilerCache) {
1093
1252
  record(hooks, ambiguousHooks, name, entry);
1094
1253
  if (ts.isJsxElement(node)) {
1095
1254
  const parentClasses = classesOf(opening);
1255
+ if (parentClasses.length) {
1256
+ const descendants = new Map();
1257
+ for (const child of node.children)
1258
+ composedBelow(child, descendants);
1259
+ for (const [type, entries] of descendants)
1260
+ for (const entry of entries)
1261
+ for (const name of parentClasses)
1262
+ record(
1263
+ composedDescendants,
1264
+ ambiguousDescendants,
1265
+ `${name}|${type}`,
1266
+ entry,
1267
+ );
1268
+ }
1096
1269
  const possible = new Map();
1097
1270
  let dynamic = false;
1098
1271
  for (const child of node.children) {
1099
1272
  if (ts.isJsxExpression(child) && child.expression) dynamic = true;
1100
1273
  if (!ts.isJsxElement(child) && !ts.isJsxSelfClosingElement(child))
1101
1274
  continue;
1102
- const childOpening = openingOf(child);
1103
- const childEntry = entryFor(childOpening);
1104
- const type =
1105
- childEntry?.boundaries?.rootElement ??
1106
- (childEntry
1107
- ? undefined
1108
- : childOpening.tagName.getText(source).toLowerCase());
1109
- if (!type) continue;
1110
- const candidates = possible.get(type) ?? [];
1111
- candidates.push(childEntry);
1112
- possible.set(type, candidates);
1275
+ for (const root of expandedRoots(child)) {
1276
+ const childOpening = openingOf(root);
1277
+ const childEntry = entryFor(childOpening);
1278
+ const type =
1279
+ childEntry?.boundaries?.rootElement ??
1280
+ (childEntry
1281
+ ? undefined
1282
+ : childOpening.tagName.getText(source).toLowerCase());
1283
+ if (!type) continue;
1284
+ const candidates = possible.get(type) ?? [];
1285
+ candidates.push(childEntry);
1286
+ possible.set(type, candidates);
1287
+ }
1113
1288
  }
1114
1289
  if (!dynamic)
1115
1290
  for (const [type, candidates] of possible)
@@ -1133,7 +1308,7 @@ function jsxOwnershipEvidence(style, facts, contents, root, compilerCache) {
1133
1308
  };
1134
1309
  visit(source);
1135
1310
  }
1136
- return { componentMode: true, hooks, composedChildren };
1311
+ return { componentMode: true, hooks, composedChildren, composedDescendants };
1137
1312
  }
1138
1313
 
1139
1314
  function cssPreferred(contract) {
@@ -1308,6 +1483,7 @@ function inspectTsx(
1308
1483
  isForeign = () => true,
1309
1484
  packageDirectory,
1310
1485
  compilerOptions,
1486
+ componentMode = false,
1311
1487
  ) {
1312
1488
  const source = ts.createSourceFile(
1313
1489
  file,
@@ -1365,10 +1541,18 @@ function inspectTsx(
1365
1541
  }
1366
1542
  }
1367
1543
  const stack = [];
1544
+ const inspectBorrowedMarkup = !isTestModule(file);
1368
1545
  const borrowed = (className, node, via) => {
1369
- for (const owner of facts.classEntries.get(className) ?? []) {
1546
+ if (!inspectBorrowedMarkup) return;
1547
+ const owners =
1548
+ facts.classEntries.get(className) ??
1549
+ (componentMode && bemBlock(className) !== className
1550
+ ? facts.blockEntries.get(bemBlock(className))
1551
+ : undefined) ??
1552
+ [];
1553
+ for (const owner of owners) {
1370
1554
  if (
1371
- !isForeign(owner) ||
1555
+ !isForeign(owner, className) ||
1372
1556
  owner.boundaries?.placeableClasses?.includes(className)
1373
1557
  )
1374
1558
  continue;
@@ -1387,6 +1571,22 @@ function inspectTsx(
1387
1571
  const borrowedValues = (values, node, via) => {
1388
1572
  for (const className of new Set(values)) borrowed(className, node, via);
1389
1573
  };
1574
+ const templateGap = '\uE000';
1575
+ const rawHtmlClasses = (value) => {
1576
+ const classes = [];
1577
+ for (const match of value.matchAll(
1578
+ /<[a-z][^>]*\sclass\s*=\s*["']([^"']+)["']/gi,
1579
+ )) {
1580
+ const pieces = match[1].split(templateGap);
1581
+ for (const [index, piece] of pieces.entries()) {
1582
+ const words = piece.split(/\s+/).filter(Boolean);
1583
+ if (index > 0 && !/^\s/.test(piece)) words.shift();
1584
+ if (index < pieces.length - 1 && !/\s$/.test(piece)) words.pop();
1585
+ classes.push(...words);
1586
+ }
1587
+ }
1588
+ return classes;
1589
+ };
1390
1590
  const visit = (node) => {
1391
1591
  if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
1392
1592
  const opening = ts.isJsxElement(node) ? node.openingElement : node;
@@ -1411,7 +1611,7 @@ function inspectTsx(
1411
1611
  );
1412
1612
  const classes = literalClasses(classAttribute);
1413
1613
  const at = location(file, opening, source);
1414
- if (!entry && /^[a-z]/.test(tag))
1614
+ if ((!entry && /^[a-z]/.test(tag)) || (componentMode && entry))
1415
1615
  borrowedValues(
1416
1616
  classAttribute?.initializer &&
1417
1617
  ts.isJsxExpression(classAttribute.initializer)
@@ -1432,7 +1632,8 @@ function inspectTsx(
1432
1632
  );
1433
1633
  if (entry && isForeign(entry))
1434
1634
  for (const className of classes.values) {
1435
- if (facts.ownership.classOwners.has(className)) continue;
1635
+ if (ownsClassBlock(facts.ownership, className, componentMode))
1636
+ continue;
1436
1637
  const styled = cssFacts.get(className)?.styled;
1437
1638
  if (!styled) continue;
1438
1639
  diagnostics.push(
@@ -1585,11 +1786,15 @@ function inspectTsx(
1585
1786
  node.right,
1586
1787
  'className assignment',
1587
1788
  );
1588
- if (ts.isStringLiteralLike(node) && node.text.includes('<')) {
1589
- for (const match of node.text.matchAll(
1590
- /<[a-z][^>]*\sclass\s*=\s*["']([^"']+)["']/gi,
1591
- ))
1592
- borrowedValues(match[1].split(/\s+/).filter(Boolean), node, 'raw HTML');
1789
+ if (ts.isStringLiteralLike(node) && node.text.includes('<'))
1790
+ borrowedValues(rawHtmlClasses(node.text), node, 'raw HTML');
1791
+ if (ts.isTemplateExpression(node)) {
1792
+ const staticHtml = [
1793
+ node.head.text,
1794
+ ...node.templateSpans.map((span) => span.literal.text),
1795
+ ].join(templateGap);
1796
+ if (staticHtml.includes('<'))
1797
+ borrowedValues(rawHtmlClasses(staticHtml), node, 'raw HTML');
1593
1798
  }
1594
1799
  ts.forEachChild(node, visit);
1595
1800
  };
@@ -1604,6 +1809,7 @@ export async function analyzeUiProject({
1604
1809
  ownership = 'package',
1605
1810
  ownershipContext = 'subject',
1606
1811
  implicitComponentOwnership = false,
1812
+ ownershipGroups = [],
1607
1813
  profile: packageProfile = resolve(
1608
1814
  import.meta.dirname,
1609
1815
  '../ai/application-ui-profile.defaults.json',
@@ -1646,6 +1852,10 @@ export async function analyzeUiProject({
1646
1852
  ownership === 'component' && implicitComponentOwnership
1647
1853
  ? await implicitOwnershipEntries(files, imports, root)
1648
1854
  : [];
1855
+ const groupEntries =
1856
+ ownership === 'component'
1857
+ ? await ownershipGroupEntries(ownershipGroups, root, contents)
1858
+ : [];
1649
1859
  const profileContexts = new Map();
1650
1860
  const loadContext = async (file) => {
1651
1861
  const startDirectory = file === root ? root : dirname(file);
@@ -1669,6 +1879,7 @@ export async function analyzeUiProject({
1669
1879
  );
1670
1880
  const ownershipEntries = [
1671
1881
  ...entries,
1882
+ ...groupEntries,
1672
1883
  ...implicitEntries.filter(
1673
1884
  (entry) =>
1674
1885
  !catalogedSources.has(
@@ -1726,12 +1937,69 @@ export async function analyzeUiProject({
1726
1937
  );
1727
1938
  return packages.get(directory);
1728
1939
  };
1729
- const foreignTo = async (file) => {
1940
+ const styledBlocksByFile = new Map();
1941
+ const styledBlocksIn = (style) => {
1942
+ if (!styledBlocksByFile.has(style)) {
1943
+ const blocks = new Set();
1944
+ const css = contents.get(style);
1945
+ if (css)
1946
+ try {
1947
+ postcss.parse(css, { from: style }).walkRules((rule) => {
1948
+ for (const name of subjectClasses(rule.selector))
1949
+ blocks.add(bemBlock(name));
1950
+ });
1951
+ } catch {
1952
+ // Malformed CSS is reported by the normal inspection pass.
1953
+ }
1954
+ styledBlocksByFile.set(style, blocks);
1955
+ }
1956
+ return styledBlocksByFile.get(style);
1957
+ };
1958
+ const foreignTo = async (file, facts) => {
1730
1959
  const own = await packageOf(dirname(file));
1731
1960
  const source = own && relative(own.directory, file).replaceAll('\\', '/');
1732
- return (entry) => {
1961
+ const ownedStyles = new Set(imports.get(file) ?? []);
1962
+ if (ownership === 'component' && !file.endsWith('.css'))
1963
+ for (const entry of facts.entries) {
1964
+ if (
1965
+ entry.package !== own?.name ||
1966
+ !entry.componentSource ||
1967
+ !entry.catalogDirectory ||
1968
+ resolve(entry.catalogDirectory, entry.componentSource) !== file
1969
+ )
1970
+ continue;
1971
+ for (const style of entry.styleSources ?? [])
1972
+ ownedStyles.add(resolve(entry.catalogDirectory, style));
1973
+ }
1974
+ return (entry, className) => {
1733
1975
  if (entry.package !== own?.name) return true;
1734
1976
  if (ownership !== 'component') return false;
1977
+ if (entry.ownershipGroupSources) {
1978
+ const relativeFile = relative(entry.catalogDirectory, file).replaceAll(
1979
+ '\\',
1980
+ '/',
1981
+ );
1982
+ if (file.endsWith('.css'))
1983
+ return !entry.styleSources?.includes(relativeFile);
1984
+ return !entry.ownershipGroupSources.some((path) =>
1985
+ path.endsWith('/')
1986
+ ? relativeFile.startsWith(path)
1987
+ : relativeFile === path,
1988
+ );
1989
+ }
1990
+ if (
1991
+ !file.endsWith('.css') &&
1992
+ className &&
1993
+ entry.catalogDirectory &&
1994
+ entry.styleSources?.some((style) => {
1995
+ const path = resolve(entry.catalogDirectory, style);
1996
+ return (
1997
+ ownedStyles.has(path) &&
1998
+ styledBlocksIn(path).has(bemBlock(className))
1999
+ );
2000
+ })
2001
+ )
2002
+ return false;
1735
2003
  const ownedSources = file.endsWith('.css')
1736
2004
  ? entry.styleSources
1737
2005
  : [entry.componentSource];
@@ -1830,9 +2098,10 @@ export async function analyzeUiProject({
1830
2098
  reachableStyleFacts(file, imports, styleFacts),
1831
2099
  fileDiagnostics,
1832
2100
  adoption,
1833
- await foreignTo(file),
2101
+ await foreignTo(file, context.facts),
1834
2102
  own?.directory,
1835
2103
  compilerOptionsFor(file, root, compilerOptions),
2104
+ ownership === 'component',
1836
2105
  );
1837
2106
  recordDiagnostics(fileDiagnostics, context);
1838
2107
  }
@@ -1851,7 +2120,7 @@ export async function analyzeUiProject({
1851
2120
  new Map(),
1852
2121
  adoption,
1853
2122
  siblingOnLoud(file),
1854
- await foreignTo(file),
2123
+ await foreignTo(file, context.facts),
1855
2124
  ownership === 'component'
1856
2125
  ? {
1857
2126
  ...jsxOwnershipEvidence(
@@ -84,7 +84,15 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
84
84
  const snapExtras = /* @__PURE__ */ new WeakMap();
85
85
  const snapStrips = /* @__PURE__ */ new Set();
86
86
  const snapObserved = /* @__PURE__ */ new Set();
87
- const snapResizeObserver = view.ResizeObserver ? new view.ResizeObserver(() => syncSnapInRoot()) : void 0;
87
+ let snapFrame;
88
+ const scheduleSnapSync = () => {
89
+ if (disposed || snapFrame !== void 0) return;
90
+ snapFrame = view.requestAnimationFrame(() => {
91
+ snapFrame = void 0;
92
+ if (!disposed) syncSnapInRoot();
93
+ });
94
+ };
95
+ const snapResizeObserver = view.ResizeObserver ? new view.ResizeObserver(scheduleSnapSync) : void 0;
88
96
  const observeSnap = (element) => {
89
97
  if (snapObserved.has(element)) return;
90
98
  snapObserved.add(element);
@@ -455,6 +463,7 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
455
463
  });
456
464
  return () => {
457
465
  disposed = true;
466
+ if (snapFrame !== void 0) view.cancelAnimationFrame(snapFrame);
458
467
  selectionObserver.disconnect();
459
468
  snapResizeObserver?.disconnect();
460
469
  for (const strip of snapStrips) {
@@ -479,4 +488,4 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
479
488
 
480
489
  export { reorderTabs, wireTabBars };
481
490
 
482
- //# sourceMappingURL=chunk-T2E5WBCZ.js.map
491
+ //# sourceMappingURL=chunk-SLWCCHNP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wire-tab-bars.ts"],"names":["target"],"mappings":";AAkCA,IAAM,mBAAA,GAAsB,EAAA;AAC5B,IAAM,6BAAA,GAAgC,GAAA;AACtC,IAAM,6BAAA,GAAgC,GAAA;AAE/B,SAAS,WAAA,CACd,KAAA,EACA,KAAA,EACA,QAAA,EACA,UACA,QAAA,EACK;AACL,EAAA,IAAI,QAAA,KAAa,QAAA,EAAU,OA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,CAAoB,WAAA,EAAa,gBAAA,EAAkB,IAAI,CAAA;AAC5D,IAAA,KAAA,MAAW,MAAA,IAAU,cAAA,EAAgB,MAAA,CAAO,KAAA,CAAM,SAAA,GAAY,EAAA;AAC9D,IAAA,cAAA,CAAe,KAAA,EAAM;AAAA,EACvB,CAAA;AACF","file":"chunk-SLWCCHNP.js","sourcesContent":["import type { TabActivation } from './tab-bar.js';\n\nexport type TabReorderSource = 'pointer' | 'keyboard';\nexport type TabDropPosition = 'before' | 'after';\n\nexport interface TabReorder {\n barId: string;\n sourceId: string;\n targetId: string;\n position: TabDropPosition;\n source: TabReorderSource;\n}\n\nexport type { TabActivation } from './tab-bar.js';\n\nexport interface WireTabBarsOptions {\n onReorder: (change: TabReorder) => void;\n /**\n * How arrow / Home / End keys activate tabs (default `'automatic'`):\n * - `'automatic'` moves roving focus **and** selects the focused tab (clicks it).\n * - `'manual'` moves roving focus only; the user selects with Enter / Space / click\n * (the ARIA Tabs manual-activation pattern). Use this when activation is a heavy or\n * side-effecting action (e.g. a tab that loads a project) so arrowing through the\n * strip doesn't trigger it on every tab.\n *\n * A per-bar `data-tab-activation=\"manual\" | \"automatic\"` attribute (see the `TabBar`\n * `activation` prop) overrides this option for that strip.\n */\n activation?: TabActivation;\n}\n\ntype TabRoot = HTMLElement;\ntype TabBarRoot = HTMLElement;\n\nconst AUTO_SCROLL_EDGE_PX = 56;\nconst AUTO_SCROLL_MIN_PX_PER_SECOND = 180;\nconst AUTO_SCROLL_MAX_PX_PER_SECOND = 900;\n\nexport function reorderTabs<T>(\n items: readonly T[],\n getId: (item: T) => string,\n sourceId: string,\n targetId: string,\n position: TabDropPosition,\n): T[] {\n if (sourceId === targetId) return [...items];\n const source = items.find((item) => getId(item) === sourceId);\n if (!source || !items.some((item) => getId(item) === targetId))\n return [...items];\n const remaining = items.filter((item) => getId(item) !== sourceId);\n const targetIndex = remaining.findIndex((item) => getId(item) === targetId);\n remaining.splice(targetIndex + (position === 'after' ? 1 : 0), 0, source);\n return remaining;\n}\n\nfunction tabRoot(target: EventTarget | null): TabRoot | undefined {\n return target instanceof Element\n ? (target.closest<TabRoot>('[data-component=\"app-tab\"]') ?? undefined)\n : undefined;\n}\n\nfunction tabBar(tab: TabRoot): TabBarRoot | undefined {\n return tab.closest<TabBarRoot>('[data-component=\"tab-bar\"]') ?? undefined;\n}\n\nfunction tabId(tab: TabRoot): string | undefined {\n return tab.dataset.tabId || undefined;\n}\n\nfunction barId(bar: TabBarRoot): string | undefined {\n return bar.dataset.tabBarId || undefined;\n}\n\nfunction positionFor(event: DragEvent, tab: TabRoot): TabDropPosition {\n const bounds = tab.getBoundingClientRect();\n return event.clientX < bounds.left + bounds.width / 2 ? 'before' : 'after';\n}\n\nfunction tabsIn(bar: TabBarRoot): HTMLButtonElement[] {\n return [\n ...bar.querySelectorAll<HTMLButtonElement>(\n '[data-kui-tab-list] [role=\"tab\"]',\n ),\n ];\n}\n\nfunction reveal(tab: HTMLElement | null | undefined): void {\n tab?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n if (\n tab\n ?.closest('[data-kui-tab-list]')\n ?.querySelector(':scope > .kui-app-tab[data-pinned=\"true\"]')\n )\n revealInStrip(tab);\n}\n\n/**\n * Scroll a tab's own strip, and nothing else, so the tab is fully visible.\n * Used for selection changes the application makes without focus (adding and\n * selecting a tab): unlike `scrollIntoView`, it never scrolls the page to a\n * bar that is out of view.\n */\nfunction revealInStrip(tab: HTMLElement): void {\n const strip = tab.closest<HTMLElement>('[data-kui-tab-list]');\n if (!strip || strip.scrollWidth <= strip.clientWidth) return;\n const bounds = strip.getBoundingClientRect();\n const snap = strip.dataset.snapTabs === 'true';\n const box = snap\n ? (tab.closest<HTMLElement>('.kui-app-tab')?.getBoundingClientRect() ??\n tab.getBoundingClientRect())\n : tab.getBoundingClientRect();\n const pinned = strip.querySelector<HTMLElement>(\n ':scope > .kui-app-tab[data-pinned=\"true\"]',\n );\n if (pinned?.contains(tab)) return;\n const pinnedBox = pinned?.getBoundingClientRect();\n if (\n strip.ownerDocument.defaultView?.getComputedStyle(strip).direction === 'rtl'\n ) {\n const right = pinnedBox\n ? Math.min(bounds.right, pinnedBox.left)\n : bounds.right;\n if (snap) strip.scrollLeft += box.right - right;\n else if (box.right > right) strip.scrollLeft += box.right - right;\n else if (box.left < bounds.left)\n strip.scrollLeft -= Math.min(bounds.left - box.left, right - box.right);\n return;\n }\n const left = pinnedBox ? Math.max(bounds.left, pinnedBox.right) : bounds.left;\n if (snap) strip.scrollLeft += box.left - left;\n else if (box.left < left) strip.scrollLeft -= left - box.left;\n else if (box.right > bounds.right)\n strip.scrollLeft += Math.min(box.right - bounds.right, box.left - left);\n}\n\n/** The selected tab button of every bar below root, keyed by bar. */\nfunction selectedTabs(root: HTMLElement | Document) {\n const selected = new Map<TabBarRoot, HTMLElement>();\n root\n .querySelectorAll<HTMLElement>(\n '[data-kui-tab-list] [role=\"tab\"][aria-selected=\"true\"]',\n )\n .forEach((button) => {\n const tab = tabRoot(button);\n const bar = tab && tabBar(tab);\n if (bar && !selected.has(bar)) selected.set(bar, button);\n });\n return selected;\n}\n\n/** Wire reordering and keyboard navigation while leaving controlled state in the application. */\nexport function wireTabBars(\n root: HTMLElement | Document,\n { onReorder, activation = 'automatic' }: WireTabBarsOptions,\n): () => void {\n const ownerDocument = (\n root.nodeType === 9 ? (root as Document) : root.ownerDocument\n )!;\n const view = ownerDocument.defaultView!;\n // WebKit positions an RTL sticky flex child as though the negative scroll\n // offset were added to its inline-start inset. Measure the actual pinned\n // edge and correct only the displacement; Chromium and Firefox stay at 0.\n const pinnedOffsets = new WeakMap<HTMLElement, number>();\n const adjustedPinned = new Set<HTMLElement>();\n const snapExtras = new WeakMap<HTMLElement, number>();\n const snapStrips = new Set<HTMLElement>();\n const snapObserved = new Set<HTMLElement>();\n let snapFrame: number | undefined;\n const scheduleSnapSync = () => {\n if (disposed || snapFrame !== undefined) return;\n snapFrame = view.requestAnimationFrame(() => {\n snapFrame = undefined;\n if (!disposed) syncSnapInRoot();\n });\n };\n const snapResizeObserver = view.ResizeObserver\n ? new view.ResizeObserver(scheduleSnapSync)\n : undefined;\n const observeSnap = (element: HTMLElement) => {\n if (snapObserved.has(element)) return;\n snapObserved.add(element);\n snapResizeObserver?.observe(element);\n };\n const syncSnap = (strip: HTMLElement) => {\n const previousExtra = snapExtras.get(strip) ?? 0;\n if (strip.dataset.snapTabs !== 'true') {\n strip.style.removeProperty('--kui-tab-bar-snap-inset');\n strip.style.removeProperty('--kui-tab-bar-snap-end-extra');\n snapExtras.delete(strip);\n snapStrips.delete(strip);\n return;\n }\n snapStrips.add(strip);\n observeSnap(strip);\n const tabs = [\n ...strip.querySelectorAll<HTMLElement>(':scope > .kui-app-tab'),\n ];\n tabs.forEach(observeSnap);\n const pinned = tabs.find(\n (candidate) => candidate.dataset.pinned === 'true',\n );\n const last = tabs.at(-1);\n const bounds = strip.getBoundingClientRect();\n const pinnedBox = pinned?.getBoundingClientRect();\n const rtl = view.getComputedStyle(strip).direction === 'rtl';\n const inset = pinnedBox\n ? rtl\n ? bounds.right - pinnedBox.left\n : pinnedBox.right - bounds.left\n : 0;\n strip.style.setProperty(\n '--kui-tab-bar-snap-inset',\n `${Math.max(0, inset)}px`,\n );\n const baseMaximum = Math.max(\n 0,\n strip.scrollWidth - strip.clientWidth - previousExtra,\n );\n let extra = 0;\n if (baseMaximum > 0 && last && last !== pinned) {\n const lastBox = last.getBoundingClientRect();\n const desired = rtl\n ? -(\n strip.scrollLeft +\n lastBox.right -\n (pinnedBox?.left ?? bounds.right)\n )\n : strip.scrollLeft + lastBox.left - (pinnedBox?.right ?? bounds.left);\n extra = Math.max(0, desired - baseMaximum);\n }\n if (Math.abs(extra - previousExtra) >= 0.5) {\n strip.style.setProperty('--kui-tab-bar-snap-end-extra', `${extra}px`);\n snapExtras.set(strip, extra);\n }\n };\n const syncSnapInRoot = () => {\n for (const element of snapObserved)\n if (!root.contains(element)) {\n snapResizeObserver?.unobserve(element);\n snapObserved.delete(element);\n }\n for (const strip of snapStrips)\n if (!root.contains(strip)) {\n strip.style.removeProperty('--kui-tab-bar-snap-inset');\n strip.style.removeProperty('--kui-tab-bar-snap-end-extra');\n snapStrips.delete(strip);\n }\n root.querySelectorAll<HTMLElement>('[data-kui-tab-list]').forEach(syncSnap);\n };\n const syncPinned = (strip: HTMLElement) => {\n const pinned = strip.querySelector<HTMLElement>(\n ':scope > .kui-app-tab[data-pinned=\"true\"]',\n );\n if (!pinned) return;\n const previous = pinned.style.translate\n ? (pinnedOffsets.get(pinned) ?? 0)\n : 0;\n const style = view.getComputedStyle(strip);\n if (style.direction !== 'rtl' || strip.scrollWidth <= strip.clientWidth) {\n if (previous !== 0) pinned.style.translate = '';\n pinnedOffsets.set(pinned, 0);\n return;\n }\n const targetRight =\n strip.getBoundingClientRect().right -\n (Number.parseFloat(style.borderRightWidth) || 0) -\n (Number.parseFloat(style.paddingRight) || 0);\n const rawRight = pinned.getBoundingClientRect().right - previous;\n const delta = targetRight - rawRight;\n const next = Math.abs(delta) < 0.5 ? 0 : delta;\n if (next !== previous) pinned.style.translate = next ? `${next}px 0` : '';\n pinnedOffsets.set(pinned, next);\n adjustedPinned.add(pinned);\n };\n const syncPinnedInRoot = () =>\n root\n .querySelectorAll<HTMLElement>('[data-kui-tab-list]')\n .forEach(syncPinned);\n const onStripScroll = (event: Event) => {\n const target = event.target;\n if (target instanceof HTMLElement && target.matches('[data-kui-tab-list]'))\n syncPinned(target);\n };\n // CSS snap settles direct gestures in most engines. WebKit can leave a\n // programmatic smooth scroll between snap points, so normalize its final\n // position to the nearest whole peer at the pinned inset.\n const onStripScrollEnd = (event: Event) => {\n const strip = event.target;\n if (\n !(strip instanceof HTMLElement) ||\n !strip.matches('[data-kui-tab-list][data-snap-tabs=\"true\"]') ||\n Math.abs(strip.scrollLeft) < 0.5\n )\n return;\n const peers = [\n ...strip.querySelectorAll<HTMLElement>(\n ':scope > .kui-app-tab:not([data-pinned=\"true\"])',\n ),\n ];\n if (!peers.length) return;\n const bounds = strip.getBoundingClientRect();\n const pinned = strip.querySelector<HTMLElement>(\n ':scope > .kui-app-tab[data-pinned=\"true\"]',\n );\n const pinnedBox = pinned?.getBoundingClientRect();\n const rtl = view.getComputedStyle(strip).direction === 'rtl';\n const edge = rtl\n ? (pinnedBox?.left ?? bounds.right)\n : (pinnedBox?.right ?? bounds.left);\n const distances = peers.map((peer) => {\n const box = peer.getBoundingClientRect();\n return rtl ? box.right - edge : box.left - edge;\n });\n const closest = distances.reduce((best, distance) =>\n Math.abs(distance) < Math.abs(best) ? distance : best,\n );\n if (Math.abs(closest) > 0.5) strip.scrollLeft += closest;\n };\n let autoScroll:\n | {\n strip: HTMLElement;\n velocity: number;\n frame: number | undefined;\n previousTime: number | undefined;\n }\n | undefined;\n const stopAutoScroll = () => {\n if (!autoScroll) return;\n if (autoScroll.frame !== undefined)\n view.cancelAnimationFrame(autoScroll.frame);\n delete autoScroll.strip.dataset.tabAutoscroll;\n autoScroll = undefined;\n };\n const runAutoScroll = (time: number) => {\n const current = autoScroll;\n if (!current) return;\n current.frame = undefined;\n const elapsed =\n current.previousTime === undefined\n ? 1000 / 60\n : Math.min(40, Math.max(1, time - current.previousTime));\n current.previousTime = time;\n const maximum = Math.max(\n 0,\n current.strip.scrollWidth - current.strip.clientWidth,\n );\n const previous = current.strip.scrollLeft;\n current.strip.scrollLeft = Math.max(\n 0,\n Math.min(maximum, previous + (current.velocity * elapsed) / 1000),\n );\n if (current.strip.scrollLeft === previous) {\n stopAutoScroll();\n return;\n }\n current.frame = view.requestAnimationFrame(runAutoScroll);\n };\n const updateAutoScroll = (event: DragEvent, strip: HTMLElement) => {\n if (strip.scrollWidth <= strip.clientWidth) {\n stopAutoScroll();\n return;\n }\n const bounds = strip.getBoundingClientRect();\n const edge = Math.min(AUTO_SCROLL_EDGE_PX, bounds.width / 3);\n const startDistance = event.clientX - bounds.left;\n const endDistance = bounds.right - event.clientX;\n let direction = 0;\n let strength = 0;\n if (startDistance >= 0 && startDistance < edge) {\n direction = -1;\n strength = 1 - startDistance / edge;\n } else if (endDistance >= 0 && endDistance < edge) {\n direction = 1;\n strength = 1 - endDistance / edge;\n }\n if (direction === 0) {\n stopAutoScroll();\n return;\n }\n const maximum = Math.max(0, strip.scrollWidth - strip.clientWidth);\n if (\n (direction < 0 && strip.scrollLeft <= 0) ||\n (direction > 0 && strip.scrollLeft >= maximum)\n ) {\n stopAutoScroll();\n return;\n }\n const speed =\n AUTO_SCROLL_MIN_PX_PER_SECOND +\n (AUTO_SCROLL_MAX_PX_PER_SECOND - AUTO_SCROLL_MIN_PX_PER_SECOND) *\n strength *\n strength;\n if (autoScroll?.strip !== strip) stopAutoScroll();\n autoScroll ??= {\n strip,\n velocity: 0,\n frame: undefined,\n previousTime: undefined,\n };\n autoScroll.velocity = direction * speed;\n strip.dataset.tabAutoscroll = direction < 0 ? 'start' : 'end';\n autoScroll.frame ??= view.requestAnimationFrame(runAutoScroll);\n };\n let dragged: { barId: string; tabId: string } | undefined;\n const clearDropPositions = () =>\n root\n .querySelectorAll<HTMLElement>('[data-tab-drop-position]')\n .forEach((tab) => delete tab.dataset.tabDropPosition);\n const clear = () => {\n stopAutoScroll();\n dragged = undefined;\n root\n .querySelectorAll<HTMLElement>(\n '[data-tab-dragging], [data-tab-drop-position]',\n )\n .forEach((tab) => {\n delete tab.dataset.tabDragging;\n delete tab.dataset.tabDropPosition;\n });\n };\n let disposed = false;\n const afterControlledRender = (sourceBarId: string, sourceTabId: string) =>\n globalThis.queueMicrotask(() => {\n if (disposed) return;\n const tab = [\n ...root.querySelectorAll<TabRoot>('[data-component=\"app-tab\"]'),\n ].find((candidate) => {\n const candidateBar = tabBar(candidate);\n return (\n tabId(candidate) === sourceTabId &&\n candidateBar !== undefined &&\n barId(candidateBar) === sourceBarId\n );\n });\n const button = tab?.querySelector<HTMLButtonElement>('[role=\"tab\"]');\n button?.focus();\n reveal(button);\n });\n\n const onDragStart = (event: Event) => {\n const dragEvent = event as DragEvent;\n const tab = tabRoot(event.target);\n const bar = tab && tabBar(tab);\n const sourceId = tab && tabId(tab);\n const sourceBarId = bar && barId(bar);\n if (\n !tab ||\n tab.getAttribute('draggable') !== 'true' ||\n !sourceId ||\n !sourceBarId\n )\n return;\n dragged = { barId: sourceBarId, tabId: sourceId };\n tab.dataset.tabDragging = 'true';\n if (dragEvent.dataTransfer) {\n dragEvent.dataTransfer.effectAllowed = 'move';\n dragEvent.dataTransfer.setData(\n 'application/x-kerf-tab',\n `${sourceBarId}:${sourceId}`,\n );\n }\n };\n const onDragOver = (event: Event) => {\n const dragEvent = event as DragEvent;\n const tab = tabRoot(event.target);\n const bar =\n event.target instanceof Element\n ? (event.target.closest<TabBarRoot>('[data-component=\"tab-bar\"]') ??\n undefined)\n : undefined;\n const targetId = tab && tabId(tab);\n const targetBarId = bar && barId(bar);\n if (!dragged || !bar || targetBarId !== dragged.barId) {\n stopAutoScroll();\n clearDropPositions();\n return;\n }\n dragEvent.preventDefault();\n const strip = bar.querySelector<HTMLElement>('[data-kui-tab-list]');\n if (strip) updateAutoScroll(dragEvent, strip);\n else stopAutoScroll();\n clearDropPositions();\n if (!tab || !targetId || targetId === dragged.tabId) return;\n tab.dataset.tabDropPosition = positionFor(dragEvent, tab);\n if (dragEvent.dataTransfer) dragEvent.dataTransfer.dropEffect = 'move';\n };\n const onDrop = (event: Event) => {\n const dragEvent = event as DragEvent;\n const tab = tabRoot(event.target);\n const bar = tab && tabBar(tab);\n const targetId = tab && tabId(tab);\n const targetBarId = bar && barId(bar);\n if (\n !dragged ||\n !tab ||\n !targetId ||\n targetId === dragged.tabId ||\n targetBarId !== dragged.barId\n ) {\n clear();\n return;\n }\n dragEvent.preventDefault();\n const change: TabReorder = {\n barId: dragged.barId,\n sourceId: dragged.tabId,\n targetId,\n position: positionFor(dragEvent, tab),\n source: 'pointer',\n };\n clear();\n onReorder(change);\n afterControlledRender(change.barId, change.sourceId);\n };\n const onKeyDown = (event: Event) => {\n const keyboardEvent = event as KeyboardEvent;\n const button =\n event.target instanceof Element\n ? event.target.closest<HTMLButtonElement>('[role=\"tab\"]')\n : null;\n const tab = button && tabRoot(button);\n const bar = tab && tabBar(tab);\n if (!button || !tab || !bar) return;\n if (keyboardEvent.key === 'Delete' || keyboardEvent.key === 'Backspace') {\n const close = tab.querySelector<HTMLButtonElement>('.kui-app-tab__close');\n if (!close) return;\n keyboardEvent.preventDefault();\n close.click();\n return;\n }\n const tabs = tabsIn(bar);\n const current = tabs.indexOf(button);\n if (current < 0) return;\n if (\n keyboardEvent.altKey &&\n keyboardEvent.shiftKey &&\n (keyboardEvent.key === 'ArrowLeft' || keyboardEvent.key === 'ArrowRight')\n ) {\n const target =\n tabs[current + (keyboardEvent.key === 'ArrowLeft' ? -1 : 1)];\n const sourceId = tabId(tab);\n const targetRoot = target && tabRoot(target);\n const targetId = targetRoot && tabId(targetRoot);\n const sourceBarId = barId(bar);\n if (\n !target ||\n !sourceId ||\n !targetId ||\n !sourceBarId ||\n tab.getAttribute('draggable') !== 'true'\n )\n return;\n keyboardEvent.preventDefault();\n onReorder({\n barId: sourceBarId,\n sourceId,\n targetId,\n position: keyboardEvent.key === 'ArrowLeft' ? 'before' : 'after',\n source: 'keyboard',\n });\n afterControlledRender(sourceBarId, sourceId);\n return;\n }\n let next: number | undefined;\n if (keyboardEvent.key === 'ArrowRight') next = (current + 1) % tabs.length;\n else if (keyboardEvent.key === 'ArrowLeft')\n next = (current - 1 + tabs.length) % tabs.length;\n else if (keyboardEvent.key === 'Home') next = 0;\n else if (keyboardEvent.key === 'End') next = tabs.length - 1;\n if (next === undefined) return;\n keyboardEvent.preventDefault();\n // A per-bar data-tab-activation attribute overrides the wireTabBars option.\n const perBar = bar.dataset.tabActivation;\n const mode: TabActivation =\n perBar === 'manual' || perBar === 'automatic' ? perBar : activation;\n const target = tabs[next]!;\n target.focus();\n // Manual activation moves roving focus only; the user selects with Enter / Space\n // (native on the tab <button>) or click. Automatic also selects the focused tab.\n if (mode === 'automatic') {\n target.click();\n // Activation can synchronously replace the controlled strip. Resolve the\n // logical tab again after rendering instead of leaving focus on a dead node.\n if (!target.isConnected)\n afterControlledRender(\n bar.dataset.tabBarId!,\n tabRoot(target)!.dataset.tabId!,\n );\n }\n reveal(target);\n };\n const onFocusIn = (event: Event) => {\n const tab =\n event.target instanceof HTMLElement &&\n event.target.matches('[role=\"tab\"]')\n ? event.target\n : undefined;\n reveal(tab);\n };\n\n root.addEventListener('dragstart', onDragStart);\n root.addEventListener('dragover', onDragOver);\n root.addEventListener('drop', onDrop);\n root.addEventListener('dragend', clear);\n root.addEventListener('keydown', onKeyDown);\n root.addEventListener('focusin', onFocusIn);\n root.addEventListener('scroll', onStripScroll, true);\n root.addEventListener('scrollend', onStripScrollEnd, true);\n syncSnapInRoot();\n root\n .querySelectorAll<HTMLElement>(\n '[data-kui-tab-list] [role=\"tab\"][aria-selected=\"true\"]',\n )\n .forEach(reveal);\n\n // Reveal a tab the application selects without focus (for example a tab it\n // adds and selects) once its controlled render lands. Only a change of a\n // bar's selected tab reveals, so a re-render that keeps the selection never\n // pulls a strip the user scrolled back to it.\n const selectedIds = new Map<string, string>();\n const recordSelection = () => {\n const changed: HTMLElement[] = [];\n for (const [bar, button] of selectedTabs(root)) {\n const id = barId(bar);\n const tab = tabRoot(button);\n const selectedId = tab && tabId(tab);\n if (!id || !selectedId) continue;\n if (selectedIds.has(id) && selectedIds.get(id) !== selectedId)\n changed.push(button);\n selectedIds.set(id, selectedId);\n }\n return changed;\n };\n recordSelection();\n syncPinnedInRoot();\n const selectionObserver = new view.MutationObserver(() => {\n if (disposed) return;\n syncSnapInRoot();\n for (const button of recordSelection())\n if (ownerDocument.activeElement !== button) revealInStrip(button);\n syncPinnedInRoot();\n });\n selectionObserver.observe(root, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['aria-selected', 'dir', 'data-snap-tabs', 'data-pinned'],\n });\n\n return () => {\n disposed = true;\n if (snapFrame !== undefined) view.cancelAnimationFrame(snapFrame);\n selectionObserver.disconnect();\n snapResizeObserver?.disconnect();\n for (const strip of snapStrips) {\n strip.style.removeProperty('--kui-tab-bar-snap-inset');\n strip.style.removeProperty('--kui-tab-bar-snap-end-extra');\n }\n snapStrips.clear();\n snapObserved.clear();\n clear();\n root.removeEventListener('dragstart', onDragStart);\n root.removeEventListener('dragover', onDragOver);\n root.removeEventListener('drop', onDrop);\n root.removeEventListener('dragend', clear);\n root.removeEventListener('keydown', onKeyDown);\n root.removeEventListener('focusin', onFocusIn);\n root.removeEventListener('scroll', onStripScroll, true);\n root.removeEventListener('scrollend', onStripScrollEnd, true);\n for (const pinned of adjustedPinned) pinned.style.translate = '';\n adjustedPinned.clear();\n };\n}\n"]}