@prosekit/web 0.5.2 → 0.5.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.
@@ -1,7 +1,6 @@
1
1
  import { BaseElementConstructor } from '@aria-ui/core';
2
2
  import { ConnectableElement } from '@aria-ui/core';
3
3
  import { Context } from '@aria-ui/core';
4
- import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
5
4
  import type { defineTableCommands } from '@prosekit/extensions/table';
6
5
  import { Editor } from '@prosekit/core';
7
6
  import type { EditorView } from '@prosekit/pm/view';
@@ -17,7 +16,6 @@ import { MenuContentEvents } from '@aria-ui/menu/elements';
17
16
  import { MenuContentProps } from '@aria-ui/menu/elements';
18
17
  import { MenuItemEvents } from '@aria-ui/menu';
19
18
  import { MenuItemProps } from '@aria-ui/menu';
20
- import { Options } from 'tsup';
21
19
  import { OverlayPositionerEvents } from '@aria-ui/overlay/elements';
22
20
  import { OverlayPositionerEvents as OverlayPositionerEvents_2 } from '@aria-ui/overlay';
23
21
  import { OverlayPositionerProps } from '@aria-ui/overlay/elements';
@@ -370,10 +368,6 @@ export declare const blockPopoverContext: Context<BlockPopoverContext>;
370
368
 
371
369
  export declare function calcResize(position: 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right', w: number, h: number, dx: number, dy: number, aspectRatio: number | null | undefined): [w: number, h: number];
372
370
 
373
- export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
374
-
375
- export { default_alias_1 }
376
-
377
371
  export declare function defaultQueryBuilder(match: RegExpExecArray): string;
378
372
 
379
373
  export declare function defineCustomElement(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void;
@@ -4,8 +4,7 @@ import {
4
4
  } from "@aria-ui/core";
5
5
  function useEditorExtension(host, editor, extension) {
6
6
  useEffect(host, () => {
7
- var _a;
8
- return (_a = editor.get()) == null ? void 0 : _a.use(extension);
7
+ return editor.get()?.use(extension);
9
8
  });
10
9
  }
11
10
 
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ZGQ225UP.js";
4
4
  import {
5
5
  useEditorExtension
6
- } from "./chunk-MZSYOTZT.js";
6
+ } from "./chunk-WTW6FOH3.js";
7
7
 
8
8
  // src/components/autocomplete/autocomplete-empty/element.gen.ts
9
9
  import { defineCustomElement, registerCustomElement } from "@aria-ui/core";
@@ -54,9 +54,8 @@ function useAutocompleteItem(element, { state, emit }) {
54
54
  useListboxItem(element, { state, emit });
55
55
  const open = openContext.consume(element);
56
56
  useEffect(element, () => {
57
- var _a;
58
57
  if (!state.value.peek() && open.get()) {
59
- state.value.set((_a = element.textContent) != null ? _a : "");
58
+ state.value.set(element.textContent ?? "");
60
59
  }
61
60
  });
62
61
  }
@@ -109,9 +108,8 @@ function useAutocompleteList(element, { state, emit }) {
109
108
  );
110
109
  useEffect2(element, () => {
111
110
  element.addEventListener("valueChange", () => {
112
- var _a;
113
111
  if (onSubmit) {
114
- (_a = onSubmit.get()) == null ? void 0 : _a();
112
+ onSubmit.get()?.();
115
113
  }
116
114
  });
117
115
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useEditorExtension
3
- } from "./chunk-MZSYOTZT.js";
3
+ } from "./chunk-WTW6FOH3.js";
4
4
 
5
5
  // src/components/block-handle/block-handle-add/element.gen.ts
6
6
  import { defineCustomElement, registerCustomElement } from "@aria-ui/core";
@@ -76,9 +76,8 @@ function useBlockHandleDraggable(host, { state }) {
76
76
  }
77
77
  function usePointerDownHandler(host, context, editor) {
78
78
  useEventListener2(host, "pointerdown", () => {
79
- var _a, _b;
80
- const { pos } = (_a = context.get()) != null ? _a : {};
81
- const { view } = (_b = editor.get()) != null ? _b : {};
79
+ const { pos } = context.get() ?? {};
80
+ const { view } = editor.get() ?? {};
82
81
  if (pos == null || view == null) {
83
82
  return;
84
83
  }
@@ -92,9 +91,8 @@ function usePointerDownHandler(host, context, editor) {
92
91
  }
93
92
  function useDraggingPreview(host, context, editor) {
94
93
  useEventListener2(host, "dragstart", (event) => {
95
- var _a;
96
94
  const hoverState = context.get();
97
- const { view } = (_a = editor.get()) != null ? _a : {};
95
+ const { view } = editor.get() ?? {};
98
96
  if (!hoverState || !view || !event.dataTransfer) {
99
97
  return;
100
98
  }
@@ -172,13 +170,12 @@ function throttle(callback, wait) {
172
170
  // src/components/block-handle/block-handle-popover/pointer-move.ts
173
171
  function defineElementHoverHandler(handler) {
174
172
  const handlePointerEvent = (view, event) => {
175
- var _a;
176
173
  const rect = view.dom.getBoundingClientRect();
177
- const pos = (_a = view.posAtCoords({
174
+ const pos = view.posAtCoords({
178
175
  top: event.clientY,
179
176
  // Use the center of the editor
180
177
  left: rect.left + rect.width / 2
181
- })) == null ? void 0 : _a.inside;
178
+ })?.inside;
182
179
  if (pos == null || pos < 0) {
183
180
  handler(null, null);
184
181
  return;
@@ -238,8 +235,7 @@ function useBlockHandlePopover(host, { state }) {
238
235
  blockPopoverContext.provide(host, context);
239
236
  const open = createSignal2(false);
240
237
  useEffect2(host, () => {
241
- var _a;
242
- open.set(!!((_a = context.get()) == null ? void 0 : _a.element));
238
+ open.set(!!context.get()?.element);
243
239
  });
244
240
  useHoverExtension(host, editor, (referenceValue, hoverState) => {
245
241
  reference.set(referenceValue);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useEditorExtension
3
- } from "./chunk-MZSYOTZT.js";
3
+ } from "./chunk-WTW6FOH3.js";
4
4
 
5
5
  // src/components/inline-popover/inline-popover/element.gen.ts
6
6
  import { defineCustomElement, registerCustomElement } from "@aria-ui/core";
@@ -69,7 +69,7 @@ function getDomDecoration(view) {
69
69
  }
70
70
  function getDomRange(view) {
71
71
  const win = view.dom.ownerDocument.defaultView;
72
- const selection = win == null ? void 0 : win.getSelection();
72
+ const selection = win?.getSelection();
73
73
  if (!selection || selection.isCollapsed) {
74
74
  return;
75
75
  }
@@ -121,19 +121,17 @@ function useResizableHandleState(host, state, context) {
121
121
  let aspectRatio = 1;
122
122
  const pointerPressing = createSignal(false);
123
123
  const handlePointerDown = (event) => {
124
- var _a;
125
124
  event.preventDefault();
126
125
  pointerPressing.set(true);
127
126
  startX = event.x;
128
127
  startY = event.y;
129
- const size = (_a = context.onResizeStart.get()) == null ? void 0 : _a();
128
+ const size = context.onResizeStart.get()?.();
130
129
  if (size) {
131
130
  ;
132
131
  [width, height, aspectRatio] = size;
133
132
  }
134
133
  };
135
134
  const handlePointerMove = (event) => {
136
- var _a;
137
135
  event.preventDefault();
138
136
  const dx = event.x - startX;
139
137
  const dy = event.y - startY;
@@ -145,13 +143,12 @@ function useResizableHandleState(host, state, context) {
145
143
  dy,
146
144
  aspectRatio
147
145
  );
148
- (_a = context.onResize.get()) == null ? void 0 : _a(w, h);
146
+ context.onResize.get()?.(w, h);
149
147
  };
150
148
  const handlePointerUp = (event) => {
151
- var _a;
152
149
  event.preventDefault();
153
150
  pointerPressing.set(false);
154
- (_a = context.onResizeEnd.get()) == null ? void 0 : _a();
151
+ context.onResizeEnd.get()?.();
155
152
  };
156
153
  useEffect(host, () => {
157
154
  host.addEventListener("pointerdown", handlePointerDown);
@@ -200,9 +197,8 @@ import {
200
197
  function useResizableRoot(host, { state, emit }) {
201
198
  const resizing = createSignal2(false);
202
199
  const onResizeStart = () => {
203
- var _a;
204
200
  const { width, height } = host.getBoundingClientRect();
205
- let aspectRatio = (_a = state.aspectRatio.peek()) != null ? _a : width / height;
201
+ let aspectRatio = state.aspectRatio.peek() ?? width / height;
206
202
  if (!isFinitePositiveNumber(aspectRatio)) {
207
203
  aspectRatio = 0;
208
204
  }
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ZGQ225UP.js";
4
4
  import {
5
5
  useEditorExtension
6
- } from "./chunk-MZSYOTZT.js";
6
+ } from "./chunk-WTW6FOH3.js";
7
7
 
8
8
  // src/components/table-handle/table-handle-column-root/element.gen.ts
9
9
  import { defineCustomElement, registerCustomElement } from "@aria-ui/core";
@@ -34,13 +34,11 @@ function useTableHandleColumnRoot(host, { state }) {
34
34
  const { editor, ...overlayState } = state;
35
35
  const rootContext = tableHandleRootContext.consume(host);
36
36
  const colFirstCellPos = createComputed(() => {
37
- var _a;
38
- return (_a = rootContext.get()) == null ? void 0 : _a.colFirstCellPos;
37
+ return rootContext.get()?.colFirstCellPos;
39
38
  });
40
39
  const referenceCell = createComputed(() => {
41
- var _a;
42
40
  const pos = colFirstCellPos.get();
43
- const view = (_a = editor.get()) == null ? void 0 : _a.view;
41
+ const view = editor.get()?.view;
44
42
  if (!pos || !view) return null;
45
43
  return view.nodeDOM(pos);
46
44
  });
@@ -99,9 +97,8 @@ function useTableHandleColumnTrigger(host, { state }) {
99
97
  useMenuTrigger(host);
100
98
  const context = tableHandleRootContext.consume(host);
101
99
  useEventListener(host, "pointerdown", () => {
102
- var _a;
103
100
  const editor = state.editor.peek();
104
- const cellPos = (_a = context.peek()) == null ? void 0 : _a.cellPos;
101
+ const cellPos = context.peek()?.cellPos;
105
102
  if (!editor || !cellPos) return;
106
103
  editor.exec(selectTableColumn({ head: cellPos }));
107
104
  });
@@ -289,9 +286,8 @@ function isHoveringCellInfoEqual(a, b) {
289
286
  return a.rowIndex === b.rowIndex && a.colIndex === b.colIndex && a.cellPos === b.cellPos && a.rowFirstCellPos === b.rowFirstCellPos && a.colFirstCellPos === b.colFirstCellPos;
290
287
  }
291
288
  function domCellAround(target) {
292
- var _a;
293
289
  while (target && target.nodeName != "TD" && target.nodeName != "TH") {
294
- target = ((_a = target.classList) == null ? void 0 : _a.contains("ProseMirror")) ? null : target.parentNode;
290
+ target = target.classList?.contains("ProseMirror") ? null : target.parentNode;
295
291
  }
296
292
  return target;
297
293
  }
@@ -361,18 +357,17 @@ function useHoveringCell(host, editor) {
361
357
  function defineCellHoverHandler(handler) {
362
358
  const pointerHandler = (view, event) => {
363
359
  const hoveringCell = getHoveringCell(view, event);
364
- return handler(hoveringCell != null ? hoveringCell : null);
360
+ return handler(hoveringCell ?? null);
365
361
  };
366
362
  return defineDOMEventHandler2("pointerover", pointerHandler);
367
363
  }
368
364
  function useSelecting(host, editor, isInTable) {
369
365
  const selecting = createSignal4(false);
370
366
  useEffect3(host, () => {
371
- var _a;
372
367
  if (!isInTable.get()) {
373
368
  return;
374
369
  }
375
- const root = (_a = editor.peek()) == null ? void 0 : _a.view.root;
370
+ const root = editor.peek()?.view.root;
376
371
  if (!root) {
377
372
  return;
378
373
  }
@@ -433,13 +428,11 @@ function useTableHandleRowRoot(host, { state }) {
433
428
  const { editor, ...overlayState } = state;
434
429
  const rootContext = tableHandleRootContext.consume(host);
435
430
  const rowFirstCellPos = createComputed4(() => {
436
- var _a;
437
- return (_a = rootContext.get()) == null ? void 0 : _a.rowFirstCellPos;
431
+ return rootContext.get()?.rowFirstCellPos;
438
432
  });
439
433
  const referenceCell = createComputed4(() => {
440
- var _a;
441
434
  const pos = rowFirstCellPos.get();
442
- const view = (_a = editor.get()) == null ? void 0 : _a.view;
435
+ const view = editor.get()?.view;
443
436
  if (!pos || !view) return null;
444
437
  return view.nodeDOM(pos);
445
438
  });
@@ -501,9 +494,8 @@ function useTableHandleRowTrigger(host, {
501
494
  useMenuTrigger2(host);
502
495
  const context = tableHandleRootContext.consume(host);
503
496
  useEventListener2(host, "pointerdown", () => {
504
- var _a;
505
497
  const editor = state.editor.peek();
506
- const cellPos = (_a = context.peek()) == null ? void 0 : _a.cellPos;
498
+ const cellPos = context.peek()?.cellPos;
507
499
  if (!editor || !cellPos) return;
508
500
  editor.exec(selectTableRow({ head: cellPos }));
509
501
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/web",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.5.3",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -71,31 +71,31 @@
71
71
  ],
72
72
  "dependencies": {
73
73
  "@aria-ui/collection": "^0.0.4",
74
- "@aria-ui/core": "^0.0.19",
75
- "@aria-ui/listbox": "^0.0.20",
76
- "@aria-ui/menu": "^0.0.15",
77
- "@aria-ui/overlay": "^0.0.21",
78
- "@aria-ui/popover": "^0.0.23",
79
- "@aria-ui/presence": "^0.0.16",
80
- "@aria-ui/tooltip": "^0.0.25",
74
+ "@aria-ui/core": "^0.0.20",
75
+ "@aria-ui/listbox": "^0.0.22",
76
+ "@aria-ui/menu": "^0.0.17",
77
+ "@aria-ui/overlay": "^0.0.23",
78
+ "@aria-ui/popover": "^0.0.25",
79
+ "@aria-ui/presence": "^0.0.17",
80
+ "@aria-ui/tooltip": "^0.0.27",
81
81
  "@floating-ui/dom": "^1.6.12",
82
- "@zag-js/dom-query": "^0.78.3",
82
+ "@zag-js/dom-query": "^0.79.3",
83
83
  "just-map-values": "^3.2.0",
84
84
  "just-omit": "^2.2.0",
85
- "prosemirror-tables": "^1.6.1",
85
+ "prosemirror-tables": "^1.6.2",
86
86
  "@prosekit/core": "^0.7.14",
87
- "@prosekit/extensions": "^0.7.23",
88
- "@prosekit/pm": "^0.1.9"
87
+ "@prosekit/pm": "^0.1.9",
88
+ "@prosekit/extensions": "^0.7.23"
89
89
  },
90
90
  "devDependencies": {
91
91
  "tsup": "^8.3.5",
92
- "typescript": "~5.6.3",
92
+ "typescript": "~5.7.2",
93
93
  "vitest": "^2.1.8",
94
94
  "@prosekit/dev": "0.0.0"
95
95
  },
96
96
  "scripts": {
97
- "build:tsup": "tsup",
98
- "build:tsc": "tsc -b tsconfig.json"
97
+ "build:tsc": "tsc -b tsconfig.json",
98
+ "build:tsup": "tsup"
99
99
  },
100
100
  "types": "./dist/prosekit-web.d.ts",
101
101
  "typesVersions": {