@prosekit/solid 0.8.0-beta.12 → 0.8.0-beta.14

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.
@@ -169,6 +169,16 @@ interface AutocompleteRootProps {
169
169
  * @default defaultItemFilter
170
170
  */
171
171
  filter?: AutocompleteRootProps$1['filter'];
172
+ /**
173
+ * Builds the query string from the regex match found before the cursor. The
174
+ * query is exposed via the `queryChange` event and used by the built-in item
175
+ * filter. The default builder lowercases the match and strips punctuation.
176
+ * Provide a custom builder to control the query, for example to preserve the
177
+ * casing and punctuation the user typed.
178
+ *
179
+ * @default defaultQueryBuilder
180
+ */
181
+ queryBuilder?: AutocompleteRootProps$1['queryBuilder'];
172
182
  /**
173
183
  * The reference to position the popup against. This can be a DOM element, a
174
184
  * Floating UI virtual element, or a function that returns either of them.
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-popup.gen.ts","../src/components/autocomplete/autocomplete-positioner.gen.ts","../src/components/autocomplete/autocomplete-root.gen.ts"],"mappings":";;;UAOiB,sBAAA;;cAGJ,iBAAA,EAAmB,SAAA,CAAU,sBAAA,GAAyB,GAAA,CAAI,cAAA,CAAe,wBAAA;;UCFrE,qBAAA;EDDsB;;;AAAA;AAGvC;;;ECME,KAAA,GAAQ,uBAAA;EDN4E;;;;;ECYpF,QAAA,GAAW,uBAAA;EDZ6B;ECcxC,QAAA,IAAY,KAAA,EAAO,sBAAA;AAAA;;cAIR,gBAAA,EAAkB,SAAA,CAAU,qBAAA,GAAwB,GAAA,CAAI,cAAA,CAAe,uBAAA;;UCpBnE,sBAAA;EFDsB;;;AAAA;EEMrC,aAAA,IAAiB,KAAA,EAAO,uBAAA;EFGzB;;;;EEEC,cAAA,IAAkB,KAAA,EAAO,uBAAuB;AAAA;;cAIrC,iBAAA,EAAmB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;EHpBb;;;;EGyBX,cAAA,IAAkB,KAAA,EAAO,sBAAA;AAAA;;cAId,gBAAA,EAAkB,SAAA,CAAU,qBAAA,GAAwB,GAAA,CAAI,cAAA,CAAe,uBAAA"}
1
+ {"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-popup.gen.ts","../src/components/autocomplete/autocomplete-positioner.gen.ts","../src/components/autocomplete/autocomplete-root.gen.ts"],"mappings":";;;UAOiB,sBAAA;;cAGJ,iBAAA,EAAmB,SAAA,CAAU,sBAAA,GAAyB,GAAA,CAAI,cAAA,CAAe,wBAAA;;UCFrE,qBAAA;EDDsB;;;AAAA;AAGvC;;;ECME,KAAA,GAAQ,uBAAA;EDN4E;;;;;ECYpF,QAAA,GAAW,uBAAA;EDZ6B;ECcxC,QAAA,IAAY,KAAA,EAAO,sBAAA;AAAA;;cAIR,gBAAA,EAAkB,SAAA,CAAU,qBAAA,GAAwB,GAAA,CAAI,cAAA,CAAe,uBAAA;;UCpBnE,sBAAA;EFDsB;;;AAAA;EEMrC,aAAA,IAAiB,KAAA,EAAO,uBAAA;EFGzB;;;;EEEC,cAAA,IAAkB,KAAA,EAAO,uBAAuB;AAAA;;cAIrC,iBAAA,EAAmB,SAAA,CAAU,sBAAA,GAAyB,GAAA,CAAI,cAAA,CAAe,wBAAA;;UCdrE,2BAAA;EHDsB;;;AAAA;AAGvC;EGIE,SAAA,GAAY,6BAAA;;;;;;EAMZ,MAAA,GAAS,6BAAA;EHV8B;;;;;;EGiBvC,IAAA,GAAO,6BAAA;EHjBqG;EGmB5G,MAAA,GAAS,6BAAA;EFrBM;EEuBf,KAAA,GAAQ,6BAAA;;EAER,WAAA,GAAc,6BAAA;EFXH;EEaX,QAAA,GAAW,6BAAA;EFX8B;EEazC,eAAA,GAAkB,6BAAA;EFrBlB;;;;;EE2BA,QAAA,GAAW,6BAAA;EFnBC;;AAAuC;AAIrD;;;;EEuBE,UAAA,GAAa,6BAAA;EFvBkD;;;;;;;;EEgC/D,IAAA,GAAO,6BAAA;EFhCkG;AAAA;;ACpB3G;;EC0DE,KAAA,GAAQ,6BAAA;EDhDwC;;;;;;ECuDhD,OAAA,GAAU,6BAAA;EDvDsD;AAAA;AAIlE;;;;EC0DE,SAAA,GAAY,6BAAA;ED1DqD;;;;;;ECiEjE,UAAA,GAAa,6BAAA;EDjEwD;;;AAAuC;;ACd9G;EAsFE,YAAA,GAAe,6BAAA;;;;;;;;EAQf,cAAA,GAAiB,6BAAA;EAjEC;;;;;;;EAyElB,WAAA,GAAc,6BAAA;AAAA;;cAIH,sBAAA,EAAwB,SAAA,CAAU,2BAAA,GAA8B,GAAA,CAAI,cAAA,CAAe,6BAAA;;UCxG/E,qBAAA;EJHsB;;;AAAA;AAGvC;;EIOE,MAAA,GAAS,uBAAA;EJP+B;;;;;EIaxC,KAAA,GAAQ,uBAAA;EJbsB;;;;;;EIoB9B,MAAA,GAAS,uBAAA;;AHtBX;;;;;;;;EGgCE,YAAA,GAAe,uBAAA;EHxBP;;;;;;;AAQ2C;EGyBnD,MAAA,GAAS,uBAAA;EHuBV;EGrBC,YAAA,IAAgB,KAAA,EAAO,sBAAA;EHvBgB;EGyBvC,aAAA,IAAiB,KAAA,EAAO,sBAAA;EHzBuC;;;;EG8B/D,aAAA,IAAiB,KAAA,EAAO,sBAAA;EH9Be;;;;EGmCvC,cAAA,IAAkB,KAAA,EAAO,sBAAA;AAAA;;cAId,gBAAA,EAAkB,SAAA,CAAU,qBAAA,GAAwB,GAAA,CAAI,cAAA,CAAe,uBAAA"}
@@ -123,6 +123,7 @@ const AutocompleteRoot = (props) => {
123
123
  "anchor",
124
124
  "editor",
125
125
  "filter",
126
+ "queryBuilder",
126
127
  "regex"
127
128
  ], [
128
129
  "onOpenChange",
@@ -138,6 +139,7 @@ const AutocompleteRoot = (props) => {
138
139
  anchor: elementProps.anchor,
139
140
  editor: elementProps.editor ?? p1Fallback,
140
141
  filter: elementProps.filter,
142
+ queryBuilder: elementProps.queryBuilder,
141
143
  regex: elementProps.regex
142
144
  });
143
145
  handlers.length = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.js","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-popup.gen.ts","../src/components/autocomplete/autocomplete-positioner.gen.ts","../src/components/autocomplete/autocomplete-root.gen.ts"],"sourcesContent":["// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteEmptyElement, type AutocompleteEmptyElement } from '@prosekit/web/autocomplete';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link AutocompleteEmpty} Solid component. */\nexport interface AutocompleteEmptyProps {}\n\n/** A Solid component that renders an `prosekit-autocomplete-empty` custom element. */\nexport const AutocompleteEmpty: Component<AutocompleteEmptyProps & JSX.HTMLAttributes<AutocompleteEmptyElement>> = (props): any => {\n registerAutocompleteEmptyElement();\n\n const restProps = props;\n\n return () => h('prosekit-autocomplete-empty', restProps);\n};\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteItemElement, type AutocompleteItemElement, type AutocompleteItemEvents, type AutocompleteItemProps as AutocompleteItemElementProps } from '@prosekit/web/autocomplete';\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 AutocompleteItem} Solid component. */\nexport interface AutocompleteItemProps {\n /**\n * The value of the item, which will be matched against the query.\n *\n * If not provided, the value is the item's text content.\n *\n * @default \"\"\n */\n value?: AutocompleteItemElementProps['value'];\n /**\n * Whether this option is disabled.\n *\n * @default false\n */\n disabled?: AutocompleteItemElementProps['disabled'];\n /** Emitted when the the item is selected. */\n onSelect?: (event: AutocompleteItemEvents['select']) => void;\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-item` custom element. */\nexport const AutocompleteItem: Component<AutocompleteItemProps & JSX.HTMLAttributes<AutocompleteItemElement>> = (props): any => {\n registerAutocompleteItemElement();\n\n const [getElement, setElement] = createSignal<AutocompleteItemElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['disabled', 'value'], ['onSelect']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { disabled: elementProps.disabled, value: elementProps.value });\n\n handlers.length = 0;\n handlers.push(eventHandlers.onSelect);\n });\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n const ac = new AbortController();\n for (const [index, eventName] of ['select'].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-autocomplete-item',\n mergeProps(restProps, {\n ref: (el: AutocompleteItemElement | 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 { registerAutocompletePopupElement, type AutocompletePopupElement, type AutocompletePopupEvents } from '@prosekit/web/autocomplete';\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 AutocompletePopup} Solid component. */\nexport interface AutocompletePopupProps {\n /**\n * Emitted when the selected value changes. Only available when multiple is\n * false.\n */\n onValueChange?: (event: AutocompletePopupEvents['valueChange']) => void;\n /**\n * Emitted when the selected values change. Only available when multiple is\n * true.\n */\n onValuesChange?: (event: AutocompletePopupEvents['valuesChange']) => void;\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-popup` custom element. */\nexport const AutocompletePopup: Component<AutocompletePopupProps & JSX.HTMLAttributes<AutocompletePopupElement>> = (props): any => {\n registerAutocompletePopupElement();\n\n const [getElement, setElement] = createSignal<AutocompletePopupElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [eventHandlers, restProps] = splitProps(props, ['onValueChange', 'onValuesChange']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n handlers.length = 0;\n handlers.push(eventHandlers.onValueChange);\n handlers.push(eventHandlers.onValuesChange);\n });\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n const ac = new AbortController();\n for (const [index, eventName] of ['valueChange', 'valuesChange'].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-autocomplete-popup',\n mergeProps(restProps, {\n ref: (el: AutocompletePopupElement | 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 { registerAutocompletePositionerElement, type AutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from '@prosekit/web/autocomplete';\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 AutocompletePositioner} Solid component. */\nexport interface AutocompletePositionerProps {\n /**\n * The placement of the popover, relative to the text cursor.\n *\n * @default \"bottom-start\"\n */\n placement?: AutocompletePositionerElementProps['placement'];\n /**\n * The distance between the popover and the text selection.\n *\n * @default { mainAxis: 8, crossAxis: -4 }\n */\n offset?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['hide'];\n /** @default true */\n inline?: AutocompletePositionerElementProps['inline'];\n /** @default true */\n hoist?: AutocompletePositionerElementProps['hoist'];\n /** @default true */\n fitViewport?: AutocompletePositionerElementProps['fitViewport'];\n /** @default \"The body element\" */\n boundary?: AutocompletePositionerElementProps['boundary'];\n /** @default 8 */\n overflowPadding?: AutocompletePositionerElementProps['overflowPadding'];\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['overlap'];\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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['sameHeight'];\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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['altBoundary'];\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-positioner` custom element. */\nexport const AutocompletePositioner: Component<AutocompletePositionerProps & JSX.HTMLAttributes<AutocompletePositionerElement>> = (props): any => {\n registerAutocompletePositionerElement();\n\n const [getElement, setElement] = createSignal<AutocompletePositionerElement | 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-autocomplete-positioner',\n mergeProps(restProps, {\n ref: (el: AutocompletePositionerElement | 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 { registerAutocompleteRootElement, type AutocompleteRootElement, type AutocompleteRootEvents, type AutocompleteRootProps as AutocompleteRootElementProps } from '@prosekit/web/autocomplete';\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 AutocompleteRoot} Solid component. */\nexport interface AutocompleteRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: AutocompleteRootElementProps['editor'];\n /**\n * The regular expression to match the query text to autocomplete.\n *\n * @default null\n */\n regex?: AutocompleteRootElementProps['regex'];\n /**\n * The filter function to determine if an item should be shown in the\n * listbox.\n *\n * @default defaultItemFilter\n */\n filter?: AutocompleteRootElementProps['filter'];\n /**\n * The reference to position the popup against. This can be a DOM element, a\n * Floating UI virtual element, or a function that returns either of them.\n * By default, the popup will be positioned against the text content that\n * triggers the autocomplete.\n *\n * @default null\n */\n anchor?: AutocompleteRootElementProps['anchor'];\n /** Fired when the open state changes. */\n onOpenChange?: (event: AutocompleteRootEvents['openChange']) => void;\n /** Fired when the query changes. */\n onQueryChange?: (event: AutocompleteRootEvents['queryChange']) => void;\n /**\n * Emitted when the selected value changes. Only available when multiple is\n * false.\n */\n onValueChange?: (event: AutocompleteRootEvents['valueChange']) => void;\n /**\n * Emitted when the selected values change. Only available when multiple is\n * true.\n */\n onValuesChange?: (event: AutocompleteRootEvents['valuesChange']) => void;\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-root` custom element. */\nexport const AutocompleteRoot: Component<AutocompleteRootProps & JSX.HTMLAttributes<AutocompleteRootElement>> = (props): any => {\n registerAutocompleteRootElement();\n\n const [getElement, setElement] = createSignal<AutocompleteRootElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['anchor', 'editor', 'filter', 'regex'], ['onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange']);\n\n const p1Fallback = useEditorContext();\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { anchor: elementProps.anchor, editor: elementProps.editor ?? p1Fallback, filter: elementProps.filter, regex: elementProps.regex });\n\n handlers.length = 0;\n handlers.push(eventHandlers.onOpenChange);\n handlers.push(eventHandlers.onQueryChange);\n handlers.push(eventHandlers.onValueChange);\n handlers.push(eventHandlers.onValuesChange);\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', 'queryChange', 'valueChange', 'valuesChange'].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-autocomplete-root',\n mergeProps(restProps, {\n ref: (el: AutocompleteRootElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n"],"mappings":";;;;;AAUA,MAAa,qBAAuG,UAAe;CACjI,iCAAiC;CAEjC,MAAM,YAAY;CAElB,aAAa,EAAE,+BAA+B,SAAS;AACzD;;ACYA,MAAa,oBAAoG,UAAe;CAC9H,gCAAgC;CAEhC,MAAM,CAAC,YAAY,cAAc,aAA6C,IAAI;CAClF,MAAM,WAAsD,CAAC;CAE7D,MAAM,CAAC,cAAc,eAAe,aAAa,WAAW,OAAO,CAAC,YAAY,OAAO,GAAG,CAAC,UAAU,CAAC;CAEtG,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,OAAO,OAAO,SAAS;GAAE,UAAU,aAAa;GAAU,OAAO,aAAa;EAAM,CAAC;EAErF,SAAS,SAAS;EAClB,SAAS,KAAK,cAAc,QAAQ;CACtC,CAAC;CAED,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,MAAM,KAAK,IAAI,gBAAgB;EAC/B,KAAK,MAAM,CAAC,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC,QAAQ,GAClD,QAAQ,iBACN,YACC,UAAU;GACT,SAAS,MAAM,GAAG,KAAK;EACzB,GACA,EAAE,QAAQ,GAAG,OAAO,CACtB;EAEF,aAAa,GAAG,MAAM;CACxB,CAAC;CAED,aACE,EACE,8BACA,WAAW,WAAW,EACpB,MAAM,OAAuC;EAC3C,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ;;AClDA,MAAa,qBAAuG,UAAe;CACjI,iCAAiC;CAEjC,MAAM,CAAC,YAAY,cAAc,aAA8C,IAAI;CACnF,MAAM,WAAsD,CAAC;CAE7D,MAAM,CAAC,eAAe,aAAa,WAAW,OAAO,CAAC,iBAAiB,gBAAgB,CAAC;CAExF,mBAAmB;EAE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,aACE,EACE,oCACA,WAAW,WAAW,EACpB,MAAM,OAA6C;EACjD,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ;;ACnGA,MAAa,oBAAoG,UAAe;CAC9H,gCAAgC;CAEhC,MAAM,CAAC,YAAY,cAAc,aAA6C,IAAI;CAClF,MAAM,WAAsD,CAAC;CAE7D,MAAM,CAAC,cAAc,eAAe,aAAa,WAAW,OAAO;EAAC;EAAU;EAAU;EAAU;CAAO,GAAG;EAAC;EAAgB;EAAiB;EAAiB;CAAgB,CAAC;CAEhL,MAAM,aAAa,iBAAiB;CAEpC,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,OAAO,OAAO,SAAS;GAAE,QAAQ,aAAa;GAAQ,QAAQ,aAAa,UAAU;GAAY,QAAQ,aAAa;GAAQ,OAAO,aAAa;EAAM,CAAC;EAEzJ,SAAS,SAAS;EAClB,SAAS,KAAK,cAAc,YAAY;EACxC,SAAS,KAAK,cAAc,aAAa;EACzC,SAAS,KAAK,cAAc,aAAa;EACzC,SAAS,KAAK,cAAc,cAAc;CAC5C,CAAC;CAED,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,MAAM,KAAK,IAAI,gBAAgB;EAC/B,KAAK,MAAM,CAAC,OAAO,cAAc;GAAC;GAAc;GAAe;GAAe;EAAc,CAAC,CAAC,QAAQ,GACpG,QAAQ,iBACN,YACC,UAAU;GACT,SAAS,MAAM,GAAG,KAAK;EACzB,GACA,EAAE,QAAQ,GAAG,OAAO,CACtB;EAEF,aAAa,GAAG,MAAM;CACxB,CAAC;CAED,aACE,EACE,8BACA,WAAW,WAAW,EACpB,MAAM,OAAuC;EAC3C,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ"}
1
+ {"version":3,"file":"autocomplete.js","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-popup.gen.ts","../src/components/autocomplete/autocomplete-positioner.gen.ts","../src/components/autocomplete/autocomplete-root.gen.ts"],"sourcesContent":["// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteEmptyElement, type AutocompleteEmptyElement } from '@prosekit/web/autocomplete';\nimport type { Component, JSX } from 'solid-js';\nimport h from 'solid-js/h';\n\n/** Props for the {@link AutocompleteEmpty} Solid component. */\nexport interface AutocompleteEmptyProps {}\n\n/** A Solid component that renders an `prosekit-autocomplete-empty` custom element. */\nexport const AutocompleteEmpty: Component<AutocompleteEmptyProps & JSX.HTMLAttributes<AutocompleteEmptyElement>> = (props): any => {\n registerAutocompleteEmptyElement();\n\n const restProps = props;\n\n return () => h('prosekit-autocomplete-empty', restProps);\n};\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteItemElement, type AutocompleteItemElement, type AutocompleteItemEvents, type AutocompleteItemProps as AutocompleteItemElementProps } from '@prosekit/web/autocomplete';\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 AutocompleteItem} Solid component. */\nexport interface AutocompleteItemProps {\n /**\n * The value of the item, which will be matched against the query.\n *\n * If not provided, the value is the item's text content.\n *\n * @default \"\"\n */\n value?: AutocompleteItemElementProps['value'];\n /**\n * Whether this option is disabled.\n *\n * @default false\n */\n disabled?: AutocompleteItemElementProps['disabled'];\n /** Emitted when the the item is selected. */\n onSelect?: (event: AutocompleteItemEvents['select']) => void;\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-item` custom element. */\nexport const AutocompleteItem: Component<AutocompleteItemProps & JSX.HTMLAttributes<AutocompleteItemElement>> = (props): any => {\n registerAutocompleteItemElement();\n\n const [getElement, setElement] = createSignal<AutocompleteItemElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['disabled', 'value'], ['onSelect']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { disabled: elementProps.disabled, value: elementProps.value });\n\n handlers.length = 0;\n handlers.push(eventHandlers.onSelect);\n });\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n const ac = new AbortController();\n for (const [index, eventName] of ['select'].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-autocomplete-item',\n mergeProps(restProps, {\n ref: (el: AutocompleteItemElement | 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 { registerAutocompletePopupElement, type AutocompletePopupElement, type AutocompletePopupEvents } from '@prosekit/web/autocomplete';\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 AutocompletePopup} Solid component. */\nexport interface AutocompletePopupProps {\n /**\n * Emitted when the selected value changes. Only available when multiple is\n * false.\n */\n onValueChange?: (event: AutocompletePopupEvents['valueChange']) => void;\n /**\n * Emitted when the selected values change. Only available when multiple is\n * true.\n */\n onValuesChange?: (event: AutocompletePopupEvents['valuesChange']) => void;\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-popup` custom element. */\nexport const AutocompletePopup: Component<AutocompletePopupProps & JSX.HTMLAttributes<AutocompletePopupElement>> = (props): any => {\n registerAutocompletePopupElement();\n\n const [getElement, setElement] = createSignal<AutocompletePopupElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [eventHandlers, restProps] = splitProps(props, ['onValueChange', 'onValuesChange']);\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n handlers.length = 0;\n handlers.push(eventHandlers.onValueChange);\n handlers.push(eventHandlers.onValuesChange);\n });\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n const ac = new AbortController();\n for (const [index, eventName] of ['valueChange', 'valuesChange'].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-autocomplete-popup',\n mergeProps(restProps, {\n ref: (el: AutocompletePopupElement | 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 { registerAutocompletePositionerElement, type AutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from '@prosekit/web/autocomplete';\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 AutocompletePositioner} Solid component. */\nexport interface AutocompletePositionerProps {\n /**\n * The placement of the popover, relative to the text cursor.\n *\n * @default \"bottom-start\"\n */\n placement?: AutocompletePositionerElementProps['placement'];\n /**\n * The distance between the popover and the text selection.\n *\n * @default { mainAxis: 8, crossAxis: -4 }\n */\n offset?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['hide'];\n /** @default true */\n inline?: AutocompletePositionerElementProps['inline'];\n /** @default true */\n hoist?: AutocompletePositionerElementProps['hoist'];\n /** @default true */\n fitViewport?: AutocompletePositionerElementProps['fitViewport'];\n /** @default \"The body element\" */\n boundary?: AutocompletePositionerElementProps['boundary'];\n /** @default 8 */\n overflowPadding?: AutocompletePositionerElementProps['overflowPadding'];\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['overlap'];\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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['sameHeight'];\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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['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?: AutocompletePositionerElementProps['altBoundary'];\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-positioner` custom element. */\nexport const AutocompletePositioner: Component<AutocompletePositionerProps & JSX.HTMLAttributes<AutocompletePositionerElement>> = (props): any => {\n registerAutocompletePositionerElement();\n\n const [getElement, setElement] = createSignal<AutocompletePositionerElement | 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-autocomplete-positioner',\n mergeProps(restProps, {\n ref: (el: AutocompletePositionerElement | 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 { registerAutocompleteRootElement, type AutocompleteRootElement, type AutocompleteRootEvents, type AutocompleteRootProps as AutocompleteRootElementProps } from '@prosekit/web/autocomplete';\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 AutocompleteRoot} Solid component. */\nexport interface AutocompleteRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: AutocompleteRootElementProps['editor'];\n /**\n * The regular expression to match the query text to autocomplete.\n *\n * @default null\n */\n regex?: AutocompleteRootElementProps['regex'];\n /**\n * The filter function to determine if an item should be shown in the\n * listbox.\n *\n * @default defaultItemFilter\n */\n filter?: AutocompleteRootElementProps['filter'];\n /**\n * Builds the query string from the regex match found before the cursor. The\n * query is exposed via the `queryChange` event and used by the built-in item\n * filter. The default builder lowercases the match and strips punctuation.\n * Provide a custom builder to control the query, for example to preserve the\n * casing and punctuation the user typed.\n *\n * @default defaultQueryBuilder\n */\n queryBuilder?: AutocompleteRootElementProps['queryBuilder'];\n /**\n * The reference to position the popup against. This can be a DOM element, a\n * Floating UI virtual element, or a function that returns either of them.\n * By default, the popup will be positioned against the text content that\n * triggers the autocomplete.\n *\n * @default null\n */\n anchor?: AutocompleteRootElementProps['anchor'];\n /** Fired when the open state changes. */\n onOpenChange?: (event: AutocompleteRootEvents['openChange']) => void;\n /** Fired when the query changes. */\n onQueryChange?: (event: AutocompleteRootEvents['queryChange']) => void;\n /**\n * Emitted when the selected value changes. Only available when multiple is\n * false.\n */\n onValueChange?: (event: AutocompleteRootEvents['valueChange']) => void;\n /**\n * Emitted when the selected values change. Only available when multiple is\n * true.\n */\n onValuesChange?: (event: AutocompleteRootEvents['valuesChange']) => void;\n}\n\n/** A Solid component that renders an `prosekit-autocomplete-root` custom element. */\nexport const AutocompleteRoot: Component<AutocompleteRootProps & JSX.HTMLAttributes<AutocompleteRootElement>> = (props): any => {\n registerAutocompleteRootElement();\n\n const [getElement, setElement] = createSignal<AutocompleteRootElement | null>(null);\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n const [elementProps, eventHandlers, restProps] = splitProps(props, ['anchor', 'editor', 'filter', 'queryBuilder', 'regex'], ['onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange']);\n\n const p1Fallback = useEditorContext();\n\n createEffect(() => {\n const element = getElement();\n if (!element) return;\n\n Object.assign(element, { anchor: elementProps.anchor, editor: elementProps.editor ?? p1Fallback, filter: elementProps.filter, queryBuilder: elementProps.queryBuilder, regex: elementProps.regex });\n\n handlers.length = 0;\n handlers.push(eventHandlers.onOpenChange);\n handlers.push(eventHandlers.onQueryChange);\n handlers.push(eventHandlers.onValueChange);\n handlers.push(eventHandlers.onValuesChange);\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', 'queryChange', 'valueChange', 'valuesChange'].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-autocomplete-root',\n mergeProps(restProps, {\n ref: (el: AutocompleteRootElement | null) => {\n setElement(el);\n },\n }),\n );\n};\n"],"mappings":";;;;;AAUA,MAAa,qBAAuG,UAAe;CACjI,iCAAiC;CAEjC,MAAM,YAAY;CAElB,aAAa,EAAE,+BAA+B,SAAS;AACzD;;ACYA,MAAa,oBAAoG,UAAe;CAC9H,gCAAgC;CAEhC,MAAM,CAAC,YAAY,cAAc,aAA6C,IAAI;CAClF,MAAM,WAAsD,CAAC;CAE7D,MAAM,CAAC,cAAc,eAAe,aAAa,WAAW,OAAO,CAAC,YAAY,OAAO,GAAG,CAAC,UAAU,CAAC;CAEtG,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,OAAO,OAAO,SAAS;GAAE,UAAU,aAAa;GAAU,OAAO,aAAa;EAAM,CAAC;EAErF,SAAS,SAAS;EAClB,SAAS,KAAK,cAAc,QAAQ;CACtC,CAAC;CAED,mBAAmB;EACjB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,MAAM,KAAK,IAAI,gBAAgB;EAC/B,KAAK,MAAM,CAAC,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC,QAAQ,GAClD,QAAQ,iBACN,YACC,UAAU;GACT,SAAS,MAAM,GAAG,KAAK;EACzB,GACA,EAAE,QAAQ,GAAG,OAAO,CACtB;EAEF,aAAa,GAAG,MAAM;CACxB,CAAC;CAED,aACE,EACE,8BACA,WAAW,WAAW,EACpB,MAAM,OAAuC;EAC3C,WAAW,EAAE;CACf,EACF,CAAC,CACH;AACJ;;AClDA,MAAa,qBAAuG,UAAe;CACjI,iCAAiC;CAEjC,MAAM,CAAC,YAAY,cAAc,aAA8C,IAAI;CACnF,MAAM,WAAsD,CAAC;CAE7D,MAAM,CAAC,eAAe,aAAa,WAAW,OAAO,CAAC,iBAAiB,gBAAgB,CAAC;CAExF,mBAAmB;EAEjB,I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ta.12",
4
+ "version": "0.8.0-beta.14",
5
5
  "private": false,
6
6
  "description": "Solid components and utilities for ProseKit",
7
7
  "author": {
@@ -74,9 +74,9 @@
74
74
  "dependencies": {
75
75
  "@prosemirror-adapter/core": "^0.5.3",
76
76
  "@prosemirror-adapter/solid": "^0.5.3",
77
- "@prosekit/pm": "^0.1.19-beta.0",
78
- "@prosekit/core": "^0.13.0-beta.3",
79
- "@prosekit/web": "^0.9.0-beta.12"
77
+ "@prosekit/core": "^0.13.0-beta.4",
78
+ "@prosekit/pm": "^0.1.19-beta.1",
79
+ "@prosekit/web": "^0.9.0-beta.14"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "solid-js": ">= 1.7.0"
@@ -93,8 +93,8 @@
93
93
  "vite-plugin-solid": "^2.11.12",
94
94
  "vitest": "^4.1.8",
95
95
  "vitest-browser-solid": "^1.0.1",
96
- "@prosekit/config-tsdown": "0.0.0",
97
96
  "@prosekit/config-ts": "0.0.0",
97
+ "@prosekit/config-tsdown": "0.0.0",
98
98
  "@prosekit/config-vitest": "0.0.0",
99
99
  "@prosekit/testing": "0.0.0"
100
100
  },
@@ -102,39 +102,5 @@
102
102
  "build:tsc": "tsc -b tsconfig.json",
103
103
  "build:tsdown": "tsdown"
104
104
  },
105
- "types": "./dist/index.d.ts",
106
- "typesVersions": {
107
- "*": {
108
- ".": [
109
- "./dist/index.d.ts"
110
- ],
111
- "autocomplete": [
112
- "./dist/autocomplete.d.ts"
113
- ],
114
- "block-handle": [
115
- "./dist/block-handle.d.ts"
116
- ],
117
- "drop-indicator": [
118
- "./dist/drop-indicator.d.ts"
119
- ],
120
- "inline-popover": [
121
- "./dist/inline-popover.d.ts"
122
- ],
123
- "menu": [
124
- "./dist/menu.d.ts"
125
- ],
126
- "popover": [
127
- "./dist/popover.d.ts"
128
- ],
129
- "resizable": [
130
- "./dist/resizable.d.ts"
131
- ],
132
- "table-handle": [
133
- "./dist/table-handle.d.ts"
134
- ],
135
- "tooltip": [
136
- "./dist/tooltip.d.ts"
137
- ]
138
- }
139
- }
105
+ "types": "./dist/index.d.ts"
140
106
  }
@@ -29,6 +29,16 @@ export interface AutocompleteRootProps {
29
29
  * @default defaultItemFilter
30
30
  */
31
31
  filter?: AutocompleteRootElementProps['filter'];
32
+ /**
33
+ * Builds the query string from the regex match found before the cursor. The
34
+ * query is exposed via the `queryChange` event and used by the built-in item
35
+ * filter. The default builder lowercases the match and strips punctuation.
36
+ * Provide a custom builder to control the query, for example to preserve the
37
+ * casing and punctuation the user typed.
38
+ *
39
+ * @default defaultQueryBuilder
40
+ */
41
+ queryBuilder?: AutocompleteRootElementProps['queryBuilder'];
32
42
  /**
33
43
  * The reference to position the popup against. This can be a DOM element, a
34
44
  * Floating UI virtual element, or a function that returns either of them.
@@ -61,7 +71,7 @@ export const AutocompleteRoot: Component<AutocompleteRootProps & JSX.HTMLAttribu
61
71
  const [getElement, setElement] = createSignal<AutocompleteRootElement | null>(null);
62
72
  const handlers: Array<((event: any) => void) | undefined> = [];
63
73
 
64
- const [elementProps, eventHandlers, restProps] = splitProps(props, ['anchor', 'editor', 'filter', 'regex'], ['onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange']);
74
+ const [elementProps, eventHandlers, restProps] = splitProps(props, ['anchor', 'editor', 'filter', 'queryBuilder', 'regex'], ['onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange']);
65
75
 
66
76
  const p1Fallback = useEditorContext();
67
77
 
@@ -69,7 +79,7 @@ export const AutocompleteRoot: Component<AutocompleteRootProps & JSX.HTMLAttribu
69
79
  const element = getElement();
70
80
  if (!element) return;
71
81
 
72
- Object.assign(element, { anchor: elementProps.anchor, editor: elementProps.editor ?? p1Fallback, filter: elementProps.filter, regex: elementProps.regex });
82
+ Object.assign(element, { anchor: elementProps.anchor, editor: elementProps.editor ?? p1Fallback, filter: elementProps.filter, queryBuilder: elementProps.queryBuilder, regex: elementProps.regex });
73
83
 
74
84
  handlers.length = 0;
75
85
  handlers.push(eventHandlers.onOpenChange);