@stesura/wordgard-view 0.4.2 → 0.4.3

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,3 +1,9 @@
1
+ ## 0.4.3 (2026-11-20)
2
+
3
+ ### New features
4
+
5
+ `batch(wg, change)` runs a change and commits what the editor's components draw from it through its renderer before returning; react-wordgard and vue-wordgard re-export it.
6
+
1
7
  ## 0.4.2 (2026-11-20)
2
8
 
3
9
  ### Bug fixes
package/dist/index.d.ts CHANGED
@@ -343,6 +343,15 @@ type Editor = EditorValue & {
343
343
  flushing: boolean;
344
344
  batch: (change: () => void) => void;
345
345
  };
346
+ /**
347
+ * Runs `change` and commits what the editor's components draw from it before
348
+ * returning, through its renderer (React's `flushSync`, Vue's pending
349
+ * updates): a store set in a bare `wg.scheduleDOMWrite` is in the DOM for the
350
+ * read phase after it. Only the components the editor draws (its document's
351
+ * app context, in Vue) commit. Throws where the renderer can't commit: inside
352
+ * a component's render.
353
+ */
354
+ declare const batch: (wg: Wordgard, change: () => void) => void;
346
355
  declare const editorOf: (wg: Wordgard) => Editor;
347
356
  declare const findEditor: (wg: Wordgard) => EditorValue | undefined;
348
357
 
@@ -408,4 +417,4 @@ declare class RenderedDocTile extends DocTile {
408
417
  declare const viewRoot: (dom: Element | null) => void;
409
418
  declare const drawnRoot: (dom: Element | null) => void;
410
419
 
411
- export { type ChildView, type ComponentShape, type DecoElt, type DecorationHandlers, DocTile, type EditorEvent, type EditorValue, type HostedRenderer, type MarkShape, type NodeCell, type NodeView, type NodeWrappers, RefusedUpdate, RenderedDocTile, RenderedWordgard, type Renderer, type RendererContext, type SelectTypes, type StateField, type Tile, TileFlag, VOID, type Words, type WrapperView, atomRef, attributedWidget, attrsToRecord, cellOf, childViewKeys, createDecorationHandlers, createDocTile, createNodeWrappers, createShapeHandle, createWrapperHandle, decorationRoot, defineMarkShape, defineNodeWrappers, defineShape, defineWidgetType, defineWrapper, drawnRoot, editorOf, findEditor, hostDocTile, idOf, isComponentMark, isComponentShape, isComponentWidget, isComponentWrapper, isTrailingBreak, listenersOf, localTagName, namespaced, nodePos, nodeViewOf, rootReplaced, shapeAttributes, shapeOf, staticCopy, uneditable, viewRoot, widgetRoot };
420
+ export { type ChildView, type ComponentShape, type DecoElt, type DecorationHandlers, DocTile, type EditorEvent, type EditorValue, type HostedRenderer, type MarkShape, type NodeCell, type NodeView, type NodeWrappers, RefusedUpdate, RenderedDocTile, RenderedWordgard, type Renderer, type RendererContext, type SelectTypes, type StateField, type Tile, TileFlag, VOID, type Words, type WrapperView, atomRef, attributedWidget, attrsToRecord, batch, cellOf, childViewKeys, createDecorationHandlers, createDocTile, createNodeWrappers, createShapeHandle, createWrapperHandle, decorationRoot, defineMarkShape, defineNodeWrappers, defineShape, defineWidgetType, defineWrapper, drawnRoot, editorOf, findEditor, hostDocTile, idOf, isComponentMark, isComponentShape, isComponentWidget, isComponentWrapper, isTrailingBreak, listenersOf, localTagName, namespaced, nodePos, nodeViewOf, rootReplaced, shapeAttributes, shapeOf, staticCopy, uneditable, viewRoot, widgetRoot };
package/dist/index.js CHANGED
@@ -1444,6 +1444,7 @@ var notifyFields = (fields, before, after) => {
1444
1444
  for (const listener of pending) listener();
1445
1445
  };
1446
1446
  var editors = /* @__PURE__ */ new WeakMap();
1447
+ var batch = (wg, change) => editorOf(wg).batch(change);
1447
1448
  var editorOf = (wg) => {
1448
1449
  const found = editors.get(wg);
1449
1450
  if (found) return found;
@@ -2866,6 +2867,7 @@ export {
2866
2867
  atomRef,
2867
2868
  attributedWidget,
2868
2869
  attrsToRecord,
2870
+ batch,
2869
2871
  cellOf,
2870
2872
  childViewKeys,
2871
2873
  createDecorationHandlers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stesura/wordgard-view",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "The core of react-wordgard and vue-wordgard, not for direct use",
5
5
  "keywords": [
6
6
  "wordgard"