@prosekit/svelte 0.0.20 → 0.0.22

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 (32) hide show
  1. package/dist/build/components/inline-popover.gen.d.ts +7 -0
  2. package/dist/build/components/inline-popover.gen.d.ts.map +1 -0
  3. package/dist/build/components/inline-popover.gen.js +2 -0
  4. package/dist/build/components/inline-popover.gen.svelte +7 -0
  5. package/dist/build/components/inline-popover.gen.svelte.d.ts +20 -0
  6. package/dist/build/components/inline-popover.gen.svelte.d.ts.map +1 -0
  7. package/dist/build/contexts/editor-context.d.ts +1 -5
  8. package/dist/build/contexts/editor-context.d.ts.map +1 -1
  9. package/dist/build/contexts/editor-context.js +2 -19
  10. package/dist/build/hooks/use-editor.d.ts +6 -0
  11. package/dist/build/hooks/use-editor.d.ts.map +1 -0
  12. package/dist/build/hooks/use-editor.js +20 -0
  13. package/dist/build/hooks/use-extension.d.ts +3 -0
  14. package/dist/build/hooks/use-extension.d.ts.map +1 -0
  15. package/dist/build/hooks/use-extension.js +14 -0
  16. package/dist/build/hooks/use-keymap.d.ts +3 -0
  17. package/dist/build/hooks/use-keymap.d.ts.map +1 -0
  18. package/dist/build/hooks/use-keymap.js +6 -0
  19. package/dist/build/index.d.ts +3 -1
  20. package/dist/build/index.d.ts.map +1 -1
  21. package/dist/build/index.js +3 -1
  22. package/dist/prosekit-svelte-inline-popover.d.ts +1 -0
  23. package/dist/prosekit-svelte-inline-popover.js +1 -0
  24. package/package.json +14 -14
  25. package/dist/build/components/code-block-popover.gen.d.ts +0 -7
  26. package/dist/build/components/code-block-popover.gen.d.ts.map +0 -1
  27. package/dist/build/components/code-block-popover.gen.js +0 -2
  28. package/dist/build/components/code-block-popover.gen.svelte +0 -7
  29. package/dist/build/components/code-block-popover.gen.svelte.d.ts +0 -20
  30. package/dist/build/components/code-block-popover.gen.svelte.d.ts.map +0 -1
  31. package/dist/prosekit-svelte-code-block-popover.d.ts +0 -1
  32. package/dist/prosekit-svelte-code-block-popover.js +0 -1
@@ -0,0 +1,7 @@
1
+ import type { InlinePopoverProps as InlinePopoverElementProps } from '@prosekit/lit/inline-popover';
2
+ import type { SvelteComponent } from 'svelte';
3
+ export type InlinePopoverProps = {
4
+ class?: string;
5
+ } & InlinePopoverElementProps;
6
+ export declare const InlinePopover: typeof SvelteComponent<InlinePopoverProps>;
7
+ //# sourceMappingURL=inline-popover.gen.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ import InlinePopoverComponent from './inline-popover.gen.svelte';
2
+ export const InlinePopover = InlinePopoverComponent;
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import '@prosekit/lit/inline-popover'
3
+ </script>
4
+
5
+ <prosekit-inline-popover {...$$props}>
6
+ <slot />
7
+ </prosekit-inline-popover>
@@ -0,0 +1,20 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import '@prosekit/lit/inline-popover';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {
11
+ default: {};
12
+ };
13
+ };
14
+ export type InlinePopoverProps = typeof __propDef.props;
15
+ export type InlinePopoverEvents = typeof __propDef.events;
16
+ export type InlinePopoverSlots = typeof __propDef.slots;
17
+ export default class InlinePopover extends SvelteComponentTyped<InlinePopoverProps, InlinePopoverEvents, InlinePopoverSlots> {
18
+ }
19
+ export {};
20
+ //# sourceMappingURL=inline-popover.gen.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-popover.gen.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/inline-popover.gen.svelte"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAE5C;AACD,OAAO,8BAA8B,CAAA;AAYrC,QAAA,MAAM,SAAS;;;;;;;;;;CAA+D,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC;AACxD,MAAM,MAAM,mBAAmB,GAAG,OAAO,SAAS,CAAC,MAAM,CAAC;AAC1D,MAAM,MAAM,kBAAkB,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC;AAExD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,oBAAoB,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,CAAC;CAC3H"}
@@ -1,11 +1,7 @@
1
- import { type Editor, type Extension } from '@prosekit/core';
2
- import { type Readable } from 'svelte/store';
1
+ import { type Editor } from '@prosekit/core';
3
2
  export interface EditorContext {
4
3
  editor: Editor;
5
4
  }
6
5
  export declare function setEditorContext(editor: Editor): void;
7
6
  export declare function getEditorContext(): EditorContext;
8
- export declare function getEditor<E extends Extension = any>(options?: {
9
- update?: boolean;
10
- }): Readable<Editor<E>>;
11
7
  //# sourceMappingURL=editor-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/editor-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,SAAS,EAEf,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEhE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;CACf;AAID,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAOhD;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,GAAG,GAAG,EAAE,OAAO,CAAC,EAAE;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAiBtB"}
1
+ {"version":3,"file":"editor-context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/editor-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAG3D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;CACf;AAID,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAOhD"}
@@ -1,6 +1,5 @@
1
- import { ProseKitError, defineEventHandler, } from '@prosekit/core';
2
- import { getContext, hasContext, onDestroy, onMount, setContext } from 'svelte';
3
- import { readonly, writable } from 'svelte/store';
1
+ import { ProseKitError } from '@prosekit/core';
2
+ import { getContext, hasContext, setContext } from 'svelte';
4
3
  const key = 'prosekit-svelte-editor-context';
5
4
  export function setEditorContext(editor) {
6
5
  if (!editor) {
@@ -15,19 +14,3 @@ export function getEditorContext() {
15
14
  }
16
15
  return getContext(key);
17
16
  }
18
- export function getEditor(options) {
19
- var _a;
20
- const update = (_a = options === null || options === void 0 ? void 0 : options.update) !== null && _a !== void 0 ? _a : false;
21
- const editor = getEditorContext().editor;
22
- const editorStore = writable(editor);
23
- if (update) {
24
- onMount(() => {
25
- const forceUpdate = () => {
26
- editorStore.set(editor);
27
- };
28
- const dispose = editor.use(defineEventHandler({ update: forceUpdate }));
29
- onDestroy(dispose);
30
- });
31
- }
32
- return readonly(editorStore);
33
- }
@@ -0,0 +1,6 @@
1
+ import { type Editor, type Extension } from '@prosekit/core';
2
+ import { type Readable } from 'svelte/store';
3
+ export declare function useEditor<E extends Extension = any>(options?: {
4
+ update?: boolean;
5
+ }): Readable<Editor<E>>;
6
+ //# sourceMappingURL=use-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-editor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAIhE,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,GAAG,GAAG,EAAE,OAAO,CAAC,EAAE;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAiBtB"}
@@ -0,0 +1,20 @@
1
+ import { defineUpdateHandler, } from '@prosekit/core';
2
+ import { onDestroy, onMount } from 'svelte';
3
+ import { readonly, writable } from 'svelte/store';
4
+ import { getEditorContext } from '../contexts/editor-context';
5
+ export function useEditor(options) {
6
+ var _a;
7
+ const update = (_a = options === null || options === void 0 ? void 0 : options.update) !== null && _a !== void 0 ? _a : false;
8
+ const editor = getEditorContext().editor;
9
+ const editorStore = writable(editor);
10
+ if (update) {
11
+ onMount(() => {
12
+ const forceUpdate = () => {
13
+ editorStore.set(editor);
14
+ };
15
+ const dispose = editor.use(defineUpdateHandler(forceUpdate));
16
+ onDestroy(dispose);
17
+ });
18
+ }
19
+ return readonly(editorStore);
20
+ }
@@ -0,0 +1,3 @@
1
+ import { type Extension } from '@prosekit/core';
2
+ export declare function useExtension<T extends Extension = Extension>(extension: T): VoidFunction;
3
+ //# sourceMappingURL=use-extension.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,14 @@
1
+ import {} from '@prosekit/core';
2
+ import { useEditor } from './use-editor';
3
+ export function useExtension(extension) {
4
+ const editorStore = useEditor();
5
+ let cleanup = null;
6
+ editorStore.subscribe((editor) => {
7
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
8
+ cleanup = editor.use(extension);
9
+ });
10
+ return () => {
11
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
12
+ cleanup = null;
13
+ };
14
+ }
@@ -0,0 +1,3 @@
1
+ import { type Keymap } from '@prosekit/core';
2
+ export declare function useKeymap(keymap: Keymap): VoidFunction;
3
+ //# sourceMappingURL=use-keymap.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,6 @@
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);
6
+ }
@@ -1,3 +1,5 @@
1
- export { getEditor } from './contexts/editor-context';
1
+ export { useEditor } from './hooks/use-editor';
2
+ export { useExtension } from './hooks/use-extension';
3
+ export { useKeymap } from './hooks/use-keymap';
2
4
  export { ProseKit } from './components/prosekit';
3
5
  //# 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,2BAA2B,CAAA;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA"}
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,2 +1,4 @@
1
- export { getEditor } from './contexts/editor-context';
1
+ export { useEditor } from './hooks/use-editor';
2
+ export { useExtension } from './hooks/use-extension';
3
+ export { useKeymap } from './hooks/use-keymap';
2
4
  export { ProseKit } from './components/prosekit';
@@ -0,0 +1 @@
1
+ export * from './build/components/inline-popover.gen'
@@ -0,0 +1 @@
1
+ export * from './build/components/inline-popover.gen'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/svelte",
3
3
  "type": "module",
4
- "version": "0.0.20",
4
+ "version": "0.0.22",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -54,12 +54,6 @@
54
54
  "import": "./dist/prosekit-svelte-autocomplete-popover.js",
55
55
  "default": "./dist/prosekit-svelte-autocomplete-popover.js"
56
56
  },
57
- "./code-block-popover": {
58
- "types": "./dist/prosekit-svelte-code-block-popover.d.ts",
59
- "svelte": "./dist/prosekit-svelte-code-block-popover.js",
60
- "import": "./dist/prosekit-svelte-code-block-popover.js",
61
- "default": "./dist/prosekit-svelte-code-block-popover.js"
62
- },
63
57
  "./combo-box": {
64
58
  "types": "./dist/prosekit-svelte-combo-box.d.ts",
65
59
  "svelte": "./dist/prosekit-svelte-combo-box.js",
@@ -84,6 +78,12 @@
84
78
  "import": "./dist/prosekit-svelte-combo-box-list.js",
85
79
  "default": "./dist/prosekit-svelte-combo-box-list.js"
86
80
  },
81
+ "./inline-popover": {
82
+ "types": "./dist/prosekit-svelte-inline-popover.d.ts",
83
+ "svelte": "./dist/prosekit-svelte-inline-popover.js",
84
+ "import": "./dist/prosekit-svelte-inline-popover.js",
85
+ "default": "./dist/prosekit-svelte-inline-popover.js"
86
+ },
87
87
  "./popover": {
88
88
  "types": "./dist/prosekit-svelte-popover.d.ts",
89
89
  "svelte": "./dist/prosekit-svelte-popover.js",
@@ -95,8 +95,8 @@
95
95
  "dist"
96
96
  ],
97
97
  "dependencies": {
98
- "@prosekit/core": "^0.0.18",
99
- "@prosekit/lit": "^0.0.22"
98
+ "@prosekit/core": "^0.0.20",
99
+ "@prosekit/lit": "^0.0.24"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "svelte": ">= 3.0.0"
@@ -109,9 +109,9 @@
109
109
  "devDependencies": {
110
110
  "@prosekit/dev": "*",
111
111
  "@sveltejs/package": "^2.2.2",
112
- "@types/node": "^20.8.10",
112
+ "@types/node": "^20.9.0",
113
113
  "read-pkg": "^9.0.0",
114
- "svelte": "^4.2.2",
114
+ "svelte": "^4.2.3",
115
115
  "svelte-check": "^3.5.2",
116
116
  "tsx": "^3.14.0",
117
117
  "typescript": "^5.2.2",
@@ -138,9 +138,6 @@
138
138
  "autocomplete-popover": [
139
139
  "./dist/prosekit-svelte-autocomplete-popover.d.ts"
140
140
  ],
141
- "code-block-popover": [
142
- "./dist/prosekit-svelte-code-block-popover.d.ts"
143
- ],
144
141
  "combo-box": [
145
142
  "./dist/prosekit-svelte-combo-box.d.ts"
146
143
  ],
@@ -153,6 +150,9 @@
153
150
  "combo-box-list": [
154
151
  "./dist/prosekit-svelte-combo-box-list.d.ts"
155
152
  ],
153
+ "inline-popover": [
154
+ "./dist/prosekit-svelte-inline-popover.d.ts"
155
+ ],
156
156
  "popover": [
157
157
  "./dist/prosekit-svelte-popover.d.ts"
158
158
  ]
@@ -1,7 +0,0 @@
1
- import type { CodeBlockPopoverProps as CodeBlockPopoverElementProps } from '@prosekit/lit/code-block-popover';
2
- import type { SvelteComponent } from 'svelte';
3
- export type CodeBlockPopoverProps = {
4
- class?: string;
5
- } & CodeBlockPopoverElementProps;
6
- export declare const CodeBlockPopover: typeof SvelteComponent<CodeBlockPopoverProps>;
7
- //# sourceMappingURL=code-block-popover.gen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-block-popover.gen.d.ts","sourceRoot":"","sources":["../../../../src/components/code-block-popover.gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,IAAI,4BAA4B,EAAE,MAAM,kCAAkC,CAAA;AAC7G,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,2 +0,0 @@
1
- import CodeBlockPopoverComponent from './code-block-popover.gen.svelte';
2
- export const CodeBlockPopover = CodeBlockPopoverComponent;
@@ -1,7 +0,0 @@
1
- <script lang="ts">
2
- import '@prosekit/lit/code-block-popover'
3
- </script>
4
-
5
- <prosekit-code-block-popover {...$$props}>
6
- <slot />
7
- </prosekit-code-block-popover>
@@ -1,20 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import '@prosekit/lit/code-block-popover';
3
- declare const __propDef: {
4
- props: {
5
- [x: string]: any;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type CodeBlockPopoverProps = typeof __propDef.props;
15
- export type CodeBlockPopoverEvents = typeof __propDef.events;
16
- export type CodeBlockPopoverSlots = typeof __propDef.slots;
17
- export default class CodeBlockPopover extends SvelteComponentTyped<CodeBlockPopoverProps, CodeBlockPopoverEvents, CodeBlockPopoverSlots> {
18
- }
19
- export {};
20
- //# sourceMappingURL=code-block-popover.gen.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-block-popover.gen.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/code-block-popover.gen.svelte"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAE5C;AACD,OAAO,kCAAkC,CAAA;AAYzC,QAAA,MAAM,SAAS;;;;;;;;;;CAA+D,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC;AAC3D,MAAM,MAAM,sBAAsB,GAAG,OAAO,SAAS,CAAC,MAAM,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC;AAE3D,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,oBAAoB,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,CAAC;CACvI"}
@@ -1 +0,0 @@
1
- export * from './build/components/code-block-popover.gen'
@@ -1 +0,0 @@
1
- export * from './build/components/code-block-popover.gen'