@prosekit/solid 0.7.6 → 0.8.0-beta.0

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.
@@ -158,6 +158,17 @@ interface InlinePopoverRootProps {
158
158
  * @default true
159
159
  */
160
160
  dismissOnEscape?: InlinePopoverRootProps$1['dismissOnEscape'];
161
+ /**
162
+ * The reference to position the popover against. This can be a DOM element, a
163
+ * Floating UI virtual element, or a function that returns either of them.
164
+ *
165
+ * When set, the popover is anchored to this reference instead of the current
166
+ * text selection, and the text selection no longer drives the open state, so
167
+ * control it with the `open` property.
168
+ *
169
+ * @default null
170
+ */
171
+ anchor?: InlinePopoverRootProps$1['anchor'];
161
172
  /**
162
173
  * Whether the overlay is currently open.
163
174
  * @default null
@@ -1 +1 @@
1
- {"version":3,"file":"inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.gen.ts","../src/components/inline-popover/inline-popover-positioner.gen.ts","../src/components/inline-popover/inline-popover-root.gen.ts"],"mappings":";;;UAOiB,uBAAA;;cAGJ,kBAAA,EAAoB,SAAA,CAAU,uBAAA,GAA0B,GAAA,CAAI,cAAA,CAAe,yBAAA;;UCFvE,4BAAA;EDDuB;;;AAAA;AAGxC;ECIE,SAAA,GAAY,8BAAA;;;;;;EAMZ,MAAA,GAAS,8BAAA;EDV+B;;;;;;ECiBxC,IAAA,GAAO,8BAAA;EDjBwG;;ACFjH;;;;EA0BE,KAAA,GAAQ,8BAAA;EAPD;;;;;;EAcP,OAAA,GAAU,8BAAA;EAoCH;;;;;;EA7BP,MAAA,GAAS,8BAAA;EA8EQ;;;;;EAxEjB,eAAA,GAAkB,8BAAA;EAlClB;;;;;EAwCA,QAAA,GAAW,8BAAA;EAnBX;;;;;;;EA2BA,UAAA,GAAa,8BAAA;EAAb;;;;;;;;EASA,IAAA,GAAO,8BAAA;EAoBK;;;;;EAdZ,KAAA,GAAQ,8BAAA;EAmCO;;;;;;EA5Bf,WAAA,GAAc,8BAAA;EAgDH;;;;;;EAzCX,SAAA,GAAY,8BAAA;EAyCiC;;;;;;EAlC7C,UAAA,GAAa,8BAAA;EAkCiH;AAAA;;AChIhI;;;EDqGE,QAAA,GAAW,8BAAA;ECvFG;;;;;;ED8Fd,YAAA,GAAe,8BAAA;ECrGf;;;;;;;ED6GA,cAAA,GAAiB,8BAAA;ECrFjB;;;;;;AAE4D;ED2F5D,WAAA,GAAc,8BAAA;AAAA;;cAIH,uBAAA,EAAyB,SAAA,CAAU,4BAAA,GAA+B,GAAA,CAAI,cAAA,CAAe,8BAAA;;UChIjF,sBAAA;EFHuB;;;AAAA;AAGxC;;EEOE,MAAA,GAAS,wBAAA;EFPgC;;;;;;EEczC,WAAA,GAAc,wBAAA;EFd2B;;;;;AAAsE;EEqB/G,eAAA,GAAkB,wBAAA;EDvBH;;;;EC4Bf,IAAA,GAAO,wBAAA;EDTA;;;;ECcP,QAAA,GAAW,wBAAA;EDmBA;ECjBX,YAAA,IAAgB,KAAA,EAAO,uBAAA;AAAA;;cAIZ,iBAAA,EAAmB,SAAA,CAAU,sBAAA,GAAyB,GAAA,CAAI,cAAA,CAAe,wBAAA"}
1
+ {"version":3,"file":"inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.gen.ts","../src/components/inline-popover/inline-popover-positioner.gen.ts","../src/components/inline-popover/inline-popover-root.gen.ts"],"mappings":";;;UAOiB,uBAAA;;cAGJ,kBAAA,EAAoB,SAAA,CAAU,uBAAA,GAA0B,GAAA,CAAI,cAAA,CAAe,yBAAA;;UCFvE,4BAAA;EDDuB;;;AAAA;AAGxC;ECIE,SAAA,GAAY,8BAAA;;;;;;EAMZ,MAAA,GAAS,8BAAA;EDV+B;;;;;;ECiBxC,IAAA,GAAO,8BAAA;EDjBwG;;ACFjH;;;;EA0BE,KAAA,GAAQ,8BAAA;EAPD;;;;;;EAcP,OAAA,GAAU,8BAAA;EAoCH;;;;;;EA7BP,MAAA,GAAS,8BAAA;EA8EQ;;;;;EAxEjB,eAAA,GAAkB,8BAAA;EAlClB;;;;;EAwCA,QAAA,GAAW,8BAAA;EAnBX;;;;;;;EA2BA,UAAA,GAAa,8BAAA;EAAb;;;;;;;;EASA,IAAA,GAAO,8BAAA;EAoBK;;;;;EAdZ,KAAA,GAAQ,8BAAA;EAmCO;;;;;;EA5Bf,WAAA,GAAc,8BAAA;EAgDH;;;;;;EAzCX,SAAA,GAAY,8BAAA;EAyCiC;;;;;;EAlC7C,UAAA,GAAa,8BAAA;EAkCiH;AAAA;;AChIhI;;;EDqGE,QAAA,GAAW,8BAAA;ECvFG;;;;;;ED8Fd,YAAA,GAAe,8BAAA;EChE+B;;;;;;;EDwE9C,cAAA,GAAiB,8BAAA;ECpFR;;;;;;;ED4FT,WAAA,GAAc,8BAAA;AAAA;AChF8C;AAAA,cDoFjD,uBAAA,EAAyB,SAAA,CAAU,4BAAA,GAA+B,GAAA,CAAI,cAAA,CAAe,8BAAA;;UChIjF,sBAAA;EFHuB;;;AAAA;AAGxC;;EEOE,MAAA,GAAS,wBAAA;EFPgC;;;;;;EEczC,WAAA,GAAc,wBAAA;EFd2B;;;;;AAAsE;EEqB/G,eAAA,GAAkB,wBAAA;EDvBH;;;;;;;;;;ECkCf,MAAA,GAAS,wBAAA;ED0BI;;;;ECrBb,IAAA,GAAO,wBAAA;EDyDM;;;;ECpDb,QAAA,GAAW,wBAAA;EDkFsC;EChFjD,YAAA,IAAgB,KAAA,EAAO,uBAAA;AAAA;;cAIZ,iBAAA,EAAmB,SAAA,CAAU,sBAAA,GAAyB,GAAA,CAAI,cAAA,CAAe,wBAAA"}
@@ -66,21 +66,23 @@ const InlinePopoverRoot = (props) => {
66
66
  const [getElement, setElement] = createSignal(null);
67
67
  const handlers = [];
68
68
  const [elementProps, eventHandlers, restProps] = splitProps(props, [
69
+ "anchor",
69
70
  "defaultOpen",
70
71
  "disabled",
71
72
  "dismissOnEscape",
72
73
  "editor",
73
74
  "open"
74
75
  ], ["onOpenChange"]);
75
- const p3Fallback = useEditorContext();
76
+ const p4Fallback = useEditorContext();
76
77
  createEffect(() => {
77
78
  const element = getElement();
78
79
  if (!element) return;
79
80
  Object.assign(element, {
81
+ anchor: elementProps.anchor,
80
82
  defaultOpen: elementProps.defaultOpen,
81
83
  disabled: elementProps.disabled,
82
84
  dismissOnEscape: elementProps.dismissOnEscape,
83
- editor: elementProps.editor ?? p3Fallback,
85
+ editor: elementProps.editor ?? p4Fallback,
84
86
  open: elementProps.open
85
87
  });
86
88
  handlers.length = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"inline-popover.js","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.gen.ts","../src/components/inline-popover/inline-popover-positioner.gen.ts","../src/components/inline-popover/inline-popover-root.gen.ts"],"sourcesContent":["// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerInlinePopoverPopupElement, type InlinePopoverPopupElement } from '@prosekit/web/inline-popover';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link InlinePopoverPopup} Solid component. */\nexport interface InlinePopoverPopupProps {}\n\n/** A Solid component that renders an `prosekit-inline-popover-popup` custom element. */\nexport const InlinePopoverPopup: Component<InlinePopoverPopupProps & JSX.HTMLAttributes<InlinePopoverPopupElement>> = (props): any => {\n registerInlinePopoverPopupElement();\n\n const restProps = props;\n\n return () => h('prosekit-inline-popover-popup', restProps);\n};\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerInlinePopoverPositionerElement, type InlinePopoverPositionerElement, type InlinePopoverPositionerProps as InlinePopoverPositionerElementProps } from '@prosekit/web/inline-popover';\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 InlinePopoverPositioner} Solid component. */\nexport interface InlinePopoverPositionerProps {\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement?: InlinePopoverPositionerElementProps['placement'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 12\n */\n offset?: InlinePopoverPositionerElementProps['offset'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default true\n */\n hide?: InlinePopoverPositionerElementProps['hide'];\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist?: InlinePopoverPositionerElementProps['hoist'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default true\n */\n overlap?: InlinePopoverPositionerElementProps['overlap'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default true\n */\n inline?: InlinePopoverPositionerElementProps['inline'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n *\n * @default 8\n */\n overflowPadding?: InlinePopoverPositionerElementProps['overflowPadding'];\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: InlinePopoverPositionerElementProps['strategy'];\n /**\n * Options to activate auto-update listeners\n *\n * @see https://floating-ui.com/docs/autoUpdate\n *\n * @default true\n */\n autoUpdate?: InlinePopoverPositionerElementProps['autoUpdate'];\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?: InlinePopoverPositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: InlinePopoverPositionerElementProps['shift'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['sameHeight'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['rootBoundary'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['altBoundary'];\n}\n\n/** A Solid component that renders an `prosekit-inline-popover-positioner` custom element. */\nexport const InlinePopoverPositioner: Component<InlinePopoverPositionerProps & JSX.HTMLAttributes<InlinePopoverPositionerElement>> = (props): any => {\n registerInlinePopoverPositionerElement();\n\n const [getElement, setElement] = createSignal<InlinePopoverPositionerElement | 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-inline-popover-positioner',\n mergeProps(restProps, {\n ref: (el: InlinePopoverPositionerElement | 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 { registerInlinePopoverRootElement, type InlinePopoverRootElement, type InlinePopoverRootEvents, type InlinePopoverRootProps as InlinePopoverRootElementProps } from '@prosekit/web/inline-popover';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\nimport { useEditorContext } from '../../contexts/editor-context.ts';\n\n/** Props for the {@link InlinePopoverRoot} Solid component. */\nexport interface InlinePopoverRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: InlinePopoverRootElementProps['editor'];\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * @default true\n */\n defaultOpen?: InlinePopoverRootElementProps['defaultOpen'];\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape?: InlinePopoverRootElementProps['dismissOnEscape'];\n /**\n * Whether the overlay is currently open.\n * @default null\n */\n open?: InlinePopoverRootElementProps['open'];\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: InlinePopoverRootElementProps['disabled'];\n /** Emitted when the open state of the popover changes. */\n onOpenChange?: (event: InlinePopoverRootEvents['openChange']) => void;\n}\n\n/** A Solid component that renders an `prosekit-inline-popover-root` custom element. */\nexport const InlinePopoverRoot: Component<InlinePopoverRootProps & JSX.HTMLAttributes<InlinePopoverRootElement>> = (props): any => {\n registerInlinePopoverRootElement();\n\n const [getElement, setElement] = createSignal<InlinePopoverRootElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['defaultOpen', 'disabled', 'dismissOnEscape', 'editor', 'open'], ['onOpenChange']);\n\n const p3Fallback = useEditorContext();\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { defaultOpen: elementProps.defaultOpen, disabled: elementProps.disabled, dismissOnEscape: elementProps.dismissOnEscape, editor: elementProps.editor ?? p3Fallback, 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-inline-popover-root',\n mergeProps(restProps, {\n ref: (el: InlinePopoverRootElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n"],"mappings":";;;;;AAUA,MAAa,sBAA0G,UAAe;CACpI,kCAAkC;CAElC,MAAM,YAAY;CAElB,aAAa,EAAE,iCAAiC,SAAS;AAC3D;;AC0HA,MAAa,2BAAyH,UAAe;CACnJ,uCAAuC;CAEvC,MAAM,CAAC,YAAY,cAAc,aAAoD,IAAI;CAEzF,MAAM,CAAC,cAAc,aAAa,WAAW,OAAO;EAAC;EAAe;EAAc;EAAY;EAAkB;EAAe;EAAQ;EAAQ;EAAS;EAAU;EAAU;EAAmB;EAAW;EAAa;EAAgB;EAAc;EAAa;EAAS;CAAU,CAAC;CAEtR,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,OAAO,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;EACzB,CAAC;CACH,CAAC;CAED,aACE,EACE,sCACA,WAAW,WAAW,EACpB,MAAM,OAA8C;EAClD,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ;;ACrIA,MAAa,qBAAuG,UAAe;CACjI,iCAAiC;CAEjC,MAAM,CAAC,YAAY,cAAc,aAA8C,IAAI;CACnF,MAAM,WAAsD,CAAC;CAE7D,MAAM,CAAC,cAAc,eAAe,aAAa,WAAW,OAAO;EAAC;EAAe;EAAY;EAAmB;EAAU;CAAM,GAAG,CAAC,cAAc,CAAC;CAErJ,MAAM,aAAa,iBAAiB;CAEpC,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,OAAO,OAAO,SAAS;GAAE,aAAa,aAAa;GAAa,UAAU,aAAa;GAAU,iBAAiB,aAAa;GAAiB,QAAQ,aAAa,UAAU;GAAY,MAAM,aAAa;EAAK,CAAC;EAEpN,SAAS,SAAS;EAClB,SAAS,KAAK,cAAc,YAAY;CAC1C,CAAC;CAED,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,MAAM,KAAK,IAAI,gBAAgB;EAC/B,KAAK,MAAM,CAAC,OAAO,cAAc,CAAC,YAAY,EAAE,QAAQ,GACtD,QAAQ,iBACN,YACC,UAAU;GACT,SAAS,SAAS,KAAK;EACzB,GACA,EAAE,QAAQ,GAAG,OAAO,CACtB;EAEF,aAAa,GAAG,MAAM;CACxB,CAAC;CAED,aACE,EACE,gCACA,WAAW,WAAW,EACpB,MAAM,OAAwC;EAC5C,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ"}
1
+ {"version":3,"file":"inline-popover.js","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.gen.ts","../src/components/inline-popover/inline-popover-positioner.gen.ts","../src/components/inline-popover/inline-popover-root.gen.ts"],"sourcesContent":["// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerInlinePopoverPopupElement, type InlinePopoverPopupElement } from '@prosekit/web/inline-popover';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link InlinePopoverPopup} Solid component. */\nexport interface InlinePopoverPopupProps {}\n\n/** A Solid component that renders an `prosekit-inline-popover-popup` custom element. */\nexport const InlinePopoverPopup: Component<InlinePopoverPopupProps & JSX.HTMLAttributes<InlinePopoverPopupElement>> = (props): any => {\n registerInlinePopoverPopupElement();\n\n const restProps = props;\n\n return () => h('prosekit-inline-popover-popup', restProps);\n};\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerInlinePopoverPositionerElement, type InlinePopoverPositionerElement, type InlinePopoverPositionerProps as InlinePopoverPositionerElementProps } from '@prosekit/web/inline-popover';\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 InlinePopoverPositioner} Solid component. */\nexport interface InlinePopoverPositionerProps {\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement?: InlinePopoverPositionerElementProps['placement'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 12\n */\n offset?: InlinePopoverPositionerElementProps['offset'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default true\n */\n hide?: InlinePopoverPositionerElementProps['hide'];\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist?: InlinePopoverPositionerElementProps['hoist'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default true\n */\n overlap?: InlinePopoverPositionerElementProps['overlap'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default true\n */\n inline?: InlinePopoverPositionerElementProps['inline'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n *\n * @default 8\n */\n overflowPadding?: InlinePopoverPositionerElementProps['overflowPadding'];\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: InlinePopoverPositionerElementProps['strategy'];\n /**\n * Options to activate auto-update listeners\n *\n * @see https://floating-ui.com/docs/autoUpdate\n *\n * @default true\n */\n autoUpdate?: InlinePopoverPositionerElementProps['autoUpdate'];\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?: InlinePopoverPositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: InlinePopoverPositionerElementProps['shift'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['sameHeight'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['rootBoundary'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['altBoundary'];\n}\n\n/** A Solid component that renders an `prosekit-inline-popover-positioner` custom element. */\nexport const InlinePopoverPositioner: Component<InlinePopoverPositionerProps & JSX.HTMLAttributes<InlinePopoverPositionerElement>> = (props): any => {\n registerInlinePopoverPositionerElement();\n\n const [getElement, setElement] = createSignal<InlinePopoverPositionerElement | 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-inline-popover-positioner',\n mergeProps(restProps, {\n ref: (el: InlinePopoverPositionerElement | 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 { registerInlinePopoverRootElement, type InlinePopoverRootElement, type InlinePopoverRootEvents, type InlinePopoverRootProps as InlinePopoverRootElementProps } from '@prosekit/web/inline-popover';\nimport { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\nimport { useEditorContext } from '../../contexts/editor-context.ts';\n\n/** Props for the {@link InlinePopoverRoot} Solid component. */\nexport interface InlinePopoverRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: InlinePopoverRootElementProps['editor'];\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * @default true\n */\n defaultOpen?: InlinePopoverRootElementProps['defaultOpen'];\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape?: InlinePopoverRootElementProps['dismissOnEscape'];\n /**\n * The reference to position the popover against. This can be a DOM element, a\n * Floating UI virtual element, or a function that returns either of them.\n *\n * When set, the popover is anchored to this reference instead of the current\n * text selection, and the text selection no longer drives the open state, so\n * control it with the `open` property.\n *\n * @default null\n */\n anchor?: InlinePopoverRootElementProps['anchor'];\n /**\n * Whether the overlay is currently open.\n * @default null\n */\n open?: InlinePopoverRootElementProps['open'];\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: InlinePopoverRootElementProps['disabled'];\n /** Emitted when the open state of the popover changes. */\n onOpenChange?: (event: InlinePopoverRootEvents['openChange']) => void;\n}\n\n/** A Solid component that renders an `prosekit-inline-popover-root` custom element. */\nexport const InlinePopoverRoot: Component<InlinePopoverRootProps & JSX.HTMLAttributes<InlinePopoverRootElement>> = (props): any => {\n registerInlinePopoverRootElement();\n\n const [getElement, setElement] = createSignal<InlinePopoverRootElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['anchor', 'defaultOpen', 'disabled', 'dismissOnEscape', 'editor', 'open'], ['onOpenChange']);\n\n const p4Fallback = useEditorContext();\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { anchor: elementProps.anchor, defaultOpen: elementProps.defaultOpen, disabled: elementProps.disabled, dismissOnEscape: elementProps.dismissOnEscape, editor: elementProps.editor ?? p4Fallback, 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-inline-popover-root',\n mergeProps(restProps, {\n ref: (el: InlinePopoverRootElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n"],"mappings":";;;;;AAUA,MAAa,sBAA0G,UAAe;CACpI,kCAAkC;CAElC,MAAM,YAAY;CAElB,aAAa,EAAE,iCAAiC,SAAS;AAC3D;;AC0HA,MAAa,2BAAyH,UAAe;CACnJ,uCAAuC;CAEvC,MAAM,CAAC,YAAY,cAAc,aAAoD,IAAI;CAEzF,MAAM,CAAC,cAAc,aAAa,WAAW,OAAO;EAAC;EAAe;EAAc;EAAY;EAAkB;EAAe;EAAQ;EAAQ;EAAS;EAAU;EAAU;EAAmB;EAAW;EAAa;EAAgB;EAAc;EAAa;EAAS;CAAU,CAAC;CAEtR,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,OAAO,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;EACzB,CAAC;CACH,CAAC;CAED,aACE,EACE,sCACA,WAAW,WAAW,EACpB,MAAM,OAA8C;EAClD,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ;;AC1HA,MAAa,qBAAuG,UAAe;CACjI,iCAAiC;CAEjC,MAAM,CAAC,YAAY,cAAc,aAA8C,IAAI;CACnF,MAAM,WAAsD,CAAC;CAE7D,MAAM,CAAC,cAAc,eAAe,aAAa,WAAW,OAAO;EAAC;EAAU;EAAe;EAAY;EAAmB;EAAU;CAAM,GAAG,CAAC,cAAc,CAAC;CAE/J,MAAM,aAAa,iBAAiB;CAEpC,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,OAAO,OAAO,SAAS;GAAE,QAAQ,aAAa;GAAQ,aAAa,aAAa;GAAa,UAAU,aAAa;GAAU,iBAAiB,aAAa;GAAiB,QAAQ,aAAa,UAAU;GAAY,MAAM,aAAa;EAAK,CAAC;EAEjP,SAAS,SAAS;EAClB,SAAS,KAAK,cAAc,YAAY;CAC1C,CAAC;CAED,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,MAAM,KAAK,IAAI,gBAAgB;EAC/B,KAAK,MAAM,CAAC,OAAO,cAAc,CAAC,YAAY,EAAE,QAAQ,GACtD,QAAQ,iBACN,YACC,UAAU;GACT,SAAS,SAAS,KAAK;EACzB,GACA,EAAE,QAAQ,GAAG,OAAO,CACtB;EAEF,aAAa,GAAG,MAAM;CACxB,CAAC;CAED,aACE,EACE,gCACA,WAAW,WAAW,EACpB,MAAM,OAAwC;EAC5C,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/solid",
3
3
  "type": "module",
4
- "version": "0.7.6",
4
+ "version": "0.8.0-beta.0",
5
5
  "private": false,
6
6
  "description": "Solid components and utilities for ProseKit",
7
7
  "author": {
@@ -75,8 +75,8 @@
75
75
  "@prosemirror-adapter/core": "^0.5.3",
76
76
  "@prosemirror-adapter/solid": "^0.5.3",
77
77
  "@prosekit/core": "^0.12.3",
78
- "@prosekit/pm": "^0.1.18",
79
- "@prosekit/web": "^0.8.6"
78
+ "@prosekit/web": "^0.9.0-beta.0",
79
+ "@prosekit/pm": "^0.1.18"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "solid-js": ">= 1.7.0"
@@ -94,9 +94,9 @@
94
94
  "vitest": "^4.1.8",
95
95
  "vitest-browser-solid": "^1.0.1",
96
96
  "@prosekit/config-ts": "0.0.0",
97
+ "@prosekit/config-tsdown": "0.0.0",
97
98
  "@prosekit/config-vitest": "0.0.0",
98
- "@prosekit/testing": "0.0.0",
99
- "@prosekit/config-tsdown": "0.0.0"
99
+ "@prosekit/testing": "0.0.0"
100
100
  },
101
101
  "scripts": {
102
102
  "build:tsc": "tsc -b tsconfig.json",
@@ -30,6 +30,17 @@ export interface InlinePopoverRootProps {
30
30
  * @default true
31
31
  */
32
32
  dismissOnEscape?: InlinePopoverRootElementProps['dismissOnEscape'];
33
+ /**
34
+ * The reference to position the popover against. This can be a DOM element, a
35
+ * Floating UI virtual element, or a function that returns either of them.
36
+ *
37
+ * When set, the popover is anchored to this reference instead of the current
38
+ * text selection, and the text selection no longer drives the open state, so
39
+ * control it with the `open` property.
40
+ *
41
+ * @default null
42
+ */
43
+ anchor?: InlinePopoverRootElementProps['anchor'];
33
44
  /**
34
45
  * Whether the overlay is currently open.
35
46
  * @default null
@@ -51,15 +62,15 @@ export const InlinePopoverRoot: Component<InlinePopoverRootProps & JSX.HTMLAttri
51
62
  const [getElement, setElement] = createSignal<InlinePopoverRootElement | null>(null);
52
63
  const handlers: Array<((event: any) => void) | undefined> = [];
53
64
 
54
- const [elementProps, eventHandlers, restProps] = splitProps(props, ['defaultOpen', 'disabled', 'dismissOnEscape', 'editor', 'open'], ['onOpenChange']);
65
+ const [elementProps, eventHandlers, restProps] = splitProps(props, ['anchor', 'defaultOpen', 'disabled', 'dismissOnEscape', 'editor', 'open'], ['onOpenChange']);
55
66
 
56
- const p3Fallback = useEditorContext();
67
+ const p4Fallback = useEditorContext();
57
68
 
58
69
  createEffect(() => {
59
70
  const element = getElement();
60
71
  if (!element) return;
61
72
 
62
- Object.assign(element, { defaultOpen: elementProps.defaultOpen, disabled: elementProps.disabled, dismissOnEscape: elementProps.dismissOnEscape, editor: elementProps.editor ?? p3Fallback, open: elementProps.open });
73
+ Object.assign(element, { anchor: elementProps.anchor, defaultOpen: elementProps.defaultOpen, disabled: elementProps.disabled, dismissOnEscape: elementProps.dismissOnEscape, editor: elementProps.editor ?? p4Fallback, open: elementProps.open });
63
74
 
64
75
  handlers.length = 0;
65
76
  handlers.push(eventHandlers.onOpenChange);