@prosekit/web 0.7.11 → 0.7.13

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.
Files changed (113) hide show
  1. package/dist/{get-default-state-BzBimBWi.js → get-default-state.js} +2 -3
  2. package/dist/get-default-state.js.map +1 -0
  3. package/dist/{get-safe-editor-view-Dt9Amrcn.js → get-safe-editor-view.js} +2 -2
  4. package/dist/get-safe-editor-view.js.map +1 -0
  5. package/dist/prosekit-web-autocomplete.d.ts.map +1 -1
  6. package/dist/prosekit-web-autocomplete.js +8 -23
  7. package/dist/prosekit-web-autocomplete.js.map +1 -1
  8. package/dist/prosekit-web-block-handle.js +53 -80
  9. package/dist/prosekit-web-block-handle.js.map +1 -1
  10. package/dist/prosekit-web-drop-indicator.js +3 -6
  11. package/dist/prosekit-web-drop-indicator.js.map +1 -1
  12. package/dist/prosekit-web-inline-popover.js +2 -9
  13. package/dist/prosekit-web-inline-popover.js.map +1 -1
  14. package/dist/prosekit-web-popover.js +1 -4
  15. package/dist/prosekit-web-popover.js.map +1 -1
  16. package/dist/prosekit-web-resizable.d.ts.map +1 -1
  17. package/dist/prosekit-web-resizable.js +30 -13
  18. package/dist/prosekit-web-resizable.js.map +1 -1
  19. package/dist/prosekit-web-table-handle.js +76 -48
  20. package/dist/prosekit-web-table-handle.js.map +1 -1
  21. package/dist/prosekit-web-tooltip.js +1 -4
  22. package/dist/prosekit-web-tooltip.js.map +1 -1
  23. package/dist/prosekit-web.js +1 -1
  24. package/dist/prosekit-web.js.map +1 -1
  25. package/dist/{use-editor-extension-B2WuUfnd.js → use-editor-extension.js} +2 -3
  26. package/dist/use-editor-extension.js.map +1 -0
  27. package/dist/{use-scrolling-BjVzAkiZ.js → use-scrolling.js} +2 -4
  28. package/dist/use-scrolling.js.map +1 -0
  29. package/package.json +11 -10
  30. package/src/components/autocomplete/autocomplete-empty/element.gen.ts +2 -2
  31. package/src/components/autocomplete/autocomplete-item/element.gen.ts +2 -2
  32. package/src/components/autocomplete/autocomplete-item/setup.ts +2 -2
  33. package/src/components/autocomplete/autocomplete-list/element.gen.ts +2 -2
  34. package/src/components/autocomplete/autocomplete-list/setup.ts +6 -5
  35. package/src/components/autocomplete/autocomplete-popover/element.gen.ts +2 -2
  36. package/src/components/autocomplete/autocomplete-popover/helpers.spec.ts +1 -1
  37. package/src/components/autocomplete/autocomplete-popover/helpers.ts +2 -2
  38. package/src/components/autocomplete/autocomplete-popover/setup.ts +8 -8
  39. package/src/components/autocomplete/index.gen.ts +12 -12
  40. package/src/components/block-handle/block-handle-add/element.gen.ts +2 -2
  41. package/src/components/block-handle/block-handle-add/setup.ts +2 -2
  42. package/src/components/block-handle/block-handle-draggable/element.gen.ts +2 -2
  43. package/src/components/block-handle/block-handle-draggable/set-drag-preview.ts +12 -13
  44. package/src/components/block-handle/block-handle-draggable/setup.ts +9 -14
  45. package/src/components/block-handle/block-handle-popover/element.gen.ts +2 -2
  46. package/src/components/block-handle/block-handle-popover/pointer-move.ts +4 -12
  47. package/src/components/block-handle/block-handle-popover/setup.ts +6 -8
  48. package/src/components/block-handle/index.gen.ts +9 -9
  49. package/src/components/drop-indicator/drop-indicator/element.gen.ts +2 -2
  50. package/src/components/drop-indicator/drop-indicator/setup.ts +4 -4
  51. package/src/components/drop-indicator/index.gen.ts +3 -3
  52. package/src/components/inline-popover/index.gen.ts +3 -3
  53. package/src/components/inline-popover/inline-popover/element.gen.ts +2 -2
  54. package/src/components/inline-popover/inline-popover/setup.ts +5 -5
  55. package/src/components/popover/index.gen.ts +9 -9
  56. package/src/components/popover/popover-content/element.gen.ts +2 -2
  57. package/src/components/popover/popover-root/element.gen.ts +2 -2
  58. package/src/components/popover/popover-trigger/element.gen.ts +2 -2
  59. package/src/components/resizable/index.gen.ts +6 -6
  60. package/src/components/resizable/resizable-handle/calc-resize.spec.ts +1 -1
  61. package/src/components/resizable/resizable-handle/calc-resize.ts +1 -1
  62. package/src/components/resizable/resizable-handle/element.gen.ts +2 -2
  63. package/src/components/resizable/resizable-handle/setup.ts +11 -4
  64. package/src/components/resizable/resizable-root/element.gen.ts +2 -2
  65. package/src/components/resizable/resizable-root/setup.ts +11 -4
  66. package/src/components/resizable/resizable-root/types.ts +37 -3
  67. package/src/components/table-handle/context.ts +1 -1
  68. package/src/components/table-handle/dnd.ts +3 -3
  69. package/src/components/table-handle/hooks/use-drop.ts +2 -2
  70. package/src/components/table-handle/index.gen.ts +27 -27
  71. package/src/components/table-handle/table-handle-column-root/element.gen.ts +2 -2
  72. package/src/components/table-handle/table-handle-column-root/setup.ts +4 -4
  73. package/src/components/table-handle/table-handle-column-trigger/element.gen.ts +2 -2
  74. package/src/components/table-handle/table-handle-column-trigger/setup.ts +3 -3
  75. package/src/components/table-handle/table-handle-drag-preview/element.gen.ts +2 -2
  76. package/src/components/table-handle/table-handle-drag-preview/render-preview.ts +5 -5
  77. package/src/components/table-handle/table-handle-drag-preview/setup.ts +5 -5
  78. package/src/components/table-handle/table-handle-drag-preview/updater.ts +4 -4
  79. package/src/components/table-handle/table-handle-drop-indicator/element.gen.ts +2 -2
  80. package/src/components/table-handle/table-handle-drop-indicator/setup.ts +4 -4
  81. package/src/components/table-handle/table-handle-drop-indicator/updater.ts +5 -5
  82. package/src/components/table-handle/table-handle-popover-content/element.gen.ts +2 -2
  83. package/src/components/table-handle/table-handle-popover-content/setup.ts +3 -3
  84. package/src/components/table-handle/table-handle-popover-item/element.gen.ts +2 -2
  85. package/src/components/table-handle/table-handle-popover-item/setup.ts +1 -1
  86. package/src/components/table-handle/table-handle-root/element.gen.ts +2 -2
  87. package/src/components/table-handle/table-handle-root/setup.ts +8 -8
  88. package/src/components/table-handle/table-handle-row-root/element.gen.ts +2 -2
  89. package/src/components/table-handle/table-handle-row-root/setup.ts +4 -4
  90. package/src/components/table-handle/table-handle-row-trigger/element.gen.ts +2 -2
  91. package/src/components/table-handle/table-handle-row-trigger/setup.ts +3 -3
  92. package/src/components/tooltip/index.gen.ts +9 -9
  93. package/src/components/tooltip/tooltip-content/element.gen.ts +2 -2
  94. package/src/components/tooltip/tooltip-root/element.gen.ts +2 -2
  95. package/src/components/tooltip/tooltip-trigger/element.gen.ts +2 -2
  96. package/src/constants.ts +1 -0
  97. package/src/hooks/use-editor-focus-event.ts +1 -1
  98. package/src/hooks/use-editor-typing.ts +1 -1
  99. package/src/hooks/use-editor-update-event.ts +1 -1
  100. package/src/hooks/use-keymap.ts +1 -1
  101. package/src/hooks/use-selecting.ts +1 -1
  102. package/src/index.ts +1 -1
  103. package/src/utils/fade-color.ts +1 -1
  104. package/src/utils/get-client-rect.ts +47 -9
  105. package/src/utils/get-default-state.spec.ts +1 -1
  106. package/dist/get-default-state-BzBimBWi.js.map +0 -1
  107. package/dist/get-safe-editor-view-Dt9Amrcn.js.map +0 -1
  108. package/dist/inject-style-BaFaVQvj.js +0 -76
  109. package/dist/inject-style-BaFaVQvj.js.map +0 -1
  110. package/dist/use-editor-extension-B2WuUfnd.js.map +0 -1
  111. package/dist/use-scrolling-BjVzAkiZ.js.map +0 -1
  112. package/src/utils/get-box-element.ts +0 -20
  113. package/src/utils/throttle.ts +0 -17
@@ -2,7 +2,7 @@ import type { ReadonlySignal } from '@aria-ui/core'
2
2
  import { createSignal, useEffect, type ConnectableElement } from '@aria-ui/core'
3
3
  import type { Editor } from '@prosekit/core'
4
4
 
5
- import { getSafeEditorView } from '../utils/get-safe-editor-view'
5
+ import { getSafeEditorView } from '../utils/get-safe-editor-view.ts'
6
6
 
7
7
  /**
8
8
  * Detect if the user is selecting text inside the editor, in which case some
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export { queueExtension } from './queue-extension'
1
+ export { queueExtension } from './queue-extension.ts'
@@ -1,4 +1,4 @@
1
- import { isColorMixSupported } from './css-feature-detection'
1
+ import { isColorMixSupported } from './css-feature-detection.ts'
2
2
 
3
3
  /**
4
4
  * Convert a color to a color with opacity
@@ -1,19 +1,29 @@
1
- /**
2
- * Similar to `element.getBoundingClientRect`, but handles `display: contents` elements.
3
- */
4
- export function getClientRect(element: Element): {
1
+ interface Rect {
5
2
  top: number
6
- right: number
7
3
  bottom: number
4
+ right: number
8
5
  left: number
9
- } {
6
+ }
7
+
8
+ interface IncludeExtraOptions {
9
+ top?: boolean
10
+ bottom?: boolean
11
+ right?: boolean
12
+ left?: boolean
13
+ }
14
+
15
+ /**
16
+ * Similar to `element.getBoundingClientRect`, but handles `display: contents` CSS
17
+ * property and optionally includes margins and outlines.
18
+ */
19
+ export function getClientRect(element: Element, includeExtra?: IncludeExtraOptions | false): Rect {
10
20
  const rect = element.getBoundingClientRect()
11
21
  if (rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0) {
12
22
  // Suspiciously rect, probably an element with `display: contents`, in
13
23
  // which case `element.getClientRects()` will return an empty array.
14
24
  if (element.getClientRects().length === 0) {
15
- const children = Array.from(element.children)
16
- const rects = children.map(child => getClientRect(child))
25
+ const children = [...element.children]
26
+ const rects = children.map(child => getClientRect(child, includeExtra))
17
27
  if (rects.length === 0) {
18
28
  return rect
19
29
  }
@@ -31,5 +41,33 @@ export function getClientRect(element: Element): {
31
41
  return { top, bottom, left, right }
32
42
  }
33
43
  }
34
- return rect
44
+ return includeExtra ? addExtra(element, rect, includeExtra) : rect
45
+ }
46
+
47
+ function addExtra(element: Element, rect: Rect, options: IncludeExtraOptions): Rect {
48
+ const view = element.ownerDocument?.defaultView
49
+ if (!view) {
50
+ return rect
51
+ }
52
+
53
+ const style = view.getComputedStyle(element)
54
+ const marginTop = options.top ? Number.parseFloat(style.marginTop) || 0 : 0
55
+ const marginBottom = options.bottom ? Number.parseFloat(style.marginBottom) || 0 : 0
56
+ const marginRight = options.right ? Number.parseFloat(style.marginRight) || 0 : 0
57
+ const marginLeft = options.left ? Number.parseFloat(style.marginLeft) || 0 : 0
58
+
59
+ const outlineWidth = Number.parseFloat(style.outlineWidth) || 0
60
+ const outlineOffset = Number.parseFloat(style.outlineOffset) || 0
61
+ const outline = Math.max(outlineWidth + outlineOffset, 0)
62
+ const outlineTop = options.top ? outline : 0
63
+ const outlineBottom = options.bottom ? outline : 0
64
+ const outlineRight = options.right ? outline : 0
65
+ const outlineLeft = options.left ? outline : 0
66
+
67
+ return {
68
+ top: rect.top - Math.max(marginTop, outlineTop),
69
+ bottom: rect.bottom + Math.max(marginBottom, outlineBottom),
70
+ right: rect.right + Math.max(marginRight, outlineRight),
71
+ left: rect.left - Math.max(marginLeft, outlineLeft),
72
+ }
35
73
  }
@@ -1,7 +1,7 @@
1
1
  import { createSignal, type PropDeclarations, type SignalState } from '@aria-ui/core'
2
2
  import { describe, expect, it } from 'vitest'
3
3
 
4
- import { getStateWithDefaults } from './get-default-state'
4
+ import { getStateWithDefaults } from './get-default-state.ts'
5
5
 
6
6
  type TestProps = {
7
7
  bool: boolean
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-default-state-BzBimBWi.js","names":[],"sources":["../src/utils/get-default-state.ts"],"sourcesContent":["import { createSignal, type PropDeclarations, type SignalState } from '@aria-ui/core'\n\nexport function getStateWithDefaults<\n Props extends Record<string, any> = Record<string, any>,\n>(\n state: Partial<SignalState<Props>>,\n props: PropDeclarations<Props>,\n): SignalState<Props> {\n const merged = { ...state } as SignalState<Props>\n\n for (const key of Object.keys(props) as (keyof Props)[]) {\n if (!merged[key]) {\n merged[key] = createSignal(props[key].default)\n }\n }\n\n return merged\n}\n"],"mappings":";;;AAEA,SAAgB,qBAGd,OACA,OACoB;CACpB,MAAM,SAAS,EAAE,GAAG,OAAO;AAE3B,MAAK,MAAM,OAAO,OAAO,KAAK,MAAM,CAClC,KAAI,CAAC,OAAO,KACV,QAAO,OAAO,aAAa,MAAM,KAAK,QAAQ;AAIlD,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-safe-editor-view-Dt9Amrcn.js","names":[],"sources":["../src/utils/get-safe-editor-view.ts"],"sourcesContent":["import type { Editor } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\n/**\n * @internal\n */\nexport function getSafeEditorView(editor?: Editor | null): EditorView | undefined {\n if (!editor || !editor.mounted) return\n return editor.view\n}\n"],"mappings":";;;;AAMA,SAAgB,kBAAkB,QAAgD;AAChF,KAAI,CAAC,UAAU,CAAC,OAAO,QAAS;AAChC,QAAO,OAAO"}
@@ -1,76 +0,0 @@
1
- import { getDocument, getId } from "@ocavue/utils";
2
-
3
- //#region src/utils/clone-element.ts
4
- /**
5
- * Creates a deep clone of an Element, including all computed styles so that
6
- * it looks almost exactly the same as the original element.
7
- */
8
- function deepCloneElement(element, important = false) {
9
- const clonedElement = element.cloneNode(true);
10
- return [clonedElement, deepCopyStyles(element, clonedElement, important)];
11
- }
12
- /**
13
- * Creates a clone of an Element, including all computed styles so that
14
- * it looks similar enough to the original element.
15
- */
16
- function cloneElement(element, important = false) {
17
- const clonedElement = element.cloneNode();
18
- return [clonedElement, copyStyles(element, clonedElement, important)];
19
- }
20
- function deepCopyStyles(source, target, important) {
21
- const sources = [source];
22
- const targets = [target];
23
- const styles = [];
24
- while (sources.length > 0 && sources.length === targets.length) {
25
- const source = sources.pop();
26
- const target = targets.pop();
27
- if (!source || !target) break;
28
- const style = copyStyles(source, target, important);
29
- if (style) styles.push(style);
30
- sources.push(...source.children);
31
- targets.push(...target.children);
32
- }
33
- return styles.join("\n");
34
- }
35
- function copyStyles(source, target, important) {
36
- if (!source || !target) return "";
37
- const view = source.ownerDocument?.defaultView;
38
- if (!view) return "";
39
- const sourceStyle = view.getComputedStyle(source);
40
- const targetStyle = target.style;
41
- if (!sourceStyle || !targetStyle) return "";
42
- for (const key of sourceStyle) targetStyle.setProperty(key, sourceStyle.getPropertyValue(key), important ? "important" : sourceStyle.getPropertyPriority(key) || "");
43
- const styles = [];
44
- for (const pseudoSelector of [":before", ":after"]) {
45
- const sourcePseudoStyle = view.getComputedStyle(source, pseudoSelector);
46
- const targetPseudoStyle = view.getComputedStyle(target, pseudoSelector);
47
- if (!sourcePseudoStyle) continue;
48
- const content = sourcePseudoStyle.getPropertyValue("content");
49
- if (!(content && content !== "none" && content !== "normal")) continue;
50
- const cssProps = [];
51
- for (const property of sourcePseudoStyle) {
52
- const sourceValue = sourcePseudoStyle.getPropertyValue(property);
53
- const sourcePriority = sourcePseudoStyle.getPropertyPriority(property);
54
- const targetValue = targetPseudoStyle.getPropertyValue(property);
55
- const targetPriority = targetPseudoStyle.getPropertyPriority(property);
56
- if (sourceValue !== targetValue || sourcePriority !== targetPriority) cssProps.push(`${property}: ${sourceValue}${sourcePriority ? " !important" : ""};`);
57
- }
58
- const uniqueClassName = `clone-pseudo-element-${getId()}`;
59
- target.classList.add(uniqueClassName);
60
- styles.push(`.${uniqueClassName}${pseudoSelector} { ${cssProps.join(" ")} }`);
61
- }
62
- return styles.join("\n");
63
- }
64
-
65
- //#endregion
66
- //#region src/utils/inject-style.ts
67
- function injectStyle(container, styleText) {
68
- if (!styleText) return;
69
- const style = getDocument(container).createElement("style");
70
- style.textContent = styleText;
71
- container.appendChild(style);
72
- }
73
-
74
- //#endregion
75
- export { cloneElement as n, deepCloneElement as r, injectStyle as t };
76
- //# sourceMappingURL=inject-style-BaFaVQvj.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-style-BaFaVQvj.js","names":[],"sources":["../src/utils/clone-element.ts","../src/utils/inject-style.ts"],"sourcesContent":["import { getId } from '@ocavue/utils'\n\n/**\n * Creates a deep clone of an Element, including all computed styles so that\n * it looks almost exactly the same as the original element.\n */\nexport function deepCloneElement<T extends Element>(element: T, important = false): [T, string] {\n const clonedElement = element.cloneNode(true) as T\n const style = deepCopyStyles(element, clonedElement, important)\n return [clonedElement, style]\n}\n\n/**\n * Creates a clone of an Element, including all computed styles so that\n * it looks similar enough to the original element.\n */\nexport function cloneElement<T extends Element>(element: T, important = false): [T, string] {\n const clonedElement = element.cloneNode() as T\n const style = copyStyles(element, clonedElement, important)\n return [clonedElement, style]\n}\n\nfunction deepCopyStyles(source: Element, target: Element, important: boolean): string {\n const sources = [source]\n const targets = [target]\n const styles: string[] = []\n\n while (sources.length > 0 && sources.length === targets.length) {\n const source = sources.pop()\n const target = targets.pop()\n\n if (!source || !target) {\n break\n }\n\n const style = copyStyles(source, target, important)\n if (style) {\n styles.push(style)\n }\n\n sources.push(...source.children)\n targets.push(...target.children)\n }\n\n return styles.join('\\n')\n}\n\nfunction copyStyles(source: Element, target: Element, important: boolean): string {\n if (!source || !target) {\n return ''\n }\n\n const view = source.ownerDocument?.defaultView\n if (!view) {\n return ''\n }\n\n // Known issue: pseudo styles are not copied.\n const sourceStyle = view.getComputedStyle(source)\n const targetStyle = (target as HTMLElement | SVGElement | MathMLElement).style\n\n if (!sourceStyle || !targetStyle) {\n return ''\n }\n\n for (const key of sourceStyle) {\n targetStyle.setProperty(\n key,\n sourceStyle.getPropertyValue(key),\n // Enforce important to avoid the style being overridden when the element\n // is connected to the page.\n // See https://github.com/prosekit/prosekit/issues/1185 for more details.\n important ? 'important' : (sourceStyle.getPropertyPriority(key) || ''),\n )\n }\n\n const styles: string[] = []\n for (const pseudoSelector of [':before', ':after']) {\n const sourcePseudoStyle = view.getComputedStyle(source, pseudoSelector)\n const targetPseudoStyle = view.getComputedStyle(target, pseudoSelector)\n\n if (!sourcePseudoStyle) {\n continue\n }\n\n const content = sourcePseudoStyle.getPropertyValue('content')\n const hasPseudoElement = content && content !== 'none' && content !== 'normal'\n\n if (!hasPseudoElement) {\n continue\n }\n\n const cssProps: string[] = []\n for (const property of sourcePseudoStyle) {\n const sourceValue = sourcePseudoStyle.getPropertyValue(property)\n const sourcePriority = sourcePseudoStyle.getPropertyPriority(property)\n const targetValue = targetPseudoStyle.getPropertyValue(property)\n const targetPriority = targetPseudoStyle.getPropertyPriority(property)\n if (sourceValue !== targetValue || sourcePriority !== targetPriority) {\n cssProps.push(`${property}: ${sourceValue}${sourcePriority ? ' !important' : ''};`)\n }\n }\n\n const uniqueClassName = `clone-pseudo-element-${getId()}`\n target.classList.add(uniqueClassName)\n styles.push(`.${uniqueClassName}${pseudoSelector} { ${cssProps.join(' ')} }`)\n }\n\n return styles.join('\\n')\n}\n","import { getDocument } from '@ocavue/utils'\n\nexport function injectStyle(container: HTMLElement, styleText: string): void {\n if (!styleText) {\n return\n }\n const document = getDocument(container)\n const style = document.createElement('style')\n style.textContent = styleText\n container.appendChild(style)\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,iBAAoC,SAAY,YAAY,OAAoB;CAC9F,MAAM,gBAAgB,QAAQ,UAAU,KAAK;AAE7C,QAAO,CAAC,eADM,eAAe,SAAS,eAAe,UAAU,CAClC;;;;;;AAO/B,SAAgB,aAAgC,SAAY,YAAY,OAAoB;CAC1F,MAAM,gBAAgB,QAAQ,WAAW;AAEzC,QAAO,CAAC,eADM,WAAW,SAAS,eAAe,UAAU,CAC9B;;AAG/B,SAAS,eAAe,QAAiB,QAAiB,WAA4B;CACpF,MAAM,UAAU,CAAC,OAAO;CACxB,MAAM,UAAU,CAAC,OAAO;CACxB,MAAM,SAAmB,EAAE;AAE3B,QAAO,QAAQ,SAAS,KAAK,QAAQ,WAAW,QAAQ,QAAQ;EAC9D,MAAM,SAAS,QAAQ,KAAK;EAC5B,MAAM,SAAS,QAAQ,KAAK;AAE5B,MAAI,CAAC,UAAU,CAAC,OACd;EAGF,MAAM,QAAQ,WAAW,QAAQ,QAAQ,UAAU;AACnD,MAAI,MACF,QAAO,KAAK,MAAM;AAGpB,UAAQ,KAAK,GAAG,OAAO,SAAS;AAChC,UAAQ,KAAK,GAAG,OAAO,SAAS;;AAGlC,QAAO,OAAO,KAAK,KAAK;;AAG1B,SAAS,WAAW,QAAiB,QAAiB,WAA4B;AAChF,KAAI,CAAC,UAAU,CAAC,OACd,QAAO;CAGT,MAAM,OAAO,OAAO,eAAe;AACnC,KAAI,CAAC,KACH,QAAO;CAIT,MAAM,cAAc,KAAK,iBAAiB,OAAO;CACjD,MAAM,cAAe,OAAoD;AAEzE,KAAI,CAAC,eAAe,CAAC,YACnB,QAAO;AAGT,MAAK,MAAM,OAAO,YAChB,aAAY,YACV,KACA,YAAY,iBAAiB,IAAI,EAIjC,YAAY,cAAe,YAAY,oBAAoB,IAAI,IAAI,GACpE;CAGH,MAAM,SAAmB,EAAE;AAC3B,MAAK,MAAM,kBAAkB,CAAC,WAAW,SAAS,EAAE;EAClD,MAAM,oBAAoB,KAAK,iBAAiB,QAAQ,eAAe;EACvE,MAAM,oBAAoB,KAAK,iBAAiB,QAAQ,eAAe;AAEvE,MAAI,CAAC,kBACH;EAGF,MAAM,UAAU,kBAAkB,iBAAiB,UAAU;AAG7D,MAAI,EAFqB,WAAW,YAAY,UAAU,YAAY,UAGpE;EAGF,MAAM,WAAqB,EAAE;AAC7B,OAAK,MAAM,YAAY,mBAAmB;GACxC,MAAM,cAAc,kBAAkB,iBAAiB,SAAS;GAChE,MAAM,iBAAiB,kBAAkB,oBAAoB,SAAS;GACtE,MAAM,cAAc,kBAAkB,iBAAiB,SAAS;GAChE,MAAM,iBAAiB,kBAAkB,oBAAoB,SAAS;AACtE,OAAI,gBAAgB,eAAe,mBAAmB,eACpD,UAAS,KAAK,GAAG,SAAS,IAAI,cAAc,iBAAiB,gBAAgB,GAAG,GAAG;;EAIvF,MAAM,kBAAkB,wBAAwB,OAAO;AACvD,SAAO,UAAU,IAAI,gBAAgB;AACrC,SAAO,KAAK,IAAI,kBAAkB,eAAe,KAAK,SAAS,KAAK,IAAI,CAAC,IAAI;;AAG/E,QAAO,OAAO,KAAK,KAAK;;;;;AC1G1B,SAAgB,YAAY,WAAwB,WAAyB;AAC3E,KAAI,CAAC,UACH;CAGF,MAAM,QADW,YAAY,UAAU,CAChB,cAAc,QAAQ;AAC7C,OAAM,cAAc;AACpB,WAAU,YAAY,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-editor-extension-B2WuUfnd.js","names":[],"sources":["../src/hooks/use-editor-extension.ts"],"sourcesContent":["import { useEffect, type ConnectableElement, type ReadonlySignal } from '@aria-ui/core'\nimport type { Editor, Extension } from '@prosekit/core'\n\nexport function useEditorExtension(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n extension: Extension,\n): void {\n useEffect(host, () => {\n return editor.get()?.use(extension)\n })\n}\n"],"mappings":";;;AAGA,SAAgB,mBACd,MACA,QACA,WACM;AACN,WAAU,YAAY;AACpB,SAAO,OAAO,KAAK,EAAE,IAAI,UAAU;GACnC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-scrolling-BjVzAkiZ.js","names":[],"sources":["../src/utils/assign-styles.ts","../src/hooks/use-scrolling.ts"],"sourcesContent":["import type { ConditionalPick } from 'type-fest'\n\n// Only include CSS properties whose value type is `string`\ntype StringStyleDeclaration = Partial<ConditionalPick<CSSStyleDeclaration, string>>\n\n/**\n * A type-safe version of `Object.assign` for `element.style`.\n */\nexport function assignStyles(\n element: HTMLElement | SVGElement | MathMLElement,\n styles: StringStyleDeclaration,\n): void {\n Object.assign(element.style, styles)\n}\n","import { createSignal, useEffect, type ConnectableElement, type ReadonlySignal } from '@aria-ui/core'\nimport { getNearestOverflowAncestor } from '@zag-js/dom-query'\n\nexport function useScrolling(host: ConnectableElement): ReadonlySignal<boolean> {\n const scrolling = createSignal(false)\n\n useEffect(host, () => {\n const scrollableParent = getNearestOverflowAncestor(host)\n\n const handleScroll = () => {\n scrolling.set(true)\n }\n\n const handleMouseMove = () => {\n scrolling.set(false)\n }\n\n scrollableParent.addEventListener('scroll', handleScroll, { passive: true })\n window.addEventListener('mousemove', handleMouseMove, { passive: true })\n window.addEventListener('pointermove', handleMouseMove, { passive: true })\n\n return () => {\n scrollableParent.removeEventListener('scroll', handleScroll)\n window.removeEventListener('mousemove', handleMouseMove)\n window.removeEventListener('pointermove', handleMouseMove)\n }\n })\n\n return scrolling\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,aACd,SACA,QACM;AACN,QAAO,OAAO,QAAQ,OAAO,OAAO;;;;;ACTtC,SAAgB,aAAa,MAAmD;CAC9E,MAAM,YAAY,aAAa,MAAM;AAErC,WAAU,YAAY;EACpB,MAAM,mBAAmB,2BAA2B,KAAK;EAEzD,MAAM,qBAAqB;AACzB,aAAU,IAAI,KAAK;;EAGrB,MAAM,wBAAwB;AAC5B,aAAU,IAAI,MAAM;;AAGtB,mBAAiB,iBAAiB,UAAU,cAAc,EAAE,SAAS,MAAM,CAAC;AAC5E,SAAO,iBAAiB,aAAa,iBAAiB,EAAE,SAAS,MAAM,CAAC;AACxE,SAAO,iBAAiB,eAAe,iBAAiB,EAAE,SAAS,MAAM,CAAC;AAE1E,eAAa;AACX,oBAAiB,oBAAoB,UAAU,aAAa;AAC5D,UAAO,oBAAoB,aAAa,gBAAgB;AACxD,UAAO,oBAAoB,eAAe,gBAAgB;;GAE5D;AAEF,QAAO"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Returns the element that has a box.
3
- */
4
- export function getBoxElement(element: Element): Element | null | undefined {
5
- const window = element.ownerDocument.defaultView
6
- if (!window) {
7
- return
8
- }
9
-
10
- const style = window.getComputedStyle(element)
11
- const display = style.display
12
-
13
- if (display === 'contents' && element.childElementCount === 1) {
14
- return element.firstElementChild
15
- } else if (display === 'none') {
16
- return
17
- }
18
-
19
- return element
20
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export function throttle<Args extends any[]>(
5
- callback: (...args: Args) => void,
6
- wait: number,
7
- ): (...args: Args) => void {
8
- let lastTime = 0
9
-
10
- return (...args: Args) => {
11
- const now = Date.now()
12
- if (now - lastTime >= wait) {
13
- callback(...args)
14
- lastTime = now
15
- }
16
- }
17
- }