@prosekit/svelte 0.6.7 → 0.6.9

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.
@@ -1,2 +1,2 @@
1
1
  import type { EventHandler } from 'svelte/elements';
2
- export declare function useComponent(propNames: string[], eventNames: string[]): (element: HTMLElement | undefined, $$props: Record<string, unknown>) => readonly [Record<string, unknown>, Record<string, EventHandler>];
2
+ export declare function useComponent(propNames: string[], eventNames: string[]): (element: HTMLElement | undefined, $$props: Record<string, unknown>) => [Record<string, unknown>, Record<string, EventHandler>];
@@ -5,7 +5,7 @@ import { useEditorContext } from '../contexts/editor-context';
5
5
  // on the element manually and only let Svelte set the attributes.
6
6
  export function useComponent(propNames, eventNames) {
7
7
  const hasEditor = propNames.includes('editor');
8
- const lowerCaseEventNameMap = Object.fromEntries(eventNames.map((name) => [name.toLowerCase(), name]));
8
+ const lowerCaseEventNameMap = new Map(eventNames.map((name) => [name.toLowerCase(), name]));
9
9
  const editorContext = useEditorContext();
10
10
  function handleChange(element, $$props) {
11
11
  const properties = {};
@@ -21,12 +21,14 @@ export function useComponent(propNames, eventNames) {
21
21
  }
22
22
  if (name.startsWith('on')) {
23
23
  const lowerCaseEventName = name.slice(2).toLowerCase();
24
- const eventName = lowerCaseEventNameMap[lowerCaseEventName];
24
+ const eventName = lowerCaseEventNameMap.get(lowerCaseEventName);
25
25
  if (eventName) {
26
26
  const extractDetail = eventName.endsWith('Change');
27
27
  eventHandlers[eventName] = (event) => {
28
28
  const handler = value;
29
- handler(extractDetail ? event.detail : event);
29
+ if (typeof handler === 'function') {
30
+ handler(extractDetail ? event.detail : event);
31
+ }
30
32
  };
31
33
  continue;
32
34
  }
@@ -29,4 +29,4 @@ export interface SvelteMarkViewOptions extends CoreMarkViewUserOptions<SvelteMar
29
29
  * @public
30
30
  */
31
31
  export declare function defineSvelteMarkView(options: SvelteMarkViewOptions): Extension;
32
- export declare function defineSvelteMarkViewFactory(factory: (options: SvelteMarkViewUserOptions) => MarkViewConstructor): Extension<import("@prosekit/core").ExtensionTyping<any, any, any>>;
32
+ export declare function defineSvelteMarkViewFactory(factory: (options: SvelteMarkViewUserOptions) => MarkViewConstructor): Extension;
@@ -29,4 +29,4 @@ export interface SvelteNodeViewOptions extends CoreNodeViewUserOptions<SvelteNod
29
29
  * @public
30
30
  */
31
31
  export declare function defineSvelteNodeView(options: SvelteNodeViewOptions): Extension;
32
- export declare function defineSvelteNodeViewFactory(factory: (options: SvelteNodeViewUserOptions) => NodeViewConstructor): Extension<import("@prosekit/core").ExtensionTyping<any, any, any>>;
32
+ export declare function defineSvelteNodeViewFactory(factory: (options: SvelteNodeViewUserOptions) => NodeViewConstructor): Extension;
@@ -8,5 +8,5 @@ import { useExtension, } from './use-extension';
8
8
  */
9
9
  export function useDocChange(handler, options) {
10
10
  const extension = defineDocChangeHandler((view) => handler(view.state.doc));
11
- return useExtension(readable(extension), options);
11
+ useExtension(readable(extension), options);
12
12
  }
@@ -3,5 +3,5 @@ import { derived, } from 'svelte/store';
3
3
  import { useExtension, } from './use-extension';
4
4
  export function useKeymap(keymapStore, options) {
5
5
  const extension = derived(keymapStore, (keymap) => defineKeymap(keymap));
6
- return useExtension(extension, options);
6
+ useExtension(extension, options);
7
7
  }
@@ -8,5 +8,5 @@ import { useExtension, } from './use-extension';
8
8
  */
9
9
  export function useStateUpdate(handler, options) {
10
10
  const extension = defineUpdateHandler((view) => handler(view.state));
11
- return useExtension(readable(extension), options);
11
+ useExtension(readable(extension), options);
12
12
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@prosekit/svelte",
3
3
  "type": "module",
4
- "version": "0.6.7",
4
+ "version": "0.6.9",
5
5
  "private": false,
6
+ "description": "Svelte components and utilities for ProseKit",
6
7
  "author": {
7
8
  "name": "ocavue",
8
9
  "email": "ocavue@gmail.com"
@@ -71,9 +72,9 @@
71
72
  "dependencies": {
72
73
  "@prosemirror-adapter/core": "^0.4.0",
73
74
  "@prosemirror-adapter/svelte": "^0.4.1",
74
- "@prosekit/core": "^0.8.0",
75
- "@prosekit/web": "^0.5.7",
76
- "@prosekit/pm": "^0.1.9"
75
+ "@prosekit/core": "^0.8.1",
76
+ "@prosekit/pm": "^0.1.10",
77
+ "@prosekit/web": "^0.5.9"
77
78
  },
78
79
  "peerDependencies": {
79
80
  "svelte": ">= 5.0.0"
@@ -84,15 +85,30 @@
84
85
  }
85
86
  },
86
87
  "devDependencies": {
87
- "@sveltejs/package": "^2.3.10",
88
- "@types/node": "^20.17.24",
88
+ "@sveltejs/package": "^2.3.11",
89
+ "@types/node": "^20.17.29",
89
90
  "read-pkg": "^9.0.1",
90
- "svelte": "^5.25.3",
91
- "svelte-check": "^4.1.5",
92
- "tsx": "^4.19.3",
93
- "typescript": "~5.7.3",
94
- "vitest": "^3.0.9",
95
- "@prosekit/dev": "0.0.0"
91
+ "svelte": "^5.33.6",
92
+ "svelte-check": "^4.2.1",
93
+ "tsx": "^4.19.4",
94
+ "typescript": "~5.8.3",
95
+ "vitest": "^3.1.4",
96
+ "@prosekit/config-vitest": "0.0.0"
97
+ },
98
+ "publishConfig": {
99
+ "dev": {}
100
+ },
101
+ "dev": {
102
+ "entry": {
103
+ "prosekit-svelte": "./src/index.ts",
104
+ "prosekit-svelte-autocomplete": "./src/components/autocomplete/index.gen.ts",
105
+ "prosekit-svelte-block-handle": "./src/components/block-handle/index.gen.ts",
106
+ "prosekit-svelte-inline-popover": "./src/components/inline-popover/index.gen.ts",
107
+ "prosekit-svelte-popover": "./src/components/popover/index.gen.ts",
108
+ "prosekit-svelte-resizable": "./src/components/resizable/index.gen.ts",
109
+ "prosekit-svelte-table-handle": "./src/components/table-handle/index.gen.ts",
110
+ "prosekit-svelte-tooltip": "./src/components/tooltip/index.gen.ts"
111
+ }
96
112
  },
97
113
  "scripts": {
98
114
  "build": "svelte-package -i src -o dist/build && tsx scripts/re-export.ts"