@tanqory/theme-conformance 0.1.0-alpha.15 → 0.1.0-alpha.17
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/README.md +27 -2
- package/dist/browser/harness.d.ts +8 -1
- package/dist/browser/harness.js +8 -2
- package/dist/browser/harness.js.map +1 -1
- package/dist/browser/page-run.d.ts +29 -1
- package/dist/browser/page-run.js +54 -6
- package/dist/browser/page-run.js.map +1 -1
- package/dist/browser/rules.d.ts +70 -0
- package/dist/browser/rules.js +119 -6
- package/dist/browser/rules.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/cli.js +52 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-chunks.d.ts +185 -0
- package/dist/client-chunks.js +378 -0
- package/dist/client-chunks.js.map +1 -0
- package/dist/field-types.js +6 -5
- package/dist/field-types.js.map +1 -1
- package/dist/fixtures/store-fixture.d.ts +5 -0
- package/dist/fixtures/store-fixture.js.map +1 -1
- package/dist/fixtures/stores/alpha.json +38 -0
- package/dist/fixtures/stores/beta.json +3 -0
- package/dist/html-checks.d.ts +3 -0
- package/dist/html-checks.js +15 -0
- package/dist/html-checks.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs.d.ts +67 -1
- package/dist/jobs.js +155 -6
- package/dist/jobs.js.map +1 -1
- package/dist/review/config.d.ts +36 -0
- package/dist/review/config.js +70 -0
- package/dist/review/config.js.map +1 -0
- package/dist/review/index.d.ts +85 -0
- package/dist/review/index.js +308 -0
- package/dist/review/index.js.map +1 -0
- package/dist/review/lighthouse.d.ts +27 -0
- package/dist/review/lighthouse.js +94 -0
- package/dist/review/lighthouse.js.map +1 -0
- package/dist/review/stores.d.ts +42 -0
- package/dist/review/stores.js +109 -0
- package/dist/review/stores.js.map +1 -0
- package/dist/runner-identity.d.ts +1 -1
- package/dist/runner-identity.js +6 -5
- package/dist/runner-identity.js.map +1 -1
- package/dist/storefront/budgets.js +26 -4
- package/dist/storefront/budgets.js.map +1 -1
- package/dist/storefront/checks/i18n.js +39 -0
- package/dist/storefront/checks/i18n.js.map +1 -1
- package/dist/storefront/fixture.d.ts +4 -3
- package/dist/storefront/fixture.js +12 -7
- package/dist/storefront/fixture.js.map +1 -1
- package/dist/storefront/gateway.d.ts +18 -2
- package/dist/storefront/gateway.js +47 -13
- package/dist/storefront/gateway.js.map +1 -1
- package/dist/storefront/locale-names.d.ts +39 -0
- package/dist/storefront/locale-names.js +63 -0
- package/dist/storefront/locale-names.js.map +1 -0
- package/dist/suites/app-blocks.d.ts +13 -0
- package/dist/suites/app-blocks.js +172 -0
- package/dist/suites/app-blocks.js.map +1 -0
- package/dist/suites/s1-static.js +4 -2
- package/dist/suites/s1-static.js.map +1 -1
- package/dist/suites/s2-render.js +20 -2
- package/dist/suites/s2-render.js.map +1 -1
- package/dist/suites/s4-limits.js +44 -1
- package/dist/suites/s4-limits.js.map +1 -1
- package/dist/suites/s5-hydration.d.ts +2 -0
- package/dist/suites/s5-hydration.js +89 -12
- package/dist/suites/s5-hydration.js.map +1 -1
- package/dist/workerd/config.js +3 -0
- package/dist/workerd/config.js.map +1 -1
- package/dist/workerd/elapsed.d.ts +19 -0
- package/dist/workerd/elapsed.js +25 -0
- package/dist/workerd/elapsed.js.map +1 -0
- package/dist/workerd/host.js +11 -4
- package/dist/workerd/host.js.map +1 -1
- package/dist/workerd/shim.mjs +40 -3
- package/dist/workerd/storefront-data.mjs +25 -11
- package/dist/workerd/tanqory-money.generated.mjs +551 -0
- package/docs/storefront-tier.md +1 -0
- package/fixtures/chunks-pass/client/assets/boot-d9c77977.js +13 -0
- package/fixtures/chunks-pass/client/assets/core-9e704970.js +21 -0
- package/fixtures/chunks-pass/client/assets/hero-f2dd1270.js +3 -0
- package/fixtures/chunks-pass/client/assets/main-28182e68.css +1 -0
- package/fixtures/chunks-pass/client/assets/main-3401d1c6.js +22 -0
- package/fixtures/chunks-pass/client/assets/probe-bad-de7c494b.js +1 -0
- package/fixtures/chunks-pass/client/assets/probe-ok-e658f0b4.js +1 -0
- package/fixtures/chunks-pass/client/assets/shared-53e84b49.js +2 -0
- package/fixtures/chunks-pass/client/client-manifest.json +87 -0
- package/fixtures/chunks-pass/defaults/regions/header.json +1 -0
- package/fixtures/chunks-pass/defaults/settings.json +1 -0
- package/fixtures/chunks-pass/defaults/templates/index.json +1 -0
- package/fixtures/chunks-pass/defaults/templates/product.json +1 -0
- package/fixtures/chunks-pass/locales/en.json +1 -0
- package/fixtures/chunks-pass/manifest.json +1 -0
- package/fixtures/chunks-pass/server/entry.mjs +171 -0
- package/fixtures/hydration-pass/defaults/templates/product.json +1 -0
- package/fixtures/hydration-pass/manifest.json +1 -1
- package/fixtures/hydration-pass/server/entry.mjs +7 -1
- package/fixtures/hydration-violations/slot-server-children/server/entry.mjs +7 -1
- package/fixtures/invalid-url-setting/defaults/templates/product.json +1 -0
- package/fixtures/invalid-url-setting/manifest.json +1 -1
- package/fixtures/invalid-url-setting/server/entry.mjs +7 -1
- package/fixtures/minimal-pass/defaults/templates/product.json +1 -0
- package/fixtures/minimal-pass/manifest.json +1 -1
- package/fixtures/minimal-pass/server/entry.mjs +7 -1
- package/fixtures/violations/defaults/templates/product.json +1 -0
- package/fixtures/violations/entries/async-iterable-body.mjs +7 -1
- package/fixtures/violations/entries/browser-only-capability.mjs +7 -1
- package/fixtures/violations/entries/deferred-ambient-access.mjs +7 -1
- package/fixtures/violations/entries/depends-on-harness-scope.mjs +7 -1
- package/fixtures/violations/entries/fetch-without-network.mjs +7 -1
- package/fixtures/violations/entries/forges-array-push.mjs +7 -1
- package/fixtures/violations/entries/forges-json-stringify.mjs +7 -1
- package/fixtures/violations/entries/forges-object-then.mjs +7 -1
- package/fixtures/violations/entries/forges-to-json.mjs +7 -1
- package/fixtures/violations/entries/grants-own-capability.mjs +7 -1
- package/fixtures/violations/entries/lowercase-tenant-leak.mjs +7 -1
- package/fixtures/violations/entries/nondeterministic-output.mjs +7 -1
- package/fixtures/violations/entries/reads-date-now.mjs +7 -1
- package/fixtures/violations/entries/reads-new-date.mjs +7 -1
- package/fixtures/violations/entries/redefines-prototype-method.mjs +7 -1
- package/fixtures/violations/entries/renders-tq-csrf-field.mjs +7 -1
- package/fixtures/violations/entries/renders-tq-form-field.mjs +7 -1
- package/fixtures/violations/entries/response-too-large.mjs +7 -1
- package/fixtures/violations/entries/retains-tenant-state.mjs +7 -1
- package/fixtures/violations/entries/signed-in-actions-customer.mjs +7 -1
- package/fixtures/violations/entries/signed-in-harness-scope.mjs +7 -1
- package/fixtures/violations/entries/slow-cold-render.mjs +7 -1
- package/fixtures/violations/entries/slow-signed-in-render.mjs +7 -1
- package/fixtures/violations/entries/slow-store-b-render.mjs +7 -1
- package/fixtures/violations/entries/stashes-on-date-prototype.mjs +7 -1
- package/fixtures/violations/entries/stashes-on-json.mjs +7 -1
- package/fixtures/violations/entries/stashes-on-prototype.mjs +7 -1
- package/fixtures/violations/entries/swallows-data-limit.mjs +7 -1
- package/fixtures/violations/manifest.json +1 -1
- package/package.json +7 -14
- package/review-config.json +37 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Tanqory client boot (theme-abi-v2.md §2.2.1): generated by build-service; the table below is part of this file, which the page loads with integrity.
|
|
2
|
+
const L=[["core-9e704970","nnBJcOuBuoSLUSWdF/AbRmSVkuibI+Fmt7kwGpyBEN4="],["shared-53e84b49","U+hLSQHB1iVw3uJPbcIh4BnBEjrckRMurUTsKcFg2Jc="],["hero-f2dd1270","8t0ScHWda2pzrHy+WlPG+TaQdOf4QinW/IGjgbQkVKE="]];const C=[0,1];const K={"src/sections/hero.js":[2,1]};let T=null;try{const R=(ix)=>{const f=[],g=[];for(let j=0;j<ix.length;j++){const e=L[ix[j]];f[j]="assets/"+e[0]+".js";g[j]="sha256-"+e[1]}return{files:f,integrity:g}};const t={core:R(C),chunks:{}};const ks=Object.keys(K);for(let j=0;j<ks.length;j++)t.chunks[ks[j]]=R(K[ks[j]]);T=t}catch{T=null}const F={"file":"assets/main-3401d1c6.js","integrity":"sha256-NAHRxvRvtmeiSX0kOlZD6PGlBA0eXhYIbUzk2nBaiIw="};const P={"ok":"assets/probe-ok-e658f0b4.js","bad":"assets/probe-bad-de7c494b.js"};const B=new URL("..",import.meta.url);
|
|
3
|
+
const NEVER=new Promise(()=>{});const U=(file)=>new URL(file,B).href;
|
|
4
|
+
const report=(what)=>{try{console.error("tanqory: "+what+" failed its integrity check or did not load")}catch{}};
|
|
5
|
+
let fell=false;const fallback=()=>{if(fell)return;fell=true;const s=document.createElement("script");s.type="module";s.crossOrigin="anonymous";s.integrity=F.integrity;s.src=U(F.file);document.head.appendChild(s)};
|
|
6
|
+
const V=new Map();const verify=(rows)=>Promise.all(rows.flatMap((r)=>r.files.map((x,i)=>{let v=V.get(x);if(!v){v=fetch(U(x),{integrity:r.integrity[i],cache:"force-cache",credentials:"same-origin"}).then((res)=>{if(!res.ok)throw new Error(String(res.status))});V.set(x,v)}return v})));
|
|
7
|
+
const gate=(key,load)=>{const r=T.chunks[key];if(!r){report("chunk "+key);return NEVER}return verify([r]).then(()=>Promise.resolve(load()).catch(()=>{report("chunk "+key);return NEVER}),()=>{report("chunk "+key);return NEVER})};
|
|
8
|
+
if(T===null||Object.prototype.hasOwnProperty.call(globalThis,"__tqGate")||Object.getOwnPropertySymbols(globalThis).includes(Symbol.for("tanqory.kit")))fallback();
|
|
9
|
+
else{Object.defineProperty(globalThis,"__tqGate",{value:gate,writable:false,configurable:false,enumerable:false});
|
|
10
|
+
Promise.allSettled([import(U(P.ok)),import(U(P.bad))]).then(([ok,bad])=>{
|
|
11
|
+
if(ok.status!=="fulfilled"||bad.status!=="rejected")return fallback();
|
|
12
|
+
let keys=[];try{const e=document.getElementById("tq-chunks");const v=e?JSON.parse(e.textContent||"[]"):[];if(Array.isArray(v))keys=v.filter((k)=>typeof k==="string"&&Object.prototype.hasOwnProperty.call(T.chunks,k)).slice(0,64)}catch{}
|
|
13
|
+
return verify([T.core,...keys.map((k)=>T.chunks[k])]).then(()=>Promise.all(keys.map((k)=>import(U(T.chunks[k].files[0])))).then(()=>import(U(T.core.files[0]))).catch(()=>report("the page's split code")),()=>fallback())})}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Generated by scripts/gen-chunks-fixture.mjs (fixtures/chunks-pass), do not edit.
|
|
2
|
+
import { tag } from "./shared-53e84b49.js";
|
|
3
|
+
const b64url = (s) => btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
|
|
4
|
+
async function data(op, args) {
|
|
5
|
+
const q = args && args.length ? `?a=${b64url(JSON.stringify(args))}` : ''
|
|
6
|
+
const res = await fetch(`/_tq/data/${op}${q}`, { headers: { accept: 'application/json' } })
|
|
7
|
+
const env = await res.json()
|
|
8
|
+
if (!env.ok) throw new Error(`${op} failed: ${env.error && env.error.code}`)
|
|
9
|
+
return env.data
|
|
10
|
+
}
|
|
11
|
+
await Promise.all([data('shop.get'), data('catalog.products', [{ first: 1 }])])
|
|
12
|
+
const button = document.querySelector('[data-tq-counter]')
|
|
13
|
+
let count = 0
|
|
14
|
+
if (button) button.addEventListener('click', () => { count += 1; button.textContent = String(count) })
|
|
15
|
+
const slot = document.querySelector('[data-tq-client-slot="notice"]')
|
|
16
|
+
if (slot) {
|
|
17
|
+
const note = document.createElement('p')
|
|
18
|
+
note.className = 'tq-note'
|
|
19
|
+
note.textContent = tag('Free shipping on orders over 50')
|
|
20
|
+
slot.append(note)
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tq-note{color:#333}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Generated by scripts/gen-chunks-fixture.mjs (fixtures/chunks-pass), do not edit.
|
|
2
|
+
const tag = (s) => String(s)
|
|
3
|
+
export const hero = tag('hero')
|
|
4
|
+
const b64url = (s) => btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
|
|
5
|
+
async function data(op, args) {
|
|
6
|
+
const q = args && args.length ? `?a=${b64url(JSON.stringify(args))}` : ''
|
|
7
|
+
const res = await fetch(`/_tq/data/${op}${q}`, { headers: { accept: 'application/json' } })
|
|
8
|
+
const env = await res.json()
|
|
9
|
+
if (!env.ok) throw new Error(`${op} failed: ${env.error && env.error.code}`)
|
|
10
|
+
return env.data
|
|
11
|
+
}
|
|
12
|
+
await Promise.all([data('shop.get'), data('catalog.products', [{ first: 1 }])])
|
|
13
|
+
const button = document.querySelector('[data-tq-counter]')
|
|
14
|
+
let count = 0
|
|
15
|
+
if (button) button.addEventListener('click', () => { count += 1; button.textContent = String(count) })
|
|
16
|
+
const slot = document.querySelector('[data-tq-client-slot="notice"]')
|
|
17
|
+
if (slot) {
|
|
18
|
+
const note = document.createElement('p')
|
|
19
|
+
note.className = 'tq-note'
|
|
20
|
+
note.textContent = tag('Free shipping on orders over 50')
|
|
21
|
+
slot.append(note)
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{}//tanqory import-map integrity probe: bad
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{}//tanqory import-map integrity probe: ok
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"assets/core-9e704970.js": {
|
|
3
|
+
"file": "assets/core-9e704970.js",
|
|
4
|
+
"kind": "script",
|
|
5
|
+
"size": 1041,
|
|
6
|
+
"digest": "sha256:9e704970eb81ba848b51259d17f01b46649592e89b23e166b7b9301a9c8110de",
|
|
7
|
+
"integrity": "sha256-nnBJcOuBuoSLUSWdF/AbRmSVkuibI+Fmt7kwGpyBEN4="
|
|
8
|
+
},
|
|
9
|
+
"assets/hero-f2dd1270.js": {
|
|
10
|
+
"file": "assets/hero-f2dd1270.js",
|
|
11
|
+
"kind": "script",
|
|
12
|
+
"size": 160,
|
|
13
|
+
"digest": "sha256:f2dd1270759d6b6a73ac7cbe5a53c6f9369074e7f84229d6fc81a381b42454a1",
|
|
14
|
+
"integrity": "sha256-8t0ScHWda2pzrHy+WlPG+TaQdOf4QinW/IGjgbQkVKE="
|
|
15
|
+
},
|
|
16
|
+
"assets/main-28182e68.css": {
|
|
17
|
+
"file": "assets/main-28182e68.css",
|
|
18
|
+
"kind": "style",
|
|
19
|
+
"size": 21,
|
|
20
|
+
"digest": "sha256:28182e680b865ae73a99a416fc55bda7e018bdf57725fbde0d136cc748407f0f",
|
|
21
|
+
"integrity": "sha256-KBguaAuGWuc6maQW/FW9p+AYvfV3JfveDRNsx0hAfw8="
|
|
22
|
+
},
|
|
23
|
+
"fallback": {
|
|
24
|
+
"file": "assets/main-3401d1c6.js",
|
|
25
|
+
"kind": "script",
|
|
26
|
+
"size": 1058,
|
|
27
|
+
"digest": "sha256:3401d1c6f46fb667a2497d243a5643e8f1a5040d1e5e16086d4ce4da705a888c",
|
|
28
|
+
"integrity": "sha256-NAHRxvRvtmeiSX0kOlZD6PGlBA0eXhYIbUzk2nBaiIw="
|
|
29
|
+
},
|
|
30
|
+
"assets/probe-bad-de7c494b.js": {
|
|
31
|
+
"file": "assets/probe-bad-de7c494b.js",
|
|
32
|
+
"kind": "script",
|
|
33
|
+
"size": 50,
|
|
34
|
+
"digest": "sha256:de7c494b6ed35a1608158f5027aa9c3bcbeac7b519d621bc45889798c1895695",
|
|
35
|
+
"integrity": "sha256-3nxJS27TWhYIFY9QJ6qcO8vqx7UZ1iG8RYiXmMGJVpU="
|
|
36
|
+
},
|
|
37
|
+
"assets/probe-ok-e658f0b4.js": {
|
|
38
|
+
"file": "assets/probe-ok-e658f0b4.js",
|
|
39
|
+
"kind": "script",
|
|
40
|
+
"size": 49,
|
|
41
|
+
"digest": "sha256:e658f0b4e659117134414229784b8bc1b7d83b371942b0613744d4764821b5ad",
|
|
42
|
+
"integrity": "sha256-5ljwtOZZEXE0QUIpeEuLwbfYOzcZQrBhN0TUdkghta0="
|
|
43
|
+
},
|
|
44
|
+
"assets/shared-53e84b49.js": {
|
|
45
|
+
"file": "assets/shared-53e84b49.js",
|
|
46
|
+
"kind": "script",
|
|
47
|
+
"size": 120,
|
|
48
|
+
"digest": "sha256:53e84b4901c1d62570dee24f6dc221e019c1123adc91132ead44ec29c160d897",
|
|
49
|
+
"integrity": "sha256-U+hLSQHB1iVw3uJPbcIh4BnBEjrckRMurUTsKcFg2Jc="
|
|
50
|
+
},
|
|
51
|
+
"main": {
|
|
52
|
+
"file": "assets/boot-d9c77977.js",
|
|
53
|
+
"kind": "script",
|
|
54
|
+
"size": 2730,
|
|
55
|
+
"digest": "sha256:d9c7797749f30c59d12f7d81bae5c328a02619e39d33eb2053559fa2166ad088",
|
|
56
|
+
"integrity": "sha256-2cd5d0nzDFnRL32BuuXDKKAmGeOdM+sgU1WfohZq0Ig=",
|
|
57
|
+
"isEntry": true,
|
|
58
|
+
"css": [
|
|
59
|
+
"assets/main-28182e68.css"
|
|
60
|
+
],
|
|
61
|
+
"imports": [],
|
|
62
|
+
"core": {
|
|
63
|
+
"files": [
|
|
64
|
+
"assets/core-9e704970.js",
|
|
65
|
+
"assets/shared-53e84b49.js"
|
|
66
|
+
],
|
|
67
|
+
"integrity": [
|
|
68
|
+
"sha256-nnBJcOuBuoSLUSWdF/AbRmSVkuibI+Fmt7kwGpyBEN4=",
|
|
69
|
+
"sha256-U+hLSQHB1iVw3uJPbcIh4BnBEjrckRMurUTsKcFg2Jc="
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"chunks": {
|
|
73
|
+
"src/sections/hero.js": {
|
|
74
|
+
"files": [
|
|
75
|
+
"assets/hero-f2dd1270.js",
|
|
76
|
+
"assets/shared-53e84b49.js"
|
|
77
|
+
],
|
|
78
|
+
"integrity": [
|
|
79
|
+
"sha256-8t0ScHWda2pzrHy+WlPG+TaQdOf4QinW/IGjgbQkVKE=",
|
|
80
|
+
"sha256-U+hLSQHB1iVw3uJPbcIh4BnBEjrckRMurUTsKcFg2Jc="
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"fallback": "assets/main-3401d1c6.js",
|
|
85
|
+
"importMap": "{\"imports\":{},\"integrity\":{\"/assets/core-9e704970.js\":\"sha256-nnBJcOuBuoSLUSWdF/AbRmSVkuibI+Fmt7kwGpyBEN4=\",\"/assets/hero-f2dd1270.js\":\"sha256-8t0ScHWda2pzrHy+WlPG+TaQdOf4QinW/IGjgbQkVKE=\",\"/assets/probe-bad-de7c494b.js\":\"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\",\"/assets/probe-ok-e658f0b4.js\":\"sha256-5ljwtOZZEXE0QUIpeEuLwbfYOzcZQrBhN0TUdkghta0=\",\"/assets/shared-53e84b49.js\":\"sha256-U+hLSQHB1iVw3uJPbcIh4BnBEjrckRMurUTsKcFg2Jc=\"}}"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "contentVersion": 1, "region": "header", "sections": [ { "type": "header-bar", "id": "header-bar-1", "settings": { "menu": "main-menu" } } ] }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "contentVersion": 1, "values": { "colorScheme": "light" } }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "contentVersion": 1, "template": "index", "regions": { "main": { "sections": [ { "type": "hero", "id": "hero-1", "settings": { "heading": "Welcome to the fixture" } }, { "type": "rich-text", "id": "rich-text-1", "settings": { "body": "<p>Hello.</p>" }, "disabled": true } ] } }, "meta": { "title": "Home" } }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"contentVersion": 1, "template": "product", "regions": {"main": {"sections": [{"type": "rich-text", "id": "product-rich-text-1", "settings": {"body": "<p>Made to last.</p>"}}]}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "cart.title": "Cart", "search.placeholder": "Search" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"abi":"2.0","capabilities":{"browser":["data:shop","data:catalog"],"server":["data:shop","data:localization","data:catalog","data:content"]},"client":{"chunks":"sections","hydration":"full"},"components":{"header-bar":{"attributes":{"menu":{"default":"main-menu","label":"Menu","type":"menu"}},"regions":["header"],"role":"layout","title":"Header bar"},"hero":{"attributes":{"body":{"label":"Body","type":"richtext"},"heading":{"default":"Welcome","label":"Heading","type":"text"}},"presets":[{"name":"Default hero","settings":{"heading":"Welcome"}}],"regions":["main"],"role":"section","title":"Hero"},"rich-text":{"attributes":{"body":{"label":"Body","type":"richtext"}},"children":["@app"],"regions":["main"],"role":"section","title":"Rich text"}},"contentVersion":1,"engines":{"tanqory-abi":"^2.0","tanqory-client-chunks":"1","tanqory-field-types":"1"},"name":"@tanqory/fixture-chunks-pass","regions":{"header":{"accepts":["header-bar"],"max":1,"min":1,"scope":"shared","title":"Header"},"main":{"max":32,"scope":"template","title":"Main"}},"routes":{"collection":"collection","home":"index","not_found":"404","page":"page","product":"product"},"settingsSchema":[{"group":"Colors","items":[{"default":"light","key":"colorScheme","label":"Scheme","options":[{"label":"Light","value":"light"},{"label":"Dark","value":"dark"}],"type":"select"}]}],"templates":{"404":{"regions":["header","main"],"route":"not_found"},"collection":{"regions":["header","main"],"route":"collection"},"index":{"regions":["header","main"],"route":"home","title":"Home"},"page":{"regions":["header","main"],"route":"page"},"product":{"regions":["header","main"],"route":"product"}},"version":"1.0.0"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// fixtures/chunks-pass — fixtures/hydration-pass on client chunks (theme-abi-v2 §2.2.1 revision 2), passing every
|
|
2
|
+
// conformance suite including suite 5 on the split path and on the runner's deliberate fallback load.
|
|
3
|
+
// The page's head is what theme-kit writes for a client-chunks artifact (server.tsx importMapTag / assetTags): the
|
|
4
|
+
// one import map first, only when assets are on the page's own origin with an empty path, its CSP hash asserted
|
|
5
|
+
// with x-tq-csp-script-hash; the global CSS; the page's section chunk keys in <script type="application/json"
|
|
6
|
+
// id="tq-chunks">; the boot with integrity. No modulepreload. The client files are the platform's own boot and probe
|
|
7
|
+
// pair (build-service chunks.mjs), written by scripts/gen-chunks-fixture.mjs: a core closure of two files (core +
|
|
8
|
+
// shared), one section chunk (hero, statically importing shared) and the single-bundle fallback, which does what the
|
|
9
|
+
// core and the hero chunk do together. The core attaches behaviour without changing the DOM, calls the browser data
|
|
10
|
+
// wire twice and fills the empty client slot (§10.5 Hyd-2), as hydration-pass does.
|
|
11
|
+
|
|
12
|
+
export const manifest = {
|
|
13
|
+
abi: '2.0',
|
|
14
|
+
name: '@tanqory/fixture-chunks-pass',
|
|
15
|
+
version: '1.0.0',
|
|
16
|
+
engines: { 'tanqory-abi': '^2.0', 'tanqory-field-types': '1', 'tanqory-client-chunks': '1' },
|
|
17
|
+
capabilities: {
|
|
18
|
+
server: ['data:shop', 'data:localization', 'data:catalog', 'data:content'],
|
|
19
|
+
browser: ['data:shop', 'data:catalog'],
|
|
20
|
+
},
|
|
21
|
+
client: { hydration: 'full', chunks: 'sections' },
|
|
22
|
+
contentVersion: 1,
|
|
23
|
+
routes: { home: 'index', product: 'product', collection: 'collection', page: 'page', not_found: '404' },
|
|
24
|
+
templates: {
|
|
25
|
+
index: { route: 'home', title: 'Home', regions: ['header', 'main'] },
|
|
26
|
+
product: { route: 'product', regions: ['header', 'main'] },
|
|
27
|
+
collection: { route: 'collection', regions: ['header', 'main'] },
|
|
28
|
+
page: { route: 'page', regions: ['header', 'main'] },
|
|
29
|
+
'404': { route: 'not_found', regions: ['header', 'main'] },
|
|
30
|
+
},
|
|
31
|
+
regions: {
|
|
32
|
+
header: { title: 'Header', scope: 'shared', accepts: ['header-bar'], min: 1, max: 1 },
|
|
33
|
+
main: { title: 'Main', scope: 'template', max: 32 },
|
|
34
|
+
},
|
|
35
|
+
components: {
|
|
36
|
+
'header-bar': {
|
|
37
|
+
role: 'layout',
|
|
38
|
+
title: 'Header bar',
|
|
39
|
+
regions: ['header'],
|
|
40
|
+
attributes: { menu: { type: 'menu', label: 'Menu', default: 'main-menu' } },
|
|
41
|
+
},
|
|
42
|
+
hero: {
|
|
43
|
+
role: 'section',
|
|
44
|
+
title: 'Hero',
|
|
45
|
+
regions: ['main'],
|
|
46
|
+
attributes: {
|
|
47
|
+
heading: { type: 'text', label: 'Heading', default: 'Welcome' },
|
|
48
|
+
body: { type: 'richtext', label: 'Body' },
|
|
49
|
+
},
|
|
50
|
+
presets: [{ name: 'Default hero', settings: { heading: 'Welcome' } }],
|
|
51
|
+
},
|
|
52
|
+
'rich-text': {
|
|
53
|
+
role: 'section',
|
|
54
|
+
title: 'Rich text',
|
|
55
|
+
regions: ['main'],
|
|
56
|
+
attributes: { body: { type: 'richtext', label: 'Body' } },
|
|
57
|
+
children: ['@app'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
settingsSchema: [{ group: 'Colors', items: [{ key: 'colorScheme', type: 'select', label: 'Scheme', options: [{ value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }], default: 'light' }] }],
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// One inline <style>; its hash is sent as x-tq-csp-style-hash (§5).
|
|
64
|
+
const INLINE_STYLE = '.tq-note{font-weight:600}'
|
|
65
|
+
const INLINE_STYLE_HASH = 'sha256-Yy+alBB/K9Dk9aYCAL3pyEVMyKxj122j5aHZZBUbgo8='
|
|
66
|
+
|
|
67
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
68
|
+
|
|
69
|
+
// theme-abi §7.2 AppBlocks-1: a block of an installed app renders as the platform placeholder, its settings inert JSON
|
|
70
|
+
const appJson = (v) => JSON.stringify(v ?? {}).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
71
|
+
const appBlocks = (node) => (node.blocks ?? []).filter((b) => /^app:/.test(b.type)).map((b) => `<div data-tq-app-block="${esc(b.type)}" data-tq-node="${esc(b.id)}" data-tq-type="${esc(b.type)}" class="tq-app-block"><script type="application/json">${appJson(b.settings)}</script></div>`).join('')
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
function renderSection(node, snap) {
|
|
75
|
+
switch (node.type) {
|
|
76
|
+
case 'header-bar': {
|
|
77
|
+
const menu = snap.menus[node.settings?.menu ?? 'main-menu']
|
|
78
|
+
const items = (menu?.items ?? []).map((i) => `<li><a href="${esc(i.url)}">${esc(i.title)}</a></li>`).join('')
|
|
79
|
+
return `<header data-tq-node="${esc(node.id)}"><strong>${esc(snap.shop.name)}</strong><nav><ul>${items}</ul></nav></header>`
|
|
80
|
+
}
|
|
81
|
+
case 'hero':
|
|
82
|
+
return `<section data-tq-node="${esc(node.id)}"><h1>${esc(node.settings?.heading ?? 'Welcome')}</h1>${node.settings?.body ?? ''}</section>`
|
|
83
|
+
case 'rich-text':
|
|
84
|
+
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}${appBlocks(node)}</section>`
|
|
85
|
+
default:
|
|
86
|
+
return ''
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function renderResource(res) {
|
|
91
|
+
switch (res.kind) {
|
|
92
|
+
case 'product': {
|
|
93
|
+
const p = res.product
|
|
94
|
+
if (!p) return '<p>Product not found</p>'
|
|
95
|
+
const img = p.featuredImage ? `<img src="${esc(p.featuredImage.url)}" alt="${esc(p.featuredImage.altText)}" width="${esc(p.featuredImage.width)}" height="${esc(p.featuredImage.height)}">` : ''
|
|
96
|
+
return `<article><h2>${esc(p.title)}</h2>${img}${p.descriptionHtml}<p>${esc(p.priceRange.minVariantPrice.amount)} ${esc(p.priceRange.minVariantPrice.currencyCode)}</p></article>`
|
|
97
|
+
}
|
|
98
|
+
case 'collection': return res.collection ? `<h2>${esc(res.collection.title)}</h2><ul>${res.collection.products.nodes.map((p) => `<li><a href="/products/${esc(p.handle)}">${esc(p.title)}</a></li>`).join('')}</ul>` : '<p>Collection not found</p>'
|
|
99
|
+
case 'page': return res.page ? `<article><h2>${esc(res.page.title)}</h2>${res.page.body}</article>` : '<p>Page not found</p>'
|
|
100
|
+
default: return ''
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// The section chunk each component's code lives in (the key of the boot's table: the theme path of the module).
|
|
105
|
+
const CHUNK_OF = { hero: 'src/sections/hero.js' }
|
|
106
|
+
|
|
107
|
+
const clientEntry = (assets) => Object.values(assets.manifest).find((e) => e.isEntry && e.kind === 'script')
|
|
108
|
+
|
|
109
|
+
// theme-kit importMapTag: the map only when assets are on the page's own origin with an empty path (§2.5).
|
|
110
|
+
function importMap(ctx) {
|
|
111
|
+
const e = clientEntry(ctx.assets)
|
|
112
|
+
if (!e?.core || typeof e.importMap !== 'string') return null
|
|
113
|
+
try {
|
|
114
|
+
const base = new URL(ctx.assets.base)
|
|
115
|
+
if (base.origin !== new URL(ctx.route.canonical).origin || base.pathname.replace(/\/$/, '') !== '') return null
|
|
116
|
+
} catch { return null }
|
|
117
|
+
return e.importMap
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function scriptHash(text) {
|
|
121
|
+
const d = new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text)))
|
|
122
|
+
let bin = ''
|
|
123
|
+
for (const b of d) bin += String.fromCharCode(b)
|
|
124
|
+
return `sha256-${btoa(bin)}`
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function clientTags(assets, keys) {
|
|
128
|
+
const entries = Object.values(assets.manifest)
|
|
129
|
+
const entry = clientEntry(assets)
|
|
130
|
+
if (!entry) return ''
|
|
131
|
+
const byFile = new Map(entries.map((e) => [e.file, e]))
|
|
132
|
+
const css = (entry.css ?? []).map((f) => byFile.get(f)).filter(Boolean)
|
|
133
|
+
return [
|
|
134
|
+
...css.map((c) => `<link rel="stylesheet" href="${esc(assets.base)}/${esc(c.file)}" integrity="${esc(c.integrity)}" crossorigin="anonymous">`),
|
|
135
|
+
`<script type="application/json" id="tq-chunks">${JSON.stringify(keys.filter((k) => entry.chunks?.[k]).sort())}</script>`,
|
|
136
|
+
`<script type="module" src="${esc(assets.base)}/${esc(entry.file)}" integrity="${esc(entry.integrity)}" crossorigin="anonymous"></script>`,
|
|
137
|
+
].join('\n')
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export async function render(request, ctx) {
|
|
141
|
+
const snap = await ctx.data.snapshot()
|
|
142
|
+
const status = ctx.route.kind === 'not_found' ? 404 : 200
|
|
143
|
+
const nodes = ctx.content.page.regions.flatMap((r) => r.sections)
|
|
144
|
+
const sections = nodes.map((n) => renderSection(n, snap)).join('')
|
|
145
|
+
const keys = [...new Set(nodes.map((n) => CHUNK_OF[n.type]).filter(Boolean))]
|
|
146
|
+
const map = importMap(ctx)
|
|
147
|
+
const title = status === 404 ? 'Not found' : snap.shop.name
|
|
148
|
+
const html = `<!doctype html>
|
|
149
|
+
<html lang="${esc(ctx.locale.language)}">
|
|
150
|
+
<head>
|
|
151
|
+
<meta charset="utf-8">
|
|
152
|
+
${map ? `<script type="importmap">${map}</script>` : ''}
|
|
153
|
+
<title>${esc(title)}</title>
|
|
154
|
+
<link rel="canonical" href="${esc(ctx.route.canonical)}">
|
|
155
|
+
<style>${INLINE_STYLE}</style>
|
|
156
|
+
${clientTags(ctx.assets, keys)}
|
|
157
|
+
</head>
|
|
158
|
+
<body data-scheme="${esc(ctx.content.settings.colorScheme ?? 'light')}">
|
|
159
|
+
${sections}
|
|
160
|
+
<main>${status === 404 ? '<h1>Page not found</h1>' : renderResource(snap.resource)}</main>
|
|
161
|
+
<p class="tq-note"><button type="button" data-tq-counter>0</button></p>
|
|
162
|
+
<div data-tq-client-slot="notice"></div>
|
|
163
|
+
<footer><p>${esc(ctx.locale.currency)} · ${esc(ctx.release.id)}</p></footer>
|
|
164
|
+
</body>
|
|
165
|
+
</html>
|
|
166
|
+
`
|
|
167
|
+
ctx.cache.hint({ maxAge: 60, swr: 600, tags: ['fixture'] })
|
|
168
|
+
const headers = new Headers({ 'content-type': 'text/html; charset=utf-8', 'x-tq-csp-style-hash': INLINE_STYLE_HASH })
|
|
169
|
+
if (map) headers.set('x-tq-csp-script-hash', await scriptHash(map))
|
|
170
|
+
return new Response(html, { status, headers })
|
|
171
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"contentVersion": 1, "template": "product", "regions": {"main": {"sections": [{"type": "rich-text", "id": "product-rich-text-1", "settings": {"body": "<p>Made to last.</p>"}}]}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":"2.0","capabilities":{"browser":["data:shop","data:catalog"],"server":["data:shop","data:localization","data:catalog","data:content"]},"client":{"hydration":"full"},"components":{"header-bar":{"attributes":{"menu":{"default":"main-menu","label":"Menu","type":"menu"}},"regions":["header"],"role":"layout","title":"Header bar"},"hero":{"attributes":{"body":{"label":"Body","type":"richtext"},"heading":{"default":"Welcome","label":"Heading","type":"text"}},"presets":[{"name":"Default hero","settings":{"heading":"Welcome"}}],"regions":["main"],"role":"section","title":"Hero"},"rich-text":{"attributes":{"body":{"label":"Body","type":"richtext"}},"regions":["main"],"role":"section","title":"Rich text"}},"contentVersion":1,"engines":{"tanqory-abi":"^2.0","tanqory-field-types":"1"},"name":"@tanqory/fixture-hydration-pass","regions":{"header":{"accepts":["header-bar"],"max":1,"min":1,"scope":"shared","title":"Header"},"main":{"max":32,"scope":"template","title":"Main"}},"routes":{"collection":"collection","home":"index","not_found":"404","page":"page","product":"product"},"settingsSchema":[{"group":"Colors","items":[{"default":"light","key":"colorScheme","label":"Scheme","options":[{"label":"Light","value":"light"},{"label":"Dark","value":"dark"}],"type":"select"}]}],"templates":{"404":{"regions":["header","main"],"route":"not_found"},"collection":{"regions":["header","main"],"route":"collection"},"index":{"regions":["header","main"],"route":"home","title":"Home"},"page":{"regions":["header","main"],"route":"page"},"product":{"regions":["header","main"],"route":"product"}},"version":"1.0.0"}
|
|
1
|
+
{"abi":"2.0","capabilities":{"browser":["data:shop","data:catalog"],"server":["data:shop","data:localization","data:catalog","data:content"]},"client":{"hydration":"full"},"components":{"header-bar":{"attributes":{"menu":{"default":"main-menu","label":"Menu","type":"menu"}},"regions":["header"],"role":"layout","title":"Header bar"},"hero":{"attributes":{"body":{"label":"Body","type":"richtext"},"heading":{"default":"Welcome","label":"Heading","type":"text"}},"presets":[{"name":"Default hero","settings":{"heading":"Welcome"}}],"regions":["main"],"role":"section","title":"Hero"},"rich-text":{"attributes":{"body":{"label":"Body","type":"richtext"}},"children":["@app"],"regions":["main"],"role":"section","title":"Rich text"}},"contentVersion":1,"engines":{"tanqory-abi":"^2.0","tanqory-field-types":"1"},"name":"@tanqory/fixture-hydration-pass","regions":{"header":{"accepts":["header-bar"],"max":1,"min":1,"scope":"shared","title":"Header"},"main":{"max":32,"scope":"template","title":"Main"}},"routes":{"collection":"collection","home":"index","not_found":"404","page":"page","product":"product"},"settingsSchema":[{"group":"Colors","items":[{"default":"light","key":"colorScheme","label":"Scheme","options":[{"label":"Light","value":"light"},{"label":"Dark","value":"dark"}],"type":"select"}]}],"templates":{"404":{"regions":["header","main"],"route":"not_found"},"collection":{"regions":["header","main"],"route":"collection"},"index":{"regions":["header","main"],"route":"home","title":"Home"},"page":{"regions":["header","main"],"route":"page"},"product":{"regions":["header","main"],"route":"product"}},"version":"1.0.0"}
|
|
@@ -50,6 +50,7 @@ export const manifest = {
|
|
|
50
50
|
title: 'Rich text',
|
|
51
51
|
regions: ['main'],
|
|
52
52
|
attributes: { body: { type: 'richtext', label: 'Body' } },
|
|
53
|
+
children: ['@app'],
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
56
|
settingsSchema: [{ group: 'Colors', items: [{ key: 'colorScheme', type: 'select', label: 'Scheme', options: [{ value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }], default: 'light' }] }],
|
|
@@ -61,6 +62,11 @@ const INLINE_STYLE_HASH = 'sha256-Yy+alBB/K9Dk9aYCAL3pyEVMyKxj122j5aHZZBUbgo8='
|
|
|
61
62
|
|
|
62
63
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
63
64
|
|
|
65
|
+
// theme-abi §7.2 AppBlocks-1: a block of an installed app renders as the platform placeholder, its settings inert JSON
|
|
66
|
+
const appJson = (v) => JSON.stringify(v ?? {}).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
67
|
+
const appBlocks = (node) => (node.blocks ?? []).filter((b) => /^app:/.test(b.type)).map((b) => `<div data-tq-app-block="${esc(b.type)}" data-tq-node="${esc(b.id)}" data-tq-type="${esc(b.type)}" class="tq-app-block"><script type="application/json">${appJson(b.settings)}</script></div>`).join('')
|
|
68
|
+
|
|
69
|
+
|
|
64
70
|
function renderSection(node, snap) {
|
|
65
71
|
switch (node.type) {
|
|
66
72
|
case 'header-bar': {
|
|
@@ -71,7 +77,7 @@ function renderSection(node, snap) {
|
|
|
71
77
|
case 'hero':
|
|
72
78
|
return `<section data-tq-node="${esc(node.id)}"><h1>${esc(node.settings?.heading ?? 'Welcome')}</h1>${node.settings?.body ?? ''}</section>`
|
|
73
79
|
case 'rich-text':
|
|
74
|
-
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}</section>`
|
|
80
|
+
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}${appBlocks(node)}</section>`
|
|
75
81
|
default:
|
|
76
82
|
return ''
|
|
77
83
|
}
|
|
@@ -47,6 +47,7 @@ export const manifest = {
|
|
|
47
47
|
title: 'Rich text',
|
|
48
48
|
regions: ['main'],
|
|
49
49
|
attributes: { body: { type: 'richtext', label: 'Body' } },
|
|
50
|
+
children: ['@app'],
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
settingsSchema: [{ group: 'Colors', items: [{ key: 'colorScheme', type: 'select', label: 'Scheme', options: [{ value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }], default: 'light' }] }],
|
|
@@ -58,6 +59,11 @@ const INLINE_STYLE_HASH = 'sha256-Yy+alBB/K9Dk9aYCAL3pyEVMyKxj122j5aHZZBUbgo8='
|
|
|
58
59
|
|
|
59
60
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
60
61
|
|
|
62
|
+
// theme-abi §7.2 AppBlocks-1: a block of an installed app renders as the platform placeholder, its settings inert JSON
|
|
63
|
+
const appJson = (v) => JSON.stringify(v ?? {}).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
64
|
+
const appBlocks = (node) => (node.blocks ?? []).filter((b) => /^app:/.test(b.type)).map((b) => `<div data-tq-app-block="${esc(b.type)}" data-tq-node="${esc(b.id)}" data-tq-type="${esc(b.type)}" class="tq-app-block"><script type="application/json">${appJson(b.settings)}</script></div>`).join('')
|
|
65
|
+
|
|
66
|
+
|
|
61
67
|
function renderSection(node, snap) {
|
|
62
68
|
switch (node.type) {
|
|
63
69
|
case 'header-bar': {
|
|
@@ -68,7 +74,7 @@ function renderSection(node, snap) {
|
|
|
68
74
|
case 'hero':
|
|
69
75
|
return `<section data-tq-node="${esc(node.id)}"><h1>${esc(node.settings?.heading ?? 'Welcome')}</h1>${node.settings?.body ?? ''}</section>`
|
|
70
76
|
case 'rich-text':
|
|
71
|
-
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}</section>`
|
|
77
|
+
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}${appBlocks(node)}</section>`
|
|
72
78
|
default:
|
|
73
79
|
return ''
|
|
74
80
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"contentVersion": 1, "template": "product", "regions": {"main": {"sections": [{"type": "rich-text", "id": "product-rich-text-1", "settings": {"body": "<p>Made to last.</p>"}}]}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":"2.0","capabilities":{"browser":[],"server":["data:shop","data:localization","data:catalog","data:content"]},"client":{"hydration":"none"},"components":{"header-bar":{"attributes":{"menu":{"default":"main-menu","label":"Menu","type":"menu"}},"regions":["header"],"role":"layout","title":"Header bar"},"hero":{"attributes":{"body":{"label":"Body","type":"richtext"},"heading":{"default":"Welcome","label":"Heading","type":"text"},"link":{"label":"Button link","type":"url"}},"presets":[{"name":"Default hero","settings":{"heading":"Welcome"}}],"regions":["main"],"role":"section","title":"Hero"},"rich-text":{"attributes":{"body":{"label":"Body","type":"richtext"}},"regions":["main"],"role":"section","title":"Rich text"}},"contentVersion":1,"engines":{"tanqory-abi":"^2.0","tanqory-field-types":"1"},"name":"@tanqory/fixture-invalid-url-setting","regions":{"header":{"accepts":["header-bar"],"max":1,"min":1,"scope":"shared","title":"Header"},"main":{"max":32,"scope":"template","title":"Main"}},"routes":{"collection":"collection","home":"index","not_found":"404","page":"page","product":"product"},"settingsSchema":[{"group":"Colors","items":[{"default":"light","key":"colorScheme","label":"Scheme","options":[{"label":"Light","value":"light"},{"label":"Dark","value":"dark"}],"type":"select"}]}],"templates":{"404":{"regions":["header","main"],"route":"not_found"},"collection":{"regions":["header","main"],"route":"collection"},"index":{"regions":["header","main"],"route":"home","title":"Home"},"page":{"regions":["header","main"],"route":"page"},"product":{"regions":["header","main"],"route":"product"}},"version":"1.0.0"}
|
|
1
|
+
{"abi":"2.0","capabilities":{"browser":[],"server":["data:shop","data:localization","data:catalog","data:content"]},"client":{"hydration":"none"},"components":{"header-bar":{"attributes":{"menu":{"default":"main-menu","label":"Menu","type":"menu"}},"regions":["header"],"role":"layout","title":"Header bar"},"hero":{"attributes":{"body":{"label":"Body","type":"richtext"},"heading":{"default":"Welcome","label":"Heading","type":"text"},"link":{"label":"Button link","type":"url"}},"presets":[{"name":"Default hero","settings":{"heading":"Welcome"}}],"regions":["main"],"role":"section","title":"Hero"},"rich-text":{"attributes":{"body":{"label":"Body","type":"richtext"}},"children":["@app"],"regions":["main"],"role":"section","title":"Rich text"}},"contentVersion":1,"engines":{"tanqory-abi":"^2.0","tanqory-field-types":"1"},"name":"@tanqory/fixture-invalid-url-setting","regions":{"header":{"accepts":["header-bar"],"max":1,"min":1,"scope":"shared","title":"Header"},"main":{"max":32,"scope":"template","title":"Main"}},"routes":{"collection":"collection","home":"index","not_found":"404","page":"page","product":"product"},"settingsSchema":[{"group":"Colors","items":[{"default":"light","key":"colorScheme","label":"Scheme","options":[{"label":"Light","value":"light"},{"label":"Dark","value":"dark"}],"type":"select"}]}],"templates":{"404":{"regions":["header","main"],"route":"not_found"},"collection":{"regions":["header","main"],"route":"collection"},"index":{"regions":["header","main"],"route":"home","title":"Home"},"page":{"regions":["header","main"],"route":"page"},"product":{"regions":["header","main"],"route":"product"}},"version":"1.0.0"}
|
|
@@ -49,6 +49,7 @@ export const manifest = {
|
|
|
49
49
|
title: 'Rich text',
|
|
50
50
|
regions: ['main'],
|
|
51
51
|
attributes: { body: { type: 'richtext', label: 'Body' } },
|
|
52
|
+
children: ['@app'],
|
|
52
53
|
},
|
|
53
54
|
},
|
|
54
55
|
settingsSchema: [{ group: 'Colors', items: [{ key: 'colorScheme', type: 'select', label: 'Scheme', options: [{ value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }], default: 'light' }] }],
|
|
@@ -56,6 +57,11 @@ export const manifest = {
|
|
|
56
57
|
|
|
57
58
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
58
59
|
|
|
60
|
+
// theme-abi §7.2 AppBlocks-1: a block of an installed app renders as the platform placeholder, its settings inert JSON
|
|
61
|
+
const appJson = (v) => JSON.stringify(v ?? {}).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
62
|
+
const appBlocks = (node) => (node.blocks ?? []).filter((b) => /^app:/.test(b.type)).map((b) => `<div data-tq-app-block="${esc(b.type)}" data-tq-node="${esc(b.id)}" data-tq-type="${esc(b.type)}" class="tq-app-block"><script type="application/json">${appJson(b.settings)}</script></div>`).join('')
|
|
63
|
+
|
|
64
|
+
|
|
59
65
|
function renderSection(node, snap) {
|
|
60
66
|
switch (node.type) {
|
|
61
67
|
case 'header-bar': {
|
|
@@ -66,7 +72,7 @@ function renderSection(node, snap) {
|
|
|
66
72
|
case 'hero':
|
|
67
73
|
return `<section data-tq-node="${esc(node.id)}"><h1>${esc(node.settings?.heading ?? 'Welcome')}</h1>${node.settings?.body ?? ''}</section>`
|
|
68
74
|
case 'rich-text':
|
|
69
|
-
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}</section>`
|
|
75
|
+
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}${appBlocks(node)}</section>`
|
|
70
76
|
default:
|
|
71
77
|
return ''
|
|
72
78
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"contentVersion": 1, "template": "product", "regions": {"main": {"sections": [{"type": "rich-text", "id": "product-rich-text-1", "settings": {"body": "<p>Made to last.</p>"}}]}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":"2.0","capabilities":{"browser":[],"server":["data:shop","data:localization","data:catalog","data:content"]},"client":{"hydration":"none"},"components":{"header-bar":{"attributes":{"menu":{"default":"main-menu","label":"Menu","type":"menu"}},"regions":["header"],"role":"layout","title":"Header bar"},"hero":{"attributes":{"body":{"label":"Body","type":"richtext"},"heading":{"default":"Welcome","label":"Heading","type":"text"}},"presets":[{"name":"Default hero","settings":{"heading":"Welcome"}}],"regions":["main"],"role":"section","title":"Hero"},"rich-text":{"attributes":{"body":{"label":"Body","type":"richtext"}},"regions":["main"],"role":"section","title":"Rich text"}},"contentVersion":1,"engines":{"tanqory-abi":"^2.0","tanqory-field-types":"1"},"name":"@tanqory/fixture-minimal-pass","regions":{"header":{"accepts":["header-bar"],"max":1,"min":1,"scope":"shared","title":"Header"},"main":{"max":32,"scope":"template","title":"Main"}},"routes":{"collection":"collection","home":"index","not_found":"404","page":"page","product":"product"},"settingsSchema":[{"group":"Colors","items":[{"default":"light","key":"colorScheme","label":"Scheme","options":[{"label":"Light","value":"light"},{"label":"Dark","value":"dark"}],"type":"select"}]}],"templates":{"404":{"regions":["header","main"],"route":"not_found"},"collection":{"regions":["header","main"],"route":"collection"},"index":{"regions":["header","main"],"route":"home","title":"Home"},"page":{"regions":["header","main"],"route":"page"},"product":{"regions":["header","main"],"route":"product"}},"version":"1.0.0"}
|
|
1
|
+
{"abi":"2.0","capabilities":{"browser":[],"server":["data:shop","data:localization","data:catalog","data:content"]},"client":{"hydration":"none"},"components":{"header-bar":{"attributes":{"menu":{"default":"main-menu","label":"Menu","type":"menu"}},"regions":["header"],"role":"layout","title":"Header bar"},"hero":{"attributes":{"body":{"label":"Body","type":"richtext"},"heading":{"default":"Welcome","label":"Heading","type":"text"}},"presets":[{"name":"Default hero","settings":{"heading":"Welcome"}}],"regions":["main"],"role":"section","title":"Hero"},"rich-text":{"attributes":{"body":{"label":"Body","type":"richtext"}},"children":["@app"],"regions":["main"],"role":"section","title":"Rich text"}},"contentVersion":1,"engines":{"tanqory-abi":"^2.0","tanqory-field-types":"1"},"name":"@tanqory/fixture-minimal-pass","regions":{"header":{"accepts":["header-bar"],"max":1,"min":1,"scope":"shared","title":"Header"},"main":{"max":32,"scope":"template","title":"Main"}},"routes":{"collection":"collection","home":"index","not_found":"404","page":"page","product":"product"},"settingsSchema":[{"group":"Colors","items":[{"default":"light","key":"colorScheme","label":"Scheme","options":[{"label":"Light","value":"light"},{"label":"Dark","value":"dark"}],"type":"select"}]}],"templates":{"404":{"regions":["header","main"],"route":"not_found"},"collection":{"regions":["header","main"],"route":"collection"},"index":{"regions":["header","main"],"route":"home","title":"Home"},"page":{"regions":["header","main"],"route":"page"},"product":{"regions":["header","main"],"route":"product"}},"version":"1.0.0"}
|
|
@@ -47,6 +47,7 @@ export const manifest = {
|
|
|
47
47
|
title: 'Rich text',
|
|
48
48
|
regions: ['main'],
|
|
49
49
|
attributes: { body: { type: 'richtext', label: 'Body' } },
|
|
50
|
+
children: ['@app'],
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
settingsSchema: [{ group: 'Colors', items: [{ key: 'colorScheme', type: 'select', label: 'Scheme', options: [{ value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }], default: 'light' }] }],
|
|
@@ -54,6 +55,11 @@ export const manifest = {
|
|
|
54
55
|
|
|
55
56
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
56
57
|
|
|
58
|
+
// theme-abi §7.2 AppBlocks-1: a block of an installed app renders as the platform placeholder, its settings inert JSON
|
|
59
|
+
const appJson = (v) => JSON.stringify(v ?? {}).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
60
|
+
const appBlocks = (node) => (node.blocks ?? []).filter((b) => /^app:/.test(b.type)).map((b) => `<div data-tq-app-block="${esc(b.type)}" data-tq-node="${esc(b.id)}" data-tq-type="${esc(b.type)}" class="tq-app-block"><script type="application/json">${appJson(b.settings)}</script></div>`).join('')
|
|
61
|
+
|
|
62
|
+
|
|
57
63
|
function renderSection(node, snap) {
|
|
58
64
|
switch (node.type) {
|
|
59
65
|
case 'header-bar': {
|
|
@@ -64,7 +70,7 @@ function renderSection(node, snap) {
|
|
|
64
70
|
case 'hero':
|
|
65
71
|
return `<section data-tq-node="${esc(node.id)}"><h1>${esc(node.settings?.heading ?? 'Welcome')}</h1>${node.settings?.body ?? ''}</section>`
|
|
66
72
|
case 'rich-text':
|
|
67
|
-
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}</section>`
|
|
73
|
+
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}${appBlocks(node)}</section>`
|
|
68
74
|
default:
|
|
69
75
|
return ''
|
|
70
76
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"contentVersion": 1, "template": "product", "regions": {"main": {"sections": [{"type": "rich-text", "id": "product-rich-text-1", "settings": {"body": "<p>Made to last.</p>"}}]}}}
|
|
@@ -45,6 +45,7 @@ export const manifest = {
|
|
|
45
45
|
title: 'Rich text',
|
|
46
46
|
regions: ['main'],
|
|
47
47
|
attributes: { body: { type: 'richtext', label: 'Body' } },
|
|
48
|
+
children: ['@app'],
|
|
48
49
|
},
|
|
49
50
|
},
|
|
50
51
|
settingsSchema: [{ group: 'Colors', items: [{ key: 'colorScheme', type: 'select', label: 'Scheme', options: [{ value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }], default: 'light' }] }],
|
|
@@ -52,6 +53,11 @@ export const manifest = {
|
|
|
52
53
|
|
|
53
54
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
54
55
|
|
|
56
|
+
// theme-abi §7.2 AppBlocks-1: a block of an installed app renders as the platform placeholder, its settings inert JSON
|
|
57
|
+
const appJson = (v) => JSON.stringify(v ?? {}).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
58
|
+
const appBlocks = (node) => (node.blocks ?? []).filter((b) => /^app:/.test(b.type)).map((b) => `<div data-tq-app-block="${esc(b.type)}" data-tq-node="${esc(b.id)}" data-tq-type="${esc(b.type)}" class="tq-app-block"><script type="application/json">${appJson(b.settings)}</script></div>`).join('')
|
|
59
|
+
|
|
60
|
+
|
|
55
61
|
function renderSection(node, snap) {
|
|
56
62
|
switch (node.type) {
|
|
57
63
|
case 'header-bar': {
|
|
@@ -62,7 +68,7 @@ function renderSection(node, snap) {
|
|
|
62
68
|
case 'hero':
|
|
63
69
|
return `<section data-tq-node="${esc(node.id)}"><h1>${esc(node.settings?.heading ?? 'Welcome')}</h1>${node.settings?.body ?? ''}</section>`
|
|
64
70
|
case 'rich-text':
|
|
65
|
-
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}</section>`
|
|
71
|
+
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}${appBlocks(node)}</section>`
|
|
66
72
|
default:
|
|
67
73
|
return ''
|
|
68
74
|
}
|
|
@@ -45,6 +45,7 @@ export const manifest = {
|
|
|
45
45
|
title: 'Rich text',
|
|
46
46
|
regions: ['main'],
|
|
47
47
|
attributes: { body: { type: 'richtext', label: 'Body' } },
|
|
48
|
+
children: ['@app'],
|
|
48
49
|
},
|
|
49
50
|
},
|
|
50
51
|
settingsSchema: [{ group: 'Colors', items: [{ key: 'colorScheme', type: 'select', label: 'Scheme', options: [{ value: 'light', label: 'Light' }, { value: 'dark', label: 'Dark' }], default: 'light' }] }],
|
|
@@ -52,6 +53,11 @@ export const manifest = {
|
|
|
52
53
|
|
|
53
54
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
54
55
|
|
|
56
|
+
// theme-abi §7.2 AppBlocks-1: a block of an installed app renders as the platform placeholder, its settings inert JSON
|
|
57
|
+
const appJson = (v) => JSON.stringify(v ?? {}).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
|
|
58
|
+
const appBlocks = (node) => (node.blocks ?? []).filter((b) => /^app:/.test(b.type)).map((b) => `<div data-tq-app-block="${esc(b.type)}" data-tq-node="${esc(b.id)}" data-tq-type="${esc(b.type)}" class="tq-app-block"><script type="application/json">${appJson(b.settings)}</script></div>`).join('')
|
|
59
|
+
|
|
60
|
+
|
|
55
61
|
function renderSection(node, snap) {
|
|
56
62
|
switch (node.type) {
|
|
57
63
|
case 'header-bar': {
|
|
@@ -62,7 +68,7 @@ function renderSection(node, snap) {
|
|
|
62
68
|
case 'hero':
|
|
63
69
|
return `<section data-tq-node="${esc(node.id)}"><h1>${esc(node.settings?.heading ?? 'Welcome')}</h1>${node.settings?.body ?? ''}</section>`
|
|
64
70
|
case 'rich-text':
|
|
65
|
-
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}</section>`
|
|
71
|
+
return `<section data-tq-node="${esc(node.id)}">${node.settings?.body ?? ''}${appBlocks(node)}</section>`
|
|
66
72
|
default:
|
|
67
73
|
return ''
|
|
68
74
|
}
|