@prosekit/svelte 0.0.19 → 0.0.21

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.
@@ -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,8 +1,11 @@
1
1
  import { type Editor, type Extension } from '@prosekit/core';
2
+ import { type Readable } from 'svelte/store';
2
3
  export interface EditorContext {
3
4
  editor: Editor;
4
5
  }
5
6
  export declare function setEditorContext(editor: Editor): void;
6
7
  export declare function getEditorContext(): EditorContext;
7
- export declare function getEditor<E extends Extension = any>(): Editor<E>;
8
+ export declare function getEditor<E extends Extension = any>(options?: {
9
+ update?: boolean;
10
+ }): Readable<Editor<E>>;
8
11
  //# 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,EAAiB,KAAK,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG3E,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,KAAK,MAAM,CAAC,CAAC,CAAC,CAEhE"}
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,5 +1,6 @@
1
- import { ProseKitError } from '@prosekit/core';
2
- import { getContext, hasContext, setContext } from 'svelte';
1
+ import { ProseKitError, defineEventHandler, } from '@prosekit/core';
2
+ import { getContext, hasContext, onDestroy, onMount, setContext } from 'svelte';
3
+ import { readonly, writable } from 'svelte/store';
3
4
  const key = 'prosekit-svelte-editor-context';
4
5
  export function setEditorContext(editor) {
5
6
  if (!editor) {
@@ -14,6 +15,19 @@ export function getEditorContext() {
14
15
  }
15
16
  return getContext(key);
16
17
  }
17
- export function getEditor() {
18
- return getEditorContext().editor;
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);
19
33
  }
@@ -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.19",
4
+ "version": "0.0.21",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -84,6 +84,12 @@
84
84
  "import": "./dist/prosekit-svelte-combo-box-list.js",
85
85
  "default": "./dist/prosekit-svelte-combo-box-list.js"
86
86
  },
87
+ "./inline-popover": {
88
+ "types": "./dist/prosekit-svelte-inline-popover.d.ts",
89
+ "svelte": "./dist/prosekit-svelte-inline-popover.js",
90
+ "import": "./dist/prosekit-svelte-inline-popover.js",
91
+ "default": "./dist/prosekit-svelte-inline-popover.js"
92
+ },
87
93
  "./popover": {
88
94
  "types": "./dist/prosekit-svelte-popover.d.ts",
89
95
  "svelte": "./dist/prosekit-svelte-popover.js",
@@ -95,8 +101,8 @@
95
101
  "dist"
96
102
  ],
97
103
  "dependencies": {
98
- "@prosekit/core": "^0.0.17",
99
- "@prosekit/lit": "^0.0.21"
104
+ "@prosekit/core": "^0.0.19",
105
+ "@prosekit/lit": "^0.0.23"
100
106
  },
101
107
  "peerDependencies": {
102
108
  "svelte": ">= 3.0.0"
@@ -110,7 +116,7 @@
110
116
  "@prosekit/dev": "*",
111
117
  "@sveltejs/package": "^2.2.2",
112
118
  "@types/node": "^20.8.10",
113
- "read-pkg": "^8.1.0",
119
+ "read-pkg": "^9.0.0",
114
120
  "svelte": "^4.2.2",
115
121
  "svelte-check": "^3.5.2",
116
122
  "tsx": "^3.14.0",
@@ -153,6 +159,9 @@
153
159
  "combo-box-list": [
154
160
  "./dist/prosekit-svelte-combo-box-list.d.ts"
155
161
  ],
162
+ "inline-popover": [
163
+ "./dist/prosekit-svelte-inline-popover.d.ts"
164
+ ],
156
165
  "popover": [
157
166
  "./dist/prosekit-svelte-popover.d.ts"
158
167
  ]