@reqvire-org/ads 0.3.9 → 0.3.10

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.
@@ -28,7 +28,8 @@ export function previewEntriesPlugin(entries, mountEntry) {
28
28
  load(id) {
29
29
  const entry = ids.get(id.slice(1));
30
30
  if (!entry) return;
31
- return `import { mountScenario } from ${JSON.stringify(mountEntry)};import Scenario from ${JSON.stringify(path.resolve(entry.root, entry.file))};export const mount = container => mountScenario(Scenario,container);`;
31
+ const styles = (entry.stylesheets ?? []).map(file => `import ${JSON.stringify(path.resolve(entry.root, file))};`).join("");
32
+ return `import { mountScenario } from ${JSON.stringify(mountEntry)};${styles}import Scenario from ${JSON.stringify(path.resolve(entry.root, entry.file))};export const mount = container => mountScenario(Scenario,container);`;
32
33
  },
33
34
  };
34
35
  }
@@ -110,7 +110,8 @@ export function inspectScenarios(options, suppliedProgram) {
110
110
  const owner = scoped.inventory.owner(relative);
111
111
  for (const name of tokens) if (tokenInventory.tokens.find(token => token.name === name)?.owner !== owner) report(file, `Token ${name} needs a preview beside its defining owner. Shared tokens belong under the configured token directory; local tokens stay with their component/pattern.`);
112
112
  }
113
- scenarios.push({ id, kind, title: metadata.title, covers: [...new Set(metadata.covers)], ...(Object.hasOwn(metadata, "exercises") ? { exercises: [...new Set(exercises)] } : {}), tokens, ...(metadata.samples ? { samples: metadata.samples } : {}), file: path.relative(root, file).replaceAll("\\", "/"), artifact: path.relative(root, scenarioArtifact(root, id)).replaceAll("\\", "/") });
113
+ const stylesheets = kind === "tokens" ? scoped.definitions.filter(entry => entry.unit === scoped.inventory.owner(relative)).map(entry => entry.file) : [];
114
+ scenarios.push({ id, kind, title: metadata.title, covers: [...new Set(metadata.covers)], ...(Object.hasOwn(metadata, "exercises") ? { exercises: [...new Set(exercises)] } : {}), tokens, ...(metadata.samples ? { samples: metadata.samples } : {}), ...(stylesheets.length ? { stylesheets } : {}), file: path.relative(root, file).replaceAll("\\", "/"), artifact: path.relative(root, scenarioArtifact(root, id)).replaceAll("\\", "/") });
114
115
  }
115
116
  return { scenarios: scenarios.sort((a, b) => a.id.localeCompare(b.id)), diagnostics };
116
117
  }
@@ -1,8 +1,23 @@
1
- # Scenario render evidence and public class helpers
1
+ # Scenario rendering, token previews and public class helpers
2
2
 
3
3
  Use this reference for `scenario-render`, `scenario-coverage` or `showcase-class`
4
4
  diagnostics. MCP serves the same guide as `ads://guides/scenarios`.
5
5
 
6
+ ## Owner-local token previews load their own definitions
7
+
8
+ Keep the registered token sheet imported by its runtime owner for product use.
9
+ A colocated `kind: "tokens"` scenario may render only the public review pattern
10
+ with its fixture samples. Discovery adds the registered owner sheet to the
11
+ generated record's `stylesheets`; `previewEntriesPlugin` imports those paths
12
+ into the token preview independently of the runtime component. Custom builders
13
+ that replace this plugin must preserve these explicit stylesheet dependencies.
14
+ Do not render the runtime owner merely to retain its CSS or add unrelated sheets.
15
+
16
+ Open the exact token scenario in a fresh App and verify resolved values and sample
17
+ effects in both themes. A successful ordinary component preview does not prove
18
+ the independently bundled token preview loads the same definitions. Shared
19
+ foundation styling still follows the project's mount/build integration.
20
+
6
21
  ## Public children can share their parent's scenario
7
22
 
8
23
  Declare the public parts actually demonstrated in `covers`, even when their
@@ -1,8 +1,23 @@
1
- # Scenario render evidence and public class helpers
1
+ # Scenario rendering, token previews and public class helpers
2
2
 
3
3
  Use this reference for `scenario-render`, `scenario-coverage` or `showcase-class`
4
4
  diagnostics. MCP serves the same guide as `ads://guides/scenarios`.
5
5
 
6
+ ## Owner-local token previews load their own definitions
7
+
8
+ Keep the registered token sheet imported by its runtime owner for product use.
9
+ A colocated `kind: "tokens"` scenario may render only the public review pattern
10
+ with its fixture samples. Discovery adds the registered owner sheet to the
11
+ generated record's `stylesheets`; `previewEntriesPlugin` imports those paths
12
+ into the token preview independently of the runtime component. Custom builders
13
+ that replace this plugin must preserve these explicit stylesheet dependencies.
14
+ Do not render the runtime owner merely to retain its CSS or add unrelated sheets.
15
+
16
+ Open the exact token scenario in a fresh App and verify resolved values and sample
17
+ effects in both themes. A successful ordinary component preview does not prove
18
+ the independently bundled token preview loads the same definitions. Shared
19
+ foundation styling still follows the project's mount/build integration.
20
+
6
21
  ## Public children can share their parent's scenario
7
22
 
8
23
  Declare the public parts actually demonstrated in `covers`, even when their
@@ -1,8 +1,23 @@
1
- # Scenario render evidence and public class helpers
1
+ # Scenario rendering, token previews and public class helpers
2
2
 
3
3
  Use this reference for `scenario-render`, `scenario-coverage` or `showcase-class`
4
4
  diagnostics. MCP serves the same guide as `ads://guides/scenarios`.
5
5
 
6
+ ## Owner-local token previews load their own definitions
7
+
8
+ Keep the registered token sheet imported by its runtime owner for product use.
9
+ A colocated `kind: "tokens"` scenario may render only the public review pattern
10
+ with its fixture samples. Discovery adds the registered owner sheet to the
11
+ generated record's `stylesheets`; `previewEntriesPlugin` imports those paths
12
+ into the token preview independently of the runtime component. Custom builders
13
+ that replace this plugin must preserve these explicit stylesheet dependencies.
14
+ Do not render the runtime owner merely to retain its CSS or add unrelated sheets.
15
+
16
+ Open the exact token scenario in a fresh App and verify resolved values and sample
17
+ effects in both themes. A successful ordinary component preview does not prove
18
+ the independently bundled token preview loads the same definitions. Shared
19
+ foundation styling still follows the project's mount/build integration.
20
+
6
21
  ## Public children can share their parent's scenario
7
22
 
8
23
  Declare the public parts actually demonstrated in `covers`, even when their
@@ -1,8 +1,23 @@
1
- # Scenario render evidence and public class helpers
1
+ # Scenario rendering, token previews and public class helpers
2
2
 
3
3
  Use this reference for `scenario-render`, `scenario-coverage` or `showcase-class`
4
4
  diagnostics. MCP serves the same guide as `ads://guides/scenarios`.
5
5
 
6
+ ## Owner-local token previews load their own definitions
7
+
8
+ Keep the registered token sheet imported by its runtime owner for product use.
9
+ A colocated `kind: "tokens"` scenario may render only the public review pattern
10
+ with its fixture samples. Discovery adds the registered owner sheet to the
11
+ generated record's `stylesheets`; `previewEntriesPlugin` imports those paths
12
+ into the token preview independently of the runtime component. Custom builders
13
+ that replace this plugin must preserve these explicit stylesheet dependencies.
14
+ Do not render the runtime owner merely to retain its CSS or add unrelated sheets.
15
+
16
+ Open the exact token scenario in a fresh App and verify resolved values and sample
17
+ effects in both themes. A successful ordinary component preview does not prove
18
+ the independently bundled token preview loads the same definitions. Shared
19
+ foundation styling still follows the project's mount/build integration.
20
+
6
21
  ## Public children can share their parent's scenario
7
22
 
8
23
  Declare the public parts actually demonstrated in `covers`, even when their
@@ -1,8 +1,23 @@
1
- # Scenario render evidence and public class helpers
1
+ # Scenario rendering, token previews and public class helpers
2
2
 
3
3
  Use this reference for `scenario-render`, `scenario-coverage` or `showcase-class`
4
4
  diagnostics. MCP serves the same guide as `ads://guides/scenarios`.
5
5
 
6
+ ## Owner-local token previews load their own definitions
7
+
8
+ Keep the registered token sheet imported by its runtime owner for product use.
9
+ A colocated `kind: "tokens"` scenario may render only the public review pattern
10
+ with its fixture samples. Discovery adds the registered owner sheet to the
11
+ generated record's `stylesheets`; `previewEntriesPlugin` imports those paths
12
+ into the token preview independently of the runtime component. Custom builders
13
+ that replace this plugin must preserve these explicit stylesheet dependencies.
14
+ Do not render the runtime owner merely to retain its CSS or add unrelated sheets.
15
+
16
+ Open the exact token scenario in a fresh App and verify resolved values and sample
17
+ effects in both themes. A successful ordinary component preview does not prove
18
+ the independently bundled token preview loads the same definitions. Shared
19
+ foundation styling still follows the project's mount/build integration.
20
+
6
21
  ## Public children can share their parent's scenario
7
22
 
8
23
  Declare the public parts actually demonstrated in `covers`, even when their
@@ -170,7 +170,11 @@ export function createVerificationController(root) {
170
170
  if (profile.mode === "browser" && group.some(check => check.scenario)) {
171
171
  const { startAdsMcp } = await import("./mcp/server.mjs");
172
172
  host ??= await startAdsMcp(root, { stdio: false, showcase: true });
173
- for (const check of group.filter(check => check.scenario)) { const url = new URL(host.url); url.searchParams.set("scenario", check.scenario); scenarios[check.scenario] = url.href; }
173
+ for (const check of group.filter(check => check.scenario)) {
174
+ const url = new URL(host.url), scenario = context.scenarios.find(entry => entry.id === check.scenario);
175
+ url.searchParams.set(scenario?.kind === "tokens" ? "category" : "scenario", check.scenario);
176
+ scenarios[check.scenario] = url.href;
177
+ }
174
178
  }
175
179
  const requestContext = { schemaVersion: 1, runId, projectRoot: root, framework: options.config.framework, profile: profileName, mode: profile.mode ?? "unit", checks: group.map(({ contract: _contract, ...check }) => check), scenarios };
176
180
  writeFileSync(request, JSON.stringify(requestContext));
package/docs/ADS.md CHANGED
@@ -209,6 +209,11 @@ Measured runtime variables retain their existing exact `styleWrites` boundary.
209
209
 
210
210
  A colocated scenario sets `kind:"tokens"` and declares real fixture `samples`
211
211
  consumed by a public review pattern. Its ID still derives from its source path.
212
+ Discovery attaches its owner's registered definition sheet as `stylesheets` on
213
+ the generated scenario record; `previewEntriesPlugin` imports it directly into
214
+ that preview's module graph. CSS-only package side effects can then tree-shake
215
+ the runtime component without dropping the token definitions. Keep the runtime
216
+ CSS import for product use; the token scenario need not import or render its owner.
212
217
  Every local token needs this real sample coverage, just like shared tokens.
213
218
  Definitions, metadata, fixture and token scenario belong to the same edit unit.
214
219
  Manifests/fixtures are development inputs; production includes the runtime's
@@ -434,6 +434,8 @@ verification, and the browser check does not judge design quality.
434
434
  An optional owner-local token namespace keeps component/pattern constants beside
435
435
  their consumer. Its definition-only stylesheet contains root/theme custom
436
436
  properties and is imported by the runtime owner; UI styling remains in Linaria.
437
+ Independent owner-token preview entries also import the registered definition
438
+ sheet directly, so tree-shaking an unused runtime owner cannot remove their values.
437
439
  Namespaces, aliases, ownership and actual colocated sample coverage are checked.
438
440
  The shared foundation remains the cross-owner vocabulary. See the
439
441
  [owner-token contract](ADS.md#owner-local-tokens).
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.10
4
+
5
+ - Attach registered owner-local token sheets to independently compiled token
6
+ previews, preserving definitions under CSS-only package side effects without
7
+ retaining runtime owners or loading peer sheets. Verify resource closure in
8
+ React/Preact and rendered samples in a sandboxed App in both themes.
9
+ - Route managed browser checks for owner-local token scenarios through the
10
+ discovered token category, independent of their component/pattern file paths.
11
+
3
12
  ## 0.3.9
4
13
 
5
14
  - Credit explicitly declared public child renders reached through parents,
package/docs/MCP.md CHANGED
@@ -560,6 +560,10 @@ framework compilation and Linaria extraction. The starter's
560
560
  - Its `buildGraph(entries, options, track)` adapter runs one multi-entry Vite build
561
561
  with `previewEntriesPlugin()` and `createPreviewResources()` from
562
562
  `@reqvire-org/ads/scenarios/vite`.
563
+ Generated owner-token entries include `stylesheets` derived from the registered
564
+ owner manifest. Pass the entries intact: the plugin imports those definition
565
+ sheets even when the runtime owner is tree-shaken. A replacement entry plugin
566
+ must preserve these dependencies without importing unrelated owners.
563
567
  - Keep `preserveEntrySignatures: "strict"`, `cssCodeSplit: true`,
564
568
  `assetsInlineLimit: 0`, `modulePreload: false`, and `write: false`. Include the
565
569
  supplied dependency-tracking plugin and the project's Linaria/framework plugins.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "type": "module",
5
5
  "description": "A design system your agent can see and shape. Your components. Your look. Your code.",
6
6
  "repository": {