@sepveneto/free-dom 0.4.1 → 0.4.3
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 +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +21 -16
- package/dist/index.mjs +23 -19
- package/package.json +1 -1
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,19 +3,19 @@ import * as vue_demi from 'vue-demi';
|
|
|
3
3
|
declare const freeDom: vue_demi.DefineComponent<{
|
|
4
4
|
x: {
|
|
5
5
|
type: NumberConstructor;
|
|
6
|
-
default:
|
|
6
|
+
default: number;
|
|
7
7
|
};
|
|
8
8
|
y: {
|
|
9
9
|
type: NumberConstructor;
|
|
10
|
-
default:
|
|
10
|
+
default: number;
|
|
11
11
|
};
|
|
12
12
|
width: {
|
|
13
13
|
type: NumberConstructor;
|
|
14
|
-
default:
|
|
14
|
+
default: number;
|
|
15
15
|
};
|
|
16
16
|
height: {
|
|
17
17
|
type: NumberConstructor;
|
|
18
|
-
default:
|
|
18
|
+
default: number;
|
|
19
19
|
};
|
|
20
20
|
absolute: {
|
|
21
21
|
type: BooleanConstructor;
|
|
@@ -73,19 +73,19 @@ declare const freeDom: vue_demi.DefineComponent<{
|
|
|
73
73
|
}, unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, ("update:x" | "update:y" | "update:width" | "update:height" | "select")[], "update:x" | "update:y" | "update:width" | "update:height" | "select", vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{
|
|
74
74
|
x: {
|
|
75
75
|
type: NumberConstructor;
|
|
76
|
-
default:
|
|
76
|
+
default: number;
|
|
77
77
|
};
|
|
78
78
|
y: {
|
|
79
79
|
type: NumberConstructor;
|
|
80
|
-
default:
|
|
80
|
+
default: number;
|
|
81
81
|
};
|
|
82
82
|
width: {
|
|
83
83
|
type: NumberConstructor;
|
|
84
|
-
default:
|
|
84
|
+
default: number;
|
|
85
85
|
};
|
|
86
86
|
height: {
|
|
87
87
|
type: NumberConstructor;
|
|
88
|
-
default:
|
|
88
|
+
default: number;
|
|
89
89
|
};
|
|
90
90
|
absolute: {
|
|
91
91
|
type: BooleanConstructor;
|
package/dist/index.js
CHANGED
|
@@ -146,19 +146,19 @@ var FreeDom = (0, import_vue_demi2.defineComponent)({
|
|
|
146
146
|
props: {
|
|
147
147
|
x: {
|
|
148
148
|
type: Number,
|
|
149
|
-
default:
|
|
149
|
+
default: 0
|
|
150
150
|
},
|
|
151
151
|
y: {
|
|
152
152
|
type: Number,
|
|
153
|
-
default:
|
|
153
|
+
default: 0
|
|
154
154
|
},
|
|
155
155
|
width: {
|
|
156
156
|
type: Number,
|
|
157
|
-
default:
|
|
157
|
+
default: 0
|
|
158
158
|
},
|
|
159
159
|
height: {
|
|
160
160
|
type: Number,
|
|
161
|
-
default:
|
|
161
|
+
default: 0
|
|
162
162
|
},
|
|
163
163
|
absolute: {
|
|
164
164
|
type: Boolean,
|
|
@@ -202,7 +202,7 @@ var FreeDom = (0, import_vue_demi2.defineComponent)({
|
|
|
202
202
|
emits: ["update:x", "update:y", "update:width", "update:height", "select"],
|
|
203
203
|
setup(props, { emit }) {
|
|
204
204
|
const active = (0, import_vue_demi2.ref)(false);
|
|
205
|
-
const SceneContext = (0, import_vue_demi2.inject)(SceneToken);
|
|
205
|
+
const SceneContext = (0, import_vue_demi2.inject)(SceneToken, void 0);
|
|
206
206
|
const _preview = (0, import_vue_demi2.computed)(() => SceneContext?.preview || props.preview);
|
|
207
207
|
const canScale = (0, import_vue_demi2.computed)(() => !_preview.value && (SceneContext?.scale || props.scale));
|
|
208
208
|
const canMove = (0, import_vue_demi2.computed)(() => !_preview.value && (SceneContext?.move || props.move));
|
|
@@ -222,7 +222,6 @@ var FreeDom = (0, import_vue_demi2.defineComponent)({
|
|
|
222
222
|
width: 0,
|
|
223
223
|
height: 0
|
|
224
224
|
});
|
|
225
|
-
const triggerThrottle = (0, import_core.useThrottleFn)(trigger);
|
|
226
225
|
const context = {
|
|
227
226
|
_rect,
|
|
228
227
|
trigger
|
|
@@ -233,18 +232,24 @@ var FreeDom = (0, import_vue_demi2.defineComponent)({
|
|
|
233
232
|
function parseNum(val) {
|
|
234
233
|
return typeof val === "number" ? val : parseFloat(val);
|
|
235
234
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
235
|
+
(0, import_vue_demi2.watch)(
|
|
236
|
+
[
|
|
237
|
+
() => props.width,
|
|
238
|
+
() => props.height,
|
|
239
|
+
() => props.x,
|
|
240
|
+
() => props.y
|
|
241
|
+
],
|
|
242
|
+
() => {
|
|
243
|
+
_rect.width = props.width;
|
|
244
|
+
_rect.height = props.height;
|
|
245
|
+
_rect.x = props.x;
|
|
246
|
+
_rect.y = props.y;
|
|
247
|
+
trigger();
|
|
248
|
+
},
|
|
249
|
+
{ immediate: true }
|
|
250
|
+
);
|
|
245
251
|
(0, import_vue_demi2.onMounted)(async () => {
|
|
246
252
|
SceneContext?.register(uuid, context);
|
|
247
|
-
await (0, import_vue_demi2.nextTick)();
|
|
248
253
|
const rect = widgetRef.value.getBoundingClientRect();
|
|
249
254
|
_rect.width = _rect.width || rect.width;
|
|
250
255
|
_rect.height = _rect.height || rect.height;
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
|
|
8
8
|
// src/components/freeDom.ts
|
|
9
9
|
import {
|
|
10
|
-
nextTick,
|
|
11
10
|
onMounted,
|
|
12
11
|
defineComponent,
|
|
13
12
|
h,
|
|
@@ -17,7 +16,7 @@ import {
|
|
|
17
16
|
reactive,
|
|
18
17
|
isVue2,
|
|
19
18
|
shallowRef,
|
|
20
|
-
|
|
19
|
+
watch as watch2
|
|
21
20
|
} from "vue-demi";
|
|
22
21
|
|
|
23
22
|
// src/hooks/use-normalize-style.ts
|
|
@@ -125,7 +124,7 @@ function useResize(startX, startY, rect, dot, diagonal, snapGrid, callbacks) {
|
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
// src/components/freeDom.ts
|
|
128
|
-
import { onClickOutside
|
|
127
|
+
import { onClickOutside } from "@vueuse/core";
|
|
129
128
|
import { v4 as uuidv4 } from "uuid";
|
|
130
129
|
var Dots = ["t", "r", "l", "b", "lt", "lb", "rt", "rb"];
|
|
131
130
|
var FreeDom = defineComponent({
|
|
@@ -133,19 +132,19 @@ var FreeDom = defineComponent({
|
|
|
133
132
|
props: {
|
|
134
133
|
x: {
|
|
135
134
|
type: Number,
|
|
136
|
-
default:
|
|
135
|
+
default: 0
|
|
137
136
|
},
|
|
138
137
|
y: {
|
|
139
138
|
type: Number,
|
|
140
|
-
default:
|
|
139
|
+
default: 0
|
|
141
140
|
},
|
|
142
141
|
width: {
|
|
143
142
|
type: Number,
|
|
144
|
-
default:
|
|
143
|
+
default: 0
|
|
145
144
|
},
|
|
146
145
|
height: {
|
|
147
146
|
type: Number,
|
|
148
|
-
default:
|
|
147
|
+
default: 0
|
|
149
148
|
},
|
|
150
149
|
absolute: {
|
|
151
150
|
type: Boolean,
|
|
@@ -189,7 +188,7 @@ var FreeDom = defineComponent({
|
|
|
189
188
|
emits: ["update:x", "update:y", "update:width", "update:height", "select"],
|
|
190
189
|
setup(props, { emit }) {
|
|
191
190
|
const active = ref2(false);
|
|
192
|
-
const SceneContext = inject(SceneToken);
|
|
191
|
+
const SceneContext = inject(SceneToken, void 0);
|
|
193
192
|
const _preview = computed(() => SceneContext?.preview || props.preview);
|
|
194
193
|
const canScale = computed(() => !_preview.value && (SceneContext?.scale || props.scale));
|
|
195
194
|
const canMove = computed(() => !_preview.value && (SceneContext?.move || props.move));
|
|
@@ -209,7 +208,6 @@ var FreeDom = defineComponent({
|
|
|
209
208
|
width: 0,
|
|
210
209
|
height: 0
|
|
211
210
|
});
|
|
212
|
-
const triggerThrottle = useThrottleFn(trigger);
|
|
213
211
|
const context = {
|
|
214
212
|
_rect,
|
|
215
213
|
trigger
|
|
@@ -220,18 +218,24 @@ var FreeDom = defineComponent({
|
|
|
220
218
|
function parseNum(val) {
|
|
221
219
|
return typeof val === "number" ? val : parseFloat(val);
|
|
222
220
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
221
|
+
watch2(
|
|
222
|
+
[
|
|
223
|
+
() => props.width,
|
|
224
|
+
() => props.height,
|
|
225
|
+
() => props.x,
|
|
226
|
+
() => props.y
|
|
227
|
+
],
|
|
228
|
+
() => {
|
|
229
|
+
_rect.width = props.width;
|
|
230
|
+
_rect.height = props.height;
|
|
231
|
+
_rect.x = props.x;
|
|
232
|
+
_rect.y = props.y;
|
|
233
|
+
trigger();
|
|
234
|
+
},
|
|
235
|
+
{ immediate: true }
|
|
236
|
+
);
|
|
232
237
|
onMounted(async () => {
|
|
233
238
|
SceneContext?.register(uuid, context);
|
|
234
|
-
await nextTick();
|
|
235
239
|
const rect = widgetRef.value.getBoundingClientRect();
|
|
236
240
|
_rect.width = _rect.width || rect.width;
|
|
237
241
|
_rect.height = _rect.height || rect.height;
|