@reqvire-org/ads 0.3.14 → 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.
@@ -0,0 +1 @@
1
+ function c(e,t){let n=new DOMParser().parseFromString(e,"text/html"),r=n.createElement("meta");if(r.httpEquiv="Content-Security-Policy",r.content=t,n.head.prepend(r),!n.querySelector("base[href]")){let i=n.querySelector("base")??n.createElement("base");i.setAttribute("href","about:srcdoc"),r.after(i)}return"<!doctype html>"+n.documentElement.outerHTML}var a=new URL(location.href).searchParams.get("parent"),o;function s(e=[]){return e.filter(t=>/^(?:https?:\/\/[a-z0-9.*:[\]-]+(?::\d+)?|data:|blob:|about:)$/i.test(t)).join(" ")}function d(e={}){let t=s(e.resourceDomains);return`default-src 'none';script-src 'unsafe-inline' ${t};style-src 'unsafe-inline' ${t};img-src data: ${t};font-src ${t||"'none'"};media-src ${t||"'none'"};worker-src ${t||"'none'"};connect-src ${s(e.connectDomains)||"'none'"};frame-src ${s(e.frameDomains)||"'none'"};base-uri about: ${s(e.baseUriDomains)};object-src 'none'`}window.addEventListener("message",e=>{if(e.source===parent&&e.origin===a){let t=e.data;if(t?.method==="ui/notifications/sandbox-resource-ready"){let{html:n,csp:r}=t.params??{};if(typeof n!="string")return;o?.remove(),o=window.document.createElement("iframe"),o.title="Design-system App",o.setAttribute("sandbox","allow-scripts"),window.document.body.append(o),o.srcdoc=c(n,d(r))}else t?.jsonrpc==="2.0"&&!t.method?.startsWith("ui/notifications/sandbox-")&&o?.contentWindow.postMessage(t,"*")}else e.source===o?.contentWindow&&e.data?.jsonrpc==="2.0"&&!e.data.method?.startsWith("ui/notifications/sandbox-")&&parent.postMessage(e.data,a)});parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-ready",params:{}},a);
@@ -55,8 +55,8 @@ For on-demand current/candidate screenshots and visual dry-run review, read
55
55
 
56
56
 
57
57
  For parent/child `covers`, conditional-control review, reference comparisons,
58
- public style-helper use in scenarios, or `scenario-render` / `showcase-class`
59
- findings, read [scenario contracts](references/scenarios.md). Its verification
58
+ public style-helper use, fragment-link navigation, or `scenario-render` /
59
+ `showcase-class` findings, read [scenario contracts](references/scenarios.md). Its verification
60
60
  examples explain API visibility, reference baselines and state-transition checks.
61
61
  Traced parents can cover declared public children; verified public Linaria
62
62
  helpers do not grant custom scenario CSS.
@@ -23,6 +23,17 @@ on-demand element screenshots. It grants no render/behavior coverage and no extr
23
23
  styling permission. Use [captures.md](captures.md) for current/candidate review,
24
24
  target selection, resource reads and storage lifecycle.
25
25
 
26
+ ## Fragment links inside Apps
27
+
28
+ Keep intended `href="#"` and named fragments in the project API and fixtures.
29
+ ADS's inline-document loader supplies an `about:srcdoc` base when the App has no
30
+ explicit base, preserving native scrolling, events and state. If a fragment
31
+ replaces the App with a sandbox URL or browser error, inspect `location.href`,
32
+ `document.baseURI` and the resolved anchor URL. Report a host loading defect;
33
+ do not add scenario `preventDefault` handlers merely to hide it. Explicit App
34
+ bases retain their declared behavior and CSP requirements; external hosts own
35
+ their document-loading policy. Verify link activation as well as rendering.
36
+
26
37
  ## Owner-local token previews load their own definitions
27
38
 
28
39
  Keep the registered token sheet imported by its runtime owner for product use.
@@ -86,8 +86,8 @@ For on-demand current/candidate screenshots and visual dry-run review, read
86
86
  [captures.md](references/captures.md).
87
87
 
88
88
  For parent/child `covers`, conditional-control review, reference comparisons,
89
- public style-helper use in scenarios, or `scenario-render` / `showcase-class`
90
- findings, read [scenario contracts](references/scenarios.md). Its verification
89
+ public style-helper use, fragment-link navigation, or `scenario-render` /
90
+ `showcase-class` findings, read [scenario contracts](references/scenarios.md). Its verification
91
91
  examples explain API visibility, reference baselines and state-transition checks.
92
92
  Traced parents can cover declared public children; verified public Linaria
93
93
  helpers do not grant custom scenario CSS.
@@ -23,6 +23,17 @@ on-demand element screenshots. It grants no render/behavior coverage and no extr
23
23
  styling permission. Use [captures.md](captures.md) for current/candidate review,
24
24
  target selection, resource reads and storage lifecycle.
25
25
 
26
+ ## Fragment links inside Apps
27
+
28
+ Keep intended `href="#"` and named fragments in the project API and fixtures.
29
+ ADS's inline-document loader supplies an `about:srcdoc` base when the App has no
30
+ explicit base, preserving native scrolling, events and state. If a fragment
31
+ replaces the App with a sandbox URL or browser error, inspect `location.href`,
32
+ `document.baseURI` and the resolved anchor URL. Report a host loading defect;
33
+ do not add scenario `preventDefault` handlers merely to hide it. Explicit App
34
+ bases retain their declared behavior and CSP requirements; external hosts own
35
+ their document-loading policy. Verify link activation as well as rendering.
36
+
26
37
  ## Owner-local token previews load their own definitions
27
38
 
28
39
  Keep the registered token sheet imported by its runtime owner for product use.
@@ -50,8 +50,8 @@ For on-demand current/candidate screenshots and visual dry-run review, read
50
50
  [captures.md](references/captures.md).
51
51
 
52
52
  For parent/child `covers`, conditional-control review, reference comparisons,
53
- public style-helper use in scenarios, or `scenario-render` / `showcase-class`
54
- findings, read [scenario contracts](references/scenarios.md). Its verification
53
+ public style-helper use, fragment-link navigation, or `scenario-render` /
54
+ `showcase-class` findings, read [scenario contracts](references/scenarios.md). Its verification
55
55
  examples explain API visibility, reference baselines and state-transition checks.
56
56
  Traced parents can cover declared public children; verified public Linaria
57
57
  helpers do not grant custom scenario CSS.
@@ -23,6 +23,17 @@ on-demand element screenshots. It grants no render/behavior coverage and no extr
23
23
  styling permission. Use [captures.md](captures.md) for current/candidate review,
24
24
  target selection, resource reads and storage lifecycle.
25
25
 
26
+ ## Fragment links inside Apps
27
+
28
+ Keep intended `href="#"` and named fragments in the project API and fixtures.
29
+ ADS's inline-document loader supplies an `about:srcdoc` base when the App has no
30
+ explicit base, preserving native scrolling, events and state. If a fragment
31
+ replaces the App with a sandbox URL or browser error, inspect `location.href`,
32
+ `document.baseURI` and the resolved anchor URL. Report a host loading defect;
33
+ do not add scenario `preventDefault` handlers merely to hide it. Explicit App
34
+ bases retain their declared behavior and CSP requirements; external hosts own
35
+ their document-loading policy. Verify link activation as well as rendering.
36
+
26
37
  ## Owner-local token previews load their own definitions
27
38
 
28
39
  Keep the registered token sheet imported by its runtime owner for product use.
@@ -52,8 +52,8 @@ For on-demand current/candidate screenshots and visual dry-run review, read
52
52
 
53
53
 
54
54
  For parent/child `covers`, conditional-control review, reference comparisons,
55
- public style-helper use in scenarios, or `scenario-render` / `showcase-class`
56
- findings, read [scenario contracts](references/scenarios.md). Its verification
55
+ public style-helper use, fragment-link navigation, or `scenario-render` /
56
+ `showcase-class` findings, read [scenario contracts](references/scenarios.md). Its verification
57
57
  examples explain API visibility, reference baselines and state-transition checks.
58
58
  Traced parents can cover declared public children; verified public Linaria
59
59
  helpers do not grant custom scenario CSS.
@@ -23,6 +23,17 @@ on-demand element screenshots. It grants no render/behavior coverage and no extr
23
23
  styling permission. Use [captures.md](captures.md) for current/candidate review,
24
24
  target selection, resource reads and storage lifecycle.
25
25
 
26
+ ## Fragment links inside Apps
27
+
28
+ Keep intended `href="#"` and named fragments in the project API and fixtures.
29
+ ADS's inline-document loader supplies an `about:srcdoc` base when the App has no
30
+ explicit base, preserving native scrolling, events and state. If a fragment
31
+ replaces the App with a sandbox URL or browser error, inspect `location.href`,
32
+ `document.baseURI` and the resolved anchor URL. Report a host loading defect;
33
+ do not add scenario `preventDefault` handlers merely to hide it. Explicit App
34
+ bases retain their declared behavior and CSP requirements; external hosts own
35
+ their document-loading policy. Verify link activation as well as rendering.
36
+
26
37
  ## Owner-local token previews load their own definitions
27
38
 
28
39
  Keep the registered token sheet imported by its runtime owner for product use.
@@ -72,8 +72,8 @@ For on-demand current/candidate screenshots and visual dry-run review, read
72
72
 
73
73
 
74
74
  For parent/child `covers`, conditional-control review, reference comparisons,
75
- public style-helper use in scenarios, or `scenario-render` / `showcase-class`
76
- findings, read [scenario contracts](references/scenarios.md). Its verification
75
+ public style-helper use, fragment-link navigation, or `scenario-render` /
76
+ `showcase-class` findings, read [scenario contracts](references/scenarios.md). Its verification
77
77
  examples explain API visibility, reference baselines and state-transition checks.
78
78
  Traced parents can cover declared public children; verified public Linaria
79
79
  helpers do not grant custom scenario CSS.
@@ -23,6 +23,17 @@ on-demand element screenshots. It grants no render/behavior coverage and no extr
23
23
  styling permission. Use [captures.md](captures.md) for current/candidate review,
24
24
  target selection, resource reads and storage lifecycle.
25
25
 
26
+ ## Fragment links inside Apps
27
+
28
+ Keep intended `href="#"` and named fragments in the project API and fixtures.
29
+ ADS's inline-document loader supplies an `about:srcdoc` base when the App has no
30
+ explicit base, preserving native scrolling, events and state. If a fragment
31
+ replaces the App with a sandbox URL or browser error, inspect `location.href`,
32
+ `document.baseURI` and the resolved anchor URL. Report a host loading defect;
33
+ do not add scenario `preventDefault` handlers merely to hide it. Explicit App
34
+ bases retain their declared behavior and CSP requirements; external hosts own
35
+ their document-loading policy. Verify link activation as well as rendering.
36
+
26
37
  ## Owner-local token previews load their own definitions
27
38
 
28
39
  Keep the registered token sheet imported by its runtime owner for product use.
@@ -213,6 +213,13 @@ Project JavaScript, styles, fonts and UI run only inside that App; the outer
213
213
  shell forwards resource bytes without applying project styles or executing its
214
214
  runtime. This keeps the host neutral while compositions retain their full skin.
215
215
 
216
+ The ADS host gives inline App documents an `about:srcdoc` base when the App
217
+ provides no explicit base URL. Fragment links then stay inside their own document
218
+ with native scrolling, history and events. The sandbox permits this local base;
219
+ external bases still require declared CSP origins. This belongs to document
220
+ loading and changes no project link or scenario handler. External hosts control
221
+ their own document-loading and CSP behavior.
222
+
216
223
  The project compiler publishes a versioned dependency graph: shared runtime and
217
224
  foundation assets, plus independently addressable scenario modules. Inside the
218
225
  App, a resource loader obtains the selected dependency closure through MCP,
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.15
4
+
5
+ - Keep fragment links inside inline preview documents by supplying a local
6
+ `about:srcdoc` base in the sandbox host and legacy nested widget. Preserve
7
+ explicit App bases, native link events and opaque origins; retain CSP gates
8
+ for external bases. Verify scrolling, state and bridge continuity in browsers.
9
+
3
10
  ## 0.3.14
4
11
 
5
12
  - Preserve independent passing behavior outcomes in complete runs with failed
package/docs/MCP.md CHANGED
@@ -593,6 +593,13 @@ origin hosts the sandbox proxy; that proxy creates an opaque inner App iframe
593
593
  and forwards the standard Apps bridge messages. The diagnostic explorer follows
594
594
  the same sandbox model. Only the App materializes and executes project resources.
595
595
 
596
+ For inline documents without an explicit App base URL, ADS supplies
597
+ `<base href="about:srcdoc">` and permits the local `about:` base scheme in CSP.
598
+ Bare and named fragment links retain native in-document navigation and state.
599
+ Explicit App bases remain subject to declared CSP origins. The legacy nested
600
+ widget uses the same document preparation. External hosts own this behavior in
601
+ their loaders; adding scenario click handlers would conceal a host defect.
602
+
596
603
  Hosts need Apps support, server resource forwarding, native ESM/import maps and
597
604
  a CSP permitting declared `blob:` script/style/font/worker resources. Project
598
605
  previews declare no network connections. The host may enforce stricter policy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
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": {
@@ -1,30 +0,0 @@
1
- const parentOrigin = new URL(location.href).searchParams.get("parent");
2
- let view;
3
- function domains(values = []) {
4
- return values.filter(value => /^(?:https?:\/\/[a-z0-9.*:[\]-]+(?::\d+)?|data:|blob:|about:)$/i.test(value)).join(" ");
5
- }
6
- function policy(csp = {}) {
7
- const resources = domains(csp.resourceDomains);
8
- return `default-src 'none';script-src 'unsafe-inline' ${resources};style-src 'unsafe-inline' ${resources};img-src data: ${resources};font-src ${resources || "'none'"};media-src ${resources || "'none'"};worker-src ${resources || "'none'"};connect-src ${domains(csp.connectDomains) || "'none'"};frame-src ${domains(csp.frameDomains) || "'none'"};base-uri ${domains(csp.baseUriDomains) || "'none'"};object-src 'none'`;
9
- }
10
- window.addEventListener("message", event => {
11
- if (event.source === parent && event.origin === parentOrigin) {
12
- const message = event.data;
13
- if (message?.method === "ui/notifications/sandbox-resource-ready") {
14
- const { html, csp } = message.params ?? {};
15
- if (typeof html !== "string") return;
16
- const document = new DOMParser().parseFromString(html, "text/html");
17
- const meta = document.createElement("meta");
18
- meta.httpEquiv = "Content-Security-Policy";
19
- meta.content = policy(csp);
20
- document.head.prepend(meta);
21
- view?.remove();
22
- view = window.document.createElement("iframe");
23
- view.title = "Design-system App";
24
- view.setAttribute("sandbox", "allow-scripts");
25
- window.document.body.append(view);
26
- view.srcdoc = "<!doctype html>" + document.documentElement.outerHTML;
27
- } else if (message?.jsonrpc === "2.0" && !message.method?.startsWith("ui/notifications/sandbox-")) view?.contentWindow.postMessage(message, "*");
28
- } else if (event.source === view?.contentWindow && event.data?.jsonrpc === "2.0" && !event.data.method?.startsWith("ui/notifications/sandbox-")) parent.postMessage(event.data, parentOrigin);
29
- });
30
- parent.postMessage({ jsonrpc: "2.0", method: "ui/notifications/sandbox-proxy-ready", params: {} }, parentOrigin);