@sepveneto/free-dom 0.12.5 → 0.12.7

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-2033-Gdg1v2Xs1Hrq/core/src/style/index.css */
1
+ /* ../../../../../../../tmp/tmp-1960-Uznj1NL705hQ/core/src/style/index.css */
2
2
  :root {
3
3
  --vv-free-dom--theme: rgb(64, 137, 239);
4
4
  --vv-free-dom--line: var(--vv-free-dom--theme);
package/dist/index.d.ts CHANGED
@@ -105,6 +105,7 @@ declare const FreeScene: vue.DefineComponent<vue.ExtractPropTypes<{
105
105
  type: NumberConstructor;
106
106
  default: number;
107
107
  };
108
+ manualDiff: BooleanConstructor;
108
109
  showLine: {
109
110
  type: BooleanConstructor;
110
111
  default: boolean;
@@ -164,6 +165,7 @@ declare const FreeScene: vue.DefineComponent<vue.ExtractPropTypes<{
164
165
  type: NumberConstructor;
165
166
  default: number;
166
167
  };
168
+ manualDiff: BooleanConstructor;
167
169
  showLine: {
168
170
  type: BooleanConstructor;
169
171
  default: boolean;
@@ -201,6 +203,7 @@ declare const FreeScene: vue.DefineComponent<vue.ExtractPropTypes<{
201
203
  }>, {
202
204
  scale: boolean | ("t" | "r" | "l" | "b" | "lt" | "lb" | "rt" | "rb")[];
203
205
  diff: number;
206
+ manualDiff: boolean;
204
207
  showLine: boolean;
205
208
  transformScale: number;
206
209
  keyboard: boolean;
@@ -393,6 +396,10 @@ declare const FreeDom: vue.DefineComponent<vue.ExtractPropTypes<{
393
396
  }>>;
394
397
  default: () => {};
395
398
  };
399
+ active: {
400
+ type: BooleanConstructor;
401
+ default: undefined;
402
+ };
396
403
  keyboard: BooleanConstructor;
397
404
  x: {
398
405
  type: NumberConstructor;
@@ -627,7 +634,7 @@ declare const FreeDom: vue.DefineComponent<vue.ExtractPropTypes<{
627
634
  handleSelect: (evt: MouseEvent) => void;
628
635
  disabled: vue.ComputedRef<boolean>;
629
636
  scale: vue.ComputedRef<number>;
630
- }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("update:modelValue" | "update:width" | "update:height" | "update:x" | "update:y")[], "update:modelValue" | "update:width" | "update:height" | "update:x" | "update:y", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
637
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("update:modelValue" | "update:width" | "update:height" | "update:x" | "update:y" | "select")[], "update:modelValue" | "update:width" | "update:height" | "update:x" | "update:y" | "select", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
631
638
  modelValue: {
632
639
  type: vue.PropType<Partial<{
633
640
  x: number;
@@ -637,6 +644,10 @@ declare const FreeDom: vue.DefineComponent<vue.ExtractPropTypes<{
637
644
  }>>;
638
645
  default: () => {};
639
646
  };
647
+ active: {
648
+ type: BooleanConstructor;
649
+ default: undefined;
650
+ };
640
651
  keyboard: BooleanConstructor;
641
652
  x: {
642
653
  type: NumberConstructor;
@@ -713,6 +724,7 @@ declare const FreeDom: vue.DefineComponent<vue.ExtractPropTypes<{
713
724
  "onUpdate:height"?: ((...args: any[]) => any) | undefined;
714
725
  "onUpdate:x"?: ((...args: any[]) => any) | undefined;
715
726
  "onUpdate:y"?: ((...args: any[]) => any) | undefined;
727
+ onSelect?: ((...args: any[]) => any) | undefined;
716
728
  }>, {
717
729
  x: number;
718
730
  y: number;
@@ -735,6 +747,7 @@ declare const FreeDom: vue.DefineComponent<vue.ExtractPropTypes<{
735
747
  h: number;
736
748
  }>;
737
749
  width: number;
750
+ active: boolean;
738
751
  height: number;
739
752
  dragStartFn: CoreFnCallback;
740
753
  dragStopFn: CoreFnCallback;
package/dist/index.js CHANGED
@@ -35292,7 +35292,7 @@ var require_reactivity_cjs_prod = __commonJS({
35292
35292
  cleanups.push(cleanupFn);
35293
35293
  }
35294
35294
  }
35295
- function watch7(source, cb, options = shared.EMPTY_OBJ) {
35295
+ function watch8(source, cb, options = shared.EMPTY_OBJ) {
35296
35296
  const { immediate, deep, once, scheduler, augmentJob, call } = options;
35297
35297
  const reactiveGetter = (source2) => {
35298
35298
  if (deep)
@@ -35518,7 +35518,7 @@ var require_reactivity_cjs_prod = __commonJS({
35518
35518
  exports.trigger = trigger;
35519
35519
  exports.triggerRef = triggerRef;
35520
35520
  exports.unref = unref5;
35521
- exports.watch = watch7;
35521
+ exports.watch = watch8;
35522
35522
  }
35523
35523
  });
35524
35524
 
@@ -37146,7 +37146,7 @@ var require_reactivity_cjs = __commonJS({
37146
37146
  );
37147
37147
  }
37148
37148
  }
37149
- function watch7(source, cb, options = shared.EMPTY_OBJ) {
37149
+ function watch8(source, cb, options = shared.EMPTY_OBJ) {
37150
37150
  const { immediate, deep, once, scheduler, augmentJob, call } = options;
37151
37151
  const warnInvalidSource = (s) => {
37152
37152
  (options.onWarn || warn2)(
@@ -37385,7 +37385,7 @@ var require_reactivity_cjs = __commonJS({
37385
37385
  exports.trigger = trigger;
37386
37386
  exports.triggerRef = triggerRef;
37387
37387
  exports.unref = unref5;
37388
- exports.watch = watch7;
37388
+ exports.watch = watch8;
37389
37389
  }
37390
37390
  });
37391
37391
 
@@ -39363,7 +39363,7 @@ var require_runtime_core_cjs_prod = __commonJS({
39363
39363
  cache.delete(key);
39364
39364
  keys.delete(key);
39365
39365
  }
39366
- watch7(
39366
+ watch8(
39367
39367
  () => [props.include, props.exclude],
39368
39368
  ([include, exclude]) => {
39369
39369
  include && pruneCache((name) => matches(include, name));
@@ -40140,12 +40140,12 @@ var require_runtime_core_cjs_prod = __commonJS({
40140
40140
  const handler = ctx[raw];
40141
40141
  if (shared.isFunction(handler)) {
40142
40142
  {
40143
- watch7(getter, handler);
40143
+ watch8(getter, handler);
40144
40144
  }
40145
40145
  }
40146
40146
  } else if (shared.isFunction(raw)) {
40147
40147
  {
40148
- watch7(getter, raw.bind(publicThis));
40148
+ watch8(getter, raw.bind(publicThis));
40149
40149
  }
40150
40150
  } else if (shared.isObject(raw)) {
40151
40151
  if (shared.isArray(raw)) {
@@ -40153,7 +40153,7 @@ var require_runtime_core_cjs_prod = __commonJS({
40153
40153
  } else {
40154
40154
  const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
40155
40155
  if (shared.isFunction(handler)) {
40156
- watch7(getter, handler, raw);
40156
+ watch8(getter, handler, raw);
40157
40157
  }
40158
40158
  }
40159
40159
  } else
@@ -42191,7 +42191,7 @@ var require_runtime_core_cjs_prod = __commonJS({
42191
42191
  return ctx;
42192
42192
  }
42193
42193
  };
42194
- function watchEffect5(effect, options) {
42194
+ function watchEffect6(effect, options) {
42195
42195
  return doWatch(effect, null, options);
42196
42196
  }
42197
42197
  function watchPostEffect(effect, options) {
@@ -42208,7 +42208,7 @@ var require_runtime_core_cjs_prod = __commonJS({
42208
42208
  { flush: "sync" }
42209
42209
  );
42210
42210
  }
42211
- function watch7(source, cb, options) {
42211
+ function watch8(source, cb, options) {
42212
42212
  return doWatch(source, cb, options);
42213
42213
  }
42214
42214
  function doWatch(source, cb, options = shared.EMPTY_OBJ) {
@@ -44058,8 +44058,8 @@ var require_runtime_core_cjs_prod = __commonJS({
44058
44058
  exports.useTransitionState = useTransitionState;
44059
44059
  exports.version = version3;
44060
44060
  exports.warn = warn$1;
44061
- exports.watch = watch7;
44062
- exports.watchEffect = watchEffect5;
44061
+ exports.watch = watch8;
44062
+ exports.watchEffect = watchEffect6;
44063
44063
  exports.watchPostEffect = watchPostEffect;
44064
44064
  exports.watchSyncEffect = watchSyncEffect;
44065
44065
  exports.withAsyncContext = withAsyncContext;
@@ -46688,7 +46688,7 @@ Server rendered element contains fewer child nodes than client vdom.`
46688
46688
  cache.delete(key);
46689
46689
  keys.delete(key);
46690
46690
  }
46691
- watch7(
46691
+ watch8(
46692
46692
  () => [props.include, props.exclude],
46693
46693
  ([include, exclude]) => {
46694
46694
  include && pruneCache((name) => matches(include, name));
@@ -47698,14 +47698,14 @@ If this is a native custom element, make sure to exclude it from component resol
47698
47698
  const handler = ctx[raw];
47699
47699
  if (shared.isFunction(handler)) {
47700
47700
  {
47701
- watch7(getter, handler);
47701
+ watch8(getter, handler);
47702
47702
  }
47703
47703
  } else {
47704
47704
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
47705
47705
  }
47706
47706
  } else if (shared.isFunction(raw)) {
47707
47707
  {
47708
- watch7(getter, raw.bind(publicThis));
47708
+ watch8(getter, raw.bind(publicThis));
47709
47709
  }
47710
47710
  } else if (shared.isObject(raw)) {
47711
47711
  if (shared.isArray(raw)) {
@@ -47713,7 +47713,7 @@ If this is a native custom element, make sure to exclude it from component resol
47713
47713
  } else {
47714
47714
  const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
47715
47715
  if (shared.isFunction(handler)) {
47716
- watch7(getter, handler, raw);
47716
+ watch8(getter, handler, raw);
47717
47717
  } else {
47718
47718
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
47719
47719
  }
@@ -50160,7 +50160,7 @@ If you want to remount the same app, move your app creation logic into a factory
50160
50160
  return ctx;
50161
50161
  }
50162
50162
  };
50163
- function watchEffect5(effect, options) {
50163
+ function watchEffect6(effect, options) {
50164
50164
  return doWatch(effect, null, options);
50165
50165
  }
50166
50166
  function watchPostEffect(effect, options) {
@@ -50177,7 +50177,7 @@ If you want to remount the same app, move your app creation logic into a factory
50177
50177
  shared.extend({}, options, { flush: "sync" })
50178
50178
  );
50179
50179
  }
50180
- function watch7(source, cb, options) {
50180
+ function watch8(source, cb, options) {
50181
50181
  if (!shared.isFunction(cb)) {
50182
50182
  warn$1(
50183
50183
  `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
@@ -52563,8 +52563,8 @@ Component that was made reactive: `,
52563
52563
  exports.useTransitionState = useTransitionState;
52564
52564
  exports.version = version3;
52565
52565
  exports.warn = warn2;
52566
- exports.watch = watch7;
52567
- exports.watchEffect = watchEffect5;
52566
+ exports.watch = watch8;
52567
+ exports.watchEffect = watchEffect6;
52568
52568
  exports.watchPostEffect = watchPostEffect;
52569
52569
  exports.watchSyncEffect = watchSyncEffect;
52570
52570
  exports.withAsyncContext = withAsyncContext;
@@ -56644,6 +56644,7 @@ function useSceneContext(elm, context, props) {
56644
56644
  return SceneContext?.fixNonMonospaced || props.fixNonMonospaced;
56645
56645
  });
56646
56646
  const keyboard = (0, import_vue_demi7.computed)(() => SceneContext?.keyboard || props.keyboard);
56647
+ const manualDiff = (0, import_vue_demi7.computed)(() => SceneContext?.manualDiff);
56647
56648
  (0, import_vue_demi7.onMounted)(() => {
56648
56649
  const node = elm.value;
56649
56650
  if (!node) {
@@ -56685,7 +56686,8 @@ function useSceneContext(elm, context, props) {
56685
56686
  disabledSelect,
56686
56687
  fixNonMonospaced,
56687
56688
  transformScale,
56688
- keyboard
56689
+ keyboard,
56690
+ manualDiff
56689
56691
  };
56690
56692
  }
56691
56693
 
@@ -57493,6 +57495,7 @@ function useMask(target, props, nodes, size) {
57493
57495
  };
57494
57496
  });
57495
57497
  const selecting = (0, import_vue_demi13.ref)(false);
57498
+ const prepareSelect = (0, import_vue_demi13.ref)(false);
57496
57499
  const rect = useElementBounding(target);
57497
57500
  const ownerDoc = (0, import_vue_demi13.computed)(() => unrefElement(target)?.ownerDocument);
57498
57501
  const activeNodes = (0, import_vue_demi13.computed)(() => nodes.value.filter((node) => {
@@ -57545,7 +57548,7 @@ function useMask(target, props, nodes, size) {
57545
57548
  return;
57546
57549
  addUserSelectStyle(ownerDoc.value);
57547
57550
  const { x: offsetX, y: offsetY } = offsetFormat(evt);
57548
- selecting.value = true;
57551
+ prepareSelect.value = true;
57549
57552
  startX.value = offsetX;
57550
57553
  startY.value = offsetY;
57551
57554
  lastX.value = offsetX;
@@ -57553,7 +57556,7 @@ function useMask(target, props, nodes, size) {
57553
57556
  document.addEventListener("mouseup", handleMouseup);
57554
57557
  }
57555
57558
  function handleMousemove(evt) {
57556
- if (!selecting.value)
57559
+ if (!prepareSelect.value)
57557
57560
  return;
57558
57561
  if (!hasEmit.value) {
57559
57562
  eventBus.emit("batch-select", "start");
@@ -57563,6 +57566,7 @@ function useMask(target, props, nodes, size) {
57563
57566
  debug(lastX.value, offsetX, lastY.value, offsetY);
57564
57567
  if (lastX.value === offsetX && lastY.value === offsetY)
57565
57568
  return;
57569
+ selecting.value = true;
57566
57570
  debug("cal", offsetX, 0, size.width.value);
57567
57571
  lastX.value = clamp(offsetX, 0, size.width.value);
57568
57572
  lastY.value = clamp(offsetY, 0, size.height.value);
@@ -57571,6 +57575,7 @@ function useMask(target, props, nodes, size) {
57571
57575
  }
57572
57576
  function handleMouseup() {
57573
57577
  removeUserSelectStyle(ownerDoc.value);
57578
+ prepareSelect.value = false;
57574
57579
  selecting.value = false;
57575
57580
  hasEmit.value = false;
57576
57581
  if (lastX.value === startX.value && lastY.value === startY.value) {
@@ -57923,6 +57928,10 @@ var freeDomProps = {
57923
57928
  type: Object,
57924
57929
  default: () => ({})
57925
57930
  },
57931
+ active: {
57932
+ type: Boolean,
57933
+ default: void 0
57934
+ },
57926
57935
  keyboard: Boolean,
57927
57936
  x: {
57928
57937
  type: Number,
@@ -57993,7 +58002,8 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
57993
58002
  "update:height",
57994
58003
  "update:x",
57995
58004
  "update:y",
57996
- "update:modelValue"
58005
+ "update:modelValue",
58006
+ "select"
57997
58007
  ],
57998
58008
  setup(props, { emit, expose, slots }) {
57999
58009
  const domRef = (0, import_vue_demi17.ref)();
@@ -58014,6 +58024,14 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
58014
58024
  } = useDraggableData(props);
58015
58025
  const { width, height, syncSize: _syncSize } = useResizableData(props, domRef);
58016
58026
  const selected = (0, import_vue_demi17.ref)(false);
58027
+ (0, import_vue_demi17.watch)(() => props.active, (val) => {
58028
+ if (typeof val === "boolean") {
58029
+ selected.value = val;
58030
+ }
58031
+ }, { immediate: true });
58032
+ (0, import_vue_demi17.watchEffect)(() => {
58033
+ emit("select", selected.value);
58034
+ });
58017
58035
  const context = (0, import_vue_demi17.reactive)({
58018
58036
  disabledSelect: (0, import_vue_demi17.toRef)(props, "disabledSelect"),
58019
58037
  selected,
@@ -58068,7 +58086,7 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
58068
58086
  if (!isValid)
58069
58087
  return;
58070
58088
  handleDrag(evt, data);
58071
- sceneContext.emit("move", evt.shiftKey);
58089
+ sceneContext.emit("move", sceneContext.manualDiff.value ? !evt.shiftKey : evt.shiftKey);
58072
58090
  };
58073
58091
  const onDragStop = (evt, coreData) => {
58074
58092
  if (!canDrag.value)
@@ -58144,6 +58162,7 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
58144
58162
  sceneContext.history?.push({ type: "resize-end" });
58145
58163
  };
58146
58164
  const onResizeStart = (evt, data) => {
58165
+ selected.value = true;
58147
58166
  props.resizeStartFn(evt, data);
58148
58167
  };
58149
58168
  const resizeNode = () => {
@@ -58253,7 +58272,7 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
58253
58272
  class: [
58254
58273
  "vv-free-dom--draggable",
58255
58274
  this.disabled && "vv-free-dom--draggable__disabled",
58256
- this.selected && "vv-free-dom--draggable__selected"
58275
+ (this.active || this.selected) && "vv-free-dom--draggable__selected"
58257
58276
  ],
58258
58277
  style: this.style
58259
58278
  },
@@ -58275,6 +58294,7 @@ var freeDomWrapProps = {
58275
58294
  type: Number,
58276
58295
  default: 2
58277
58296
  },
58297
+ manualDiff: Boolean,
58278
58298
  showLine: {
58279
58299
  type: Boolean,
58280
58300
  default: true
package/dist/index.mjs CHANGED
@@ -35293,7 +35293,7 @@ var require_reactivity_cjs_prod = __commonJS({
35293
35293
  cleanups.push(cleanupFn);
35294
35294
  }
35295
35295
  }
35296
- function watch7(source, cb, options = shared.EMPTY_OBJ) {
35296
+ function watch8(source, cb, options = shared.EMPTY_OBJ) {
35297
35297
  const { immediate, deep, once, scheduler, augmentJob, call } = options;
35298
35298
  const reactiveGetter = (source2) => {
35299
35299
  if (deep)
@@ -35519,7 +35519,7 @@ var require_reactivity_cjs_prod = __commonJS({
35519
35519
  exports.trigger = trigger;
35520
35520
  exports.triggerRef = triggerRef;
35521
35521
  exports.unref = unref5;
35522
- exports.watch = watch7;
35522
+ exports.watch = watch8;
35523
35523
  }
35524
35524
  });
35525
35525
 
@@ -37147,7 +37147,7 @@ var require_reactivity_cjs = __commonJS({
37147
37147
  );
37148
37148
  }
37149
37149
  }
37150
- function watch7(source, cb, options = shared.EMPTY_OBJ) {
37150
+ function watch8(source, cb, options = shared.EMPTY_OBJ) {
37151
37151
  const { immediate, deep, once, scheduler, augmentJob, call } = options;
37152
37152
  const warnInvalidSource = (s) => {
37153
37153
  (options.onWarn || warn2)(
@@ -37386,7 +37386,7 @@ var require_reactivity_cjs = __commonJS({
37386
37386
  exports.trigger = trigger;
37387
37387
  exports.triggerRef = triggerRef;
37388
37388
  exports.unref = unref5;
37389
- exports.watch = watch7;
37389
+ exports.watch = watch8;
37390
37390
  }
37391
37391
  });
37392
37392
 
@@ -39364,7 +39364,7 @@ var require_runtime_core_cjs_prod = __commonJS({
39364
39364
  cache.delete(key);
39365
39365
  keys.delete(key);
39366
39366
  }
39367
- watch7(
39367
+ watch8(
39368
39368
  () => [props.include, props.exclude],
39369
39369
  ([include, exclude]) => {
39370
39370
  include && pruneCache((name) => matches(include, name));
@@ -40141,12 +40141,12 @@ var require_runtime_core_cjs_prod = __commonJS({
40141
40141
  const handler = ctx[raw];
40142
40142
  if (shared.isFunction(handler)) {
40143
40143
  {
40144
- watch7(getter, handler);
40144
+ watch8(getter, handler);
40145
40145
  }
40146
40146
  }
40147
40147
  } else if (shared.isFunction(raw)) {
40148
40148
  {
40149
- watch7(getter, raw.bind(publicThis));
40149
+ watch8(getter, raw.bind(publicThis));
40150
40150
  }
40151
40151
  } else if (shared.isObject(raw)) {
40152
40152
  if (shared.isArray(raw)) {
@@ -40154,7 +40154,7 @@ var require_runtime_core_cjs_prod = __commonJS({
40154
40154
  } else {
40155
40155
  const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
40156
40156
  if (shared.isFunction(handler)) {
40157
- watch7(getter, handler, raw);
40157
+ watch8(getter, handler, raw);
40158
40158
  }
40159
40159
  }
40160
40160
  } else
@@ -42192,7 +42192,7 @@ var require_runtime_core_cjs_prod = __commonJS({
42192
42192
  return ctx;
42193
42193
  }
42194
42194
  };
42195
- function watchEffect5(effect, options) {
42195
+ function watchEffect6(effect, options) {
42196
42196
  return doWatch(effect, null, options);
42197
42197
  }
42198
42198
  function watchPostEffect(effect, options) {
@@ -42209,7 +42209,7 @@ var require_runtime_core_cjs_prod = __commonJS({
42209
42209
  { flush: "sync" }
42210
42210
  );
42211
42211
  }
42212
- function watch7(source, cb, options) {
42212
+ function watch8(source, cb, options) {
42213
42213
  return doWatch(source, cb, options);
42214
42214
  }
42215
42215
  function doWatch(source, cb, options = shared.EMPTY_OBJ) {
@@ -44059,8 +44059,8 @@ var require_runtime_core_cjs_prod = __commonJS({
44059
44059
  exports.useTransitionState = useTransitionState;
44060
44060
  exports.version = version3;
44061
44061
  exports.warn = warn$1;
44062
- exports.watch = watch7;
44063
- exports.watchEffect = watchEffect5;
44062
+ exports.watch = watch8;
44063
+ exports.watchEffect = watchEffect6;
44064
44064
  exports.watchPostEffect = watchPostEffect;
44065
44065
  exports.watchSyncEffect = watchSyncEffect;
44066
44066
  exports.withAsyncContext = withAsyncContext;
@@ -46689,7 +46689,7 @@ Server rendered element contains fewer child nodes than client vdom.`
46689
46689
  cache.delete(key);
46690
46690
  keys.delete(key);
46691
46691
  }
46692
- watch7(
46692
+ watch8(
46693
46693
  () => [props.include, props.exclude],
46694
46694
  ([include, exclude]) => {
46695
46695
  include && pruneCache((name) => matches(include, name));
@@ -47699,14 +47699,14 @@ If this is a native custom element, make sure to exclude it from component resol
47699
47699
  const handler = ctx[raw];
47700
47700
  if (shared.isFunction(handler)) {
47701
47701
  {
47702
- watch7(getter, handler);
47702
+ watch8(getter, handler);
47703
47703
  }
47704
47704
  } else {
47705
47705
  warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
47706
47706
  }
47707
47707
  } else if (shared.isFunction(raw)) {
47708
47708
  {
47709
- watch7(getter, raw.bind(publicThis));
47709
+ watch8(getter, raw.bind(publicThis));
47710
47710
  }
47711
47711
  } else if (shared.isObject(raw)) {
47712
47712
  if (shared.isArray(raw)) {
@@ -47714,7 +47714,7 @@ If this is a native custom element, make sure to exclude it from component resol
47714
47714
  } else {
47715
47715
  const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
47716
47716
  if (shared.isFunction(handler)) {
47717
- watch7(getter, handler, raw);
47717
+ watch8(getter, handler, raw);
47718
47718
  } else {
47719
47719
  warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
47720
47720
  }
@@ -50161,7 +50161,7 @@ If you want to remount the same app, move your app creation logic into a factory
50161
50161
  return ctx;
50162
50162
  }
50163
50163
  };
50164
- function watchEffect5(effect, options) {
50164
+ function watchEffect6(effect, options) {
50165
50165
  return doWatch(effect, null, options);
50166
50166
  }
50167
50167
  function watchPostEffect(effect, options) {
@@ -50178,7 +50178,7 @@ If you want to remount the same app, move your app creation logic into a factory
50178
50178
  shared.extend({}, options, { flush: "sync" })
50179
50179
  );
50180
50180
  }
50181
- function watch7(source, cb, options) {
50181
+ function watch8(source, cb, options) {
50182
50182
  if (!shared.isFunction(cb)) {
50183
50183
  warn$1(
50184
50184
  `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
@@ -52564,8 +52564,8 @@ Component that was made reactive: `,
52564
52564
  exports.useTransitionState = useTransitionState;
52565
52565
  exports.version = version3;
52566
52566
  exports.warn = warn2;
52567
- exports.watch = watch7;
52568
- exports.watchEffect = watchEffect5;
52567
+ exports.watch = watch8;
52568
+ exports.watchEffect = watchEffect6;
52569
52569
  exports.watchPostEffect = watchPostEffect;
52570
52570
  exports.watchSyncEffect = watchSyncEffect;
52571
52571
  exports.withAsyncContext = withAsyncContext;
@@ -56216,7 +56216,7 @@ import {
56216
56216
  ref as ref13,
56217
56217
  shallowRef as shallowRef6,
56218
56218
  toRefs as toRefs2,
56219
- watch as watch5
56219
+ watch as watch6
56220
56220
  } from "vue-demi";
56221
56221
 
56222
56222
  // src/util/tokens.ts
@@ -56643,6 +56643,7 @@ function useSceneContext(elm, context, props) {
56643
56643
  return SceneContext?.fixNonMonospaced || props.fixNonMonospaced;
56644
56644
  });
56645
56645
  const keyboard = computed2(() => SceneContext?.keyboard || props.keyboard);
56646
+ const manualDiff = computed2(() => SceneContext?.manualDiff);
56646
56647
  onMounted(() => {
56647
56648
  const node = elm.value;
56648
56649
  if (!node) {
@@ -56684,7 +56685,8 @@ function useSceneContext(elm, context, props) {
56684
56685
  disabledSelect,
56685
56686
  fixNonMonospaced,
56686
56687
  transformScale,
56687
- keyboard
56688
+ keyboard,
56689
+ manualDiff
56688
56690
  };
56689
56691
  }
56690
56692
 
@@ -57492,6 +57494,7 @@ function useMask(target, props, nodes, size) {
57492
57494
  };
57493
57495
  });
57494
57496
  const selecting = ref9(false);
57497
+ const prepareSelect = ref9(false);
57495
57498
  const rect = useElementBounding(target);
57496
57499
  const ownerDoc = computed6(() => unrefElement(target)?.ownerDocument);
57497
57500
  const activeNodes = computed6(() => nodes.value.filter((node) => {
@@ -57544,7 +57547,7 @@ function useMask(target, props, nodes, size) {
57544
57547
  return;
57545
57548
  addUserSelectStyle(ownerDoc.value);
57546
57549
  const { x: offsetX, y: offsetY } = offsetFormat(evt);
57547
- selecting.value = true;
57550
+ prepareSelect.value = true;
57548
57551
  startX.value = offsetX;
57549
57552
  startY.value = offsetY;
57550
57553
  lastX.value = offsetX;
@@ -57552,7 +57555,7 @@ function useMask(target, props, nodes, size) {
57552
57555
  document.addEventListener("mouseup", handleMouseup);
57553
57556
  }
57554
57557
  function handleMousemove(evt) {
57555
- if (!selecting.value)
57558
+ if (!prepareSelect.value)
57556
57559
  return;
57557
57560
  if (!hasEmit.value) {
57558
57561
  eventBus.emit("batch-select", "start");
@@ -57562,6 +57565,7 @@ function useMask(target, props, nodes, size) {
57562
57565
  debug(lastX.value, offsetX, lastY.value, offsetY);
57563
57566
  if (lastX.value === offsetX && lastY.value === offsetY)
57564
57567
  return;
57568
+ selecting.value = true;
57565
57569
  debug("cal", offsetX, 0, size.width.value);
57566
57570
  lastX.value = clamp(offsetX, 0, size.width.value);
57567
57571
  lastY.value = clamp(offsetY, 0, size.height.value);
@@ -57570,6 +57574,7 @@ function useMask(target, props, nodes, size) {
57570
57574
  }
57571
57575
  function handleMouseup() {
57572
57576
  removeUserSelectStyle(ownerDoc.value);
57577
+ prepareSelect.value = false;
57573
57578
  selecting.value = false;
57574
57579
  hasEmit.value = false;
57575
57580
  if (lastX.value === startX.value && lastY.value === startY.value) {
@@ -57630,7 +57635,7 @@ function useOperateHistory(nodes) {
57630
57635
  }
57631
57636
 
57632
57637
  // src/components/freeDom.ts
57633
- import { computed as computed10, defineComponent as defineComponent5, onMounted as onMounted4, reactive as reactive4, ref as ref12, toRef as toRef2 } from "vue-demi";
57638
+ import { computed as computed10, defineComponent as defineComponent5, onMounted as onMounted4, reactive as reactive4, ref as ref12, toRef as toRef2, watch as watch5, watchEffect as watchEffect5 } from "vue-demi";
57634
57639
 
57635
57640
  // src/components/freeDomCore.ts
57636
57641
  import { computed as computed8, defineComponent as defineComponent3, onUnmounted as onUnmounted3, ref as ref11 } from "vue-demi";
@@ -57922,6 +57927,10 @@ var freeDomProps = {
57922
57927
  type: Object,
57923
57928
  default: () => ({})
57924
57929
  },
57930
+ active: {
57931
+ type: Boolean,
57932
+ default: void 0
57933
+ },
57925
57934
  keyboard: Boolean,
57926
57935
  x: {
57927
57936
  type: Number,
@@ -57992,7 +58001,8 @@ var freeDom = defineComponent5({
57992
58001
  "update:height",
57993
58002
  "update:x",
57994
58003
  "update:y",
57995
- "update:modelValue"
58004
+ "update:modelValue",
58005
+ "select"
57996
58006
  ],
57997
58007
  setup(props, { emit, expose, slots }) {
57998
58008
  const domRef = ref12();
@@ -58013,6 +58023,14 @@ var freeDom = defineComponent5({
58013
58023
  } = useDraggableData(props);
58014
58024
  const { width, height, syncSize: _syncSize } = useResizableData(props, domRef);
58015
58025
  const selected = ref12(false);
58026
+ watch5(() => props.active, (val) => {
58027
+ if (typeof val === "boolean") {
58028
+ selected.value = val;
58029
+ }
58030
+ }, { immediate: true });
58031
+ watchEffect5(() => {
58032
+ emit("select", selected.value);
58033
+ });
58016
58034
  const context = reactive4({
58017
58035
  disabledSelect: toRef2(props, "disabledSelect"),
58018
58036
  selected,
@@ -58067,7 +58085,7 @@ var freeDom = defineComponent5({
58067
58085
  if (!isValid)
58068
58086
  return;
58069
58087
  handleDrag(evt, data);
58070
- sceneContext.emit("move", evt.shiftKey);
58088
+ sceneContext.emit("move", sceneContext.manualDiff.value ? !evt.shiftKey : evt.shiftKey);
58071
58089
  };
58072
58090
  const onDragStop = (evt, coreData) => {
58073
58091
  if (!canDrag.value)
@@ -58143,6 +58161,7 @@ var freeDom = defineComponent5({
58143
58161
  sceneContext.history?.push({ type: "resize-end" });
58144
58162
  };
58145
58163
  const onResizeStart = (evt, data) => {
58164
+ selected.value = true;
58146
58165
  props.resizeStartFn(evt, data);
58147
58166
  };
58148
58167
  const resizeNode = () => {
@@ -58252,7 +58271,7 @@ var freeDom = defineComponent5({
58252
58271
  class: [
58253
58272
  "vv-free-dom--draggable",
58254
58273
  this.disabled && "vv-free-dom--draggable__disabled",
58255
- this.selected && "vv-free-dom--draggable__selected"
58274
+ (this.active || this.selected) && "vv-free-dom--draggable__selected"
58256
58275
  ],
58257
58276
  style: this.style
58258
58277
  },
@@ -58274,6 +58293,7 @@ var freeDomWrapProps = {
58274
58293
  type: Number,
58275
58294
  default: 2
58276
58295
  },
58296
+ manualDiff: Boolean,
58277
58297
  showLine: {
58278
58298
  type: Boolean,
58279
58299
  default: true
@@ -58312,7 +58332,7 @@ var FreeDomWrap = defineComponent6({
58312
58332
  const height = ref13(0);
58313
58333
  const rectRef = shallowRef6();
58314
58334
  const wrapRect = useElementBounding(rectRef);
58315
- watch5([
58335
+ watch6([
58316
58336
  wrapRect.width,
58317
58337
  wrapRect.height,
58318
58338
  () => nodes.value.length
@@ -58463,7 +58483,7 @@ var FreeDomWrap = defineComponent6({
58463
58483
  import { Fragment as Fragment2, defineComponent as defineComponent8, h as h6, provide as provide3, reactive as reactive6, ref as ref16, toRefs as toRefs3 } from "vue-demi";
58464
58484
 
58465
58485
  // src/components/gridItem.ts
58466
- import { defineComponent as defineComponent7, inject as inject5, onMounted as onMounted5, ref as ref14, watch as watch6 } from "vue-demi";
58486
+ import { defineComponent as defineComponent7, inject as inject5, onMounted as onMounted5, ref as ref14, watch as watch7 } from "vue-demi";
58467
58487
 
58468
58488
  // src/components/tokens.ts
58469
58489
  var gridLayoutContextKey = Symbol("gridLayoutContext");
@@ -58537,7 +58557,7 @@ var GridItem = defineComponent7({
58537
58557
  onMounted5(() => {
58538
58558
  moveDroppingItem();
58539
58559
  });
58540
- watch6(() => props.droppingPosition, (currPos, prevPos) => {
58560
+ watch7(() => props.droppingPosition, (currPos, prevPos) => {
58541
58561
  moveDroppingItem(prevPos);
58542
58562
  }, { deep: true });
58543
58563
  function moveDroppingItem(prevPos) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sepveneto/free-dom",
3
- "version": "0.12.5",
3
+ "version": "0.12.7",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",