@inditextech/weave-sdk 0.57.0 → 0.57.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/sdk.cjs CHANGED
@@ -21930,7 +21930,7 @@ var WeaveRegisterManager = class {
21930
21930
 
21931
21931
  //#endregion
21932
21932
  //#region package.json
21933
- var version = "0.57.0";
21933
+ var version = "0.57.1";
21934
21934
 
21935
21935
  //#endregion
21936
21936
  //#region src/managers/setup.ts
@@ -25095,8 +25095,7 @@ var WeaveFrameNode = class extends WeaveNode {
25095
25095
  const WEAVE_STROKE_NODE_TYPE = "stroke";
25096
25096
  const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
25097
25097
  splineResolution: 8,
25098
- resamplingSpacing: 2,
25099
- cachePixelRatio: 4
25098
+ resamplingSpacing: 2
25100
25099
  };
25101
25100
 
25102
25101
  //#endregion
@@ -25258,7 +25257,6 @@ var WeaveStrokeNode = class extends WeaveNode {
25258
25257
  context.fillStrokeShape(shape);
25259
25258
  }
25260
25259
  });
25261
- if (props.cacheStroke) stroke.cache({ pixelRatio: this.config.cachePixelRatio });
25262
25260
  this.setupDefaultNodeAugmentation(stroke);
25263
25261
  const defaultTransformerProperties = this.defaultGetTransformerProperties(this.config.transform);
25264
25262
  stroke.getTransformerProperties = function() {
@@ -25268,18 +25266,14 @@ var WeaveStrokeNode = class extends WeaveNode {
25268
25266
  return stroke;
25269
25267
  }
25270
25268
  onUpdate(nodeInstance, nextProps) {
25271
- const actAttrs = nodeInstance.getAttrs();
25272
- if (actAttrs.stroke !== nextProps.stroke || actAttrs.strokeWidth !== nextProps.strokeWidth || actAttrs.dash !== nextProps.dash) nodeInstance.clearCache();
25273
25269
  nodeInstance.setAttrs({ ...nextProps });
25274
- if (nextProps.cacheStroke) {
25275
- nodeInstance.sceneFunc((ctx, shape) => {
25276
- this.drawShape(ctx, shape);
25277
- });
25278
- nodeInstance.cache({ pixelRatio: this.config.cachePixelRatio });
25279
- }
25280
25270
  const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
25281
25271
  if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
25282
25272
  }
25273
+ getZoomPlugin() {
25274
+ const zoomPlugin = this.instance.getPlugin("stageZoom");
25275
+ return zoomPlugin;
25276
+ }
25283
25277
  scaleReset(node) {
25284
25278
  const strokeNode = node;
25285
25279
  const oldPoints = [...strokeNode.getAttrs().strokeElements];
@@ -26909,8 +26903,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
26909
26903
  y: 0,
26910
26904
  width: 0,
26911
26905
  height: 0,
26912
- strokeElements: newStrokeElements,
26913
- cacheStroke: false
26906
+ strokeElements: newStrokeElements
26914
26907
  });
26915
26908
  const nodeInstance = nodeHandler.onRender(node.props);
26916
26909
  this.measureContainer?.add(nodeInstance);
@@ -26958,8 +26951,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
26958
26951
  height: box.height,
26959
26952
  x: box.x,
26960
26953
  y: box.y,
26961
- strokeElements: newStrokeElements,
26962
- cacheStroke: true
26954
+ strokeElements: newStrokeElements
26963
26955
  });
26964
26956
  const realNode = this.instance.getStage().findOne(`#${tempStroke.getAttrs().id}`);
26965
26957
  if (realNode) realNode.destroy();
package/dist/sdk.d.cts CHANGED
@@ -1329,7 +1329,6 @@ declare const WEAVE_FRAME_NODE_DEFAULT_PROPS: {
1329
1329
  type WeaveStrokeProperties = {
1330
1330
  splineResolution: number;
1331
1331
  resamplingSpacing: number;
1332
- cachePixelRatio: number;
1333
1332
  transform?: WeaveNodeTransformerProperties;
1334
1333
  };
1335
1334
  type WeaveStrokeNodeParams = {
@@ -1342,8 +1341,163 @@ type WeaveStrokePoint = {
1342
1341
  };
1343
1342
 
1344
1343
  //#endregion
1345
- //#region src/nodes/stroke/stroke.d.ts
1344
+ //#region src/plugins/stage-zoom/constants.d.ts
1345
+ //# sourceMappingURL=types.d.ts.map
1346
+ declare const WEAVE_STAGE_ZOOM_TYPE: {
1347
+ readonly MOUSE_WHEEL: "mouseWheel";
1348
+ readonly PINCH_ZOOM: "pinchZoom";
1349
+ };
1350
+
1351
+ //#endregion
1352
+ //#region src/plugins/stage-zoom/types.d.ts
1353
+ type WeaveStageZoomTypeKeys = keyof typeof WEAVE_STAGE_ZOOM_TYPE;
1354
+ type WeaveStageZoomType = (typeof WEAVE_STAGE_ZOOM_TYPE)[WeaveStageZoomTypeKeys];
1355
+ type WeaveStageZoomChanged = {
1356
+ scale: number;
1357
+ zoomSteps: number[];
1358
+ actualStep: number;
1359
+ onDefaultStep: boolean;
1360
+ canZoomIn: boolean;
1361
+ canZoomOut: boolean;
1362
+ };
1363
+ type WeaveStageZoomPluginOnZoomChangeEvent = WeaveStageZoomChanged;
1364
+ type WeaveStageZoomPluginConfig = {
1365
+ zoomSteps: number[];
1366
+ defaultZoom: number;
1367
+ fitToScreen: {
1368
+ padding: number;
1369
+ };
1370
+ fitToSelection: {
1371
+ padding: number;
1372
+ };
1373
+ zoomInertia: {
1374
+ friction: number;
1375
+ mouseWheelStep: number;
1376
+ trackpadStep: number;
1377
+ };
1378
+ };
1379
+ type WeaveStageZoomPluginParams = {
1380
+ config?: DeepPartial<WeaveStageZoomPluginConfig>;
1381
+ };
1382
+
1383
+ //#endregion
1384
+ //#region src/plugins/stage-grid/constants.d.ts
1385
+ //# sourceMappingURL=types.d.ts.map
1386
+ declare const WEAVE_STAGE_GRID_KEY = "stageGrid";
1387
+ declare const WEAVE_GRID_TYPES: {
1388
+ readonly LINES: "lines";
1389
+ readonly DOTS: "dots";
1390
+ };
1391
+ declare const WEAVE_GRID_DEFAULT_SIZE = 50;
1392
+ declare const WEAVE_GRID_DEFAULT_TYPE: string;
1393
+ declare const WEAVE_GRID_DEFAULT_COLOR = "rgba(0,0,0,0.1)";
1394
+ declare const WEAVE_GRID_DEFAULT_ORIGIN_COLOR = "rgba(255,0,0,0.1)";
1395
+ declare const WEAVE_GRID_DEFAULT_STROKE = 0.5;
1396
+ declare const WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO = 4;
1397
+ declare const WEAVE_GRID_DEFAULT_RADIUS = 1;
1398
+ declare const WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO = 2;
1399
+ declare const WEAVE_GRID_DEFAULT_MAJOR_EVERY = 10;
1400
+ declare const WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS = 250;
1401
+ declare const WEAVE_GRID_LAYER_ID = "gridLayer";
1402
+
1403
+ //#endregion
1404
+ //#region src/plugins/stage-grid/types.d.ts
1405
+ //# sourceMappingURL=constants.d.ts.map
1406
+ type WeaveStageGridPluginConfig = {
1407
+ type: WeaveStageGridType;
1408
+ gridColor: string;
1409
+ gridOriginColor: string;
1410
+ gridSize: number;
1411
+ gridMajorEvery?: number;
1412
+ gridMajorRatio?: number;
1413
+ gridStroke?: number;
1414
+ gridDotRadius?: number;
1415
+ gridDotMaxDotsPerAxis: number;
1416
+ };
1417
+ type WeaveStageGridPluginParams = {
1418
+ config?: Partial<WeaveStageGridPluginConfig>;
1419
+ };
1420
+ type WeaveStageGridTypeKeys = keyof typeof WEAVE_GRID_TYPES;
1421
+ type WeaveStageGridType = (typeof WEAVE_GRID_TYPES)[WeaveStageGridTypeKeys];
1422
+
1423
+ //#endregion
1424
+ //#region src/plugins/stage-grid/stage-grid.d.ts
1346
1425
  //# sourceMappingURL=types.d.ts.map
1426
+ declare class WeaveStageGridPlugin extends WeavePlugin {
1427
+ private moveToolActive;
1428
+ private isMouseMiddleButtonPressed;
1429
+ private isSpaceKeyPressed;
1430
+ private config;
1431
+ constructor(params?: Partial<WeaveStageGridPluginParams>);
1432
+ getName(): string;
1433
+ getLayerName(): string;
1434
+ initLayer(): void;
1435
+ onInit(): void;
1436
+ private initEvents;
1437
+ getLayer(): Konva.Layer | undefined;
1438
+ getAdaptiveSpacing(scale: number): number;
1439
+ private getAdjustedSpacing;
1440
+ private renderGridLines;
1441
+ private renderGridDots;
1442
+ private renderGrid;
1443
+ onRender(): void;
1444
+ enable(): void;
1445
+ disable(): void;
1446
+ getType(): WeaveStageGridType;
1447
+ setType(type: WeaveStageGridType): void;
1448
+ }
1449
+
1450
+ //#endregion
1451
+ //#region src/plugins/stage-zoom/stage-zoom.d.ts
1452
+ //# sourceMappingURL=stage-grid.d.ts.map
1453
+ declare class WeaveStageZoomPlugin extends WeavePlugin {
1454
+ private isCtrlOrMetaPressed;
1455
+ protected previousPointer: string | null;
1456
+ getLayerName: undefined;
1457
+ initLayer: undefined;
1458
+ onRender: undefined;
1459
+ private config;
1460
+ private actualScale;
1461
+ private actualStep;
1462
+ private updatedMinimumZoom;
1463
+ private pinching;
1464
+ private zooming;
1465
+ private isTrackpad;
1466
+ private zoomVelocity;
1467
+ private zoomInertiaType;
1468
+ defaultStep: number;
1469
+ constructor(params?: WeaveStageZoomPluginParams);
1470
+ getName(): string;
1471
+ onInit(): void;
1472
+ private setZoom;
1473
+ canZoomOut(): boolean;
1474
+ canZoomIn(): boolean;
1475
+ zoomToStep(step: number): void;
1476
+ private findClosestStepIndex;
1477
+ zoomIn(pointer?: Vector2d): void;
1478
+ zoomOut(pointer?: Vector2d): void;
1479
+ minimumZoom(): number;
1480
+ fitToScreen(): void;
1481
+ fitToSelection(smartZoom?: boolean): void;
1482
+ enable(): void;
1483
+ disable(): void;
1484
+ getDistance(p1: Vector2d, p2: Vector2d): number;
1485
+ getCenter(p1: Vector2d, p2: Vector2d): {
1486
+ x: number;
1487
+ y: number;
1488
+ };
1489
+ private initEvents;
1490
+ getInertiaScale(): number;
1491
+ zoomTick(): void;
1492
+ isPinching(): boolean;
1493
+ getStageGridPlugin(): WeaveStageGridPlugin | undefined;
1494
+ getNodesSelectionPlugin(): WeaveNodesSelectionPlugin | undefined;
1495
+ getContextMenuPlugin(): WeaveContextMenuPlugin | undefined;
1496
+ }
1497
+
1498
+ //#endregion
1499
+ //#region src/nodes/stroke/stroke.d.ts
1500
+ //# sourceMappingURL=stage-zoom.d.ts.map
1347
1501
  declare class WeaveStrokeNode extends WeaveNode {
1348
1502
  private readonly config;
1349
1503
  protected nodeType: string;
@@ -1354,6 +1508,7 @@ declare class WeaveStrokeNode extends WeaveNode {
1354
1508
  private drawShape;
1355
1509
  onRender(props: WeaveElementAttributes): WeaveElementInstance;
1356
1510
  onUpdate(nodeInstance: WeaveElementInstance, nextProps: WeaveElementAttributes): void;
1511
+ getZoomPlugin(): WeaveStageZoomPlugin | undefined;
1357
1512
  scaleReset(node: Konva.Node): void;
1358
1513
  serialize(instance: WeaveElementInstance): WeaveStateElement;
1359
1514
  }
@@ -1365,7 +1520,6 @@ declare const WEAVE_STROKE_NODE_TYPE = "stroke";
1365
1520
  declare const WEAVE_STROKE_NODE_DEFAULT_CONFIG: {
1366
1521
  splineResolution: number;
1367
1522
  resamplingSpacing: number;
1368
- cachePixelRatio: number;
1369
1523
  };
1370
1524
 
1371
1525
  //#endregion
@@ -1751,164 +1905,9 @@ type WeaveBrushToolActionParams = {
1751
1905
  config: Partial<WeaveBrushToolActionProperties>;
1752
1906
  };
1753
1907
 
1754
- //#endregion
1755
- //#region src/plugins/stage-zoom/constants.d.ts
1756
- //# sourceMappingURL=types.d.ts.map
1757
- declare const WEAVE_STAGE_ZOOM_TYPE: {
1758
- readonly MOUSE_WHEEL: "mouseWheel";
1759
- readonly PINCH_ZOOM: "pinchZoom";
1760
- };
1761
-
1762
- //#endregion
1763
- //#region src/plugins/stage-zoom/types.d.ts
1764
- type WeaveStageZoomTypeKeys = keyof typeof WEAVE_STAGE_ZOOM_TYPE;
1765
- type WeaveStageZoomType = (typeof WEAVE_STAGE_ZOOM_TYPE)[WeaveStageZoomTypeKeys];
1766
- type WeaveStageZoomChanged = {
1767
- scale: number;
1768
- zoomSteps: number[];
1769
- actualStep: number;
1770
- onDefaultStep: boolean;
1771
- canZoomIn: boolean;
1772
- canZoomOut: boolean;
1773
- };
1774
- type WeaveStageZoomPluginOnZoomChangeEvent = WeaveStageZoomChanged;
1775
- type WeaveStageZoomPluginConfig = {
1776
- zoomSteps: number[];
1777
- defaultZoom: number;
1778
- fitToScreen: {
1779
- padding: number;
1780
- };
1781
- fitToSelection: {
1782
- padding: number;
1783
- };
1784
- zoomInertia: {
1785
- friction: number;
1786
- mouseWheelStep: number;
1787
- trackpadStep: number;
1788
- };
1789
- };
1790
- type WeaveStageZoomPluginParams = {
1791
- config?: DeepPartial<WeaveStageZoomPluginConfig>;
1792
- };
1793
-
1794
- //#endregion
1795
- //#region src/plugins/stage-grid/constants.d.ts
1796
- //# sourceMappingURL=types.d.ts.map
1797
- declare const WEAVE_STAGE_GRID_KEY = "stageGrid";
1798
- declare const WEAVE_GRID_TYPES: {
1799
- readonly LINES: "lines";
1800
- readonly DOTS: "dots";
1801
- };
1802
- declare const WEAVE_GRID_DEFAULT_SIZE = 50;
1803
- declare const WEAVE_GRID_DEFAULT_TYPE: string;
1804
- declare const WEAVE_GRID_DEFAULT_COLOR = "rgba(0,0,0,0.1)";
1805
- declare const WEAVE_GRID_DEFAULT_ORIGIN_COLOR = "rgba(255,0,0,0.1)";
1806
- declare const WEAVE_GRID_DEFAULT_STROKE = 0.5;
1807
- declare const WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO = 4;
1808
- declare const WEAVE_GRID_DEFAULT_RADIUS = 1;
1809
- declare const WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO = 2;
1810
- declare const WEAVE_GRID_DEFAULT_MAJOR_EVERY = 10;
1811
- declare const WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS = 250;
1812
- declare const WEAVE_GRID_LAYER_ID = "gridLayer";
1813
-
1814
- //#endregion
1815
- //#region src/plugins/stage-grid/types.d.ts
1816
- //# sourceMappingURL=constants.d.ts.map
1817
- type WeaveStageGridPluginConfig = {
1818
- type: WeaveStageGridType;
1819
- gridColor: string;
1820
- gridOriginColor: string;
1821
- gridSize: number;
1822
- gridMajorEvery?: number;
1823
- gridMajorRatio?: number;
1824
- gridStroke?: number;
1825
- gridDotRadius?: number;
1826
- gridDotMaxDotsPerAxis: number;
1827
- };
1828
- type WeaveStageGridPluginParams = {
1829
- config?: Partial<WeaveStageGridPluginConfig>;
1830
- };
1831
- type WeaveStageGridTypeKeys = keyof typeof WEAVE_GRID_TYPES;
1832
- type WeaveStageGridType = (typeof WEAVE_GRID_TYPES)[WeaveStageGridTypeKeys];
1833
-
1834
- //#endregion
1835
- //#region src/plugins/stage-grid/stage-grid.d.ts
1836
- //# sourceMappingURL=types.d.ts.map
1837
- declare class WeaveStageGridPlugin extends WeavePlugin {
1838
- private moveToolActive;
1839
- private isMouseMiddleButtonPressed;
1840
- private isSpaceKeyPressed;
1841
- private config;
1842
- constructor(params?: Partial<WeaveStageGridPluginParams>);
1843
- getName(): string;
1844
- getLayerName(): string;
1845
- initLayer(): void;
1846
- onInit(): void;
1847
- private initEvents;
1848
- getLayer(): Konva.Layer | undefined;
1849
- getAdaptiveSpacing(scale: number): number;
1850
- private getAdjustedSpacing;
1851
- private renderGridLines;
1852
- private renderGridDots;
1853
- private renderGrid;
1854
- onRender(): void;
1855
- enable(): void;
1856
- disable(): void;
1857
- getType(): WeaveStageGridType;
1858
- setType(type: WeaveStageGridType): void;
1859
- }
1860
-
1861
- //#endregion
1862
- //#region src/plugins/stage-zoom/stage-zoom.d.ts
1863
- //# sourceMappingURL=stage-grid.d.ts.map
1864
- declare class WeaveStageZoomPlugin extends WeavePlugin {
1865
- private isCtrlOrMetaPressed;
1866
- protected previousPointer: string | null;
1867
- getLayerName: undefined;
1868
- initLayer: undefined;
1869
- onRender: undefined;
1870
- private config;
1871
- private actualScale;
1872
- private actualStep;
1873
- private updatedMinimumZoom;
1874
- private pinching;
1875
- private zooming;
1876
- private isTrackpad;
1877
- private zoomVelocity;
1878
- private zoomInertiaType;
1879
- defaultStep: number;
1880
- constructor(params?: WeaveStageZoomPluginParams);
1881
- getName(): string;
1882
- onInit(): void;
1883
- private setZoom;
1884
- canZoomOut(): boolean;
1885
- canZoomIn(): boolean;
1886
- zoomToStep(step: number): void;
1887
- private findClosestStepIndex;
1888
- zoomIn(pointer?: Vector2d): void;
1889
- zoomOut(pointer?: Vector2d): void;
1890
- minimumZoom(): number;
1891
- fitToScreen(): void;
1892
- fitToSelection(smartZoom?: boolean): void;
1893
- enable(): void;
1894
- disable(): void;
1895
- getDistance(p1: Vector2d, p2: Vector2d): number;
1896
- getCenter(p1: Vector2d, p2: Vector2d): {
1897
- x: number;
1898
- y: number;
1899
- };
1900
- private initEvents;
1901
- getInertiaScale(): number;
1902
- zoomTick(): void;
1903
- isPinching(): boolean;
1904
- getStageGridPlugin(): WeaveStageGridPlugin | undefined;
1905
- getNodesSelectionPlugin(): WeaveNodesSelectionPlugin | undefined;
1906
- getContextMenuPlugin(): WeaveContextMenuPlugin | undefined;
1907
- }
1908
-
1909
1908
  //#endregion
1910
1909
  //#region src/actions/brush-tool/brush-tool.d.ts
1911
- //# sourceMappingURL=stage-zoom.d.ts.map
1910
+ //# sourceMappingURL=types.d.ts.map
1912
1911
  declare class WeaveBrushToolAction extends WeaveAction {
1913
1912
  protected config: WeaveBrushToolActionProperties;
1914
1913
  protected initialized: boolean;