praxis-kit 4.1.3 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,4 +206,13 @@ declare const silentDiagnostics: Diagnostics;
206
206
  declare const warnDiagnostics: Diagnostics;
207
207
  declare const throwDiagnostics: Diagnostics;
208
208
 
209
- export { AsyncConsoleReporter, CollectingReporter, ConsoleReporter, DefaultPolicy, type DefaultPolicyOptions, type Diagnostic, DiagnosticCategory, DiagnosticCode, type DiagnosticInput, type DiagnosticPolicy, type DiagnosticReporter, type DiagnosticSuggestion, Diagnostics, Enforcement, type Err, type Formatter, type Ok, PraxisError, type Result, Severity, type SourceLocation, type SourcePosition, ThrowingReporter, type ValidationResult, err, formatDiagnostic, isAtLeast, nullReporter, ok, silentDiagnostics, throwDiagnostics, warnDiagnostics };
209
+ type DiagnosticsMode = 'warn' | 'throw' | 'silent';
210
+ /**
211
+ * Resolves an `enforcement.diagnostics` value — a preset name, a full `Diagnostics`
212
+ * instance, or `undefined` — to a concrete `Diagnostics` instance. Lets authors write
213
+ * `enforcement: { diagnostics: 'warn' }` without importing `Diagnostics` or the presets
214
+ * themselves.
215
+ */
216
+ declare function resolveDiagnostics(value: Diagnostics | DiagnosticsMode | undefined, fallback: Diagnostics): Diagnostics;
217
+
218
+ export { AsyncConsoleReporter, CollectingReporter, ConsoleReporter, DefaultPolicy, type DefaultPolicyOptions, type Diagnostic, DiagnosticCategory, DiagnosticCode, type DiagnosticInput, type DiagnosticPolicy, type DiagnosticReporter, type DiagnosticSuggestion, Diagnostics, type DiagnosticsMode, Enforcement, type Err, type Formatter, type Ok, PraxisError, type Result, Severity, type SourceLocation, type SourcePosition, ThrowingReporter, type ValidationResult, err, formatDiagnostic, isAtLeast, nullReporter, ok, resolveDiagnostics, silentDiagnostics, throwDiagnostics, warnDiagnostics };
@@ -266,6 +266,17 @@ var throwDiagnostics = new Diagnostics(
266
266
  new ConsoleReporter(),
267
267
  new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 3 /* Error */ })
268
268
  );
269
+
270
+ // ../../lib/diagnostics/src/resolve-diagnostics.ts
271
+ var PRESETS_BY_MODE = {
272
+ warn: warnDiagnostics,
273
+ throw: throwDiagnostics,
274
+ silent: silentDiagnostics
275
+ };
276
+ function resolveDiagnostics(value, fallback) {
277
+ if (value === void 0) return fallback;
278
+ return typeof value === "string" ? PRESETS_BY_MODE[value] : value;
279
+ }
269
280
  export {
270
281
  AsyncConsoleReporter,
271
282
  CollectingReporter,
@@ -283,6 +294,7 @@ export {
283
294
  isAtLeast,
284
295
  nullReporter,
285
296
  ok,
297
+ resolveDiagnostics,
286
298
  silentDiagnostics,
287
299
  throwDiagnostics,
288
300
  warnDiagnostics
@@ -1884,17 +1884,22 @@ var RuleValidator = class _RuleValidator extends InvariantBase {
1884
1884
  };
1885
1885
 
1886
1886
  // ../../lib/contract/src/children/children-evaluator.ts
1887
+ var isTextLike = (child) => isString(child) || isNumber(child);
1887
1888
  var ChildrenEvaluator = class extends InvariantBase {
1888
1889
  #context;
1889
1890
  #rules;
1890
1891
  #ruleNames;
1891
1892
  #matcher;
1892
1893
  #ruleValidator;
1893
- constructor(rules, diagnostics, context = "Component") {
1894
+ #exclusiveChildren;
1895
+ #allowText;
1896
+ constructor(rules, diagnostics, context = "Component", options = {}) {
1894
1897
  super(diagnostics);
1895
1898
  this.#context = context;
1896
1899
  this.#rules = rules.map((r) => normalizeChildRule(r));
1897
1900
  this.#ruleNames = this.#rules.map((r) => r.name);
1901
+ this.#exclusiveChildren = options.exclusiveChildren ?? false;
1902
+ this.#allowText = options.allowText ?? true;
1898
1903
  iterate.forEach(this.#rules, (rule) => {
1899
1904
  const { name, position, cardinality } = rule;
1900
1905
  if ((position === "first" || position === "last") && (cardinality.kind === "unbounded" || cardinality.max > 1)) {
@@ -1908,8 +1913,17 @@ var ChildrenEvaluator = class extends InvariantBase {
1908
1913
  }
1909
1914
  evaluate(children) {
1910
1915
  if (!this.active) return;
1911
- const { matrix, unexpectedIndices, ambiguousIndices } = this.#matcher.match(children);
1916
+ const {
1917
+ matrix,
1918
+ unexpectedIndices: rawUnexpectedIndices,
1919
+ ambiguousIndices
1920
+ } = this.#matcher.match(children);
1912
1921
  this.#ruleValidator.validate(this.#rules, matrix, children.length);
1922
+ const unexpectedIndices = new Set(
1923
+ [...rawUnexpectedIndices].filter(
1924
+ (ci) => isTextLike(children[ci]) ? this.#allowText === false : this.#exclusiveChildren
1925
+ )
1926
+ );
1913
1927
  if (unexpectedIndices.size === 0 && ambiguousIndices.size === 0) return;
1914
1928
  const violating = [...unexpectedIndices, ...ambiguousIndices].sort((a, b) => a - b);
1915
1929
  iterate.forEach(violating, (ci) => {
@@ -2031,8 +2045,11 @@ function metadata(name = "metadata") {
2031
2045
  function firstOptional(name, tag) {
2032
2046
  return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
2033
2047
  }
2034
- function contract(children) {
2035
- return { diagnostics: warnDiagnostics, children };
2048
+ function contract(children, options) {
2049
+ return { diagnostics: warnDiagnostics, children, ...options };
2050
+ }
2051
+ function closedContract(children) {
2052
+ return contract(children, { exclusiveChildren: true });
2036
2053
  }
2037
2054
  function ariaContract(aria) {
2038
2055
  return { diagnostics: warnDiagnostics, aria };
@@ -2058,8 +2075,10 @@ var VOID_TAGS = [
2058
2075
  ];
2059
2076
  var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
2060
2077
  var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
2061
- var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
2062
- var tableContract = contract([
2078
+ var listContract = closedContract([
2079
+ { name: "list-item", match: isTag("li", ...METADATA_TAGS) }
2080
+ ]);
2081
+ var tableContract = closedContract([
2063
2082
  firstOptional("caption", "caption"),
2064
2083
  { name: "colgroup", match: isTag("colgroup") },
2065
2084
  { name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
@@ -2067,29 +2086,31 @@ var tableContract = contract([
2067
2086
  { name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
2068
2087
  { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2069
2088
  ]);
2070
- var tableBodyContract = contract([
2089
+ var tableBodyContract = closedContract([
2071
2090
  { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2072
2091
  ]);
2073
- var tableRowContract = contract([
2092
+ var tableRowContract = closedContract([
2074
2093
  { name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
2075
2094
  ]);
2076
- var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
2077
- var dlContract = contract([
2095
+ var colgroupContract = closedContract([
2096
+ { name: "column", match: isTag("col", "template") }
2097
+ ]);
2098
+ var dlContract = closedContract([
2078
2099
  { name: "term", match: isTag("dt") },
2079
2100
  { name: "description", match: isTag("dd") },
2080
2101
  { name: "group", match: isTag("div") },
2081
2102
  metadata()
2082
2103
  ]);
2083
- var selectContract = contract([
2104
+ var selectContract = closedContract([
2084
2105
  { name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
2085
2106
  ]);
2086
- var optgroupContract = contract([
2107
+ var optgroupContract = closedContract([
2087
2108
  { name: "option", match: isTag("option", ...METADATA_TAGS) }
2088
2109
  ]);
2089
- var datalistContract = contract([
2110
+ var datalistContract = closedContract([
2090
2111
  { name: "option", match: isTag("option", ...METADATA_TAGS) }
2091
2112
  ]);
2092
- var pictureContract = contract([
2113
+ var pictureContract = closedContract([
2093
2114
  { name: "source", match: isTag("source", ...METADATA_TAGS) },
2094
2115
  { name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
2095
2116
  ]);
@@ -2105,23 +2126,18 @@ var mediaContract = contract([
2105
2126
  metadata(),
2106
2127
  { name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
2107
2128
  ]);
2108
- var headContract = contract([
2129
+ var headContract = closedContract([
2109
2130
  {
2110
2131
  name: "metadata",
2111
2132
  match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
2112
2133
  }
2113
2134
  ]);
2114
- var htmlContract = contract([
2135
+ var htmlContract = closedContract([
2115
2136
  { name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
2116
2137
  { name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
2117
2138
  ]);
2118
- var voidContract = contract([]);
2119
- var textOnlyContract = contract([
2120
- {
2121
- name: "text",
2122
- match: (child) => isString(child) || isNumber(child)
2123
- }
2124
- ]);
2139
+ var voidContract = contract([], { exclusiveChildren: true, allowText: false });
2140
+ var textOnlyContract = contract([], { exclusiveChildren: true });
2125
2141
  var landmarkContract = ariaContract([landmarkRoleRule, landmarkNameAdvisory]);
2126
2142
  var dialogContract = ariaContract([requireAccessibleName]);
2127
2143
  var menuContract = ariaContract([requireAccessibleName]);
@@ -2166,9 +2182,15 @@ var htmlContracts = {
2166
2182
  var htmlDiagnostics = warnDiagnostics2;
2167
2183
  function buildEvaluatorMap() {
2168
2184
  const map2 = /* @__PURE__ */ new Map();
2169
- iterate.forEachEntry(htmlContracts, (tag, { children }) => {
2170
- if (children?.length) {
2171
- map2.set(tag, new ChildrenEvaluator(children, htmlDiagnostics, `<${tag}>`));
2185
+ iterate.forEachEntry(htmlContracts, (tag, { children, exclusiveChildren, allowText }) => {
2186
+ if (children?.length || exclusiveChildren || allowText === false) {
2187
+ map2.set(
2188
+ tag,
2189
+ new ChildrenEvaluator(children ?? [], htmlDiagnostics, `<${tag}>`, {
2190
+ exclusiveChildren,
2191
+ allowText
2192
+ })
2193
+ );
2172
2194
  }
2173
2195
  });
2174
2196
  return map2;
@@ -2379,7 +2401,7 @@ function definePipeline(factory) {
2379
2401
  }
2380
2402
 
2381
2403
  // ../core/src/options/resolve-factory-options.ts
2382
- import { silentDiagnostics } from "./_shared/diagnostics.js";
2404
+ import { resolveDiagnostics, silentDiagnostics } from "./_shared/diagnostics.js";
2383
2405
  var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
2384
2406
  function composeNormalizers(normalizers, fn) {
2385
2407
  if (!normalizers?.length) return fn;
@@ -2400,7 +2422,7 @@ function resolveFactoryOptions(options = {}) {
2400
2422
  const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
2401
2423
  return Object.freeze({
2402
2424
  defaultTag: options.tag ?? "div",
2403
- diagnostics: enforcement?.diagnostics ?? silentDiagnostics,
2425
+ diagnostics: resolveDiagnostics(enforcement?.diagnostics, silentDiagnostics),
2404
2426
  variantKeys,
2405
2427
  ...whenDefined("displayName", options.name),
2406
2428
  ...whenDefined("defaultProps", options.defaults),
@@ -2413,6 +2435,8 @@ function resolveFactoryOptions(options = {}) {
2413
2435
  ...whenDefined("normalizeFn", composedNormalizeFn),
2414
2436
  ...whenDefined("ariaRules", enforcement?.aria),
2415
2437
  ...whenDefined("childRules", enforcement?.children),
2438
+ ...whenDefined("exclusiveChildren", enforcement?.exclusiveChildren),
2439
+ ...whenDefined("allowText", enforcement?.allowText),
2416
2440
  ...whenDefined("allowedAs", enforcement?.allowedAs),
2417
2441
  ...whenDefined("precomputedClasses", styling?.precomputedClasses)
2418
2442
  });
@@ -2597,16 +2621,22 @@ function buildCoreRuntime(normalized) {
2597
2621
  }
2598
2622
 
2599
2623
  // ../../lib/adapter-utils/src/runtime/build-engines.ts
2600
- function buildEngines(diagnostics, childRules, context) {
2601
- return childRules?.length ? { childrenEvaluator: new ChildrenEvaluator(childRules, diagnostics, context) } : {};
2624
+ function buildEngines(diagnostics, childRules, context, childrenOptions) {
2625
+ const { exclusiveChildren, allowText } = childrenOptions ?? {};
2626
+ return childRules?.length || exclusiveChildren || allowText === false ? {
2627
+ childrenEvaluator: new ChildrenEvaluator(childRules ?? [], diagnostics, context, {
2628
+ exclusiveChildren,
2629
+ allowText
2630
+ })
2631
+ } : {};
2602
2632
  }
2603
2633
 
2604
2634
  // ../../lib/adapter-utils/src/runtime/resolve-adapter-common-options.ts
2605
- import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics3 } from "./_shared/diagnostics.js";
2635
+ import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics3, resolveDiagnostics as resolveDiagnostics2 } from "./_shared/diagnostics.js";
2606
2636
  function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
2607
2637
  return {
2608
2638
  name: options.name ?? defaultName,
2609
- diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
2639
+ diagnostics: resolveDiagnostics2(options.enforcement?.diagnostics, defaultDiagnostics)
2610
2640
  };
2611
2641
  }
2612
2642
 
@@ -2950,7 +2980,11 @@ function buildRuntime(options, defaultSlotComponent, normalizeChildren) {
2950
2980
  const { childrenEvaluator } = buildEngines(
2951
2981
  normalized.diagnostics,
2952
2982
  normalized.enforcement?.children,
2953
- normalized.name
2983
+ normalized.name,
2984
+ {
2985
+ exclusiveChildren: normalized.enforcement?.exclusiveChildren,
2986
+ allowText: normalized.enforcement?.allowText
2987
+ }
2954
2988
  );
2955
2989
  const filterProps = composeFilter(ownedKeys, normalized.filterProps);
2956
2990
  const slotValidator = new SlotValidator(normalized.name, normalized.diagnostics, "React element");
@@ -213850,9 +213850,9 @@ var require_path_browserify = __commonJS({
213850
213850
  }
213851
213851
  });
213852
213852
 
213853
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
213853
+ // ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/constants.js
213854
213854
  var require_constants = __commonJS({
213855
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"(exports, module) {
213855
+ "../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/constants.js"(exports, module) {
213856
213856
  "use strict";
213857
213857
  var WIN_SLASH = "\\\\/";
213858
213858
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -214052,9 +214052,9 @@ var require_constants = __commonJS({
214052
214052
  }
214053
214053
  });
214054
214054
 
214055
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
214055
+ // ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/utils.js
214056
214056
  var require_utils = __commonJS({
214057
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"(exports) {
214057
+ "../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/utils.js"(exports) {
214058
214058
  "use strict";
214059
214059
  var {
214060
214060
  REGEX_BACKSLASH,
@@ -214116,9 +214116,9 @@ var require_utils = __commonJS({
214116
214116
  }
214117
214117
  });
214118
214118
 
214119
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
214119
+ // ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/scan.js
214120
214120
  var require_scan = __commonJS({
214121
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js"(exports, module) {
214121
+ "../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/scan.js"(exports, module) {
214122
214122
  "use strict";
214123
214123
  var utils = require_utils();
214124
214124
  var {
@@ -214446,9 +214446,9 @@ var require_scan = __commonJS({
214446
214446
  }
214447
214447
  });
214448
214448
 
214449
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
214449
+ // ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/parse.js
214450
214450
  var require_parse = __commonJS({
214451
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(exports, module) {
214451
+ "../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/parse.js"(exports, module) {
214452
214452
  "use strict";
214453
214453
  var constants = require_constants();
214454
214454
  var utils = require_utils();
@@ -214624,7 +214624,11 @@ var require_parse = __commonJS({
214624
214624
  }
214625
214625
  }
214626
214626
  };
214627
- var getStarExtglobSequenceOutput = (pattern) => {
214627
+ var buildCharClassStar = (chars) => {
214628
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
214629
+ return `${source}*`;
214630
+ };
214631
+ var getStarExtglobSequenceChars = (pattern) => {
214628
214632
  let index = 0;
214629
214633
  const chars = [];
214630
214634
  while (index < pattern.length) {
@@ -214646,8 +214650,7 @@ var require_parse = __commonJS({
214646
214650
  if (chars.length < 1) {
214647
214651
  return;
214648
214652
  }
214649
- const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
214650
- return `${source}*`;
214653
+ return chars;
214651
214654
  };
214652
214655
  var repeatedExtglobRecursion = (pattern) => {
214653
214656
  let depth = 0;
@@ -214671,15 +214674,29 @@ var require_parse = __commonJS({
214671
214674
  return { risky: true };
214672
214675
  }
214673
214676
  }
214677
+ const safeChars = [];
214678
+ let sawStarSequence = false;
214679
+ let combinable = true;
214674
214680
  for (const branch of branches) {
214675
- const safeOutput = getStarExtglobSequenceOutput(branch);
214676
- if (safeOutput) {
214677
- return { risky: true, safeOutput };
214681
+ const chars = getStarExtglobSequenceChars(branch);
214682
+ if (chars) {
214683
+ sawStarSequence = true;
214684
+ safeChars.push(...chars);
214685
+ continue;
214686
+ }
214687
+ const literal = normalizeSimpleBranch(branch);
214688
+ if (literal && literal.length === 1) {
214689
+ safeChars.push(literal);
214690
+ continue;
214678
214691
  }
214692
+ combinable = false;
214679
214693
  if (repeatedExtglobRecursion(branch) > max) {
214680
214694
  return { risky: true };
214681
214695
  }
214682
214696
  }
214697
+ if (sawStarSequence) {
214698
+ return combinable ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } : { risky: true };
214699
+ }
214683
214700
  return { risky: false };
214684
214701
  };
214685
214702
  var parse = (input, options) => {
@@ -215443,9 +215460,9 @@ var require_parse = __commonJS({
215443
215460
  }
215444
215461
  });
215445
215462
 
215446
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
215463
+ // ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/picomatch.js
215447
215464
  var require_picomatch = __commonJS({
215448
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js"(exports, module) {
215465
+ "../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/picomatch.js"(exports, module) {
215449
215466
  "use strict";
215450
215467
  var scan = require_scan();
215451
215468
  var parse = require_parse();
@@ -215529,9 +215546,9 @@ var require_picomatch = __commonJS({
215529
215546
  }
215530
215547
  return { isMatch: Boolean(match), match, output };
215531
215548
  };
215532
- picomatch.matchBase = (input, glob, options) => {
215549
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
215533
215550
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
215534
- return regex.test(utils.basename(input));
215551
+ return regex.test(utils.basename(input, { windows: posix }));
215535
215552
  };
215536
215553
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
215537
215554
  picomatch.parse = (pattern, options) => {
@@ -215583,9 +215600,9 @@ var require_picomatch = __commonJS({
215583
215600
  }
215584
215601
  });
215585
215602
 
215586
- // ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
215603
+ // ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/index.js
215587
215604
  var require_picomatch2 = __commonJS({
215588
- "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js"(exports, module) {
215605
+ "../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/index.js"(exports, module) {
215589
215606
  "use strict";
215590
215607
  var pico = require_picomatch();
215591
215608
  var utils = require_utils();
@@ -215600,9 +215617,9 @@ var require_picomatch2 = __commonJS({
215600
215617
  }
215601
215618
  });
215602
215619
 
215603
- // ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.cjs
215620
+ // ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.5/node_modules/fdir/dist/index.cjs
215604
215621
  var require_dist = __commonJS({
215605
- "../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.cjs"(exports) {
215622
+ "../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.5/node_modules/fdir/dist/index.cjs"(exports) {
215606
215623
  "use strict";
215607
215624
  var __create2 = Object.create;
215608
215625
  var __defProp2 = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- import { Diagnostics as Diagnostics$1, DiagnosticInput } from '../_shared/diagnostics.js';
1
+ import { Diagnostics as Diagnostics$1, DiagnosticInput, DiagnosticsMode } from '../_shared/diagnostics.js';
2
2
  import { RequireAtLeastOne, Simplify, ReadonlyDeep } from 'type-fest';
3
3
 
4
4
  type StringMap<T = unknown> = Record<string, T>;
@@ -194,9 +194,25 @@ type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly Ar
194
194
  type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
195
195
 
196
196
  type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
197
- readonly diagnostics?: Diagnostics$1;
197
+ /**
198
+ * Accepts a preset name (`'warn'`, `'throw'`, `'silent'`) or a full `Diagnostics`
199
+ * instance for custom reporting/policy. The string form needs no import from
200
+ * `@praxis-kit/diagnostics`.
201
+ */
202
+ readonly diagnostics?: Diagnostics$1 | DiagnosticsMode;
198
203
  readonly aria?: readonly AriaRule[];
199
204
  readonly children?: readonly ChildRuleInput[];
205
+ /**
206
+ * When true, only children matching a `children` rule (or text, per `allowText`)
207
+ * are valid — anything else is rejected. Default: false (open — children not
208
+ * matching any rule are allowed).
209
+ */
210
+ readonly exclusiveChildren?: boolean;
211
+ /**
212
+ * When false, text/number child nodes are rejected regardless of exclusiveChildren
213
+ * or any listed rule. Default: true.
214
+ */
215
+ readonly allowText?: boolean;
200
216
  readonly props?: readonly PropNormalizer[];
201
217
  /** Restricts the `as` prop to this set of tags. Violations route through diagnostics. */
202
218
  readonly allowedAs?: readonly TAllowed[];
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js
31
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js
32
32
  var require_deepMerge = __commonJS({
33
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js"(exports) {
33
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js"(exports) {
34
34
  "use strict";
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.isObjectNotArray = isObjectNotArray;
@@ -63,9 +63,9 @@ var require_deepMerge = __commonJS({
63
63
  }
64
64
  });
65
65
 
66
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js
66
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js
67
67
  var require_applyDefault = __commonJS({
68
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js"(exports) {
68
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js"(exports) {
69
69
  "use strict";
70
70
  Object.defineProperty(exports, "__esModule", { value: true });
71
71
  exports.applyDefault = applyDefault;
@@ -90,9 +90,9 @@ var require_applyDefault = __commonJS({
90
90
  }
91
91
  });
92
92
 
93
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js
93
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js
94
94
  var require_parserSeemsToBeTSESLint = __commonJS({
95
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js"(exports) {
95
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js"(exports) {
96
96
  "use strict";
97
97
  Object.defineProperty(exports, "__esModule", { value: true });
98
98
  exports.parserSeemsToBeTSESLint = parserSeemsToBeTSESLint;
@@ -102,9 +102,9 @@ var require_parserSeemsToBeTSESLint = __commonJS({
102
102
  }
103
103
  });
104
104
 
105
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
105
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
106
106
  var require_getParserServices = __commonJS({
107
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js"(exports) {
107
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js"(exports) {
108
108
  "use strict";
109
109
  Object.defineProperty(exports, "__esModule", { value: true });
110
110
  exports.getParserServices = getParserServices;
@@ -135,17 +135,17 @@ var require_getParserServices = __commonJS({
135
135
  }
136
136
  });
137
137
 
138
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js
138
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js
139
139
  var require_InferTypesFromRule = __commonJS({
140
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js"(exports) {
140
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js"(exports) {
141
141
  "use strict";
142
142
  Object.defineProperty(exports, "__esModule", { value: true });
143
143
  }
144
144
  });
145
145
 
146
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js
146
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js
147
147
  var require_nullThrows = __commonJS({
148
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js"(exports) {
148
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js"(exports) {
149
149
  "use strict";
150
150
  Object.defineProperty(exports, "__esModule", { value: true });
151
151
  exports.NullThrowsReasons = void 0;
@@ -163,9 +163,9 @@ var require_nullThrows = __commonJS({
163
163
  }
164
164
  });
165
165
 
166
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js
166
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js
167
167
  var require_RuleCreator = __commonJS({
168
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js"(exports) {
168
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js"(exports) {
169
169
  "use strict";
170
170
  Object.defineProperty(exports, "__esModule", { value: true });
171
171
  exports.RuleCreator = RuleCreator8;
@@ -211,9 +211,9 @@ var require_RuleCreator = __commonJS({
211
211
  }
212
212
  });
213
213
 
214
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
214
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
215
215
  var require_eslint_utils = __commonJS({
216
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js"(exports) {
216
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js"(exports) {
217
217
  "use strict";
218
218
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
219
219
  if (k2 === void 0) k2 = k;
@@ -1,5 +1,5 @@
1
1
  import { RequireAtLeastOne, Simplify, ReadonlyDeep } from 'type-fest';
2
- import { Diagnostics, DiagnosticInput } from '../_shared/diagnostics.js';
2
+ import { Diagnostics, DiagnosticInput, DiagnosticsMode } from '../_shared/diagnostics.js';
3
3
  import { LitElement } from 'lit';
4
4
 
5
5
  type StringMap<T = unknown> = Record<string, T>;
@@ -196,9 +196,25 @@ type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly Ar
196
196
  type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
197
197
 
198
198
  type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
199
- readonly diagnostics?: Diagnostics;
199
+ /**
200
+ * Accepts a preset name (`'warn'`, `'throw'`, `'silent'`) or a full `Diagnostics`
201
+ * instance for custom reporting/policy. The string form needs no import from
202
+ * `@praxis-kit/diagnostics`.
203
+ */
204
+ readonly diagnostics?: Diagnostics | DiagnosticsMode;
200
205
  readonly aria?: readonly AriaRule[];
201
206
  readonly children?: readonly ChildRuleInput[];
207
+ /**
208
+ * When true, only children matching a `children` rule (or text, per `allowText`)
209
+ * are valid — anything else is rejected. Default: false (open — children not
210
+ * matching any rule are allowed).
211
+ */
212
+ readonly exclusiveChildren?: boolean;
213
+ /**
214
+ * When false, text/number child nodes are rejected regardless of exclusiveChildren
215
+ * or any listed rule. Default: true.
216
+ */
217
+ readonly allowText?: boolean;
202
218
  readonly props?: readonly PropNormalizer[];
203
219
  /** Restricts the `as` prop to this set of tags. Violations route through diagnostics. */
204
220
  readonly allowedAs?: readonly TAllowed[];