@prosekit/vue 0.8.0-beta.13 → 0.8.0-beta.15

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":";;;UAMiB,sBAAA;;cAGJ,iBAAA,EAAmB,sBAAA,CAAuB,sBAAA,GAAyB,cAAA;;UCH/D,qBAAA;EDAsB;;;AAAA;AAGvC;;;ECKE,KAAA,GAAQ,uBAAA;EDLsE;;;;;ECW9E,QAAA,GAAW,uBAAA;EDXmE;ECa9E,QAAA,IAAY,KAAA,EAAO,sBAAA;AAAA;;cAIR,gBAAA,EAAkB,sBAAA,CAAuB,qBAAA,GAAwB,cAAA;;UCpB7D,sBAAA;EFAsB;;;AAAA;EEKrC,aAAA,IAAiB,KAAA,EAAO,uBAAA;EFOzB;;;;EEFC,cAAA,IAAkB,KAAA,EAAO,uBAAuB;AAAA;;cAIrC,iBAAA,EAAmB,sBAAA,CAAuB,sBAAA,GAAyB,cAAA;;UCd/D,2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EAAkB,sBAAA,CAAuB,qBAAA,GAAwB,cAAA"}
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":";;;UAMiB,sBAAA;;cAGJ,iBAAA,EAAmB,sBAAA,CAAuB,sBAAA,GAAyB,cAAA;;UCH/D,qBAAA;EDAsB;;;AAAA;AAGvC;;;ECKE,KAAA,GAAQ,uBAAA;EDLsE;;;;;ECW9E,QAAA,GAAW,uBAAA;EDXmE;ECa9E,QAAA,IAAY,KAAA,EAAO,sBAAA;AAAA;;cAIR,gBAAA,EAAkB,sBAAA,CAAuB,qBAAA,GAAwB,cAAA;;UCpB7D,sBAAA;EFAsB;;;AAAA;EEKrC,aAAA,IAAiB,KAAA,EAAO,uBAAA;EFOzB;;;;EEFC,cAAA,IAAkB,KAAA,EAAO,uBAAuB;AAAA;;cAIrC,iBAAA,EAAmB,sBAAA,CAAuB,sBAAA,GAAyB,cAAA;;UCd/D,2BAAA;EHAsB;;;AAAA;AAGvC;EGGE,SAAA,GAAY,6BAAA;;;;;;EAMZ,MAAA,GAAS,6BAAA;EHTqB;;;;AAA8D;;EGgB5F,IAAA,GAAO,6BAAA;EFnB6B;EEqBpC,MAAA,GAAS,6BAAA;EFbD;EEeR,KAAA,GAAQ,6BAAA;EFPW;EESnB,WAAA,GAAc,6BAAA;EFT2B;EEWzC,QAAA,GAAW,6BAAA;EFnBH;EEqBR,eAAA,GAAkB,6BAAA;EFfP;;;;;EEqBX,QAAA,GAAW,6BAAA;EFfA;;;;;;;EEuBX,UAAA,GAAa,6BAAA;EFvBgB;;;;AAA6D;;ACpB5F;;ECoDE,IAAA,GAAO,6BAAA;ED1CyC;;;;;ECgDhD,KAAA,GAAQ,6BAAA;EDhDU;;AAA8C;AAIlE;;;ECmDE,OAAA,GAAU,6BAAA;EDnDoE;;;;;;EC0D9E,SAAA,GAAY,6BAAA;ED1DgF;AAAA;;ACd9F;;;EA+EE,UAAA,GAAa,6BAAA;EAnEJ;;;;;;EA0ET,YAAA,GAAe,6BAAA;EAnDJ;;;;;;;EA2DX,cAAA,GAAiB,6BAAA;EAAA;;;;;;;EAQjB,WAAA,GAAc,6BAAA;AAAA;;cAIH,sBAAA,EAAwB,sBAAA,CAAuB,2BAAA,GAA8B,cAAA;;UCxGzE,qBAAA;EJFsB;;;AAAA;AAGvC;;EIME,MAAA,GAAS,uBAAA;EJN4C;;;;;EIYrD,KAAA,GAAQ,uBAAA;EJZ6C;;;AAAuC;;ACH9F;EGsBE,MAAA,GAAS,uBAAA;;;;;;;;;;EAUT,YAAA,GAAe,uBAAA;EHhBf;;;;AAAmD;AAIrD;;;EGqBE,MAAA,GAAS,uBAAA;EHrBmE;EGuB5E,YAAA,IAAgB,KAAA,EAAO,sBAAA;EHvB4B;EGyBnD,aAAA,IAAiB,KAAA,EAAO,sBAAA;EHzBK;;;;EG8B7B,aAAA,IAAiB,KAAA,EAAO,sBAAA;;AFlD1B;;;EEuDE,cAAA,IAAkB,KAAA,EAAO,sBAAA;AAAA;;cAId,gBAAA,EAAkB,sBAAA,CAAuB,qBAAA,GAAwB,cAAA"}
@@ -171,12 +171,13 @@ const AutocompleteRoot = /* @__PURE__ */ defineComponent((props, { slots }) => {
171
171
  const elementRef = shallowRef(null);
172
172
  const p1Fallback = useEditorContext();
173
173
  const splittedProps = computed(() => {
174
- const { anchor: p0, editor: p1, filter: p2, regex: p3, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;
174
+ const { anchor: p0, editor: p1, filter: p2, queryBuilder: p3, regex: p4, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;
175
175
  return [[
176
176
  p0,
177
177
  p1,
178
178
  p2,
179
179
  p3,
180
+ p4,
180
181
  e0,
181
182
  e1,
182
183
  e2,
@@ -187,12 +188,13 @@ const AutocompleteRoot = /* @__PURE__ */ defineComponent((props, { slots }) => {
187
188
  watchEffect(() => {
188
189
  const element = elementRef.value;
189
190
  if (!element) return;
190
- const [p0, p1, p2, p3, e0, e1, e2, e3] = splittedProps.value[0];
191
+ const [p0, p1, p2, p3, p4, e0, e1, e2, e3] = splittedProps.value[0];
191
192
  Object.assign(element, {
192
193
  anchor: p0,
193
194
  editor: p1 ?? p1Fallback,
194
195
  filter: p2,
195
- regex: p3
196
+ queryBuilder: p3,
197
+ regex: p4
196
198
  });
197
199
  handlers.length = 0;
198
200
  handlers.push(e0);
@@ -225,6 +227,7 @@ const AutocompleteRoot = /* @__PURE__ */ defineComponent((props, { slots }) => {
225
227
  "anchor",
226
228
  "editor",
227
229
  "filter",
230
+ "queryBuilder",
228
231
  "regex",
229
232
  "onOpenChange",
230
233
  "onQueryChange",
@@ -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 } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes } from 'vue';\n\n/** Props for the {@link AutocompleteEmpty} Vue component. */\nexport interface AutocompleteEmptyProps {}\n\n/** A Vue component that renders an `prosekit-autocomplete-empty` custom element. */\nexport const AutocompleteEmpty: DefineSetupFnComponent<AutocompleteEmptyProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteEmptyProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompleteEmptyElement();\n\n return () => {\n return h('prosekit-autocomplete-empty', props, slots.default?.());\n };\n },\n { props: [] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteItemElement, type AutocompleteItemEvents, type AutocompleteItemProps as AutocompleteItemElementProps } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\n/** Props for the {@link AutocompleteItem} Vue 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 Vue component that renders an `prosekit-autocomplete-item` custom element. */\nexport const AutocompleteItem: DefineSetupFnComponent<AutocompleteItemProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteItemProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompleteItemElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const splittedProps = computed(() => {\n const { disabled: p0, value: p1, onSelect: e0, ...restProps } = props;\n return [[p0, p1, e0], restProps] as const;\n });\n\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [p0, p1, e0] = splittedProps.value[0];\n\n Object.assign(element, { disabled: p0, value: p1 });\n\n handlers.length = 0;\n handlers.push(e0);\n });\n\n watchEffect(() => {\n const element = elementRef.value;\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: Event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-item', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['disabled', 'value', 'onSelect'] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompletePopupElement, type AutocompletePopupEvents } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\n/** Props for the {@link AutocompletePopup} Vue 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 Vue component that renders an `prosekit-autocomplete-popup` custom element. */\nexport const AutocompletePopup: DefineSetupFnComponent<AutocompletePopupProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompletePopupProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompletePopupElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const splittedProps = computed(() => {\n const { onValueChange: e0, onValuesChange: e1, ...restProps } = props;\n return [[e0, e1], restProps] as const;\n });\n\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [e0, e1] = splittedProps.value[0];\n\n handlers.length = 0;\n handlers.push(e0);\n handlers.push(e1);\n });\n\n watchEffect(() => {\n const element = elementRef.value;\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: Event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-popup', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['onValueChange', 'onValuesChange'] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\n/** Props for the {@link AutocompletePositioner} Vue 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 Vue component that renders an `prosekit-autocomplete-positioner` custom element. */\nexport const AutocompletePositioner: DefineSetupFnComponent<AutocompletePositionerProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompletePositionerProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompletePositionerElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const splittedProps = computed(() => {\n const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props;\n return [[p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17], restProps] as const;\n });\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17] = splittedProps.value[0];\n\n Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17 });\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-positioner', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['altBoundary', 'autoUpdate', 'boundary', 'elementContext', 'fitViewport', 'flip', 'hide', 'hoist', 'inline', 'offset', 'overflowPadding', 'overlap', 'placement', 'rootBoundary', 'sameHeight', 'sameWidth', 'shift', 'strategy'] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteRootElement, type AutocompleteRootEvents, type AutocompleteRootProps as AutocompleteRootElementProps } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\nimport { useEditorContext } from '../../injection/editor-context.ts';\n\n/** Props for the {@link AutocompleteRoot} Vue 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 Vue component that renders an `prosekit-autocomplete-root` custom element. */\nexport const AutocompleteRoot: DefineSetupFnComponent<AutocompleteRootProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteRootProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompleteRootElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const p1Fallback = useEditorContext();\n\n const splittedProps = computed(() => {\n const { anchor: p0, editor: p1, filter: p2, regex: p3, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;\n return [[p0, p1, p2, p3, e0, e1, e2, e3], restProps] as const;\n });\n\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [p0, p1, p2, p3, e0, e1, e2, e3] = splittedProps.value[0];\n\n Object.assign(element, { anchor: p0, editor: p1 ?? p1Fallback, filter: p2, regex: p3 });\n\n handlers.length = 0;\n handlers.push(e0);\n handlers.push(e1);\n handlers.push(e2);\n handlers.push(e3);\n });\n\n watchEffect(() => {\n const element = elementRef.value;\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: Event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-root', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['anchor', 'editor', 'filter', 'regex', 'onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange'] },\n);\n"],"mappings":";;;;AASA,MAAa,oBAAqG,iCAC/G,OAAO,EAAE,YAAY;CACpB,iCAAiC;CAEjC,aAAa;EACX,OAAO,EAAE,+BAA+B,OAAO,MAAM,UAAU,CAAC;CAClE;AACF,GACA,EAAE,OAAO,CAAC,EAAE,CACd;;ACQA,MAAa,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AI,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,cAAc,MAAM;EAE7D,OAAO,OAAO,SAAS;GAAE,QAAQ;GAAI,QAAQ,MAAM;GAAY,QAAQ;GAAI,OAAO;EAAG,CAAC;EAEtF,SAAS,SAAS;EAClB,SAAS,KAAK,EAAE;EAChB,SAAS,KAAK,EAAE;EAChB,SAAS,KAAK,EAAE;EAChB,SAAS,KAAK,EAAE;CAClB,CAAC;CAED,kBAAkB;EAChB,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,UAAiB;GAChB,SAAS,MAAM,GAAG,KAAK;EACzB,GACA,EAAE,QAAQ,GAAG,OAAO,CACtB;EAEF,aAAa,GAAG,MAAM;CACxB,CAAC;CAED,aAAa;EACX,MAAM,YAAY,cAAc,MAAM;EACtC,OAAO,EAAE,8BAA8B;GAAE,GAAG;GAAW,KAAK;EAAW,GAAG,MAAM,UAAU,CAAC;CAC7F;AACF,GACA,EAAE,OAAO;CAAC;CAAU;CAAU;CAAU;CAAS;CAAgB;CAAiB;CAAiB;AAAgB,EAAE,CACvH"}
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 } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes } from 'vue';\n\n/** Props for the {@link AutocompleteEmpty} Vue component. */\nexport interface AutocompleteEmptyProps {}\n\n/** A Vue component that renders an `prosekit-autocomplete-empty` custom element. */\nexport const AutocompleteEmpty: DefineSetupFnComponent<AutocompleteEmptyProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteEmptyProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompleteEmptyElement();\n\n return () => {\n return h('prosekit-autocomplete-empty', props, slots.default?.());\n };\n },\n { props: [] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteItemElement, type AutocompleteItemEvents, type AutocompleteItemProps as AutocompleteItemElementProps } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\n/** Props for the {@link AutocompleteItem} Vue 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 Vue component that renders an `prosekit-autocomplete-item` custom element. */\nexport const AutocompleteItem: DefineSetupFnComponent<AutocompleteItemProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteItemProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompleteItemElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const splittedProps = computed(() => {\n const { disabled: p0, value: p1, onSelect: e0, ...restProps } = props;\n return [[p0, p1, e0], restProps] as const;\n });\n\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [p0, p1, e0] = splittedProps.value[0];\n\n Object.assign(element, { disabled: p0, value: p1 });\n\n handlers.length = 0;\n handlers.push(e0);\n });\n\n watchEffect(() => {\n const element = elementRef.value;\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: Event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-item', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['disabled', 'value', 'onSelect'] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompletePopupElement, type AutocompletePopupEvents } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\n/** Props for the {@link AutocompletePopup} Vue 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 Vue component that renders an `prosekit-autocomplete-popup` custom element. */\nexport const AutocompletePopup: DefineSetupFnComponent<AutocompletePopupProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompletePopupProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompletePopupElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const splittedProps = computed(() => {\n const { onValueChange: e0, onValuesChange: e1, ...restProps } = props;\n return [[e0, e1], restProps] as const;\n });\n\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [e0, e1] = splittedProps.value[0];\n\n handlers.length = 0;\n handlers.push(e0);\n handlers.push(e1);\n });\n\n watchEffect(() => {\n const element = elementRef.value;\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: Event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-popup', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['onValueChange', 'onValuesChange'] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\n/** Props for the {@link AutocompletePositioner} Vue 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 Vue component that renders an `prosekit-autocomplete-positioner` custom element. */\nexport const AutocompletePositioner: DefineSetupFnComponent<AutocompletePositionerProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompletePositionerProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompletePositionerElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const splittedProps = computed(() => {\n const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props;\n return [[p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17], restProps] as const;\n });\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17] = splittedProps.value[0];\n\n Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17 });\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-positioner', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['altBoundary', 'autoUpdate', 'boundary', 'elementContext', 'fitViewport', 'flip', 'hide', 'hoist', 'inline', 'offset', 'overflowPadding', 'overlap', 'placement', 'rootBoundary', 'sameHeight', 'sameWidth', 'shift', 'strategy'] },\n);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerAutocompleteRootElement, type AutocompleteRootEvents, type AutocompleteRootProps as AutocompleteRootElementProps } from '@prosekit/web/autocomplete';\nimport { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';\n\nimport { useEditorContext } from '../../injection/editor-context.ts';\n\n/** Props for the {@link AutocompleteRoot} Vue 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 Vue component that renders an `prosekit-autocomplete-root` custom element. */\nexport const AutocompleteRoot: DefineSetupFnComponent<AutocompleteRootProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteRootProps & HTMLAttributes>(\n (props, { slots }) => {\n registerAutocompleteRootElement();\n\n const elementRef = shallowRef<HTMLElement | null>(null);\n\n const p1Fallback = useEditorContext();\n\n const splittedProps = computed(() => {\n const { anchor: p0, editor: p1, filter: p2, queryBuilder: p3, regex: p4, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;\n return [[p0, p1, p2, p3, p4, e0, e1, e2, e3], restProps] as const;\n });\n\n const handlers: Array<((event: any) => void) | undefined> = [];\n\n watchEffect(() => {\n const element = elementRef.value;\n if (!element) return;\n\n const [p0, p1, p2, p3, p4, e0, e1, e2, e3] = splittedProps.value[0];\n\n Object.assign(element, { anchor: p0, editor: p1 ?? p1Fallback, filter: p2, queryBuilder: p3, regex: p4 });\n\n handlers.length = 0;\n handlers.push(e0);\n handlers.push(e1);\n handlers.push(e2);\n handlers.push(e3);\n });\n\n watchEffect(() => {\n const element = elementRef.value;\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: Event) => {\n handlers[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n });\n\n return () => {\n const restProps = splittedProps.value[1];\n return h('prosekit-autocomplete-root', { ...restProps, ref: elementRef }, slots.default?.());\n };\n },\n { props: ['anchor', 'editor', 'filter', 'queryBuilder', 'regex', 'onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange'] },\n);\n"],"mappings":";;;;AASA,MAAa,oBAAqG,iCAC/G,OAAO,EAAE,YAAY;CACpB,iCAAiC;CAEjC,aAAa;EACX,OAAO,EAAE,+BAA+B,OAAO,MAAM,UAAU,CAAC;CAClE;AACF,GACA,EAAE,OAAO,CAAC,EAAE,CACd;;ACQA,MAAa,mBAAmG,iCAC7G,OAAO,EAAE,YAAY;CACpB,gCAAgC;CAEhC,MAAM,aAAa,WAA+B,IAAI;CAEtD,MAAM,gBAAgB,eAAe;EACnC,MAAM,EAAE,UAAU,IAAI,OAAO,IAAI,UAAU,IAAI,GAAG,cAAc;EAChE,OAAO,CAAC;GAAC;GAAI;GAAI;EAAE,GAAG,SAAS;CACjC,CAAC;CAED,MAAM,WAAsD,CAAC;CAE7D,kBAAkB;EAChB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EAEd,MAAM,CAAC,IAAI,IAAI,MAAM,cAAc,MAAM;EAEzC,OAAO,OAAO,SAAS;GAAE,UAAU;GAAI,OAAO;EAAG,CAAC;EAElD,SAAS,SAAS;EAClB,SAAS,KAAK,EAAE;CAClB,CAAC;CAED,kBAAkB;EAChB,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,UAAiB;GAChB,SAAS,MAAM,GAAG,KAAK;EACzB,GACA,EAAE,QAAQ,GAAG,OAAO,CACtB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GACA,EAAE,OAAO;CAAC;CAAU;CAAU;CAAU;CAAgB;CAAS;CAAgB;CAAiB;CAAiB;AAAgB,EAAE,CACvI"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/vue",
3
3
  "type": "module",
4
- "version": "0.8.0-beta.13",
4
+ "version": "0.8.0-beta.15",
5
5
  "private": false,
6
6
  "description": "Vue components and utilities for ProseKit",
7
7
  "author": {
@@ -76,7 +76,7 @@
76
76
  "@prosemirror-adapter/vue": "^0.5.3",
77
77
  "@prosekit/core": "^0.13.0-beta.4",
78
78
  "@prosekit/pm": "^0.1.19-beta.1",
79
- "@prosekit/web": "^0.9.0-beta.13"
79
+ "@prosekit/web": "^0.9.0-beta.15"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "vue": ">= 3.0.0"
@@ -94,10 +94,10 @@
94
94
  "vitest": "^4.1.8",
95
95
  "vitest-browser-vue": "^2.1.0",
96
96
  "vue": "^3.5.35",
97
- "@prosekit/config-tsdown": "0.0.0",
98
- "@prosekit/config-vitest": "0.0.0",
99
97
  "@prosekit/config-ts": "0.0.0",
100
- "@prosekit/testing": "0.0.0"
98
+ "@prosekit/config-tsdown": "0.0.0",
99
+ "@prosekit/testing": "0.0.0",
100
+ "@prosekit/config-vitest": "0.0.0"
101
101
  },
102
102
  "scripts": {
103
103
  "build:tsc": "tsc -b tsconfig.json",
@@ -27,6 +27,16 @@ export interface AutocompleteRootProps {
27
27
  * @default defaultItemFilter
28
28
  */
29
29
  filter?: AutocompleteRootElementProps['filter'];
30
+ /**
31
+ * Builds the query string from the regex match found before the cursor. The
32
+ * query is exposed via the `queryChange` event and used by the built-in item
33
+ * filter. The default builder lowercases the match and strips punctuation.
34
+ * Provide a custom builder to control the query, for example to preserve the
35
+ * casing and punctuation the user typed.
36
+ *
37
+ * @default defaultQueryBuilder
38
+ */
39
+ queryBuilder?: AutocompleteRootElementProps['queryBuilder'];
30
40
  /**
31
41
  * The reference to position the popup against. This can be a DOM element, a
32
42
  * Floating UI virtual element, or a function that returns either of them.
@@ -62,8 +72,8 @@ export const AutocompleteRoot: DefineSetupFnComponent<AutocompleteRootProps & HT
62
72
  const p1Fallback = useEditorContext();
63
73
 
64
74
  const splittedProps = computed(() => {
65
- const { anchor: p0, editor: p1, filter: p2, regex: p3, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;
66
- return [[p0, p1, p2, p3, e0, e1, e2, e3], restProps] as const;
75
+ const { anchor: p0, editor: p1, filter: p2, queryBuilder: p3, regex: p4, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;
76
+ return [[p0, p1, p2, p3, p4, e0, e1, e2, e3], restProps] as const;
67
77
  });
68
78
 
69
79
  const handlers: Array<((event: any) => void) | undefined> = [];
@@ -72,9 +82,9 @@ export const AutocompleteRoot: DefineSetupFnComponent<AutocompleteRootProps & HT
72
82
  const element = elementRef.value;
73
83
  if (!element) return;
74
84
 
75
- const [p0, p1, p2, p3, e0, e1, e2, e3] = splittedProps.value[0];
85
+ const [p0, p1, p2, p3, p4, e0, e1, e2, e3] = splittedProps.value[0];
76
86
 
77
- Object.assign(element, { anchor: p0, editor: p1 ?? p1Fallback, filter: p2, regex: p3 });
87
+ Object.assign(element, { anchor: p0, editor: p1 ?? p1Fallback, filter: p2, queryBuilder: p3, regex: p4 });
78
88
 
79
89
  handlers.length = 0;
80
90
  handlers.push(e0);
@@ -105,5 +115,5 @@ export const AutocompleteRoot: DefineSetupFnComponent<AutocompleteRootProps & HT
105
115
  return h('prosekit-autocomplete-root', { ...restProps, ref: elementRef }, slots.default?.());
106
116
  };
107
117
  },
108
- { props: ['anchor', 'editor', 'filter', 'regex', 'onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange'] },
118
+ { props: ['anchor', 'editor', 'filter', 'queryBuilder', 'regex', 'onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange'] },
109
119
  );