plitejs 54.0.0-beta.6 → 54.0.0-beta.8

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 (61) hide show
  1. package/README.md +4 -4
  2. package/dist/authored/index.d.ts +67 -47
  3. package/dist/authored/index.js +7640 -4563
  4. package/dist/{authored-veto-BsBDXC0b.js → authored-veto-DLmBMIcy.js} +1 -1
  5. package/dist/clipboard-format-key-SzffxWqa.js +14 -0
  6. package/dist/{comparison-plan-IOewH50q.js → comparison-plan-BqFJWjO4.js} +142 -14
  7. package/dist/{create-editor-DRRzGwaC.js → create-editor-kU8fg-PF.js} +30 -78
  8. package/dist/diff/index.d.ts +2 -32
  9. package/dist/diff/index.js +92 -372
  10. package/dist/dom/index.d.ts +3 -2
  11. package/dist/dom/index.js +3 -2
  12. package/dist/{dom-CVYV5Qd5.js → dom-SUWlnfT9.js} +1052 -261
  13. package/dist/history/index.d.ts +5 -5
  14. package/dist/history/index.js +3237 -2096
  15. package/dist/history-skip-CcEhIzak.js +35 -0
  16. package/dist/hyperscript/index.d.ts +1 -1
  17. package/dist/hyperscript/index.js +1 -1
  18. package/dist/{hyperscript-CT6hhnAY.js → hyperscript-DdeGYoSc.js} +3 -2
  19. package/dist/{index-PDROnF1G.d.ts → index-4PpawhYe.d.ts} +1 -1
  20. package/dist/{index-VZrKWWeh.d.ts → index-BsOySJwr.d.ts} +86 -203
  21. package/dist/{index-D7-n2GCk.d.ts → index-CHEKdrHP.d.ts} +32 -24
  22. package/dist/{comparison-types-DBQFu7Rt.d.ts → index-DM-b6jEe.d.ts} +21 -57
  23. package/dist/{index-BT7D4vtf.d.ts → index-DqmhcD_0.d.ts} +1 -5
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +5 -4
  26. package/dist/internal/index.d.ts +2 -2
  27. package/dist/internal/index.js +66 -5
  28. package/dist/law-check-Bvnz2EKh.js +19271 -0
  29. package/dist/pagination/index.d.ts +1 -1
  30. package/dist/pagination/index.js +1 -1
  31. package/dist/pagination/react.d.ts +14 -11
  32. package/dist/pagination/react.js +237 -144
  33. package/dist/{pagination-Cs5ka6hW.js → pagination-XEnxZ1DX.js} +2 -1
  34. package/dist/{plugin-Bm6nsPHh.js → plugin-B8uCi-Hr.js} +17196 -22475
  35. package/dist/{range-geometry-DO-kbNrb.d.ts → range-geometry-B2f67yLv.d.ts} +1 -1
  36. package/dist/{range-geometry-D1XfYWs0.js → range-geometry-BGKYQHqO.js} +3 -2
  37. package/dist/react/index.d.ts +4 -5
  38. package/dist/react/index.js +8 -7
  39. package/dist/react/virtualized.d.ts +5 -5
  40. package/dist/react/virtualized.js +69 -43
  41. package/dist/{react-BYtwRr4v.js → react-B6B-5z7t.js} +141 -171
  42. package/dist/{retraction-DnEUo8oE.js → retraction-BMzQ2on5.js} +2 -18
  43. package/dist/scroll-root-DudA40xj.js +25 -0
  44. package/dist/{src-DIQDddmh.js → src--BZ7fZY4.js} +183 -64
  45. package/dist/testing/index.d.ts +2 -2
  46. package/dist/testing/index.js +4 -3
  47. package/dist/{index-DHt8nZQ6.d.ts → tx-only-D8lpB-sT.d.ts} +9246 -8660
  48. package/dist/{editor-owner-CGj1wYCa.js → update-policy-J-4sHmrg.js} +54 -2
  49. package/dist/{use-editor-dom-scope-hT7W9d-p.js → use-editor-dom-scope-BFWvutxn.js} +18267 -15917
  50. package/dist/yjs/index.d.ts +1 -1
  51. package/dist/yjs/index.js +1 -1
  52. package/dist/yjs/react/index.d.ts +3 -3
  53. package/dist/yjs/react/index.js +3 -3
  54. package/dist/{yjs-C_g9gZwI.js → yjs-DPngKQWQ.js} +420 -164
  55. package/package.json +2 -9
  56. package/dist/annotation-store-metrics-Ccjkef45.js +0 -12
  57. package/dist/annotations/index.d.ts +0 -2
  58. package/dist/annotations/index.js +0 -2
  59. package/dist/index-BvQzYVAW.d.ts +0 -71
  60. package/dist/mapped-view-store-CBk2-bDR.js +0 -120
  61. package/dist/store-BLYxJgOU.js +0 -747
package/README.md CHANGED
@@ -14,7 +14,7 @@ const editor = createEditor({
14
14
 
15
15
  Use `isEditor` when library code needs to validate an unknown value before treating it as an editor.
16
16
 
17
- Use `createEditorView(editor, options)` when framework packages need a root-scoped view over a committed editor. React components use `useEditor` from `plitejs/react`.
17
+ Use `createEditorView(editor, options)` when framework packages need a root-scoped view over a committed editor. React components create an editor with `useCreateEditor` and read the active editor with `useEditor` from `plitejs/react`.
18
18
 
19
19
  Read committed state with `editor.read(...)`. Use direct read methods for one-shot reads and the callback form when several reads must share one state view.
20
20
 
@@ -69,7 +69,7 @@ import { definePlugin, defineEffect } from 'plitejs';
69
69
 
70
70
  const refreshIndex = defineEffect({ key: 'search.refresh-index' });
71
71
 
72
- const searchEffects = definePlugin('search-effects', {
72
+ const searchEffects = definePlugin('searchEffects', {
73
73
  effectTypes: [refreshIndex],
74
74
  });
75
75
  ```
@@ -78,6 +78,6 @@ Advanced library code can install descriptor-based read middleware and grouped t
78
78
 
79
79
  Pure data helpers live on namespaces such as `ElementApi`, `NodeApi`, `PathApi`, `PointApi`, `RangeApi`, `SpanApi`, and `TextApi`. Inside a live editor, prefer `editor.read.<group>.<method>()` for one-shot reads, grouped `state.*` reads for custom read logic, `editor.update.<group>.<method>()` for one-shot writes, and grouped `tx.*` writes for composed commands. Plugin `read` factories return callable method trees built once per configuration; methods read live state when invoked.
80
80
 
81
- DOM, React, annotations, history, hyperscript, layout, diff, and testing APIs live on explicit `plitejs/*` subpaths. There is no public `/internal` entrypoint.
81
+ DOM, React, history, hyperscript, pagination, diff, and testing APIs live on explicit `plitejs/*` subpaths. There is no public `/internal` entrypoint.
82
82
 
83
- React components create annotation stores with `useAnnotationStore` from `plitejs/react`. Framework adapters with an independent lifetime use `createAnnotationStore` from `plitejs/annotations`; the React root does not export the imperative constructor.
83
+ Build anchored overlays directly on `editor.anchor`, `commit.changed.anchors()`, and `DecorationSource`.
@@ -1,5 +1,28 @@
1
- import { Bg as Point, Bm as TxOnlyMethod, Es as SchemaPropertyExclusiveGroup, Fs as SchemaPropertyTypeChangePolicy, Ng as Location, No as PropertySetDescriptor, Ns as SchemaPropertyRole, Ps as SchemaPropertySplitPolicy, Rm as TxDeclaredMethod, Tc as AnyEditor, Td as NodeKey, Ud as PluginDependencyReferenceFor, Wg as Path, Yg as EditorJsonValue, _d as EditorViewOptions, dn as AuthoredProjectionDiagnostic, fn as AuthoredProjectionRefusal, js as SchemaPropertyLandingPolicy, kc as ContentSlice, kd as Plugin, kf as Value, kg as Range, ko as PropertyJsonDescriptor, sl as EditorDocumentValue, un as AuthoredDocumentProjection, ws as SchemaPropertyCopyPolicy } from "../index-DHt8nZQ6.js";
2
- import { h as TwoWayComparison } from "../comparison-types-DBQFu7Rt.js";
1
+ import { Bh as SchemaPropertyCopyPolicy, Cc as AuthoredDocumentProjection, F_ as Point, G as EditorDocumentValue, Hh as SchemaPropertyExclusiveGroup, Jm as PropertySetDescriptor, O_ as Location, Tc as AuthoredProjectionRefusal, Wm as PropertyJsonDescriptor, Xh as SchemaPropertySplitPolicy, Yh as SchemaPropertyRole, Zh as SchemaPropertyTypeChangePolicy, _r as Plugin, jr as PluginDependencyReferenceFor, l as AnyEditor, p as ContentSlice, pr as NodeKey, qh as SchemaPropertyLandingPolicy, r as TxOnlyMethod, rr as EditorViewOptions, rv as EditorJsonValue, t as TxDeclaredMethod, w_ as Range, wc as AuthoredProjectionDiagnostic, z_ as Path } from "../tx-only-D8lpB-sT.js";
2
+ import { r as Comparison } from "../index-DM-b6jEe.js";
3
+ //#region src/authored/comparison.d.ts
4
+ /** Outcome of proposing a validated document comparison as one native change. */
5
+ type AuthoredComparisonImportResult = Readonly<{
6
+ ids: readonly string[];
7
+ mappings: ReadonlyArray<Readonly<{
8
+ changeId: string;
9
+ groupId: string;
10
+ }>>;
11
+ status: 'applied' | 'unchanged';
12
+ }> | Readonly<{
13
+ reason: 'authored-frontier' | 'document' | 'schema';
14
+ status: 'stale';
15
+ }> | Readonly<{
16
+ reason: 'ambiguous-selection' | 'dependency';
17
+ status: 'blocked';
18
+ }> | Readonly<{
19
+ reason: 'comparison' | 'selection';
20
+ status: 'invalid';
21
+ }> | Readonly<{
22
+ reason: 'actor';
23
+ status: 'unavailable';
24
+ }>;
25
+ //#endregion
3
26
  //#region src/authored/tree/layers.d.ts
4
27
  type FormatWrite = Readonly<{
5
28
  kind: 'remove';
@@ -88,8 +111,17 @@ type AuthoredMark = (MarkBase & Readonly<{
88
111
  key?: undefined;
89
112
  kind: Exclude<AuthoredMarkKind, 'format' | 'insert' | 'join' | 'joined' | 'split'>;
90
113
  }>) | (MarkBase & Follows & NoGave & Readonly<{
114
+ key?: undefined;
91
115
  kind: 'insert';
92
116
  }>) | (MarkBase & Follows & Readonly<{
117
+ /**
118
+ * On a suggested block split, the split's identity within its
119
+ * incarnation, minted once when the recorder writes it, which the
120
+ * `end` member it leaves on the line it cut names. Absent on a split
121
+ * an Editing change records and on one stored before keys, which
122
+ * rejoin the nearest line before them that the decision keeps.
123
+ */
124
+ key?: string;
93
125
  /**
94
126
  * On a block split, what the split gave its new line: for each key a
95
127
  * join compares, and `type`, whose value the split did not copy from
@@ -120,14 +152,15 @@ type Follows = Readonly<{
120
152
  * holder is a `joined` claim.
121
153
  */
122
154
  follows?: string;
123
- key?: undefined;
124
155
  }>;
125
156
  type NoGave = Readonly<{
126
157
  gave?: undefined;
127
158
  }>;
159
+ /** A format write an authored split carried onto the split-off block, optionally naming its source. */
128
160
  type GaveWrite = FormatWrite & Readonly<{
129
161
  from?: string;
130
162
  }>;
163
+ /** Format writes keyed by property name that an authored split carried onto the split-off block. */
131
164
  type SplitGave = Readonly<Record<string, GaveWrite>>;
132
165
  declare const authoredMarksSchema: Readonly<{
133
166
  properties: (Readonly<{
@@ -195,7 +228,7 @@ declare const authoredRecords: Plugin<Readonly<{
195
228
  };
196
229
  };
197
230
  }> & Readonly<{
198
- name: "authored-records";
231
+ name: "authoredRecords";
199
232
  }>>;
200
233
  //#endregion
201
234
  //#region src/authored/refusal.d.ts
@@ -218,7 +251,7 @@ type AuthoredRefusal = Readonly<{
218
251
  code: 'generated-values' | 'unrepresentable' | 'veto';
219
252
  message: string;
220
253
  /**
221
- * Each veto reason the change met, such as `'table'`, or the
254
+ * Each veto reason the change met, such as `'code-block'`, or the
222
255
  * {@link UnrepresentableReason} an unrepresentable edit met.
223
256
  */
224
257
  reasons: readonly string[];
@@ -454,6 +487,13 @@ type AuthoredRead = {
454
487
  * author withdrew it, or when the document never held the id.
455
488
  */
456
489
  outcome: (id: string) => AuthoredOutcome | null;
490
+ /**
491
+ * Whether a stored grid element, such as a table, takes no write that
492
+ * reshapes it or sizes its rows and columns: it waits as a pending deletion
493
+ * or holds a pending row, column or format change of a change that does not
494
+ * insert it whole.
495
+ */
496
+ gridLocked: (node: unknown) => boolean;
457
497
  /** What review reads on a node of the stored document. */
458
498
  reviewOf: (node: unknown) => AuthoredReview;
459
499
  };
@@ -480,6 +520,24 @@ type AuthoredUpdate = {
480
520
  type AuthoredPlugin = Plugin<{
481
521
  activate: true;
482
522
  api: {
523
+ /**
524
+ * Publish the selected groups of a validated fixed-revision comparison as
525
+ * one native proposal under the calling view's author. Reads the whole
526
+ * document (`editor.read.value()`), validates its schema, content, and
527
+ * envelope (`meta` and `records`), and returns `unchanged` without writing
528
+ * when accepting the importer's own pending changes unmarked in the
529
+ * selection's document already yields that document. Otherwise returns
530
+ * `applied` only when accepting the proposal alone gives the selection's
531
+ * document and rejecting it alone gives the document it started from, with
532
+ * every other suggestion left pending; writes nothing and returns `blocked`
533
+ * when it cannot. Review can still hold the proposal's decision until a
534
+ * pending change it waits on is decided. An error that escapes the update
535
+ * after the proposal commits propagates.
536
+ */
537
+ proposeComparison: (input: Readonly<{
538
+ comparison: Comparison;
539
+ groupIds?: readonly string[];
540
+ }>) => AuthoredComparisonImportResult;
483
541
  setView: (view: AuthoredView) => void;
484
542
  /**
485
543
  * Calls the listener once for each commit that changes the review, with
@@ -508,9 +566,9 @@ type AuthoredTestOptions = AuthoredOptions & Readonly<{
508
566
  intent?: 'edit' | 'propose';
509
567
  now?: () => number;
510
568
  /**
511
- * Record what a feature's veto refuses in Suggesting, such as a new table
512
- * row, as content loaded from elsewhere can hold it. A write review cannot
513
- * show in a table, such as a lone new cell, still refuses.
569
+ * Record what a feature's veto refuses in Suggesting, such as a code block,
570
+ * as content loaded from elsewhere can hold it. A write review cannot show
571
+ * in a table, such as a lone new cell, still refuses.
514
572
  */
515
573
  vetoes?: false;
516
574
  }>;
@@ -530,44 +588,6 @@ declare const createAuthoredPlugin: (options: AuthoredTestOptions) => AuthoredPl
530
588
  /** Suggestions recorded as review marks in the document. */
531
589
  declare const authored: (options: AuthoredOptions) => AuthoredPlugin;
532
590
  //#endregion
533
- //#region src/authored/comparison.d.ts
534
- type AuthoredComparisonImportResult = Readonly<{
535
- ids: readonly string[];
536
- mappings: ReadonlyArray<Readonly<{
537
- changeId: string;
538
- groupId: string;
539
- }>>;
540
- status: 'applied' | 'unchanged';
541
- }> | Readonly<{
542
- reason: 'authored-frontier' | 'document' | 'schema';
543
- status: 'stale';
544
- }> | Readonly<{
545
- reason: 'ambiguous-selection' | 'dependency';
546
- status: 'blocked';
547
- }> | Readonly<{
548
- reason: 'comparison' | 'selection';
549
- status: 'invalid';
550
- }> | Readonly<{
551
- reason: 'actor' | 'plugin';
552
- status: 'unavailable';
553
- }>;
554
- /**
555
- * Publish the selected groups of a validated fixed-revision comparison as one
556
- * native proposal. Returns `unchanged`, writing nothing, when accepting the
557
- * importer's own pending changes that the selection's document no longer marks,
558
- * and keeping every other pending change, already gives that document.
559
- * Otherwise returns `applied` only when accepting the proposal alone gives the
560
- * selection's document and rejecting it alone gives the document it started
561
- * from, with every other suggestion left pending. When it cannot, it writes
562
- * nothing and returns `blocked`. Review can still hold the proposal's decision
563
- * until a pending change it waits on is decided. An error that escapes the
564
- * update after the proposal commits propagates.
565
- */
566
- declare const proposeAuthoredComparison: <V extends Value>(editor: AnyEditor<V>, input: Readonly<{
567
- comparison: TwoWayComparison<V>;
568
- groupIds?: readonly string[];
569
- }>) => AuthoredComparisonImportResult;
570
- //#endregion
571
591
  //#region src/authored/format.d.ts
572
592
  /** `proposed` accepts every pending change; `accepted` rejects every one. */
573
593
  type AuthoredFormatProjection = 'accepted' | 'proposed';
@@ -593,4 +613,4 @@ declare function projectAuthoredDocument(document: EditorDocumentValue, options:
593
613
  */
594
614
  declare const projectAuthoredRange: (document: EditorDocumentValue, projected: EditorDocumentValue, range: Range) => Range | null;
595
615
  //#endregion
596
- export { type AuthoredChange, type AuthoredChangeDetails, type AuthoredChangeGroup, type AuthoredChangeKind, type AuthoredChangePart, type AuthoredChangesDelta, type AuthoredComparisonImportResult, type AuthoredDecision, type AuthoredDocumentProjection, type AuthoredFormatProjection, type AuthoredGroupDetails, type AuthoredGroupPart, type AuthoredMark, type AuthoredOptions, type AuthoredOutcome, type AuthoredPage, AuthoredPlaceError, type AuthoredPlugin, type AuthoredProjectionDiagnostic, type AuthoredProjectionRefusal, type AuthoredQuery, type AuthoredRefusal, type AuthoredResult, type AuthoredReview, type AuthoredTestOptions, type AuthoredView, type GaveWrite, type SplitGave, authored, authoredRecords, createAuthoredPlugin, projectAuthoredDocument, projectAuthoredRange, proposeAuthoredComparison };
616
+ export { type AuthoredChange, type AuthoredChangeDetails, type AuthoredChangeGroup, type AuthoredChangeKind, type AuthoredChangePart, type AuthoredChangesDelta, type AuthoredComparisonImportResult, type AuthoredDecision, type AuthoredDocumentProjection, type AuthoredFormatProjection, type AuthoredGroupDetails, type AuthoredGroupPart, type AuthoredMark, type AuthoredOptions, type AuthoredOutcome, type AuthoredPage, AuthoredPlaceError, type AuthoredPlugin, type AuthoredProjectionDiagnostic, type AuthoredProjectionRefusal, type AuthoredQuery, type AuthoredRefusal, type AuthoredResult, type AuthoredReview, type AuthoredTestOptions, type AuthoredView, type GaveWrite, type SplitGave, authored, authoredRecords, createAuthoredPlugin, projectAuthoredDocument, projectAuthoredRange };