@prosekit/solid 0.5.2 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{create-component-x4Duyu8z.js → create-component-DOv1yHjo.js} +3 -3
  2. package/dist/{create-component-x4Duyu8z.js.map → create-component-DOv1yHjo.js.map} +1 -1
  3. package/dist/{create-props-BwXSSFVp.d.ts → create-props-IUcX0Ggy.d.ts} +2 -2
  4. package/dist/create-props-IUcX0Ggy.d.ts.map +1 -0
  5. package/dist/{editor-context-DIj_hnDx.js → editor-context-B5bsBkGo.js} +2 -2
  6. package/dist/{editor-context-DIj_hnDx.js.map → editor-context-B5bsBkGo.js.map} +1 -1
  7. package/dist/prosekit-solid-autocomplete.d.ts +2 -2
  8. package/dist/prosekit-solid-autocomplete.d.ts.map +1 -1
  9. package/dist/prosekit-solid-autocomplete.js +2 -2
  10. package/dist/prosekit-solid-block-handle.d.ts +2 -2
  11. package/dist/prosekit-solid-block-handle.d.ts.map +1 -1
  12. package/dist/prosekit-solid-block-handle.js +2 -2
  13. package/dist/prosekit-solid-drop-indicator.d.ts +2 -2
  14. package/dist/prosekit-solid-drop-indicator.d.ts.map +1 -1
  15. package/dist/prosekit-solid-drop-indicator.js +2 -2
  16. package/dist/prosekit-solid-inline-popover.d.ts +2 -2
  17. package/dist/prosekit-solid-inline-popover.d.ts.map +1 -1
  18. package/dist/prosekit-solid-inline-popover.js +2 -2
  19. package/dist/prosekit-solid-popover.d.ts +2 -2
  20. package/dist/prosekit-solid-popover.d.ts.map +1 -1
  21. package/dist/prosekit-solid-popover.js +2 -2
  22. package/dist/prosekit-solid-resizable.d.ts +2 -2
  23. package/dist/prosekit-solid-resizable.d.ts.map +1 -1
  24. package/dist/prosekit-solid-resizable.js +2 -2
  25. package/dist/prosekit-solid-table-handle.d.ts +2 -2
  26. package/dist/prosekit-solid-table-handle.d.ts.map +1 -1
  27. package/dist/prosekit-solid-table-handle.js +2 -2
  28. package/dist/prosekit-solid-tooltip.d.ts +2 -2
  29. package/dist/prosekit-solid-tooltip.d.ts.map +1 -1
  30. package/dist/prosekit-solid-tooltip.js +2 -2
  31. package/dist/prosekit-solid.d.ts +32 -3
  32. package/dist/prosekit-solid.d.ts.map +1 -1
  33. package/dist/prosekit-solid.js +32 -16
  34. package/dist/prosekit-solid.js.map +1 -1
  35. package/dist/{types-CoG9Vl2B.d.ts → types-VT1O6Xnr.d.ts} +2 -2
  36. package/dist/types-VT1O6Xnr.d.ts.map +1 -0
  37. package/package.json +9 -9
  38. package/src/hooks/use-editor-derived-value.ts +51 -0
  39. package/src/hooks/use-extension.ts +1 -1
  40. package/src/index.ts +4 -0
  41. package/dist/create-props-BwXSSFVp.d.ts.map +0 -1
  42. package/dist/types-CoG9Vl2B.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { useEditorContext } from "./editor-context-DIj_hnDx.js";
1
+ import { n as useEditorContext } from "./editor-context-B5bsBkGo.js";
2
2
  import h from "solid-js/h";
3
3
 
4
4
  //#region src/components/create-component.ts
@@ -38,5 +38,5 @@ function createComponent(tagName, propNames, eventNames) {
38
38
  }
39
39
 
40
40
  //#endregion
41
- export { createComponent };
42
- //# sourceMappingURL=create-component-x4Duyu8z.js.map
41
+ export { createComponent as t };
42
+ //# sourceMappingURL=create-component-DOv1yHjo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-component-x4Duyu8z.js","names":["properties: Record<string, () => unknown>","eventHandlers: Record<string, AnyFunction>"],"sources":["../src/components/create-component.ts"],"sourcesContent":["import type { AnyFunction } from '@prosekit/core'\nimport type { Component } from 'solid-js'\nimport h from 'solid-js/h'\n\nimport { useEditorContext } from '../contexts/editor-context'\nimport type { PropsWithElement } from '../types'\n\nexport function createComponent<\n Props extends object,\n CustomElement extends HTMLElement,\n>(\n tagName: string,\n propNames: string[],\n eventNames: string[],\n): Component<PropsWithElement<Props, CustomElement>> {\n const hasEditor = propNames.includes('editor')\n const lowerCaseEventNameMap = new Map(\n eventNames.map((name) => [name.toLowerCase(), name]),\n )\n\n const Component = (props: Record<string, unknown>) => {\n const properties: Record<string, () => unknown> = {}\n const eventHandlers: Record<string, AnyFunction> = {}\n\n for (const name of Object.keys(props)) {\n if (propNames.includes(name)) {\n properties['prop:' + name] = () => props[name]\n continue\n }\n\n if (name.startsWith('on')) {\n const lowerCaseEventName = name.slice(2).toLowerCase()\n const eventName = lowerCaseEventNameMap.get(lowerCaseEventName)\n if (eventName) {\n const extractDetail = eventName.endsWith('Change')\n eventHandlers['on:' + eventName] = (event: Event) => {\n const handler = props[name] as AnyFunction | null\n if (typeof handler === 'function') {\n handler(extractDetail ? (event as CustomEvent).detail : event)\n }\n }\n continue\n }\n }\n\n properties[name] = () => props[name]\n }\n\n const editor = useEditorContext()\n\n if (hasEditor && editor) {\n properties['prop:editor'] = () => props['editor'] || editor\n }\n\n return h(tagName, { ...properties, ...eventHandlers })\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return Component as any\n}\n"],"mappings":";;;;AAOA,SAAgB,gBAId,SACA,WACA,YACmD;CACnD,MAAM,YAAY,UAAU,SAAS,SAAS;CAC9C,MAAM,wBAAwB,IAAI,IAChC,WAAW,KAAK,SAAS,CAAC,KAAK,aAAa,EAAE,KAAK,CAAC,CACrD;CAED,MAAM,aAAa,UAAmC;EACpD,MAAMA,aAA4C,EAAE;EACpD,MAAMC,gBAA6C,EAAE;AAErD,OAAK,MAAM,QAAQ,OAAO,KAAK,MAAM,EAAE;AACrC,OAAI,UAAU,SAAS,KAAK,EAAE;AAC5B,eAAW,UAAU,cAAc,MAAM;AACzC;;AAGF,OAAI,KAAK,WAAW,KAAK,EAAE;IACzB,MAAM,qBAAqB,KAAK,MAAM,EAAE,CAAC,aAAa;IACtD,MAAM,YAAY,sBAAsB,IAAI,mBAAmB;AAC/D,QAAI,WAAW;KACb,MAAM,gBAAgB,UAAU,SAAS,SAAS;AAClD,mBAAc,QAAQ,cAAc,UAAiB;MACnD,MAAM,UAAU,MAAM;AACtB,UAAI,OAAO,YAAY,WACrB,SAAQ,gBAAiB,MAAsB,SAAS,MAAM;;AAGlE;;;AAIJ,cAAW,cAAc,MAAM;;EAGjC,MAAM,SAAS,kBAAkB;AAEjC,MAAI,aAAa,OACf,YAAW,uBAAuB,MAAM,aAAa;AAGvD,SAAO,EAAE,SAAS;GAAE,GAAG;GAAY,GAAG;GAAe,CAAC;;AAIxD,QAAO"}
1
+ {"version":3,"file":"create-component-DOv1yHjo.js","names":["properties: Record<string, () => unknown>","eventHandlers: Record<string, AnyFunction>"],"sources":["../src/components/create-component.ts"],"sourcesContent":["import type { AnyFunction } from '@prosekit/core'\nimport type { Component } from 'solid-js'\nimport h from 'solid-js/h'\n\nimport { useEditorContext } from '../contexts/editor-context'\nimport type { PropsWithElement } from '../types'\n\nexport function createComponent<\n Props extends object,\n CustomElement extends HTMLElement,\n>(\n tagName: string,\n propNames: string[],\n eventNames: string[],\n): Component<PropsWithElement<Props, CustomElement>> {\n const hasEditor = propNames.includes('editor')\n const lowerCaseEventNameMap = new Map(\n eventNames.map((name) => [name.toLowerCase(), name]),\n )\n\n const Component = (props: Record<string, unknown>) => {\n const properties: Record<string, () => unknown> = {}\n const eventHandlers: Record<string, AnyFunction> = {}\n\n for (const name of Object.keys(props)) {\n if (propNames.includes(name)) {\n properties['prop:' + name] = () => props[name]\n continue\n }\n\n if (name.startsWith('on')) {\n const lowerCaseEventName = name.slice(2).toLowerCase()\n const eventName = lowerCaseEventNameMap.get(lowerCaseEventName)\n if (eventName) {\n const extractDetail = eventName.endsWith('Change')\n eventHandlers['on:' + eventName] = (event: Event) => {\n const handler = props[name] as AnyFunction | null\n if (typeof handler === 'function') {\n handler(extractDetail ? (event as CustomEvent).detail : event)\n }\n }\n continue\n }\n }\n\n properties[name] = () => props[name]\n }\n\n const editor = useEditorContext()\n\n if (hasEditor && editor) {\n properties['prop:editor'] = () => props['editor'] || editor\n }\n\n return h(tagName, { ...properties, ...eventHandlers })\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return Component as any\n}\n"],"mappings":";;;;AAOA,SAAgB,gBAId,SACA,WACA,YACmD;CACnD,MAAM,YAAY,UAAU,SAAS,SAAS;CAC9C,MAAM,wBAAwB,IAAI,IAChC,WAAW,KAAK,SAAS,CAAC,KAAK,aAAa,EAAE,KAAK,CAAC,CACrD;CAED,MAAM,aAAa,UAAmC;EACpD,MAAMA,aAA4C,EAAE;EACpD,MAAMC,gBAA6C,EAAE;AAErD,OAAK,MAAM,QAAQ,OAAO,KAAK,MAAM,EAAE;AACrC,OAAI,UAAU,SAAS,KAAK,EAAE;AAC5B,eAAW,UAAU,cAAc,MAAM;AACzC;;AAGF,OAAI,KAAK,WAAW,KAAK,EAAE;IACzB,MAAM,qBAAqB,KAAK,MAAM,EAAE,CAAC,aAAa;IACtD,MAAM,YAAY,sBAAsB,IAAI,mBAAmB;AAC/D,QAAI,WAAW;KACb,MAAM,gBAAgB,UAAU,SAAS,SAAS;AAClD,mBAAc,QAAQ,cAAc,UAAiB;MACnD,MAAM,UAAU,MAAM;AACtB,UAAI,OAAO,YAAY,WACrB,SAAQ,gBAAiB,MAAsB,SAAS,MAAM;;AAGlE;;;AAIJ,cAAW,cAAc,MAAM;;EAGjC,MAAM,SAAS,kBAAkB;AAEjC,MAAI,aAAa,OACf,YAAW,uBAAuB,MAAM,aAAa;AAGvD,SAAO,EAAE,SAAS;GAAE,GAAG;GAAY,GAAG;GAAe,CAAC;;AAIxD,QAAO"}
@@ -2,5 +2,5 @@
2
2
  type CreateProps<Props extends { [PropName in keyof Props]: unknown }, Events extends { [EventName in keyof Events]: CustomEvent }> = Props & CreateEventProps<Events>;
3
3
  type CreateEventProps<Events extends { [EventName in keyof Events]: CustomEvent }> = { [EventName in keyof Events as `on${Capitalize<string & EventName>}`]: (event: EventName extends `${string}Change` ? Events[EventName]['detail'] : Events[EventName]) => void };
4
4
  //#endregion
5
- export { CreateProps };
6
- //# sourceMappingURL=create-props-BwXSSFVp.d.ts.map
5
+ export { CreateProps as t };
6
+ //# sourceMappingURL=create-props-IUcX0Ggy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-props-IUcX0Ggy.d.ts","names":[],"sources":["../src/components/create-props.ts"],"sourcesContent":[],"mappings":";KAAY,yCAAA,MACyB,KADd,GAAA,OAAA,EACc,EAAA,eAAA,gBACE,MAAA,MAAA,GAAS,WAAT,EAAS,CAAA,GAC5C,KAD4C,GACpC,gBADoC,CACnB,MADmB,CAAA;KAG3C,gBAFD,CAAA,eAAA,gBAAyB,MAGU,MAHV,GAGmB,WAHnB,EAAjB,CAAA,GAAA,gBAAgB,MAKN,MALM,IAAA,KAKS,UALT,CAAA,MAAA,GAK6B,SAL7B,CAAA,EAAA,GAAA,CAAA,KAAA,EAMjB,SANiB,SAAA,GAAA,MAAA,QAAA,GAMqB,MANrB,CAM4B,SAN5B,CAAA,CAAA,QAAA,CAAA,GAOpB,MAPoB,CAOb,SAPa,CAAA,EAAA,GAAA,IAAA,EAAQ"}
@@ -14,5 +14,5 @@ function useEditorContext() {
14
14
  const EditorContextProvider = editorContext.Provider;
15
15
 
16
16
  //#endregion
17
- export { EditorContextProvider, useEditorContext };
18
- //# sourceMappingURL=editor-context-DIj_hnDx.js.map
17
+ export { useEditorContext as n, EditorContextProvider as t };
18
+ //# sourceMappingURL=editor-context-B5bsBkGo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-context-DIj_hnDx.js","names":["EditorContextProvider: ContextProviderComponent<Editor | null>"],"sources":["../src/contexts/editor-context.ts"],"sourcesContent":["import type {\n Editor,\n Extension,\n} from '@prosekit/core'\nimport {\n createContext,\n useContext,\n type ContextProviderComponent,\n} from 'solid-js'\n\nconst editorContext = createContext<Editor | null>(null)\n\n/**\n * @internal\n */\nexport function useEditorContext<E extends Extension>(): Editor<E> | null {\n return useContext(editorContext)\n}\n\n/**\n * @internal\n */\nexport const EditorContextProvider: ContextProviderComponent<Editor | null> = editorContext.Provider\n"],"mappings":";;;AAUA,MAAM,gBAAgB,cAA6B,KAAK;;;;AAKxD,SAAgB,mBAA0D;AACxE,QAAO,WAAW,cAAc;;;;;AAMlC,MAAaA,wBAAiE,cAAc"}
1
+ {"version":3,"file":"editor-context-B5bsBkGo.js","names":["EditorContextProvider: ContextProviderComponent<Editor | null>"],"sources":["../src/contexts/editor-context.ts"],"sourcesContent":["import type {\n Editor,\n Extension,\n} from '@prosekit/core'\nimport {\n createContext,\n useContext,\n type ContextProviderComponent,\n} from 'solid-js'\n\nconst editorContext = createContext<Editor | null>(null)\n\n/**\n * @internal\n */\nexport function useEditorContext<E extends Extension>(): Editor<E> | null {\n return useContext(editorContext)\n}\n\n/**\n * @internal\n */\nexport const EditorContextProvider: ContextProviderComponent<Editor | null> = editorContext.Provider\n"],"mappings":";;;AAUA,MAAM,gBAAgB,cAA6B,KAAK;;;;AAKxD,SAAgB,mBAA0D;AACxE,QAAO,WAAW,cAAc;;;;;AAMlC,MAAaA,wBAAiE,cAAc"}
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { AutocompleteEmptyElement, AutocompleteEmptyEvents, AutocompleteEmptyProps as AutocompleteEmptyProps$1, AutocompleteItemElement, AutocompleteItemEvents, AutocompleteItemProps as AutocompleteItemProps$1, AutocompleteListElement, AutocompleteListEvents, AutocompleteListProps as AutocompleteListProps$1, AutocompletePopoverElement, AutocompletePopoverEvents, AutocompletePopoverProps as AutocompletePopoverProps$1 } from "@prosekit/web/autocomplete";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-list.gen.ts","../src/components/autocomplete/autocomplete-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAwC,UAAvB,sBAAA,SAA+B,OAAR,CAAgB,WAAhB,CAA4B,wBAA5B,EAAmC,uBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE9D,iBAF8D,EAE3C,SAF2C,CAEjC,gBAFiC,CAGzE,sBAHyE,EAIzE,wBAJyE,CAAA,CAAA;;;;;AAA3E;AAAwC,UCAvB,qBAAA,SAA8B,ODAP,CCAe,WDAf,CCA2B,uBDA3B,ECAkC,sBDAlC,CAAA,CAAA,CAAA;AAAmC,cCE9D,gBDF8D,ECE5C,SDF4C,CCElC,gBDFkC,CCGzE,qBDHyE,ECIzE,uBDJyE,CAAA,CAAA;;;;;AAA3E;AAAwC,UEAvB,qBAAA,SAA8B,OFAP,CEAe,WFAf,CEA2B,uBFA3B,EEAkC,sBFAlC,CAAA,CAAA,CAAA;AAAmC,cEE9D,gBFF8D,EEE5C,SFF4C,CEElC,gBFFkC,CEGzE,qBFHyE,EEIzE,uBFJyE,CAAA,CAAA;;;;;AAA3E;AAAwC,UGAvB,wBAAA,SAAiC,OHAV,CGAkB,WHAlB,CGA8B,0BHA9B,EGAqC,yBHArC,CAAA,CAAA,CAAA;AAAmC,cGE9D,mBHF8D,EGEzC,SHFyC,CGE/B,gBHF+B,CGGzE,wBHHyE,EGIzE,0BHJyE,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-list.gen.ts","../src/components/autocomplete/autocomplete-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAoE,UAAnD,sBAAA,SAA+B,OAAoB,CAAZ,WAAY,CAAA,wBAAA,EAAO,uBAAP,CAAA,CAAA,CAAA;AAAZ,cAE3C,iBAF2C,EAExB,SAFwB,CAEd,gBAFc,CAGtD,sBAHsD,EAItD,wBAJsD,CAAA,CAAA;;;;;AAAxD;AAAoE,UCAnD,qBAAA,SAA8B,ODAqB,CCAb,WDAa,CCAD,uBDAC,ECAM,sBDAN,CAAA,CAAA,CAAA;AAAZ,cCE3C,gBDF2C,ECEzB,SDFyB,CCEf,gBDFe,CCGtD,qBDHsD,ECItD,uBDJsD,CAAA,CAAA;;;;;AAAxD;AAAoE,UEAnD,qBAAA,SAA8B,OFAqB,CEAb,WFAa,CEAD,uBFAC,EEAM,sBFAN,CAAA,CAAA,CAAA;AAAZ,cEE3C,gBFF2C,EEEzB,SFFyB,CEEf,gBFFe,CEGtD,qBFHsD,EEItD,uBFJsD,CAAA,CAAA;;;;;AAAxD;AAAoE,UGAnD,wBAAA,SAAiC,OHAkB,CGAV,WHAU,CGAE,0BHAF,EGAS,yBHAT,CAAA,CAAA,CAAA;AAAZ,cGE3C,mBHF2C,EGEtB,SHFsB,CGEZ,gBHFY,CGGtD,wBHHsD,EGItD,0BHJsD,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { autocompleteEmptyEvents, autocompleteEmptyProps, autocompleteItemEvents, autocompleteItemProps, autocompleteListEvents, autocompleteListProps, autocompletePopoverEvents, autocompletePopoverProps } from "@prosekit/web/autocomplete";
4
4
 
5
5
  //#region src/components/autocomplete/autocomplete-empty.gen.ts
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { BlockHandleAddElement, BlockHandleAddEvents, BlockHandleAddProps as BlockHandleAddProps$1, BlockHandleDraggableElement, BlockHandleDraggableEvents, BlockHandleDraggableProps as BlockHandleDraggableProps$1, BlockHandlePopoverElement, BlockHandlePopoverEvents, BlockHandlePopoverProps as BlockHandlePopoverProps$1 } from "@prosekit/web/block-handle";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-block-handle.d.ts","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAqC,UAApB,mBAAA,SAA4B,OAAR,CAAgB,WAAhB,CAA4B,qBAA5B,EAAmC,oBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE3D,cAF2D,EAE3C,SAF2C,CAEjC,gBAFiC,CAGtE,mBAHsE,EAItE,qBAJsE,CAAA,CAAA;;;;;AAAxE;AAAqC,UCApB,yBAAA,SAAkC,ODAd,CCAsB,WDAtB,CCAkC,2BDAlC,ECAyC,0BDAzC,CAAA,CAAA,CAAA;AAAmC,cCE3D,oBDF2D,ECErC,SDFqC,CCE3B,gBDF2B,CCGtE,yBDHsE,ECItE,2BDJsE,CAAA,CAAA;;;;;AAAxE;AAAqC,UEApB,uBAAA,SAAgC,OFAZ,CEAoB,WFApB,CEAgC,yBFAhC,EEAuC,wBFAvC,CAAA,CAAA,CAAA;AAAmC,cEE3D,kBFF2D,EEEvC,SFFuC,CEE7B,gBFF6B,CEGtE,uBFHsE,EEItE,yBFJsE,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-block-handle.d.ts","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAiE,UAAhD,mBAAA,SAA4B,OAAoB,CAAZ,WAAY,CAAA,qBAAA,EAAO,oBAAP,CAAA,CAAA,CAAA;AAAZ,cAExC,cAFwC,EAExB,SAFwB,CAEd,gBAFc,CAGnD,mBAHmD,EAInD,qBAJmD,CAAA,CAAA;;;;;AAArD;AAAiE,UCAhD,yBAAA,SAAkC,ODAc,CCAN,WDAM,CCAM,2BDAN,ECAa,0BDAb,CAAA,CAAA,CAAA;AAAZ,cCExC,oBDFwC,ECElB,SDFkB,CCER,gBDFQ,CCGnD,yBDHmD,ECInD,2BDJmD,CAAA,CAAA;;;;;AAArD;AAAiE,UEAhD,uBAAA,SAAgC,OFAgB,CEAR,WFAQ,CEAI,yBFAJ,EEAW,wBFAX,CAAA,CAAA,CAAA;AAAZ,cEExC,kBFFwC,EEEpB,SFFoB,CEEV,gBFFU,CEGnD,uBFHmD,EEInD,yBFJmD,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { blockHandleAddEvents, blockHandleAddProps, blockHandleDraggableEvents, blockHandleDraggableProps, blockHandlePopoverEvents, blockHandlePopoverProps } from "@prosekit/web/block-handle";
4
4
 
5
5
  //#region src/components/block-handle/block-handle-add.gen.ts
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { DropIndicatorElement, DropIndicatorEvents, DropIndicatorProps as DropIndicatorProps$1 } from "@prosekit/web/drop-indicator";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-drop-indicator.d.ts","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAoC,UAAnB,kBAAA,SAA2B,OAAR,CAAgB,WAAhB,CAA4B,oBAA5B,EAAmC,mBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE1D,aAF0D,EAE3C,SAF2C,CAEjC,gBAFiC,CAGrE,kBAHqE,EAIrE,oBAJqE,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-drop-indicator.d.ts","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAgE,UAA/C,kBAAA,SAA2B,OAAoB,CAAZ,WAAY,CAAA,oBAAA,EAAO,mBAAP,CAAA,CAAA,CAAA;AAAZ,cAEvC,aAFuC,EAExB,SAFwB,CAEd,gBAFc,CAGlD,kBAHkD,EAIlD,oBAJkD,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { dropIndicatorEvents, dropIndicatorProps } from "@prosekit/web/drop-indicator";
4
4
 
5
5
  //#region src/components/drop-indicator/drop-indicator.gen.ts
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { InlinePopoverElement, InlinePopoverEvents, InlinePopoverProps as InlinePopoverProps$1 } from "@prosekit/web/inline-popover";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAoC,UAAnB,kBAAA,SAA2B,OAAR,CAAgB,WAAhB,CAA4B,oBAA5B,EAAmC,mBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE1D,aAF0D,EAE3C,SAF2C,CAEjC,gBAFiC,CAGrE,kBAHqE,EAIrE,oBAJqE,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAgE,UAA/C,kBAAA,SAA2B,OAAoB,CAAZ,WAAY,CAAA,oBAAA,EAAO,mBAAP,CAAA,CAAA,CAAA;AAAZ,cAEvC,aAFuC,EAExB,SAFwB,CAEd,gBAFc,CAGlD,kBAHkD,EAIlD,oBAJkD,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { inlinePopoverEvents, inlinePopoverProps } from "@prosekit/web/inline-popover";
4
4
 
5
5
  //#region src/components/inline-popover/inline-popover.gen.ts
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { PopoverContentElement, PopoverContentEvents, PopoverContentProps as PopoverContentProps$1, PopoverRootElement, PopoverRootEvents, PopoverRootProps as PopoverRootProps$1, PopoverTriggerElement, PopoverTriggerEvents, PopoverTriggerProps as PopoverTriggerProps$1 } from "@prosekit/web/popover";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-popover.d.ts","names":[],"sources":["../src/components/popover/popover-content.gen.ts","../src/components/popover/popover-root.gen.ts","../src/components/popover/popover-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAqC,UAApB,mBAAA,SAA4B,OAAR,CAAgB,WAAhB,CAA4B,qBAA5B,EAAmC,oBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE3D,cAF2D,EAE3C,SAF2C,CAEjC,gBAFiC,CAGtE,mBAHsE,EAItE,qBAJsE,CAAA,CAAA;;;;;AAAxE;AAAqC,UCApB,gBAAA,SAAyB,ODAL,CCAa,WDAb,CCAyB,kBDAzB,ECAgC,iBDAhC,CAAA,CAAA,CAAA;AAAmC,cCE3D,WDF2D,ECE9C,SDF8C,CCEpC,gBDFoC,CCGtE,gBDHsE,ECItE,kBDJsE,CAAA,CAAA;;;;;AAAxE;AAAqC,UEApB,mBAAA,SAA4B,OFAR,CEAgB,WFAhB,CEA4B,qBFA5B,EEAmC,oBFAnC,CAAA,CAAA,CAAA;AAAmC,cEE3D,cFF2D,EEE3C,SFF2C,CEEjC,gBFFiC,CEGtE,mBFHsE,EEItE,qBFJsE,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-popover.d.ts","names":[],"sources":["../src/components/popover/popover-content.gen.ts","../src/components/popover/popover-root.gen.ts","../src/components/popover/popover-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAiE,UAAhD,mBAAA,SAA4B,OAAoB,CAAZ,WAAY,CAAA,qBAAA,EAAO,oBAAP,CAAA,CAAA,CAAA;AAAZ,cAExC,cAFwC,EAExB,SAFwB,CAEd,gBAFc,CAGnD,mBAHmD,EAInD,qBAJmD,CAAA,CAAA;;;;;AAArD;AAAiE,UCAhD,gBAAA,SAAyB,ODAuB,CCAf,WDAe,CCAH,kBDAG,ECAI,iBDAJ,CAAA,CAAA,CAAA;AAAZ,cCExC,WDFwC,ECE3B,SDF2B,CCEjB,gBDFiB,CCGnD,gBDHmD,ECInD,kBDJmD,CAAA,CAAA;;;;;AAArD;AAAiE,UEAhD,mBAAA,SAA4B,OFAoB,CEAZ,WFAY,CEAA,qBFAA,EEAO,oBFAP,CAAA,CAAA,CAAA;AAAZ,cEExC,cFFwC,EEExB,SFFwB,CEEd,gBFFc,CEGnD,mBFHmD,EEInD,qBFJmD,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { popoverContentEvents, popoverContentProps, popoverRootEvents, popoverRootProps, popoverTriggerEvents, popoverTriggerProps } from "@prosekit/web/popover";
4
4
 
5
5
  //#region src/components/popover/popover-content.gen.ts
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { ResizableHandleElement, ResizableHandleEvents, ResizableHandleProps as ResizableHandleProps$1, ResizableRootElement, ResizableRootEvents, ResizableRootProps as ResizableRootProps$1 } from "@prosekit/web/resizable";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle.gen.ts","../src/components/resizable/resizable-root.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAsC,UAArB,oBAAA,SAA6B,OAAR,CAAgB,WAAhB,CAA4B,sBAA5B,EAAmC,qBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE5D,eAF4D,EAE3C,SAF2C,CAEjC,gBAFiC,CAGvE,oBAHuE,EAIvE,sBAJuE,CAAA,CAAA;;;;;AAAzE;AAAsC,UCArB,kBAAA,SAA2B,ODAN,CCAc,WDAd,CCA0B,oBDA1B,ECAiC,mBDAjC,CAAA,CAAA,CAAA;AAAmC,cCE5D,aDF4D,ECE7C,SDF6C,CCEnC,gBDFmC,CCGvE,kBDHuE,ECIvE,oBDJuE,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle.gen.ts","../src/components/resizable/resizable-root.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAkE,UAAjD,oBAAA,SAA6B,OAAoB,CAAZ,WAAY,CAAA,sBAAA,EAAO,qBAAP,CAAA,CAAA,CAAA;AAAZ,cAEzC,eAFyC,EAExB,SAFwB,CAEd,gBAFc,CAGpD,oBAHoD,EAIpD,sBAJoD,CAAA,CAAA;;;;;AAAtD;AAAkE,UCAjD,kBAAA,SAA2B,ODAsB,CCAd,WDAc,CCAF,oBDAE,ECAK,mBDAL,CAAA,CAAA,CAAA;AAAZ,cCEzC,aDFyC,ECE1B,SDF0B,CCEhB,gBDFgB,CCGpD,kBDHoD,ECIpD,oBDJoD,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { resizableHandleEvents, resizableHandleProps, resizableRootEvents, resizableRootProps } from "@prosekit/web/resizable";
4
4
 
5
5
  //#region src/components/resizable/resizable-handle.gen.ts
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { TableHandleColumnRootElement, TableHandleColumnRootEvents, TableHandleColumnRootProps as TableHandleColumnRootProps$1, TableHandleColumnTriggerElement, TableHandleColumnTriggerEvents, TableHandleColumnTriggerProps as TableHandleColumnTriggerProps$1, TableHandleDragPreviewElement, TableHandleDragPreviewEvents, TableHandleDragPreviewProps as TableHandleDragPreviewProps$1, TableHandleDropIndicatorElement, TableHandleDropIndicatorEvents, TableHandleDropIndicatorProps as TableHandleDropIndicatorProps$1, TableHandlePopoverContentElement, TableHandlePopoverContentEvents, TableHandlePopoverContentProps as TableHandlePopoverContentProps$1, TableHandlePopoverItemElement, TableHandlePopoverItemEvents, TableHandlePopoverItemProps as TableHandlePopoverItemProps$1, TableHandleRootElement, TableHandleRootEvents, TableHandleRootProps as TableHandleRootProps$1, TableHandleRowRootElement, TableHandleRowRootEvents, TableHandleRowRootProps as TableHandleRowRootProps$1, TableHandleRowTriggerElement, TableHandleRowTriggerEvents, TableHandleRowTriggerProps as TableHandleRowTriggerProps$1 } from "@prosekit/web/table-handle";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-root.gen.ts","../src/components/table-handle/table-handle-column-trigger.gen.ts","../src/components/table-handle/table-handle-drag-preview.gen.ts","../src/components/table-handle/table-handle-drop-indicator.gen.ts","../src/components/table-handle/table-handle-popover-content.gen.ts","../src/components/table-handle/table-handle-popover-item.gen.ts","../src/components/table-handle/table-handle-root.gen.ts","../src/components/table-handle/table-handle-row-root.gen.ts","../src/components/table-handle/table-handle-row-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAA4C,UAA3B,0BAAA,SAAmC,OAAR,CAAgB,WAAhB,CAA4B,4BAA5B,EAAmC,2BAAnC,CAAA,CAAA,CAAA;AAAmC,cAElE,qBAFkE,EAE3C,SAF2C,CAEjC,gBAFiC,CAG7E,0BAH6E,EAI7E,4BAJ6E,CAAA,CAAA;;;;;AAA/E;AAA4C,UCA3B,6BAAA,SAAsC,ODAX,CCAmB,WDAnB,CCA+B,+BDA/B,ECAsC,8BDAtC,CAAA,CAAA,CAAA;AAAmC,cCElE,wBDFkE,ECExC,SDFwC,CCE9B,gBDF8B,CCG7E,6BDH6E,ECI7E,+BDJ6E,CAAA,CAAA;;;;;AAA/E;AAA4C,UEA3B,2BAAA,SAAoC,OFAT,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,WRAhB,CQA4B,4BRA5B,EQAmC,2BRAnC,CAAA,CAAA,CAAA;AAAmC,cQElE,qBRFkE,EQE3C,SRF2C,CQEjC,gBRFiC,CQG7E,0BRH6E,EQI7E,4BRJ6E,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-root.gen.ts","../src/components/table-handle/table-handle-column-trigger.gen.ts","../src/components/table-handle/table-handle-drag-preview.gen.ts","../src/components/table-handle/table-handle-drop-indicator.gen.ts","../src/components/table-handle/table-handle-popover-content.gen.ts","../src/components/table-handle/table-handle-popover-item.gen.ts","../src/components/table-handle/table-handle-root.gen.ts","../src/components/table-handle/table-handle-row-root.gen.ts","../src/components/table-handle/table-handle-row-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAwE,UAAvD,0BAAA,SAAmC,OAAoB,CAAZ,WAAY,CAAA,4BAAA,EAAO,2BAAP,CAAA,CAAA,CAAA;AAAZ,cAE/C,qBAF+C,EAExB,SAFwB,CAEd,gBAFc,CAG1D,0BAH0D,EAI1D,4BAJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UCAvD,6BAAA,SAAsC,ODAiB,CCAT,WDAS,CCAG,+BDAH,ECAU,8BDAV,CAAA,CAAA,CAAA;AAAZ,cCE/C,wBDF+C,ECErB,SDFqB,CCEX,gBDFW,CCG1D,6BDH0D,ECI1D,+BDJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UEAvD,2BAAA,SAAoC,OFAmB,CEAX,WFAW,CEAC,6BFAD,EEAQ,4BFAR,CAAA,CAAA,CAAA;AAAZ,cEE/C,sBFF+C,EEEvB,SFFuB,CEEb,gBFFa,CEG1D,2BFH0D,EEI1D,6BFJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UGAvD,6BAAA,SAAsC,OHAiB,CGAT,WHAS,CGAG,+BHAH,EGAU,8BHAV,CAAA,CAAA,CAAA;AAAZ,cGE/C,wBHF+C,EGErB,SHFqB,CGEX,gBHFW,CGG1D,6BHH0D,EGI1D,+BHJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UIAvD,8BAAA,SAAuC,OJAgB,CIAR,WJAQ,CIAI,gCJAJ,EIAW,+BJAX,CAAA,CAAA,CAAA;AAAZ,cIE/C,yBJF+C,EIEpB,SJFoB,CIEV,gBJFU,CIG1D,8BJH0D,EII1D,gCJJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UKAvD,2BAAA,SAAoC,OLAmB,CKAX,WLAW,CKAC,6BLAD,EKAQ,4BLAR,CAAA,CAAA,CAAA;AAAZ,cKE/C,sBLF+C,EKEvB,SLFuB,CKEb,gBLFa,CKG1D,2BLH0D,EKI1D,6BLJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UMAvD,oBAAA,SAA6B,ONA0B,CMAlB,WNAkB,CMAN,sBNAM,EMAC,qBNAD,CAAA,CAAA,CAAA;AAAZ,cME/C,eNF+C,EME9B,SNF8B,CMEpB,gBNFoB,CMG1D,oBNH0D,EMI1D,sBNJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UOAvD,uBAAA,SAAgC,OPAuB,COAf,WPAe,COAH,yBPAG,EOAI,wBPAJ,CAAA,CAAA,CAAA;AAAZ,cOE/C,kBPF+C,EOE3B,SPF2B,COEjB,gBPFiB,COG1D,uBPH0D,EOI1D,yBPJ0D,CAAA,CAAA;;;;;AAA5D;AAAwE,UQAvD,0BAAA,SAAmC,ORAoB,CQAZ,WRAY,CQAA,4BRAA,EQAO,2BRAP,CAAA,CAAA,CAAA;AAAZ,cQE/C,qBRF+C,EQExB,SRFwB,CQEd,gBRFc,CQG1D,0BRH0D,EQI1D,4BRJ0D,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, tableHandleDragPreviewEvents, tableHandleDragPreviewProps, tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, tableHandlePopoverContentEvents, tableHandlePopoverContentProps, tableHandlePopoverItemEvents, tableHandlePopoverItemProps, tableHandleRootEvents, tableHandleRootProps, tableHandleRowRootEvents, tableHandleRowRootProps, tableHandleRowTriggerEvents, tableHandleRowTriggerProps } from "@prosekit/web/table-handle";
4
4
 
5
5
  //#region src/components/table-handle/table-handle-column-root.gen.ts
@@ -1,5 +1,5 @@
1
- import { PropsWithElement } from "./types-CoG9Vl2B.js";
2
- import { CreateProps } from "./create-props-BwXSSFVp.js";
1
+ import { i as PropsWithElement } from "./types-VT1O6Xnr.js";
2
+ import { t as CreateProps } from "./create-props-IUcX0Ggy.js";
3
3
  import { Component } from "solid-js";
4
4
  import { TooltipContentElement, TooltipContentEvents, TooltipContentProps as TooltipContentProps$1, TooltipRootElement, TooltipRootEvents, TooltipRootProps as TooltipRootProps$1, TooltipTriggerElement, TooltipTriggerEvents, TooltipTriggerProps as TooltipTriggerProps$1 } from "@prosekit/web/tooltip";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid-tooltip.d.ts","names":[],"sources":["../src/components/tooltip/tooltip-content.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAqC,UAApB,mBAAA,SAA4B,OAAR,CAAgB,WAAhB,CAA4B,qBAA5B,EAAmC,oBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE3D,cAF2D,EAE3C,SAF2C,CAEjC,gBAFiC,CAGtE,mBAHsE,EAItE,qBAJsE,CAAA,CAAA;;;;;AAAxE;AAAqC,UCApB,gBAAA,SAAyB,ODAL,CCAa,WDAb,CCAyB,kBDAzB,ECAgC,iBDAhC,CAAA,CAAA,CAAA;AAAmC,cCE3D,WDF2D,ECE9C,SDF8C,CCEpC,gBDFoC,CCGtE,gBDHsE,ECItE,kBDJsE,CAAA,CAAA;;;;;AAAxE;AAAqC,UEApB,mBAAA,SAA4B,OFAR,CEAgB,WFAhB,CEA4B,qBFA5B,EEAmC,oBFAnC,CAAA,CAAA,CAAA;AAAmC,cEE3D,cFF2D,EEE3C,SFF2C,CEEjC,gBFFiC,CEGtE,mBFHsE,EEItE,qBFJsE,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-solid-tooltip.d.ts","names":[],"sources":["../src/components/tooltip/tooltip-content.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgBA;AAAiE,UAAhD,mBAAA,SAA4B,OAAoB,CAAZ,WAAY,CAAA,qBAAA,EAAO,oBAAP,CAAA,CAAA,CAAA;AAAZ,cAExC,cAFwC,EAExB,SAFwB,CAEd,gBAFc,CAGnD,mBAHmD,EAInD,qBAJmD,CAAA,CAAA;;;;;AAArD;AAAiE,UCAhD,gBAAA,SAAyB,ODAuB,CCAf,WDAe,CCAH,kBDAG,ECAI,iBDAJ,CAAA,CAAA,CAAA;AAAZ,cCExC,WDFwC,ECE3B,SDF2B,CCEjB,gBDFiB,CCGnD,gBDHmD,ECInD,kBDJmD,CAAA,CAAA;;;;;AAArD;AAAiE,UEAhD,mBAAA,SAA4B,OFAoB,CEAZ,WFAY,CEAA,qBFAA,EEAO,oBFAP,CAAA,CAAA,CAAA;AAAZ,cEExC,cFFwC,EEExB,SFFwB,CEEd,gBFFc,CEGnD,mBFHmD,EEInD,qBFJmD,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-DIj_hnDx.js";
2
- import { createComponent } from "./create-component-x4Duyu8z.js";
1
+ import "./editor-context-B5bsBkGo.js";
2
+ import { t as createComponent } from "./create-component-DOv1yHjo.js";
3
3
  import { tooltipContentEvents, tooltipContentProps, tooltipRootEvents, tooltipRootProps, tooltipTriggerEvents, tooltipTriggerProps } from "@prosekit/web/tooltip";
4
4
 
5
5
  //#region src/components/tooltip/tooltip-content.gen.ts
@@ -1,4 +1,4 @@
1
- import { MaybeAccessor, PropsWithChildren, PropsWithClass, PropsWithElement } from "./types-CoG9Vl2B.js";
1
+ import { i as PropsWithElement, n as PropsWithChildren, r as PropsWithClass, t as MaybeAccessor } from "./types-VT1O6Xnr.js";
2
2
  import { MarkViewContextProps, NodeViewContextProps } from "@prosemirror-adapter/solid";
3
3
  import { Accessor, Component, ParentProps } from "solid-js";
4
4
  import { Editor, Extension, Keymap, Priority } from "@prosekit/core";
@@ -75,7 +75,7 @@ declare function defineSolidNodeView(options: SolidNodeViewOptions): Extension;
75
75
  interface UseExtensionOptions {
76
76
  /**
77
77
  * The editor to add the extension to. If not provided, it will use the
78
- * editor from the nearest `ProseKit` component.
78
+ * editor from the nearest `<ProseKit>` component.
79
79
  */
80
80
  editor?: MaybeAccessor<Editor>;
81
81
  /**
@@ -117,6 +117,35 @@ declare function useEditor<E extends Extension = any>(options?: {
117
117
  update?: boolean;
118
118
  }): () => Editor<E>;
119
119
  //#endregion
120
+ //#region src/hooks/use-editor-derived-value.d.ts
121
+ interface UseEditorDerivedOptions<E extends Extension = any> {
122
+ /**
123
+ * The editor to add the extension to. If not provided, it will use the
124
+ * editor from the nearest `<ProseKit>` component.
125
+ */
126
+ editor?: MaybeAccessor<Editor<E>>;
127
+ }
128
+ /**
129
+ * Runs a function to derive a value from the editor instance after editor state
130
+ * changes.
131
+ *
132
+ * This is useful when you need to render something based on the editor state,
133
+ * for example, whether the selected text is wrapped in an italic mark.
134
+ *
135
+ * It returns an accessor of the derived value that updates whenever the editor
136
+ * state changes.
137
+ *
138
+ * @public
139
+ */
140
+ declare function useEditorDerivedValue<E extends Extension, Derived>(
141
+ /**
142
+ * A function that receives the editor instance and returns a derived value.
143
+ *
144
+ * It will be called whenever the editor's document state changes, or when it
145
+ * mounts.
146
+ */
147
+ derive: (editor: Editor<E>) => Derived, options?: UseEditorDerivedOptions<E>): Accessor<Derived>;
148
+ //#endregion
120
149
  //#region src/hooks/use-keymap.d.ts
121
150
  declare function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void;
122
151
  //#endregion
@@ -128,5 +157,5 @@ declare function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions):
128
157
  */
129
158
  declare function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void;
130
159
  //#endregion
131
- export { type MaybeAccessor, type PropsWithChildren, type PropsWithClass, type PropsWithElement, ProseKit, type ProseKitProps, type SolidMarkViewComponent, type SolidMarkViewOptions, type SolidMarkViewProps, type SolidNodeViewComponent, type SolidNodeViewOptions, type SolidNodeViewProps, type UseExtensionOptions, defineSolidMarkView, defineSolidNodeView, useDocChange, useEditor, useExtension, useKeymap, useStateUpdate };
160
+ export { type MaybeAccessor, type PropsWithChildren, type PropsWithClass, type PropsWithElement, ProseKit, type ProseKitProps, type SolidMarkViewComponent, type SolidMarkViewOptions, type SolidMarkViewProps, type SolidNodeViewComponent, type SolidNodeViewOptions, type SolidNodeViewProps, type UseEditorDerivedOptions, type UseExtensionOptions, defineSolidMarkView, defineSolidNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
132
161
  //# sourceMappingURL=prosekit-solid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAYY,aAAA,GAAgB;UAClB;;;;;;AADV;AAAyB,cASZ,QATY,EASF,SATE,CASQ,aATR,CAAA;;;;;;UCaR,kBAAA,SAA2B;ADb5C;;;AAA4B,KCkBhB,sBAAA,GAAyB,SDlBT,CCkBmB,kBDlBnB,CAAA;;AAS5B;;;;AAAgC,UCgBf,oBAAA,SAA6B,uBDhBd,CCgBsC,sBDhBtC,CAAA,CAAA;;;;ECIf,IAAA,EAAA,MAAA;AAKjB;AAOA;;;;;AA6CgB,iBAAA,mBAAA,CAAmB,OAAA,EAAU,oBAAV,CAAA,EAAiC,SAAjC;;;;;;UCzDlB,kBAAA,SAA2B;AFb5C;;;AAA4B,KEkBhB,sBAAA,GAAyB,SFlBT,CEkBmB,kBFlBnB,CAAA;;AAS5B;;;;AAAgC,UEgBf,oBAAA,SAA6B,uBFhBd,CEgBsC,sBFhBtC,CAAA,CAAA;;;;ECIf,IAAA,EAAA,MAAA;AAKjB;AAOA;;;;;AA6CgB,iBCeA,mBAAA,CDfmB,OAAA,ECeU,oBDfV,CAAA,ECeiC,SDfjC;;;UEtElB,mBAAA;;;;;WAKN,cAAc;EHLb;;;UAAgB,CAAA,EGUf,QHVe;;AAS5B;;;AAAuB,iBGOP,YAAA;;;;;AFHhB,SAAiB,EEQJ,QFRI,CEQK,SFRc,GAAA,IAAQ,CAAA,EAAA,OAAoB,CAApB,EEShC,mBFToD,CAAA,EAAA,IAAA;;;;;;;;iBGZhD,YAAA,gBACC,oCACL;;;;;;;;iBCKI,oBAAoB,wBLCpC;;;AATA;;;;EAAuC,MAAA,CAAA,EAAA,OAAA;AASvC,CAAA,CAAA,EAAa,GAAA,GKOH,MLQT,CKRgB,CLQhB,CAAA;;;iBM1Be,SAAA,eAAwB,kBAAkB;;;;;;;;iBCG1C,cAAA,kBACG,gCACP"}
1
+ {"version":3,"file":"prosekit-solid.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":[],"mappings":";;;;;;;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yBb,uBHzBa,CGyBW,CHzBX,CAAA,CAAA,EG0BtB,QH1BsB,CG0Bb,OH1Ba,CAAA;;;iBIPT,SAAA,eAAwB,kBAAkB;;;;;;;;iBCG1C,cAAA,kBACG,gCACP"}
@@ -1,4 +1,4 @@
1
- import { EditorContextProvider, useEditorContext } from "./editor-context-DIj_hnDx.js";
1
+ import { n as useEditorContext, t as EditorContextProvider } from "./editor-context-B5bsBkGo.js";
2
2
  import { ProsemirrorAdapterProvider, useMarkViewContext, useMarkViewFactory, useNodeViewContext, useNodeViewFactory } from "@prosemirror-adapter/solid";
3
3
  import { createComponent, createEffect, createMemo, createSignal, onCleanup } from "solid-js";
4
4
  import { EditorNotFoundError, ProseKitError, defineDocChangeHandler, defineKeymap, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeViewComponent, defineNodeViewFactory, defineUpdateHandler, union, withPriority } from "@prosekit/core";
@@ -76,8 +76,7 @@ function withMarkViewProps(component) {
76
76
  */
77
77
  function consumeSolidMarkViews() {
78
78
  const markViewFactory = useMarkViewFactory();
79
- const extension = createMemo(() => defineSolidMarkViewFactory(markViewFactory), [markViewFactory]);
80
- useExtension(extension);
79
+ useExtension(createMemo(() => defineSolidMarkViewFactory(markViewFactory), [markViewFactory]));
81
80
  }
82
81
  /**
83
82
  * Defines a mark view using a Solid component.
@@ -86,14 +85,13 @@ function consumeSolidMarkViews() {
86
85
  */
87
86
  function defineSolidMarkView(options) {
88
87
  const { name, component,...userOptions } = options;
89
- const args = {
90
- ...userOptions,
91
- component: withMarkViewProps(component)
92
- };
93
88
  return defineMarkViewComponent({
94
89
  group: "solid",
95
90
  name,
96
- args
91
+ args: {
92
+ ...userOptions,
93
+ component: withMarkViewProps(component)
94
+ }
97
95
  });
98
96
  }
99
97
  function defineSolidMarkViewFactory(factory) {
@@ -141,8 +139,7 @@ function withNodeViewProps(component) {
141
139
  */
142
140
  function consumeSolidNodeViews() {
143
141
  const nodeViewFactory = useNodeViewFactory();
144
- const extension = createMemo(() => defineSolidNodeViewFactory(nodeViewFactory), [nodeViewFactory]);
145
- useExtension(extension);
142
+ useExtension(createMemo(() => defineSolidNodeViewFactory(nodeViewFactory), [nodeViewFactory]));
146
143
  }
147
144
  /**
148
145
  * Defines a node view using a Solid component.
@@ -151,14 +148,13 @@ function consumeSolidNodeViews() {
151
148
  */
152
149
  function defineSolidNodeView(options) {
153
150
  const { name, component,...userOptions } = options;
154
- const args = {
155
- ...userOptions,
156
- component: withNodeViewProps(component)
157
- };
158
151
  return defineNodeViewComponent({
159
152
  group: "solid",
160
153
  name,
161
- args
154
+ args: {
155
+ ...userOptions,
156
+ component: withNodeViewProps(component)
157
+ }
162
158
  });
163
159
  }
164
160
  function defineSolidNodeViewFactory(factory) {
@@ -233,6 +229,26 @@ function useForceUpdate() {
233
229
  return createSignal(void 0, { equals: false });
234
230
  }
235
231
 
232
+ //#endregion
233
+ //#region src/hooks/use-editor-derived-value.ts
234
+ /**
235
+ * Runs a function to derive a value from the editor instance after editor state
236
+ * changes.
237
+ *
238
+ * This is useful when you need to render something based on the editor state,
239
+ * for example, whether the selected text is wrapped in an italic mark.
240
+ *
241
+ * It returns an accessor of the derived value that updates whenever the editor
242
+ * state changes.
243
+ *
244
+ * @public
245
+ */
246
+ function useEditorDerivedValue(derive, options) {
247
+ const initialEditor = options?.editor;
248
+ const editorAccessor = initialEditor ? () => toValue(initialEditor) : useEditor({ update: true });
249
+ return createMemo(() => derive(editorAccessor()));
250
+ }
251
+
236
252
  //#endregion
237
253
  //#region src/hooks/use-keymap.ts
238
254
  function useKeymap(keymap, options) {
@@ -253,5 +269,5 @@ function useStateUpdate(handler, options) {
253
269
  }
254
270
 
255
271
  //#endregion
256
- export { ProseKit, defineSolidMarkView, defineSolidNodeView, useDocChange, useEditor, useExtension, useKeymap, useStateUpdate };
272
+ export { ProseKit, defineSolidMarkView, defineSolidNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
257
273
  //# sourceMappingURL=prosekit-solid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-solid.js","names":["context: Accessor<SolidMarkViewProps>","args: SolidMarkViewUserOptions","context: Accessor<SolidNodeViewProps>","args: SolidNodeViewUserOptions","ProseKit: Component<ProseKitProps>"],"sources":["../src/utils/to-value.ts","../src/hooks/use-editor-extension.ts","../src/hooks/use-priority-extension.ts","../src/hooks/use-extension.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/components/prosekit.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":["/**\n * Accesses the value of a MaybeAccessor\n *\n * @example\n * ```ts\n * access(\"foo\") // => \"foo\"\n * access(() => \"foo\") // => \"foo\"\n * ```\n */\nexport function toValue<T>(\n v: (() => T) | T,\n): T {\n return (typeof v === 'function') ? (v as () => T)() : v\n}\n","import {\n EditorNotFoundError,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n createEffect,\n onCleanup,\n type Accessor,\n} from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context'\nimport type { MaybeAccessor } from '../types'\nimport { toValue } from '../utils/to-value'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editorAccessor: MaybeAccessor<Editor> | undefined | null,\n extensionAccessor: Accessor<Extension | null>,\n): void {\n const editorContext = useEditorContext()\n\n createEffect(() => {\n const editor = toValue(editorAccessor) || toValue(editorContext)\n const extension = extensionAccessor()\n\n if (!editor) {\n throw new EditorNotFoundError()\n }\n if (extension) {\n onCleanup(editor.use(extension))\n }\n })\n}\n","import {\n withPriority,\n type Extension,\n type Priority,\n} from '@prosekit/core'\n\n/**\n * @internal\n */\nexport function usePriorityExtension<T extends Extension = Extension>(\n extension: () => T | null,\n priority?: Priority | null,\n): () => T | null {\n return () => {\n const ext = extension()\n return ext && priority ? withPriority(ext, priority) : ext\n }\n}\n","import type {\n Editor,\n Extension,\n Priority,\n} from '@prosekit/core'\nimport type { Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types'\n\nimport { useEditorExtension } from './use-editor-extension'\nimport { usePriorityExtension } from './use-priority-extension'\n\nexport interface UseExtensionOptions {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `ProseKit` component.\n */\n editor?: MaybeAccessor<Editor>\n\n /**\n * Optional priority to add the extension with.\n */\n priority?: Priority\n}\n\n/**\n * Add an extension to the editor.\n */\nexport function useExtension(\n /**\n * The accessor to an extension to add to the editor. If it changes, the previous\n * extension will be removed and the new one (if not null) will be added.\n */\n extension: Accessor<Extension | null>,\n options?: UseExtensionOptions,\n): void {\n useEditorExtension(\n options?.editor,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import {\n defineMarkViewComponent,\n defineMarkViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { MarkViewConstructor } from '@prosekit/pm/view'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useMarkViewContext,\n useMarkViewFactory,\n type MarkViewContextProps,\n type SolidMarkViewUserOptions,\n} from '@prosemirror-adapter/solid'\nimport {\n createComponent,\n createMemo,\n type Accessor,\n type Component,\n} from 'solid-js'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface SolidMarkViewProps extends MarkViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidMarkViewComponent = Component<SolidMarkViewProps>\n\n/**\n * Options for {@link defineSolidMarkView}.\n *\n * @public\n */\nexport interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nfunction withMarkViewProps(\n component: SolidMarkViewComponent,\n): Component<SolidMarkViewProps> {\n return function MarkViewPropsWrapper() {\n const context: Accessor<SolidMarkViewProps> = useMarkViewContext()\n const props: SolidMarkViewProps = {\n get contentRef() {\n return context().contentRef\n },\n get view() {\n return context().view\n },\n get mark() {\n return context().mark\n },\n }\n return createComponent(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport function consumeSolidMarkViews(): void {\n const markViewFactory = useMarkViewFactory()\n const extension = createMemo(\n () => defineSolidMarkViewFactory(markViewFactory),\n [markViewFactory],\n )\n\n useExtension(extension)\n}\n\n/**\n * Defines a mark view using a Solid component.\n *\n * @public\n */\nexport function defineSolidMarkView(options: SolidMarkViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: SolidMarkViewUserOptions = {\n ...userOptions,\n component: withMarkViewProps(component),\n }\n\n return defineMarkViewComponent<SolidMarkViewUserOptions>({\n group: 'solid',\n name,\n args,\n })\n}\n\nfunction defineSolidMarkViewFactory(\n factory: (options: SolidMarkViewOptions) => MarkViewConstructor,\n) {\n return defineMarkViewFactory<SolidMarkViewOptions>({\n group: 'solid',\n factory,\n })\n}\n","import {\n defineNodeViewComponent,\n defineNodeViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { NodeViewConstructor } from '@prosekit/pm/view'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useNodeViewContext,\n useNodeViewFactory,\n type NodeViewContextProps,\n type SolidNodeViewUserOptions,\n} from '@prosemirror-adapter/solid'\nimport {\n createComponent,\n createMemo,\n type Accessor,\n type Component,\n} from 'solid-js'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface SolidNodeViewProps extends NodeViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidNodeViewComponent = Component<SolidNodeViewProps>\n\n/**\n * Options for {@link defineSolidNodeView}.\n *\n * @public\n */\nexport interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nfunction withNodeViewProps(\n component: SolidNodeViewComponent,\n): Component<SolidNodeViewProps> {\n return function NodeViewPropsWrapper() {\n const context: Accessor<SolidNodeViewProps> = useNodeViewContext()\n const props: SolidNodeViewProps = {\n get contentRef() {\n return context().contentRef\n },\n get view() {\n return context().view\n },\n get getPos() {\n return context().getPos\n },\n get setAttrs() {\n return context().setAttrs\n },\n get node() {\n return context().node\n },\n get selected() {\n return context().selected\n },\n get decorations() {\n return context().decorations\n },\n get innerDecorations() {\n return context().innerDecorations\n },\n }\n return createComponent(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport function consumeSolidNodeViews(): void {\n const nodeViewFactory = useNodeViewFactory()\n const extension = createMemo(\n () => defineSolidNodeViewFactory(nodeViewFactory),\n [nodeViewFactory],\n )\n\n useExtension(extension)\n}\n\n/**\n * Defines a node view using a Solid component.\n *\n * @public\n */\nexport function defineSolidNodeView(options: SolidNodeViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: SolidNodeViewUserOptions = {\n ...userOptions,\n component: withNodeViewProps(component),\n }\n\n return defineNodeViewComponent<SolidNodeViewUserOptions>({\n group: 'solid',\n name,\n args,\n })\n}\n\nfunction defineSolidNodeViewFactory(\n factory: (options: SolidNodeViewOptions) => NodeViewConstructor,\n) {\n return defineNodeViewFactory<SolidNodeViewOptions>({\n group: 'solid',\n factory,\n })\n}\n","import type { Editor } from '@prosekit/core'\nimport { ProsemirrorAdapterProvider } from '@prosemirror-adapter/solid'\nimport {\n createComponent,\n type Component,\n type ParentProps,\n} from 'solid-js'\n\nimport { EditorContextProvider } from '../contexts/editor-context'\nimport { consumeSolidMarkViews } from '../extensions/solid-mark-view'\nimport { consumeSolidNodeViews } from '../extensions/solid-node-view'\n\nexport type ProseKitProps = ParentProps<{\n editor: Editor\n}>\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: Component<ProseKitProps> = (props) => {\n return createComponent(ProsemirrorAdapterProvider, {\n get children() {\n return createComponent(EditorContextProvider, {\n get value() {\n return props.editor\n },\n get children() {\n consumeSolidNodeViews()\n consumeSolidMarkViews()\n return props.children\n },\n })\n },\n })\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor document changes.\n *\n * @public\n */\nexport function useDocChange(\n handler: (doc: ProseMirrorNode) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineDocChangeHandler((view) => handler(view.state.doc))\n useExtension(() => extension, options)\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n ProseKitError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n createEffect,\n createSignal,\n} from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\n/**\n * Retrieves the editor instance from the nearest ProseKit component.\n *\n * @public\n */\nexport function useEditor<E extends Extension = any>(options?: {\n /**\n * Whether to update the component when the editor is mounted or editor state\n * is updated.\n *\n * @default false\n */\n update?: boolean\n}): () => Editor<E> {\n const update = options?.update ?? false\n\n const editor = useEditorContext<E>()\n if (!editor) {\n throw new ProseKitError(\n 'useEditor must be used within the ProseKit component',\n )\n }\n\n const [depend, forceUpdate] = useForceUpdate()\n\n createEffect(() => {\n if (update) {\n const extension = union(\n defineMountHandler(forceUpdate),\n defineUpdateHandler(forceUpdate),\n )\n return editor.use(extension)\n }\n }, [editor, update, forceUpdate])\n\n return () => {\n depend()\n return editor\n }\n}\n\nfunction useForceUpdate() {\n return createSignal(undefined, { equals: false })\n}\n","import {\n defineKeymap,\n type Keymap,\n} from '@prosekit/core'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\nexport function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void {\n const extension = () => defineKeymap(keymap())\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor state changes.\n *\n * @public\n */\nexport function useStateUpdate(\n handler: (state: EditorState) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineUpdateHandler((view) => handler(view.state))\n useExtension(() => ext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QAAQ,KAAK,MAAM,IAAI,CAAC;AAC3E,oBAAmB,WAAW,QAAQ;;;;;;;;;;ACExC,SAAgB,UAAqC,SAQjC;CAClB,MAAM,SAAS,SAAS,UAAU;CAElC,MAAM,SAAS,kBAAqB;AACpC,KAAI,CAAC,OACH,OAAM,IAAI,cACR,uDACD;CAGH,MAAM,CAAC,QAAQ,eAAe,gBAAgB;AAE9C,oBAAmB;AACjB,MAAI,QAAQ;GACV,MAAM,YAAY,MAChB,mBAAmB,YAAY,EAC/B,oBAAoB,YAAY,CACjC;AACD,UAAO,OAAO,IAAI,UAAU;;IAE7B;EAAC;EAAQ;EAAQ;EAAY,CAAC;AAEjC,cAAa;AACX,UAAQ;AACR,SAAO;;;AAIX,SAAS,iBAAiB;AACxB,QAAO,aAAa,QAAW,EAAE,QAAQ,OAAO,CAAC;;;;;AC/CnD,SAAgB,UAAU,QAAsB,SAAqC;CACnF,MAAM,kBAAkB,aAAa,QAAQ,CAAC;AAC9C,cAAa,WAAW,QAAQ;;;;;;;;;;ACClC,SAAgB,eACd,SACA,SACM;CACN,MAAM,YAAY,qBAAqB,SAAS,QAAQ,KAAK,MAAM,CAAC;AACpE,oBAAmB,WAAW,QAAQ"}
1
+ {"version":3,"file":"prosekit-solid.js","names":["context: Accessor<SolidMarkViewProps>","context: Accessor<SolidNodeViewProps>","ProseKit: Component<ProseKitProps>","editorAccessor: Accessor<Editor<E>>"],"sources":["../src/utils/to-value.ts","../src/hooks/use-editor-extension.ts","../src/hooks/use-priority-extension.ts","../src/hooks/use-extension.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/components/prosekit.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":["/**\n * Accesses the value of a MaybeAccessor\n *\n * @example\n * ```ts\n * access(\"foo\") // => \"foo\"\n * access(() => \"foo\") // => \"foo\"\n * ```\n */\nexport function toValue<T>(\n v: (() => T) | T,\n): T {\n return (typeof v === 'function') ? (v as () => T)() : v\n}\n","import {\n EditorNotFoundError,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n createEffect,\n onCleanup,\n type Accessor,\n} from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context'\nimport type { MaybeAccessor } from '../types'\nimport { toValue } from '../utils/to-value'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editorAccessor: MaybeAccessor<Editor> | undefined | null,\n extensionAccessor: Accessor<Extension | null>,\n): void {\n const editorContext = useEditorContext()\n\n createEffect(() => {\n const editor = toValue(editorAccessor) || toValue(editorContext)\n const extension = extensionAccessor()\n\n if (!editor) {\n throw new EditorNotFoundError()\n }\n if (extension) {\n onCleanup(editor.use(extension))\n }\n })\n}\n","import {\n withPriority,\n type Extension,\n type Priority,\n} from '@prosekit/core'\n\n/**\n * @internal\n */\nexport function usePriorityExtension<T extends Extension = Extension>(\n extension: () => T | null,\n priority?: Priority | null,\n): () => T | null {\n return () => {\n const ext = extension()\n return ext && priority ? withPriority(ext, priority) : ext\n }\n}\n","import type {\n Editor,\n Extension,\n Priority,\n} from '@prosekit/core'\nimport type { Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types'\n\nimport { useEditorExtension } from './use-editor-extension'\nimport { usePriorityExtension } from './use-priority-extension'\n\nexport interface UseExtensionOptions {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: MaybeAccessor<Editor>\n\n /**\n * Optional priority to add the extension with.\n */\n priority?: Priority\n}\n\n/**\n * Add an extension to the editor.\n */\nexport function useExtension(\n /**\n * The accessor to an extension to add to the editor. If it changes, the previous\n * extension will be removed and the new one (if not null) will be added.\n */\n extension: Accessor<Extension | null>,\n options?: UseExtensionOptions,\n): void {\n useEditorExtension(\n options?.editor,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import {\n defineMarkViewComponent,\n defineMarkViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { MarkViewConstructor } from '@prosekit/pm/view'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useMarkViewContext,\n useMarkViewFactory,\n type MarkViewContextProps,\n type SolidMarkViewUserOptions,\n} from '@prosemirror-adapter/solid'\nimport {\n createComponent,\n createMemo,\n type Accessor,\n type Component,\n} from 'solid-js'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface SolidMarkViewProps extends MarkViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidMarkViewComponent = Component<SolidMarkViewProps>\n\n/**\n * Options for {@link defineSolidMarkView}.\n *\n * @public\n */\nexport interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nfunction withMarkViewProps(\n component: SolidMarkViewComponent,\n): Component<SolidMarkViewProps> {\n return function MarkViewPropsWrapper() {\n const context: Accessor<SolidMarkViewProps> = useMarkViewContext()\n const props: SolidMarkViewProps = {\n get contentRef() {\n return context().contentRef\n },\n get view() {\n return context().view\n },\n get mark() {\n return context().mark\n },\n }\n return createComponent(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport function consumeSolidMarkViews(): void {\n const markViewFactory = useMarkViewFactory()\n const extension = createMemo(\n () => defineSolidMarkViewFactory(markViewFactory),\n [markViewFactory],\n )\n\n useExtension(extension)\n}\n\n/**\n * Defines a mark view using a Solid component.\n *\n * @public\n */\nexport function defineSolidMarkView(options: SolidMarkViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: SolidMarkViewUserOptions = {\n ...userOptions,\n component: withMarkViewProps(component),\n }\n\n return defineMarkViewComponent<SolidMarkViewUserOptions>({\n group: 'solid',\n name,\n args,\n })\n}\n\nfunction defineSolidMarkViewFactory(\n factory: (options: SolidMarkViewOptions) => MarkViewConstructor,\n) {\n return defineMarkViewFactory<SolidMarkViewOptions>({\n group: 'solid',\n factory,\n })\n}\n","import {\n defineNodeViewComponent,\n defineNodeViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { NodeViewConstructor } from '@prosekit/pm/view'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useNodeViewContext,\n useNodeViewFactory,\n type NodeViewContextProps,\n type SolidNodeViewUserOptions,\n} from '@prosemirror-adapter/solid'\nimport {\n createComponent,\n createMemo,\n type Accessor,\n type Component,\n} from 'solid-js'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface SolidNodeViewProps extends NodeViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidNodeViewComponent = Component<SolidNodeViewProps>\n\n/**\n * Options for {@link defineSolidNodeView}.\n *\n * @public\n */\nexport interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nfunction withNodeViewProps(\n component: SolidNodeViewComponent,\n): Component<SolidNodeViewProps> {\n return function NodeViewPropsWrapper() {\n const context: Accessor<SolidNodeViewProps> = useNodeViewContext()\n const props: SolidNodeViewProps = {\n get contentRef() {\n return context().contentRef\n },\n get view() {\n return context().view\n },\n get getPos() {\n return context().getPos\n },\n get setAttrs() {\n return context().setAttrs\n },\n get node() {\n return context().node\n },\n get selected() {\n return context().selected\n },\n get decorations() {\n return context().decorations\n },\n get innerDecorations() {\n return context().innerDecorations\n },\n }\n return createComponent(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport function consumeSolidNodeViews(): void {\n const nodeViewFactory = useNodeViewFactory()\n const extension = createMemo(\n () => defineSolidNodeViewFactory(nodeViewFactory),\n [nodeViewFactory],\n )\n\n useExtension(extension)\n}\n\n/**\n * Defines a node view using a Solid component.\n *\n * @public\n */\nexport function defineSolidNodeView(options: SolidNodeViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: SolidNodeViewUserOptions = {\n ...userOptions,\n component: withNodeViewProps(component),\n }\n\n return defineNodeViewComponent<SolidNodeViewUserOptions>({\n group: 'solid',\n name,\n args,\n })\n}\n\nfunction defineSolidNodeViewFactory(\n factory: (options: SolidNodeViewOptions) => NodeViewConstructor,\n) {\n return defineNodeViewFactory<SolidNodeViewOptions>({\n group: 'solid',\n factory,\n })\n}\n","import type { Editor } from '@prosekit/core'\nimport { ProsemirrorAdapterProvider } from '@prosemirror-adapter/solid'\nimport {\n createComponent,\n type Component,\n type ParentProps,\n} from 'solid-js'\n\nimport { EditorContextProvider } from '../contexts/editor-context'\nimport { consumeSolidMarkViews } from '../extensions/solid-mark-view'\nimport { consumeSolidNodeViews } from '../extensions/solid-node-view'\n\nexport type ProseKitProps = ParentProps<{\n editor: Editor\n}>\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: Component<ProseKitProps> = (props) => {\n return createComponent(ProsemirrorAdapterProvider, {\n get children() {\n return createComponent(EditorContextProvider, {\n get value() {\n return props.editor\n },\n get children() {\n consumeSolidNodeViews()\n consumeSolidMarkViews()\n return props.children\n },\n })\n },\n })\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor document changes.\n *\n * @public\n */\nexport function useDocChange(\n handler: (doc: ProseMirrorNode) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineDocChangeHandler((view) => handler(view.state.doc))\n useExtension(() => extension, options)\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n ProseKitError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n createEffect,\n createSignal,\n} from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\n/**\n * Retrieves the editor instance from the nearest ProseKit component.\n *\n * @public\n */\nexport function useEditor<E extends Extension = any>(options?: {\n /**\n * Whether to update the component when the editor is mounted or editor state\n * is updated.\n *\n * @default false\n */\n update?: boolean\n}): () => Editor<E> {\n const update = options?.update ?? false\n\n const editor = useEditorContext<E>()\n if (!editor) {\n throw new ProseKitError(\n 'useEditor must be used within the ProseKit component',\n )\n }\n\n const [depend, forceUpdate] = useForceUpdate()\n\n createEffect(() => {\n if (update) {\n const extension = union(\n defineMountHandler(forceUpdate),\n defineUpdateHandler(forceUpdate),\n )\n return editor.use(extension)\n }\n }, [editor, update, forceUpdate])\n\n return () => {\n depend()\n return editor\n }\n}\n\nfunction useForceUpdate() {\n return createSignal(undefined, { equals: false })\n}\n","import type {\n Editor,\n Extension,\n} from '@prosekit/core'\nimport {\n createMemo,\n type Accessor,\n} from 'solid-js'\n\nimport type { MaybeAccessor } from '../types'\nimport { toValue } from '../utils/to-value'\n\nimport { useEditor } from './use-editor'\n\nexport interface UseEditorDerivedOptions<E extends Extension = any> {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: MaybeAccessor<Editor<E>>\n}\n\n/**\n * Runs a function to derive a value from the editor instance after editor state\n * changes.\n *\n * This is useful when you need to render something based on the editor state,\n * for example, whether the selected text is wrapped in an italic mark.\n *\n * It returns an accessor of the derived value that updates whenever the editor\n * state changes.\n *\n * @public\n */\nexport function useEditorDerivedValue<E extends Extension, Derived>(\n /**\n * A function that receives the editor instance and returns a derived value.\n *\n * It will be called whenever the editor's document state changes, or when it\n * mounts.\n */\n derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Accessor<Derived> {\n const initialEditor = options?.editor\n const editorAccessor: Accessor<Editor<E>> = initialEditor\n ? () => toValue(initialEditor)\n : useEditor<E>({ update: true })\n\n return createMemo(() => derive(editorAccessor()))\n}\n","import {\n defineKeymap,\n type Keymap,\n} from '@prosekit/core'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\nexport function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void {\n const extension = () => defineKeymap(keymap())\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor state changes.\n *\n * @public\n */\nexport function useStateUpdate(\n handler: (state: EditorState) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = defineUpdateHandler((view) => handler(view.state))\n useExtension(() => extension, options)\n}\n"],"mappings":";;;;;;;;;;;;;;;AASA,SAAgB,QACd,GACG;AACH,QAAQ,OAAO,MAAM,aAAe,GAAe,GAAG;;;;;;;;ACMxD,SAAgB,mBACd,gBACA,mBACM;CACN,MAAM,gBAAgB,kBAAkB;AAExC,oBAAmB;EACjB,MAAM,SAAS,QAAQ,eAAe,IAAI,QAAQ,cAAc;EAChE,MAAM,YAAY,mBAAmB;AAErC,MAAI,CAAC,OACH,OAAM,IAAI,qBAAqB;AAEjC,MAAI,UACF,WAAU,OAAO,IAAI,UAAU,CAAC;GAElC;;;;;;;;ACzBJ,SAAgB,qBACd,WACA,UACgB;AAChB,cAAa;EACX,MAAM,MAAM,WAAW;AACvB,SAAO,OAAO,WAAW,aAAa,KAAK,SAAS,GAAG;;;;;;;;;ACa3D,SAAgB,aAKd,WACA,SACM;AACN,oBACE,SAAS,QACT,qBAAqB,WAAW,SAAS,SAAS,CACnD;;;;;ACKH,SAAS,kBACP,WAC+B;AAC/B,QAAO,SAAS,uBAAuB;EACrC,MAAMA,UAAwC,oBAAoB;AAYlE,SAAO,gBAAgB,WAXW;GAChC,IAAI,aAAa;AACf,WAAO,SAAS,CAAC;;GAEnB,IAAI,OAAO;AACT,WAAO,SAAS,CAAC;;GAEnB,IAAI,OAAO;AACT,WAAO,SAAS,CAAC;;GAEpB,CACuC;;;;;;AAO5C,SAAgB,wBAA8B;CAC5C,MAAM,kBAAkB,oBAAoB;AAM5C,cALkB,iBACV,2BAA2B,gBAAgB,EACjD,CAAC,gBAAgB,CAClB,CAEsB;;;;;;;AAQzB,SAAgB,oBAAoB,SAA0C;CAC5E,MAA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//#endregion
26
- export { MaybeAccessor, PropsWithChildren, PropsWithClass, PropsWithElement };
27
- //# sourceMappingURL=types-CoG9Vl2B.d.ts.map
26
+ export { PropsWithElement as i, PropsWithChildren as n, PropsWithClass as r, MaybeAccessor as t };
27
+ //# sourceMappingURL=types-VT1O6Xnr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-VT1O6Xnr.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;AAOY,KAPA,cAOiB,CAAA,IAAA,OAAgB,CAAA,GAPH,CAQ7B,GAAA;EAMD,KAAA,CAAA,EAAA,MAAA,GAAA,SAAgB;CAA6C;;;;AAAyC,KAPtG,iBAOsG,CAAA,IAAA,OAAA,CAAA,GAPrE,CAOqE,GAAA;EAKtG,QAAA,CAAA,EAXC,UAWY,GAAA,SAAA;CAAM;;;;KALnB,6DAA6D,eAAe,QAAQ,GAAA,CAAI,eAAe;;;;KAKvG,mBAAmB,IAAI,SAAS"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/solid",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.6.1",
5
5
  "private": false,
6
6
  "description": "Solid components and utilities for ProseKit",
7
7
  "author": {
@@ -68,11 +68,11 @@
68
68
  "src"
69
69
  ],
70
70
  "dependencies": {
71
- "@prosemirror-adapter/core": "^0.4.2",
72
- "@prosemirror-adapter/solid": "^0.4.2",
73
- "@prosekit/core": "^0.8.4",
74
- "@prosekit/pm": "^0.1.12",
75
- "@prosekit/web": "^0.7.4"
71
+ "@prosemirror-adapter/core": "^0.4.6",
72
+ "@prosemirror-adapter/solid": "^0.4.6",
73
+ "@prosekit/core": "^0.8.6",
74
+ "@prosekit/web": "^0.7.6",
75
+ "@prosekit/pm": "^0.1.14"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "solid-js": ">= 1.7.0"
@@ -83,9 +83,9 @@
83
83
  }
84
84
  },
85
85
  "devDependencies": {
86
- "solid-js": "^1.9.9",
87
- "tsdown": "^0.15.4",
88
- "typescript": "~5.9.2",
86
+ "solid-js": "^1.9.10",
87
+ "tsdown": "^0.16.2",
88
+ "typescript": "~5.9.3",
89
89
  "@prosekit/config-tsdown": "0.0.0",
90
90
  "@prosekit/config-vitest": "0.0.0"
91
91
  },
@@ -0,0 +1,51 @@
1
+ import type {
2
+ Editor,
3
+ Extension,
4
+ } from '@prosekit/core'
5
+ import {
6
+ createMemo,
7
+ type Accessor,
8
+ } from 'solid-js'
9
+
10
+ import type { MaybeAccessor } from '../types'
11
+ import { toValue } from '../utils/to-value'
12
+
13
+ import { useEditor } from './use-editor'
14
+
15
+ export interface UseEditorDerivedOptions<E extends Extension = any> {
16
+ /**
17
+ * The editor to add the extension to. If not provided, it will use the
18
+ * editor from the nearest `<ProseKit>` component.
19
+ */
20
+ editor?: MaybeAccessor<Editor<E>>
21
+ }
22
+
23
+ /**
24
+ * Runs a function to derive a value from the editor instance after editor state
25
+ * changes.
26
+ *
27
+ * This is useful when you need to render something based on the editor state,
28
+ * for example, whether the selected text is wrapped in an italic mark.
29
+ *
30
+ * It returns an accessor of the derived value that updates whenever the editor
31
+ * state changes.
32
+ *
33
+ * @public
34
+ */
35
+ export function useEditorDerivedValue<E extends Extension, Derived>(
36
+ /**
37
+ * A function that receives the editor instance and returns a derived value.
38
+ *
39
+ * It will be called whenever the editor's document state changes, or when it
40
+ * mounts.
41
+ */
42
+ derive: (editor: Editor<E>) => Derived,
43
+ options?: UseEditorDerivedOptions<E>,
44
+ ): Accessor<Derived> {
45
+ const initialEditor = options?.editor
46
+ const editorAccessor: Accessor<Editor<E>> = initialEditor
47
+ ? () => toValue(initialEditor)
48
+ : useEditor<E>({ update: true })
49
+
50
+ return createMemo(() => derive(editorAccessor()))
51
+ }
@@ -13,7 +13,7 @@ import { usePriorityExtension } from './use-priority-extension'
13
13
  export interface UseExtensionOptions {
14
14
  /**
15
15
  * The editor to add the extension to. If not provided, it will use the
16
- * editor from the nearest `ProseKit` component.
16
+ * editor from the nearest `<ProseKit>` component.
17
17
  */
18
18
  editor?: MaybeAccessor<Editor>
19
19
 
package/src/index.ts CHANGED
@@ -16,6 +16,10 @@ export {
16
16
  } from './extensions/solid-node-view'
17
17
  export { useDocChange } from './hooks/use-doc-change'
18
18
  export { useEditor } from './hooks/use-editor'
19
+ export {
20
+ useEditorDerivedValue,
21
+ type UseEditorDerivedOptions,
22
+ } from './hooks/use-editor-derived-value'
19
23
  export {
20
24
  useExtension,
21
25
  type UseExtensionOptions,
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-props-BwXSSFVp.d.ts","names":[],"sources":["../src/components/create-props.ts"],"sourcesContent":[],"mappings":";KAAY,yCAAA,MACyB,KADd,GAAA,OAAA,EAAA,EAAA,eAAA,gBACc,MACE,MADF,GACW,WADX,MAEjC,KADmC,GAC3B,gBAD2B,CACV,MADU,CAAA;KAGlC,gBAH2C,CAAA,eAAA,gBAC5C,MAGmC,MAHnC,GAG4C,WAH5C,sBAAQ,MAKU,MALV,IAAA,KAKyB,UALzB,CAAA,MAAA,GAK6C,SAL7C,CAAA,EAAA,GAAA,CAAA,KAAA,EAMD,SANC,SAAA,GAAA,MAAA,QAAA,GAMqC,MANrC,CAM4C,SAN5C,CAAA,CAAA,QAAA,CAAA,GAOJ,MAPI,CAOG,SAPH,CAAA,EAAA,GAAA,IAAA,EAAgB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-CoG9Vl2B.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;AAOY,KAPA,cAOiB,CAAA,IAAA,OAAA,CAAA,GAPa,CAOb,GAAA;EAAA,KAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;;;AAO7B;AAA4B,KAPhB,iBAOgB,CAAA,IAAA,OAAA,CAAA,GAPiB,CAOjB,GAAA;UAA6C,CAAA,EAN5D,UAM4D,GAAA,SAAA;;;;;AAK7D,KALA,gBAKa,CAAA,cAAA,MAAA,EAAA,sBALgD,WAKhD,CAAA,GAL+D,KAK/D,GALuE,GAAA,CAAI,cAK3E,CAL0F,aAK1F,CAAA;;;;AAAU,KAAvB,aAAuB,CAAA,CAAA,CAAA,GAAJ,CAAI,GAAA,QAAA,CAAS,CAAT,CAAA"}