@inditextech/weave-sdk 0.20.2 → 0.20.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/dist/sdk.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import Emittery from "emittery";
2
1
  import Konva from "konva";
3
2
  import { Vector2d } from "konva/lib/types";
4
- import pino, { Logger } from "pino";
5
3
  import * as Y from "yjs";
6
4
  import { Doc } from "yjs";
5
+ import Emittery from "emittery";
6
+ import pino, { Logger } from "pino";
7
7
  import { StageConfig } from "konva/lib/Stage";
8
8
  import { KonvaEventObject } from "konva/lib/Node";
9
9
 
@@ -168,6 +168,16 @@ declare const WEAVE_EXPORT_FORMATS: {
168
168
  readonly "PNG": "image/png";
169
169
  readonly "JPEG": "image/jpeg";
170
170
  }; //#endregion
171
+ //#region src/nodes/extensions.d.ts
172
+ declare module 'konva/lib/Node' {
173
+ interface Node {
174
+ getTransformerProperties(): WeaveNodeTransformerProperties;
175
+ resetCrop(): void;
176
+ updatePosition(position: Vector2d): void;
177
+ }
178
+ }
179
+
180
+ //#endregion
171
181
  //#region src/stores/store.d.ts
172
182
  declare abstract class WeaveStore implements WeaveStoreBase {
173
183
  protected instance: Weave;
package/dist/sdk.d.ts CHANGED
@@ -1,173 +1,12 @@
1
+ import { MappedTypeDescription, NodeSerializable, WeaveActionBase, WeaveConfig, WeaveElementAttributes, WeaveElementInstance, WeaveExportNodeOptions, WeaveFont, WeaveLoggerConfig, WeaveMousePointInfo, WeaveMousePointInfoSimple, WeaveNodeBase, WeaveNodeConfiguration, WeaveNodeFound, WeaveNodeTransformerProperties, WeavePluginBase, WeavePosition, WeaveSelection, WeaveSerializedGroup, WeaveState, WeaveStateElement, WeaveStatus, WeaveStoreBase, WeaveStoreOptions, WeaveUndoRedoChange, WeaveUser } from "./extensions.d-NOtVg64R.js";
1
2
  import Konva from "konva";
2
3
  import { Vector2d } from "konva/lib/types";
3
- import * as Y from "yjs";
4
4
  import { Doc } from "yjs";
5
5
  import Emittery from "emittery";
6
6
  import pino, { Logger } from "pino";
7
7
  import { StageConfig } from "konva/lib/Stage";
8
8
  import { KonvaEventObject } from "konva/lib/Node";
9
9
 
10
- //#region ../types/dist/types.d.ts
11
- //#region src/base/node.d.ts
12
- interface WeaveNodeBase {
13
- create(id: string, props: WeaveElementAttributes): WeaveStateElement;
14
- onRender(props: WeaveElementAttributes): WeaveElementInstance;
15
- onUpdate(instance: WeaveElementInstance, nextProps: WeaveElementAttributes): void;
16
- onDestroy(instance: WeaveElementInstance): void;
17
- serialize(instance: WeaveElementInstance): WeaveStateElement;
18
- }
19
-
20
- //#endregion
21
- //#region src/base/action.d.ts
22
- interface WeaveActionBase {
23
- onInit?(): void;
24
- trigger(cancelAction: () => void, params?: unknown): unknown;
25
- internalUpdate?(): void;
26
- cleanup?(): void;
27
- }
28
-
29
- //#endregion
30
- //#region src/base/plugin.d.ts
31
- interface WeavePluginBase {
32
- onInit?(): void;
33
- onRender?(): void;
34
- enable(): void;
35
- disable(): void;
36
- isEnabled(): boolean;
37
- }
38
-
39
- //#endregion
40
- //#region src/base/store.d.ts
41
- type WeaveStoreOptions = {
42
- getUser: () => WeaveUser;
43
- undoManagerOptions?: WeaveUndoManagerOptions;
44
- };
45
- interface WeaveStoreBase {
46
- connect(): void;
47
- disconnect(): void;
48
- setAwarenessInfo(field: string, value: unknown): void;
49
- }
50
-
51
- //#endregion
52
- //#region src/types.d.ts
53
- type WeaveConfig = {
54
- store: WeaveStoreBase;
55
- nodes?: WeaveNodeBase[];
56
- actions?: WeaveActionBase[];
57
- plugins?: WeavePluginBase[];
58
- fonts?: WeaveFont[];
59
- logger?: WeaveLoggerConfig;
60
- };
61
- type WeaveStatusKeys = keyof typeof WEAVE_INSTANCE_STATUS;
62
- type WeaveStatus = (typeof WEAVE_INSTANCE_STATUS)[WeaveStatusKeys];
63
- type NodeSerializable = Konva.NodeConfig & {
64
- id: string;
65
- nodeType: string;
66
- };
67
- type WeaveElementAttributes = {
68
- [key: string]: any;
69
- id?: string;
70
- nodeType?: string;
71
- children?: WeaveStateElement[];
72
- };
73
- type WeaveStateElement = {
74
- key: string;
75
- type: string;
76
- props: WeaveElementAttributes;
77
- };
78
- type WeaveState = {
79
- weave: {
80
- key: "stage";
81
- type: "stage";
82
- props: {
83
- [key: string]: unknown;
84
- id: "stage";
85
- children: WeaveStateElement[];
86
- };
87
- } | Record<string, WeaveStateElement>;
88
- };
89
- type WeaveSelection = {
90
- instance: Konva.Shape | Konva.Group;
91
- node: WeaveStateElement;
92
- };
93
- type WeaveMousePointInfoSimple = {
94
- mousePoint: Vector2d;
95
- container: Konva.Layer | Konva.Group | undefined;
96
- };
97
- type WeaveMousePointInfo = WeaveMousePointInfoSimple & {
98
- measureContainer: Konva.Layer | Konva.Group | undefined;
99
- };
100
- type WeaveSerializedGroup = {
101
- serializedNodes: WeaveStateElement[];
102
- minPoint: Vector2d;
103
- } | undefined;
104
- type WeaveNodeFound = {
105
- node: WeaveStateElement | null;
106
- parent: WeaveStateElement | null;
107
- index: number;
108
- };
109
- type WeaveElementInstance = Konva.Layer | Konva.Group | Konva.Shape;
110
- type WeaveLoggerConfig = {
111
- disabled?: boolean;
112
- level?: "debug" | "info" | "warn" | "error";
113
- };
114
- type WeavePositionKeys = keyof typeof WEAVE_NODE_POSITION;
115
- type WeavePosition = (typeof WEAVE_NODE_POSITION)[WeavePositionKeys];
116
- type WeaveExportNodeOptions = {
117
- format?: typeof WEAVE_EXPORT_FORMATS.PNG;
118
- padding?: number;
119
- pixelRatio?: number;
120
- backgroundColor?: string;
121
- quality?: number;
122
- };
123
- type WeaveUser = {
124
- [key: string]: any;
125
- name: string;
126
- email: string;
127
- };
128
- type WeaveFont = {
129
- id: string;
130
- name: string;
131
- };
132
- type WeaveUndoManagerOptions = {
133
- captureTimeout?: number;
134
- trackedOrigins?: Set<any>;
135
- };
136
- type WeaveUndoRedoChange = {
137
- canRedo: boolean;
138
- canUndo: boolean;
139
- redoStackLength: number;
140
- undoStackLength: number;
141
- };
142
- declare type docElementTypeDescription = "xml" | "text" | Array<any> | object;
143
- declare type DocTypeDescription = {
144
- [key: string]: docElementTypeDescription;
145
- };
146
- 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 };
147
- type WeaveNodeTransformerProperties = Konva.TransformerConfig;
148
- type WeaveNodeConfiguration = {
149
- transform: Partial<WeaveNodeTransformerProperties>;
150
- };
151
-
152
- //#endregion
153
- //#region src/constants.d.ts
154
-
155
- declare const WEAVE_INSTANCE_STATUS: {
156
- readonly "IDLE": "idle";
157
- readonly "STARTING": "starting";
158
- readonly "LOADING_FONTS": "loadingFonts";
159
- readonly "RUNNING": "running";
160
- };
161
- declare const WEAVE_NODE_POSITION: {
162
- readonly "UP": "up";
163
- readonly "DOWN": "down";
164
- readonly "FRONT": "front";
165
- readonly "BACK": "back";
166
- };
167
- declare const WEAVE_EXPORT_FORMATS: {
168
- readonly "PNG": "image/png";
169
- readonly "JPEG": "image/jpeg";
170
- }; //#endregion
171
10
  //#region src/stores/store.d.ts
172
11
  declare abstract class WeaveStore implements WeaveStoreBase {
173
12
  protected instance: Weave;
@@ -199,9 +38,7 @@ declare abstract class WeaveStore implements WeaveStoreBase {
199
38
  abstract connect(): void;
200
39
  abstract disconnect(): void;
201
40
  abstract setAwarenessInfo(field: string, value: unknown): void;
202
- }
203
-
204
- //#endregion
41
+ } //#endregion
205
42
  //#region src/plugins/plugin.d.ts
206
43
  declare abstract class WeavePlugin implements WeavePluginBase {
207
44
  protected instance: Weave;
package/dist/sdk.js CHANGED
@@ -1,8 +1,9 @@
1
+ import "./extensions.d-NOtVg64R.d.ts";
1
2
  import Konva from "konva";
2
3
  import "konva/lib/types";
4
+ import { Doc, UndoManager } from "yjs";
3
5
  import { WEAVE_AWARENESS_LAYER_ID, WEAVE_DEFAULT_TRANSFORM_PROPERTIES, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FILE_FORMAT, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_NODE_CUSTOM_EVENTS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WEAVE_UTILITY_LAYER_ID } from "@inditextech/weave-types";
4
6
  import { getYjsDoc, getYjsValue, observeDeep, syncedStore } from "@syncedstore/core";
5
- import { Doc, UndoManager } from "yjs";
6
7
  import React from "react";
7
8
  import ReactReconciler from "react-reconciler";
8
9
  import { Line } from "konva/lib/shapes/Line";
@@ -18035,7 +18036,7 @@ var WeaveRegisterManager = class {
18035
18036
 
18036
18037
  //#endregion
18037
18038
  //#region package.json
18038
- var version = "0.20.2";
18039
+ var version = "0.20.3";
18039
18040
 
18040
18041
  //#endregion
18041
18042
  //#region src/managers/setup.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inditextech/weave-sdk",
3
- "version": "0.20.2",
3
+ "version": "0.20.3",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
@@ -43,7 +43,7 @@
43
43
  "version:release": "npm version $RELEASE_VERSION -m \"[npm-scripts] prepare release $RELEASE_VERSION\" --tag-version-prefix \"\""
44
44
  },
45
45
  "dependencies": {
46
- "@inditextech/weave-types": "0.20.2",
46
+ "@inditextech/weave-types": "0.20.3",
47
47
  "@syncedstore/core": "0.6.0",
48
48
  "canvas": "3.1.0",
49
49
  "konva": "9.3.20",