@prosekit/web 0.4.0 → 0.4.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.
@@ -194,9 +194,11 @@ import { defineCustomElement as defineCustomElement2, registerCustomElement as r
194
194
  // src/components/resizable/resizable-root/setup.ts
195
195
  import {
196
196
  createSignal as createSignal2,
197
+ useAttribute,
197
198
  useEffect as useEffect2
198
199
  } from "@aria-ui/core";
199
200
  function useResizableRoot(host, { state, emit }) {
201
+ const resizing = createSignal2(false);
200
202
  const onResizeStart = () => {
201
203
  var _a;
202
204
  const { width, height } = host.getBoundingClientRect();
@@ -205,6 +207,7 @@ function useResizableRoot(host, { state, emit }) {
205
207
  aspectRatio = 0;
206
208
  }
207
209
  emit("resizeStart", { width, height });
210
+ resizing.set(true);
208
211
  return [width, height, aspectRatio];
209
212
  };
210
213
  const onResize = (width, height) => {
@@ -214,6 +217,7 @@ function useResizableRoot(host, { state, emit }) {
214
217
  const onResizeEnd = () => {
215
218
  const { width, height } = host.getBoundingClientRect();
216
219
  emit("resizeEnd", { width, height });
220
+ resizing.set(false);
217
221
  };
218
222
  onResizeStartContext.provide(host, createSignal2(onResizeStart));
219
223
  onResizeContext.provide(host, createSignal2(onResize));
@@ -221,11 +225,12 @@ function useResizableRoot(host, { state, emit }) {
221
225
  useEffect2(host, () => {
222
226
  updateResizableRootStyles(
223
227
  host,
224
- state.width.get(),
225
- state.height.get(),
228
+ Math.max(state.width.get() || 0, 1),
229
+ Math.max(state.height.get() || 0, 1),
226
230
  state.aspectRatio.get()
227
231
  );
228
232
  });
233
+ useAttribute(host, "data-resizing", () => resizing.get() ? "" : void 0);
229
234
  }
230
235
  function updateResizableRootStyles(host, width, height, aspectRatio) {
231
236
  host.style.width = isFinitePositiveNumber(width) ? `${width}px` : "";
@@ -235,7 +240,7 @@ function updateResizableRootStyles(host, width, height, aspectRatio) {
235
240
  if (width && width > 0 && aspectRatio >= 1) {
236
241
  host.style.height = "auto";
237
242
  } else if (height && height > 0 && aspectRatio <= 1) {
238
- host.style.width = "auto";
243
+ host.style.width = "min-content";
239
244
  }
240
245
  }
241
246
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/web",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -79,18 +79,18 @@
79
79
  "@aria-ui/presence": "^0.0.15",
80
80
  "@aria-ui/tooltip": "^0.0.23",
81
81
  "@floating-ui/dom": "^1.6.11",
82
- "@zag-js/dom-query": "^0.68.1",
82
+ "@zag-js/dom-query": "^0.75.0",
83
83
  "just-map-values": "^3.2.0",
84
84
  "just-omit": "^2.2.0",
85
85
  "prosemirror-tables": "^1.5.0",
86
- "@prosekit/core": "^0.7.11",
87
- "@prosekit/pm": "^0.1.8",
88
- "@prosekit/extensions": "^0.7.18"
86
+ "@prosekit/core": "^0.7.12",
87
+ "@prosekit/extensions": "^0.7.19",
88
+ "@prosekit/pm": "^0.1.8"
89
89
  },
90
90
  "devDependencies": {
91
91
  "tsup": "^8.3.0",
92
- "typescript": "^5.6.2",
93
- "vitest": "^2.1.2",
92
+ "typescript": "^5.6.3",
93
+ "vitest": "^2.1.3",
94
94
  "@prosekit/dev": "0.0.0"
95
95
  },
96
96
  "scripts": {