studiograph 1.3.48-next.261 → 1.3.48-next.263
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/agent/prompts/system.md +2 -2
- package/dist/agent/skills/artifact-canvas/skill.md +25 -37
- package/dist/agent/skills/paged-documents/skill.md +74 -104
- package/dist/agent/tools/artifact-tools.js +1 -1
- package/dist/agent/tools/artifact-tools.js.map +1 -1
- package/dist/core/artifact-columns-css.d.ts +38 -0
- package/dist/core/artifact-columns-css.js +157 -0
- package/dist/core/artifact-columns-css.js.map +1 -0
- package/dist/core/artifact-frame-document.d.ts +57 -15
- package/dist/core/artifact-frame-document.js +396 -356
- package/dist/core/artifact-frame-document.js.map +1 -1
- package/dist/core/artifact-frame-model.d.ts +42 -1
- package/dist/core/artifact-frame-model.js +102 -1
- package/dist/core/artifact-frame-model.js.map +1 -1
- package/dist/mcp/tools.js +8 -8
- package/dist/mcp/tools.js.map +1 -1
- package/dist/server/routes/artifact-export-api.js +2 -3
- package/dist/server/routes/artifact-export-api.js.map +1 -1
- package/dist/server/routes/chat-turn-outcome.d.ts +36 -0
- package/dist/server/routes/chat-turn-outcome.js +17 -0
- package/dist/server/routes/chat-turn-outcome.js.map +1 -0
- package/dist/services/artifact-library-sources.d.ts +1 -6
- package/dist/services/artifact-library-sources.js +1 -9
- package/dist/services/artifact-library-sources.js.map +1 -1
- package/dist/services/artifact-render-export.d.ts +3 -3
- package/dist/services/artifact-render-export.js +57 -50
- package/dist/services/artifact-render-export.js.map +1 -1
- package/dist/web/_app/immutable/chunks/{Cg7m1gqN.js → 1Av0cjjM.js} +1 -1
- package/dist/web/_app/immutable/chunks/7C_XQ_V22.js +949 -0
- package/dist/web/_app/immutable/chunks/{Bpmx7Umc.js → 7dxFJmtT.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CR1JY_cb.js → B3TQ2v3O.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CZBW5wi82.js → BKJo_vcH2.js} +1 -1
- package/dist/web/_app/immutable/chunks/{Cx5IiiDO2.js → BLjaRsry2.js} +1 -1
- package/dist/web/_app/immutable/chunks/{snCOoD78.js → BWM7Fyds.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CQl_RUVN2.js → BZrDj1Yc2.js} +1 -1
- package/dist/web/_app/immutable/chunks/{D0_Iu3Uj.js → B_EIjYsb.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DaB0hU8_.js → BaVciYXp.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CQW66fYJ.js → BkWTUZUm.js} +1 -1
- package/dist/web/_app/immutable/chunks/{BU5TCj7m.js → BzEpkiVx.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CkivrILi.js → CFQ_EH_P.js} +1 -1
- package/dist/web/_app/immutable/chunks/CL_APTyv.js +1 -0
- package/dist/web/_app/immutable/chunks/{2z2ekE6D2.js → COK5qG3L2.js} +2 -2
- package/dist/web/_app/immutable/chunks/{BIeOkmiV.js → CRwWneZ-.js} +1 -1
- package/dist/web/_app/immutable/chunks/{1QRy7-wo.js → CW2H4JII.js} +1 -1
- package/dist/web/_app/immutable/chunks/{pPsy4008.js → CWeviCpk.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DMFH9Cnt2.js → CXOqnNsj2.js} +1 -1
- package/dist/web/_app/immutable/chunks/{oIZupUnz.js → CX_WuP2f.js} +1 -1
- package/dist/web/_app/immutable/chunks/{BIwe25Lk.js → CY5xLE5F.js} +1 -1
- package/dist/web/_app/immutable/chunks/{D-vvXTU3.js → CeUT6lMf.js} +2 -2
- package/dist/web/_app/immutable/chunks/{B5UH1FNe.js → CgmH6rPv.js} +3 -3
- package/dist/web/_app/immutable/chunks/{-Tbr-96c2.js → CkOWeGhc2.js} +1 -1
- package/dist/web/_app/immutable/chunks/{K5YHt1WL2.js → CkPu5VTd2.js} +1 -1
- package/dist/web/_app/immutable/chunks/ClSRVrsW.js +1 -0
- package/dist/web/_app/immutable/chunks/{CcgYvk_3.js → Cmq7bKUh.js} +1 -1
- package/dist/web/_app/immutable/chunks/{F5xZdLlB.js → CnR_G-ce.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CuYL65Bn.js → CzSx91mJ.js} +1 -1
- package/dist/web/_app/immutable/chunks/D-a94Hdg.js +1 -0
- package/dist/web/_app/immutable/chunks/DAcMjPms.js +2 -0
- package/dist/web/_app/immutable/chunks/{B06uE1qJ.js → DC2fTKy0.js} +1 -1
- package/dist/web/_app/immutable/chunks/{atFSAfcd2.js → DDfqLzbz2.js} +2 -2
- package/dist/web/_app/immutable/chunks/{DhD1HF7R.js → DFLuHkej.js} +1 -1
- package/dist/web/_app/immutable/chunks/{PwUOTfSv.js → DOZR4-gy.js} +1 -1
- package/dist/web/_app/immutable/chunks/DO_V9Cgc.js +1 -0
- package/dist/web/_app/immutable/chunks/{Cxdio_Al.js → DPI7dnke.js} +3 -3
- package/dist/web/_app/immutable/chunks/{CG8YKaqc.js → DVcmIzo2.js} +1 -1
- package/dist/web/_app/immutable/chunks/DZ2Zr5zb.js +1 -0
- package/dist/web/_app/immutable/chunks/{ChS3kWO-.js → DiGsqyRs.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CKwV6HKc.js → DmzyKw-k.js} +1 -1
- package/dist/web/_app/immutable/chunks/Dvj33Rn2.js +1 -0
- package/dist/web/_app/immutable/chunks/{B9VQbssY.js → MDb5bFUr.js} +1 -1
- package/dist/web/_app/immutable/chunks/mYfi0ijf2.js +66 -0
- package/dist/web/_app/immutable/chunks/{CuatNdzp.js → nkOOikT2.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CLninaDG2.js → qU6V8dVT2.js} +2 -2
- package/dist/web/_app/immutable/chunks/{DtXJCaQc2.js → qtwjrlYo2.js} +1 -1
- package/dist/web/_app/immutable/chunks/{B3u4QMoU.js → vR5HiNz9.js} +1 -1
- package/dist/web/_app/immutable/chunks/{7l950wkn.js → xhwwouQZ.js} +1 -1
- package/dist/web/_app/immutable/chunks/{BBrP9GiZ.js → yKBXs2Vl.js} +1 -1
- package/dist/web/_app/immutable/chunks/{sUAtda6y2.js → zMLQbXeR2.js} +1 -1
- package/dist/web/_app/immutable/entry/{app.1tcNTKI-.js → app.CRvuxoVJ.js} +2 -2
- package/dist/web/_app/immutable/entry/start.CRSlQSAo.js +1 -0
- package/dist/web/_app/immutable/nodes/{0.v0W5DL7W.js → 0.DCtO9hJz.js} +2 -2
- package/dist/web/_app/immutable/nodes/{1.81Rb3Ith.js → 1.CU0Xk0hX.js} +1 -1
- package/dist/web/_app/immutable/nodes/{10.CAlZNFOq.js → 10.BQ_I0U3h.js} +1 -1
- package/dist/web/_app/immutable/nodes/{11.CCfUginI.js → 11.D8W7J9oj.js} +1 -1
- package/dist/web/_app/immutable/nodes/{12.BJLboAyk.js → 12.shu8hSiJ.js} +1 -1
- package/dist/web/_app/immutable/nodes/{13.Cz4UTl2G.js → 13.CqSie9pj.js} +1 -1
- package/dist/web/_app/immutable/nodes/15.CRTNtmaK.js +1 -0
- package/dist/web/_app/immutable/nodes/{16.BjohAUt9.js → 16.CLnfWtVJ.js} +1 -1
- package/dist/web/_app/immutable/nodes/{18.DsOT0tDo.js → 18.L6u3xca6.js} +1 -1
- package/dist/web/_app/immutable/nodes/{19.BiJWLOUT.js → 19.BfT4fpP2.js} +1 -1
- package/dist/web/_app/immutable/nodes/{2.Cd72nG2V.js → 2.Cywkr3cW.js} +4 -4
- package/dist/web/_app/immutable/nodes/{3.BIT9mm9r.js → 3.C5-yIMEM.js} +1 -1
- package/dist/web/_app/immutable/nodes/{4.Cn7r0Poe.js → 4.LWwxRkzM.js} +3 -3
- package/dist/web/_app/immutable/nodes/{5.CkJNdCZG.js → 5.CwRllvWS.js} +1 -1
- package/dist/web/_app/immutable/nodes/{6.1rbIRQgQ.js → 6.BcR9vQIF.js} +1 -1
- package/dist/web/_app/immutable/nodes/{7.w17Zl36i.js → 7.Bm0Ie3c3.js} +1 -1
- package/dist/web/_app/immutable/nodes/{8.DqTsYuU-.js → 8.Dj0JJcTw.js} +1 -1
- package/dist/web/_app/immutable/nodes/{9.BJhYZPfc.js → 9.9MiRRKIu.js} +1 -1
- package/dist/web/_app/version.json +1 -1
- package/dist/web/index.html +14 -14
- package/package.json +1 -2
- package/dist/web/_app/immutable/chunks/9Sn2PwSn2.js +0 -1025
- package/dist/web/_app/immutable/chunks/AFZSy-Vk.js +0 -2
- package/dist/web/_app/immutable/chunks/B4PrlkmE.js +0 -1
- package/dist/web/_app/immutable/chunks/C85NG5lS.js +0 -1
- package/dist/web/_app/immutable/chunks/CJbr-v9X.js +0 -1
- package/dist/web/_app/immutable/chunks/D4vfNy_f.js +0 -1
- package/dist/web/_app/immutable/chunks/DG7uGoZb2.js +0 -58
- package/dist/web/_app/immutable/chunks/DTOO9nUj.js +0 -1
- package/dist/web/_app/immutable/chunks/Dav8Lgyy2.js +0 -5
- package/dist/web/_app/immutable/chunks/DjXtgWTP.js +0 -1
- package/dist/web/_app/immutable/entry/start.BJMsySI1.js +0 -1
- package/dist/web/_app/immutable/nodes/15.D2mNE6C-.js +0 -1
- /package/dist/web/_app/immutable/chunks/{Oglnp7sm.js → Oglnp7sm2.js} +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite author CSS so a `pages` document's flowing content paginates under
|
|
3
|
+
* NATIVE CSS multi-column (the columns compositor) instead of Paged.js.
|
|
4
|
+
*
|
|
5
|
+
* WHY: the compositor lays the document body out as one tall multi-column flow
|
|
6
|
+
* (`column-width` = the page content width); each column == one page. Two author
|
|
7
|
+
* CSS idioms were written for Paged.js's `@page` model and DON'T translate:
|
|
8
|
+
* 1. Forced PAGE breaks (`break-before:page`, legacy `page-break-*:always`, …)
|
|
9
|
+
* do nothing inside a multicol container — they must become COLUMN breaks.
|
|
10
|
+
* 2. `position:running(name)` elements (the source for `@page` margin-box
|
|
11
|
+
* running headers) are inert outside `@page`; left in the body flow they
|
|
12
|
+
* render as stray in-flow content. They must be removed from the flow.
|
|
13
|
+
*
|
|
14
|
+
* This is a BUILD-TIME transform (run once on the emitted shared CSS + each
|
|
15
|
+
* paginated frame's inline `<style>` blocks), so there is no sandboxed-runtime
|
|
16
|
+
* twin to keep in lock-step — unlike the former Paged.js url() sanitizer.
|
|
17
|
+
*
|
|
18
|
+
* PARSER, NOT BARE REGEX: a naive `String.replace` would corrupt a
|
|
19
|
+
* `content:"break-before:page"` string literal, a `/* break-before:page */`
|
|
20
|
+
* comment, or text inside a `url()`. So we first SEGMENT the CSS — copying
|
|
21
|
+
* comments, string literals, and `url()` tokens through VERBATIM — and apply the
|
|
22
|
+
* property/value rewrites ONLY to the "normal" CSS runs between them. The
|
|
23
|
+
* segmenter mirrors the skip logic of the (removed) `artifact-paged-css.ts` url
|
|
24
|
+
* scanner: it honors `\` escapes and never matches `url(` inside a comment or
|
|
25
|
+
* string.
|
|
26
|
+
*
|
|
27
|
+
* Scope: `@page` blocks and the `page:` property are left untouched — they are
|
|
28
|
+
* simply ignored by the screen render (and the PDF export composites the page
|
|
29
|
+
* tiles, so it never consults the author's `@page`). Named-page break values are
|
|
30
|
+
* not real `break-before` keywords, so they need no mapping.
|
|
31
|
+
*/
|
|
32
|
+
const IDENT = /[A-Za-z0-9_-]/;
|
|
33
|
+
const SPACE = /\s/;
|
|
34
|
+
/** Apply the break/running rewrites to a run of NORMAL css (no comments, strings,
|
|
35
|
+
* or url() tokens — the segmenter guarantees that). Property names + values are
|
|
36
|
+
* matched with `\b` boundaries so `break-before:pagex` (a longer value) is never
|
|
37
|
+
* partially rewritten. Order matters: the `avoid-page` and legacy `page-break-*`
|
|
38
|
+
* rules run before the generic forced-break rule so each declaration maps once. */
|
|
39
|
+
function rewriteColumnsInNormalCss(s) {
|
|
40
|
+
const lc = (x) => x.toLowerCase();
|
|
41
|
+
// Each property name is left-anchored with `(?<![\w-])` so it matches a WHOLE
|
|
42
|
+
// property, never a substring of a longer one — e.g. a custom property
|
|
43
|
+
// `--page-break-before` or a vendor prefix `-webkit-page-break-before` /
|
|
44
|
+
// `-webkit-column-break-before` (both preceded by `-`) are left untouched rather
|
|
45
|
+
// than mangled into an invalid property. Legitimate declarations are preceded by
|
|
46
|
+
// `{`, `;`, whitespace, a quote, or start-of-string — none of which are `[\w-]`.
|
|
47
|
+
return s
|
|
48
|
+
// position:running(header) → display:none (remove the running source from flow).
|
|
49
|
+
.replace(/(?<![\w-])position\s*:\s*running\([^)]*\)/gi, 'display:none')
|
|
50
|
+
// break-inside:avoid-page → break-inside:avoid (page-specific avoidance → generic).
|
|
51
|
+
.replace(/(?<![\w-])break-(inside|before|after)\s*:\s*avoid-page\b/gi, (_m, d) => `break-${lc(d)}:avoid`)
|
|
52
|
+
// Legacy page-break-* shorthand → modern break-*.
|
|
53
|
+
.replace(/(?<![\w-])page-break-(before|after)\s*:\s*(?:always|left|right|recto|verso|page)\b/gi, (_m, d) => `break-${lc(d)}:column`)
|
|
54
|
+
.replace(/(?<![\w-])page-break-(before|after)\s*:\s*avoid\b/gi, (_m, d) => `break-${lc(d)}:avoid`)
|
|
55
|
+
.replace(/(?<![\w-])page-break-inside\s*:\s*avoid\b/gi, 'break-inside:avoid')
|
|
56
|
+
// Modern forced PAGE break → forced COLUMN break.
|
|
57
|
+
.replace(/(?<![\w-])break-(before|after)\s*:\s*(?:page|always|left|right|recto|verso)\b/gi, (_m, d) => `break-${lc(d)}:column`);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Token-aware rewrite of author CSS for the native-columns compositor. Copies
|
|
61
|
+
* comments / string literals / `url()` tokens through verbatim; rewrites forced
|
|
62
|
+
* page breaks → column breaks and neutralizes `position:running()` only in the
|
|
63
|
+
* normal CSS between them. Idempotent (a second pass finds nothing to change).
|
|
64
|
+
*/
|
|
65
|
+
export function rewriteAuthorCssForColumns(css) {
|
|
66
|
+
if (!css)
|
|
67
|
+
return css;
|
|
68
|
+
const len = css.length;
|
|
69
|
+
const isIdent = (c) => c !== undefined && IDENT.test(c);
|
|
70
|
+
const isSpace = (c) => c !== undefined && SPACE.test(c);
|
|
71
|
+
let out = '';
|
|
72
|
+
let normal = '';
|
|
73
|
+
const flush = () => { if (normal) {
|
|
74
|
+
out += rewriteColumnsInNormalCss(normal);
|
|
75
|
+
normal = '';
|
|
76
|
+
} };
|
|
77
|
+
let i = 0;
|
|
78
|
+
while (i < len) {
|
|
79
|
+
const c = css[i];
|
|
80
|
+
// CSS comment — copy through untouched.
|
|
81
|
+
if (c === '/' && css[i + 1] === '*') {
|
|
82
|
+
flush();
|
|
83
|
+
const end = css.indexOf('*/', i + 2);
|
|
84
|
+
const stop = end === -1 ? len : end + 2;
|
|
85
|
+
out += css.slice(i, stop);
|
|
86
|
+
i = stop;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
// String literal — copy through (a break/running token inside a string is data).
|
|
90
|
+
if (c === '"' || c === "'") {
|
|
91
|
+
flush();
|
|
92
|
+
let j = i + 1;
|
|
93
|
+
while (j < len) {
|
|
94
|
+
if (css[j] === '\\') {
|
|
95
|
+
j += 2;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (css[j] === c) {
|
|
99
|
+
j++;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
j++;
|
|
103
|
+
}
|
|
104
|
+
out += css.slice(i, j);
|
|
105
|
+
i = j;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
// url( … ) token — copy through verbatim (only when `url` is a standalone
|
|
109
|
+
// function name, so `myurl(` / `figurl(` are normal text).
|
|
110
|
+
if ((c === 'u' || c === 'U') && css.slice(i, i + 4).toLowerCase() === 'url(' && !isIdent(css[i - 1])) {
|
|
111
|
+
flush();
|
|
112
|
+
let j = i + 4;
|
|
113
|
+
while (j < len && isSpace(css[j]))
|
|
114
|
+
j++;
|
|
115
|
+
if (css[j] === '"' || css[j] === "'") {
|
|
116
|
+
const q = css[j];
|
|
117
|
+
j++;
|
|
118
|
+
while (j < len) {
|
|
119
|
+
if (css[j] === '\\') {
|
|
120
|
+
j += 2;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (css[j] === q) {
|
|
124
|
+
j++;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
j++;
|
|
128
|
+
}
|
|
129
|
+
while (j < len && isSpace(css[j]))
|
|
130
|
+
j++;
|
|
131
|
+
if (css[j] === ')')
|
|
132
|
+
j++;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
while (j < len) {
|
|
136
|
+
if (css[j] === '\\') {
|
|
137
|
+
j += 2;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (css[j] === ')') {
|
|
141
|
+
j++;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
j++;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
out += css.slice(i, j);
|
|
148
|
+
i = j;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
normal += c;
|
|
152
|
+
i++;
|
|
153
|
+
}
|
|
154
|
+
flush();
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=artifact-columns-css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-columns-css.js","sourceRoot":"","sources":["../../src/core/artifact-columns-css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,KAAK,GAAG,eAAe,CAAC;AAC9B,MAAM,KAAK,GAAG,IAAI,CAAC;AAEnB;;;;oFAIoF;AACpF,SAAS,yBAAyB,CAAC,CAAS;IAC1C,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1C,8EAA8E;IAC9E,uEAAuE;IACvE,yEAAyE;IACzE,iFAAiF;IACjF,iFAAiF;IACjF,iFAAiF;IACjF,OAAO,CAAC;QACN,iFAAiF;SAChF,OAAO,CAAC,6CAA6C,E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AAC,SAAS;oBAAC,CAAC;oBAC1C,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;wBAAC,CAAC,EAAE,CAAC;wBAAC,MAAM;oBAAC,CAAC;oBACnC,CAAC,EAAE,CAAC;gBACN,CAAC;YACH,CAAC;YACD,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACvB,CAAC,GAAG,CAAC,CAAC;YACN,SAAS;QACX,CAAC;QACD,MAAM,IAAI,CAAC,CAAC;QACZ,CAAC,EAAE,CAAC;IACN,CAAC;IACD,KAAK,EAAE,CAAC;IACR,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -38,12 +38,6 @@ export interface FrameDocumentContext {
|
|
|
38
38
|
/** Base URL for a headless render so root-relative `/api/assets/...` resolve.
|
|
39
39
|
* Never set on a downloaded file (it must not phone home). */
|
|
40
40
|
baseHref?: string;
|
|
41
|
-
/** Paged.js source (the `Paged` UMD global). Supplied by the host loader when
|
|
42
|
-
* the bundle has any paginated `document` frame; absent otherwise. Injected
|
|
43
|
-
* in-sandbox so the platform fragments a document's flowing content stream
|
|
44
|
-
* into page boxes (P3.3). Pure @core can't read it from disk, so it threads
|
|
45
|
-
* in like `librarySources`. */
|
|
46
|
-
pagedSource?: string;
|
|
47
41
|
/** Opaque per-render id echoed back in the runtime's `frame-pages` message so
|
|
48
42
|
* the host can drop a stale pagination result from a superseded render (the
|
|
49
43
|
* double-buffer slot may be reset/reloaded with newer content before a slow
|
|
@@ -81,25 +75,73 @@ export declare function isPagesArtifact(bundle: ArtifactBundle): boolean;
|
|
|
81
75
|
* present (no stepper). The host (FrameCanvas) imports this so its whiteboard
|
|
82
76
|
* predicate can't drift from the renderer. */
|
|
83
77
|
export declare function isWhiteboard(bundle: ArtifactBundle): boolean;
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
78
|
+
/** Rewrite a paginated frame's CSS for the native-columns compositor (forced page
|
|
79
|
+
* breaks → column breaks; `position:running()` removed), covering BOTH `<style>`
|
|
80
|
+
* blocks AND inline `style="…"` / `style='…'` attributes. An element with an inline
|
|
81
|
+
* `style="break-before:page"` (the offer-letter signature-block idiom) would
|
|
82
|
+
* otherwise survive un-mapped and only paginate by Chromium's lenient page→column
|
|
83
|
+
* coercion inside multicol — not guaranteed cross-browser. Each value runs through
|
|
84
|
+
* the same token-safe {@link rewriteAuthorCssForColumns}.
|
|
85
|
+
*
|
|
86
|
+
* ONE left-to-right scan over an alternation whose `<style>`-block branch is FIRST,
|
|
87
|
+
* so the scanner consumes a whole style element before it can reach a `style=`
|
|
88
|
+
* literal sitting in that element's CSS text (an `[style]` attribute selector, a
|
|
89
|
+
* `content:"…style=…"` string): only real markup attributes match the inline branch
|
|
90
|
+
* — no double-processing. A style element's text can't contain `</style>`, so the
|
|
91
|
+
* non-greedy block match is safe. (Limitation, mirroring the url() segmenter's: body
|
|
92
|
+
* TEXT shaped exactly like `style="break-before:page"` would also be rewritten; that
|
|
93
|
+
* pathological case is not worth a full HTML parser, and the value itself is still
|
|
94
|
+
* token-safe — strings/url()/comments inside it are preserved. Only QUOTED
|
|
95
|
+
* attribute values are matched; a rare unquoted single-declaration
|
|
96
|
+
* `style=break-before:page` is left to the browser's lenient page→column coercion,
|
|
97
|
+
* as it was before this mapping existed.) */
|
|
98
|
+
export declare function rewritePaginatedContentStyles(html: string): string;
|
|
99
|
+
/** Whether a HOST-LESS render (PNG/PDF/inspect/standalone download) lays this
|
|
100
|
+
* bundle out as a scrolling page COLUMN of compositor-built page tiles. THE single
|
|
86
101
|
* source of truth for that decision across every host-less caller (the headless
|
|
87
102
|
* render, the export route, the MCP export tool), so none drifts from the
|
|
88
103
|
* builder's actual column layout.
|
|
89
104
|
*
|
|
90
105
|
* Requires a FULLY-paginated document — every frame is a `pages` frame — with at
|
|
91
106
|
* least one fixed page box. A MIXED artifact (pages + other layouts) is NOT
|
|
92
|
-
* paginated host-less: the column layout ({@link isPagesArtifact}) wouldn't
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* Paged.js
|
|
107
|
+
* paginated host-less: the column layout ({@link isPagesArtifact}) wouldn't apply,
|
|
108
|
+
* so it would fall to the clipped grid AND the render's page-box selector would
|
|
109
|
+
* switch to the page TILES and drop the non-page frames entirely. Instead a mixed
|
|
110
|
+
* artifact renders as the grid with every frame present (the live editor, which
|
|
111
|
+
* composites pages into the grid, is the surface that paginates mixed). The
|
|
112
|
+
* compositor itself is always inlined (no library to load), so this no longer
|
|
113
|
+
* gates a multi-hundred-KB Paged.js fetch — only the host-less COLUMN vs GRID
|
|
114
|
+
* layout choice + the page-box selector. */
|
|
99
115
|
export declare function bundleNeedsPagination(bundle: ArtifactBundle): boolean;
|
|
116
|
+
interface ResolvedPageMargins {
|
|
117
|
+
top: number;
|
|
118
|
+
right: number;
|
|
119
|
+
bottom: number;
|
|
120
|
+
left: number;
|
|
121
|
+
}
|
|
122
|
+
/** The native-columns geometry for one paginated `pages` frame: the page box
|
|
123
|
+
* (`width`×`height`), the content area inside the margins (`contentWidth`×
|
|
124
|
+
* `contentHeight`), the inter-page gutter in the measurement/clip flow (`gap` =
|
|
125
|
+
* both side margins + a 40px buffer so adjacent pages never visually touch), and
|
|
126
|
+
* the column `pitch` (`contentWidth + gap`). The compositor lays the document
|
|
127
|
+
* body out as one tall multi-column flow of `contentWidth`-wide columns; each
|
|
128
|
+
* column is one page, and translating the flow by `−i*pitch` reveals page `i` in
|
|
129
|
+
* a clipped window. PURE + exported so the arithmetic is unit-testable (the
|
|
130
|
+
* in-browser two-pass measure on top of it can only be covered by e2e). */
|
|
131
|
+
export interface ColumnPageGeometry {
|
|
132
|
+
width: number;
|
|
133
|
+
height: number;
|
|
134
|
+
contentWidth: number;
|
|
135
|
+
contentHeight: number;
|
|
136
|
+
gap: number;
|
|
137
|
+
pitch: number;
|
|
138
|
+
margins: ResolvedPageMargins;
|
|
139
|
+
}
|
|
140
|
+
export declare function columnPageGeometry(frame: ArtifactBundle['frames'][number]): ColumnPageGeometry;
|
|
100
141
|
/**
|
|
101
142
|
* Build the single sandboxed-iframe document for a frame-model bundle. Every
|
|
102
143
|
* surface calls this; `host` selects whether a live host drives chrome/transform
|
|
103
144
|
* (`iframe`) or the file is self-contained (`none`).
|
|
104
145
|
*/
|
|
105
146
|
export declare function buildFrameDocument(bundle: ArtifactBundle, ctx: FrameDocumentContext): string;
|
|
147
|
+
export {};
|