@sepveneto/free-dom 0.9.0 → 0.10.0

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/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* ../../../../../../../tmp/tmp-1880-p3aCZArVLO4k/core/src/style/index.css */
1
+ /* ../../../../../../../tmp/tmp-1954-fWPtLbls0CBY/core/src/style/index.css */
2
2
  :root {
3
3
  --vv-free-dom--theme: #4089ef;
4
4
  --vv-free-dom--line: var(--vv-free-dom--theme);
@@ -59,8 +59,12 @@
59
59
  border-bottom: 2px solid rgba(0, 0, 0, 0.4);
60
60
  }
61
61
  .vv-free-dom--draggable {
62
+ position: absolute;
62
63
  cursor: move;
63
64
  }
65
+ .vv-free-dom--draggable__disabled {
66
+ cursor: initial;
67
+ }
64
68
  .vv-free-dom--line {
65
69
  background: var(--vv-free-dom--line);
66
70
  position: absolute;
package/dist/index.d.ts CHANGED
@@ -30,6 +30,10 @@ declare const freeDomCoreProps: {
30
30
  default: typeof noop$1;
31
31
  };
32
32
  disabled: BooleanConstructor;
33
+ scale: {
34
+ type: NumberConstructor;
35
+ default: number;
36
+ };
33
37
  };
34
38
  type FreeDomCoreProps = ExtractPropTypes<typeof freeDomCoreProps>;
35
39
 
@@ -113,6 +117,10 @@ declare const FreeScene: vue_demi.DefineComponent<{
113
117
  type: BooleanConstructor;
114
118
  default: boolean;
115
119
  };
120
+ transformScale: {
121
+ type: NumberConstructor;
122
+ default: number;
123
+ };
116
124
  handle: {
117
125
  type: StringConstructor;
118
126
  default: undefined;
@@ -159,6 +167,10 @@ declare const FreeScene: vue_demi.DefineComponent<{
159
167
  type: BooleanConstructor;
160
168
  default: boolean;
161
169
  };
170
+ transformScale: {
171
+ type: NumberConstructor;
172
+ default: number;
173
+ };
162
174
  handle: {
163
175
  type: StringConstructor;
164
176
  default: undefined;
@@ -180,17 +192,18 @@ declare const FreeScene: vue_demi.DefineComponent<{
180
192
  };
181
193
  fixNonMonospaced: BooleanConstructor;
182
194
  }>>, {
195
+ scale: boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[];
183
196
  width: number;
184
197
  height: number;
185
198
  diff: number;
186
199
  showLine: boolean;
200
+ transformScale: number;
187
201
  handle: string;
188
202
  minWidth: number;
189
203
  minHeight: number;
190
204
  lockAspectRatio: boolean;
191
205
  disabledDrag: boolean;
192
206
  disabledResize: boolean;
193
- scale: boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[];
194
207
  fixNonMonospaced: boolean;
195
208
  }, {}>;
196
209
  declare const GridLayout: vue_demi.DefineComponent<{
@@ -397,6 +410,10 @@ declare const FreeDom: vue_demi.DefineComponent<{
397
410
  type: vue_demi.PropType<boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[]>;
398
411
  default: undefined;
399
412
  };
413
+ transformScale: {
414
+ type: NumberConstructor;
415
+ default: number;
416
+ };
400
417
  fixNonMonospaced: BooleanConstructor;
401
418
  }, {
402
419
  domRef: vue_demi.Ref<({
@@ -408,6 +425,7 @@ declare const FreeDom: vue_demi.DefineComponent<{
408
425
  stopFn?: CoreFnCallback | undefined;
409
426
  dragFn?: CoreFnCallback | undefined;
410
427
  disabled?: boolean | undefined;
428
+ scale?: number | undefined;
411
429
  key?: string | number | symbol | undefined;
412
430
  style?: unknown;
413
431
  ref?: vue_demi.VNodeRef | undefined;
@@ -484,6 +502,10 @@ declare const FreeDom: vue_demi.DefineComponent<{
484
502
  default: () => void;
485
503
  };
486
504
  disabled: BooleanConstructor;
505
+ scale: {
506
+ type: NumberConstructor;
507
+ default: number;
508
+ };
487
509
  }>>, {
488
510
  only: vue_demi.ComputedRef<vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
489
511
  [key: string]: any;
@@ -497,6 +519,7 @@ declare const FreeDom: vue_demi.DefineComponent<{
497
519
  stopFn: CoreFnCallback;
498
520
  dragFn: CoreFnCallback;
499
521
  disabled: boolean;
522
+ scale: number;
500
523
  }, {}, string, {}> & {
501
524
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
502
525
  created?: ((() => void) | (() => void)[]) | undefined;
@@ -535,6 +558,10 @@ declare const FreeDom: vue_demi.DefineComponent<{
535
558
  default: () => void;
536
559
  };
537
560
  disabled: BooleanConstructor;
561
+ scale: {
562
+ type: NumberConstructor;
563
+ default: number;
564
+ };
538
565
  }>> & vue_demi.ShallowUnwrapRef<{
539
566
  only: vue_demi.ComputedRef<vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
540
567
  [key: string]: any;
@@ -544,7 +571,6 @@ declare const FreeDom: vue_demi.DefineComponent<{
544
571
  mouseupFn: (evt: MouseEvent) => void;
545
572
  }> & {} & vue_demi.ComponentCustomProperties & {}) | undefined>;
546
573
  style: vue_demi.ComputedRef<{
547
- position: string;
548
574
  width: string;
549
575
  height: string;
550
576
  transform: string;
@@ -629,6 +655,10 @@ declare const FreeDom: vue_demi.DefineComponent<{
629
655
  type: vue_demi.PropType<boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[]>;
630
656
  default: undefined;
631
657
  };
658
+ transformScale: {
659
+ type: NumberConstructor;
660
+ default: number;
661
+ };
632
662
  fixNonMonospaced: BooleanConstructor;
633
663
  }>> & {
634
664
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -640,15 +670,16 @@ declare const FreeDom: vue_demi.DefineComponent<{
640
670
  x: number;
641
671
  y: number;
642
672
  dragFn: CoreFnCallback;
673
+ scale: boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[];
643
674
  width: number;
644
675
  height: number;
676
+ transformScale: number;
645
677
  handle: string;
646
678
  minWidth: number;
647
679
  minHeight: number;
648
680
  lockAspectRatio: boolean;
649
681
  disabledDrag: boolean;
650
682
  disabledResize: boolean;
651
- scale: boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[];
652
683
  fixNonMonospaced: boolean;
653
684
  modelValue: Partial<{
654
685
  x: number;
@@ -681,6 +712,10 @@ declare const FreeDomCore: vue_demi.DefineComponent<{
681
712
  default: () => void;
682
713
  };
683
714
  disabled: BooleanConstructor;
715
+ scale: {
716
+ type: NumberConstructor;
717
+ default: number;
718
+ };
684
719
  }, {
685
720
  only: vue_demi.ComputedRef<vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
686
721
  [key: string]: any;
@@ -706,12 +741,17 @@ declare const FreeDomCore: vue_demi.DefineComponent<{
706
741
  default: () => void;
707
742
  };
708
743
  disabled: BooleanConstructor;
744
+ scale: {
745
+ type: NumberConstructor;
746
+ default: number;
747
+ };
709
748
  }>>, {
710
749
  userSelectHack: boolean;
711
750
  startFn: CoreFnCallback;
712
751
  stopFn: CoreFnCallback;
713
752
  dragFn: CoreFnCallback;
714
753
  disabled: boolean;
754
+ scale: number;
715
755
  }, {}>;
716
756
  declare const ResizeDomCore: vue_demi.DefineComponent<{
717
757
  dragOpts: {
@@ -803,12 +843,12 @@ declare const ResizeDomCore: vue_demi.DefineComponent<{
803
843
  }>>, {
804
844
  startFn: ResizeFnCallback;
805
845
  stopFn: ResizeFnCallback;
846
+ scale: boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[];
806
847
  width: number;
807
848
  height: number;
808
849
  minWidth: number;
809
850
  minHeight: number;
810
851
  lockAspectRatio: boolean;
811
- scale: boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[];
812
852
  resizeFn: ResizeFnCallback;
813
853
  dragOpts: Partial<FreeDomCoreProps>;
814
854
  }, {}>;
package/dist/index.js CHANGED
@@ -86,7 +86,7 @@ var markLine_default = (0, import_vue_demi2.defineComponent)({
86
86
  setup() {
87
87
  const SceneContext = (0, import_vue_demi2.inject)(SceneToken);
88
88
  const lines = (0, import_vue_demi2.shallowRef)(lineType);
89
- const diff = (0, import_vue_demi2.ref)(SceneContext.diff);
89
+ const diff = (0, import_vue_demi2.computed)(() => SceneContext.diff / SceneContext.transformScale);
90
90
  const nodes = SceneContext.nodes;
91
91
  const lineStatus = (0, import_vue_demi2.reactive)({
92
92
  xt: {
@@ -364,6 +364,7 @@ function useSceneContext(context, props) {
364
364
  const disabledDrag = (0, import_vue_demi7.computed)(() => SceneContext?.disabledDrag || props.disabledDrag);
365
365
  const disabledResize = (0, import_vue_demi7.computed)(() => SceneContext?.disabledResize || props.disabledResize);
366
366
  const scale = (0, import_vue_demi7.computed)(() => SceneContext?.scale || props.scale);
367
+ const transformScale = (0, import_vue_demi7.computed)(() => SceneContext?.transformScale || props.transformScale);
367
368
  const fixNonMonospaced = (0, import_vue_demi7.computed)(() => {
368
369
  return SceneContext?.fixNonMonospaced || props.fixNonMonospaced;
369
370
  });
@@ -396,7 +397,8 @@ function useSceneContext(context, props) {
396
397
  minHeight,
397
398
  disabledDrag,
398
399
  disabledResize,
399
- fixNonMonospaced
400
+ fixNonMonospaced,
401
+ transformScale
400
402
  };
401
403
  }
402
404
 
@@ -859,7 +861,11 @@ var freeDomCoreProps = {
859
861
  type: Function,
860
862
  default: noop
861
863
  },
862
- disabled: Boolean
864
+ disabled: Boolean,
865
+ scale: {
866
+ type: Number,
867
+ default: 1
868
+ }
863
869
  };
864
870
  var freeDomCore = (0, import_vue_demi11.defineComponent)({
865
871
  name: "FreeDomCore",
@@ -952,8 +958,8 @@ var freeDomCore = (0, import_vue_demi11.defineComponent)({
952
958
  parentNode = parent;
953
959
  parentRect = isBody ? { left: 0, top: 0 } : parent.getBoundingClientRect();
954
960
  }
955
- const x = evt.clientX + parent.scrollLeft - parentRect.left;
956
- const y = evt.clientY + parent.scrollTop - parentRect.top;
961
+ const x = (evt.clientX + parent.scrollLeft - parentRect.left) / props.scale;
962
+ const y = (evt.clientY + parent.scrollTop - parentRect.top) / props.scale;
957
963
  return { x, y };
958
964
  }
959
965
  return {
@@ -1202,6 +1208,10 @@ var freeDomProps = {
1202
1208
  disabledDrag: Boolean,
1203
1209
  disabledResize: Boolean,
1204
1210
  scale: resizeDomCoreProps.scale,
1211
+ transformScale: {
1212
+ type: Number,
1213
+ default: 1
1214
+ },
1205
1215
  fixNonMonospaced: Boolean
1206
1216
  };
1207
1217
  var freeDom = (0, import_vue_demi13.defineComponent)({
@@ -1255,7 +1265,6 @@ var freeDom = (0, import_vue_demi13.defineComponent)({
1255
1265
  context.trigger({ x: pos.x, y: pos.y, w: pos.width, h: pos.height });
1256
1266
  });
1257
1267
  const style = (0, import_vue_demi13.computed)(() => ({
1258
- position: "absolute",
1259
1268
  width: `${width.value}px`,
1260
1269
  height: `${height.value}px`,
1261
1270
  transform: `translate(${x.value}px, ${y.value}px)`
@@ -1355,7 +1364,10 @@ var freeDom = (0, import_vue_demi13.defineComponent)({
1355
1364
  width: width.value,
1356
1365
  height: height.value,
1357
1366
  lockAspectRatio: sceneContext.lockAspectRatio.value,
1358
- dragOpts: { disabled: sceneContext.disabledResize.value },
1367
+ dragOpts: {
1368
+ disabled: sceneContext.disabledResize.value,
1369
+ scale: sceneContext.transformScale.value
1370
+ },
1359
1371
  startFn: onResizeStart,
1360
1372
  resizeFn: onResize,
1361
1373
  stopFn: onResizeStop,
@@ -1390,7 +1402,7 @@ var freeDom = (0, import_vue_demi13.defineComponent)({
1390
1402
  freeDomCore_default,
1391
1403
  {
1392
1404
  ref: "domRef",
1393
- class: "vv-free-dom--draggable",
1405
+ class: ["vv-free-dom--draggable", this.disabled && "vv-free-dom--draggable__disabled"],
1394
1406
  style: this.style
1395
1407
  },
1396
1408
  props
@@ -1417,6 +1429,10 @@ var freeDomWrapProps = {
1417
1429
  type: Boolean,
1418
1430
  default: true
1419
1431
  },
1432
+ transformScale: {
1433
+ type: Number,
1434
+ default: 1
1435
+ },
1420
1436
  handle: freeDomProps.handle,
1421
1437
  minWidth: freeDomProps.minWidth,
1422
1438
  minHeight: freeDomProps.minHeight,
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/components/freeDomWrap.ts
2
- import { computed as computed7, defineComponent as defineComponent5, onMounted as onMounted3, provide, reactive as reactive3, ref as ref10, shallowRef as shallowRef4, toRefs, watchEffect as watchEffect4 } from "vue-demi";
2
+ import { computed as computed8, defineComponent as defineComponent5, onMounted as onMounted3, provide, reactive as reactive3, ref as ref9, shallowRef as shallowRef4, toRefs, watchEffect as watchEffect4 } from "vue-demi";
3
3
 
4
4
  // src/util/tokens.ts
5
5
  var SceneToken = Symbol("Scene");
@@ -47,7 +47,7 @@ function log(...args) {
47
47
  }
48
48
 
49
49
  // src/components/markLine.ts
50
- import { defineComponent, h as h2, inject, onBeforeUnmount, reactive, ref, shallowRef } from "vue-demi";
50
+ import { computed, defineComponent, h as h2, inject, onBeforeUnmount, reactive, shallowRef } from "vue-demi";
51
51
  var lineType = ["xt", "xc", "xb", "yl", "yc", "yr"];
52
52
  var markLine_default = defineComponent({
53
53
  props: {
@@ -56,7 +56,7 @@ var markLine_default = defineComponent({
56
56
  setup() {
57
57
  const SceneContext = inject(SceneToken);
58
58
  const lines = shallowRef(lineType);
59
- const diff = ref(SceneContext.diff);
59
+ const diff = computed(() => SceneContext.diff / SceneContext.transformScale);
60
60
  const nodes = SceneContext.nodes;
61
61
  const lineStatus = reactive({
62
62
  xt: {
@@ -214,16 +214,16 @@ var markLine_default = defineComponent({
214
214
  });
215
215
 
216
216
  // src/hooks/use-normalize-style.ts
217
- import { ref as ref2, unref, watch } from "vue-demi";
217
+ import { ref, unref, watch } from "vue-demi";
218
218
 
219
219
  // src/hooks/use-default-slot.ts
220
- import { computed, useSlots } from "vue-demi";
220
+ import { computed as computed2, useSlots } from "vue-demi";
221
221
  function useDefaultSlot() {
222
222
  const slots = useSlots();
223
- const slotList = computed(() => {
223
+ const slotList = computed2(() => {
224
224
  return typeof slots.default === "function" ? slots.default() : slots.default;
225
225
  });
226
- const only = computed(() => slotList.value?.[0]);
226
+ const only = computed2(() => slotList.value?.[0]);
227
227
  return {
228
228
  slots: slotList,
229
229
  only
@@ -231,10 +231,10 @@ function useDefaultSlot() {
231
231
  }
232
232
 
233
233
  // src/hooks/use-core-date.ts
234
- import { ref as ref3, unref as unref2 } from "vue-demi";
234
+ import { ref as ref2, unref as unref2 } from "vue-demi";
235
235
  function useCoreData(node) {
236
- const lastX = ref3(NaN);
237
- const lastY = ref3(NaN);
236
+ const lastX = ref2(NaN);
237
+ const lastY = ref2(NaN);
238
238
  function create(x, y) {
239
239
  const isStart = isNaN(lastX.value);
240
240
  const _node = unref2(node);
@@ -271,13 +271,13 @@ function useCoreData(node) {
271
271
  }
272
272
 
273
273
  // src/hooks/use-draggable-data.ts
274
- import { ref as ref4, watchEffect } from "vue-demi";
274
+ import { ref as ref3, watchEffect } from "vue-demi";
275
275
  function useDraggableData(props) {
276
- const x = ref4(props.x || props.modelValue.x || 0);
277
- const y = ref4(props.y || props.modelValue.y || 0);
278
- const deltaX = ref4(0);
279
- const deltaY = ref4(0);
280
- const dragData = ref4();
276
+ const x = ref3(props.x || props.modelValue.x || 0);
277
+ const y = ref3(props.y || props.modelValue.y || 0);
278
+ const deltaX = ref3(0);
279
+ const deltaY = ref3(0);
280
+ const dragData = ref3();
281
281
  watchEffect(() => {
282
282
  x.value = props.x || props.modelValue.x || 0;
283
283
  });
@@ -322,19 +322,20 @@ function useDraggableData(props) {
322
322
  }
323
323
 
324
324
  // src/hooks/use-scene-context.ts
325
- import { computed as computed2, inject as inject2, onMounted, onUnmounted } from "vue-demi";
325
+ import { computed as computed3, inject as inject2, onMounted, onUnmounted } from "vue-demi";
326
326
  var id = 0;
327
327
  function useSceneContext(context, props) {
328
328
  const SceneContext = inject2(SceneToken, void 0);
329
329
  const uuid = id++;
330
- const handle = computed2(() => SceneContext?.handle || props.handle);
331
- const lockAspectRatio = computed2(() => SceneContext?.lockAspectRatio || props.lockAspectRatio);
332
- const minWidth = computed2(() => SceneContext?.minWidth || props.minWidth);
333
- const minHeight = computed2(() => SceneContext?.minHeight || props.minHeight);
334
- const disabledDrag = computed2(() => SceneContext?.disabledDrag || props.disabledDrag);
335
- const disabledResize = computed2(() => SceneContext?.disabledResize || props.disabledResize);
336
- const scale = computed2(() => SceneContext?.scale || props.scale);
337
- const fixNonMonospaced = computed2(() => {
330
+ const handle = computed3(() => SceneContext?.handle || props.handle);
331
+ const lockAspectRatio = computed3(() => SceneContext?.lockAspectRatio || props.lockAspectRatio);
332
+ const minWidth = computed3(() => SceneContext?.minWidth || props.minWidth);
333
+ const minHeight = computed3(() => SceneContext?.minHeight || props.minHeight);
334
+ const disabledDrag = computed3(() => SceneContext?.disabledDrag || props.disabledDrag);
335
+ const disabledResize = computed3(() => SceneContext?.disabledResize || props.disabledResize);
336
+ const scale = computed3(() => SceneContext?.scale || props.scale);
337
+ const transformScale = computed3(() => SceneContext?.transformScale || props.transformScale);
338
+ const fixNonMonospaced = computed3(() => {
338
339
  return SceneContext?.fixNonMonospaced || props.fixNonMonospaced;
339
340
  });
340
341
  onMounted(() => {
@@ -366,14 +367,15 @@ function useSceneContext(context, props) {
366
367
  minHeight,
367
368
  disabledDrag,
368
369
  disabledResize,
369
- fixNonMonospaced
370
+ fixNonMonospaced,
371
+ transformScale
370
372
  };
371
373
  }
372
374
 
373
375
  // src/hooks/use-event-bus.ts
374
- import { ref as ref5 } from "vue-demi";
376
+ import { ref as ref4 } from "vue-demi";
375
377
  function useEventBus() {
376
- const callbacks = ref5({});
378
+ const callbacks = ref4({});
377
379
  const on = (name, cb) => {
378
380
  if (!callbacks.value[name]) {
379
381
  callbacks.value[name] = [cb];
@@ -396,10 +398,10 @@ function useEventBus() {
396
398
  }
397
399
 
398
400
  // src/hooks/use-resizable-data.ts
399
- import { ref as ref6, watchEffect as watchEffect2 } from "vue-demi";
401
+ import { ref as ref5, watchEffect as watchEffect2 } from "vue-demi";
400
402
  function useResizableData(props, domRef) {
401
- const width = ref6(getWidth());
402
- const height = ref6(getHeight());
403
+ const width = ref5(getWidth());
404
+ const height = ref5(getHeight());
403
405
  watchEffect2(() => {
404
406
  width.value = getWidth();
405
407
  });
@@ -432,22 +434,22 @@ function useResizableData(props, domRef) {
432
434
  }
433
435
 
434
436
  // src/hooks/use-layout.ts
435
- import { computed as computed3, ref as ref7, shallowRef as shallowRef2, watchEffect as watchEffect3 } from "vue-demi";
437
+ import { computed as computed4, ref as ref6, shallowRef as shallowRef2, watchEffect as watchEffect3 } from "vue-demi";
436
438
  function useLayout(props) {
437
439
  const layout = shallowRef2(props.modelValue);
438
440
  watchEffect3(() => {
439
441
  layout.value = props.modelValue;
440
442
  });
441
- const cellWidth = computed3(
443
+ const cellWidth = computed4(
442
444
  () => (props.width - margin.value[0] * (cols.value - 1) - (containerPadding.value?.[0] || margin.value[0]) * 2) / props.cols
443
445
  );
444
- const cols = computed3(() => props.cols);
445
- const rowHeight = computed3(() => props.rowHeight);
446
- const margin = computed3(() => props.margin);
447
- const maxRows = computed3(() => props.maxRows);
448
- const containerPadding = computed3(() => props.containerPadding);
449
- const minW = computed3(() => props.minW);
450
- const minH = computed3(() => props.minH);
446
+ const cols = computed4(() => props.cols);
447
+ const rowHeight = computed4(() => props.rowHeight);
448
+ const margin = computed4(() => props.margin);
449
+ const maxRows = computed4(() => props.maxRows);
450
+ const containerPadding = computed4(() => props.containerPadding);
451
+ const minW = computed4(() => props.minW);
452
+ const minH = computed4(() => props.minH);
451
453
  function getItem(key) {
452
454
  return layout.value.find((item) => item.i === key);
453
455
  }
@@ -682,46 +684,46 @@ function useLayout(props) {
682
684
  }
683
685
  function useLayoutItem(props, layout) {
684
686
  const { cellWidth, margin, rowHeight, cols, maxRows, containerPadding: cPadding } = layout;
685
- const dragging = ref7();
686
- const resizing = ref7();
687
- const containerPadding = computed3(() => cPadding.value || margin.value);
688
- const x = computed3(() => {
687
+ const dragging = ref6();
688
+ const resizing = ref6();
689
+ const containerPadding = computed4(() => cPadding.value || margin.value);
690
+ const x = computed4(() => {
689
691
  if (!dragging.value) {
690
692
  return Math.round(props.x * (cellWidth.value + margin.value[0]) + containerPadding.value[0]);
691
693
  } else {
692
694
  return Math.round(dragging.value.x);
693
695
  }
694
696
  });
695
- const y = computed3(() => {
697
+ const y = computed4(() => {
696
698
  if (!dragging.value) {
697
699
  return Math.round(props.y * (rowHeight.value + margin.value[1]) + containerPadding.value[1]);
698
700
  } else {
699
701
  return Math.round(dragging.value.y);
700
702
  }
701
703
  });
702
- const width = computed3(() => {
704
+ const width = computed4(() => {
703
705
  if (!resizing.value) {
704
706
  return Math.round(cellWidth.value * props.width + Math.max(0, props.width - 1) * margin.value[0]);
705
707
  } else {
706
708
  return Math.round(resizing.value.width);
707
709
  }
708
710
  });
709
- const height = computed3(() => {
711
+ const height = computed4(() => {
710
712
  if (!resizing.value) {
711
713
  return Math.round(rowHeight.value * props.height + Math.max(0, props.height - 1) * margin.value[1]);
712
714
  } else {
713
715
  return Math.round(resizing.value.height);
714
716
  }
715
717
  });
716
- const minWidth = computed3(() => {
718
+ const minWidth = computed4(() => {
717
719
  const minW = layout.minW.value;
718
720
  return Math.round(cellWidth.value * minW + Math.max(0, minW - 1) * margin.value[0]);
719
721
  });
720
- const minHeight = computed3(() => {
722
+ const minHeight = computed4(() => {
721
723
  const minH = layout.minH.value;
722
724
  return Math.round(rowHeight.value * minH + Math.max(0, minH - 1) * margin.value[1]);
723
725
  });
724
- const style = computed3(() => {
726
+ const style = computed4(() => {
725
727
  return {
726
728
  position: "absolute",
727
729
  width: `${width.value}px`,
@@ -806,10 +808,10 @@ function useLayoutItem(props, layout) {
806
808
  }
807
809
 
808
810
  // src/components/freeDom.ts
809
- import { computed as computed6, defineComponent as defineComponent4, onMounted as onMounted2, reactive as reactive2, ref as ref9 } from "vue-demi";
811
+ import { computed as computed7, defineComponent as defineComponent4, onMounted as onMounted2, reactive as reactive2, ref as ref8 } from "vue-demi";
810
812
 
811
813
  // src/components/freeDomCore.ts
812
- import { computed as computed4, defineComponent as defineComponent2, isVue2 as isVue22, onUnmounted as onUnmounted2, ref as ref8 } from "vue-demi";
814
+ import { computed as computed5, defineComponent as defineComponent2, isVue2 as isVue22, onUnmounted as onUnmounted2, ref as ref7 } from "vue-demi";
813
815
  function noop() {
814
816
  }
815
817
  var freeDomCoreProps = {
@@ -829,17 +831,21 @@ var freeDomCoreProps = {
829
831
  type: Function,
830
832
  default: noop
831
833
  },
832
- disabled: Boolean
834
+ disabled: Boolean,
835
+ scale: {
836
+ type: Number,
837
+ default: 1
838
+ }
833
839
  };
834
840
  var freeDomCore = defineComponent2({
835
841
  name: "FreeDomCore",
836
842
  props: freeDomCoreProps,
837
843
  setup(props) {
838
844
  const { only } = useDefaultSlot();
839
- const dragging = ref8(false);
840
- const coreRef = ref8();
841
- const node = computed4(() => coreRef.value?.$el || coreRef.value);
842
- const ownerDoc = computed4(() => node.value?.ownerDocument);
845
+ const dragging = ref7(false);
846
+ const coreRef = ref7();
847
+ const node = computed5(() => coreRef.value?.$el || coreRef.value);
848
+ const ownerDoc = computed5(() => node.value?.ownerDocument);
843
849
  const { lastX, lastY, create } = useCoreData(node);
844
850
  let parentNode;
845
851
  let parentRect;
@@ -922,8 +928,8 @@ var freeDomCore = defineComponent2({
922
928
  parentNode = parent;
923
929
  parentRect = isBody ? { left: 0, top: 0 } : parent.getBoundingClientRect();
924
930
  }
925
- const x = evt.clientX + parent.scrollLeft - parentRect.left;
926
- const y = evt.clientY + parent.scrollTop - parentRect.top;
931
+ const x = (evt.clientX + parent.scrollLeft - parentRect.left) / props.scale;
932
+ const y = (evt.clientY + parent.scrollTop - parentRect.top) / props.scale;
927
933
  return { x, y };
928
934
  }
929
935
  return {
@@ -969,7 +975,7 @@ var freeDomCore = defineComponent2({
969
975
  var freeDomCore_default = freeDomCore;
970
976
 
971
977
  // src/components/resizeDomCore.ts
972
- import { computed as computed5, defineComponent as defineComponent3, h as h3, shallowRef as shallowRef3 } from "vue-demi";
978
+ import { computed as computed6, defineComponent as defineComponent3, h as h3, shallowRef as shallowRef3 } from "vue-demi";
973
979
  var Dots = ["t", "r", "l", "b", "lt", "lb", "rt", "rb"];
974
980
  function noop2() {
975
981
  }
@@ -1017,7 +1023,7 @@ var resizeDomCore = defineComponent3({
1017
1023
  props: resizeDomCoreProps,
1018
1024
  setup(props, { slots }) {
1019
1025
  const { slots: _slots } = useDefaultSlot();
1020
- const dots = computed5(() => {
1026
+ const dots = computed6(() => {
1021
1027
  const _dots = props.scale;
1022
1028
  return Array.isArray(_dots) ? _dots : Dots;
1023
1029
  });
@@ -1172,6 +1178,10 @@ var freeDomProps = {
1172
1178
  disabledDrag: Boolean,
1173
1179
  disabledResize: Boolean,
1174
1180
  scale: resizeDomCoreProps.scale,
1181
+ transformScale: {
1182
+ type: Number,
1183
+ default: 1
1184
+ },
1175
1185
  fixNonMonospaced: Boolean
1176
1186
  };
1177
1187
  var freeDom = defineComponent4({
@@ -1185,7 +1195,7 @@ var freeDom = defineComponent4({
1185
1195
  "update:modelValue"
1186
1196
  ],
1187
1197
  setup(props, { emit, expose, slots }) {
1188
- const domRef = ref9();
1198
+ const domRef = ref8();
1189
1199
  const {
1190
1200
  x,
1191
1201
  y,
@@ -1218,14 +1228,13 @@ var freeDom = defineComponent4({
1218
1228
  sceneContext.minHeight.value
1219
1229
  );
1220
1230
  };
1221
- const canDrag = ref9(false);
1231
+ const canDrag = ref8(false);
1222
1232
  onMounted2(() => {
1223
1233
  props.autoSize && syncSize();
1224
1234
  const pos = sceneContext.correct(context._rect);
1225
1235
  context.trigger({ x: pos.x, y: pos.y, w: pos.width, h: pos.height });
1226
1236
  });
1227
- const style = computed6(() => ({
1228
- position: "absolute",
1237
+ const style = computed7(() => ({
1229
1238
  width: `${width.value}px`,
1230
1239
  height: `${height.value}px`,
1231
1240
  transform: `translate(${x.value}px, ${y.value}px)`
@@ -1325,7 +1334,10 @@ var freeDom = defineComponent4({
1325
1334
  width: width.value,
1326
1335
  height: height.value,
1327
1336
  lockAspectRatio: sceneContext.lockAspectRatio.value,
1328
- dragOpts: { disabled: sceneContext.disabledResize.value },
1337
+ dragOpts: {
1338
+ disabled: sceneContext.disabledResize.value,
1339
+ scale: sceneContext.transformScale.value
1340
+ },
1329
1341
  startFn: onResizeStart,
1330
1342
  resizeFn: onResize,
1331
1343
  stopFn: onResizeStop,
@@ -1360,7 +1372,7 @@ var freeDom = defineComponent4({
1360
1372
  freeDomCore_default,
1361
1373
  {
1362
1374
  ref: "domRef",
1363
- class: "vv-free-dom--draggable",
1375
+ class: ["vv-free-dom--draggable", this.disabled && "vv-free-dom--draggable__disabled"],
1364
1376
  style: this.style
1365
1377
  },
1366
1378
  props
@@ -1387,6 +1399,10 @@ var freeDomWrapProps = {
1387
1399
  type: Boolean,
1388
1400
  default: true
1389
1401
  },
1402
+ transformScale: {
1403
+ type: Number,
1404
+ default: 1
1405
+ },
1390
1406
  handle: freeDomProps.handle,
1391
1407
  minWidth: freeDomProps.minWidth,
1392
1408
  minHeight: freeDomProps.minHeight,
@@ -1403,9 +1419,9 @@ var FreeDomWrap = defineComponent5({
1403
1419
  const { slots } = useDefaultSlot();
1404
1420
  const eventBus = useEventBus();
1405
1421
  const rectRef = shallowRef4();
1406
- const nodes = ref10([]);
1407
- const width = ref10(props.width);
1408
- const height = ref10(props.height);
1422
+ const nodes = ref9([]);
1423
+ const width = ref9(props.width);
1424
+ const height = ref9(props.height);
1409
1425
  watchEffect4(() => {
1410
1426
  width.value = props.width;
1411
1427
  });
@@ -1487,7 +1503,7 @@ var FreeDomWrap = defineComponent5({
1487
1503
  emit: eventBus.emit
1488
1504
  })
1489
1505
  );
1490
- const style = computed7(() => ({
1506
+ const style = computed8(() => ({
1491
1507
  width: `${props.width}px`,
1492
1508
  height: `${props.height}px`
1493
1509
  }));
@@ -1512,7 +1528,7 @@ var FreeDomWrap = defineComponent5({
1512
1528
  });
1513
1529
 
1514
1530
  // src/components/gridLayout.ts
1515
- import { defineComponent as defineComponent7, h as h4, provide as provide2, ref as ref11 } from "vue-demi";
1531
+ import { defineComponent as defineComponent7, h as h4, provide as provide2, ref as ref10 } from "vue-demi";
1516
1532
 
1517
1533
  // src/components/gridItem.ts
1518
1534
  import { defineComponent as defineComponent6, inject as inject3 } from "vue-demi";
@@ -1710,7 +1726,7 @@ var GridLayout = defineComponent7({
1710
1726
  setup(props, { emit }) {
1711
1727
  const layout = useLayout(props);
1712
1728
  provide2(gridLayoutContextKey, layout);
1713
- const activeDrag = ref11(null);
1729
+ const activeDrag = ref10(null);
1714
1730
  function processItem(node) {
1715
1731
  const key = node.key;
1716
1732
  if (!key)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sepveneto/free-dom",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",