@inditextech/weave-types 0.2.0 → 0.2.1

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/dist/types.cjs CHANGED
@@ -23,6 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
 
24
24
  //#endregion
25
25
  require("konva");
26
+ require("yjs");
26
27
 
27
28
  //#region src/constants.ts
28
29
  const WEAVE_NODE_LAYER_ID = "mainLayer";
package/dist/types.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import Konva from "konva";
2
+ import * as Y from "yjs";
2
3
  import { Vector2d } from "konva/lib/types";
3
4
 
4
5
  //#region src/constants.d.ts
@@ -179,6 +180,12 @@ type WeaveCallbacks = {
179
180
  onStateChange?: (state: WeaveState) => void;
180
181
  onUndoManagerStatusChange?: (undoManagerStatus: WeaveUndoRedoChange) => void;
181
182
  };
183
+ declare type docElementTypeDescription = "xml" | "text" | Array<any> | object;
184
+ declare type DocTypeDescription = {
185
+ [key: string]: docElementTypeDescription;
186
+ };
187
+ declare type MappedTypeDescription<T extends DocTypeDescription> = { readonly [P in keyof T]: T[P] extends "xml" ? Y.XmlFragment : T[P] extends "text" ? Y.Text : T[P] extends Array<any> ? T[P] : T[P] extends object ? Partial<T[P]> : never };
188
+ declare function crdtDoc<T extends DocTypeDescription>(doc: Y.Doc, typeDescription: T): MappedTypeDescription<T>;
182
189
 
183
190
  //#endregion
184
191
  //#region src/base/node.d.ts
@@ -191,4 +198,4 @@ interface WeaveNodeBase {
191
198
  }
192
199
 
193
200
  //#endregion
194
- export { GroupSerializable, GroupsStateChange, NodeSerializable, NodesStateChange, STATE_ACTIONS, StateAction, StateActionKeys, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FILE_FORMAT, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WeaveActionBase, WeaveAwarenessChange, WeaveCallbacks, WeaveConfig, WeaveElementAttributes, WeaveElementInstance, WeaveExportFileFormat, WeaveExportFileFormatKeys, WeaveExportFormat, WeaveExportFormatKeys, WeaveExportNodeOptions, WeaveFont, WeaveLoggerConfig, WeaveMousePointInfo, WeaveMousePointInfoSimple, WeaveNodeBase, WeaveNodeFound, WeavePluginBase, WeavePosition, WeavePositionKeys, WeaveSelection, WeaveSerializedGroup, WeaveState, WeaveStateElement, WeaveStatus, WeaveStatusKeys, WeaveStoreBase, WeaveStoreOptions, WeaveUndoManagerOptions, WeaveUndoRedoChange, WeaveUser };
201
+ export { DocTypeDescription, GroupSerializable, GroupsStateChange, MappedTypeDescription, NodeSerializable, NodesStateChange, STATE_ACTIONS, StateAction, StateActionKeys, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FILE_FORMAT, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WeaveActionBase, WeaveAwarenessChange, WeaveCallbacks, WeaveConfig, WeaveElementAttributes, WeaveElementInstance, WeaveExportFileFormat, WeaveExportFileFormatKeys, WeaveExportFormat, WeaveExportFormatKeys, WeaveExportNodeOptions, WeaveFont, WeaveLoggerConfig, WeaveMousePointInfo, WeaveMousePointInfoSimple, WeaveNodeBase, WeaveNodeFound, WeavePluginBase, WeavePosition, WeavePositionKeys, WeaveSelection, WeaveSerializedGroup, WeaveState, WeaveStateElement, WeaveStatus, WeaveStatusKeys, WeaveStoreBase, WeaveStoreOptions, WeaveUndoManagerOptions, WeaveUndoRedoChange, WeaveUser, crdtDoc, docElementTypeDescription };
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import Konva from "konva";
2
+ import * as Y from "yjs";
2
3
  import { Vector2d } from "konva/lib/types";
3
4
 
4
5
  //#region src/constants.d.ts
@@ -179,6 +180,12 @@ type WeaveCallbacks = {
179
180
  onStateChange?: (state: WeaveState) => void;
180
181
  onUndoManagerStatusChange?: (undoManagerStatus: WeaveUndoRedoChange) => void;
181
182
  };
183
+ declare type docElementTypeDescription = "xml" | "text" | Array<any> | object;
184
+ declare type DocTypeDescription = {
185
+ [key: string]: docElementTypeDescription;
186
+ };
187
+ declare type MappedTypeDescription<T extends DocTypeDescription> = { readonly [P in keyof T]: T[P] extends "xml" ? Y.XmlFragment : T[P] extends "text" ? Y.Text : T[P] extends Array<any> ? T[P] : T[P] extends object ? Partial<T[P]> : never };
188
+ declare function crdtDoc<T extends DocTypeDescription>(doc: Y.Doc, typeDescription: T): MappedTypeDescription<T>;
182
189
 
183
190
  //#endregion
184
191
  //#region src/base/node.d.ts
@@ -191,4 +198,4 @@ interface WeaveNodeBase {
191
198
  }
192
199
 
193
200
  //#endregion
194
- export { GroupSerializable, GroupsStateChange, NodeSerializable, NodesStateChange, STATE_ACTIONS, StateAction, StateActionKeys, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FILE_FORMAT, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WeaveActionBase, WeaveAwarenessChange, WeaveCallbacks, WeaveConfig, WeaveElementAttributes, WeaveElementInstance, WeaveExportFileFormat, WeaveExportFileFormatKeys, WeaveExportFormat, WeaveExportFormatKeys, WeaveExportNodeOptions, WeaveFont, WeaveLoggerConfig, WeaveMousePointInfo, WeaveMousePointInfoSimple, WeaveNodeBase, WeaveNodeFound, WeavePluginBase, WeavePosition, WeavePositionKeys, WeaveSelection, WeaveSerializedGroup, WeaveState, WeaveStateElement, WeaveStatus, WeaveStatusKeys, WeaveStoreBase, WeaveStoreOptions, WeaveUndoManagerOptions, WeaveUndoRedoChange, WeaveUser };
201
+ export { DocTypeDescription, GroupSerializable, GroupsStateChange, MappedTypeDescription, NodeSerializable, NodesStateChange, STATE_ACTIONS, StateAction, StateActionKeys, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FILE_FORMAT, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WeaveActionBase, WeaveAwarenessChange, WeaveCallbacks, WeaveConfig, WeaveElementAttributes, WeaveElementInstance, WeaveExportFileFormat, WeaveExportFileFormatKeys, WeaveExportFormat, WeaveExportFormatKeys, WeaveExportNodeOptions, WeaveFont, WeaveLoggerConfig, WeaveMousePointInfo, WeaveMousePointInfoSimple, WeaveNodeBase, WeaveNodeFound, WeavePluginBase, WeavePosition, WeavePositionKeys, WeaveSelection, WeaveSerializedGroup, WeaveState, WeaveStateElement, WeaveStatus, WeaveStatusKeys, WeaveStoreBase, WeaveStoreOptions, WeaveUndoManagerOptions, WeaveUndoRedoChange, WeaveUser, crdtDoc, docElementTypeDescription };
package/dist/types.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import Konva from "konva";
2
+ import "yjs";
2
3
 
3
4
  //#region src/constants.ts
4
5
  const WEAVE_NODE_LAYER_ID = "mainLayer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inditextech/weave-types",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
@@ -42,7 +42,8 @@
42
42
  "version:release": "npm version $RELEASE_VERSION -m \"[npm-scripts] prepare release $RELEASE_VERSION\" --tag-version-prefix \"\""
43
43
  },
44
44
  "dependencies": {
45
- "konva": "9.3.20"
45
+ "konva": "9.3.20",
46
+ "yjs": "13.6.26"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@typescript-eslint/eslint-plugin": "8.26.0",