@viveeditor/svelte 0.0.0-stage → 1.0.0-rc.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 viveEditor contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,29 @@
1
- # Temporary Holding Version
1
+ # @viveeditor/svelte
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Svelte 5 component and action for viveEditor with bind:value, toolbar and every feature included.
4
+
5
+ Part of [viveEditor](https://github.com/mtvrkan/viveeditor#readme), a free, open-source rich text editor.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @viveeditor/svelte viveeditor
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```svelte
16
+ <script>
17
+ import { ViveEditor } from '@viveeditor/svelte'
18
+ import 'viveeditor/style.css'
19
+ let html = $state('')
20
+ </script>
21
+
22
+ <ViveEditor bind:value={html} locale="tr" label="Article body" />
23
+ ```
24
+
25
+ Svelte 5. The `use:viveEditor` action works on any element.
26
+
27
+ ## License
28
+
29
+ MIT
@@ -0,0 +1,50 @@
1
+ <script lang="ts">
2
+ import type { Editor } from 'viveeditor'
3
+ import { type ViveEditorOptions, viveEditor } from './action.js'
4
+
5
+ interface Props
6
+ extends Pick<ViveEditorOptions, 'extensions' | 'ui' | 'locale' | 'label' | 'editable'> {
7
+ value?: string
8
+ editor?: Editor | null
9
+ id?: string
10
+ class?: string
11
+ onchange?: (html: string, editor: Editor) => void
12
+ onready?: (editor: Editor) => void
13
+ onfocus?: (editor: Editor) => void
14
+ onblur?: (editor: Editor) => void
15
+ onerror?: (error: unknown) => void
16
+ }
17
+
18
+ let {
19
+ value = $bindable(''),
20
+ editor = $bindable(null),
21
+ id,
22
+ class: className,
23
+ onchange,
24
+ onready,
25
+ onfocus,
26
+ onblur,
27
+ onerror,
28
+ ...options
29
+ }: Props = $props()
30
+ </script>
31
+
32
+ <div
33
+ {id}
34
+ class={className}
35
+ use:viveEditor={{
36
+ ...options,
37
+ value,
38
+ onChange: (html, current) => {
39
+ value = html
40
+ onchange?.(html, current)
41
+ },
42
+ onReady: (current) => {
43
+ editor = current
44
+ onready?.(current)
45
+ },
46
+ onFocus: (current) => onfocus?.(current),
47
+ onBlur: (current) => onblur?.(current),
48
+ onError: (error) => onerror?.(error),
49
+ }}
50
+ ></div>
@@ -0,0 +1,16 @@
1
+ import type { Editor } from 'viveeditor';
2
+ import { type ViveEditorOptions } from './action.js';
3
+ interface Props extends Pick<ViveEditorOptions, 'extensions' | 'ui' | 'locale' | 'label' | 'editable'> {
4
+ value?: string;
5
+ editor?: Editor | null;
6
+ id?: string;
7
+ class?: string;
8
+ onchange?: (html: string, editor: Editor) => void;
9
+ onready?: (editor: Editor) => void;
10
+ onfocus?: (editor: Editor) => void;
11
+ onblur?: (editor: Editor) => void;
12
+ onerror?: (error: unknown) => void;
13
+ }
14
+ declare const ViveEditor: import("svelte").Component<Props, {}, "value" | "editor">;
15
+ type ViveEditor = ReturnType<typeof ViveEditor>;
16
+ export default ViveEditor;
@@ -0,0 +1,14 @@
1
+ import { type Editor, type MountOptions } from 'viveeditor';
2
+ export interface ViveEditorOptions extends Pick<MountOptions, 'extensions' | 'ui' | 'locale' | 'label' | 'onError'> {
3
+ value?: string;
4
+ editable?: boolean;
5
+ onChange?: (html: string, editor: Editor) => void;
6
+ onReady?: (editor: Editor) => void;
7
+ onFocus?: (editor: Editor) => void;
8
+ onBlur?: (editor: Editor) => void;
9
+ }
10
+ export interface ViveEditorAction {
11
+ update(options: ViveEditorOptions): void;
12
+ destroy(): void;
13
+ }
14
+ export declare function viveEditor(host: HTMLElement, options?: ViveEditorOptions): ViveEditorAction;
package/dist/action.js ADDED
@@ -0,0 +1,29 @@
1
+ import { mountEditor } from 'viveeditor';
2
+ export function viveEditor(host, options = {}) {
3
+ let latest = options;
4
+ const { value, editable, extensions, ui, locale, label } = options;
5
+ const mount = mountEditor(host, {
6
+ value: value ?? '',
7
+ editable: editable ?? true,
8
+ ...(extensions === undefined ? {} : { extensions }),
9
+ ...(ui === undefined ? {} : { ui }),
10
+ ...(locale === undefined ? {} : { locale }),
11
+ ...(label === undefined ? {} : { label }),
12
+ onChange: (html, current) => latest.onChange?.(html, current),
13
+ onReady: (current) => latest.onReady?.(current),
14
+ onFocus: (current) => latest.onFocus?.(current),
15
+ onBlur: (current) => latest.onBlur?.(current),
16
+ onError: (error) => latest.onError?.(error),
17
+ });
18
+ return {
19
+ update(next) {
20
+ latest = next;
21
+ if (next.value !== undefined)
22
+ mount.setValue(next.value);
23
+ mount.setEditable(next.editable ?? true);
24
+ },
25
+ destroy() {
26
+ mount.destroy();
27
+ },
28
+ };
29
+ }
@@ -0,0 +1,2 @@
1
+ export { type ViveEditorAction, type ViveEditorOptions, viveEditor } from './action.js';
2
+ export { default as ViveEditor } from './ViveEditor.svelte';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { viveEditor } from './action.js';
2
+ export { default as ViveEditor } from './ViveEditor.svelte';
package/package.json CHANGED
@@ -1,6 +1,77 @@
1
1
  {
2
2
  "name": "@viveeditor/svelte",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Svelte 5 component and action for viveEditor with bind:value, toolbar and every feature included.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "viveeditor",
8
+ "rich-text-editor",
9
+ "wysiwyg",
10
+ "editor",
11
+ "prosemirror",
12
+ "svelte",
13
+ "svelte5"
14
+ ],
15
+ "homepage": "https://editor.vivepdf.com/en/docs/frameworks/",
16
+ "bugs": {
17
+ "url": "https://github.com/mtvrkan/viveeditor/issues"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/mtvrkan/viveeditor.git",
22
+ "directory": "packages/svelte"
23
+ },
24
+ "type": "module",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "svelte": "./dist/index.js",
29
+ "default": "./dist/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "dependencies": {
36
+ "viveeditor": "^1.0.0-rc.1"
37
+ },
38
+ "devDependencies": {
39
+ "@size-limit/preset-small-lib": "^14.3.0",
40
+ "@sveltejs/package": "^3.0.1",
41
+ "@sveltejs/vite-plugin-svelte": "^7.3.1",
42
+ "@testing-library/svelte": "^5.4.2",
43
+ "jsdom": "^30.1.3",
44
+ "size-limit": "^14.3.0",
45
+ "svelte": "^5.57.2",
46
+ "svelte-check": "^4.7.7",
47
+ "vitest": "^5.0.5"
48
+ },
49
+ "size-limit": [
50
+ {
51
+ "name": "@viveeditor/svelte action",
52
+ "path": "dist/action.js",
53
+ "ignore": [
54
+ "viveeditor"
55
+ ],
56
+ "limit": "1 KB"
57
+ }
58
+ ],
59
+ "sideEffects": false,
60
+ "peerDependencies": {
61
+ "svelte": "^5.0.0"
62
+ },
63
+ "svelte": "./dist/index.js",
64
+ "engines": {
65
+ "node": ">=22.12"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public",
69
+ "provenance": true
70
+ },
71
+ "scripts": {
72
+ "build": "svelte-package -i src -o dist",
73
+ "typecheck": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings",
74
+ "test": "vitest run",
75
+ "size": "size-limit"
76
+ }
6
77
  }