docblocks-react-ui 0.0.0-stage → 0.1.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/LICENSE +21 -0
  3. package/README.md +585 -2
  4. package/dist/Editor-CiJY5R4v.mjs +26587 -0
  5. package/dist/Editor-DT7RkRXf.d.mts +32 -0
  6. package/dist/LoaderCircle-AGVFE4IP.mjs +19 -0
  7. package/dist/Skeleton-D922Ths5.mjs +13 -0
  8. package/dist/constants-D4FTL0ph.mjs +81 -0
  9. package/dist/fonts/OFL.txt +162 -0
  10. package/dist/fonts/inter-300-c.woff2 +0 -0
  11. package/dist/fonts/inter-300-l.woff2 +0 -0
  12. package/dist/fonts/inter-300i-c.woff2 +0 -0
  13. package/dist/fonts/inter-300i-l.woff2 +0 -0
  14. package/dist/fonts/inter-400-c.woff2 +0 -0
  15. package/dist/fonts/inter-400-l.woff2 +0 -0
  16. package/dist/fonts/inter-400i-c.woff2 +0 -0
  17. package/dist/fonts/inter-400i-l.woff2 +0 -0
  18. package/dist/fonts/inter-600-c.woff2 +0 -0
  19. package/dist/fonts/inter-600-l.woff2 +0 -0
  20. package/dist/fonts/inter-600i-c.woff2 +0 -0
  21. package/dist/fonts/inter-600i-l.woff2 +0 -0
  22. package/dist/fonts/jetbrains-mono-300-c.woff2 +0 -0
  23. package/dist/fonts/jetbrains-mono-300-l.woff2 +0 -0
  24. package/dist/fonts/jetbrains-mono-300i-c.woff2 +0 -0
  25. package/dist/fonts/jetbrains-mono-300i-l.woff2 +0 -0
  26. package/dist/fonts/jetbrains-mono-400-c.woff2 +0 -0
  27. package/dist/fonts/jetbrains-mono-400-l.woff2 +0 -0
  28. package/dist/fonts/jetbrains-mono-400i-c.woff2 +0 -0
  29. package/dist/fonts/jetbrains-mono-400i-l.woff2 +0 -0
  30. package/dist/fonts/jetbrains-mono-600-c.woff2 +0 -0
  31. package/dist/fonts/jetbrains-mono-600-l.woff2 +0 -0
  32. package/dist/fonts/jetbrains-mono-600i-c.woff2 +0 -0
  33. package/dist/fonts/jetbrains-mono-600i-l.woff2 +0 -0
  34. package/dist/fonts/lora-400-c.woff2 +0 -0
  35. package/dist/fonts/lora-400-l.woff2 +0 -0
  36. package/dist/fonts/lora-400i-c.woff2 +0 -0
  37. package/dist/fonts/lora-400i-l.woff2 +0 -0
  38. package/dist/fonts/lora-600-c.woff2 +0 -0
  39. package/dist/fonts/lora-600-l.woff2 +0 -0
  40. package/dist/fonts/lora-600i-c.woff2 +0 -0
  41. package/dist/fonts/lora-600i-l.woff2 +0 -0
  42. package/dist/fonts/lora-700-c.woff2 +0 -0
  43. package/dist/fonts/lora-700-l.woff2 +0 -0
  44. package/dist/fonts/lora-700i-c.woff2 +0 -0
  45. package/dist/fonts/lora-700i-l.woff2 +0 -0
  46. package/dist/fonts/open-sans-300-c.woff2 +0 -0
  47. package/dist/fonts/open-sans-300-l.woff2 +0 -0
  48. package/dist/fonts/open-sans-300i-c.woff2 +0 -0
  49. package/dist/fonts/open-sans-300i-l.woff2 +0 -0
  50. package/dist/fonts/open-sans-400-c.woff2 +0 -0
  51. package/dist/fonts/open-sans-400-l.woff2 +0 -0
  52. package/dist/fonts/open-sans-400i-c.woff2 +0 -0
  53. package/dist/fonts/open-sans-400i-l.woff2 +0 -0
  54. package/dist/fonts/open-sans-600-c.woff2 +0 -0
  55. package/dist/fonts/open-sans-600-l.woff2 +0 -0
  56. package/dist/fonts/open-sans-600i-c.woff2 +0 -0
  57. package/dist/fonts/open-sans-600i-l.woff2 +0 -0
  58. package/dist/fonts/pt-sans-400-c.woff2 +0 -0
  59. package/dist/fonts/pt-sans-400-l.woff2 +0 -0
  60. package/dist/fonts/pt-sans-400i-c.woff2 +0 -0
  61. package/dist/fonts/pt-sans-400i-l.woff2 +0 -0
  62. package/dist/fonts/pt-sans-700-c.woff2 +0 -0
  63. package/dist/fonts/pt-sans-700-l.woff2 +0 -0
  64. package/dist/fonts/pt-sans-700i-c.woff2 +0 -0
  65. package/dist/fonts/pt-sans-700i-l.woff2 +0 -0
  66. package/dist/fonts/pt-serif-400-c.woff2 +0 -0
  67. package/dist/fonts/pt-serif-400-l.woff2 +0 -0
  68. package/dist/fonts/pt-serif-400i-c.woff2 +0 -0
  69. package/dist/fonts/pt-serif-400i-l.woff2 +0 -0
  70. package/dist/fonts/pt-serif-700-c.woff2 +0 -0
  71. package/dist/fonts/pt-serif-700-l.woff2 +0 -0
  72. package/dist/fonts/pt-serif-700i-c.woff2 +0 -0
  73. package/dist/fonts/pt-serif-700i-l.woff2 +0 -0
  74. package/dist/index-D6_ysSmQ.d.mts +1075 -0
  75. package/dist/index-YJcgf8Hh.d.mts +39 -0
  76. package/dist/index.d.mts +388 -0
  77. package/dist/index.mjs +641 -0
  78. package/dist/mermaid/index.d.mts +10 -0
  79. package/dist/mermaid/index.mjs +252 -0
  80. package/dist/motion/index.d.mts +8 -0
  81. package/dist/motion/index.mjs +1009 -0
  82. package/dist/pdf/index.d.mts +5 -0
  83. package/dist/pdf/index.mjs +164 -0
  84. package/dist/pdf/jbig2.wasm +0 -0
  85. package/dist/pdf/jbig2_nowasm_fallback.js +15 -0
  86. package/dist/pdf/pdf.worker.min.mjs +28 -0
  87. package/dist/styles.css +4562 -0
  88. package/package.json +99 -4
  89. package/theme.css +128 -0
@@ -0,0 +1,1075 @@
1
+ import { n as BlockRendererMap } from "./index-YJcgf8Hh.mjs";
2
+ import { ComponentType, ReactNode } from "react";
3
+ import { Block, BlockContent, BlockId, BlockType, CanvasTextAttrs, Change, ConnectorAttrs, DatabaseFilterPayload, Doc, DocMeta, Geometry, PresenceState, Selection, SelectionView, ShapeAttrs, SyncEmbedRef, SyncProvider } from "docblocks-core";
4
+ import { StoreApi } from "zustand/vanilla";
5
+ //#region src/blob-store.d.ts
6
+ /**
7
+ * The blob bridge: the library does not own storage.
8
+ *
9
+ * The bytes live where the consumer stored them (S3, disk, a CDN — the
10
+ * package does not know and does not care). The document holds only an
11
+ * opaque key, and the consumer's callbacks are the only path key →
12
+ * displayable url and file → key. Both directions carry the metadata:
13
+ * `upload` accepts a `meta` (the consumer decides the subtype), and
14
+ * `resolve` returns the key's url plus the authoritative metadata — the
15
+ * UI renders from `meta.subtype` and never guesses (an image blob stands
16
+ * an `<img>`, a pdf an iframe viewer, a file a download card).
17
+ *
18
+ * The legacy `blobResolver` prop (synchronous key → src string) wraps as
19
+ * a store: view-only (no upload), subtype "image".
20
+ */
21
+ /** The blob's media class; the consumer decides, extends additively. */
22
+ type BlobSubtype = "image" | "pdf" | "file";
23
+ /** The blob's display metadata (the consumer is the source of truth). */
24
+ interface BlobMeta {
25
+ subtype: BlobSubtype;
26
+ /** The file name (the file card's caption). */
27
+ name?: string;
28
+ /** The mime type. */
29
+ type?: string;
30
+ /** The byte size. */
31
+ size?: number;
32
+ }
33
+ /** A resolved blob: the displayable url and its authoritative metadata. */
34
+ interface BlobRef {
35
+ /** The displayable url (http(s)/data/object — the form is the consumer's). */
36
+ url: string;
37
+ meta: BlobMeta;
38
+ }
39
+ /** The consumer's blob bridge (injected via the EditorProvider `blobStore` prop). */
40
+ interface BlobStore {
41
+ /** Key → the displayable url + the authoritative metadata; rejects an unknown key. */
42
+ resolve(key: string): Promise<BlobRef>;
43
+ /** Upload: file → the opaque key (the doc holds only the key).
44
+ * The consumer may extend or override `meta` (it decides the subtype).
45
+ * Throws a typed error on the backend's refusal. */
46
+ upload(file: File | Blob, meta?: Partial<BlobMeta>): Promise<string>;
47
+ /** Optional: drop the bit (gc). Not required by the v contract. */
48
+ remove?(key: string): Promise<void>;
49
+ }
50
+ /** Derive the subtype from the file's mime (the consumer's `meta.subtype` wins). */
51
+ declare function blobSubtypeOf(file: File | Blob): BlobSubtype;
52
+ /**
53
+ * The package's default in-memory store (the consumer passes no `blobStore`):
54
+ * uploads stand data urls for the JS session, cleared on the page reload.
55
+ */
56
+ declare function createMemoryBlobStore(): BlobStore;
57
+ //#endregion
58
+ //#region src/database/bridge/errors.d.ts
59
+ /**
60
+ * The bridge's structured error: the stable machine-readable code +
61
+ * the safe message (no stack trace, SQL or tenant details) + the optional
62
+ * retry hint / the failed field's path. The transport serializes the error
63
+ * as the rejected result; `toBridgeError` normalizes an unknown rejection
64
+ * to the same shape.
65
+ */
66
+ /**
67
+ * The stable error codes. The client's rule per code group: `validation` /
68
+ * `protocol_mismatch` — show, no retry; `not_found` / `forbidden` — stop,
69
+ * clear the sensitive state; `conflict` — rebaseline and offer the retry;
70
+ * `idempotency_conflict` — no automatic retry; `idempotency_expired` /
71
+ * `operation_unknown` — rebaseline, never a new operation;
72
+ * `limit_exceeded` / `payload_too_large` — shrink the request, no retry
73
+ * unchanged; `cursor_expired` / `replay_expired` — discard the page /
74
+ * cursor and take a fresh snapshot; `transient` / `unavailable` /
75
+ * `timeout` — retry only with the same operationId; `enum.option_in_use`
76
+ * — show, no retry (the delete's default refusal; the explicit
77
+ * replacement migration is the consumer's separate operation).
78
+ */
79
+ type BridgeErrorCode = "validation" | "invalid_filter" | "invalid_operator" | "invalid_column" | "protocol_mismatch" | "limit_exceeded" | "payload_too_large" | "not_found" | "forbidden" | "conflict" | "idempotency_conflict" | "idempotency_expired" | "operation_unknown" | "cursor_expired" | "replay_expired" | "transient" | "unavailable" | "timeout" | "enum.option_in_use";
80
+ /** Every code of the set (the closed vocabulary). */
81
+ declare const BRIDGE_ERROR_CODES: readonly BridgeErrorCode[];
82
+ /** The structured bridge error (the rejection of every contract method). */
83
+ declare class BridgeError extends Error {
84
+ readonly code: BridgeErrorCode;
85
+ readonly retryAfter?: number;
86
+ readonly path?: string;
87
+ constructor(code: BridgeErrorCode, message: string, options?: {
88
+ retryAfter?: number;
89
+ path?: string;
90
+ cause?: unknown;
91
+ });
92
+ }
93
+ /** The code membership (the closed vocabulary's guard). */
94
+ declare function isBridgeErrorCode(value: unknown): value is BridgeErrorCode;
95
+ /**
96
+ * The error's guard: the class instance or the plain serialized shape
97
+ * (the wire-rehydrated `{ code, message }` object).
98
+ */
99
+ declare function isBridgeError(error: unknown): error is BridgeError;
100
+ /**
101
+ * Normalizes an unknown rejection to the contract's error. A rejection
102
+ * that carries no recognizable machine code is a transport-level failure
103
+ * (the write's outcome is unknown) and stands the `unavailable` group: the
104
+ * safe recovery is the same-operationId reconciliation, not a blind new
105
+ * operation.
106
+ */
107
+ declare function toBridgeError(error: unknown): BridgeError;
108
+ //#endregion
109
+ //#region src/database/bridge/models.d.ts
110
+ /** An opaque stable identifier (the table / row / field / operation id). */
111
+ type Id = string;
112
+ /** The consumer's revision stand (the row / column / table's version). */
113
+ type Revision = string;
114
+ /** The ISO-8601 instant (the mutation's issue time). */
115
+ type IsoInstant = string;
116
+ /** A row's cells: the field id → the stored value. `null` clears a
117
+ * nullable cell; an absent key stands "do not change"; `undefined` is
118
+ * never a stored value (it is dropped before the JSON serialization). */
119
+ type CellMap = Record<Id, unknown>;
120
+ /** The table's catalog entry (the picker / the block's reference). */
121
+ interface TableRef {
122
+ id: Id;
123
+ name: string;
124
+ revision: Revision;
125
+ /** The hidden system table (the enum's options' catalog): absent from
126
+ * `listTables`, reachable by id. */
127
+ system?: boolean;
128
+ }
129
+ /** The column's schema entry (the consumer's field registry row). */
130
+ interface Column {
131
+ id: Id;
132
+ name: string;
133
+ type: string;
134
+ /** The position in the schema order (the 0-based seat). */
135
+ position: number;
136
+ nullable: boolean;
137
+ revision: Revision;
138
+ /** The operator catalog override; the consumer's default catalog for
139
+ * the type stands when absent. */
140
+ operators?: string[];
141
+ /** The reference relation over the plain column: the cell holds the
142
+ * referenced row's stable id (an option row id for the enum, a linked
143
+ * row id for the row link); `many` = the cell holds the array. */
144
+ reference?: {
145
+ kind: "enum" | "row";
146
+ tableId: Id;
147
+ many: boolean;
148
+ /** The display column of the linked table (the row-link's stand; the
149
+ * default is the first text column / the pk). */
150
+ displayColumnId?: Id;
151
+ };
152
+ /** The number column's display attributes. */
153
+ numberDisplay?: {
154
+ decimals?: number;
155
+ thousands?: boolean;
156
+ prefix?: string;
157
+ suffix?: string;
158
+ allowNegative?: boolean;
159
+ };
160
+ }
161
+ /** The table's schema + the table reference. */
162
+ interface TableDescription {
163
+ table: TableRef;
164
+ columns: Column[];
165
+ schemaRevision: Revision;
166
+ }
167
+ /** A query operator descriptor (the value's kind the filter builder
168
+ * renders). */
169
+ interface QueryOperator {
170
+ id: string;
171
+ valueKind: "none" | "scalar" | "list";
172
+ }
173
+ /** The server's query semantics (the canonicalization stand the filter /
174
+ * sort values normalize to). */
175
+ interface QuerySemantics {
176
+ semanticsVersion: string;
177
+ collation: string;
178
+ timezone: string;
179
+ nullOrdering: "first" | "last";
180
+ operatorsByColumnType: Record<string, QueryOperator[]>;
181
+ }
182
+ /** One filter condition (the column + the operator + the value; the value
183
+ * is absent only for the valueless operators). */
184
+ interface FilterConditionInput {
185
+ columnId: Id;
186
+ op: string;
187
+ value?: unknown;
188
+ }
189
+ /** The recursive and/or filter input (the block's `filter` view state; the
190
+ * server canonicalizes and validates it against the declared operators —
191
+ * the unknown column / operator / type rejects). */
192
+ interface FilterInput {
193
+ logic: "and" | "or";
194
+ conditions: FilterConditionInput[];
195
+ groups?: FilterInput[] | null;
196
+ }
197
+ /** The sort input: the ordered sort keys (the null ordering per key). */
198
+ type SortInput = {
199
+ fieldId: Id;
200
+ direction: "asc" | "desc";
201
+ nulls?: "first" | "last";
202
+ }[];
203
+ /** The page query (the filter + the sort + the page size). */
204
+ interface PageQuery {
205
+ filter?: FilterInput;
206
+ sort?: SortInput;
207
+ limit?: number;
208
+ }
209
+ /** A wire row: the stable id + the canonical physical order key (a finite
210
+ * IEEE-754 number — never a string, NaN or infinity; the canonical total
211
+ * order is `(orderKey, rowId)`) + the revision + the cells. The page's
212
+ * row order is the array's order. */
213
+ interface RowWire {
214
+ id: Id;
215
+ orderKey: number;
216
+ revision: Revision;
217
+ cells: Record<string, unknown>;
218
+ }
219
+ /** An ordered row page: the rows in the server's order + the opaque next
220
+ * cursor (null = the last page) + the snapshot's top event boundary +
221
+ * the schema revision + the query fingerprint (the server's signed
222
+ * canonical form — the client never constructs one). */
223
+ interface RowPage {
224
+ rows: RowWire[];
225
+ nextCursor: string | null;
226
+ asOfSeq: number;
227
+ schemaRevision: Revision;
228
+ queryFingerprint: string;
229
+ }
230
+ /** The page + the query semantics. */
231
+ type PageSnapshot = RowPage & {
232
+ semantics: QuerySemantics;
233
+ };
234
+ /** The initial load: the schema and the first page from one consistent
235
+ * snapshot (the `page.asOfSeq` is the R both represent). */
236
+ type TableSnapshot = TableDescription & {
237
+ page: PageSnapshot;
238
+ };
239
+ /** The write's context: the client-issued idempotency key (a UUID, unique
240
+ * within the operation retention) + the issue time + the optional CAS
241
+ * revision (its absence selects the LWW default — the last committed
242
+ * write of the same cell wins). */
243
+ interface MutationContext {
244
+ operationId: Id;
245
+ issuedAt: IsoInstant;
246
+ expectedRevision?: Revision;
247
+ }
248
+ /** The committed mutation's receipt: the operation's ids + the commit's
249
+ * sequence + the server-normalized result + the new revisions. The outer
250
+ * commit envelope of the same operation carries the very same receipt. */
251
+ interface MutationReceipt<T> {
252
+ operationId: Id;
253
+ txId: Id;
254
+ committedSeq: number;
255
+ result: T;
256
+ revisions: Record<Id, Revision>;
257
+ }
258
+ /** The operation's status (the lost-response reconciliation: the
259
+ * committed receipt or the pending stand). */
260
+ type OperationStatus<T = unknown> = {
261
+ state: "committed";
262
+ receipt: MutationReceipt<T>;
263
+ } | {
264
+ state: "pending";
265
+ };
266
+ /** The protocol capability (the baseline set every conformant bridge
267
+ * declares; the optional sets gate the UI paths that need them). */
268
+ type ProtocolCapability = "orderedRows" | "snapshotReplay" | "idempotentWrites" | "structuredErrors" | "viewInvalidation" | "cas" | "rowRestore" | "columnRestore" | "serverSort" | "mixedBatch" | "materializedWindow";
269
+ /** The negotiated finite limits (the server enforces the filter's depth /
270
+ * terms, the page size, the batch's count, the request / frame bytes and
271
+ * the active subscriptions with `limit_exceeded` / `payload_too_large`). */
272
+ interface ProtocolLimits {
273
+ maxFilterDepth: number;
274
+ maxFilterTerms: number;
275
+ maxPageSize: number;
276
+ maxBatchOps: number;
277
+ maxRequestBytes: number;
278
+ maxFrameBytes: number;
279
+ maxSubscriptions: number;
280
+ }
281
+ /** The protocol descriptor (the version + the capabilities + the limits +
282
+ * the retention horizons). */
283
+ interface ProtocolDescriptor {
284
+ protocolVersion: 2;
285
+ capabilities: readonly ProtocolCapability[];
286
+ limits: ProtocolLimits;
287
+ operationRetentionSeconds: number;
288
+ retryHorizonSeconds: number;
289
+ }
290
+ /** The domain event (the nested record of a committed transaction's
291
+ * envelope — the nested events never carry their own seq). */
292
+ type DomainEvent = {
293
+ type: "table.created";
294
+ payload: {
295
+ table: TableDescription;
296
+ };
297
+ } | {
298
+ type: "table.renamed";
299
+ payload: {
300
+ table: TableRef;
301
+ };
302
+ } | {
303
+ type: "table.deleted";
304
+ payload: {
305
+ tableId: Id;
306
+ revision: Revision;
307
+ };
308
+ } | {
309
+ type: "field.created" | "field.updated" | "field.restored";
310
+ payload: {
311
+ column: Column;
312
+ schemaRevision: Revision;
313
+ };
314
+ } | {
315
+ type: "field.deleted";
316
+ payload: {
317
+ columnId: Id;
318
+ before: Column;
319
+ schemaRevision: Revision;
320
+ };
321
+ } | {
322
+ type: "row.created" | "row.updated" | "row.restored" | "row.moved";
323
+ payload: {
324
+ row: RowWire;
325
+ };
326
+ } | {
327
+ type: "row.deleted";
328
+ payload: {
329
+ rowId: Id;
330
+ deletedRevision: Revision;
331
+ before: RowWire;
332
+ };
333
+ } | {
334
+ type: "enum.option.renamed";
335
+ payload: {
336
+ catalogTableId: Id;
337
+ option: RowWire;
338
+ };
339
+ };
340
+ /** The committed transaction's envelope base (the per-table ordered
341
+ * stream's frame). */
342
+ interface TableEnvelopeBase {
343
+ tableId: Id;
344
+ /** The envelope's monotonic sequence (not necessarily the previous's + 1). */
345
+ seq: number;
346
+ /** The previous committed envelope's seq (null for the table's first) —
347
+ * the client detects a loss by the chain, not by the arithmetic. */
348
+ prevSeq: number | null;
349
+ txId: Id;
350
+ }
351
+ /** The per-table stream's frame: one committed transaction → one outer
352
+ * envelope → one `seq` / `prevSeq`; the `commit` kind carries the ordered
353
+ * nested domain events, the `invalidate` kind stands the explicit
354
+ * rebaseline (the server reset signal, the large rebalance). */
355
+ type TableEvent = TableEnvelopeBase & ({
356
+ kind: "commit";
357
+ /** The session id of the write's origin (the per-connection stand
358
+ * — a second tab of the same user is NOT the origin). */
359
+ originSessionId: Id;
360
+ operationId: Id;
361
+ receipt: MutationReceipt<unknown>;
362
+ events: DomainEvent[];
363
+ } | {
364
+ kind: "invalidate";
365
+ /** Present for a client mutation, null for a server reset signal. */
366
+ originSessionId: Id | null;
367
+ operationId: Id | null;
368
+ receipt: MutationReceipt<unknown> | null;
369
+ events: [];
370
+ });
371
+ /** The subscription's status (the bootstrap's phases). */
372
+ type SubscriptionStatus = "connecting" | "replaying" | "live" | "closed";
373
+ /** The subscription's observer: the readiness (the replay's cursor + the
374
+ * table's head + the protocol), the ordered at-least-once stream, the
375
+ * transport's errors, and the forced rebaseline signals. */
376
+ interface SubscriptionObserver {
377
+ /** The subscriber is registered: the replay stands the events after
378
+ * `afterSeq`, `headSeq` is the table's current head. */
379
+ ready: (value: {
380
+ afterSeq: number;
381
+ headSeq: number;
382
+ protocol: ProtocolDescriptor;
383
+ }) => void;
384
+ event: (value: TableEvent) => void;
385
+ status: (value: SubscriptionStatus) => void;
386
+ error: (error: BridgeError) => void;
387
+ /** The local page is discarded and a fresh snapshot is taken (the
388
+ * replay expired, the permission lost, the gap detected). */
389
+ reset: (value: {
390
+ code: "replay_expired" | "permission_lost" | "gap_detected";
391
+ }) => void;
392
+ }
393
+ /** The subscription's handle. */
394
+ interface SubscriptionHandle {
395
+ unsubscribe(): void;
396
+ }
397
+ /**
398
+ * A bridge column (the grid's view over the wire's `Column` — the display
399
+ * attributes flattened, the reference relation's fields in the wire's
400
+ * `reference` stand). The `type` is a standard PostgreSQL type name (or
401
+ * the consumer's own name): the contract is type-agnostic — the package
402
+ * does not validate the set; the consumer maps type → DDL and type →
403
+ * cell editor. `operators` is the consumer's operator catalog override;
404
+ * when absent, the package's default catalog for the type stands (the
405
+ * filter builders), and the query must apply exactly the declared
406
+ * operators. The `decimals` / `thousands` / `prefix` / `suffix` /
407
+ * `allowNegative` fields are the number column's display attributes (the
408
+ * column's own data — the package's number formatter reads them). The
409
+ * reference fields declare a RELATION over the plain column:
410
+ * `refKind "enum"` — the cell value is the option row id of the dict
411
+ * table (`refTableId`); `refKind "row"` — the cell value is the linked
412
+ * table's row id (`refDisplayColumn` declares which column of the linked
413
+ * table stands the display; the default is the first text column / the
414
+ * pk). `refMany` is the many cardinality (the cell value is an ARRAY of
415
+ * the option row ids / the row ids; the consumer maps the array to a
416
+ * junction table behind the row's write).
417
+ */
418
+ interface BridgeColumn {
419
+ id: string;
420
+ name: string;
421
+ type: string;
422
+ operators?: string[];
423
+ /** The reference table (the dict table for the enum options / the
424
+ * linked table for the row links). */
425
+ refTableId?: string;
426
+ /** The reference kind: "enum" (the dict table's rows are the options)
427
+ * or "row" (the cell holds the linked row's row id). */
428
+ refKind?: "enum" | "row";
429
+ /** The many cardinality (the cell value is an array). */
430
+ refMany?: boolean;
431
+ /** The display column of the linked table (the row-link display; the
432
+ * default is the first text column / the pk). */
433
+ refDisplayColumn?: string;
434
+ /** The number's digit count after the point (default 0 = integer). */
435
+ decimals?: number;
436
+ /** The thousands' separator (the space grouping: `1 000 000`). */
437
+ thousands?: boolean;
438
+ /** The display's prefix stand (e.g. the currency sign). */
439
+ prefix?: string;
440
+ /** The display's suffix stand. */
441
+ suffix?: string;
442
+ /** Whether negative values are allowed (the edit rejects them otherwise). */
443
+ allowNegative?: boolean;
444
+ }
445
+ /**
446
+ * The table description (the grid's view over the wire's
447
+ * `TableDescription`): the table's name + the grid's columns.
448
+ */
449
+ interface BridgeTableDescription {
450
+ name: string;
451
+ columns: BridgeColumn[];
452
+ }
453
+ /** The cell value input kind the annotation derives from the column type. */
454
+ type BridgeValueInput = "text" | "number" | "boolean" | "date" | "datetime" | "enum" | "row-link" | "none";
455
+ /** The column annotation the filter builder renders from. */
456
+ interface BridgeColumnAnnotation {
457
+ /** The operator catalog (the consumer's `operators` override or the package default for the type). */
458
+ operators: string[];
459
+ /** The value input kind (none = no value is taken: empty / not-empty). */
460
+ valueInput: BridgeValueInput;
461
+ /** Whether the operators take no value (empty / not-empty). */
462
+ valueless: Set<string>;
463
+ }
464
+ /**
465
+ * The parse result of a typed cell / filter value: the committed value
466
+ * (`null` for the empty string) or the validation error (the input is not
467
+ * committed — the editor keeps / reverts to the last valid value).
468
+ */
469
+ type CellValueParse = {
470
+ ok: true;
471
+ value: unknown;
472
+ } | {
473
+ ok: false;
474
+ error: string;
475
+ };
476
+ /** A batch operation (the mixed batch's element; the ordered `ops[]`
477
+ * commit as one transaction — either the whole batch or none). */
478
+ type BatchOp = {
479
+ op: "create";
480
+ row: CellMap;
481
+ beforeRowId?: Id | null;
482
+ } | {
483
+ op: "update";
484
+ rowId: Id;
485
+ cells: CellMap;
486
+ expectedRevision?: Revision;
487
+ } | {
488
+ op: "delete";
489
+ rowId: Id;
490
+ expectedRevision?: Revision;
491
+ } | {
492
+ op: "move";
493
+ rowId: Id;
494
+ beforeRowId: Id | null;
495
+ expectedRevision?: Revision;
496
+ };
497
+ /**
498
+ * The bridge contract (all methods async; a failure rejects with a
499
+ * `BridgeError`). `snapshotTable` is the sole initial read; `queryNextPage`
500
+ * only follows it over the opaque query-bound cursor. `subscribeTable` is
501
+ * the only push channel: the client takes the snapshot R first, then
502
+ * subscribes with `afterSeq: R` — the server registers the subscriber,
503
+ * replays every `seq > R` in the table's order, then continues the same
504
+ * stream live. A repeated `operationId` with the same operation body
505
+ * returns the initial committed result without a second effect; a repeated
506
+ * id with a different body rejects with `idempotency_conflict`; an id
507
+ * outside the retention rejects with `idempotency_expired` and is never
508
+ * executed again.
509
+ */
510
+ interface DatabaseBridge {
511
+ /** The protocol descriptor (the version + the capabilities + the
512
+ * limits): the client negotiates it before any use — a version /
513
+ * baseline-capability mismatch stands the `protocol_mismatch`, not a
514
+ * silent downgrade. */
515
+ describeProtocol(): Promise<ProtocolDescriptor>;
516
+ /** The visible tables (the system tables stand excluded). */
517
+ listTables(): Promise<TableRef[]>;
518
+ /** Create the table (empty — the schema stands the `createColumn`
519
+ * calls) → the committed table reference. */
520
+ createTable(input: {
521
+ name: string;
522
+ system?: boolean;
523
+ }, ctx: MutationContext): Promise<MutationReceipt<TableRef>>;
524
+ /** Rename the table (the name stands on the table, shared by every
525
+ * block that references it). */
526
+ renameTable(tableId: Id, input: {
527
+ name: string;
528
+ }, ctx: MutationContext): Promise<MutationReceipt<TableRef>>;
529
+ /** The table schema + the pk / order metadata. */
530
+ describeTable(tableId: Id): Promise<TableDescription>;
531
+ /** The sole initial load: the schema and the first page from one
532
+ * consistent snapshot (the `page.asOfSeq` is the R both represent). */
533
+ snapshotTable(tableId: Id, query: PageQuery): Promise<TableSnapshot>;
534
+ /** The next page over the opaque keyset cursor (the cursor is signed
535
+ * and bound to its table, its snapshot R and its normalized query);
536
+ * any commit that advanced the table's public head after R rejects
537
+ * with `cursor_expired` — the client takes a fresh `snapshotTable`. */
538
+ queryNextPage(tableId: Id, input: {
539
+ cursor: string;
540
+ asOfSeq: number;
541
+ queryFingerprint: string;
542
+ }): Promise<PageSnapshot>;
543
+ /** Add a column (after `afterColumnId`, or at the end). */
544
+ createColumn(tableId: Id, input: {
545
+ column: Omit<Column, "id" | "revision">;
546
+ afterColumnId?: Id;
547
+ }, ctx: MutationContext): Promise<MutationReceipt<Column>>;
548
+ /** Patch the column's attributes (the rename stands the `name` key —
549
+ * the name is an attribute). */
550
+ updateColumn(tableId: Id, columnId: Id, patch: Partial<Omit<Column, "id" | "revision">>, ctx: MutationContext): Promise<MutationReceipt<Column>>;
551
+ /** Remove a column. The consumer MAY stand the soft-delete posture
552
+ * (the definition, the position and the cell values stay preserved,
553
+ * the removal restorable over `restoreDeletedColumn`); the destructing
554
+ * posture stands the removal not undoable. */
555
+ deleteColumn(tableId: Id, columnId: Id, ctx: MutationContext): Promise<MutationReceipt<{
556
+ columnId: Id;
557
+ }>>;
558
+ /** Restore the soft-deleted column — its schema, its position and the
559
+ * preserved cell values; the no-op when the column stands in the
560
+ * schema again. */
561
+ restoreDeletedColumn(tableId: Id, columnId: Id, ctx: MutationContext): Promise<MutationReceipt<Column>>;
562
+ /** The row displays for the row-link cells (the join stands in the
563
+ * consumer backend; the missing / deleted target stands `null` — no
564
+ * data of the absent target is revealed). */
565
+ resolveRowDisplay(tableId: Id, input: {
566
+ rowIds: Id[];
567
+ displayColumn?: Id;
568
+ }): Promise<Record<Id, string | null>>;
569
+ /** The atomic mixed batch: the ordered `ops[]` commit as one
570
+ * transaction (either the whole batch or none); the failure stands the
571
+ * first unexecutable operation's index and code and publishes no
572
+ * partial envelope. The receipt's `rows` stand the CREATED rows over
573
+ * the create op's order (the moved / updated / deleted rows stand the
574
+ * envelope's events + the `revisions`, not the `rows`). */
575
+ batchRows(tableId: Id, input: {
576
+ ops: BatchOp[];
577
+ }, ctx: MutationContext): Promise<MutationReceipt<{
578
+ rows: RowWire[];
579
+ }>>;
580
+ /** Restore the soft-deleted rows: one atomic operation, independent of
581
+ * the input id order (the rows keep their saved order); the row past
582
+ * its physical GC stands the safe `not_found`. */
583
+ undeleteRows(tableId: Id, input: {
584
+ rowIds: Id[];
585
+ }, ctx: MutationContext): Promise<MutationReceipt<{
586
+ rows: RowWire[];
587
+ }>>;
588
+ /** The push channel (the consumer's transport): the bootstrap's
589
+ * subscriber (the `afterSeq` replay cursor), the ordered at-least-once
590
+ * per-table stream, and the unsubscribe. */
591
+ subscribeTable(tableId: Id, input: {
592
+ afterSeq: number;
593
+ }, observer: SubscriptionObserver): SubscriptionHandle;
594
+ /** The operation's status (the lost-response reconciliation): the
595
+ * committed receipt, the pending stand, or the `operation_unknown`
596
+ * rejection (an unknown id is never a new mutation). */
597
+ getOperationStatus(operationId: Id): Promise<OperationStatus>;
598
+ }
599
+ //#endregion
600
+ //#region src/database/grid/use-ref-tables.d.ts
601
+ /** The loaded ref-table data: the row ids in the row order + the row
602
+ * displays (rowId → the display text) + the option colors (rowId → the
603
+ * `color` column's hex — the absent value stands none). */
604
+ interface RefTableData {
605
+ rowIds: string[];
606
+ displays: Record<string, string>;
607
+ colors: Record<string, string>;
608
+ }
609
+ /** The ref-table data keyed by the entry's key (`refEntryKey`). */
610
+ type RefTableDataMap = Record<string, RefTableData>;
611
+ //#endregion
612
+ //#region src/database/filter-builder/FilterBuilder.d.ts
613
+ interface FilterBuilderProps {
614
+ /** The payload being edited; null = the empty filter. */
615
+ value: DatabaseFilterPayload | null;
616
+ /** The columns (the annotation source). */
617
+ columns: BridgeColumn[];
618
+ /** The draft change (the parent keeps the draft until Apply). */
619
+ onChange: (payload: DatabaseFilterPayload) => void;
620
+ /** The ref tables' data (the enum's dict options + the row-link's row
621
+ * displays — the ref value inputs render from it). */
622
+ refTableData?: RefTableDataMap;
623
+ }
624
+ declare function FilterBuilder({ value, columns, onChange, refTableData }: FilterBuilderProps): import("react").JSX.Element;
625
+ //#endregion
626
+ //#region src/database/filter-builder/utils.d.ts
627
+ /** The empty filter payload (the "no filter" shape the Clear writes). */
628
+ declare function emptyFilter(): DatabaseFilterPayload;
629
+ /** Whether the payload is applicable: every condition that needs a value
630
+ * has one (an empty value = the condition is inapplicable). */
631
+ declare function filterIsComplete(payload: DatabaseFilterPayload | null, columns: BridgeColumn[]): boolean;
632
+ //#endregion
633
+ //#region src/database/use-database-table/models.d.ts
634
+ /** One loaded row: the row id (the pk value) + the cells. */
635
+ interface DatabaseTableRow {
636
+ rowId: string;
637
+ cells: Record<string, unknown>;
638
+ }
639
+ type DatabaseTablePhase = "loading" | "ready" | "broken";
640
+ /** The public result of the hook (the grid renderer + the consumer UI read from it). */
641
+ interface UseDatabaseTable {
642
+ phase: DatabaseTablePhase;
643
+ /** The table description (the schema); null while loading / broken. */
644
+ table: BridgeTableDescription | null;
645
+ /** The loaded rows in the row order. */
646
+ rows: DatabaseTableRow[];
647
+ /** The row's live revision (the CAS's stand — the draft session's open
648
+ * pin reads it at the session's open). */
649
+ revisionOf(rowId: string): Revision | undefined;
650
+ /** The cursor of the next page; null = the last page is loaded. */
651
+ nextCursor: string | null;
652
+ /** The last operation error (the transient display); cleared on the next load. */
653
+ error: string | null;
654
+ /** The last operation's structured error code (null = no error, or the
655
+ * failure carried no machine code). */
656
+ errorCode: BridgeErrorCode | null;
657
+ /** The negotiated protocol capabilities (the optional paths' gate — the
658
+ * row / column restore, the CAS, the server sort stands). */
659
+ capabilities: readonly ProtocolCapability[];
660
+ insertRow(cells?: Record<string, unknown>): Promise<string>;
661
+ /** The row's write: the pinned revision (the cell's draft session's
662
+ * open stand) selects the compare-and-swap over it; its absence stands
663
+ * the live revision (the LWW's default). */
664
+ updateRow(rowId: string, cells: Record<string, unknown>, expectedRevision?: Revision): Promise<void>;
665
+ /** The batch update: ONE commit (the one bridge call + the one undo
666
+ * entry — the inverse restores every touched row over the one undo,
667
+ * so the multi-row clear stands back over a single undo press). */
668
+ updateRows(updates: Array<{
669
+ rowId: string;
670
+ cells: Record<string, unknown>;
671
+ }>): Promise<void>;
672
+ /** The mixed paste (the spec's paste batch): the visible rows' updates
673
+ * (from the active row down) + the overflow's creates — ONE `batchRows`
674
+ * (one transaction, one undo entry; the inverse = the updates' restore
675
+ * + the created rows' deletion). The updates stand the optimistic
676
+ * apply; the creates stand over the post-commit refresh. Returns the
677
+ * created rows' ids. */
678
+ pasteRows(input: {
679
+ updates: Array<{
680
+ rowId: string;
681
+ cells: Record<string, unknown>;
682
+ }>;
683
+ creates: Array<Record<string, unknown>>;
684
+ /** The created rows' seat: the visible successor of the last updated
685
+ * row (null = the table's tail). */
686
+ beforeRowId: string | null;
687
+ }): Promise<string[]>;
688
+ removeRow(rowId: string): Promise<void>;
689
+ moveRow(rowId: string, beforeRowId: string | null): Promise<void>;
690
+ /** Creates the column over the bridge → the bridge-assigned column id
691
+ * (the view state the caller appends to the block's `columnOrder`). */
692
+ addColumn(column: BridgeColumn, afterColumnId?: string): Promise<string>;
693
+ updateColumn(columnId: string, patch: Partial<Omit<BridgeColumn, "id" | "name">>): Promise<void>;
694
+ deleteColumn(columnId: string): Promise<void>;
695
+ renameColumn(columnId: string, name: string): Promise<void>;
696
+ /** Renames the table (the bridge's attribute — every block over the
697
+ * tableId stands the new name over the table event). */
698
+ renameTable(name: string): Promise<void>;
699
+ /** Loads the next page (the `nextCursor` continuation). */
700
+ loadMore(): Promise<void>;
701
+ /** Reloads from the bridge (the broken-state retry). */
702
+ retry(): void;
703
+ /** The forward-only undo (the inverse operation via the bridge). */
704
+ undo(): Promise<void>;
705
+ /** The forward-only redo. */
706
+ redo(): Promise<void>;
707
+ canUndo: boolean;
708
+ canRedo: boolean;
709
+ }
710
+ //#endregion
711
+ //#region src/database/use-database-table/use-database-table.d.ts
712
+ /**
713
+ * The external-form data provider for one `tableId` (per block
714
+ * instance: each block has its own row store and its own undo stack, even
715
+ * when several blocks reference the same table). The `filter` stands the
716
+ * block's view state (the block's `filter` attr's payload — the contract
717
+ * filter's input shape).
718
+ */
719
+ declare function useDatabaseTable(bridge: DatabaseBridge, tableId: string, filter?: DatabaseFilterPayload): UseDatabaseTable;
720
+ //#endregion
721
+ //#region src/canvas/clipboard.d.ts
722
+ /** The one copied canvas item (the deep data; the ids stand the originals). */
723
+ type ClipboardItem = {
724
+ type: "shape";
725
+ attrs?: ShapeAttrs;
726
+ geometry?: Geometry;
727
+ } | {
728
+ type: "connector";
729
+ attrs: ConnectorAttrs;
730
+ geometry?: Geometry;
731
+ } | {
732
+ type: "canvas-text";
733
+ attrs?: CanvasTextAttrs;
734
+ content?: BlockContent;
735
+ geometry?: Geometry;
736
+ } | {
737
+ type: "group";
738
+ attrs: {
739
+ members: BlockId[];
740
+ title?: string;
741
+ };
742
+ geometry?: Geometry;
743
+ };
744
+ /** The deep copy of the copied canvas items (the ids stand the originals). */
745
+ interface CanvasClipboard {
746
+ /** The copied items with the original ids (top-level + the containers' transitive members). */
747
+ entries: {
748
+ id: BlockId;
749
+ item: ClipboardItem;
750
+ }[];
751
+ /** The top-level ids (the selection order) — the paste's selection stand. */
752
+ ids: BlockId[];
753
+ }
754
+ //#endregion
755
+ //#region src/state/models.d.ts
756
+ /**
757
+ * Per-instance editor state: a projection of one docblocks-core Doc.
758
+ *
759
+ * The store is never the source of truth — writes go command -> Doc ->
760
+ * onChange -> applyChange. Slice references are stable across changes a
761
+ * slice is not involved in, so a component selecting one block re-renders
762
+ * only when that block actually changed.
763
+ */
764
+ interface EditorState {
765
+ /** Block snapshots keyed by id; a block keeps its reference while its JSON is unchanged. */
766
+ blocks: Record<BlockId, Block>;
767
+ /**
768
+ * The entry-list block ids: the document root's children (the page
769
+ * sequence), or the subtree entry's derived segment (the subtree root
770
+ * and its deeper followers — re-derived only when the change can affect
771
+ * it, see `applyChange`'s invalidation: a peer or a local insert into
772
+ * the segment grows it without touching the subtree root itself).
773
+ */
774
+ rootChildren: BlockId[];
775
+ /** Document meta; replaced only when the title changed. */
776
+ meta: DocMeta;
777
+ /**
778
+ * The sequence-structure stamp: bumped only when the entry sequence's
779
+ * structure changes (a rootChildren change, or a sequence block's
780
+ * `indent` / `list` kind changing) — never on a text/mark change of an
781
+ * unchanged structure. The motion view's row derivation keys on it, so a
782
+ * text-only edit re-renders the edited row through its own subscription
783
+ * only (the origin is irrelevant — every change flows through
784
+ * `applyChange`).
785
+ */
786
+ seqStamp: number;
787
+ /** Local view selection; a separate slice so caret moves never re-render blocks. */
788
+ selection: Selection;
789
+ /**
790
+ * The collapsed block ids (the derived segment's rows are hidden). Local
791
+ * view state — never document data, no wire traffic; a separate slice,
792
+ * reset on remount.
793
+ */
794
+ collapsedIds: BlockId[];
795
+ /** Remote peers' ephemeral state; a separate slice for the same reason. */
796
+ presence: PresenceState[];
797
+ /**
798
+ * The canvas clipboard: the deep copy of
799
+ * the copied canvas items — the view state per editor (not doc data, no
800
+ * wire); `null` when empty. A separate slice so the copy never re-renders
801
+ * blocks.
802
+ */
803
+ canvasClipboard: CanvasClipboard | null;
804
+ }
805
+ /** Internal write functions, called by the EditorProvider subscriptions. */
806
+ interface EditorActions {
807
+ /** Re-reads the blocks a doc change touched, keeping stable references for the unchanged ones. */
808
+ applyChange: (change: Change) => void;
809
+ /** Replaces the presence slice. */
810
+ setPresence: (peers: PresenceState[]) => void;
811
+ /** Replaces the selection slice. */
812
+ setSelection: (selection: Selection) => void;
813
+ /** Sets the collapsed state of one list item (view state, no doc command). */
814
+ setCollapsed: (id: BlockId, collapsed: boolean) => void;
815
+ /** Replaces the canvas clipboard slice (the copy / the clear). */
816
+ setCanvasClipboard: (clipboard: CanvasClipboard | null) => void;
817
+ }
818
+ /** The per-instance vanilla store created by `createEditorStore`. */
819
+ type EditorStore = StoreApi<EditorState & EditorActions>;
820
+ //#endregion
821
+ //#region src/editor-provider/models.d.ts
822
+ /**
823
+ * Resolves a sync-embed ref to the master doc the consumer holds; null when
824
+ * the master is unknown to the consumer (the block renders its broken state).
825
+ */
826
+ type SyncEmbedResolver = (ref: SyncEmbedRef) => Doc | null;
827
+ /** The embed sandbox policy: the iframe's `sandbox` value for a given embed
828
+ * src; `null` stands no sandbox (a fully trusted embed, the old behavior). */
829
+ type EmbedSandboxPolicy = (src: string) => string | null;
830
+ /** The props a PDF first-page preview renderer receives (the `pdfPreview` provider prop). */
831
+ interface PdfPreviewProps {
832
+ /** The block's id — the renderer stamps it on its root, like the other block renderers. */
833
+ id: BlockId;
834
+ /** The resolved blob url (the store's resolve result). */
835
+ url: string;
836
+ /** The blob's display name (absent when the store has none). */
837
+ name?: string;
838
+ }
839
+ /** A PDF first-page preview renderer: a component over a resolved `pdf` blob. */
840
+ type PdfPreview = ComponentType<PdfPreviewProps>;
841
+ /** A mention search result: the stable target id + the display label. */
842
+ interface MentionEntry {
843
+ id: string;
844
+ label: string;
845
+ }
846
+ /**
847
+ * The consumer's mention search provider: the user / document catalog behind
848
+ * the `@` mention trigger. The two sections are separate so the picker can
849
+ * stand "People" and "Documents" groups; a `kind` is derived from the
850
+ * section on the pick (`user` / `doc`).
851
+ */
852
+ interface MentionProvider {
853
+ /** The users matching the query (the `user` mention kind). */
854
+ searchUsers(query: string): Promise<MentionEntry[]>;
855
+ /** The documents matching the query (the `doc` mention kind). */
856
+ searchDocs(query: string): Promise<MentionEntry[]>;
857
+ }
858
+ /** The per-instance selection view; null before the mount effect ran and after unmount. */
859
+ interface SelectionRef {
860
+ view: SelectionView | null;
861
+ }
862
+ /** The consumer's user access level: the available document modes. "viewer" is locked to the published's view (the current state is never rendered); "editor" (the default) may edit and view. Session state — not document data, never on the wire. */
863
+ type AccessLevel = "viewer" | "editor";
864
+ /** The document's mode (consumer-controlled view state, like the page/canvas `view`): "edit" (the default) is the live document editable; "view" is the live document read-only (the current state, still syncing); "published" is the `publishedDoc`'s snapshot read-only (static). */
865
+ type EditorMode = "edit" | "view" | "published";
866
+ /** Per-instance editor context: the store, the doc, the selection handle, and the customization values. */
867
+ interface EditorContextValue {
868
+ store: EditorStore;
869
+ doc: Doc;
870
+ selection: SelectionRef;
871
+ /** Consumer renderers by block type; empty when none were supplied. */
872
+ renderers: BlockRendererMap;
873
+ /** The effective blob bridge (the consumer's store, the legacy resolver
874
+ * wrapped, or the shared default in-memory store) — always present. */
875
+ blobStore: BlobStore;
876
+ /** The effective database bridge (the consumer's implementation);
877
+ * undefined when none was supplied — the external-form database blocks
878
+ * render the disconnected placeholder. */
879
+ databaseBridge: DatabaseBridge | undefined;
880
+ /** The sync-embed master-doc resolver; null when none was supplied. */
881
+ syncEmbedResolver: SyncEmbedResolver | null;
882
+ /** The consumer's PDF first-page preview renderer; null when none was supplied (the native iframe stands). */
883
+ pdfPreview: PdfPreview | null;
884
+ /** The consumer's mention search provider; null when none was supplied (`@` stays plain text). */
885
+ mentionProvider: MentionProvider | null;
886
+ /** The effective embed sandbox policy (the consumer's, or the safe default) — always present. */
887
+ embedSandbox: EmbedSandboxPolicy;
888
+ /** The entry-list root: the document root by default, a subtree block otherwise. */
889
+ rootBlockId: BlockId;
890
+ /** The enclosing providers' doc ids, outermost first (the sync-embed cycle visited-set). */
891
+ ancestorDocIds: readonly string[];
892
+ /** The number of enclosing editor renders (the sync-embed cycle depth bound). */
893
+ embedDepth: number;
894
+ /** The empty-block hint text (the default points at the slash command palette). */
895
+ commandPalettePlaceholder: string;
896
+ /** The consumer's access level (the effective stand: the own prop, else the enclosing one, else "editor"). */
897
+ accessLevel: AccessLevel;
898
+ /** The effective document mode (resolved: a viewer stands "published" over any stand; a nested provider without its own `mode` inherits the enclosing one). */
899
+ mode: EditorMode;
900
+ /** True over the non-edit modes ("view" / "published"): every editing surface gates off (the read-only stand). */
901
+ viewMode: boolean;
902
+ }
903
+ interface EditorProviderProps {
904
+ /**
905
+ * The headless document to render and edit; must not change after mount.
906
+ * Required over the editor's stand. Over the `viewer`'s stand the doc IS
907
+ * the published snapshot — the consumer passes only the stand the reader
908
+ * may see (the live document never reaches the reader's browser); an
909
+ * absent stand over the viewer renders the not-published placeholder.
910
+ */
911
+ doc?: Doc;
912
+ /**
913
+ * Optional user access level: "viewer" locks the render to the
914
+ * published's view (the `mode`'s stand is ignored — the current state is
915
+ * never rendered for a reader); "editor" (the default) may edit and
916
+ * view. Over the viewer's stand the `doc` is the published snapshot and
917
+ * the `publishedDoc` prop is not consulted (the doc IS the snapshot).
918
+ * Session state supplied by the consumer — never document data.
919
+ */
920
+ accessLevel?: AccessLevel;
921
+ /**
922
+ * Optional document mode (consumer-controlled, like the page/canvas
923
+ * `view`): "edit" (the default) renders the live document editable,
924
+ * "view" renders it read-only (the current state, the doc keeps
925
+ * syncing), "published" renders the `publishedDoc`'s snapshot read-only.
926
+ * A viewer stands "published" over every stand. A nested provider
927
+ * without its own `mode` inherits the enclosing one.
928
+ */
929
+ mode?: EditorMode;
930
+ /**
931
+ * Optional published snapshot (a hydrated `Doc`, the consumer's
932
+ * `loadDoc` / `fromJSON` over its own stored state): rendered
933
+ * read-only over the "published" mode (a static stand — no sync
934
+ * transport). Must not change after mount (like `doc`): a new
935
+ * snapshot is a consumer remount over a `key` change.
936
+ */
937
+ publishedDoc?: Doc | null;
938
+ /** Optional sync transport for presence (awareness); the doc's own changes are always tracked. */
939
+ provider?: SyncProvider;
940
+ /**
941
+ * Optional per-instance block renderers: a consumer renderer for a type
942
+ * replaces the built-in one (view-layer customization). Replacing a
943
+ * text-editable type replaces the whole block view, including its
944
+ * editing affordance; a renderer that needs editing drives the core
945
+ * commands through the hooks. Pass a stable reference for the map
946
+ * (module-level or memoized): it is read into the provider context per
947
+ * render, so a fresh inline object would churn the context value and
948
+ * re-render every context consumer.
949
+ */
950
+ blockRenderers?: BlockRendererMap;
951
+ /**
952
+ * Optional resolver of an image's blob key to an img src; without it the
953
+ * image renders a placeholder.
954
+ *
955
+ * Like `blockRenderers`, the value is read per render into the provider
956
+ * context: pass a stable reference (module-level or memoized) so the
957
+ * context does not churn on every provider render.
958
+ */
959
+ blobResolver?: (key: string) => string;
960
+ /**
961
+ * Optional blob bridge: resolves a blob key to its displayable url and
962
+ * metadata, and uploads a file to a new key (the slash Image path and
963
+ * the future attachment blocks write the key only after the upload
964
+ * resolved). Without it — and without `blobResolver` — the editor uses
965
+ * the shared default in-memory store (uploads stand data urls for the
966
+ * JS session; a page reload clears them), so the upload path works
967
+ * out of the box.
968
+ *
969
+ * Like `blobResolver`, the value is read per render into the provider
970
+ * context: pass a stable reference. A nested provider that supplies
971
+ * none inherits the enclosing store.
972
+ */
973
+ blobStore?: BlobStore;
974
+ /**
975
+ * Optional database bridge: the consumer's implementation of the table
976
+ * operations behind the external-form database blocks (the document
977
+ * keeps only the `tableId` reference; the schema and the rows live in
978
+ * the consumer's database). Without it the external-form blocks render
979
+ * the disconnected placeholder (the inline form stands unchanged — its
980
+ * data is the document's own).
981
+ *
982
+ * Like `blobStore`, the value is read per render into the provider
983
+ * context: pass a stable reference. A nested provider that supplies
984
+ * none inherits the enclosing bridge.
985
+ */
986
+ databaseBridge?: DatabaseBridge;
987
+ /**
988
+ * Optional resolver of a sync-embed's ref to the master Doc (the consumer
989
+ * holds the master in its own store); without it the built-in renderer
990
+ * renders the broken state for every sync-embed.
991
+ *
992
+ * The value is read per render into the provider context (like
993
+ * `blockRenderers`): pass a stable reference. A provider nested inside
994
+ * another inherits the enclosing resolver when it supplies none (a
995
+ * sync-embed inside a rendered master must resolve too).
996
+ */
997
+ syncEmbedResolver?: SyncEmbedResolver;
998
+ /**
999
+ * Optional PDF first-page preview renderer: a component that renders a
1000
+ * `pdf`-subtype image block's resolved blob as a client-side first-page
1001
+ * preview (the `./pdf` subpath provides one over pdfjs-dist, an optional
1002
+ * peer). Without it the block stands the native iframe viewer.
1003
+ *
1004
+ * Like `blockRenderers`, the value is read per render into the provider
1005
+ * context: pass a stable reference (the component is module-level). A
1006
+ * nested provider that supplies none inherits the enclosing one.
1007
+ */
1008
+ pdfPreview?: PdfPreview;
1009
+ /**
1010
+ * Optional mention search provider: the user / document catalog behind the
1011
+ * `@` mention trigger in page text blocks. Without it the `@` stays plain
1012
+ * text (no picker). Like `pdfPreview`, the value is read per render into
1013
+ * the provider context: pass a stable reference. A nested provider that
1014
+ * supplies none inherits the enclosing one.
1015
+ */
1016
+ mentionProvider?: MentionProvider;
1017
+ /**
1018
+ * Optional embed sandbox policy: the iframe's `sandbox` value for a given
1019
+ * embed src; `null` stands no sandbox (a fully trusted embed). Without it
1020
+ * the safe default applies (`DEFAULT_EMBED_SANDBOX` — interactive but no
1021
+ * `allow-same-origin`, so the embedded content cannot read the parent's DOM
1022
+ * / state). Grant `allow-same-origin` only for trusted origins.
1023
+ *
1024
+ * Like `pdfPreview`, the value is read per render into the provider
1025
+ * context: pass a stable reference. A nested provider that supplies none
1026
+ * inherits the enclosing policy.
1027
+ */
1028
+ embedSandbox?: EmbedSandboxPolicy;
1029
+ /**
1030
+ * Optional entry-list root: render the entry list of this block instead
1031
+ * of the document root (the subtree view — the block itself plus its own
1032
+ * subtree). Defaults to the document root: behavior unchanged.
1033
+ *
1034
+ * Like `doc`, the value must not change after mount.
1035
+ */
1036
+ rootBlockId?: BlockId;
1037
+ /**
1038
+ * The command palette placeholder hint text, shown while the caret sits
1039
+ * in a text block with no content; defaults to "Type '/' for commands"
1040
+ * (`COMMAND_PALETTE_PLACEHOLDER`). A nested provider that supplies none
1041
+ * inherits the enclosing value, like the resolvers.
1042
+ */
1043
+ commandPalettePlaceholder?: string;
1044
+ children: ReactNode;
1045
+ }
1046
+ //#endregion
1047
+ //#region src/editor-provider/EditorProvider.d.ts
1048
+ /**
1049
+ * The provider's entry: resolves the viewer's top-level stand before the
1050
+ * stand's hooks (the security stand — the reader's browser never holds the
1051
+ * live document: over the `viewer`'s level the `doc` is the published
1052
+ * snapshot, the only stand the consumer passes, and an absent stand stands
1053
+ * the not-published placeholder — the document was never published). The
1054
+ * editor's stand requires the doc (an explicit throw over the absent
1055
+ * stand).
1056
+ */
1057
+ declare function EditorProvider(props: EditorProviderProps): import("react").JSX.Element;
1058
+ //#endregion
1059
+ //#region src/editor-provider/constants.d.ts
1060
+ /**
1061
+ * The safe embed sandbox (the default when no `embedSandbox` policy is
1062
+ * supplied): the embedded content stands an opaque origin (no
1063
+ * `allow-same-origin`), so it cannot read the parent's DOM, cookies, or state;
1064
+ * scripts, forms, and popups still run, so interactive embeds keep working.
1065
+ * Grant `allow-same-origin` — and `allow-scripts` together with it — only for
1066
+ * trusted origins via the `embedSandbox` policy: that combination lets the
1067
+ * frame lift its own sandbox.
1068
+ */
1069
+ declare const DEFAULT_EMBED_SANDBOX = "allow-scripts allow-forms allow-popups";
1070
+ //#endregion
1071
+ //#region src/editor-provider/context.d.ts
1072
+ /** Read the per-instance editor context; throws outside an EditorProvider. */
1073
+ declare function useEditorContext(): EditorContextValue;
1074
+ //#endregion
1075
+ export { TableEnvelopeBase as $, DomainEvent as A, ProtocolCapability as B, BridgeColumnAnnotation as C, CellValueParse as D, CellMap as E, MutationContext as F, Revision as G, ProtocolLimits as H, MutationReceipt as I, SortInput as J, RowPage as K, OperationStatus as L, FilterInput as M, Id as N, Column as O, IsoInstant as P, TableDescription as Q, PageQuery as R, BridgeColumn as S, BridgeValueInput as T, QueryOperator as U, ProtocolDescriptor as V, QuerySemantics as W, SubscriptionObserver as X, SubscriptionHandle as Y, SubscriptionStatus as Z, UseDatabaseTable as _, EditorContextValue as a, BridgeErrorCode as at, FilterBuilder as b, EmbedSandboxPolicy as c, toBridgeError as ct, PdfPreview as d, BlobStore as dt, TableEvent as et, PdfPreviewProps as f, BlobSubtype as ft, DatabaseTableRow as g, DatabaseTablePhase as h, AccessLevel as i, BridgeError as it, FilterConditionInput as j, DatabaseBridge as k, MentionEntry as l, BlobMeta as lt, useDatabaseTable as m, createMemoryBlobStore as mt, DEFAULT_EMBED_SANDBOX as n, TableSnapshot as nt, EditorMode as o, isBridgeError as ot, SyncEmbedResolver as p, blobSubtypeOf as pt, RowWire as q, EditorProvider as r, BRIDGE_ERROR_CODES as rt, EditorProviderProps as s, isBridgeErrorCode as st, useEditorContext as t, TableRef as tt, MentionProvider as u, BlobRef as ut, emptyFilter as v, BridgeTableDescription as w, BatchOp as x, filterIsComplete as y, PageSnapshot as z };