@paged-media/idml-viewer 0.61.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/idml-viewer",
3
- "version": "0.61.1",
3
+ "version": "0.63.0",
4
4
  "description": "Standalone IDML viewer for the browser — camera, pages, input and events over the @paged-media/sdk WebGPU ViewerSession.",
5
5
  "license": "MPL-2.0 OR LicenseRef-PMEL",
6
6
  "repository": {
@@ -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/wasm/paged_sdk.js CHANGED
@@ -377,6 +377,9 @@ function __wbg_get_imports() {
377
377
  const ret = arg0.createView(arg1);
378
378
  return ret;
379
379
  }, arguments); },
380
+ __wbg_destroy_ce807b0d8ddbb656: function(arg0) {
381
+ arg0.destroy();
382
+ },
380
383
  __wbg_dispatchWorkgroupsIndirect_94154bd122d10b07: function(arg0, arg1, arg2) {
381
384
  arg0.dispatchWorkgroupsIndirect(arg1, arg2);
382
385
  },
@@ -1348,12 +1351,12 @@ function __wbg_get_imports() {
1348
1351
  arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
1349
1352
  }, arguments); },
1350
1353
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1351
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1720, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
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`.
1352
1355
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0cde11723d429dba);
1353
1356
  return ret;
1354
1357
  },
1355
1358
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1356
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 285, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1359
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 280, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1357
1360
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h9534aa66f81a191a);
1358
1361
  return ret;
1359
1362
  },
Binary file