@prosekit/svelte 0.1.0 → 0.1.2

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 (37) hide show
  1. package/dist/build/components/autocomplete-empty.gen.d.ts +2 -3
  2. package/dist/build/components/autocomplete-empty.gen.d.ts.map +1 -1
  3. package/dist/build/components/autocomplete-item.gen.d.ts +2 -3
  4. package/dist/build/components/autocomplete-item.gen.d.ts.map +1 -1
  5. package/dist/build/components/autocomplete-list.gen.d.ts +2 -3
  6. package/dist/build/components/autocomplete-list.gen.d.ts.map +1 -1
  7. package/dist/build/components/autocomplete-popover.gen.d.ts +2 -3
  8. package/dist/build/components/autocomplete-popover.gen.d.ts.map +1 -1
  9. package/dist/build/components/combo-box-input.gen.d.ts +2 -3
  10. package/dist/build/components/combo-box-input.gen.d.ts.map +1 -1
  11. package/dist/build/components/combo-box-item.gen.d.ts +2 -3
  12. package/dist/build/components/combo-box-item.gen.d.ts.map +1 -1
  13. package/dist/build/components/combo-box-list.gen.d.ts +2 -3
  14. package/dist/build/components/combo-box-list.gen.d.ts.map +1 -1
  15. package/dist/build/components/combo-box.gen.d.ts +2 -3
  16. package/dist/build/components/combo-box.gen.d.ts.map +1 -1
  17. package/dist/build/components/inline-popover.gen.d.ts +2 -3
  18. package/dist/build/components/inline-popover.gen.d.ts.map +1 -1
  19. package/dist/build/components/popover.gen.d.ts +2 -3
  20. package/dist/build/components/popover.gen.d.ts.map +1 -1
  21. package/dist/build/hooks/use-extension.d.ts +9 -1
  22. package/dist/build/hooks/use-extension.d.ts.map +1 -1
  23. package/dist/build/hooks/use-extension.js +15 -7
  24. package/dist/build/hooks/use-keymap.d.ts +5 -2
  25. package/dist/build/hooks/use-keymap.d.ts.map +1 -1
  26. package/dist/build/hooks/use-keymap.js +6 -5
  27. package/dist/build/hooks/use-priority-extension.d.ts +4 -0
  28. package/dist/build/hooks/use-priority-extension.d.ts.map +1 -0
  29. package/dist/build/hooks/use-priority-extension.js +9 -0
  30. package/dist/build/index.d.ts +2 -1
  31. package/dist/build/index.d.ts.map +1 -1
  32. package/dist/build/index.js +1 -1
  33. package/dist/build/types.d.ts +7 -0
  34. package/dist/build/types.d.ts.map +1 -0
  35. package/dist/build/types.js +1 -0
  36. package/package.json +8 -8
  37. package/src/index.ts +5 -0
@@ -1,7 +1,6 @@
1
1
  import type { AutocompleteEmptyProps as AutocompleteEmptyElementProps } from '@prosekit/lit/autocomplete-empty';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type AutocompleteEmptyProps = {
4
- class?: string;
5
- } & AutocompleteEmptyElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type AutocompleteEmptyProps = PropsWithClass<AutocompleteEmptyElementProps>;
6
5
  export declare const AutocompleteEmpty: typeof SvelteComponent<AutocompleteEmptyProps>;
7
6
  //# sourceMappingURL=autocomplete-empty.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-empty.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-empty.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,IAAI,6BAA6B,EAAE,MAAM,kCAAkC,CAAA;AAC/G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,6BAA6B,CAAA;AAEjC,eAAO,MAAM,iBAAiB,EAAgE,uBAAuB,sBAAsB,CAAC,CAAA"}
1
+ {"version":3,"file":"autocomplete-empty.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-empty.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,IAAI,6BAA6B,EAAE,MAAM,kCAAkC,CAAA;AAC/G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,6BAA6B,CAAC,CAAA;AAElF,eAAO,MAAM,iBAAiB,EAAgE,uBAAuB,sBAAsB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { AutocompleteItemProps as AutocompleteItemElementProps } from '@prosekit/lit/autocomplete-item';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type AutocompleteItemProps = {
4
- class?: string;
5
- } & AutocompleteItemElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type AutocompleteItemProps = PropsWithClass<AutocompleteItemElementProps>;
6
5
  export declare const AutocompleteItem: typeof SvelteComponent<AutocompleteItemProps>;
7
6
  //# sourceMappingURL=autocomplete-item.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-item.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-item.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,IAAI,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,4BAA4B,CAAA;AAEhC,eAAO,MAAM,gBAAgB,EAA+D,uBAAuB,qBAAqB,CAAC,CAAA"}
1
+ {"version":3,"file":"autocomplete-item.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-item.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,IAAI,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,4BAA4B,CAAC,CAAA;AAEhF,eAAO,MAAM,gBAAgB,EAA+D,uBAAuB,qBAAqB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { AutocompleteListProps as AutocompleteListElementProps } from '@prosekit/lit/autocomplete-list';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type AutocompleteListProps = {
4
- class?: string;
5
- } & AutocompleteListElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type AutocompleteListProps = PropsWithClass<AutocompleteListElementProps>;
6
5
  export declare const AutocompleteList: typeof SvelteComponent<AutocompleteListProps>;
7
6
  //# sourceMappingURL=autocomplete-list.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-list.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-list.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,IAAI,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,4BAA4B,CAAA;AAEhC,eAAO,MAAM,gBAAgB,EAA+D,uBAAuB,qBAAqB,CAAC,CAAA"}
1
+ {"version":3,"file":"autocomplete-list.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-list.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,IAAI,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,4BAA4B,CAAC,CAAA;AAEhF,eAAO,MAAM,gBAAgB,EAA+D,uBAAuB,qBAAqB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { AutocompletePopoverProps as AutocompletePopoverElementProps } from '@prosekit/lit/autocomplete-popover';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type AutocompletePopoverProps = {
4
- class?: string;
5
- } & AutocompletePopoverElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type AutocompletePopoverProps = PropsWithClass<AutocompletePopoverElementProps>;
6
5
  export declare const AutocompletePopover: typeof SvelteComponent<AutocompletePopoverProps>;
7
6
  //# sourceMappingURL=autocomplete-popover.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-popover.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-popover.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,IAAI,+BAA+B,EAAE,MAAM,oCAAoC,CAAA;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,+BAA+B,CAAA;AAEnC,eAAO,MAAM,mBAAmB,EAAkE,uBAAuB,wBAAwB,CAAC,CAAA"}
1
+ {"version":3,"file":"autocomplete-popover.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete-popover.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,IAAI,+BAA+B,EAAE,MAAM,oCAAoC,CAAA;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,+BAA+B,CAAC,CAAA;AAEtF,eAAO,MAAM,mBAAmB,EAAkE,uBAAuB,wBAAwB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { ComboBoxInputProps as ComboBoxInputElementProps } from '@prosekit/lit/combo-box-input';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type ComboBoxInputProps = {
4
- class?: string;
5
- } & ComboBoxInputElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type ComboBoxInputProps = PropsWithClass<ComboBoxInputElementProps>;
6
5
  export declare const ComboBoxInput: typeof SvelteComponent<ComboBoxInputProps>;
7
6
  //# sourceMappingURL=combo-box-input.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box-input.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box-input.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,MAAM,+BAA+B,CAAA;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,yBAAyB,CAAA;AAE7B,eAAO,MAAM,aAAa,EAA4D,uBAAuB,kBAAkB,CAAC,CAAA"}
1
+ {"version":3,"file":"combo-box-input.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box-input.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,MAAM,+BAA+B,CAAA;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,yBAAyB,CAAC,CAAA;AAE1E,eAAO,MAAM,aAAa,EAA4D,uBAAuB,kBAAkB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { ComboBoxItemProps as ComboBoxItemElementProps } from '@prosekit/lit/combo-box-item';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type ComboBoxItemProps = {
4
- class?: string;
5
- } & ComboBoxItemElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type ComboBoxItemProps = PropsWithClass<ComboBoxItemElementProps>;
6
5
  export declare const ComboBoxItem: typeof SvelteComponent<ComboBoxItemProps>;
7
6
  //# sourceMappingURL=combo-box-item.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box-item.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box-item.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,wBAAwB,CAAA;AAE5B,eAAO,MAAM,YAAY,EAA2D,uBAAuB,iBAAiB,CAAC,CAAA"}
1
+ {"version":3,"file":"combo-box-item.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box-item.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAA;AAExE,eAAO,MAAM,YAAY,EAA2D,uBAAuB,iBAAiB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { ComboBoxListProps as ComboBoxListElementProps } from '@prosekit/lit/combo-box-list';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type ComboBoxListProps = {
4
- class?: string;
5
- } & ComboBoxListElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type ComboBoxListProps = PropsWithClass<ComboBoxListElementProps>;
6
5
  export declare const ComboBoxList: typeof SvelteComponent<ComboBoxListProps>;
7
6
  //# sourceMappingURL=combo-box-list.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box-list.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box-list.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,wBAAwB,CAAA;AAE5B,eAAO,MAAM,YAAY,EAA2D,uBAAuB,iBAAiB,CAAC,CAAA"}
1
+ {"version":3,"file":"combo-box-list.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box-list.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAA;AAExE,eAAO,MAAM,YAAY,EAA2D,uBAAuB,iBAAiB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { ComboBoxProps as ComboBoxElementProps } from '@prosekit/lit/combo-box';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type ComboBoxProps = {
4
- class?: string;
5
- } & ComboBoxElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type ComboBoxProps = PropsWithClass<ComboBoxElementProps>;
6
5
  export declare const ComboBox: typeof SvelteComponent<ComboBoxProps>;
7
6
  //# sourceMappingURL=combo-box.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,oBAAoB,CAAA;AAExB,eAAO,MAAM,QAAQ,EAAuD,uBAAuB,aAAa,CAAC,CAAA"}
1
+ {"version":3,"file":"combo-box.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAA;AAEhE,eAAO,MAAM,QAAQ,EAAuD,uBAAuB,aAAa,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { InlinePopoverProps as InlinePopoverElementProps } from '@prosekit/lit/inline-popover';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type InlinePopoverProps = {
4
- class?: string;
5
- } & InlinePopoverElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type InlinePopoverProps = PropsWithClass<InlinePopoverElementProps>;
6
5
  export declare const InlinePopover: typeof SvelteComponent<InlinePopoverProps>;
7
6
  //# sourceMappingURL=inline-popover.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inline-popover.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/inline-popover.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,MAAM,8BAA8B,CAAA;AACnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,yBAAyB,CAAA;AAE7B,eAAO,MAAM,aAAa,EAA4D,uBAAuB,kBAAkB,CAAC,CAAA"}
1
+ {"version":3,"file":"inline-popover.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/inline-popover.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,MAAM,8BAA8B,CAAA;AACnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,yBAAyB,CAAC,CAAA;AAE1E,eAAO,MAAM,aAAa,EAA4D,uBAAuB,kBAAkB,CAAC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { PopoverProps as PopoverElementProps } from '@prosekit/lit/popover';
2
2
  import type { SvelteComponent } from 'svelte';
3
- export type PopoverProps = {
4
- class?: string;
5
- } & PopoverElementProps;
3
+ import type { PropsWithClass } from '../types';
4
+ export type PopoverProps = PropsWithClass<PopoverElementProps>;
6
5
  export declare const Popover: typeof SvelteComponent<PopoverProps>;
7
6
  //# sourceMappingURL=popover.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/popover.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAI7C,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,mBAAmB,CAAA;AAEvB,eAAO,MAAM,OAAO,EAAsD,uBAAuB,YAAY,CAAC,CAAA"}
1
+ {"version":3,"file":"popover.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/popover.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAA;AAE9D,eAAO,MAAM,OAAO,EAAsD,uBAAuB,YAAY,CAAC,CAAA"}
@@ -1,3 +1,11 @@
1
1
  import { type Extension } from '@prosekit/core';
2
- export declare function useExtension<T extends Extension = Extension>(extension: T): VoidFunction;
2
+ import { type Readable } from 'svelte/store';
3
+ /**
4
+ * Add an extension to the editor.
5
+ *
6
+ * It accepts a store to an optional extension. If the extension is changed, the
7
+ * previous extension will be removed and the new one (if not null) will be
8
+ * added.
9
+ */
10
+ export declare function useExtension<T extends Extension = Extension>(extensionStore: Readable<T | null>): void;
3
11
  //# sourceMappingURL=use-extension.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-extension.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI/C,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAC1D,SAAS,EAAE,CAAC,GACX,YAAY,CAcd"}
1
+ {"version":3,"file":"use-extension.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAIrD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAC1D,cAAc,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,GACjC,IAAI,CAWN"}
@@ -1,14 +1,22 @@
1
1
  import {} from '@prosekit/core';
2
+ import { derived } from 'svelte/store';
2
3
  import { useEditor } from './use-editor';
3
- export function useExtension(extension) {
4
+ /**
5
+ * Add an extension to the editor.
6
+ *
7
+ * It accepts a store to an optional extension. If the extension is changed, the
8
+ * previous extension will be removed and the new one (if not null) will be
9
+ * added.
10
+ */
11
+ export function useExtension(extensionStore) {
4
12
  const editorStore = useEditor();
13
+ const store = derived([editorStore, extensionStore], (values) => values);
5
14
  let cleanup = null;
6
- editorStore.subscribe((editor) => {
7
- cleanup === null || cleanup === void 0 ? void 0 : cleanup();
8
- cleanup = editor.use(extension);
9
- });
10
- return () => {
15
+ store.subscribe(([editor, extension]) => {
11
16
  cleanup === null || cleanup === void 0 ? void 0 : cleanup();
12
17
  cleanup = null;
13
- };
18
+ if (extension) {
19
+ cleanup = editor.use(extension);
20
+ }
21
+ });
14
22
  }
@@ -1,3 +1,6 @@
1
- import { type Keymap } from '@prosekit/core';
2
- export declare function useKeymap(keymap: Keymap): VoidFunction;
1
+ import { Priority, type Keymap } from '@prosekit/core';
2
+ import { type Readable } from 'svelte/store';
3
+ export declare function useKeymap(keymapStore: Readable<Keymap>, options?: {
4
+ priority?: Priority;
5
+ }): void;
3
6
  //# sourceMappingURL=use-keymap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-keymap.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-keymap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAI1D,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAGtD"}
1
+ {"version":3,"file":"use-keymap.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-keymap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAIrD,wBAAgB,SAAS,CACvB,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC7B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GAChC,IAAI,CAGN"}
@@ -1,6 +1,7 @@
1
- import { defineKeymap } from '@prosekit/core';
2
- import { useExtension } from './use-extension';
3
- export function useKeymap(keymap) {
4
- const extension = defineKeymap(keymap);
5
- return useExtension(extension);
1
+ import { Priority, defineKeymap } from '@prosekit/core';
2
+ import { derived } from 'svelte/store';
3
+ import { usePriorityExtension } from './use-priority-extension';
4
+ export function useKeymap(keymapStore, options) {
5
+ const extension = derived(keymapStore, (keymap) => defineKeymap(keymap));
6
+ usePriorityExtension(extension, options === null || options === void 0 ? void 0 : options.priority);
6
7
  }
@@ -0,0 +1,4 @@
1
+ import { Priority, type Extension } from '@prosekit/core';
2
+ import { type Readable } from 'svelte/store';
3
+ export declare function usePriorityExtension<T extends Extension = Extension>(extensionStore: Readable<T | null>, priority?: Priority | null): void;
4
+ //# sourceMappingURL=use-priority-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-priority-extension.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-priority-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACvE,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAIrD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAClE,cAAc,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,EAClC,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,GACzB,IAAI,CAKN"}
@@ -0,0 +1,9 @@
1
+ import { Priority, withPriority } from '@prosekit/core';
2
+ import { derived } from 'svelte/store';
3
+ import { useExtension } from './use-extension';
4
+ export function usePriorityExtension(extensionStore, priority) {
5
+ const extensionWithPriorityStore = derived(extensionStore, (extension) => {
6
+ return extension && priority ? withPriority(extension, priority) : extension;
7
+ });
8
+ return useExtension(extensionWithPriorityStore);
9
+ }
@@ -1,5 +1,6 @@
1
+ export { ProseKit } from './components/prosekit';
1
2
  export { useEditor } from './hooks/use-editor';
2
3
  export { useExtension } from './hooks/use-extension';
3
4
  export { useKeymap } from './hooks/use-keymap';
4
- export { ProseKit } from './components/prosekit';
5
+ export type { PropsWithClass } from './types';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA"}
@@ -1,4 +1,4 @@
1
+ export { ProseKit } from './components/prosekit';
1
2
  export { useEditor } from './hooks/use-editor';
2
3
  export { useExtension } from './hooks/use-extension';
3
4
  export { useKeymap } from './hooks/use-keymap';
4
- export { ProseKit } from './components/prosekit';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export type PropsWithClass<P = unknown> = P & {
5
+ class?: string | undefined;
6
+ };
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG;IAC5C,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/svelte",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -108,13 +108,13 @@
108
108
  },
109
109
  "devDependencies": {
110
110
  "@prosekit/dev": "*",
111
- "@sveltejs/package": "^2.2.2",
112
- "@types/node": "^20.9.0",
113
- "read-pkg": "^9.0.0",
114
- "svelte": "^4.2.3",
115
- "svelte-check": "^3.5.2",
116
- "tsx": "^3.14.0",
117
- "typescript": "^5.2.2",
111
+ "@sveltejs/package": "^2.2.3",
112
+ "@types/node": "^20.10.1",
113
+ "read-pkg": "^9.0.1",
114
+ "svelte": "^4.2.8",
115
+ "svelte-check": "^3.6.2",
116
+ "tsx": "^4.6.1",
117
+ "typescript": "^5.3.2",
118
118
  "vitest": "^0.34.6"
119
119
  },
120
120
  "scripts": {
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { ProseKit } from './components/prosekit'
2
+ export { useEditor } from './hooks/use-editor'
3
+ export { useExtension } from './hooks/use-extension'
4
+ export { useKeymap } from './hooks/use-keymap'
5
+ export type { PropsWithClass } from './types'