@prosekit/solid 0.7.0-beta.4 → 0.7.0-beta.5
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/editor-context.js +0 -2
- package/dist/editor-context.js.map +1 -1
- package/dist/prosekit-solid-autocomplete.d.ts +10 -61
- package/dist/prosekit-solid-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-solid-autocomplete.js +5 -50
- package/dist/prosekit-solid-autocomplete.js.map +1 -1
- package/dist/prosekit-solid-block-handle.d.ts +10 -61
- package/dist/prosekit-solid-block-handle.d.ts.map +1 -1
- package/dist/prosekit-solid-block-handle.js +5 -50
- package/dist/prosekit-solid-block-handle.js.map +1 -1
- package/dist/prosekit-solid-drop-indicator.d.ts +2 -13
- package/dist/prosekit-solid-drop-indicator.d.ts.map +1 -1
- package/dist/prosekit-solid-drop-indicator.js +1 -10
- package/dist/prosekit-solid-drop-indicator.js.map +1 -1
- package/dist/prosekit-solid-inline-popover.d.ts +6 -37
- package/dist/prosekit-solid-inline-popover.d.ts.map +1 -1
- package/dist/prosekit-solid-inline-popover.js +3 -30
- package/dist/prosekit-solid-inline-popover.js.map +1 -1
- package/dist/prosekit-solid-menu.d.ts +48 -88
- package/dist/prosekit-solid-menu.d.ts.map +1 -1
- package/dist/prosekit-solid-menu.js +50 -74
- package/dist/prosekit-solid-menu.js.map +1 -1
- package/dist/prosekit-solid-popover.d.ts +8 -49
- package/dist/prosekit-solid-popover.d.ts.map +1 -1
- package/dist/prosekit-solid-popover.js +4 -40
- package/dist/prosekit-solid-popover.js.map +1 -1
- package/dist/prosekit-solid-resizable.d.ts +4 -25
- package/dist/prosekit-solid-resizable.d.ts.map +1 -1
- package/dist/prosekit-solid-resizable.js +2 -20
- package/dist/prosekit-solid-resizable.js.map +1 -1
- package/dist/prosekit-solid-table-handle.d.ts +22 -133
- package/dist/prosekit-solid-table-handle.d.ts.map +1 -1
- package/dist/prosekit-solid-table-handle.js +11 -110
- package/dist/prosekit-solid-table-handle.js.map +1 -1
- package/dist/prosekit-solid-tooltip.d.ts +8 -49
- package/dist/prosekit-solid-tooltip.d.ts.map +1 -1
- package/dist/prosekit-solid-tooltip.js +4 -40
- package/dist/prosekit-solid-tooltip.js.map +1 -1
- package/dist/prosekit-solid.d.ts +0 -21
- package/dist/prosekit-solid.d.ts.map +1 -1
- package/dist/prosekit-solid.js +0 -28
- package/dist/prosekit-solid.js.map +1 -1
- package/package.json +4 -4
- package/src/components/autocomplete/autocomplete-empty.gen.ts +3 -13
- package/src/components/autocomplete/autocomplete-item.gen.ts +3 -13
- package/src/components/autocomplete/autocomplete-popup.gen.ts +3 -13
- package/src/components/autocomplete/autocomplete-positioner.gen.ts +3 -13
- package/src/components/autocomplete/autocomplete-root.gen.ts +3 -13
- package/src/components/autocomplete/index.gen.ts +1 -3
- package/src/components/block-handle/block-handle-add.gen.ts +3 -13
- package/src/components/block-handle/block-handle-draggable.gen.ts +3 -13
- package/src/components/block-handle/block-handle-popup.gen.ts +3 -13
- package/src/components/block-handle/block-handle-positioner.gen.ts +3 -13
- package/src/components/block-handle/block-handle-root.gen.ts +3 -13
- package/src/components/block-handle/index.gen.ts +1 -3
- package/src/components/drop-indicator/drop-indicator.gen.ts +3 -13
- package/src/components/drop-indicator/index.gen.ts +1 -3
- package/src/components/inline-popover/index.gen.ts +1 -3
- package/src/components/inline-popover/inline-popover-popup.gen.ts +3 -13
- package/src/components/inline-popover/inline-popover-positioner.gen.ts +3 -13
- package/src/components/inline-popover/inline-popover-root.gen.ts +3 -13
- package/src/components/menu/index.gen.ts +1 -3
- package/src/components/menu/menu-item.gen.ts +3 -13
- package/src/components/menu/menu-popup.gen.ts +3 -13
- package/src/components/menu/menu-positioner.gen.ts +3 -13
- package/src/components/menu/menu-root.gen.ts +3 -13
- package/src/components/menu/menu-submenu-root.gen.ts +65 -18
- package/src/components/menu/menu-submenu-trigger.gen.ts +39 -18
- package/src/components/menu/menu-trigger.gen.ts +3 -13
- package/src/components/popover/index.gen.ts +1 -3
- package/src/components/popover/popover-popup.gen.ts +3 -13
- package/src/components/popover/popover-positioner.gen.ts +3 -13
- package/src/components/popover/popover-root.gen.ts +3 -13
- package/src/components/popover/popover-trigger.gen.ts +3 -13
- package/src/components/resizable/index.gen.ts +1 -3
- package/src/components/resizable/resizable-handle.gen.ts +3 -13
- package/src/components/resizable/resizable-root.gen.ts +3 -13
- package/src/components/table-handle/index.gen.ts +1 -3
- package/src/components/table-handle/table-handle-column-menu-root.gen.ts +3 -13
- package/src/components/table-handle/table-handle-column-menu-trigger.gen.ts +3 -13
- package/src/components/table-handle/table-handle-column-popup.gen.ts +3 -13
- package/src/components/table-handle/table-handle-column-positioner.gen.ts +3 -13
- package/src/components/table-handle/table-handle-drag-preview.gen.ts +3 -13
- package/src/components/table-handle/table-handle-drop-indicator.gen.ts +3 -13
- package/src/components/table-handle/table-handle-root.gen.ts +3 -13
- package/src/components/table-handle/table-handle-row-menu-root.gen.ts +3 -13
- package/src/components/table-handle/table-handle-row-menu-trigger.gen.ts +3 -13
- package/src/components/table-handle/table-handle-row-popup.gen.ts +3 -13
- package/src/components/table-handle/table-handle-row-positioner.gen.ts +3 -13
- package/src/components/tooltip/index.gen.ts +1 -3
- package/src/components/tooltip/tooltip-popup.gen.ts +3 -13
- package/src/components/tooltip/tooltip-positioner.gen.ts +3 -13
- package/src/components/tooltip/tooltip-root.gen.ts +3 -13
- package/src/components/tooltip/tooltip-trigger.gen.ts +3 -13
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
import { Component, JSX } from "solid-js";
|
|
2
2
|
import { TooltipPopupElement, TooltipPositionerElement, TooltipPositionerProps as TooltipPositionerProps$1, TooltipRootElement, TooltipRootEvents, TooltipRootProps as TooltipRootProps$1, TooltipTriggerElement, TooltipTriggerProps as TooltipTriggerProps$1 } from "@prosekit/web/tooltip";
|
|
3
|
-
|
|
4
|
-
//#region src/components/tooltip/tooltip-popup.gen.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Props for the {@link TooltipPopup} Solid component.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
3
|
+
/** Props for the {@link TooltipPopup} Solid component. */
|
|
10
4
|
interface TooltipPopupProps {}
|
|
11
|
-
/**
|
|
12
|
-
* A Solid component that renders an `prosekit-tooltip-popup` custom element.
|
|
13
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
5
|
+
/** A Solid component that renders an `prosekit-tooltip-popup` custom element. */
|
|
16
6
|
declare const TooltipPopup: Component<TooltipPopupProps & JSX.HTMLAttributes<TooltipPopupElement>>;
|
|
17
|
-
|
|
18
|
-
//#region src/components/tooltip/tooltip-positioner.gen.d.ts
|
|
19
|
-
/**
|
|
20
|
-
* Props for the {@link TooltipPositioner} Solid component.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
7
|
+
/** Props for the {@link TooltipPositioner} Solid component. */
|
|
24
8
|
interface TooltipPositionerProps {
|
|
25
9
|
/**
|
|
26
10
|
* The strategy to use for positioning
|
|
@@ -150,19 +134,9 @@ interface TooltipPositionerProps {
|
|
|
150
134
|
*/
|
|
151
135
|
altBoundary?: TooltipPositionerProps$1['altBoundary'];
|
|
152
136
|
}
|
|
153
|
-
/**
|
|
154
|
-
* A Solid component that renders an `prosekit-tooltip-positioner` custom element.
|
|
155
|
-
*
|
|
156
|
-
* @public
|
|
157
|
-
*/
|
|
137
|
+
/** A Solid component that renders an `prosekit-tooltip-positioner` custom element. */
|
|
158
138
|
declare const TooltipPositioner: Component<TooltipPositionerProps & JSX.HTMLAttributes<TooltipPositionerElement>>;
|
|
159
|
-
|
|
160
|
-
//#region src/components/tooltip/tooltip-root.gen.d.ts
|
|
161
|
-
/**
|
|
162
|
-
* Props for the {@link TooltipRoot} Solid component.
|
|
163
|
-
*
|
|
164
|
-
* @public
|
|
165
|
-
*/
|
|
139
|
+
/** Props for the {@link TooltipRoot} Solid component. */
|
|
166
140
|
interface TooltipRootProps {
|
|
167
141
|
/**
|
|
168
142
|
* Whether the overlay is initially open.
|
|
@@ -182,19 +156,9 @@ interface TooltipRootProps {
|
|
|
182
156
|
/** Emitted when the tooltip is opened or closed. */
|
|
183
157
|
onOpenChange?: (event: TooltipRootEvents['openChange']) => void;
|
|
184
158
|
}
|
|
185
|
-
/**
|
|
186
|
-
* A Solid component that renders an `prosekit-tooltip-root` custom element.
|
|
187
|
-
*
|
|
188
|
-
* @public
|
|
189
|
-
*/
|
|
159
|
+
/** A Solid component that renders an `prosekit-tooltip-root` custom element. */
|
|
190
160
|
declare const TooltipRoot: Component<TooltipRootProps & JSX.HTMLAttributes<TooltipRootElement>>;
|
|
191
|
-
|
|
192
|
-
//#region src/components/tooltip/tooltip-trigger.gen.d.ts
|
|
193
|
-
/**
|
|
194
|
-
* Props for the {@link TooltipTrigger} Solid component.
|
|
195
|
-
*
|
|
196
|
-
* @public
|
|
197
|
-
*/
|
|
161
|
+
/** Props for the {@link TooltipTrigger} Solid component. */
|
|
198
162
|
interface TooltipTriggerProps {
|
|
199
163
|
/**
|
|
200
164
|
* Whether the component should ignore user interaction.
|
|
@@ -212,12 +176,7 @@ interface TooltipTriggerProps {
|
|
|
212
176
|
*/
|
|
213
177
|
closeDelay?: TooltipTriggerProps$1['closeDelay'];
|
|
214
178
|
}
|
|
215
|
-
/**
|
|
216
|
-
* A Solid component that renders an `prosekit-tooltip-trigger` custom element.
|
|
217
|
-
*
|
|
218
|
-
* @public
|
|
219
|
-
*/
|
|
179
|
+
/** A Solid component that renders an `prosekit-tooltip-trigger` custom element. */
|
|
220
180
|
declare const TooltipTrigger: Component<TooltipTriggerProps & JSX.HTMLAttributes<TooltipTriggerElement>>;
|
|
221
|
-
//#endregion
|
|
222
181
|
export { TooltipPopup, type TooltipPopupProps, TooltipPositioner, type TooltipPositionerProps, TooltipRoot, type TooltipRootProps, TooltipTrigger, type TooltipTriggerProps };
|
|
223
182
|
//# sourceMappingURL=prosekit-solid-tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-solid-tooltip.d.ts","names":[],"sources":["../src/components/tooltip/tooltip-popup.gen.ts","../src/components/tooltip/tooltip-positioner.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-solid-tooltip.d.ts","names":[],"sources":["../src/components/tooltip/tooltip-popup.gen.ts","../src/components/tooltip/tooltip-positioner.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"mappings":";;;UAOiB,iBAAA;;cAGJ,YAAA,EAAc,SAAA,CAAU,iBAAA,GAAoB,GAAA,CAAI,cAAA,CAAe,mBAAA;;UCF3D,sBAAA;EDDiB;;;;AAGlC;ECIE,QAAA,GAAW,wBAAA;;;;;;EAMX,SAAA,GAAY,wBAAA;EDVsB;;;;;;;ECkBlC,UAAA,GAAa,wBAAA;;AApBf;;;;;EA2BE,KAAA,GAAQ,wBAAA;EAAA;;;;;EAMR,MAAA,GAAS,wBAAA;EAoCG;;;;;;;;EA3BZ,IAAA,GAAO,wBAAA;EAqFoC;;;;;EA/E3C,KAAA,GAAQ,wBAAA;EA5BR;;;;;;EAmCA,OAAA,GAAU,wBAAA;EAbH;;;;;;EAoBP,WAAA,GAAc,wBAAA;EAOd;;;;;;EAAA,SAAA,GAAY,wBAAA;EAqBL;;;;;;EAdP,UAAA,GAAa,wBAAA;EA2Cb;;;;;;EApCA,MAAA,GAAS,wBAAA;EA0FV;;;;;;EAnFC,IAAA,GAAO,wBAAA;EAyCgC;;;;;;EAlCvC,QAAA,GAAW,wBAAA;EAkCiG;;ACnI9G;;;;EDwGE,YAAA,GAAe,wBAAA;ECzFJ;;;;;;EDgGX,eAAA,GAAkB,wBAAA;ECrGX;;;;;;;ED6GP,cAAA,GAAiB,wBAAA;EClGN;;;;;;;ED0GX,WAAA,GAAc,wBAAA;AAAA;;cAIH,iBAAA,EAAmB,SAAA,CAAU,sBAAA,GAAyB,GAAA,CAAI,cAAA,CAAe,wBAAA;;UCnIrE,gBAAA;EFDiB;;;;EEMhC,WAAA,GAAc,kBAAA;EFGf;;;;EEEC,IAAA,GAAO,kBAAA;EFRkB;;;;EEazB,QAAA,GAAW,kBAAA;EFb4C;EEevD,YAAA,IAAgB,KAAA,EAAO,iBAAA;AAAA;;cAIZ,WAAA,EAAa,SAAA,CAAU,gBAAA,GAAmB,GAAA,CAAI,cAAA,CAAe,kBAAA;;UCrBzD,mBAAA;EHDiB;;;;EGMhC,QAAA,GAAW,qBAAA;EHGZ;;;;EGEC,SAAA,GAAY,qBAAA;EHRa;;;;EGazB,UAAA,GAAa,qBAAA;AAAA;;cAIF,cAAA,EAAgB,SAAA,CAAU,mBAAA,GAAsB,GAAA,CAAI,cAAA,CAAe,qBAAA"}
|
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
import { createEffect, createSignal, mergeProps, splitProps } from "solid-js";
|
|
2
2
|
import h from "solid-js/h";
|
|
3
3
|
import { registerTooltipPopupElement, registerTooltipPositionerElement, registerTooltipRootElement, registerTooltipTriggerElement } from "@prosekit/web/tooltip";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* A Solid component that renders an `prosekit-tooltip-popup` custom element.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
4
|
+
/** A Solid component that renders an `prosekit-tooltip-popup` custom element. */
|
|
13
5
|
const TooltipPopup = (props) => {
|
|
14
6
|
registerTooltipPopupElement();
|
|
15
7
|
const restProps = props;
|
|
16
8
|
return () => h("prosekit-tooltip-popup", restProps);
|
|
17
9
|
};
|
|
18
|
-
|
|
19
|
-
//#region src/components/tooltip/tooltip-positioner.gen.ts
|
|
20
|
-
/**
|
|
21
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* A Solid component that renders an `prosekit-tooltip-positioner` custom element.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
10
|
+
/** A Solid component that renders an `prosekit-tooltip-positioner` custom element. */
|
|
28
11
|
const TooltipPositioner = (props) => {
|
|
29
12
|
registerTooltipPositionerElement();
|
|
30
13
|
const [getElement, setElement] = createSignal(null);
|
|
@@ -76,16 +59,7 @@ const TooltipPositioner = (props) => {
|
|
|
76
59
|
setElement(el);
|
|
77
60
|
} }));
|
|
78
61
|
};
|
|
79
|
-
|
|
80
|
-
//#region src/components/tooltip/tooltip-root.gen.ts
|
|
81
|
-
/**
|
|
82
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
83
|
-
*/
|
|
84
|
-
/**
|
|
85
|
-
* A Solid component that renders an `prosekit-tooltip-root` custom element.
|
|
86
|
-
*
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
62
|
+
/** A Solid component that renders an `prosekit-tooltip-root` custom element. */
|
|
89
63
|
const TooltipRoot = (props) => {
|
|
90
64
|
registerTooltipRootElement();
|
|
91
65
|
const [getElement, setElement] = createSignal(null);
|
|
@@ -119,16 +93,7 @@ const TooltipRoot = (props) => {
|
|
|
119
93
|
setElement(el);
|
|
120
94
|
} }));
|
|
121
95
|
};
|
|
122
|
-
|
|
123
|
-
//#region src/components/tooltip/tooltip-trigger.gen.ts
|
|
124
|
-
/**
|
|
125
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
126
|
-
*/
|
|
127
|
-
/**
|
|
128
|
-
* A Solid component that renders an `prosekit-tooltip-trigger` custom element.
|
|
129
|
-
*
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
96
|
+
/** A Solid component that renders an `prosekit-tooltip-trigger` custom element. */
|
|
132
97
|
const TooltipTrigger = (props) => {
|
|
133
98
|
registerTooltipTriggerElement();
|
|
134
99
|
const [getElement, setElement] = createSignal(null);
|
|
@@ -150,7 +115,6 @@ const TooltipTrigger = (props) => {
|
|
|
150
115
|
setElement(el);
|
|
151
116
|
} }));
|
|
152
117
|
};
|
|
153
|
-
//#endregion
|
|
154
118
|
export { TooltipPopup, TooltipPositioner, TooltipRoot, TooltipTrigger };
|
|
155
119
|
|
|
156
120
|
//# sourceMappingURL=prosekit-solid-tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-solid-tooltip.js","names":[],"sources":["../src/components/tooltip/tooltip-popup.gen.ts","../src/components/tooltip/tooltip-positioner.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"sourcesContent":["/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerTooltipPopupElement, type TooltipPopupElement } from '@prosekit/web/tooltip';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/**\n * Props for the {@link TooltipPopup} Solid component.\n *\n * @public\n */\nexport interface TooltipPopupProps {}\n\n/**\n * A Solid component that renders an `prosekit-tooltip-popup` custom element.\n *\n * @public\n */\nexport const TooltipPopup: Component<TooltipPopupProps & JSX.HTMLAttributes<TooltipPopupElement>> = (props): any => {\n registerTooltipPopupElement();\n\n const restProps = props;\n\n return () => h('prosekit-tooltip-popup', restProps);\n};\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerTooltipPositionerElement, type TooltipPositionerElement, type TooltipPositionerProps as TooltipPositionerElementProps } from '@prosekit/web/tooltip';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/**\n * Props for the {@link TooltipPositioner} Solid component.\n *\n * @public\n */\nexport interface TooltipPositionerProps {\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: TooltipPositionerElementProps['strategy'];\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement?: TooltipPositionerElementProps['placement'];\n /**\n * Options to activate auto-update listeners\n *\n * @see https://floating-ui.com/docs/autoUpdate\n *\n * @default true\n */\n autoUpdate?: TooltipPositionerElementProps['autoUpdate'];\n /**\n * Whether to use the browser Popover API to place the floating element on\n * top of other page content.\n *\n * @default true\n */\n hoist?: TooltipPositionerElementProps['hoist'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 6\n */\n offset?: TooltipPositionerElementProps['offset'];\n /**\n * Whether to flip the `placement` in order to keep it in view when the\n * preferred placement(s) will overflow the clipping boundary. You can also\n * provide an array of placements to try sequentially if the preferred\n * `placement` does not fit.\n *\n * @default true\n */\n flip?: TooltipPositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: TooltipPositionerElementProps['shift'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default false\n */\n overlap?: TooltipPositionerElementProps['overlap'];\n /**\n * Whether to constrain the floating element's width and height to not exceed\n * the viewport.\n *\n * @default false\n */\n fitViewport?: TooltipPositionerElementProps['fitViewport'];\n /**\n * Whether to constrain the floating element's width so that it matches the\n * reference element.\n *\n * @default false\n */\n sameWidth?: TooltipPositionerElementProps['sameWidth'];\n /**\n * Whether to constrain the floating element's height so that it matches the\n * reference element.\n *\n * @default false\n */\n sameHeight?: TooltipPositionerElementProps['sameHeight'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default false\n */\n inline?: TooltipPositionerElementProps['inline'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default false\n */\n hide?: TooltipPositionerElementProps['hide'];\n /**\n * Describes the clipping element(s) or area that overflow will be checked relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.\n *\n * @default 'clippingAncestors'\n */\n boundary?: TooltipPositionerElementProps['boundary'];\n /**\n * Describes the root boundary that the element will be checked for overflow relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.\n *\n * @default 'viewport'\n */\n rootBoundary?: TooltipPositionerElementProps['rootBoundary'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n * Please see https://floating-ui.com/docs/detectoverflow#padding for more information.\n *\n * @default 4\n */\n overflowPadding?: TooltipPositionerElementProps['overflowPadding'];\n /**\n * The element that will be used to check for overflow. Please see\n * https://floating-ui.com/docs/detectoverflow#elementcontext for more\n * information.\n *\n * @default 'floating'\n */\n elementContext?: TooltipPositionerElementProps['elementContext'];\n /**\n * Whether to check the alternate elementContext's boundary. Please see\n * https://floating-ui.com/docs/detectoverflow#altboundary for more\n * information.\n *\n * @default false\n */\n altBoundary?: TooltipPositionerElementProps['altBoundary'];\n}\n\n/**\n * A Solid component that renders an `prosekit-tooltip-positioner` custom element.\n *\n * @public\n */\nexport const TooltipPositioner: Component<TooltipPositionerProps & JSX.HTMLAttributes<TooltipPositionerElement>> = (props): any => {\n registerTooltipPositionerElement();\n\n const [getElement, setElement] = createSignal<TooltipPositionerElement | null>(null);\n\n const [elementProps, restProps] = splitProps(props, ['altBoundary', 'autoUpdate', 'boundary', 'elementContext', 'fitViewport', 'flip', 'hide', 'hoist', 'inline', 'offset', 'overflowPadding', 'overlap', 'placement', 'rootBoundary', 'sameHeight', 'sameWidth', 'shift', 'strategy']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, {\n altBoundary: elementProps.altBoundary,\n autoUpdate: elementProps.autoUpdate,\n boundary: elementProps.boundary,\n elementContext: elementProps.elementContext,\n fitViewport: elementProps.fitViewport,\n flip: elementProps.flip,\n hide: elementProps.hide,\n hoist: elementProps.hoist,\n inline: elementProps.inline,\n offset: elementProps.offset,\n overflowPadding: elementProps.overflowPadding,\n overlap: elementProps.overlap,\n placement: elementProps.placement,\n rootBoundary: elementProps.rootBoundary,\n sameHeight: elementProps.sameHeight,\n sameWidth: elementProps.sameWidth,\n shift: elementProps.shift,\n strategy: elementProps.strategy,\n });\n });\n\n return () =>\n h(\n 'prosekit-tooltip-positioner',\n mergeProps(restProps, {\n ref: (el: TooltipPositionerElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerTooltipRootElement, type TooltipRootElement, type TooltipRootEvents, type TooltipRootProps as TooltipRootElementProps } from '@prosekit/web/tooltip';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/**\n * Props for the {@link TooltipRoot} Solid component.\n *\n * @public\n */\nexport interface TooltipRootProps {\n /**\n * Whether the overlay is initially open.\n * @default false\n */\n defaultOpen?: TooltipRootElementProps['defaultOpen'];\n /**\n * Whether the overlay is currently open.\n * @default null\n */\n open?: TooltipRootElementProps['open'];\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipRootElementProps['disabled'];\n /** Emitted when the tooltip is opened or closed. */\n onOpenChange?: (event: TooltipRootEvents['openChange']) => void;\n}\n\n/**\n * A Solid component that renders an `prosekit-tooltip-root` custom element.\n *\n * @public\n */\nexport const TooltipRoot: Component<TooltipRootProps & JSX.HTMLAttributes<TooltipRootElement>> = (props): any => {\n registerTooltipRootElement();\n\n const [getElement, setElement] = createSignal<TooltipRootElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['defaultOpen', 'disabled', 'open'], ['onOpenChange']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { defaultOpen: elementProps.defaultOpen, disabled: elementProps.disabled, open: elementProps.open });\n\n handlers.length = 0;\n handlers.push(eventHandlers.onOpenChange);\n });\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n const ac = new AbortController();\n for (const [index, eventName] of ['openChange'].entries()) {\n element.addEventListener(\n eventName,\n (event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () =>\n h(\n 'prosekit-tooltip-root',\n mergeProps(restProps, {\n ref: (el: TooltipRootElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerTooltipTriggerElement, type TooltipTriggerElement, type TooltipTriggerProps as TooltipTriggerElementProps } from '@prosekit/web/tooltip';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/**\n * Props for the {@link TooltipTrigger} Solid component.\n *\n * @public\n */\nexport interface TooltipTriggerProps {\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipTriggerElementProps['disabled'];\n /**\n * The delay in milliseconds before opening the tooltip on hover.\n * @default 600\n */\n openDelay?: TooltipTriggerElementProps['openDelay'];\n /**\n * The delay in milliseconds before closing the tooltip when hover/focus ends.\n * @default 0\n */\n closeDelay?: TooltipTriggerElementProps['closeDelay'];\n}\n\n/**\n * A Solid component that renders an `prosekit-tooltip-trigger` custom element.\n *\n * @public\n */\nexport const TooltipTrigger: Component<TooltipTriggerProps & JSX.HTMLAttributes<TooltipTriggerElement>> = (props): any => {\n registerTooltipTriggerElement();\n\n const [getElement, setElement] = createSignal<TooltipTriggerElement | null>(null);\n\n const [elementProps, restProps] = splitProps(props, ['closeDelay', 'disabled', 'openDelay']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { closeDelay: elementProps.closeDelay, disabled: elementProps.disabled, openDelay: elementProps.openDelay });\n });\n\n return () =>\n h(\n 'prosekit-tooltip-trigger',\n mergeProps(restProps, {\n ref: (el: TooltipTriggerElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,gBAAwF,UAAe;AAClH,8BAA6B;CAE7B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3H,WAAS,SAAS;AAClB,WAAS,KAAK,cAAc,aAAa;GACzC;AAEF,oBAAmB;EACjB,MAAM,UAAU,YAAY;AAC5B,MAAI,CAAC,QAAS;EAEd,MAAM,KAAK,IAAI,iBAAiB;AAChC,OAAK,MAAM,CAAC,OAAO,cAAc,CAAC,aAAa,CAAC,SAAS,CACvD,SAAQ,iBACN,YACC,UAAU;AACT,YAAS,SAAS,MAAM;KAE1B,EAAE,QAAQ,GAAG,QAAQ,CACtB;AAEH,eAAa,GAAG,OAAO;GACvB;AAEF,cACE,EACE,yBACA,WAAW,WAAW,EACpB,MAAM,OAAkC;AACtC,aAAW,GAAG;IAEjB,CAAC,CACH;;;;;;;;;;;;AC7CL,MAAa,kBAA8F,UAAe;AACxH,gCAA+B;CAE/B,MAAM,CAAC,YAAY,cAAc,aAA2C,KAAK;CAEjF,MAAM,CAAC,cAAc,aAAa,WAAW,OAAO;EAAC;EAAc;EAAY;EAAY,CAAC;AAE5F,oBAAmB;EACjB,MAAM,UAAU,YAAY;AAC5B,MAAI,CAAC,QAAS;AAEd,SAAO,OAAO,SAAS;GAAE,YAAY,aAAa;GAAY,UAAU,aAAa;GAAU,WAAW,aAAa;GAAW,CAAC;GACnI;AAEF,cACE,EACE,4BACA,WAAW,WAAW,EACpB,MAAM,OAAqC;AACzC,aAAW,GAAG;IAEjB,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"prosekit-solid-tooltip.js","names":[],"sources":["../src/components/tooltip/tooltip-popup.gen.ts","../src/components/tooltip/tooltip-positioner.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"sourcesContent":["// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipPopupElement, type TooltipPopupElement } from '@prosekit/web/tooltip';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link TooltipPopup} Solid component. */\nexport interface TooltipPopupProps {}\n\n/** A Solid component that renders an `prosekit-tooltip-popup` custom element. */\nexport const TooltipPopup: Component<TooltipPopupProps & JSX.HTMLAttributes<TooltipPopupElement>> = (props): any => {\n registerTooltipPopupElement();\n\n const restProps = props;\n\n return () => h('prosekit-tooltip-popup', restProps);\n};\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipPositionerElement, type TooltipPositionerElement, type TooltipPositionerProps as TooltipPositionerElementProps } from '@prosekit/web/tooltip';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link TooltipPositioner} Solid component. */\nexport interface TooltipPositionerProps {\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: TooltipPositionerElementProps['strategy'];\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement?: TooltipPositionerElementProps['placement'];\n /**\n * Options to activate auto-update listeners\n *\n * @see https://floating-ui.com/docs/autoUpdate\n *\n * @default true\n */\n autoUpdate?: TooltipPositionerElementProps['autoUpdate'];\n /**\n * Whether to use the browser Popover API to place the floating element on\n * top of other page content.\n *\n * @default true\n */\n hoist?: TooltipPositionerElementProps['hoist'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 6\n */\n offset?: TooltipPositionerElementProps['offset'];\n /**\n * Whether to flip the `placement` in order to keep it in view when the\n * preferred placement(s) will overflow the clipping boundary. You can also\n * provide an array of placements to try sequentially if the preferred\n * `placement` does not fit.\n *\n * @default true\n */\n flip?: TooltipPositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: TooltipPositionerElementProps['shift'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default false\n */\n overlap?: TooltipPositionerElementProps['overlap'];\n /**\n * Whether to constrain the floating element's width and height to not exceed\n * the viewport.\n *\n * @default false\n */\n fitViewport?: TooltipPositionerElementProps['fitViewport'];\n /**\n * Whether to constrain the floating element's width so that it matches the\n * reference element.\n *\n * @default false\n */\n sameWidth?: TooltipPositionerElementProps['sameWidth'];\n /**\n * Whether to constrain the floating element's height so that it matches the\n * reference element.\n *\n * @default false\n */\n sameHeight?: TooltipPositionerElementProps['sameHeight'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default false\n */\n inline?: TooltipPositionerElementProps['inline'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default false\n */\n hide?: TooltipPositionerElementProps['hide'];\n /**\n * Describes the clipping element(s) or area that overflow will be checked relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.\n *\n * @default 'clippingAncestors'\n */\n boundary?: TooltipPositionerElementProps['boundary'];\n /**\n * Describes the root boundary that the element will be checked for overflow relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.\n *\n * @default 'viewport'\n */\n rootBoundary?: TooltipPositionerElementProps['rootBoundary'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n * Please see https://floating-ui.com/docs/detectoverflow#padding for more information.\n *\n * @default 4\n */\n overflowPadding?: TooltipPositionerElementProps['overflowPadding'];\n /**\n * The element that will be used to check for overflow. Please see\n * https://floating-ui.com/docs/detectoverflow#elementcontext for more\n * information.\n *\n * @default 'floating'\n */\n elementContext?: TooltipPositionerElementProps['elementContext'];\n /**\n * Whether to check the alternate elementContext's boundary. Please see\n * https://floating-ui.com/docs/detectoverflow#altboundary for more\n * information.\n *\n * @default false\n */\n altBoundary?: TooltipPositionerElementProps['altBoundary'];\n}\n\n/** A Solid component that renders an `prosekit-tooltip-positioner` custom element. */\nexport const TooltipPositioner: Component<TooltipPositionerProps & JSX.HTMLAttributes<TooltipPositionerElement>> = (props): any => {\n registerTooltipPositionerElement();\n\n const [getElement, setElement] = createSignal<TooltipPositionerElement | null>(null);\n\n const [elementProps, restProps] = splitProps(props, ['altBoundary', 'autoUpdate', 'boundary', 'elementContext', 'fitViewport', 'flip', 'hide', 'hoist', 'inline', 'offset', 'overflowPadding', 'overlap', 'placement', 'rootBoundary', 'sameHeight', 'sameWidth', 'shift', 'strategy']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, {\n altBoundary: elementProps.altBoundary,\n autoUpdate: elementProps.autoUpdate,\n boundary: elementProps.boundary,\n elementContext: elementProps.elementContext,\n fitViewport: elementProps.fitViewport,\n flip: elementProps.flip,\n hide: elementProps.hide,\n hoist: elementProps.hoist,\n inline: elementProps.inline,\n offset: elementProps.offset,\n overflowPadding: elementProps.overflowPadding,\n overlap: elementProps.overlap,\n placement: elementProps.placement,\n rootBoundary: elementProps.rootBoundary,\n sameHeight: elementProps.sameHeight,\n sameWidth: elementProps.sameWidth,\n shift: elementProps.shift,\n strategy: elementProps.strategy,\n });\n });\n\n return () =>\n h(\n 'prosekit-tooltip-positioner',\n mergeProps(restProps, {\n ref: (el: TooltipPositionerElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipRootElement, type TooltipRootElement, type TooltipRootEvents, type TooltipRootProps as TooltipRootElementProps } from '@prosekit/web/tooltip';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link TooltipRoot} Solid component. */\nexport interface TooltipRootProps {\n /**\n * Whether the overlay is initially open.\n * @default false\n */\n defaultOpen?: TooltipRootElementProps['defaultOpen'];\n /**\n * Whether the overlay is currently open.\n * @default null\n */\n open?: TooltipRootElementProps['open'];\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipRootElementProps['disabled'];\n /** Emitted when the tooltip is opened or closed. */\n onOpenChange?: (event: TooltipRootEvents['openChange']) => void;\n}\n\n/** A Solid component that renders an `prosekit-tooltip-root` custom element. */\nexport const TooltipRoot: Component<TooltipRootProps & JSX.HTMLAttributes<TooltipRootElement>> = (props): any => {\n registerTooltipRootElement();\n\n const [getElement, setElement] = createSignal<TooltipRootElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['defaultOpen', 'disabled', 'open'], ['onOpenChange']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { defaultOpen: elementProps.defaultOpen, disabled: elementProps.disabled, open: elementProps.open });\n\n handlers.length = 0;\n handlers.push(eventHandlers.onOpenChange);\n });\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n const ac = new AbortController();\n for (const [index, eventName] of ['openChange'].entries()) {\n element.addEventListener(\n eventName,\n (event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () =>\n h(\n 'prosekit-tooltip-root',\n mergeProps(restProps, {\n ref: (el: TooltipRootElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipTriggerElement, type TooltipTriggerElement, type TooltipTriggerProps as TooltipTriggerElementProps } from '@prosekit/web/tooltip';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link TooltipTrigger} Solid component. */\nexport interface TooltipTriggerProps {\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipTriggerElementProps['disabled'];\n /**\n * The delay in milliseconds before opening the tooltip on hover.\n * @default 600\n */\n openDelay?: TooltipTriggerElementProps['openDelay'];\n /**\n * The delay in milliseconds before closing the tooltip when hover/focus ends.\n * @default 0\n */\n closeDelay?: TooltipTriggerElementProps['closeDelay'];\n}\n\n/** A Solid component that renders an `prosekit-tooltip-trigger` custom element. */\nexport const TooltipTrigger: Component<TooltipTriggerProps & JSX.HTMLAttributes<TooltipTriggerElement>> = (props): any => {\n registerTooltipTriggerElement();\n\n const [getElement, setElement] = createSignal<TooltipTriggerElement | null>(null);\n\n const [elementProps, restProps] = splitProps(props, ['closeDelay', 'disabled', 'openDelay']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { closeDelay: elementProps.closeDelay, disabled: elementProps.disabled, openDelay: elementProps.openDelay });\n });\n\n return () =>\n h(\n 'prosekit-tooltip-trigger',\n mergeProps(restProps, {\n ref: (el: TooltipTriggerElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n"],"mappings":";;;;AAUA,MAAa,gBAAwF,UAAe;AAClH,8BAA6B;CAE7B,MAAM,YAAY;AAElB,cAAa,EAAE,0BAA0B,UAAU;;;AC4HrD,MAAa,qBAAuG,UAAe;AACjI,mCAAkC;CAElC,MAAM,CAAC,YAAY,cAAc,aAA8C,KAAK;CAEpF,MAAM,CAAC,cAAc,aAAa,WAAW,OAAO;EAAC;EAAe;EAAc;EAAY;EAAkB;EAAe;EAAQ;EAAQ;EAAS;EAAU;EAAU;EAAmB;EAAW;EAAa;EAAgB;EAAc;EAAa;EAAS;EAAW,CAAC;AAEvR,oBAAmB;EACjB,MAAM,UAAU,YAAY;AAC5B,MAAI,CAAC,QAAS;AAEd,SAAO,OAAO,SAAS;GACrB,aAAa,aAAa;GAC1B,YAAY,aAAa;GACzB,UAAU,aAAa;GACvB,gBAAgB,aAAa;GAC7B,aAAa,aAAa;GAC1B,MAAM,aAAa;GACnB,MAAM,aAAa;GACnB,OAAO,aAAa;GACpB,QAAQ,aAAa;GACrB,QAAQ,aAAa;GACrB,iBAAiB,aAAa;GAC9B,SAAS,aAAa;GACtB,WAAW,aAAa;GACxB,cAAc,aAAa;GAC3B,YAAY,aAAa;GACzB,WAAW,aAAa;GACxB,OAAO,aAAa;GACpB,UAAU,aAAa;GACxB,CAAC;GACF;AAEF,cACE,EACE,+BACA,WAAW,WAAW,EACpB,MAAM,OAAwC;AAC5C,aAAW,GAAG;IAEjB,CAAC,CACH;;;ACvJL,MAAa,eAAqF,UAAe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import { MarkViewContextProps, NodeViewContextProps } from "@prosemirror-adapter
|
|
|
4
4
|
import { CoreMarkViewUserOptions, CoreNodeViewUserOptions } from "@prosemirror-adapter/core";
|
|
5
5
|
import { ProseMirrorNode } from "@prosekit/pm/model";
|
|
6
6
|
import { EditorState } from "@prosekit/pm/state";
|
|
7
|
-
|
|
8
|
-
//#region src/components/prosekit.d.ts
|
|
9
7
|
type ProseKitProps = ParentProps<{
|
|
10
8
|
editor: Editor;
|
|
11
9
|
}>;
|
|
@@ -15,8 +13,6 @@ type ProseKitProps = ParentProps<{
|
|
|
15
13
|
* @public
|
|
16
14
|
*/
|
|
17
15
|
declare const ProseKit: Component<ProseKitProps>;
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/extensions/solid-mark-view.d.ts
|
|
20
16
|
/**
|
|
21
17
|
* @public
|
|
22
18
|
*/
|
|
@@ -42,8 +38,6 @@ interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComp
|
|
|
42
38
|
* @public
|
|
43
39
|
*/
|
|
44
40
|
declare function defineSolidMarkView(options: SolidMarkViewOptions): Extension;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/extensions/solid-node-view.d.ts
|
|
47
41
|
/**
|
|
48
42
|
* @public
|
|
49
43
|
*/
|
|
@@ -69,8 +63,6 @@ interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComp
|
|
|
69
63
|
* @public
|
|
70
64
|
*/
|
|
71
65
|
declare function defineSolidNodeView(options: SolidNodeViewOptions): Extension;
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/types.d.ts
|
|
74
66
|
/**
|
|
75
67
|
* @internal
|
|
76
68
|
*/
|
|
@@ -91,8 +83,6 @@ type PropsWithElement<Props extends object, CustomElement extends HTMLElement> =
|
|
|
91
83
|
* T or a reactive/non-reactive function returning T
|
|
92
84
|
*/
|
|
93
85
|
type MaybeAccessor<T> = T | Accessor<T>;
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/hooks/use-extension.d.ts
|
|
96
86
|
interface UseExtensionOptions {
|
|
97
87
|
/**
|
|
98
88
|
* The editor to add the extension to. If not provided, it will use the
|
|
@@ -114,16 +104,12 @@ declare function useExtension(
|
|
|
114
104
|
*/
|
|
115
105
|
|
|
116
106
|
extension: Accessor<Extension | null>, options?: UseExtensionOptions): void;
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/hooks/use-doc-change.d.ts
|
|
119
107
|
/**
|
|
120
108
|
* Calls the given handler whenever the editor document changes.
|
|
121
109
|
*
|
|
122
110
|
* @public
|
|
123
111
|
*/
|
|
124
112
|
declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void;
|
|
125
|
-
//#endregion
|
|
126
|
-
//#region src/hooks/use-editor-derived-value.d.ts
|
|
127
113
|
interface UseEditorDerivedOptions<E extends Extension = any> {
|
|
128
114
|
/**
|
|
129
115
|
* The editor to add the extension to. If not provided, it will use the
|
|
@@ -152,8 +138,6 @@ declare function useEditorDerivedValue<E extends Extension, Derived>(
|
|
|
152
138
|
*/
|
|
153
139
|
|
|
154
140
|
derive: (editor: Editor<E>) => Derived, options?: UseEditorDerivedOptions<E>): Accessor<Derived>;
|
|
155
|
-
//#endregion
|
|
156
|
-
//#region src/hooks/use-editor.d.ts
|
|
157
141
|
/**
|
|
158
142
|
* Retrieves the editor instance from the nearest ProseKit component.
|
|
159
143
|
*
|
|
@@ -168,17 +152,12 @@ declare function useEditor<E extends Extension = any>(options?: {
|
|
|
168
152
|
*/
|
|
169
153
|
update?: boolean;
|
|
170
154
|
}): () => Editor<E>;
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/hooks/use-keymap.d.ts
|
|
173
155
|
declare function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void;
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/hooks/use-state-update.d.ts
|
|
176
156
|
/**
|
|
177
157
|
* Calls the given handler whenever the editor state changes.
|
|
178
158
|
*
|
|
179
159
|
* @public
|
|
180
160
|
*/
|
|
181
161
|
declare function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void;
|
|
182
|
-
//#endregion
|
|
183
162
|
export { type MaybeAccessor, type PropsWithChildren, type PropsWithClass, type PropsWithElement, ProseKit, type ProseKitProps, type SolidMarkViewComponent, type SolidMarkViewOptions, type SolidMarkViewProps, type SolidNodeViewComponent, type SolidNodeViewOptions, type SolidNodeViewProps, type UseEditorDerivedOptions, type UseExtensionOptions, defineSolidMarkView, defineSolidNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
|
|
184
163
|
//# sourceMappingURL=prosekit-solid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-solid.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/types.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-editor.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-solid.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/types.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-editor.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"mappings":";;;;;;KAOY,aAAA,GAAgB,WAAA;EAC1B,MAAA,EAAQ,MAAA;AAAA;;;AADV;;;cASa,QAAA,EAAU,SAAA,CAAU,aAAA;;;;UCAhB,kBAAA,SAA2B,oBAAA;;;;KAKhC,sBAAA,GAAyB,SAAA,CAAU,kBAAA;;;;ADL/C;;UCYiB,oBAAA,SAA6B,uBAAA,CAAwB,sBAAA;EDZ/C;;;ECgBrB,IAAA;AAAA;;;;;AAJF;iBAiDgB,m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MAAA,QAAc,MAAA,EAAQ,OAAA,GAAU,mBAAA;;;;;;iBCM1C,cAAA,CACd,OAAA,GAAU,KAAA,EAAO,WAAA,WACjB,OAAA,GAAU,mBAAA"}
|
package/dist/prosekit-solid.js
CHANGED
|
@@ -3,13 +3,10 @@ import { createComponent, createEffect, createMemo, createSignal, onCleanup } fr
|
|
|
3
3
|
import { EditorNotFoundError, ProseKitError, defineDocChangeHandler, defineKeymap, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeViewComponent, defineNodeViewFactory, defineUpdateHandler, union, withPriority } from "@prosekit/core";
|
|
4
4
|
import { AbstractSolidMarkView, AbstractSolidNodeView, buildSolidMarkViewCreator, buildSolidNodeViewCreator, useSolidRenderer } from "@prosemirror-adapter/solid";
|
|
5
5
|
import { Portal } from "solid-js/web";
|
|
6
|
-
//#region src/extensions/helpers.ts
|
|
7
6
|
function hidePortalDiv(el) {
|
|
8
7
|
el.style.display = "contents";
|
|
9
8
|
el.dataset.solidPortal = "true";
|
|
10
9
|
}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/extensions/solid-mark-view.ts
|
|
13
10
|
var ProseKitSolidMarkView = class extends AbstractSolidMarkView {
|
|
14
11
|
constructor(..._args) {
|
|
15
12
|
super(..._args);
|
|
@@ -55,8 +52,6 @@ function defineSolidMarkView(options) {
|
|
|
55
52
|
args: options
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/extensions/solid-node-view.ts
|
|
60
55
|
var ProseKitSolidNodeView = class extends AbstractSolidNodeView {
|
|
61
56
|
constructor(..._args) {
|
|
62
57
|
super(..._args);
|
|
@@ -117,8 +112,6 @@ function defineSolidNodeView(options) {
|
|
|
117
112
|
args: options
|
|
118
113
|
});
|
|
119
114
|
}
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/utils/to-value.ts
|
|
122
115
|
/**
|
|
123
116
|
* Accesses the value of a MaybeAccessor
|
|
124
117
|
*
|
|
@@ -131,8 +124,6 @@ function defineSolidNodeView(options) {
|
|
|
131
124
|
function toValue(v) {
|
|
132
125
|
return typeof v === "function" ? v() : v;
|
|
133
126
|
}
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region src/hooks/use-editor-extension.ts
|
|
136
127
|
/**
|
|
137
128
|
* @internal
|
|
138
129
|
*/
|
|
@@ -145,16 +136,12 @@ function useEditorExtension(editorAccessor, extensionAccessor) {
|
|
|
145
136
|
if (extension) onCleanup(editor.use(extension));
|
|
146
137
|
});
|
|
147
138
|
}
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/components/view-renderer.ts
|
|
150
139
|
const ViewRenderer = (props) => {
|
|
151
140
|
const { renderSolidRenderer, removeSolidRenderer, render } = useSolidRenderer();
|
|
152
141
|
const extension = union([defineSolidMarkViewFactory(renderSolidRenderer, removeSolidRenderer), defineSolidNodeViewFactory(renderSolidRenderer, removeSolidRenderer)]);
|
|
153
142
|
useEditorExtension(() => props.editor, () => extension);
|
|
154
143
|
return [props.children, render];
|
|
155
144
|
};
|
|
156
|
-
//#endregion
|
|
157
|
-
//#region src/components/prosekit.ts
|
|
158
145
|
/**
|
|
159
146
|
* The root component for a ProseKit editor.
|
|
160
147
|
*
|
|
@@ -177,8 +164,6 @@ const ProseKit = (props) => {
|
|
|
177
164
|
}
|
|
178
165
|
});
|
|
179
166
|
};
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/hooks/use-priority-extension.ts
|
|
182
167
|
/**
|
|
183
168
|
* @internal
|
|
184
169
|
*/
|
|
@@ -188,16 +173,12 @@ function usePriorityExtension(extension, priority) {
|
|
|
188
173
|
return ext && priority ? withPriority(ext, priority) : ext;
|
|
189
174
|
};
|
|
190
175
|
}
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/hooks/use-extension.ts
|
|
193
176
|
/**
|
|
194
177
|
* Add an extension to the editor.
|
|
195
178
|
*/
|
|
196
179
|
function useExtension(extension, options) {
|
|
197
180
|
useEditorExtension(options?.editor, usePriorityExtension(extension, options?.priority));
|
|
198
181
|
}
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/hooks/use-doc-change.ts
|
|
201
182
|
/**
|
|
202
183
|
* Calls the given handler whenever the editor document changes.
|
|
203
184
|
*
|
|
@@ -207,8 +188,6 @@ function useDocChange(handler, options) {
|
|
|
207
188
|
const extension = defineDocChangeHandler((view) => handler(view.state.doc));
|
|
208
189
|
useExtension(() => extension, options);
|
|
209
190
|
}
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region src/hooks/use-editor.ts
|
|
212
191
|
/**
|
|
213
192
|
* Retrieves the editor instance from the nearest ProseKit component.
|
|
214
193
|
*
|
|
@@ -237,8 +216,6 @@ function useEditor(options) {
|
|
|
237
216
|
function useForceUpdate() {
|
|
238
217
|
return createSignal(void 0, { equals: false });
|
|
239
218
|
}
|
|
240
|
-
//#endregion
|
|
241
|
-
//#region src/hooks/use-editor-derived-value.ts
|
|
242
219
|
/**
|
|
243
220
|
* Runs a function to derive a value from the editor instance after editor state
|
|
244
221
|
* changes.
|
|
@@ -256,14 +233,10 @@ function useEditorDerivedValue(derive, options) {
|
|
|
256
233
|
const editorAccessor = initialEditor ? () => toValue(initialEditor) : useEditor({ update: true });
|
|
257
234
|
return createMemo(() => derive(editorAccessor()));
|
|
258
235
|
}
|
|
259
|
-
//#endregion
|
|
260
|
-
//#region src/hooks/use-keymap.ts
|
|
261
236
|
function useKeymap(keymap, options) {
|
|
262
237
|
const extension = () => defineKeymap(keymap());
|
|
263
238
|
useExtension(extension, options);
|
|
264
239
|
}
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region src/hooks/use-state-update.ts
|
|
267
240
|
/**
|
|
268
241
|
* Calls the given handler whenever the editor state changes.
|
|
269
242
|
*
|
|
@@ -273,7 +246,6 @@ function useStateUpdate(handler, options) {
|
|
|
273
246
|
const extension = defineUpdateHandler((view) => handler(view.state));
|
|
274
247
|
useExtension(() => extension, options);
|
|
275
248
|
}
|
|
276
|
-
//#endregion
|
|
277
249
|
export { ProseKit, defineSolidMarkView, defineSolidNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
|
|
278
250
|
|
|
279
251
|
//# sourceMappingURL=prosekit-solid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-solid.js","names":[],"sources":["../src/extensions/helpers.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/utils/to-value.ts","../src/hooks/use-editor-extension.ts","../src/components/view-renderer.ts","../src/components/prosekit.ts","../src/hooks/use-priority-extension.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":["export function hidePortalDiv(el: HTMLElement): void {\n el.style.display = 'contents'\n el.dataset.solidPortal = 'true'\n}\n","import { defineMarkViewComponent, defineMarkViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidMarkView,\n buildSolidMarkViewCreator,\n type MarkViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidMarkViewProps extends MarkViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidMarkViewComponent = Component<SolidMarkViewProps>\n\n/**\n * Options for {@link defineSolidMarkView}.\n *\n * @public\n */\nexport interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nclass ProseKitSolidMarkView extends AbstractSolidMarkView<SolidMarkViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidMarkViewProps = this.context\n const props: SolidMarkViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get mark() {\n return getProps().mark\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidMarkViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidMarkViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidMarkView)\n return defineMarkViewFactory<SolidMarkViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a mark view using a Solid component.\n *\n * @public\n */\nexport function defineSolidMarkView(options: SolidMarkViewOptions): Extension {\n return defineMarkViewComponent<SolidMarkViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","import { defineNodeViewComponent, defineNodeViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidNodeView,\n buildSolidNodeViewCreator,\n type NodeViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidNodeViewProps extends NodeViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidNodeViewComponent = Component<SolidNodeViewProps>\n\n/**\n * Options for {@link defineSolidNodeView}.\n *\n * @public\n */\nexport interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nclass ProseKitSolidNodeView extends AbstractSolidNodeView<SolidNodeViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidNodeViewProps = this.context\n const props: SolidNodeViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get getPos() {\n return getProps().getPos\n },\n get setAttrs() {\n return getProps().setAttrs\n },\n get node() {\n return getProps().node\n },\n get selected() {\n return getProps().selected\n },\n get decorations() {\n return getProps().decorations\n },\n get innerDecorations() {\n return getProps().innerDecorations\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidNodeViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidNodeViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidNodeView)\n return defineNodeViewFactory<SolidNodeViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a node view using a Solid component.\n *\n * @public\n */\nexport function defineSolidNodeView(options: SolidNodeViewOptions): Extension {\n return defineNodeViewComponent<SolidNodeViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","/**\n * Accesses the value of a MaybeAccessor\n *\n * @example\n * ```ts\n * access(\"foo\") // => \"foo\"\n * access(() => \"foo\") // => \"foo\"\n * ```\n */\nexport function toValue<T>(\n v: (() => T) | T,\n): T {\n return (typeof v === 'function') ? (v as () => T)() : v\n}\n","import { EditorNotFoundError, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, onCleanup, type Accessor } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editorAccessor: MaybeAccessor<Editor> | undefined | null,\n extensionAccessor: Accessor<Extension | null>,\n): void {\n const editorContext = useEditorContext()\n\n createEffect(() => {\n const editor = toValue(editorAccessor) || toValue(editorContext)\n const extension = extensionAccessor()\n\n if (!editor) {\n throw new EditorNotFoundError()\n }\n if (extension) {\n onCleanup(editor.use(extension))\n }\n })\n}\n","import { union, type Editor } from '@prosekit/core'\nimport { useSolidRenderer } from '@prosemirror-adapter/solid'\nimport type { Component, JSX, ParentProps } from 'solid-js'\n\nimport { defineSolidMarkViewFactory } from '../extensions/solid-mark-view.ts'\nimport { defineSolidNodeViewFactory } from '../extensions/solid-node-view.ts'\nimport { useEditorExtension } from '../hooks/use-editor-extension.ts'\n\ntype ViewRendererProps = ParentProps<{\n editor: Editor\n}>\n\nexport const ViewRenderer: Component<ViewRendererProps> = (props): JSX.Element => {\n const { renderSolidRenderer, removeSolidRenderer, render } = useSolidRenderer()\n\n const extension = union([\n defineSolidMarkViewFactory(renderSolidRenderer, removeSolidRenderer),\n defineSolidNodeViewFactory(renderSolidRenderer, removeSolidRenderer),\n ])\n\n useEditorExtension(() => props.editor, () => extension)\n\n return [props.children, render] as unknown as JSX.Element\n}\n","import type { Editor } from '@prosekit/core'\nimport { createComponent, type Component, type ParentProps } from 'solid-js'\n\nimport { EditorContextProvider } from '../contexts/editor-context.ts'\n\nimport { ViewRenderer } from './view-renderer.ts'\n\nexport type ProseKitProps = ParentProps<{\n editor: Editor\n}>\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: Component<ProseKitProps> = (props) => {\n return createComponent(EditorContextProvider, {\n get value() {\n return props.editor\n },\n get children() {\n return createComponent(ViewRenderer, {\n get editor() {\n return props.editor\n },\n get children() {\n return props.children\n },\n })\n },\n })\n}\n","import { withPriority, type Extension, type Priority } from '@prosekit/core'\n\n/**\n * @internal\n */\nexport function usePriorityExtension<T extends Extension = Extension>(\n extension: () => T | null,\n priority?: Priority | null,\n): () => T | null {\n return () => {\n const ext = extension()\n return ext && priority ? withPriority(ext, priority) : ext\n }\n}\n","import type { Editor, Extension, Priority } from '@prosekit/core'\nimport type { Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\nimport { usePriorityExtension } from './use-priority-extension.ts'\n\nexport interface UseExtensionOptions {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: MaybeAccessor<Editor>\n\n /**\n * Optional priority to add the extension with.\n */\n priority?: Priority\n}\n\n/**\n * Add an extension to the editor.\n */\nexport function useExtension(\n /**\n * The accessor to an extension to add to the editor. If it changes, the previous\n * extension will be removed and the new one (if not null) will be added.\n */\n extension: Accessor<Extension | null>,\n options?: UseExtensionOptions,\n): void {\n useEditorExtension(\n options?.editor,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\n/**\n * Calls the given handler whenever the editor document changes.\n *\n * @public\n */\nexport function useDocChange(\n handler: (doc: ProseMirrorNode) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineDocChangeHandler((view) => handler(view.state.doc))\n useExtension(() => extension, options)\n}\n","import { defineMountHandler, defineUpdateHandler, ProseKitError, union, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, createSignal } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\n\n/**\n * Retrieves the editor instance from the nearest ProseKit component.\n *\n * @public\n */\nexport function useEditor<E extends Extension = any>(options?: {\n /**\n * Whether to update the component when the editor is mounted or editor state\n * is updated.\n *\n * @default false\n */\n update?: boolean\n}): () => Editor<E> {\n const update = options?.update ?? false\n\n const editor = useEditorContext<E>()\n if (!editor) {\n throw new ProseKitError(\n 'useEditor must be used within the ProseKit component',\n )\n }\n\n const [depend, forceUpdate] = useForceUpdate()\n\n createEffect(() => {\n if (update) {\n const extension = union(\n defineMountHandler(forceUpdate),\n defineUpdateHandler(forceUpdate),\n )\n return editor.use(extension)\n }\n }, [editor, update, forceUpdate])\n\n return () => {\n depend()\n return editor\n }\n}\n\nfunction useForceUpdate() {\n return createSignal(undefined, { equals: false })\n}\n","import type { Editor, Extension } from '@prosekit/core'\nimport { createMemo, type Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\nimport { useEditor } from './use-editor.ts'\n\nexport interface UseEditorDerivedOptions<E extends Extension = any> {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: MaybeAccessor<Editor<E>>\n}\n\n/**\n * Runs a function to derive a value from the editor instance after editor state\n * changes.\n *\n * This is useful when you need to render something based on the editor state,\n * for example, whether the selected text is wrapped in an italic mark.\n *\n * It returns an accessor of the derived value that updates whenever the editor\n * state changes.\n *\n * @public\n */\nexport function useEditorDerivedValue<E extends Extension, Derived>(\n /**\n * A function that receives the editor instance and returns a derived value.\n *\n * It will be called whenever the editor's document state changes, or when it\n * mounts.\n */\n derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Accessor<Derived> {\n const initialEditor = options?.editor\n const editorAccessor: Accessor<Editor<E>> = initialEditor\n ? () => toValue(initialEditor)\n : useEditor<E>({ update: true })\n\n return createMemo(() => derive(editorAccessor()))\n}\n","import { defineKeymap, type Keymap } from '@prosekit/core'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\nexport function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void {\n const extension = () => defineKeymap(keymap())\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\n/**\n * Calls the given handler whenever the editor state changes.\n *\n * @public\n */\nexport function useStateUpdate(\n handler: (state: EditorState) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineUpdateHandler((view) => handler(view.state))\n useExtension(() => extension, options)\n}\n"],"mappings":";;;;;;AAAA,SAAgB,cAAc,IAAuB;AACnD,IAAG,MAAM,UAAU;AACnB,IAAG,QAAQ,cAAc;;;;ACiC3B,IAAM,wBAAN,cAAoC,sBAA8C;;;sBACpD;GAC1B,MAA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MAAM,IAAI,CAAC;AAC3E,oBAAmB,WAAW,QAAQ;;;;;;;;;ACLxC,SAAgB,UAAqC,SAQjC;CAClB,MAAM,SAAS,SAAS,UAAU;CAElC,MAAM,SAAS,kBAAqB;AACpC,KAAI,CAAC,OACH,OAAM,IAAI,cACR,uDACD;CAGH,MAAM,CAAC,QAAQ,eAAe,gBAAgB;AAE9C,oBAAmB;AACjB,MAAI,QAAQ;GACV,MAAM,YAAY,MAChB,mBAAmB,YAAY,EAC/B,oBAAoB,YAAY,CACjC;AACD,UAAO,OAAO,IAAI,UAAU;;IAE7B;EAAC;EAAQ;EAAQ;EAAY,CAAC;AAEjC,cAAa;AACX,UAAQ;AACR,SAAO;;;AAIX,SAAS,iBAAiB;AACxB,QAAO,aAAa,KAAA,GAAW,EAAE,QAAQ,OAAO,CAAC;;;;;;;;;;;;;;;;ACnBnD,SAAgB,sBAOd,QACA,SACmB;CACnB,MAAM,gBAAgB,SAAS;CAC/B,MAAM,iBAAsC,sBAClC,QAAQ,cAAc,GAC5B,UAAa,EAAE,QAAQ,MAAM,CAAC;AAElC,QAAO,iBAAiB,OAAO,gBAAgB,CAAC,CAAC;;;;ACvCnD,SAAgB,UAAU,QAAsB,SAAqC;CACnF,MAAM,kBAAkB,aAAa,QAAQ,CAAC;AAC9C,cAAa,WAAW,QAAQ;;;;;;;;;ACIlC,SAAgB,eACd,SACA,SACM;CACN,MAAM,YAAY,qBAAqB,SAAS,QAAQ,KAAK,MAAM,CAAC;AACpE,oBAAmB,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"file":"prosekit-solid.js","names":[],"sources":["../src/extensions/helpers.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/utils/to-value.ts","../src/hooks/use-editor-extension.ts","../src/components/view-renderer.ts","../src/components/prosekit.ts","../src/hooks/use-priority-extension.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":["export function hidePortalDiv(el: HTMLElement): void {\n el.style.display = 'contents'\n el.dataset.solidPortal = 'true'\n}\n","import { defineMarkViewComponent, defineMarkViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidMarkView,\n buildSolidMarkViewCreator,\n type MarkViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidMarkViewProps extends MarkViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidMarkViewComponent = Component<SolidMarkViewProps>\n\n/**\n * Options for {@link defineSolidMarkView}.\n *\n * @public\n */\nexport interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nclass ProseKitSolidMarkView extends AbstractSolidMarkView<SolidMarkViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidMarkViewProps = this.context\n const props: SolidMarkViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get mark() {\n return getProps().mark\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidMarkViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidMarkViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidMarkView)\n return defineMarkViewFactory<SolidMarkViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a mark view using a Solid component.\n *\n * @public\n */\nexport function defineSolidMarkView(options: SolidMarkViewOptions): Extension {\n return defineMarkViewComponent<SolidMarkViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","import { defineNodeViewComponent, defineNodeViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidNodeView,\n buildSolidNodeViewCreator,\n type NodeViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidNodeViewProps extends NodeViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidNodeViewComponent = Component<SolidNodeViewProps>\n\n/**\n * Options for {@link defineSolidNodeView}.\n *\n * @public\n */\nexport interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nclass ProseKitSolidNodeView extends AbstractSolidNodeView<SolidNodeViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidNodeViewProps = this.context\n const props: SolidNodeViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get getPos() {\n return getProps().getPos\n },\n get setAttrs() {\n return getProps().setAttrs\n },\n get node() {\n return getProps().node\n },\n get selected() {\n return getProps().selected\n },\n get decorations() {\n return getProps().decorations\n },\n get innerDecorations() {\n return getProps().innerDecorations\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidNodeViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidNodeViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidNodeView)\n return defineNodeViewFactory<SolidNodeViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a node view using a Solid component.\n *\n * @public\n */\nexport function defineSolidNodeView(options: SolidNodeViewOptions): Extension {\n return defineNodeViewComponent<SolidNodeViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","/**\n * Accesses the value of a MaybeAccessor\n *\n * @example\n * ```ts\n * access(\"foo\") // => \"foo\"\n * access(() => \"foo\") // => \"foo\"\n * ```\n */\nexport function toValue<T>(\n v: (() => T) | T,\n): T {\n return (typeof v === 'function') ? (v as () => T)() : v\n}\n","import { EditorNotFoundError, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, onCleanup, type Accessor } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editorAccessor: MaybeAccessor<Editor> | undefined | null,\n extensionAccessor: Accessor<Extension | null>,\n): void {\n const editorContext = useEditorContext()\n\n createEffect(() => {\n const editor = toValue(editorAccessor) || toValue(editorContext)\n const extension = extensionAccessor()\n\n if (!editor) {\n throw new EditorNotFoundError()\n }\n if (extension) {\n onCleanup(editor.use(extension))\n }\n })\n}\n","import { union, type Editor } from '@prosekit/core'\nimport { useSolidRenderer } from '@prosemirror-adapter/solid'\nimport type { Component, JSX, ParentProps } from 'solid-js'\n\nimport { defineSolidMarkViewFactory } from '../extensions/solid-mark-view.ts'\nimport { defineSolidNodeViewFactory } from '../extensions/solid-node-view.ts'\nimport { useEditorExtension } from '../hooks/use-editor-extension.ts'\n\ntype ViewRendererProps = ParentProps<{\n editor: Editor\n}>\n\nexport const ViewRenderer: Component<ViewRendererProps> = (props): JSX.Element => {\n const { renderSolidRenderer, removeSolidRenderer, render } = useSolidRenderer()\n\n const extension = union([\n defineSolidMarkViewFactory(renderSolidRenderer, removeSolidRenderer),\n defineSolidNodeViewFactory(renderSolidRenderer, removeSolidRenderer),\n ])\n\n useEditorExtension(() => props.editor, () => extension)\n\n return [props.children, render] as unknown as JSX.Element\n}\n","import type { Editor } from '@prosekit/core'\nimport { createComponent, type Component, type ParentProps } from 'solid-js'\n\nimport { EditorContextProvider } from '../contexts/editor-context.ts'\n\nimport { ViewRenderer } from './view-renderer.ts'\n\nexport type ProseKitProps = ParentProps<{\n editor: Editor\n}>\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: Component<ProseKitProps> = (props) => {\n return createComponent(EditorContextProvider, {\n get value() {\n return props.editor\n },\n get children() {\n return createComponent(ViewRenderer, {\n get editor() {\n return props.editor\n },\n get children() {\n return props.children\n },\n })\n },\n })\n}\n","import { withPriority, type Extension, type Priority } from '@prosekit/core'\n\n/**\n * @internal\n */\nexport function usePriorityExtension<T extends Extension = Extension>(\n extension: () => T | null,\n priority?: Priority | null,\n): () => T | null {\n return () => {\n const ext = extension()\n return ext && priority ? withPriority(ext, priority) : ext\n }\n}\n","import type { Editor, Extension, Priority } from '@prosekit/core'\nimport type { Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\nimport { usePriorityExtension } from './use-priority-extension.ts'\n\nexport interface UseExtensionOptions {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: MaybeAccessor<Editor>\n\n /**\n * Optional priority to add the extension with.\n */\n priority?: Priority\n}\n\n/**\n * Add an extension to the editor.\n */\nexport function useExtension(\n /**\n * The accessor to an extension to add to the editor. If it changes, the previous\n * extension will be removed and the new one (if not null) will be added.\n */\n extension: Accessor<Extension | null>,\n options?: UseExtensionOptions,\n): void {\n useEditorExtension(\n options?.editor,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\n/**\n * Calls the given handler whenever the editor document changes.\n *\n * @public\n */\nexport function useDocChange(\n handler: (doc: ProseMirrorNode) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineDocChangeHandler((view) => handler(view.state.doc))\n useExtension(() => extension, options)\n}\n","import { defineMountHandler, defineUpdateHandler, ProseKitError, union, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, createSignal } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\n\n/**\n * Retrieves the editor instance from the nearest ProseKit component.\n *\n * @public\n */\nexport function useEditor<E extends Extension = any>(options?: {\n /**\n * Whether to update the component when the editor is mounted or editor state\n * is updated.\n *\n * @default false\n */\n update?: boolean\n}): () => Editor<E> {\n const update = options?.update ?? false\n\n const editor = useEditorContext<E>()\n if (!editor) {\n throw new ProseKitError(\n 'useEditor must be used within the ProseKit component',\n )\n }\n\n const [depend, forceUpdate] = useForceUpdate()\n\n createEffect(() => {\n if (update) {\n const extension = union(\n defineMountHandler(forceUpdate),\n defineUpdateHandler(forceUpdate),\n )\n return editor.use(extension)\n }\n }, [editor, update, forceUpdate])\n\n return () => {\n depend()\n return editor\n }\n}\n\nfunction useForceUpdate() {\n return createSignal(undefined, { equals: false })\n}\n","import type { Editor, Extension } from '@prosekit/core'\nimport { createMemo, type Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\nimport { useEditor } from './use-editor.ts'\n\nexport interface UseEditorDerivedOptions<E extends Extension = any> {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: MaybeAccessor<Editor<E>>\n}\n\n/**\n * Runs a function to derive a value from the editor instance after editor state\n * changes.\n *\n * This is useful when you need to render something based on the editor state,\n * for example, whether the selected text is wrapped in an italic mark.\n *\n * It returns an accessor of the derived value that updates whenever the editor\n * state changes.\n *\n * @public\n */\nexport function useEditorDerivedValue<E extends Extension, Derived>(\n /**\n * A function that receives the editor instance and returns a derived value.\n *\n * It will be called whenever the editor's document state changes, or when it\n * mounts.\n */\n derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Accessor<Derived> {\n const initialEditor = options?.editor\n const editorAccessor: Accessor<Editor<E>> = initialEditor\n ? () => toValue(initialEditor)\n : useEditor<E>({ update: true })\n\n return createMemo(() => derive(editorAccessor()))\n}\n","import { defineKeymap, type Keymap } from '@prosekit/core'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\nexport function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void {\n const extension = () => defineKeymap(keymap())\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\n/**\n * Calls the given handler whenever the editor state changes.\n *\n * @public\n */\nexport function useStateUpdate(\n handler: (state: EditorState) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineUpdateHandler((view) => handler(view.state))\n useExtension(() => extension, options)\n}\n"],"mappings":";;;;;AAAA,SAAgB,cAAc,IAAuB;AACnD,IAAG,MAAM,UAAU;AACnB,IAAG,QAAQ,cAAc;;ACiC3B,IAAM,wBAAN,cAAoC,sBAA8C;;;sBACpD;GAC1B,MAAM,gBAAgB,KAAK;GAC3B,MAAM,WAAqC,KAAK;AAYhD,UAAO,gBAAgB,QAAQ;IAC7B,OAAO,KAAK;IACZ,UAAU,gBAAgB,eAbM;KAChC,IAAI,aAAa;AACf,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CAAC;;KAErB,CAGgD;IAC/C,KAAK;IACN,CAAC;;;;;;;AAON,SAAgB,2BACd,qBACA,qBACW;AAEX,QAAO,sBAA4C;EACjD,OAAO;EACP,SAHc,0BAA0B,qBAAqB,qBAAqB,sBAAsB;EAIzG,CAAC;;;;;;;AAQJ,SAAgB,oBAAoB,SAA0C;AAC5E,QAAO,w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,EAAE,QAAQ,OAAO,CAAC;;;;;;;;;;;;;;ACnBnD,SAAgB,sBAOd,QACA,SACmB;CACnB,MAAM,gBAAgB,SAAS;CAC/B,MAAM,iBAAsC,sBAClC,QAAQ,cAAc,GAC5B,UAAa,EAAE,QAAQ,MAAM,CAAC;AAElC,QAAO,iBAAiB,OAAO,gBAAgB,CAAC,CAAC;;ACvCnD,SAAgB,UAAU,QAAsB,SAAqC;CACnF,MAAM,kBAAkB,aAAa,QAAQ,CAAC;AAC9C,cAAa,WAAW,QAAQ;;;;;;;ACIlC,SAAgB,eACd,SACA,SACM;CACN,MAAM,YAAY,qBAAqB,SAAS,QAAQ,KAAK,MAAM,CAAC;AACpE,oBAAmB,WAAW,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosekit/solid",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.0-beta.
|
|
4
|
+
"version": "0.7.0-beta.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Solid components and utilities for ProseKit",
|
|
7
7
|
"author": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@prosemirror-adapter/solid": "^0.5.3",
|
|
77
77
|
"@prosekit/core": "^0.12.0-beta.0",
|
|
78
78
|
"@prosekit/pm": "^0.1.15",
|
|
79
|
-
"@prosekit/web": "^0.8.0-beta.
|
|
79
|
+
"@prosekit/web": "^0.8.0-beta.4"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"solid-js": ">= 1.7.0"
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"vitest": "^4.1.4",
|
|
95
95
|
"vitest-browser-solid": "^1.0.1",
|
|
96
96
|
"@prosekit/config-ts": "0.0.0",
|
|
97
|
-
"@prosekit/config-tsdown": "0.0.0",
|
|
98
97
|
"@prosekit/config-vitest": "0.0.0",
|
|
99
|
-
"@prosekit/testing": "0.0.0"
|
|
98
|
+
"@prosekit/testing": "0.0.0",
|
|
99
|
+
"@prosekit/config-tsdown": "0.0.0"
|
|
100
100
|
},
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"dev": {}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerAutocompleteEmptyElement, type AutocompleteEmptyElement } from '@prosekit/web/autocomplete';
|
|
6
4
|
import type { Component, JSX } from 'solid-js';
|
|
7
5
|
import h from 'solid-js/h';
|
|
8
6
|
|
|
9
|
-
/**
|
|
10
|
-
* Props for the {@link AutocompleteEmpty} Solid component.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
7
|
+
/** Props for the {@link AutocompleteEmpty} Solid component. */
|
|
14
8
|
export interface AutocompleteEmptyProps {}
|
|
15
9
|
|
|
16
|
-
/**
|
|
17
|
-
* A Solid component that renders an `prosekit-autocomplete-empty` custom element.
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
10
|
+
/** A Solid component that renders an `prosekit-autocomplete-empty` custom element. */
|
|
21
11
|
export const AutocompleteEmpty: Component<AutocompleteEmptyProps & JSX.HTMLAttributes<AutocompleteEmptyElement>> = (props): any => {
|
|
22
12
|
registerAutocompleteEmptyElement();
|
|
23
13
|
|