@reqvire-org/ads 0.3.13 → 0.3.15
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.
- package/dist/bootstrap-ds/ADS.md +4 -1
- package/dist/check.mjs +8 -2
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/widget.bundle.js +14 -14
- package/dist/scenario-slots.mjs +124 -0
- package/dist/showcase/sandbox.bundle.js +1 -0
- package/dist/skills/ads-break-ui/SKILL.md +2 -2
- package/dist/skills/ads-break-ui/references/guarded-editing.md +14 -3
- package/dist/skills/ads-break-ui/references/scenarios.md +46 -1
- package/dist/skills/ads-designer/SKILL.md +2 -2
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +4 -1
- package/dist/skills/ads-designer/references/guarded-editing.md +14 -3
- package/dist/skills/ads-designer/references/scenarios.md +46 -1
- package/dist/skills/ads-import/SKILL.md +2 -2
- package/dist/skills/ads-import/references/guarded-editing.md +14 -3
- package/dist/skills/ads-import/references/scenarios.md +46 -1
- package/dist/skills/ads-migrate/SKILL.md +2 -2
- package/dist/skills/ads-migrate/references/guarded-editing.md +14 -3
- package/dist/skills/ads-migrate/references/scenarios.md +46 -1
- package/dist/skills/ads-motion/SKILL.md +2 -2
- package/dist/skills/ads-motion/references/guarded-editing.md +14 -3
- package/dist/skills/ads-motion/references/scenarios.md +46 -1
- package/dist/source-values.mjs +2 -1
- package/dist/verification.mjs +8 -3
- package/docs/ADS.md +5 -2
- package/docs/ARCHITECTURE.md +11 -0
- package/docs/BEHAVIORS.md +8 -3
- package/docs/CHANGELOG.md +17 -0
- package/docs/MCP.md +12 -0
- package/package.json +1 -1
- package/dist/showcase/sandbox.js +0 -30
package/dist/bootstrap-ds/ADS.md
CHANGED
|
@@ -197,7 +197,10 @@ or applies the right CSS property. Browser review still verifies the samples.
|
|
|
197
197
|
|
|
198
198
|
Scenarios and fixture helpers are development-only wherever colocated. Runtime
|
|
199
199
|
source and the public barrel cannot import or re-export them. Showcase/scenario
|
|
200
|
-
code defines no CSS, custom classes or native controls; use public ADS
|
|
200
|
+
code defines no CSS, custom classes or standalone native controls; use public ADS
|
|
201
|
+
APIs. A single direct native child can supply semantics to a public runtime slot
|
|
202
|
+
when source tracing proves that owner clones the exact child with its own props.
|
|
203
|
+
An `asChild` flag alone is not evidence; scenario styling remains forbidden.
|
|
201
204
|
Neither ADS implementations nor scenarios import application code. Live business
|
|
202
205
|
data belongs to application adapters; ADS receives inputs or injected callbacks.
|
|
203
206
|
Direct global `fetch`, XHR, WebSocket and EventSource use is rejected. Renderer
|
package/dist/check.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import { foundationDeclaration, foundationSelector } from "./foundation.mjs";
|
|
|
21
21
|
import { scopedTokens, scopedTokenOwner } from "./scoped-tokens.mjs";
|
|
22
22
|
import { createAtomicCompositionReview } from "./atomic-composition.mjs";
|
|
23
23
|
import { createScenarioTrace } from "./scenario-trace.mjs";
|
|
24
|
+
import { createScenarioSlots } from "./scenario-slots.mjs";
|
|
24
25
|
|
|
25
26
|
const scenarioLayoutGuidance = "Put demo-only sizing and framing in a public review/layout pattern. Keep required behavior in the runtime owner; add component props for deliberate product API needs.";
|
|
26
27
|
const inlineStyleGuidance = `Own visual styles in component/pattern Linaria. ${scenarioLayoutGuidance} Reserve inlineStyleFiles for documented measured geometry, not demo layout.`;
|
|
@@ -54,6 +55,7 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
54
55
|
const checker = program.getTypeChecker();
|
|
55
56
|
const atomicCompositionReview = createAtomicCompositionReview(program, options);
|
|
56
57
|
const scenarioTrace = createScenarioTrace(program, options);
|
|
58
|
+
let scenarioSlot;
|
|
57
59
|
function report(file, rule, message, line = 1, column = 1) {
|
|
58
60
|
diagnostics.push({ file: path.relative(root, file).replaceAll("\\", "/"), rule, message, line, column });
|
|
59
61
|
}
|
|
@@ -168,6 +170,10 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
168
170
|
const proof = scenarioTrace.classValue(expression, property);
|
|
169
171
|
if (proof.present && !proof.ok) nodeReport(node, "showcase-class", `Scenarios define no custom class names. A public class helper must return runtime-owned Linaria styles; stable hooks authored in that owner may accompany real styles. Arbitrary strings, private styles and forwarded consumer classes do not qualify.${proof.reasons.length ? ` ${proof.reasons.join(" ")}` : ""} ${scenarioLayoutGuidance} See ads://guides/scenarios.`);
|
|
170
172
|
}
|
|
173
|
+
function scenarioControl(node) {
|
|
174
|
+
const proof = (scenarioSlot ??= createScenarioSlots(program, options))(node);
|
|
175
|
+
if (!proof.ok) nodeReport(node, "showcase-control", `Scenario controls must render public ADS components for actual interaction. A native direct child may provide semantics only when source tracing proves its public runtime parent clones that child with owned props; an asChild prop alone grants no permission.${proof.reasons.length ? ` ${proof.reasons.join(" ")}` : ""} ${scenarioLayoutGuidance} See ads://guides/scenarios.`);
|
|
176
|
+
}
|
|
171
177
|
if (!showcase && (isInside(path.join(dsRoot, "components"), file) || isInside(path.join(dsRoot, "patterns"), file))) inspectPublicProps(source, checker, nodeReport);
|
|
172
178
|
function isLinariaTag(tag) {
|
|
173
179
|
if (ts.isCallExpression(tag)) tag = tag.expression;
|
|
@@ -225,7 +231,7 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
225
231
|
if (showcase) for (const property of properties) if (ts.isSpreadAssignment(property)) scenarioClass(property, property.expression, true);
|
|
226
232
|
if (showcase && tag && ts.isStringLiteralLike(tag)) {
|
|
227
233
|
const role = properties.find(property => ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name)) && property.name.text === "role")?.initializer;
|
|
228
|
-
if (showcaseControls.has(tag.text) || role && ts.isStringLiteralLike(role) && widgetRoles.has(role.text))
|
|
234
|
+
if (showcaseControls.has(tag.text) || role && ts.isStringLiteralLike(role) && widgetRoles.has(role.text)) scenarioControl(node);
|
|
229
235
|
}
|
|
230
236
|
}
|
|
231
237
|
if (isInside(dsRoot, file) && (ts.isIdentifier(node) && ["fetch", "XMLHttpRequest", "WebSocket", "EventSource"].includes(node.text) && !(ts.isPropertyAccessExpression(node.parent) && node.parent.name === node))) {
|
|
@@ -236,7 +242,7 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
236
242
|
if (showcase && (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) && ts.isIdentifier(node.tagName) && /^[a-z]/.test(node.tagName.text)) {
|
|
237
243
|
const role = node.attributes.properties.find((attr) => ts.isJsxAttribute(attr) && attr.name.text === "role")?.initializer;
|
|
238
244
|
const roleValue = role && ts.isStringLiteralLike(role) ? role.text : role && ts.isJsxExpression(role) && role.expression && ts.isStringLiteralLike(role.expression) ? role.expression.text : null;
|
|
239
|
-
if (showcaseControls.has(node.tagName.text) || widgetRoles.has(roleValue))
|
|
245
|
+
if (showcaseControls.has(node.tagName.text) || widgetRoles.has(roleValue)) scenarioControl(node);
|
|
240
246
|
}
|
|
241
247
|
if (showcase && ts.isJsxAttribute(node) && ts.isIdentifier(node.name) && node.name.text === "className") scenarioClass(node, node.initializer && ts.isJsxExpression(node.initializer) ? node.initializer.expression : node.initializer);
|
|
242
248
|
if (showcase && ts.isJsxSpreadAttribute(node)) scenarioClass(node, node.expression, true);
|
|
@@ -3,7 +3,7 @@ import { readFile } from "node:fs/promises";
|
|
|
3
3
|
|
|
4
4
|
/** A different loopback port provides the browser host's separate sandbox origin. */
|
|
5
5
|
export async function startSandboxHost(parentOrigin) {
|
|
6
|
-
const script = await readFile(new URL("../showcase/sandbox.js", import.meta.url));
|
|
6
|
+
const script = await readFile(new URL("../showcase/sandbox.bundle.js", import.meta.url));
|
|
7
7
|
const web = createServer((req, res) => {
|
|
8
8
|
const origin = `http://127.0.0.1:${web.address().port}`;
|
|
9
9
|
const url = new URL(req.url, origin);
|