@paged-media/sdk 0.62.0 → 0.63.0
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/package.json +1 -1
- package/paged_sdk.d.ts +90 -12
- package/paged_sdk.js +2 -2
- package/paged_sdk_bg.wasm +0 -0
package/package.json
CHANGED
package/paged_sdk.d.ts
CHANGED
|
@@ -5,6 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type ScenePathSeg = { op: "moveTo"; x: number; y: number } | { op: "lineTo"; x: number; y: number } | { op: "cubicTo"; cx1: number; cy1: number; cx2: number; cy2: number; x: number; y: number } | { op: "close" };
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A byte buffer that crosses the message channel. Wraps `Vec<u8>`
|
|
10
|
+
* so transferable-via-`postMessage` semantics are explicit at call
|
|
11
|
+
* sites; the wasm crate decides whether to clone or transfer based
|
|
12
|
+
* on whether the value is the JS-side `Uint8Array` or a Rust-side
|
|
13
|
+
* `Vec`. The wire form is whatever serde produces for `Vec<u8>` —
|
|
14
|
+
* JSON renders an array of numbers; future binary protocols (CBOR
|
|
15
|
+
* / messagepack) render a real bytes blob without code change.
|
|
16
|
+
*/
|
|
17
|
+
export type ByteBuf = number[];
|
|
18
|
+
|
|
8
19
|
/**
|
|
9
20
|
* A compositing blend mode for [`SceneItem::FillPathBlend`] (C-1.4).
|
|
10
21
|
* Mirrors the CSS-relevant subset of the display list\'s
|
|
@@ -95,6 +106,29 @@ export interface PagesLayout {
|
|
|
95
106
|
pages: PageRect[];
|
|
96
107
|
}
|
|
97
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Element address the user can select OR a `SetElementProperty`
|
|
111
|
+
* mutation can target. The first six variants are page items
|
|
112
|
+
* (selection state holds these); `StoryRange` is the half-open
|
|
113
|
+
* character range that character / paragraph property writes
|
|
114
|
+
* address. Selection state today never holds `StoryRange` (the
|
|
115
|
+
* text-side caret + range live in `ContentSelection`); the
|
|
116
|
+
* variant exists so the apply layer can be reached via the
|
|
117
|
+
* existing `Mutation::SetElementProperty` wire shape — see
|
|
118
|
+
* `docs/paged/sdk-implementation-plan.md` §3c.1 ADR.
|
|
119
|
+
*/
|
|
120
|
+
export type ElementId = { kind: "textFrame"; id: string } | { kind: "rectangle"; id: string } | { kind: "oval"; id: string } | { kind: "polygon"; id: string } | { kind: "graphicLine"; id: string } | { kind: "group"; id: string } | { kind: "storyRange"; id: { story_id: string; start: number; end: number } } | { kind: "table"; id: { story_id: string; table_id: string } } | { kind: "tableCell"; id: { story_id: string; table_id: string; row: number; col: number } };
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* How a `SetElementSelection` request combines with the current set.
|
|
124
|
+
* Mirrors the canonical macOS / industry convention:
|
|
125
|
+
* - `Replace` — plain click; selection becomes the request.
|
|
126
|
+
* - `Add` — Shift-click; union (already-selected ids stay).
|
|
127
|
+
* - `Toggle` — Cmd/Ctrl-click; ids already in the set are removed,
|
|
128
|
+
* ids not in the set are added.
|
|
129
|
+
*/
|
|
130
|
+
export type SelectionMode = "replace" | "add" | "toggle";
|
|
131
|
+
|
|
98
132
|
/**
|
|
99
133
|
* One RGBA8 tile of a [`PixelLayer`]. `rgba` is tightly packed
|
|
100
134
|
* (`width*height*4`, row-major); the tile is placed at the `(x, y)`
|
|
@@ -129,18 +163,6 @@ export interface SceneGradientStop {
|
|
|
129
163
|
*/
|
|
130
164
|
export type SceneItem = { kind: "fillPath"; path: ScenePathSeg[]; paint: ScenePaint } | { kind: "strokePath"; path: ScenePathSeg[]; paint: ScenePaint; width: number } | ({ kind: "text" } & SceneTextItem) | { kind: "image"; rgba: number[]; width: number; height: number; x: number; y: number; w: number; h: number } | { kind: "fillPathGradient"; path: ScenePathSeg[]; gradient: SceneGradient } | { kind: "fillPathBlend"; path: ScenePathSeg[]; paint: ScenePaint; blend: SceneBlendMode } | { kind: "dropShadow"; path: ScenePathSeg[]; offset_x: number; offset_y: number; blur_radius: number; r: number; g: number; b: number; a: number } | { kind: "innerShadow"; path: ScenePathSeg[]; offset_x: number; offset_y: number; blur_radius: number; choke: number; r: number; g: number; b: number; a: number } | { kind: "strokePathGradient"; path: ScenePathSeg[]; gradient: SceneGradient; width: number } | { kind: "fillPathGradientBlend"; path: ScenePathSeg[]; gradient: SceneGradient; blend: SceneBlendMode };
|
|
131
165
|
|
|
132
|
-
/**
|
|
133
|
-
* Stable page identity, independent of position in the page vector.
|
|
134
|
-
*
|
|
135
|
-
* Derived from the IDML `<Page Self=\"...\">` attribute where present;
|
|
136
|
-
* synthesised as `\"page-<spread_idx>-<local_idx>\"` when missing
|
|
137
|
-
* (older / synthetic fixtures without `Self`). The canvas keys
|
|
138
|
-
* display-list caches and LOD tiles by `PageId`, so the value must
|
|
139
|
-
* stay stable across re-layouts — only document-structural edits
|
|
140
|
-
* (insert/delete page) should ever change the set of `PageId`s.
|
|
141
|
-
*/
|
|
142
|
-
export type PageId = string;
|
|
143
|
-
|
|
144
166
|
/**
|
|
145
167
|
* Structured, JSON-serialisable result of `load` / `render_*`. Unlike
|
|
146
168
|
* the legacy free functions, recoverable parse/layout problems are
|
|
@@ -152,6 +174,60 @@ export interface Diagnostics {
|
|
|
152
174
|
messages: Diagnostic[];
|
|
153
175
|
}
|
|
154
176
|
|
|
177
|
+
/**
|
|
178
|
+
* W1.13 — cell qualifier for a content address that points INTO a
|
|
179
|
+
* table cell rather than the story\'s main paragraph flow.
|
|
180
|
+
*
|
|
181
|
+
* ## The two-stream addressing model
|
|
182
|
+
*
|
|
183
|
+
* Table-cell text is stored out of band on `Table.cells[].paragraphs`
|
|
184
|
+
* (see `idml_import`), disjoint from `Story.paragraphs`. So a content
|
|
185
|
+
* address needs to say *which* paragraph stream its byte offsets index:
|
|
186
|
+
*
|
|
187
|
+
* - `ContentSelection.cell == None` — offsets are story-local bytes
|
|
188
|
+
* over `story.paragraphs` (the body flow). Unchanged from before.
|
|
189
|
+
* - `ContentSelection.cell == Some(addr)` — offsets are CELL-LOCAL
|
|
190
|
+
* bytes over `cell.paragraphs`, under the same story-offset contract
|
|
191
|
+
* (run bytes + one synthetic `\\n` per inter-paragraph boundary,
|
|
192
|
+
* counted within the cell). The owning story is still `story_id`;
|
|
193
|
+
* `addr` picks the cell within that story\'s table.
|
|
194
|
+
*
|
|
195
|
+
* `table_id` / `row` / `col` are the SAME identifiers the hit-test
|
|
196
|
+
* surface emits (`HitResult.table_context` / `TableHitContext`) and
|
|
197
|
+
* that the renderer stamps onto cell `LineLayout`s
|
|
198
|
+
* (`paged_renderer::CellAddr`), so a hit that lands in a cell hands
|
|
199
|
+
* back exactly the qualifier the caret/edit address needs — no second
|
|
200
|
+
* query.
|
|
201
|
+
*
|
|
202
|
+
* ## Why a qualifier and not a re-numbered flat offset
|
|
203
|
+
*
|
|
204
|
+
* The alternative — fold cells into one flat story-offset space via a
|
|
205
|
+
* reserved high-bit/region scheme — was rejected: it makes
|
|
206
|
+
* `shift_for_insert`/`shift_for_delete`, undo inverse offsets, and the
|
|
207
|
+
* existing body-only consumers (BreakRecord, the A/B harness, every
|
|
208
|
+
* `RequestWordBounds`/`RequestLineBounds` caller) all have to learn the
|
|
209
|
+
* encoding, and a single arithmetic slip silently routes an edit into
|
|
210
|
+
* the wrong cell. The qualifier keeps body addressing byte-identical
|
|
211
|
+
* (the field defaults to `None` and is `#[serde(default)]`, so it
|
|
212
|
+
* rides v35 additively — old senders omit it) and makes \"which stream\
|
|
213
|
+
* an explicit, type-checked decision. Undo is trivially correct
|
|
214
|
+
* because the inverse op carries the same `cell` qualifier.
|
|
215
|
+
*/
|
|
216
|
+
export interface TextCellAddr {
|
|
217
|
+
/**
|
|
218
|
+
* `<Table Self=\"...\">` id within `story_id`.
|
|
219
|
+
*/
|
|
220
|
+
tableId: string;
|
|
221
|
+
/**
|
|
222
|
+
* Template row (0-based); span-origin row for spanned cells.
|
|
223
|
+
*/
|
|
224
|
+
row: number;
|
|
225
|
+
/**
|
|
226
|
+
* Column (0-based); span-origin column for spanned cells.
|
|
227
|
+
*/
|
|
228
|
+
col: number;
|
|
229
|
+
}
|
|
230
|
+
|
|
155
231
|
export interface Diagnostic {
|
|
156
232
|
/**
|
|
157
233
|
* `\"error\" | \"warning\" | \"info\"`.
|
|
@@ -176,6 +252,8 @@ export interface PageRect {
|
|
|
176
252
|
heightPt: number;
|
|
177
253
|
}
|
|
178
254
|
|
|
255
|
+
export type PageId = string;
|
|
256
|
+
|
|
179
257
|
|
|
180
258
|
/**
|
|
181
259
|
* Headless readback result. `rgba` is tightly-packed RGBA8
|
package/paged_sdk.js
CHANGED
|
@@ -1351,12 +1351,12 @@ function __wbg_get_imports() {
|
|
|
1351
1351
|
arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
|
|
1352
1352
|
}, arguments); },
|
|
1353
1353
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1354
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1354
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1709, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1355
1355
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0cde11723d429dba);
|
|
1356
1356
|
return ret;
|
|
1357
1357
|
},
|
|
1358
1358
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1359
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1359
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 280, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1360
1360
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h9534aa66f81a191a);
|
|
1361
1361
|
return ret;
|
|
1362
1362
|
},
|
package/paged_sdk_bg.wasm
CHANGED
|
Binary file
|