kritzel-stencil 0.3.24 → 0.3.26

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 (40) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/kritzel-active-users_45.cjs.entry.js +60 -36
  3. package/dist/cjs/{schema.constants-D8JoUfNc.js → schema.constants-CPz_o--2.js} +271 -101
  4. package/dist/collection/classes/handlers/line-handle.handler.js +59 -52
  5. package/dist/collection/classes/handlers/move.handler.js +2 -0
  6. package/dist/collection/classes/handlers/rotation.handler.js +18 -6
  7. package/dist/collection/classes/managers/anchor.manager.js +112 -38
  8. package/dist/collection/classes/managers/clipboard.manager.js +7 -0
  9. package/dist/collection/classes/objects/selection-group.class.js +80 -5
  10. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +50 -34
  11. package/dist/collection/configs/default-engine-config.js +1 -0
  12. package/dist/collection/constants/version.js +1 -1
  13. package/dist/components/index.js +1 -1
  14. package/dist/components/kritzel-controls.js +1 -1
  15. package/dist/components/kritzel-editor.js +1 -1
  16. package/dist/components/kritzel-engine.js +1 -1
  17. package/dist/components/kritzel-settings.js +1 -1
  18. package/dist/components/kritzel-tool-config.js +1 -1
  19. package/dist/components/p-B0VgBZUT.js +9 -0
  20. package/dist/components/{p-Bz_zj6dQ.js → p-BAhZcKRe.js} +1 -1
  21. package/dist/components/{p-Dw-t1qQc.js → p-DKxt_AjI.js} +1 -1
  22. package/dist/components/{p-B5XGjTLd.js → p-DRncK1E6.js} +1 -1
  23. package/dist/components/{p-DNDt6O6A.js → p-DUo2M5uM.js} +1 -1
  24. package/dist/esm/index.js +2 -2
  25. package/dist/esm/kritzel-active-users_45.entry.js +60 -36
  26. package/dist/esm/{schema.constants-B3IqnD8l.js → schema.constants-C9ZX7hQv.js} +271 -101
  27. package/dist/stencil/index.esm.js +1 -1
  28. package/dist/stencil/p-71271db1.entry.js +9 -0
  29. package/dist/stencil/{p-B3IqnD8l.js → p-C9ZX7hQv.js} +1 -1
  30. package/dist/stencil/stencil.esm.js +1 -1
  31. package/dist/types/classes/handlers/line-handle.handler.d.ts +1 -0
  32. package/dist/types/classes/handlers/rotation.handler.d.ts +4 -0
  33. package/dist/types/classes/managers/anchor.manager.d.ts +39 -3
  34. package/dist/types/classes/objects/selection-group.class.d.ts +8 -1
  35. package/dist/types/constants/version.d.ts +1 -1
  36. package/dist/types/interfaces/anchor.interface.d.ts +12 -2
  37. package/dist/types/interfaces/engine-state.interface.d.ts +2 -1
  38. package/package.json +1 -1
  39. package/dist/components/p-on11Z8cZ.js +0 -9
  40. package/dist/stencil/p-63bc234f.entry.js +0 -9
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var schema_constants = require('./schema.constants-D8JoUfNc.js');
3
+ var schema_constants = require('./schema.constants-CPz_o--2.js');
4
4
  var Y = require('yjs');
5
5
  var yIndexeddb = require('y-indexeddb');
6
6
  var yWebsocket = require('y-websocket');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Xav9JFHg.js');
4
- var schema_constants = require('./schema.constants-D8JoUfNc.js');
4
+ var schema_constants = require('./schema.constants-CPz_o--2.js');
5
5
  var Y = require('yjs');
6
6
  require('y-indexeddb');
7
7
  require('y-websocket');
@@ -21616,6 +21616,7 @@ const DEFAULT_ENGINE_CONFIG = {
21616
21616
  activeTool: null,
21617
21617
  objects: null,
21618
21618
  snapCandidate: null,
21619
+ snapPreviewCandidate: null,
21619
21620
  resizeHandleType: null,
21620
21621
  lineHandleType: null,
21621
21622
  hasViewportChanged: false,
@@ -24157,6 +24158,7 @@ class KritzelClipboardManager {
24157
24158
  */
24158
24159
  regenerateIdsAndRemapAnchors(topLevel) {
24159
24160
  const all = [];
24161
+ const hasOnlyTopLevelLines = topLevel.length > 0 && topLevel.every(object => schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelLine'));
24160
24162
  const collect = (objects) => {
24161
24163
  for (const object of objects) {
24162
24164
  all.push(object);
@@ -24181,9 +24183,15 @@ class KritzelClipboardManager {
24181
24183
  if (object.startAnchor && idMap.has(object.startAnchor.objectId)) {
24182
24184
  object.startAnchor = { objectId: idMap.get(object.startAnchor.objectId) };
24183
24185
  }
24186
+ else if (hasOnlyTopLevelLines) {
24187
+ object.startAnchor = undefined;
24188
+ }
24184
24189
  if (object.endAnchor && idMap.has(object.endAnchor.objectId)) {
24185
24190
  object.endAnchor = { objectId: idMap.get(object.endAnchor.objectId) };
24186
24191
  }
24192
+ else if (hasOnlyTopLevelLines) {
24193
+ object.endAnchor = undefined;
24194
+ }
24187
24195
  }
24188
24196
  }
24189
24197
  }
@@ -29412,7 +29420,11 @@ const KritzelEngine = class {
29412
29420
  transform: object?.transformationMatrix,
29413
29421
  transformOrigin: 'top left',
29414
29422
  position: 'absolute',
29415
- zIndex: object.zIndex.toString(),
29423
+ // The object wrapper establishes its own stacking context (transform + z-index),
29424
+ // so the selection-line handles inside it cannot escape above the snap/anchor
29425
+ // layers (z-index 9999/9998) rendered later at the origin level. Lift the
29426
+ // selected line's wrapper above those layers so its handles always paint on top.
29427
+ zIndex: this.core.displaySelectionLineUI(object) ? '10001' : object.zIndex.toString(),
29416
29428
  pointerEvents: getObjectWrapperPointerEvents(object),
29417
29429
  } }, schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (index.h("svg", { ref: el => el && object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
29418
29430
  height: object?.totalHeight + 'px',
@@ -29616,10 +29628,21 @@ const KritzelEngine = class {
29616
29628
  }
29617
29629
  const selectionBorderColor = remoteUserColor ?? (schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme) || 'var(--kritzel-selection-border-color, #007AFF)');
29618
29630
  const selectionHandleStrokeColor = remoteUserColor ?? 'var(--kritzel-selection-handle-stroke-color, #007AFF)';
29631
+ const lineObject = object;
29632
+ const activeSnapCandidate = this.core.store.state.snapCandidate;
29633
+ const previewSnapCandidate = this.core.store.state.snapPreviewCandidate;
29634
+ const isStartHandleSnapped = lineObject.startAnchor != null;
29635
+ const isEndHandleSnapped = lineObject.endAnchor != null;
29636
+ const highlightedSnapCandidate = activeSnapCandidate ?? previewSnapCandidate;
29637
+ const isStartHandleSnapPreview = highlightedSnapCandidate?.endpoint === 'start';
29638
+ const isEndHandleSnapPreview = highlightedSnapCandidate?.endpoint === 'end';
29639
+ const isStartHandleHighlighted = isStartHandleSnapped || isStartHandleSnapPreview;
29640
+ const isEndHandleHighlighted = isEndHandleSnapped || isEndHandleSnapPreview;
29641
+ const selectionOverlayZIndex = this.core.displaySelectionLineUI(object) ? '10000' : (object.zIndex + 1).toString();
29619
29642
  const handleScale = object.scale ?? 1;
29620
29643
  const { canRenderResizeHandles, canRenderRotationHandle } = this.getSelectionHandleCapabilities(object);
29621
29644
  return (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", style: {
29622
- zIndex: (object.zIndex + 1).toString(),
29645
+ zIndex: selectionOverlayZIndex,
29623
29646
  height: object?.totalHeight.toString(),
29624
29647
  width: object?.totalWidth.toString(),
29625
29648
  left: '0',
@@ -29710,7 +29733,7 @@ const KritzelEngine = class {
29710
29733
  strokeLinecap: 'round',
29711
29734
  fill: 'none',
29712
29735
  } })), !this.isSelecting && !isRemoteSelection && (index.h("g", { class: "selection-line-handles", style: { pointerEvents: 'auto' } }, index.h("circle", { class: "selection-line-handle start", cx: object.startX - object.x, cy: object.startY - object.y, r: `${((baseHandleSize - 1) * object.scale) / this.core.store.state?.scale}`, style: {
29713
- fill: 'var(--kritzel-selection-handle-color, #000000)',
29736
+ fill: isStartHandleHighlighted ? selectionHandleStrokeColor : 'var(--kritzel-selection-handle-color, #000000)',
29714
29737
  stroke: selectionHandleStrokeColor,
29715
29738
  strokeWidth: `calc(2px * ${object.scale} / ${this.core.store.state?.scale})`,
29716
29739
  paintOrder: 'fill',
@@ -29734,7 +29757,7 @@ const KritzelEngine = class {
29734
29757
  fill: 'transparent',
29735
29758
  paintOrder: 'fill',
29736
29759
  } }), index.h("circle", { class: "selection-line-handle end", cx: object.endX - object.x, cy: object.endY - object.y, r: `${((baseHandleSize - 1) * object.scale) / this.core.store.state?.scale}`, style: {
29737
- fill: 'var(--kritzel-selection-handle-color, #000000)',
29760
+ fill: isEndHandleHighlighted ? selectionHandleStrokeColor : 'var(--kritzel-selection-handle-color, #000000)',
29738
29761
  stroke: selectionHandleStrokeColor,
29739
29762
  strokeWidth: `calc(2px * ${object.scale} / ${this.core.store.state?.scale})`,
29740
29763
  paintOrder: 'fill',
@@ -29744,6 +29767,36 @@ const KritzelEngine = class {
29744
29767
  } })))))));
29745
29768
  })()));
29746
29769
  }), (() => {
29770
+ const data = this.core.anchorManager.getSnapIndicatorRenderData() ?? this.core.anchorManager.getSnapPreviewRenderData();
29771
+ if (!data)
29772
+ return null;
29773
+ const isActiveSnap = this.core.anchorManager.getSnapIndicatorRenderData() != null;
29774
+ return (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "snap-indicator", style: {
29775
+ position: 'absolute',
29776
+ left: '0',
29777
+ top: '0',
29778
+ width: '1px',
29779
+ height: '1px',
29780
+ pointerEvents: 'none',
29781
+ zIndex: '9999',
29782
+ overflow: 'visible',
29783
+ } }, index.h("g", null, data.snapLinePath ? (index.h("path", { d: data.snapLinePath, fill: "none", style: {
29784
+ stroke: isActiveSnap ? 'var(--kritzel-snap-line-stroke, rgba(0, 0, 0, 0.2))' : 'var(--kritzel-snap-line-stroke, rgba(0, 0, 0, 0.12))',
29785
+ strokeWidth: data.lineStrokeWidth,
29786
+ strokeDasharray: data.dashArray,
29787
+ strokeLinecap: 'round',
29788
+ } })) : (data.edgeX !== undefined &&
29789
+ data.edgeY !== undefined && (index.h("line", { x1: data.edgeX, y1: data.edgeY, x2: data.centerX, y2: data.centerY, style: {
29790
+ stroke: isActiveSnap ? 'var(--kritzel-snap-line-stroke, rgba(0, 0, 0, 0.2))' : 'var(--kritzel-snap-line-stroke, rgba(0, 0, 0, 0.12))',
29791
+ strokeWidth: data.lineStrokeWidth,
29792
+ strokeDasharray: data.dashArray,
29793
+ strokeLinecap: 'round',
29794
+ } }))), index.h("circle", { cx: data.centerX, cy: data.centerY, r: data.indicatorRadius, style: {
29795
+ fill: isActiveSnap ? 'var(--kritzel-snap-indicator-fill, rgba(59, 130, 246, 0.3))' : 'rgba(59, 130, 246, 0.18)',
29796
+ stroke: isActiveSnap ? 'var(--kritzel-snap-indicator-stroke, #007bff)' : 'rgba(59, 130, 246, 0.5)',
29797
+ strokeWidth: data.indicatorStrokeWidth,
29798
+ } }))));
29799
+ })(), (() => {
29747
29800
  const data = this.core.anchorManager.getAnchorLinesRenderData();
29748
29801
  if (!data)
29749
29802
  return null;
@@ -29768,7 +29821,7 @@ const KritzelEngine = class {
29768
29821
  strokeDasharray: data.dashArray,
29769
29822
  strokeLinecap: 'round',
29770
29823
  } })), index.h("circle", { cx: data.startAnchorViz.centerX, cy: data.startAnchorViz.centerY, r: data.indicatorRadius, style: {
29771
- fill: 'var(--kritzel-snap-indicator-fill, rgba(0, 0, 0))',
29824
+ fill: 'var(--kritzel-snap-indicator-fill, rgba(59, 130, 246, 0.3))',
29772
29825
  stroke: 'var(--kritzel-snap-indicator-stroke, #007bff)',
29773
29826
  strokeWidth: data.indicatorStrokeWidth,
29774
29827
  } }))), data.endAnchorViz && (index.h("g", { class: "anchor-line-end" }, data.endAnchorViz.pathD ? (index.h("path", { d: data.endAnchorViz.pathD, style: {
@@ -29787,35 +29840,6 @@ const KritzelEngine = class {
29787
29840
  stroke: 'var(--kritzel-snap-indicator-stroke, #007bff)',
29788
29841
  strokeWidth: data.indicatorStrokeWidth,
29789
29842
  } })))));
29790
- })(), (() => {
29791
- const data = this.core.anchorManager.getSnapIndicatorRenderData();
29792
- if (!data)
29793
- return null;
29794
- return (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "snap-indicator", style: {
29795
- position: 'absolute',
29796
- left: '0',
29797
- top: '0',
29798
- width: '1px',
29799
- height: '1px',
29800
- pointerEvents: 'none',
29801
- zIndex: '9999',
29802
- overflow: 'visible',
29803
- } }, index.h("g", null, data.snapLinePath ? (index.h("path", { d: data.snapLinePath, fill: "none", style: {
29804
- stroke: 'var(--kritzel-snap-line-stroke, rgba(0, 0, 0, 0.2))',
29805
- strokeWidth: data.lineStrokeWidth,
29806
- strokeDasharray: data.dashArray,
29807
- strokeLinecap: 'round',
29808
- } })) : (data.edgeX !== undefined &&
29809
- data.edgeY !== undefined && (index.h("line", { x1: data.edgeX, y1: data.edgeY, x2: data.centerX, y2: data.centerY, style: {
29810
- stroke: 'var(--kritzel-snap-line-stroke, rgba(0, 0, 0, 0.2))',
29811
- strokeWidth: data.lineStrokeWidth,
29812
- strokeDasharray: data.dashArray,
29813
- strokeLinecap: 'round',
29814
- } }))), index.h("circle", { cx: data.centerX, cy: data.centerY, r: data.indicatorRadius, style: {
29815
- fill: 'var(--kritzel-snap-indicator-fill, rgba(59, 130, 246, 0.3))',
29816
- stroke: 'var(--kritzel-snap-indicator-stroke, #007bff)',
29817
- strokeWidth: data.indicatorStrokeWidth,
29818
- } }))));
29819
29843
  })()), this.core.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { class: "context-menu", ref: el => (this.contextMenuElement = el ?? null), items: this.core.store.state.contextMenuItems, objects: this.core.store.selectionGroup?.objects || [], style: {
29820
29844
  position: 'absolute',
29821
29845
  left: `${this.core.store.state.contextMenuX}px`,
@@ -31227,7 +31251,7 @@ const KritzelPortal = class {
31227
31251
  * This file is auto-generated by the version bump scripts.
31228
31252
  * Do not modify manually.
31229
31253
  */
31230
- const KRITZEL_VERSION = '0.3.24';
31254
+ const KRITZEL_VERSION = '0.3.26';
31231
31255
 
31232
31256
  const kritzelSettingsCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}.shortcuts-list{display:flex;flex-direction:column;gap:24px}.shortcuts-category{display:flex;flex-direction:column;gap:8px}.shortcuts-category-title{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.shortcuts-group{display:flex;flex-direction:column;gap:4px}.shortcut-item{display:flex;justify-content:space-between;align-items:center;padding:6px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-item-bg, rgba(0, 0, 0, 0.02))}.shortcut-label{font-size:14px;color:var(--kritzel-settings-content-text-color, #666666)}.shortcut-key{font-family:monospace;font-size:12px;padding:2px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-key-bg, #f0f0f0);color:var(--kritzel-settings-shortcut-key-color, #333333);border:1px solid var(--kritzel-settings-shortcut-key-border, #ddd)}`;
31233
31257