@paged-media/sdk 0.62.0 → 0.64.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/sdk",
3
- "version": "0.62.0",
3
+ "version": "0.64.0",
4
4
  "type": "module",
5
5
  "main": "paged_sdk.js",
6
6
  "types": "paged_sdk.d.ts",
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
@@ -290,6 +368,7 @@ export interface InitOutput {
290
368
  readonly __wbg_set_renderedraster_rgba: (a: number, b: number, c: number) => void;
291
369
  readonly __wbg_set_renderedraster_width: (a: number, b: number) => void;
292
370
  readonly __wbg_viewersession_free: (a: number, b: number) => void;
371
+ readonly on_start: () => void;
293
372
  readonly viewersession_load: (a: number, b: number, c: number, d: number, e: number) => any;
294
373
  readonly viewersession_new: () => any;
295
374
  readonly viewersession_page_count: (a: number) => number;
@@ -302,7 +381,6 @@ export interface InitOutput {
302
381
  readonly viewersession_render_to_canvas_main: (a: number, b: any) => any;
303
382
  readonly viewersession_resize: (a: number, b: number, c: number, d: number) => void;
304
383
  readonly viewersession_set_page: (a: number, b: number) => void;
305
- readonly on_start: () => void;
306
384
  readonly qcms_enable_iccv4: () => void;
307
385
  readonly qcms_profile_precache_output_transform: (a: number) => void;
308
386
  readonly qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
@@ -316,9 +394,9 @@ export interface InitOutput {
316
394
  readonly qcms_white_point_sRGB: (a: number) => void;
317
395
  readonly lut_inverse_interp16: (a: number, b: number, c: number) => number;
318
396
  readonly lut_interp_linear16: (a: number, b: number, c: number) => number;
319
- readonly wasm_bindgen__convert__closures_____invoke__h0cde11723d429dba: (a: number, b: number, c: any) => [number, number];
320
- readonly wasm_bindgen__convert__closures_____invoke__h59cb846e76c2acc2: (a: number, b: number, c: any, d: any) => void;
321
- readonly wasm_bindgen__convert__closures_____invoke__h9534aa66f81a191a: (a: number, b: number, c: any) => void;
397
+ readonly wasm_bindgen__convert__closures_____invoke__h1697a25be679c0e2: (a: number, b: number, c: any, d: any) => void;
398
+ readonly wasm_bindgen__convert__closures_____invoke__h78ff2cea7266d1aa: (a: number, b: number, c: any) => [number, number];
399
+ readonly wasm_bindgen__convert__closures_____invoke__h6089e3893d556868: (a: number, b: number, c: any) => void;
322
400
  readonly __wbindgen_malloc: (a: number, b: number) => number;
323
401
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
324
402
  readonly __wbindgen_exn_store: (a: number) => void;