praxis-kit 4.1.3 → 6.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
@@ -420,6 +420,19 @@ function makeResolveTag(defaultTag) {
420
420
  };
421
421
  }
422
422
 
423
+ // ../../lib/primitive/src/rule/rule-brand.ts
424
+ var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
425
+
426
+ // ../../lib/primitive/src/rule/is-dynamic-rule.ts
427
+ function isDynamicRule(rule) {
428
+ return isObject(rule, true) && rule[RULE_BRAND] === true;
429
+ }
430
+
431
+ // ../../lib/primitive/src/rule/resolve-rule.ts
432
+ function resolveRule(rule, context) {
433
+ return isDynamicRule(rule) ? rule.resolve(context) : rule;
434
+ }
435
+
423
436
  // ../../lib/primitive/src/utils/assert-never.ts
424
437
  function assertNever(value) {
425
438
  throw new Error(`Unexpected value: ${String(value)}`);
@@ -1884,32 +1897,68 @@ var RuleValidator = class _RuleValidator extends InvariantBase {
1884
1897
  };
1885
1898
 
1886
1899
  // ../../lib/contract/src/children/children-evaluator.ts
1900
+ var isTextLike = (child) => isString(child) || isNumber(child);
1901
+ function checkPositionCardinalityInvariant(rules, context) {
1902
+ iterate.forEach(rules, (rule) => {
1903
+ const { name, position, cardinality } = rule;
1904
+ if ((position === "first" || position === "last") && (cardinality.kind === "unbounded" || cardinality.max > 1)) {
1905
+ throw new RangeError(
1906
+ `ChildrenEvaluator [${context}]: rule "${name}" sets position="${position}" with an unbound or >1 max. position="first|last" implies max=1.`
1907
+ );
1908
+ }
1909
+ });
1910
+ }
1887
1911
  var ChildrenEvaluator = class extends InvariantBase {
1888
1912
  #context;
1889
- #rules;
1890
- #ruleNames;
1913
+ /** Rules with a static cardinality — normalized once, reused on every evaluate() call. */
1914
+ #staticRules;
1915
+ /** Rules whose cardinality is `dynamic(...)` — re-resolved against a ChildRuleContext per call. */
1916
+ #dynamicRuleInputs;
1891
1917
  #matcher;
1892
1918
  #ruleValidator;
1893
- constructor(rules, diagnostics, context = "Component") {
1919
+ #exclusiveChildren;
1920
+ #allowText;
1921
+ constructor(rules, diagnostics, context = "Component", options = {}) {
1894
1922
  super(diagnostics);
1895
1923
  this.#context = context;
1896
- this.#rules = rules.map((r) => normalizeChildRule(r));
1897
- this.#ruleNames = this.#rules.map((r) => r.name);
1898
- iterate.forEach(this.#rules, (rule) => {
1899
- const { name, position, cardinality } = rule;
1900
- if ((position === "first" || position === "last") && (cardinality.kind === "unbounded" || cardinality.max > 1)) {
1901
- throw new RangeError(
1902
- `ChildrenEvaluator [${context}]: rule "${name}" sets position="${position}" with an unbound or >1 max. position="first|last" implies max=1.`
1903
- );
1904
- }
1924
+ this.#exclusiveChildren = options.exclusiveChildren ?? false;
1925
+ this.#allowText = options.allowText ?? true;
1926
+ const staticRuleInputs = [];
1927
+ const dynamicRuleInputs = [];
1928
+ iterate.forEach(rules, (rule) => {
1929
+ if (isDynamicRule(rule.cardinality)) dynamicRuleInputs.push(rule);
1930
+ else staticRuleInputs.push(rule);
1905
1931
  });
1906
- this.#matcher = new RuleMatcher(this.#rules);
1932
+ this.#dynamicRuleInputs = dynamicRuleInputs;
1933
+ this.#staticRules = staticRuleInputs.map(
1934
+ (r) => normalizeChildRule(r)
1935
+ );
1907
1936
  this.#ruleValidator = new RuleValidator(context, diagnostics);
1937
+ if (this.#dynamicRuleInputs.length === 0) {
1938
+ checkPositionCardinalityInvariant(this.#staticRules, context);
1939
+ this.#matcher = new RuleMatcher(this.#staticRules);
1940
+ } else {
1941
+ this.#matcher = void 0;
1942
+ }
1908
1943
  }
1909
- evaluate(children) {
1944
+ /**
1945
+ * @param context Required when any rule has a `dynamic(...)` cardinality —
1946
+ * supplies the resolved tag/props those rules are evaluated against.
1947
+ */
1948
+ evaluate(children, context) {
1910
1949
  if (!this.active) return;
1911
- const { matrix, unexpectedIndices, ambiguousIndices } = this.#matcher.match(children);
1912
- this.#ruleValidator.validate(this.#rules, matrix, children.length);
1950
+ const { rules, matcher } = this.#resolveRules(context);
1951
+ const {
1952
+ matrix,
1953
+ unexpectedIndices: rawUnexpectedIndices,
1954
+ ambiguousIndices
1955
+ } = matcher.match(children);
1956
+ this.#ruleValidator.validate(rules, matrix, children.length);
1957
+ const unexpectedIndices = new Set(
1958
+ [...rawUnexpectedIndices].filter(
1959
+ (ci) => isTextLike(children[ci]) ? this.#allowText === false : this.#exclusiveChildren
1960
+ )
1961
+ );
1913
1962
  if (unexpectedIndices.size === 0 && ambiguousIndices.size === 0) return;
1914
1963
  const violating = [...unexpectedIndices, ...ambiguousIndices].sort((a, b) => a - b);
1915
1964
  iterate.forEach(violating, (ci) => {
@@ -1918,11 +1967,28 @@ var ChildrenEvaluator = class extends InvariantBase {
1918
1967
  this.violate(ContractDiagnostics.unexpectedChild(typeName, ci, this.#context));
1919
1968
  } else {
1920
1969
  const matches = matrix.childToRules.forward.get(ci);
1921
- const names = [...matches].map((ri) => this.#ruleNames[ri] ?? `#${ri}`);
1970
+ const names = [...matches].map((ri) => rules[ri]?.name ?? `#${ri}`);
1922
1971
  this.violate(ContractDiagnostics.ambiguousChild(typeName, ci, names, this.#context));
1923
1972
  }
1924
1973
  });
1925
1974
  }
1975
+ #resolveRules(context) {
1976
+ if (this.#dynamicRuleInputs.length === 0) {
1977
+ return { rules: this.#staticRules, matcher: this.#matcher };
1978
+ }
1979
+ if (context === void 0) {
1980
+ throw new RangeError(
1981
+ `ChildrenEvaluator [${this.#context}]: rule(s) have a dynamic(...) cardinality \u2014 evaluate() requires a context argument to resolve them.`
1982
+ );
1983
+ }
1984
+ const resolvedDynamicRules = this.#dynamicRuleInputs.map((r) => {
1985
+ const cardinality = resolveRule(r.cardinality, context);
1986
+ return normalizeChildRule({ ...r, cardinality });
1987
+ });
1988
+ checkPositionCardinalityInvariant(resolvedDynamicRules, this.#context);
1989
+ const rules = [...this.#staticRules, ...resolvedDynamicRules];
1990
+ return { rules, matcher: new RuleMatcher(rules) };
1991
+ }
1926
1992
  };
1927
1993
 
1928
1994
  // ../../lib/contract/src/props/get-disabled-props.ts
@@ -2031,8 +2097,11 @@ function metadata(name = "metadata") {
2031
2097
  function firstOptional(name, tag) {
2032
2098
  return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
2033
2099
  }
2034
- function contract(children) {
2035
- return { diagnostics: warnDiagnostics, children };
2100
+ function contract(children, options) {
2101
+ return { diagnostics: warnDiagnostics, children, ...options };
2102
+ }
2103
+ function closedContract(children) {
2104
+ return contract(children, { exclusiveChildren: true });
2036
2105
  }
2037
2106
  function ariaContract(aria) {
2038
2107
  return { diagnostics: warnDiagnostics, aria };
@@ -2058,8 +2127,10 @@ var VOID_TAGS = [
2058
2127
  ];
2059
2128
  var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
2060
2129
  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([
2130
+ var listContract = closedContract([
2131
+ { name: "list-item", match: isTag("li", ...METADATA_TAGS) }
2132
+ ]);
2133
+ var tableContract = closedContract([
2063
2134
  firstOptional("caption", "caption"),
2064
2135
  { name: "colgroup", match: isTag("colgroup") },
2065
2136
  { name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
@@ -2067,29 +2138,31 @@ var tableContract = contract([
2067
2138
  { name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
2068
2139
  { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2069
2140
  ]);
2070
- var tableBodyContract = contract([
2141
+ var tableBodyContract = closedContract([
2071
2142
  { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2072
2143
  ]);
2073
- var tableRowContract = contract([
2144
+ var tableRowContract = closedContract([
2074
2145
  { name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
2075
2146
  ]);
2076
- var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
2077
- var dlContract = contract([
2147
+ var colgroupContract = closedContract([
2148
+ { name: "column", match: isTag("col", "template") }
2149
+ ]);
2150
+ var dlContract = closedContract([
2078
2151
  { name: "term", match: isTag("dt") },
2079
2152
  { name: "description", match: isTag("dd") },
2080
2153
  { name: "group", match: isTag("div") },
2081
2154
  metadata()
2082
2155
  ]);
2083
- var selectContract = contract([
2156
+ var selectContract = closedContract([
2084
2157
  { name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
2085
2158
  ]);
2086
- var optgroupContract = contract([
2159
+ var optgroupContract = closedContract([
2087
2160
  { name: "option", match: isTag("option", ...METADATA_TAGS) }
2088
2161
  ]);
2089
- var datalistContract = contract([
2162
+ var datalistContract = closedContract([
2090
2163
  { name: "option", match: isTag("option", ...METADATA_TAGS) }
2091
2164
  ]);
2092
- var pictureContract = contract([
2165
+ var pictureContract = closedContract([
2093
2166
  { name: "source", match: isTag("source", ...METADATA_TAGS) },
2094
2167
  { name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
2095
2168
  ]);
@@ -2105,23 +2178,18 @@ var mediaContract = contract([
2105
2178
  metadata(),
2106
2179
  { name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
2107
2180
  ]);
2108
- var headContract = contract([
2181
+ var headContract = closedContract([
2109
2182
  {
2110
2183
  name: "metadata",
2111
2184
  match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
2112
2185
  }
2113
2186
  ]);
2114
- var htmlContract = contract([
2187
+ var htmlContract = closedContract([
2115
2188
  { name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
2116
2189
  { name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
2117
2190
  ]);
2118
- var voidContract = contract([]);
2119
- var textOnlyContract = contract([
2120
- {
2121
- name: "text",
2122
- match: (child) => isString(child) || isNumber(child)
2123
- }
2124
- ]);
2191
+ var voidContract = contract([], { exclusiveChildren: true, allowText: false });
2192
+ var textOnlyContract = contract([], { exclusiveChildren: true });
2125
2193
  var landmarkContract = ariaContract([landmarkRoleRule, landmarkNameAdvisory]);
2126
2194
  var dialogContract = ariaContract([requireAccessibleName]);
2127
2195
  var menuContract = ariaContract([requireAccessibleName]);
@@ -2166,9 +2234,15 @@ var htmlContracts = {
2166
2234
  var htmlDiagnostics = warnDiagnostics2;
2167
2235
  function buildEvaluatorMap() {
2168
2236
  const map2 = /* @__PURE__ */ new Map();
2169
- iterate.forEachEntry(htmlContracts, (tag, { children }) => {
2170
- if (children?.length) {
2171
- map2.set(tag, new ChildrenEvaluator(children, htmlDiagnostics, `<${tag}>`));
2237
+ iterate.forEachEntry(htmlContracts, (tag, { children, exclusiveChildren, allowText }) => {
2238
+ if (children?.length || exclusiveChildren || allowText === false) {
2239
+ map2.set(
2240
+ tag,
2241
+ new ChildrenEvaluator(children ?? [], htmlDiagnostics, `<${tag}>`, {
2242
+ exclusiveChildren,
2243
+ allowText
2244
+ })
2245
+ );
2172
2246
  }
2173
2247
  });
2174
2248
  return map2;
@@ -2379,7 +2453,7 @@ function definePipeline(factory) {
2379
2453
  }
2380
2454
 
2381
2455
  // ../core/src/options/resolve-factory-options.ts
2382
- import { silentDiagnostics } from "./_shared/diagnostics.js";
2456
+ import { resolveDiagnostics, silentDiagnostics } from "./_shared/diagnostics.js";
2383
2457
  var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
2384
2458
  function composeNormalizers(normalizers, fn) {
2385
2459
  if (!normalizers?.length) return fn;
@@ -2400,7 +2474,7 @@ function resolveFactoryOptions(options = {}) {
2400
2474
  const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
2401
2475
  return Object.freeze({
2402
2476
  defaultTag: options.tag ?? "div",
2403
- diagnostics: enforcement?.diagnostics ?? silentDiagnostics,
2477
+ diagnostics: resolveDiagnostics(enforcement?.diagnostics, silentDiagnostics),
2404
2478
  variantKeys,
2405
2479
  ...whenDefined("displayName", options.name),
2406
2480
  ...whenDefined("defaultProps", options.defaults),
@@ -2413,6 +2487,8 @@ function resolveFactoryOptions(options = {}) {
2413
2487
  ...whenDefined("normalizeFn", composedNormalizeFn),
2414
2488
  ...whenDefined("ariaRules", enforcement?.aria),
2415
2489
  ...whenDefined("childRules", enforcement?.children),
2490
+ ...whenDefined("exclusiveChildren", enforcement?.exclusiveChildren),
2491
+ ...whenDefined("allowText", enforcement?.allowText),
2416
2492
  ...whenDefined("allowedAs", enforcement?.allowedAs),
2417
2493
  ...whenDefined("precomputedClasses", styling?.precomputedClasses)
2418
2494
  });
@@ -2597,16 +2673,22 @@ function buildCoreRuntime(normalized) {
2597
2673
  }
2598
2674
 
2599
2675
  // ../../lib/adapter-utils/src/runtime/build-engines.ts
2600
- function buildEngines(diagnostics, childRules, context) {
2601
- return childRules?.length ? { childrenEvaluator: new ChildrenEvaluator(childRules, diagnostics, context) } : {};
2676
+ function buildEngines(diagnostics, childRules, context, childrenOptions) {
2677
+ const { exclusiveChildren, allowText } = childrenOptions ?? {};
2678
+ return childRules?.length || exclusiveChildren || allowText === false ? {
2679
+ childrenEvaluator: new ChildrenEvaluator(childRules ?? [], diagnostics, context, {
2680
+ exclusiveChildren,
2681
+ allowText
2682
+ })
2683
+ } : {};
2602
2684
  }
2603
2685
 
2604
2686
  // ../../lib/adapter-utils/src/runtime/resolve-adapter-common-options.ts
2605
- import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics3 } from "./_shared/diagnostics.js";
2687
+ import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics3, resolveDiagnostics as resolveDiagnostics2 } from "./_shared/diagnostics.js";
2606
2688
  function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
2607
2689
  return {
2608
2690
  name: options.name ?? defaultName,
2609
- diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
2691
+ diagnostics: resolveDiagnostics2(options.enforcement?.diagnostics, defaultDiagnostics)
2610
2692
  };
2611
2693
  }
2612
2694
 
@@ -2816,8 +2898,14 @@ function applyDisplayName(component, name) {
2816
2898
  // ../../adapters/react/src/shared/render.ts
2817
2899
  import { createElement as createElement2 } from "react";
2818
2900
  import { jsx as jsx2 } from "react/jsx-runtime";
2819
- function buildRenderState(tag, directives, props, className, children) {
2820
- const state = { tag, directives, props, className };
2901
+ function buildRenderState(tag, directives, props, normalizedProps, className, children) {
2902
+ const state = {
2903
+ tag,
2904
+ directives,
2905
+ props,
2906
+ normalizedProps,
2907
+ className
2908
+ };
2821
2909
  if (children !== void 0) state.children = children;
2822
2910
  return state;
2823
2911
  }
@@ -2842,7 +2930,7 @@ function prepareRenderState(runtime, props, filterProps) {
2842
2930
  ...as !== void 0 && { as },
2843
2931
  ...asChild !== void 0 && { asChild }
2844
2932
  };
2845
- return buildRenderState(tag, directives, filteredProps, resolvedClass, children);
2933
+ return buildRenderState(tag, directives, filteredProps, normalizedProps, resolvedClass, children);
2846
2934
  }
2847
2935
  function warnDiscardedChildren(originalChildren, normalizedChildren, validator) {
2848
2936
  if (!Array.isArray(originalChildren)) return;
@@ -2920,7 +3008,10 @@ function render({
2920
3008
  let cached;
2921
3009
  const getNormalizedChildren = () => cached ??= normalizeChildren(state.children);
2922
3010
  if (process.env.NODE_ENV !== "production") {
2923
- childrenEvaluator?.evaluate(getNormalizedChildren());
3011
+ childrenEvaluator?.evaluate(getNormalizedChildren(), {
3012
+ tag: state.tag,
3013
+ props: state.normalizedProps
3014
+ });
2924
3015
  runtime.options.htmlChildrenEvaluatorFn?.(state.tag)?.evaluate(getNormalizedChildren());
2925
3016
  }
2926
3017
  if (typeof props.render === "function") {
@@ -2950,7 +3041,11 @@ function buildRuntime(options, defaultSlotComponent, normalizeChildren) {
2950
3041
  const { childrenEvaluator } = buildEngines(
2951
3042
  normalized.diagnostics,
2952
3043
  normalized.enforcement?.children,
2953
- normalized.name
3044
+ normalized.name,
3045
+ {
3046
+ exclusiveChildren: normalized.enforcement?.exclusiveChildren,
3047
+ allowText: normalized.enforcement?.allowText
3048
+ }
2954
3049
  );
2955
3050
  const filterProps = composeFilter(ownedKeys, normalized.filterProps);
2956
3051
  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>;
@@ -29,6 +29,26 @@ type MinMax = {
29
29
  };
30
30
  type CardinalityInput = Partial<MinMax>;
31
31
 
32
+ /**
33
+ * Resolved per-instance state available to a dynamic (`dynamic(...)`) child
34
+ * rule field — the same tag/props every adapter already computes before
35
+ * evaluating children, exposed so a rule can vary by them (e.g. cardinality
36
+ * that depends on the resolved `as` tag).
37
+ */
38
+ type ChildRuleContext = {
39
+ readonly tag: unknown;
40
+ readonly props: Readonly<AnyRecord>;
41
+ };
42
+
43
+ declare const RULE_BRAND: unique symbol;
44
+
45
+ type DynamicRule<T, C = unknown> = {
46
+ readonly [RULE_BRAND]: true;
47
+ resolve(context: C): T;
48
+ };
49
+
50
+ type Rule<T, C = unknown> = T | DynamicRule<T, C>;
51
+
32
52
  type ChildRuleMatch<T, U extends T = T> = (child: T) => child is U;
33
53
 
34
54
  type ChildRulePosition = 'first' | 'last' | 'any';
@@ -36,7 +56,13 @@ type ChildRulePosition = 'first' | 'last' | 'any';
36
56
  type ChildRuleInput<T = unknown, U extends T = T> = {
37
57
  name: string;
38
58
  match: ChildRuleMatch<T, U>;
39
- cardinality?: CardinalityInput;
59
+ /**
60
+ * Either a static cardinality, or `dynamic((ctx) => ...)` to derive it from
61
+ * the resolved tag/props (e.g. a different max depending on `as`). `match`
62
+ * stays static-only — it's already a function, so a dynamic wrapper would
63
+ * be indistinguishable from the predicate itself without one.
64
+ */
65
+ cardinality?: Rule<CardinalityInput, ChildRuleContext>;
40
66
  position?: ChildRulePosition;
41
67
  /**
42
68
  * Optional component-type reference for O(1) dispatch index.
@@ -194,9 +220,25 @@ type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly Ar
194
220
  type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
195
221
 
196
222
  type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
197
- readonly diagnostics?: Diagnostics$1;
223
+ /**
224
+ * Accepts a preset name (`'warn'`, `'throw'`, `'silent'`) or a full `Diagnostics`
225
+ * instance for custom reporting/policy. The string form needs no import from
226
+ * `@praxis-kit/diagnostics`.
227
+ */
228
+ readonly diagnostics?: Diagnostics$1 | DiagnosticsMode;
198
229
  readonly aria?: readonly AriaRule[];
199
230
  readonly children?: readonly ChildRuleInput[];
231
+ /**
232
+ * When true, only children matching a `children` rule (or text, per `allowText`)
233
+ * are valid — anything else is rejected. Default: false (open — children not
234
+ * matching any rule are allowed).
235
+ */
236
+ readonly exclusiveChildren?: boolean;
237
+ /**
238
+ * When false, text/number child nodes are rejected regardless of exclusiveChildren
239
+ * or any listed rule. Default: true.
240
+ */
241
+ readonly allowText?: boolean;
200
242
  readonly props?: readonly PropNormalizer[];
201
243
  /** Restricts the `as` prop to this set of tags. Violations route through diagnostics. */
202
244
  readonly allowedAs?: readonly TAllowed[];