@sepveneto/free-dom 0.12.0-beta.0 → 0.12.0-beta.2

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-1923-wOVpZZwj554Y/core/src/style/index.css */
1
+ /* ../../../../../../../tmp/tmp-1932-reazjYfj4HU7/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
@@ -121,11 +121,11 @@ declare const FreeScene: vue.DefineComponent<{
121
121
  };
122
122
  minWidth: {
123
123
  type: NumberConstructor;
124
- default: number;
124
+ default: undefined;
125
125
  };
126
126
  minHeight: {
127
127
  type: NumberConstructor;
128
- default: number;
128
+ default: undefined;
129
129
  };
130
130
  lockAspectRatio: BooleanConstructor;
131
131
  disabledDrag: BooleanConstructor;
@@ -176,11 +176,11 @@ declare const FreeScene: vue.DefineComponent<{
176
176
  };
177
177
  minWidth: {
178
178
  type: NumberConstructor;
179
- default: number;
179
+ default: undefined;
180
180
  };
181
181
  minHeight: {
182
182
  type: NumberConstructor;
183
- default: number;
183
+ default: undefined;
184
184
  };
185
185
  lockAspectRatio: BooleanConstructor;
186
186
  disabledDrag: BooleanConstructor;
package/dist/index.js CHANGED
@@ -19865,7 +19865,8 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
19865
19865
  }),
19866
19866
  trigger: (pos) => {
19867
19867
  emit2("update:modelValue", pos);
19868
- }
19868
+ },
19869
+ props
19869
19870
  });
19870
19871
  const sceneContext = useSceneContext(domRef, context, props);
19871
19872
  onClickOutside(domRef, () => {
@@ -19884,11 +19885,13 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
19884
19885
  (0, import_vue_demi17.onMounted)(() => {
19885
19886
  props.autoSize && syncSize();
19886
19887
  });
19887
- const style = (0, import_vue_demi17.computed)(() => ({
19888
- width: `${width.value}px`,
19889
- height: `${height.value}px`,
19890
- transform: `translate(${x.value}px, ${y.value}px)`
19891
- }));
19888
+ const style = (0, import_vue_demi17.computed)(() => {
19889
+ return {
19890
+ width: `${width.value}px`,
19891
+ height: `${height.value}px`,
19892
+ transform: `translate(${x.value}px, ${y.value}px)`
19893
+ };
19894
+ });
19892
19895
  const onDrag = (evt, coreData) => {
19893
19896
  if (!canDrag.value)
19894
19897
  return;
@@ -20119,8 +20122,14 @@ var freeDomWrapProps = {
20119
20122
  keyboard: Boolean,
20120
20123
  disabledBatch: Boolean,
20121
20124
  handle: freeDomProps.handle,
20122
- minWidth: freeDomProps.minWidth,
20123
- minHeight: freeDomProps.minHeight,
20125
+ minWidth: {
20126
+ type: Number,
20127
+ default: void 0
20128
+ },
20129
+ minHeight: {
20130
+ type: Number,
20131
+ default: void 0
20132
+ },
20124
20133
  lockAspectRatio: freeDomProps.lockAspectRatio,
20125
20134
  disabledDrag: freeDomProps.disabledDrag,
20126
20135
  disabledResize: freeDomProps.disabledResize,
@@ -20167,7 +20176,14 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
20167
20176
  const mask = useMask(rectRef, props, nodes);
20168
20177
  function runCorrect() {
20169
20178
  nodes.value.forEach((pos) => {
20170
- const { x, y, width: width2, height: height2 } = correct(pos.node._rect);
20179
+ const minWidth = props.minWidth || pos.node.props.minWidth;
20180
+ const minHeight = props.minHeight || pos.node.props.minHeight;
20181
+ const { x, y, width: width2, height: height2 } = correct(
20182
+ // @ts-expect-error: triggered after mount
20183
+ pos.node._rect,
20184
+ minWidth,
20185
+ minHeight
20186
+ );
20171
20187
  pos.node._rect.x = x;
20172
20188
  pos.node._rect.y = y;
20173
20189
  pos.node._rect.width = width2;
@@ -20190,7 +20206,7 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
20190
20206
  const { x, y, width: w, height: h8 } = pos;
20191
20207
  return x >= 0 && x + w <= width.value && y >= 0 && y + h8 <= height.value;
20192
20208
  }
20193
- function correct(pos) {
20209
+ function correct(pos, minWidth, minHeight) {
20194
20210
  let x = Math.max(pos.x, 0);
20195
20211
  let y = Math.max(pos.y, 0);
20196
20212
  let w = pos.width;
@@ -20198,14 +20214,14 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
20198
20214
  if (pos.x + pos.width > width.value) {
20199
20215
  x = width.value - pos.width;
20200
20216
  if (x < 0) {
20201
- w = width.value;
20217
+ w = Math.max(width.value, minWidth);
20202
20218
  x = 0;
20203
20219
  }
20204
20220
  }
20205
20221
  if (pos.y + pos.height > height.value) {
20206
20222
  y = height.value - pos.height;
20207
20223
  if (y < 0) {
20208
- h8 = height.value;
20224
+ h8 = Math.max(height.value, minHeight);
20209
20225
  y = 0;
20210
20226
  }
20211
20227
  }
package/dist/index.mjs CHANGED
@@ -19862,7 +19862,8 @@ var freeDom = defineComponent5({
19862
19862
  }),
19863
19863
  trigger: (pos) => {
19864
19864
  emit2("update:modelValue", pos);
19865
- }
19865
+ },
19866
+ props
19866
19867
  });
19867
19868
  const sceneContext = useSceneContext(domRef, context, props);
19868
19869
  onClickOutside(domRef, () => {
@@ -19881,11 +19882,13 @@ var freeDom = defineComponent5({
19881
19882
  onMounted4(() => {
19882
19883
  props.autoSize && syncSize();
19883
19884
  });
19884
- const style = computed10(() => ({
19885
- width: `${width.value}px`,
19886
- height: `${height.value}px`,
19887
- transform: `translate(${x.value}px, ${y.value}px)`
19888
- }));
19885
+ const style = computed10(() => {
19886
+ return {
19887
+ width: `${width.value}px`,
19888
+ height: `${height.value}px`,
19889
+ transform: `translate(${x.value}px, ${y.value}px)`
19890
+ };
19891
+ });
19889
19892
  const onDrag = (evt, coreData) => {
19890
19893
  if (!canDrag.value)
19891
19894
  return;
@@ -20116,8 +20119,14 @@ var freeDomWrapProps = {
20116
20119
  keyboard: Boolean,
20117
20120
  disabledBatch: Boolean,
20118
20121
  handle: freeDomProps.handle,
20119
- minWidth: freeDomProps.minWidth,
20120
- minHeight: freeDomProps.minHeight,
20122
+ minWidth: {
20123
+ type: Number,
20124
+ default: void 0
20125
+ },
20126
+ minHeight: {
20127
+ type: Number,
20128
+ default: void 0
20129
+ },
20121
20130
  lockAspectRatio: freeDomProps.lockAspectRatio,
20122
20131
  disabledDrag: freeDomProps.disabledDrag,
20123
20132
  disabledResize: freeDomProps.disabledResize,
@@ -20164,7 +20173,14 @@ var FreeDomWrap = defineComponent6({
20164
20173
  const mask = useMask(rectRef, props, nodes);
20165
20174
  function runCorrect() {
20166
20175
  nodes.value.forEach((pos) => {
20167
- const { x, y, width: width2, height: height2 } = correct(pos.node._rect);
20176
+ const minWidth = props.minWidth || pos.node.props.minWidth;
20177
+ const minHeight = props.minHeight || pos.node.props.minHeight;
20178
+ const { x, y, width: width2, height: height2 } = correct(
20179
+ // @ts-expect-error: triggered after mount
20180
+ pos.node._rect,
20181
+ minWidth,
20182
+ minHeight
20183
+ );
20168
20184
  pos.node._rect.x = x;
20169
20185
  pos.node._rect.y = y;
20170
20186
  pos.node._rect.width = width2;
@@ -20187,7 +20203,7 @@ var FreeDomWrap = defineComponent6({
20187
20203
  const { x, y, width: w, height: h8 } = pos;
20188
20204
  return x >= 0 && x + w <= width.value && y >= 0 && y + h8 <= height.value;
20189
20205
  }
20190
- function correct(pos) {
20206
+ function correct(pos, minWidth, minHeight) {
20191
20207
  let x = Math.max(pos.x, 0);
20192
20208
  let y = Math.max(pos.y, 0);
20193
20209
  let w = pos.width;
@@ -20195,14 +20211,14 @@ var FreeDomWrap = defineComponent6({
20195
20211
  if (pos.x + pos.width > width.value) {
20196
20212
  x = width.value - pos.width;
20197
20213
  if (x < 0) {
20198
- w = width.value;
20214
+ w = Math.max(width.value, minWidth);
20199
20215
  x = 0;
20200
20216
  }
20201
20217
  }
20202
20218
  if (pos.y + pos.height > height.value) {
20203
20219
  y = height.value - pos.height;
20204
20220
  if (y < 0) {
20205
- h8 = height.value;
20221
+ h8 = Math.max(height.value, minHeight);
20206
20222
  y = 0;
20207
20223
  }
20208
20224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sepveneto/free-dom",
3
- "version": "0.12.0-beta.0",
3
+ "version": "0.12.0-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",