@sepveneto/free-dom 0.9.0 → 0.9.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/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* ../../../../../../../tmp/tmp-1880-p3aCZArVLO4k/core/src/style/index.css */
1
+ /* ../../../../../../../tmp/tmp-1888-2C7SiiG2SRG2/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);
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);
90
90
  const nodes = SceneContext.nodes;
91
91
  const lineStatus = (0, import_vue_demi2.reactive)({
92
92
  xt: {
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);
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,19 @@ 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 fixNonMonospaced = computed3(() => {
338
338
  return SceneContext?.fixNonMonospaced || props.fixNonMonospaced;
339
339
  });
340
340
  onMounted(() => {
@@ -371,9 +371,9 @@ function useSceneContext(context, props) {
371
371
  }
372
372
 
373
373
  // src/hooks/use-event-bus.ts
374
- import { ref as ref5 } from "vue-demi";
374
+ import { ref as ref4 } from "vue-demi";
375
375
  function useEventBus() {
376
- const callbacks = ref5({});
376
+ const callbacks = ref4({});
377
377
  const on = (name, cb) => {
378
378
  if (!callbacks.value[name]) {
379
379
  callbacks.value[name] = [cb];
@@ -396,10 +396,10 @@ function useEventBus() {
396
396
  }
397
397
 
398
398
  // src/hooks/use-resizable-data.ts
399
- import { ref as ref6, watchEffect as watchEffect2 } from "vue-demi";
399
+ import { ref as ref5, watchEffect as watchEffect2 } from "vue-demi";
400
400
  function useResizableData(props, domRef) {
401
- const width = ref6(getWidth());
402
- const height = ref6(getHeight());
401
+ const width = ref5(getWidth());
402
+ const height = ref5(getHeight());
403
403
  watchEffect2(() => {
404
404
  width.value = getWidth();
405
405
  });
@@ -432,22 +432,22 @@ function useResizableData(props, domRef) {
432
432
  }
433
433
 
434
434
  // src/hooks/use-layout.ts
435
- import { computed as computed3, ref as ref7, shallowRef as shallowRef2, watchEffect as watchEffect3 } from "vue-demi";
435
+ import { computed as computed4, ref as ref6, shallowRef as shallowRef2, watchEffect as watchEffect3 } from "vue-demi";
436
436
  function useLayout(props) {
437
437
  const layout = shallowRef2(props.modelValue);
438
438
  watchEffect3(() => {
439
439
  layout.value = props.modelValue;
440
440
  });
441
- const cellWidth = computed3(
441
+ const cellWidth = computed4(
442
442
  () => (props.width - margin.value[0] * (cols.value - 1) - (containerPadding.value?.[0] || margin.value[0]) * 2) / props.cols
443
443
  );
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);
444
+ const cols = computed4(() => props.cols);
445
+ const rowHeight = computed4(() => props.rowHeight);
446
+ const margin = computed4(() => props.margin);
447
+ const maxRows = computed4(() => props.maxRows);
448
+ const containerPadding = computed4(() => props.containerPadding);
449
+ const minW = computed4(() => props.minW);
450
+ const minH = computed4(() => props.minH);
451
451
  function getItem(key) {
452
452
  return layout.value.find((item) => item.i === key);
453
453
  }
@@ -682,46 +682,46 @@ function useLayout(props) {
682
682
  }
683
683
  function useLayoutItem(props, layout) {
684
684
  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(() => {
685
+ const dragging = ref6();
686
+ const resizing = ref6();
687
+ const containerPadding = computed4(() => cPadding.value || margin.value);
688
+ const x = computed4(() => {
689
689
  if (!dragging.value) {
690
690
  return Math.round(props.x * (cellWidth.value + margin.value[0]) + containerPadding.value[0]);
691
691
  } else {
692
692
  return Math.round(dragging.value.x);
693
693
  }
694
694
  });
695
- const y = computed3(() => {
695
+ const y = computed4(() => {
696
696
  if (!dragging.value) {
697
697
  return Math.round(props.y * (rowHeight.value + margin.value[1]) + containerPadding.value[1]);
698
698
  } else {
699
699
  return Math.round(dragging.value.y);
700
700
  }
701
701
  });
702
- const width = computed3(() => {
702
+ const width = computed4(() => {
703
703
  if (!resizing.value) {
704
704
  return Math.round(cellWidth.value * props.width + Math.max(0, props.width - 1) * margin.value[0]);
705
705
  } else {
706
706
  return Math.round(resizing.value.width);
707
707
  }
708
708
  });
709
- const height = computed3(() => {
709
+ const height = computed4(() => {
710
710
  if (!resizing.value) {
711
711
  return Math.round(rowHeight.value * props.height + Math.max(0, props.height - 1) * margin.value[1]);
712
712
  } else {
713
713
  return Math.round(resizing.value.height);
714
714
  }
715
715
  });
716
- const minWidth = computed3(() => {
716
+ const minWidth = computed4(() => {
717
717
  const minW = layout.minW.value;
718
718
  return Math.round(cellWidth.value * minW + Math.max(0, minW - 1) * margin.value[0]);
719
719
  });
720
- const minHeight = computed3(() => {
720
+ const minHeight = computed4(() => {
721
721
  const minH = layout.minH.value;
722
722
  return Math.round(rowHeight.value * minH + Math.max(0, minH - 1) * margin.value[1]);
723
723
  });
724
- const style = computed3(() => {
724
+ const style = computed4(() => {
725
725
  return {
726
726
  position: "absolute",
727
727
  width: `${width.value}px`,
@@ -806,10 +806,10 @@ function useLayoutItem(props, layout) {
806
806
  }
807
807
 
808
808
  // src/components/freeDom.ts
809
- import { computed as computed6, defineComponent as defineComponent4, onMounted as onMounted2, reactive as reactive2, ref as ref9 } from "vue-demi";
809
+ import { computed as computed7, defineComponent as defineComponent4, onMounted as onMounted2, reactive as reactive2, ref as ref8 } from "vue-demi";
810
810
 
811
811
  // src/components/freeDomCore.ts
812
- import { computed as computed4, defineComponent as defineComponent2, isVue2 as isVue22, onUnmounted as onUnmounted2, ref as ref8 } from "vue-demi";
812
+ import { computed as computed5, defineComponent as defineComponent2, isVue2 as isVue22, onUnmounted as onUnmounted2, ref as ref7 } from "vue-demi";
813
813
  function noop() {
814
814
  }
815
815
  var freeDomCoreProps = {
@@ -836,10 +836,10 @@ var freeDomCore = defineComponent2({
836
836
  props: freeDomCoreProps,
837
837
  setup(props) {
838
838
  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);
839
+ const dragging = ref7(false);
840
+ const coreRef = ref7();
841
+ const node = computed5(() => coreRef.value?.$el || coreRef.value);
842
+ const ownerDoc = computed5(() => node.value?.ownerDocument);
843
843
  const { lastX, lastY, create } = useCoreData(node);
844
844
  let parentNode;
845
845
  let parentRect;
@@ -969,7 +969,7 @@ var freeDomCore = defineComponent2({
969
969
  var freeDomCore_default = freeDomCore;
970
970
 
971
971
  // src/components/resizeDomCore.ts
972
- import { computed as computed5, defineComponent as defineComponent3, h as h3, shallowRef as shallowRef3 } from "vue-demi";
972
+ import { computed as computed6, defineComponent as defineComponent3, h as h3, shallowRef as shallowRef3 } from "vue-demi";
973
973
  var Dots = ["t", "r", "l", "b", "lt", "lb", "rt", "rb"];
974
974
  function noop2() {
975
975
  }
@@ -1017,7 +1017,7 @@ var resizeDomCore = defineComponent3({
1017
1017
  props: resizeDomCoreProps,
1018
1018
  setup(props, { slots }) {
1019
1019
  const { slots: _slots } = useDefaultSlot();
1020
- const dots = computed5(() => {
1020
+ const dots = computed6(() => {
1021
1021
  const _dots = props.scale;
1022
1022
  return Array.isArray(_dots) ? _dots : Dots;
1023
1023
  });
@@ -1185,7 +1185,7 @@ var freeDom = defineComponent4({
1185
1185
  "update:modelValue"
1186
1186
  ],
1187
1187
  setup(props, { emit, expose, slots }) {
1188
- const domRef = ref9();
1188
+ const domRef = ref8();
1189
1189
  const {
1190
1190
  x,
1191
1191
  y,
@@ -1218,13 +1218,13 @@ var freeDom = defineComponent4({
1218
1218
  sceneContext.minHeight.value
1219
1219
  );
1220
1220
  };
1221
- const canDrag = ref9(false);
1221
+ const canDrag = ref8(false);
1222
1222
  onMounted2(() => {
1223
1223
  props.autoSize && syncSize();
1224
1224
  const pos = sceneContext.correct(context._rect);
1225
1225
  context.trigger({ x: pos.x, y: pos.y, w: pos.width, h: pos.height });
1226
1226
  });
1227
- const style = computed6(() => ({
1227
+ const style = computed7(() => ({
1228
1228
  position: "absolute",
1229
1229
  width: `${width.value}px`,
1230
1230
  height: `${height.value}px`,
@@ -1403,9 +1403,9 @@ var FreeDomWrap = defineComponent5({
1403
1403
  const { slots } = useDefaultSlot();
1404
1404
  const eventBus = useEventBus();
1405
1405
  const rectRef = shallowRef4();
1406
- const nodes = ref10([]);
1407
- const width = ref10(props.width);
1408
- const height = ref10(props.height);
1406
+ const nodes = ref9([]);
1407
+ const width = ref9(props.width);
1408
+ const height = ref9(props.height);
1409
1409
  watchEffect4(() => {
1410
1410
  width.value = props.width;
1411
1411
  });
@@ -1487,7 +1487,7 @@ var FreeDomWrap = defineComponent5({
1487
1487
  emit: eventBus.emit
1488
1488
  })
1489
1489
  );
1490
- const style = computed7(() => ({
1490
+ const style = computed8(() => ({
1491
1491
  width: `${props.width}px`,
1492
1492
  height: `${props.height}px`
1493
1493
  }));
@@ -1512,7 +1512,7 @@ var FreeDomWrap = defineComponent5({
1512
1512
  });
1513
1513
 
1514
1514
  // src/components/gridLayout.ts
1515
- import { defineComponent as defineComponent7, h as h4, provide as provide2, ref as ref11 } from "vue-demi";
1515
+ import { defineComponent as defineComponent7, h as h4, provide as provide2, ref as ref10 } from "vue-demi";
1516
1516
 
1517
1517
  // src/components/gridItem.ts
1518
1518
  import { defineComponent as defineComponent6, inject as inject3 } from "vue-demi";
@@ -1710,7 +1710,7 @@ var GridLayout = defineComponent7({
1710
1710
  setup(props, { emit }) {
1711
1711
  const layout = useLayout(props);
1712
1712
  provide2(gridLayoutContextKey, layout);
1713
- const activeDrag = ref11(null);
1713
+ const activeDrag = ref10(null);
1714
1714
  function processItem(node) {
1715
1715
  const key = node.key;
1716
1716
  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.9.1",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",