docblocks-core 0.1.2 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # docblocks-core
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0791efb: The `embed` block gains the persisted view attrs: the optional `zoom`
8
+ (the scale factor, positive) and `panX` / `panY` (the pan offsets, px).
9
+ Absent or `null` stand the identity view (the attrs' null idiom — the
10
+ values are never removed, `null` = the view cleared). The reader stands
11
+ the unknown attrs over the older data (absent = the identity); the
12
+ validator stands the finite-number / positive-zoom rules over the
13
+ strict's path.
14
+ - 48ef4fb: The `embed` block's height stands the stretchable stand: the
15
+ `--docblocks-embed-height` token (300 px) is the default — the minimum,
16
+ and the block's bottom edge stands the resize handle (the hover reveal's
17
+ grip bar, the `cursor-row-resize`'s stand, the keyboard's arrows over
18
+ the 16 px's step — the slider's aria). The drag stretches the wrapper's
19
+ height over the gesture (the live's stand), and the rest's commit stands
20
+ the block's new `height` attr (px; absent or `null` = the token's
21
+ default — the null idiom's stand, so the reload restores the stretched
22
+ stand and the panes share it over the wire). The stretch only stands
23
+ over the minimum (the drag over it clamps, the clear stands the `null`'s
24
+ write); the read-only's stand gates the handle off.
25
+
26
+ ## 0.1.3
27
+
28
+ ### Patch Changes
29
+
30
+ - 5971d30: `PresenceState` now passes through the awareness payload's sharing
31
+ contract fields — the consumer user identity (`userId` / `name`), the
32
+ opaque ciphertext selection entries (`selections`), and the publication
33
+ counter (`seq`). The ws-provider mapper validates them defensively; a
34
+ legacy frame keeps its pre-sharing shape.
35
+
3
36
  ## 0.1.2
4
37
 
5
38
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -283,6 +283,21 @@ interface EmbedAttrs {
283
283
  src: string;
284
284
  /** Accessible title; falls back to the kind in the renderer. */
285
285
  title?: string;
286
+ /**
287
+ * The persisted zoom (the scale factor; 1 = 100%). Absent or `null` = the
288
+ * identity (the null idiom — attrs are never removed).
289
+ */
290
+ zoom?: number | null;
291
+ /** The persisted horizontal pan offset (px); absent or `null` = 0. */
292
+ panX?: number | null;
293
+ /** The persisted vertical pan offset (px); absent or `null` = 0. */
294
+ panY?: number | null;
295
+ /**
296
+ * The persisted height (px; the block's stretched stand). Absent or
297
+ * `null` = the default (the `--docblocks-embed-height` token's stand —
298
+ * the minimum; the resize only stretches over it).
299
+ */
300
+ height?: number | null;
286
301
  /** Nesting depth in the page sequence (default 0). */
287
302
  indent?: PageIndent;
288
303
  }
@@ -1287,6 +1302,27 @@ interface PresenceState {
1287
1302
  selection: PresenceSelection | null;
1288
1303
  /** Unix milliseconds. Staleness handling (TTL) is a consumer concern. */
1289
1304
  updatedAt: number;
1305
+ /**
1306
+ * Consumer-provided stable user identity (optional; absent on legacy
1307
+ * peers). `peerId` is the anonymous transport-level identifier —
1308
+ * `userId` is the only addressable identity.
1309
+ */
1310
+ userId?: string;
1311
+ /** Consumer-provided roster display label (optional). */
1312
+ name?: string;
1313
+ /**
1314
+ * Opaque ciphertext selection entries (optional): one per share
1315
+ * target, no target id inside the entry — the recipient tries each
1316
+ * entry with its own decryptor. Absent when the peer shares with
1317
+ * everyone (plaintext `selection`) or not at all.
1318
+ */
1319
+ selections?: string[];
1320
+ /**
1321
+ * Monotonic per-publisher selection publication counter (optional):
1322
+ * the recipient discards a decrypted selection whose `seq` is older
1323
+ * than the last accepted one for the peer (the async decrypt race).
1324
+ */
1325
+ seq?: number;
1290
1326
  }
1291
1327
  /**
1292
1328
  * Transport for syncing one document with peers.
package/dist/index.mjs CHANGED
@@ -710,7 +710,17 @@ const BLOCK_REGISTRY = {
710
710
  nonEmpty: true,
711
711
  required: true
712
712
  },
713
- title: { kind: "string" }
713
+ title: { kind: "string" },
714
+ zoom: {
715
+ kind: "nullable-number",
716
+ positive: true
717
+ },
718
+ panX: { kind: "nullable-number" },
719
+ panY: { kind: "nullable-number" },
720
+ height: {
721
+ kind: "nullable-number",
722
+ positive: true
723
+ }
714
724
  }
715
725
  },
716
726
  "sync-embed": {
@@ -6255,6 +6265,18 @@ function parseSelection(value) {
6255
6265
  if (isStringArray(sel.blocks)) return { blocks: [...sel.blocks] };
6256
6266
  return null;
6257
6267
  }
6268
+ /** The sharing-contract presence extras (identity, ciphertext entries, the
6269
+ * publication counter): defensive validation, absent for legacy peers. */
6270
+ function parsePresenceExtras(value) {
6271
+ if (typeof value !== "object" || value === null) return {};
6272
+ const state = value;
6273
+ const extras = {};
6274
+ if (typeof state.userId === "string") extras.userId = state.userId;
6275
+ if (typeof state.name === "string") extras.name = state.name;
6276
+ if (isStringArray(state.selections)) extras.selections = [...state.selections];
6277
+ if (typeof state.seq === "number") extras.seq = state.seq;
6278
+ return extras;
6279
+ }
6258
6280
  /** The default socket factory: the global WebSocket, normalized to WsLike. */
6259
6281
  const defaultWebSocketImpl = (url) => {
6260
6282
  const ws = new WebSocket(url);
@@ -6591,7 +6613,8 @@ var WsSyncProvider = class {
6591
6613
  peers.push({
6592
6614
  peerId: String(clientID),
6593
6615
  selection: parseSelection(state.selection),
6594
- updatedAt: typeof state.updatedAt === "number" ? state.updatedAt : 0
6616
+ updatedAt: typeof state.updatedAt === "number" ? state.updatedAt : 0,
6617
+ ...parsePresenceExtras(state)
6595
6618
  });
6596
6619
  });
6597
6620
  return peers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-core",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Headless CRDT document engine: schema v1, Doc (commands/transactions/undo), sync providers. Yjs-based, zero UI dependencies.",
5
5
  "type": "module",
6
6
  "license": "MIT",