@animus-ui/extract 0.1.16 → 0.1.18

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.
Files changed (44) hide show
  1. package/README.md +3 -1
  2. package/crates/extract-v2/animus-extract-v2.darwin-arm64.node +0 -0
  3. package/crates/extract-v2/animus-extract-v2.linux-arm64-gnu.node +0 -0
  4. package/crates/extract-v2/animus-extract-v2.linux-x64-gnu.node +0 -0
  5. package/crates/extract-v2/index.d.ts +20 -2
  6. package/dist/index.cjs +4 -1
  7. package/dist/index.mjs +2 -2
  8. package/dist/pipeline/analyze-project-args.d.ts +8 -1
  9. package/dist/pipeline/analyze-project-args.d.ts.map +1 -1
  10. package/dist/pipeline/core-options.d.ts +10 -2
  11. package/dist/pipeline/core-options.d.ts.map +1 -1
  12. package/dist/pipeline/dynamic-prop-config.d.ts +31 -4
  13. package/dist/pipeline/dynamic-prop-config.d.ts.map +1 -1
  14. package/dist/pipeline/engine-adapter.d.ts +1 -1
  15. package/dist/pipeline/engine-adapter.d.ts.map +1 -1
  16. package/dist/pipeline/index.d.ts +3 -3
  17. package/dist/pipeline/index.d.ts.map +1 -1
  18. package/dist/pipeline/manifest-diagnostics.d.ts +10 -2
  19. package/dist/pipeline/manifest-diagnostics.d.ts.map +1 -1
  20. package/dist/pipeline/manifest-schema.d.ts +7 -0
  21. package/dist/pipeline/manifest-schema.d.ts.map +1 -1
  22. package/dist/pipeline/prefix.d.ts +2 -0
  23. package/dist/pipeline/prefix.d.ts.map +1 -1
  24. package/dist/pipeline/property-registrations.d.ts +16 -0
  25. package/dist/pipeline/property-registrations.d.ts.map +1 -0
  26. package/dist/pipeline/run-analysis.d.ts.map +1 -1
  27. package/dist/pipeline/source-corpus.d.ts +11 -0
  28. package/dist/pipeline/source-corpus.d.ts.map +1 -1
  29. package/dist/pipeline/source-ingestion.d.ts +12 -0
  30. package/dist/pipeline/source-ingestion.d.ts.map +1 -1
  31. package/dist/pipeline/system-config.d.ts +12 -2
  32. package/dist/pipeline/system-config.d.ts.map +1 -1
  33. package/dist/pipeline/system-props-module.d.ts +3 -1
  34. package/dist/pipeline/system-props-module.d.ts.map +1 -1
  35. package/dist/pipeline/unit-fallback.d.ts.map +1 -1
  36. package/dist/{pipeline-DeEENy5C.mjs → pipeline-Dr-I4Xhl.mjs} +211 -19
  37. package/dist/{pipeline-x1yBZ2UP.cjs → pipeline-OKnmnyFu.cjs} +228 -18
  38. package/dist/session/extraction-session.d.ts +16 -7
  39. package/dist/session/extraction-session.d.ts.map +1 -1
  40. package/dist/session/index.d.ts +1 -1
  41. package/dist/session/index.d.ts.map +1 -1
  42. package/dist/session.cjs +70 -40
  43. package/dist/session.mjs +70 -41
  44. package/package.json +4 -4
@@ -1,8 +1,10 @@
1
1
  import type { DynamicPropMeta } from './dynamic-prop-config';
2
+ import type { ProjectManifest } from './manifest-schema';
2
3
  export declare function buildSystemPropsModule(opts: {
3
4
  systemPropMapJson: string;
4
5
  groupRegistryJson: string;
5
6
  dynamicProps: Record<string, DynamicPropMeta>;
6
- transformsSource?: string;
7
+ admittedTransforms: ProjectManifest['admitted_transforms'];
8
+ typedSystemProps: ProjectManifest['typed_system_props'];
7
9
  }): string;
8
10
  //# sourceMappingURL=system-props-module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"system-props-module.d.ts","sourceRoot":"","sources":["../../pipeline/system-props-module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAQT"}
1
+ {"version":3,"file":"system-props-module.d.ts","sourceRoot":"","sources":["../../pipeline/system-props-module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA4BzD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,kBAAkB,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC3D,gBAAgB,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;CACzD,GAAG,MAAM,CAYT"}
@@ -1 +1 @@
1
- {"version":3,"file":"unit-fallback.d.ts","sourceRoot":"","sources":["../../pipeline/unit-fallback.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyCrD"}
1
+ {"version":3,"file":"unit-fallback.d.ts","sourceRoot":"","sources":["../../pipeline/unit-fallback.ts"],"names":[],"mappings":"AAQA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAoDrD"}
@@ -64,7 +64,7 @@ function assembleStylesheet(options) {
64
64
  //#region pipeline/analyze-project-args.ts
65
65
  /** @internal */
66
66
  function buildAnalyzeProjectArgs(inputs) {
67
- return [
67
+ const args = [
68
68
  inputs.filesJson,
69
69
  inputs.scalesJson,
70
70
  inputs.variableMapJson,
@@ -82,8 +82,11 @@ function buildAnalyzeProjectArgs(inputs) {
82
82
  inputs.staticCssJson,
83
83
  inputs.conditionAliasesJson,
84
84
  inputs.externalDirsJson,
85
- inputs.transformSourcesJson
85
+ inputs.transformSourcesJson,
86
+ inputs.transformProvenanceJson ?? null
86
87
  ];
88
+ if (inputs.declarationScalesJson) args.push(inputs.declarationScalesJson);
89
+ return args;
87
90
  }
88
91
  //#endregion
89
92
  //#region pipeline/content-hash.ts
@@ -747,6 +750,7 @@ const NODE_NEXT_EXTENSION_MAP = {
747
750
  ".tsx",
748
751
  ".jsx"
749
752
  ],
753
+ ".jsx": [".tsx"],
750
754
  ".mjs": [".mts"],
751
755
  ".cjs": [".cts"]
752
756
  };
@@ -928,6 +932,7 @@ async function ingestSourceEntries(rawEntries, options) {
928
932
  }]);
929
933
  }
930
934
  const facts = collectFileFacts(analysisEntries, options);
935
+ const abortedParses = [];
931
936
  for (const [analysisPath, file] of Object.entries(facts.files)) {
932
937
  const originalPath = analysisOwner.get(analysisPath) ?? analysisPath;
933
938
  for (const message of file.parseDiagnostics) diagnostics.push({
@@ -936,6 +941,11 @@ async function ingestSourceEntries(rawEntries, options) {
936
941
  originalPath,
937
942
  analysisPath
938
943
  });
944
+ if (file.parsePanicked) abortedParses.push({
945
+ originalPath,
946
+ hash: ownership[originalPath].originalHash,
947
+ messages: file.parseDiagnostics
948
+ });
939
949
  }
940
950
  const resolvers = new ResolverExportIndex(facts, analysisEntries.map((entry) => entry.path));
941
951
  for (const { canonicalPath, paths } of resolvers.collisions) for (let index = 0; index < paths.length; index += 1) {
@@ -965,12 +975,14 @@ async function ingestSourceEntries(rawEntries, options) {
965
975
  }
966
976
  addAdaptedEntries(original.path, result.entries);
967
977
  }
968
- return {
978
+ const result = {
969
979
  originalEntries,
970
980
  analysisEntries,
971
981
  ownership,
972
982
  diagnostics
973
983
  };
984
+ if (abortedParses.length > 0) result.abortedParses = abortedParses;
985
+ return result;
974
986
  }
975
987
  /**
976
988
  * `parseCount` counts the parses performed by THIS call, so a fully-memoized
@@ -1096,7 +1108,7 @@ function createV2EngineApi(deps) {
1096
1108
  return {
1097
1109
  loadSystemModule: (...args) => native.loadSystemModule(...args),
1098
1110
  extractFacts: (filesJson) => native.extractFacts(filesJson),
1099
- analyzeProject: (filesJsonRaw, scalesJson, variableMapJson, contextualVarsJson, propConfigJson, groupRegistryJson, packageResolutionJson, devMode, emitterConfigJson, selectorAliasesJson, _selectorOrderJson, globalStyleBlocksJson, pathAliasesJson, keyframesJson, staticCssJson, conditionAliasesJson, externalDirsJson, transformSourcesJson) => {
1111
+ analyzeProject: (filesJsonRaw, scalesJson, variableMapJson, contextualVarsJson, propConfigJson, groupRegistryJson, packageResolutionJson, devMode, emitterConfigJson, selectorAliasesJson, _selectorOrderJson, globalStyleBlocksJson, pathAliasesJson, keyframesJson, staticCssJson, conditionAliasesJson, externalDirsJson, transformSourcesJson, transformProvenanceJson, declarationScalesJson) => {
1100
1112
  const filesJson = deps.rehydrateFilesJson ? deps.rehydrateFilesJson(filesJsonRaw) : filesJsonRaw;
1101
1113
  const sent = /* @__PURE__ */ new Map();
1102
1114
  for (const entry of parseFilesJson(filesJson, label)) sent.set(entry.path, entry.source);
@@ -1121,6 +1133,8 @@ function createV2EngineApi(deps) {
1121
1133
  staticCssJson: staticCssJson ?? void 0,
1122
1134
  externalDirsJson: externalDirsJson ?? void 0,
1123
1135
  transformSourcesJson: transformSourcesJson ?? void 0,
1136
+ transformProvenanceJson: transformProvenanceJson ?? void 0,
1137
+ declarationScalesJson,
1124
1138
  devMode
1125
1139
  };
1126
1140
  const engine = new native.ExtractEngine(config);
@@ -1180,6 +1194,12 @@ const REPLACEABLE_DEFAULT_EXCLUDE = [
1180
1194
  ".spec."
1181
1195
  ];
1182
1196
  const DEFAULT_EXCLUDE = [...STRUCTURAL_EXCLUDE, ...REPLACEABLE_DEFAULT_EXCLUDE];
1197
+ /** The effective log tier: the option or `ANIMUS_DEBUG`, whichever is higher. */
1198
+ function resolveVerbosity(option, debugEnv) {
1199
+ if (option === "trace" || debugEnv === "trace") return "trace";
1200
+ if (option === true || debugEnv === "1" || debugEnv === "true") return "verbose";
1201
+ return "quiet";
1202
+ }
1183
1203
  const CORE_OPTION_KEYS = /* @__PURE__ */ new Set([
1184
1204
  "system",
1185
1205
  "exclude",
@@ -1241,6 +1261,7 @@ function assertKnownOptionKeys(raw, ownKeys = [], rejectKeys = [], opts = {}) {
1241
1261
  */
1242
1262
  const isString = (value) => Object(value) !== value && Object.prototype.toString.call(value) === "[object String]";
1243
1263
  const isBoolean = (value) => Object(value) !== value && Object.prototype.toString.call(value) === "[object Boolean]";
1264
+ const isVerbose = (value) => isBoolean(value) || value === "trace";
1244
1265
  const isStringArray = (value) => Array.isArray(value) && value.every(isString);
1245
1266
  const isStringOrStringArray = (value) => isString(value) || isStringArray(value);
1246
1267
  const CORE_VALUE_GATES = [
@@ -1266,8 +1287,8 @@ const CORE_VALUE_GATES = [
1266
1287
  },
1267
1288
  {
1268
1289
  key: "verbose",
1269
- ok: isBoolean,
1270
- expected: "a boolean"
1290
+ ok: isVerbose,
1291
+ expected: "a boolean or 'trace'"
1271
1292
  },
1272
1293
  {
1273
1294
  key: "minify",
@@ -1949,6 +1970,16 @@ function createSourceCorpus(host, ingestor = createSourceIngestor(host)) {
1949
1970
  const ingested = await ingestor.ingest(rawEntries);
1950
1971
  return withoutInvalidOriginals(ingested, ingestor.surfaceDiagnostics(ingested.diagnostics));
1951
1972
  },
1973
+ rejection(prepared) {
1974
+ const aborted = (prepared.abortedParses ?? []).filter(({ originalPath }) => prepared.ownership[originalPath] !== void 0);
1975
+ if (aborted.length === 0) return null;
1976
+ const files = aborted.map(({ originalPath, messages }) => `${originalPath} (${messages.join("; ")})`).join(", ");
1977
+ const owners = aborted.length === 1 ? "this file's" : "these files'";
1978
+ return {
1979
+ originals: new Map(aborted.map(({ originalPath, hash }) => [originalPath, hash])),
1980
+ message: `${host.prefix} analysis not published: the parser stopped before the end of ${files}; fix the syntax error to publish ${owners} changes`
1981
+ };
1982
+ },
1952
1983
  publish(accepted) {
1953
1984
  ingestor.markPublished(accepted);
1954
1985
  published = {
@@ -2284,6 +2315,8 @@ function unreadableSourceDiagnostic(relPath, error) {
2284
2315
  }
2285
2316
  /** The collision entry code minted by the system package's merge. */
2286
2317
  const VOCABULARY_COLLISION = "animus.vocabulary.collision";
2318
+ /** A theme `@property` registration browsers would ignore; it is not emitted. */
2319
+ const INVALID_PROPERTY_REGISTRATION = "animus.theme.invalid-property-registration";
2287
2320
  /** Minted when a sealed kit with registered vocabulary is consumed through
2288
2321
  * the deprecated `from()`/`includes:` verbs. */
2289
2322
  const VOCABULARY_LEGACY_VERB = "animus.vocabulary.legacy-verb";
@@ -2291,7 +2324,8 @@ const DIAGNOSTIC_SEVERITY = /* @__PURE__ */ new Map([
2291
2324
  [SELECTOR_UNSUPPORTED_SUBJECT, "error"],
2292
2325
  [UNREADABLE_SOURCE_FILE, "error"],
2293
2326
  [VOCABULARY_COLLISION, "warn"],
2294
- [VOCABULARY_LEGACY_VERB, "warn"]
2327
+ [VOCABULARY_LEGACY_VERB, "warn"],
2328
+ [INVALID_PROPERTY_REGISTRATION, "error"]
2295
2329
  ]);
2296
2330
  /** An unlisted code is `warn`: a witness kind from a newer system package
2297
2331
  * must not fail the strict build of a host that predates its writer. */
@@ -2332,6 +2366,19 @@ function vocabularyWitnessDiagnostics(vocabularyWitnessesJson) {
2332
2366
  });
2333
2367
  return diagnostics;
2334
2368
  }
2369
+ /** The diagnostics a loaded system's own records carry: vocabulary
2370
+ * witnesses and invalid `@property` registrations. */
2371
+ function systemLoadDiagnostics(system) {
2372
+ const registrations = (system.invalidPropertyRegistrations ?? []).map(({ name, reason }) => ({
2373
+ file: "system",
2374
+ component: name,
2375
+ kind: "warn",
2376
+ message: `@property ${name} was not emitted: ${reason}. Browsers ignore an invalid registration and minifying it fails; fix it where the theme declares ${name} (${INVALID_PROPERTY_REGISTRATION})`,
2377
+ code: INVALID_PROPERTY_REGISTRATION,
2378
+ severity: severityFor(INVALID_PROPERTY_REGISTRATION)
2379
+ }));
2380
+ return [...vocabularyWitnessDiagnostics(system.vocabularyWitnessesJson), ...registrations];
2381
+ }
2335
2382
  /**
2336
2383
  * The single strict-escalation policy point for both extraction plugins:
2337
2384
  * error-severity diagnostics throw together under `strict`, else warn.
@@ -2356,9 +2403,14 @@ function surfaceManifestDiagnostics(manifest, warn, policy = {}) {
2356
2403
  }
2357
2404
  //#endregion
2358
2405
  //#region pipeline/unit-fallback.ts
2406
+ /** A digit run after one of these continues a word (`#b1b1b7`, `ss01`,
2407
+ * `U+0025`), so it is not a bare number. The extractor predicts this pass
2408
+ * with `unit_fallback_rewrites` in `crates/extract-v2/src/css.rs`; keep both
2409
+ * in step. */
2410
+ const WORD_CHAR = /[A-Za-z0-9_#+-]/;
2359
2411
  function applyUnitFallback(css) {
2360
- return css.replace(/([a-z-]+)\s*:\s*([^;{}]+);/g, (match, prop, value) => {
2361
- if (isUnitlessProperty(prop)) return match;
2412
+ return css.replace(/(--[\w-]+|[a-z-]+)\s*:\s*([^;{}]+);/g, (match, prop, value) => {
2413
+ if (isUnitlessProperty(prop) || prop.startsWith("--")) return match;
2362
2414
  let depth = 0;
2363
2415
  let fixed = "";
2364
2416
  let i = 0;
@@ -2373,8 +2425,14 @@ function applyUnitFallback(css) {
2373
2425
  } else if (depth > 0) {
2374
2426
  fixed += value[i];
2375
2427
  i++;
2428
+ } else if (value[i] === "\"" || value[i] === "'") {
2429
+ let end = i + 1;
2430
+ while (end < value.length && value[end] !== value[i]) end += value[end] === "\\" ? 2 : 1;
2431
+ end = Math.min(end + 1, value.length);
2432
+ fixed += value.slice(i, end);
2433
+ i = end;
2376
2434
  } else {
2377
- const numMatch = value.slice(i).match(/^(-?\d+\.?\d*)/);
2435
+ const numMatch = i === 0 || !WORD_CHAR.test(value[i - 1]) ? value.slice(i).match(/^([+-]?\d+\.?\d*)/) : null;
2378
2436
  if (numMatch) {
2379
2437
  const num = numMatch[1];
2380
2438
  const after = value[i + num.length];
@@ -2399,7 +2457,7 @@ function buildAnalysisInputs(opts) {
2399
2457
  css_module_id: opts.emitter.cssModuleId
2400
2458
  };
2401
2459
  if (opts.emitter.systemPropsModuleId) emitterConfig.system_props_module_id = opts.emitter.systemPropsModuleId;
2402
- return {
2460
+ const inputs = {
2403
2461
  filesJson: JSON.stringify(opts.fileEntries),
2404
2462
  scalesJson: opts.system.scalesJson,
2405
2463
  variableMapJson: opts.system.variableMapJson,
@@ -2416,8 +2474,11 @@ function buildAnalysisInputs(opts) {
2416
2474
  staticCssJson: opts.staticCssJson ?? null,
2417
2475
  conditionAliasesJson: opts.system.conditionAliasesJson ?? null,
2418
2476
  transformSourcesJson: opts.system.transformSourcesJson ?? null,
2477
+ transformProvenanceJson: opts.system.transformProvenanceJson ?? null,
2419
2478
  externalDirsJson: opts.externalDirs?.length && hasSourceThemeManifests(opts.system) ? JSON.stringify(opts.externalDirs) : null
2420
2479
  };
2480
+ if (opts.system.declarationScalesJson) inputs.declarationScalesJson = opts.system.declarationScalesJson;
2481
+ return inputs;
2421
2482
  }
2422
2483
  function hasSourceThemeManifests(system) {
2423
2484
  const json = system.sourceThemeManifestsJson ?? "";
@@ -2439,7 +2500,11 @@ function runProjectAnalysis(engineApi, opts) {
2439
2500
  const manifest = JSON.parse(manifestJson);
2440
2501
  surfaceManifestDiagnostics(manifest, opts.warn, {
2441
2502
  strict: opts.strict,
2442
- prepend: [...collectSelectorAliasDiagnostics(opts.system.selectorAliasesJson), ...opts.extraDiagnostics ?? []]
2503
+ prepend: [
2504
+ ...collectSelectorAliasDiagnostics(opts.system.selectorAliasesJson),
2505
+ ...systemLoadDiagnostics(opts.system),
2506
+ ...opts.extraDiagnostics ?? []
2507
+ ]
2443
2508
  });
2444
2509
  const parseMs = Math.round(performance.now() - t);
2445
2510
  return {
@@ -2499,6 +2564,11 @@ function serializeStaticCss(config) {
2499
2564
  }
2500
2565
  //#endregion
2501
2566
  //#region pipeline/prefix.ts
2567
+ /** Prefix variable references without changing their matching rules. */
2568
+ function prefixVariableReferences(prefix, value) {
2569
+ if (!prefix) return value;
2570
+ return value.replace(/var\(--([a-zA-Z][\w-]*)\)/g, `var(--${prefix}-$1)`);
2571
+ }
2502
2572
  function applyPrefix(prefix, variableMapJson, variableCss, themeJson, contextualVarsJson) {
2503
2573
  if (!prefix) return {
2504
2574
  variableMapJson,
@@ -2506,18 +2576,18 @@ function applyPrefix(prefix, variableMapJson, variableCss, themeJson, contextual
2506
2576
  themeJson,
2507
2577
  contextualVarsJson
2508
2578
  };
2509
- const varRefRe = /var\(--([a-zA-Z][\w-]*)\)/g;
2510
2579
  const map = JSON.parse(variableMapJson);
2511
2580
  const prefixed = {};
2512
2581
  for (const [key, varName] of Object.entries(map)) prefixed[key] = varName.startsWith("--") ? `--${prefix}-${varName.slice(2)}` : varName;
2513
2582
  let css = variableCss;
2514
2583
  css = css.replace(/--([a-zA-Z][\w-]*)\s*:/g, `--${prefix}-$1:`);
2515
- css = css.replace(varRefRe, `var(--${prefix}-$1)`);
2584
+ css = prefixVariableReferences(prefix, css);
2585
+ css = css.replace(/@property(\s+)--([a-zA-Z][\w-]*)/g, `@property$1--${prefix}-$2`);
2516
2586
  const result = {
2517
2587
  variableMapJson: JSON.stringify(prefixed),
2518
2588
  variableCss: css
2519
2589
  };
2520
- if (themeJson) result.themeJson = themeJson.replace(varRefRe, `var(--${prefix}-$1)`);
2590
+ if (themeJson) result.themeJson = prefixVariableReferences(prefix, themeJson);
2521
2591
  if (contextualVarsJson) {
2522
2592
  const ctxVars = JSON.parse(contextualVarsJson);
2523
2593
  const prefixedCtx = {};
@@ -2527,6 +2597,88 @@ function applyPrefix(prefix, variableMapJson, variableCss, themeJson, contextual
2527
2597
  return result;
2528
2598
  }
2529
2599
  //#endregion
2600
+ //#region pipeline/property-registrations.ts
2601
+ const PROPERTY_RULE = /@property\s+(--[\w-]+)\s*\{[^}]*\}\n?/g;
2602
+ /** The data types a registration's `syntax` may name. */
2603
+ const SYNTAX_TYPES = /* @__PURE__ */ new Set([
2604
+ "angle",
2605
+ "color",
2606
+ "custom-ident",
2607
+ "image",
2608
+ "integer",
2609
+ "length",
2610
+ "length-percentage",
2611
+ "number",
2612
+ "percentage",
2613
+ "resolution",
2614
+ "string",
2615
+ "time",
2616
+ "transform-function",
2617
+ "transform-list",
2618
+ "url"
2619
+ ]);
2620
+ const SYNTAX_COMPONENT = /^(?:<([a-z-]+)>[+#]?|-?[a-zA-Z_][\w-]*)$/;
2621
+ /** The syntax types whose values can carry a font- or container-relative
2622
+ * unit, which makes a typed initial value depend on context. */
2623
+ const DIMENSION_TYPES = /* @__PURE__ */ new Set([
2624
+ "image",
2625
+ "length",
2626
+ "length-percentage",
2627
+ "transform-function",
2628
+ "transform-list"
2629
+ ]);
2630
+ const RELATIVE_UNIT = /(?:\d|\.)(?:r?em|r?ex|r?cap|r?ch|r?ic|r?lh|cq(?:w|h|i|b|min|max))\b/i;
2631
+ const SUBSTITUTION = /\b(?:var|env|attr)\(/i;
2632
+ /** Quoted strings and `url()` hold text, never units or substitutions. */
2633
+ const LITERAL_TEXT = /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|url\([^)]*\)/gi;
2634
+ /**
2635
+ * Removes the `@property` rules browsers would ignore — an unknown syntax
2636
+ * component, a syntax other than `*` without an initial value, an initial
2637
+ * value that depends on context, or one the syntax does not accept.
2638
+ * Minifying a stylesheet that contains such a rule can also fail.
2639
+ */
2640
+ function splitInvalidPropertyRegistrations(css) {
2641
+ const invalid = [];
2642
+ return {
2643
+ css: css.replace(PROPERTY_RULE, (rule, name) => {
2644
+ const reason = registrationFailure(rule);
2645
+ if (reason === null) return rule;
2646
+ invalid.push({
2647
+ name,
2648
+ reason
2649
+ });
2650
+ return "";
2651
+ }),
2652
+ invalid
2653
+ };
2654
+ }
2655
+ function registrationFailure(rule) {
2656
+ const syntax = /syntax:\s*"([^"]*)"/.exec(rule)?.[1]?.trim() ?? "";
2657
+ const initialValue = /initial-value\s*:\s*([^;}]*)/.exec(rule)?.[1]?.trim();
2658
+ if (syntax !== "*") {
2659
+ const components = syntax.split("|").map((component) => ({
2660
+ text: component.trim(),
2661
+ match: SYNTAX_COMPONENT.exec(component.trim())
2662
+ }));
2663
+ const unknown = components.find(({ match }) => match === null || match[1] !== void 0 && !SYNTAX_TYPES.has(match[1]));
2664
+ if (unknown !== void 0) return `syntax "${syntax}" has the unknown component "${unknown.text}"`;
2665
+ if (initialValue === void 0) return `syntax "${syntax}" needs an initialValue`;
2666
+ const dimensional = components.some(({ match }) => match?.[1] !== void 0 && DIMENSION_TYPES.has(match[1]));
2667
+ const value = initialValue.replace(LITERAL_TEXT, "");
2668
+ if (SUBSTITUTION.test(value) || dimensional && RELATIVE_UNIT.test(value)) return `initialValue "${initialValue}" depends on context; font- and container-relative units and var(), env() and attr() are not allowed`;
2669
+ }
2670
+ try {
2671
+ transform({
2672
+ filename: "animus-registrations.css",
2673
+ code: Buffer.from(rule)
2674
+ });
2675
+ return null;
2676
+ } catch (error) {
2677
+ const detail = error instanceof Error ? error.message : String(error);
2678
+ return `the CSS parser rejects \`${rule.trim()}\` (${detail})`;
2679
+ }
2680
+ }
2681
+ //#endregion
2530
2682
  //#region pipeline/system-config.ts
2531
2683
  /**
2532
2684
  * Load and normalize a SystemInstance; `prefix` namespaces every CSS
@@ -2537,16 +2689,19 @@ function loadSystemConfig(engineApi, opts) {
2537
2689
  const config = loadSystemModule(opts.systemPath, opts.rootDir);
2538
2690
  let scalesJson = config.scalesJson;
2539
2691
  let variableMapJson = config.variableMapJson;
2540
- let variableCss = config.variableCss;
2692
+ const registrations = splitInvalidPropertyRegistrations(config.variableCss);
2693
+ let variableCss = registrations.css;
2541
2694
  let contextualVarsJson = config.contextualVarsJson || null;
2695
+ let declarationScalesJson = config.declarationScalesJson || null;
2542
2696
  if (opts.prefix) {
2543
2697
  const prefixed = applyPrefix(opts.prefix, variableMapJson, variableCss, scalesJson, contextualVarsJson || void 0);
2544
2698
  variableMapJson = prefixed.variableMapJson;
2545
2699
  variableCss = prefixed.variableCss;
2546
2700
  if (prefixed.themeJson) scalesJson = prefixed.themeJson;
2547
2701
  if (prefixed.contextualVarsJson) contextualVarsJson = prefixed.contextualVarsJson;
2702
+ if (declarationScalesJson) declarationScalesJson = prefixVariableReferences(opts.prefix, declarationScalesJson);
2548
2703
  }
2549
- return {
2704
+ const system = {
2550
2705
  propConfigJson: config.propConfig,
2551
2706
  groupRegistryJson: config.groupRegistry,
2552
2707
  scalesJson,
@@ -2556,12 +2711,16 @@ function loadSystemConfig(engineApi, opts) {
2556
2711
  selectorAliasesJson: config.selectorAliases || null,
2557
2712
  conditionAliasesJson: config.conditionAliases || null,
2558
2713
  transformSourcesJson: config.transformSources || null,
2714
+ transformProvenanceJson: config.transformProvenance || null,
2559
2715
  globalStyleBlocksJson: config.globalStyleBlocks || null,
2560
2716
  keyframesJson: config.keyframesBlocks || null,
2561
2717
  vocabularyWitnessesJson: config.vocabularyWitnesses || null,
2562
2718
  dependencies: config.dependencies ?? [],
2563
2719
  sourceThemeManifestsJson: config.sourceThemeManifests || null
2564
2720
  };
2721
+ if (declarationScalesJson) system.declarationScalesJson = declarationScalesJson;
2722
+ if (registrations.invalid.length > 0) system.invalidPropertyRegistrations = registrations.invalid;
2723
+ return system;
2565
2724
  }
2566
2725
  //#endregion
2567
2726
  //#region pipeline/structural-self-check.ts
@@ -2591,6 +2750,16 @@ function runStructuralSelfCheck(input) {
2591
2750
  function buildDynamicPropConfig(dynamicProps) {
2592
2751
  const configEntries = {};
2593
2752
  for (const [propName, meta] of Object.entries(dynamicProps)) {
2753
+ if (meta.kind === "declarations") {
2754
+ if (!meta.slotClass || !meta.memberVars || !meta.declarationScaleValues) throw new Error(`buildDynamicPropConfig: declaration prop '${propName}' carries no member metadata — expected slotClass, memberVars and declarationScaleValues.`);
2755
+ configEntries[propName] = {
2756
+ kind: meta.kind,
2757
+ slotClass: meta.slotClass,
2758
+ memberVars: meta.memberVars,
2759
+ declarationScaleValues: meta.declarationScaleValues
2760
+ };
2761
+ continue;
2762
+ }
2594
2763
  if (!meta.varName || !meta.slotClass) throw new Error(`buildDynamicPropConfig: dynamic prop '${propName}' carries no slot metadata — expected varName and slotClass, got keys [${Object.keys(meta).join(", ")}].`);
2595
2764
  const entry = {
2596
2765
  varName: meta.varName,
@@ -2599,16 +2768,39 @@ function buildDynamicPropConfig(dynamicProps) {
2599
2768
  if (meta.property) entry.property = meta.property;
2600
2769
  if (meta.properties && meta.properties.length > 0) entry.properties = meta.properties;
2601
2770
  if (meta.transformName) entry.transformName = meta.transformName;
2771
+ if (meta.transformId) entry.transformId = meta.transformId;
2602
2772
  if (meta.scaleValues && Object.keys(meta.scaleValues).length > 0) entry.scaleValues = meta.scaleValues;
2773
+ if (meta.negative) entry.negative = true;
2774
+ if (meta.strict) entry.strict = true;
2775
+ if (meta.keywords?.length) entry.keywords = meta.keywords;
2603
2776
  configEntries[propName] = entry;
2604
2777
  }
2605
2778
  return configEntries;
2606
2779
  }
2607
2780
  //#endregion
2608
2781
  //#region pipeline/system-props-module.ts
2782
+ /** Compiles the exact entry text in strict mode, the mode of the ES module it
2783
+ * lands in, without evaluating it: one malformed entry would otherwise fail
2784
+ * the whole module. */
2785
+ function parsesAsEntry(entry) {
2786
+ try {
2787
+ Function(`'use strict'; return {\n${entry}};`);
2788
+ return true;
2789
+ } catch {
2790
+ return false;
2791
+ }
2792
+ }
2793
+ /** Delivers the loaded system's configured transform sources that analysis
2794
+ * admitted, keyed by definition and wrapped as `({source})` like the
2795
+ * build-time evaluator registers them. Static evaluation uses the same
2796
+ * definitions, so a same-named project declaration reaches neither path. */
2797
+ function transformsSource(admittedTransforms) {
2798
+ const entries = Object.entries(admittedTransforms).sort(([a], [b]) => a < b ? -1 : 1).map(([name, source]) => ` ${JSON.stringify(name)}: (${source}),\n`).filter(parsesAsEntry);
2799
+ return entries.length > 0 ? `{\n${entries.join("")}}` : "{}";
2800
+ }
2609
2801
  function buildSystemPropsModule(opts) {
2610
2802
  const dynamicPropConfig = buildDynamicPropConfig(opts.dynamicProps);
2611
- return `export const systemPropMap = ${opts.systemPropMapJson};\nexport const systemPropGroups = ${opts.groupRegistryJson};\nexport const dynamicPropConfig = ${JSON.stringify(dynamicPropConfig)};\nexport const transforms = ${opts.transformsSource ?? "{}"};\n`;
2803
+ return `export const systemPropMap = ${opts.systemPropMapJson};\nexport const systemPropGroups = ${opts.groupRegistryJson};\nexport const dynamicPropConfig = ${JSON.stringify(dynamicPropConfig)};\nexport const transforms = ${transformsSource(opts.admittedTransforms)};\n` + (opts.typedSystemProps.length > 0 ? `export const typedSystemProps = ${JSON.stringify(opts.typedSystemProps)};\n` : "");
2612
2804
  }
2613
2805
  //#endregion
2614
2806
  //#region pipeline/timing-waterfall.ts
@@ -2902,4 +3094,4 @@ function realpathThroughNearestExistingAncestor(path) {
2902
3094
  }
2903
3095
  }
2904
3096
  //#endregion
2905
- export { DEFAULT_EXCLUDE as $, enforceExternalTokenContracts as A, firstOwners as B, surfaceManifestDiagnostics as C, validateLayerOrder as Ct, postProcessCss as D, vocabularyWitnessDiagnostics as E, createSourceCorpus as F, walkPackageSources as G, resolveAbsolutePathSpecifier as H, collectExternalPackageSources as I, sharesVolumeRoot as J, createSourceIdentity as K, excludeCollectedPackages as L, resolveThroughPathAliases as M, findAssetSpecifiers as N, resolveLightningTargets as O, substituteAssetPlaceholders as P, CORE_OPTION_KEYS as Q, extractSystemFilePackages as R, isUnresolvedParentDrop as S, stripLeadingLayerDeclaration as St, unresolvedParentName as T, staleDistIncludesMessage as U, isExcludedPackageRelativePath as V, unresolvableIncludesMessage as W, discoverFiles as X, compareDiscoveryOrder as Y, AnimusConfigError as Z, clearEngineCache as _, preprocessMdx as _t, assertNoErrorDiagnostics as a, resolveMode as at, VOCABULARY_COLLISION as b, ANIMUS_LAYERS as bt, buildSystemPropsModule as c, createV2EngineApi as ct, loadSystemConfig as d, parseFilesJson as dt, DRIVER_NAMESPACES as et, applyPrefix as f, projectExternalFileOwners as ft, buildAnalysisInputs as g, isEngineTransformExtension as gt, stableStringify as h, ENGINE_TRANSFORM_EXTENSIONS as ht, snapshotFilePlans as i, createExcludeMatcher as it, resolveAssetFile as j, buildPathAliasesJson as k, buildDynamicPropConfig as l, ingestSourceEntries as lt, camelToKebab as m, DEFAULT_EXTENSIONS as mt, diffFilePlans as n, STRUCTURAL_EXCLUDE as nt, readTsconfigAliasPairs as o, RETIRED_ENGINE_MESSAGE as ot, serializeStaticCss as p, adaptSvelteSource as pt, isPathWithinRoot as q, hashReplacementPlans as r, assertKnownOptionKeys as rt, formatRustTimingWaterfall as s, assertNoRetiredEngineSelection as st, toWatchKeys as t, REPLACEABLE_DEFAULT_EXCLUDE as tt, runStructuralSelfCheck as u, isAdvisorySourceDiagnostic as ut, runProjectAnalysis as v, contentHash as vt, unreadableSourceDiagnostic as w, __require as wt, VOCABULARY_LEGACY_VERB as x, assembleStylesheet as xt, applyUnitFallback as y, buildAnalyzeProjectArgs as yt, findPackageRoot as z };
3097
+ export { AnimusConfigError as $, resolveLightningTargets as A, extractSystemFilePackages as B, isUnresolvedParentDrop as C, ANIMUS_LAYERS as Ct, unresolvedParentName as D, __require as Dt, unreadableSourceDiagnostic as E, validateLayerOrder as Et, findAssetSpecifiers as F, staleDistIncludesMessage as G, firstOwners as H, substituteAssetPlaceholders as I, createSourceIdentity as J, unresolvableIncludesMessage as K, createSourceCorpus as L, enforceExternalTokenContracts as M, resolveAssetFile as N, vocabularyWitnessDiagnostics as O, resolveThroughPathAliases as P, discoverFiles as Q, collectExternalPackageSources as R, VOCABULARY_LEGACY_VERB as S, buildAnalyzeProjectArgs as St, systemLoadDiagnostics as T, stripLeadingLayerDeclaration as Tt, isExcludedPackageRelativePath as U, findPackageRoot as V, resolveAbsolutePathSpecifier as W, sharesVolumeRoot as X, isPathWithinRoot as Y, compareDiscoveryOrder as Z, clearEngineCache as _, DEFAULT_EXTENSIONS as _t, assertNoErrorDiagnostics as a, assertKnownOptionKeys as at, INVALID_PROPERTY_REGISTRATION as b, preprocessMdx as bt, buildSystemPropsModule as c, resolveVerbosity as ct, loadSystemConfig as d, createV2EngineApi as dt, CORE_OPTION_KEYS as et, applyPrefix as f, ingestSourceEntries as ft, buildAnalysisInputs as g, adaptSvelteSource as gt, stableStringify as h, projectExternalFileOwners as ht, snapshotFilePlans as i, STRUCTURAL_EXCLUDE as it, buildPathAliasesJson as j, postProcessCss as k, buildDynamicPropConfig as l, RETIRED_ENGINE_MESSAGE as lt, camelToKebab as m, parseFilesJson as mt, diffFilePlans as n, DRIVER_NAMESPACES as nt, readTsconfigAliasPairs as o, createExcludeMatcher as ot, serializeStaticCss as p, isAdvisorySourceDiagnostic as pt, walkPackageSources as q, hashReplacementPlans as r, REPLACEABLE_DEFAULT_EXCLUDE as rt, formatRustTimingWaterfall as s, resolveMode as st, toWatchKeys as t, DEFAULT_EXCLUDE as tt, runStructuralSelfCheck as u, assertNoRetiredEngineSelection as ut, runProjectAnalysis as v, ENGINE_TRANSFORM_EXTENSIONS as vt, surfaceManifestDiagnostics as w, assembleStylesheet as wt, VOCABULARY_COLLISION as x, contentHash as xt, applyUnitFallback as y, isEngineTransformExtension as yt, excludeCollectedPackages as z };