@vizel/svelte 0.0.1-alpha.6 → 1.0.0
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/README.md +1 -1
- package/dist/components/Vizel.svelte +16 -0
- package/dist/components/Vizel.svelte.d.ts +6 -0
- package/dist/components/Vizel.svelte.d.ts.map +1 -1
- package/dist/components/VizelBubbleMenuDefault.svelte +4 -0
- package/dist/components/VizelBubbleMenuDefault.svelte.d.ts.map +1 -1
- package/dist/components/VizelToolbar.svelte +40 -0
- package/dist/components/VizelToolbar.svelte.d.ts +18 -0
- package/dist/components/VizelToolbar.svelte.d.ts.map +1 -0
- package/dist/components/VizelToolbarButton.svelte +45 -0
- package/dist/components/VizelToolbarButton.svelte.d.ts +21 -0
- package/dist/components/VizelToolbarButton.svelte.d.ts.map +1 -0
- package/dist/components/VizelToolbarDefault.svelte +56 -0
- package/dist/components/VizelToolbarDefault.svelte.d.ts +13 -0
- package/dist/components/VizelToolbarDefault.svelte.d.ts.map +1 -0
- package/dist/components/VizelToolbarDivider.svelte +12 -0
- package/dist/components/VizelToolbarDivider.svelte.d.ts +8 -0
- package/dist/components/VizelToolbarDivider.svelte.d.ts.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/runes/createVizelEditor.svelte.d.ts.map +1 -1
- package/dist/runes/createVizelEditor.svelte.js +26 -15
- package/package.json +34 -14
package/README.md
CHANGED
|
@@ -44,6 +44,10 @@ export interface VizelProps {
|
|
|
44
44
|
features?: VizelFeatureOptions;
|
|
45
45
|
/** Custom class name for the editor container */
|
|
46
46
|
class?: string;
|
|
47
|
+
/** Whether to show the toolbar (default: false) */
|
|
48
|
+
showToolbar?: boolean;
|
|
49
|
+
/** Custom toolbar content */
|
|
50
|
+
toolbar?: Snippet<[{ editor: Editor }]>;
|
|
47
51
|
/** Whether to show the bubble menu (default: true) */
|
|
48
52
|
showBubbleMenu?: boolean;
|
|
49
53
|
/** Enable embed option in bubble menu link editor (requires Embed extension) */
|
|
@@ -75,11 +79,14 @@ import { getVizelMarkdown, setVizelMarkdown } from "@vizel/core";
|
|
|
75
79
|
import { createVizelEditor } from "../runes/createVizelEditor.svelte.ts";
|
|
76
80
|
import VizelBubbleMenu from "./VizelBubbleMenu.svelte";
|
|
77
81
|
import VizelEditor from "./VizelEditor.svelte";
|
|
82
|
+
import VizelToolbar from "./VizelToolbar.svelte";
|
|
78
83
|
|
|
79
84
|
// Use $props() without destructuring to avoid state_referenced_locally warnings
|
|
80
85
|
// Props are intentionally captured once at editor creation time
|
|
81
86
|
let {
|
|
82
87
|
class: className,
|
|
88
|
+
showToolbar = false,
|
|
89
|
+
toolbar,
|
|
83
90
|
showBubbleMenu = true,
|
|
84
91
|
enableEmbed = false,
|
|
85
92
|
bubbleMenu,
|
|
@@ -144,6 +151,15 @@ $effect(() => {
|
|
|
144
151
|
</script>
|
|
145
152
|
|
|
146
153
|
<div class="vizel-root {className ?? ''}" data-vizel-root>
|
|
154
|
+
{#if showToolbar && editor && toolbar}
|
|
155
|
+
<VizelToolbar {editor}>
|
|
156
|
+
{#snippet children({ editor: e })}
|
|
157
|
+
{@render toolbar({ editor: e })}
|
|
158
|
+
{/snippet}
|
|
159
|
+
</VizelToolbar>
|
|
160
|
+
{:else if showToolbar && editor}
|
|
161
|
+
<VizelToolbar {editor} />
|
|
162
|
+
{/if}
|
|
147
163
|
<VizelEditor {editor} />
|
|
148
164
|
{#if showBubbleMenu && editor && bubbleMenu}
|
|
149
165
|
<VizelBubbleMenu {editor} {enableEmbed}>
|
|
@@ -41,6 +41,12 @@ export interface VizelProps {
|
|
|
41
41
|
features?: VizelFeatureOptions;
|
|
42
42
|
/** Custom class name for the editor container */
|
|
43
43
|
class?: string;
|
|
44
|
+
/** Whether to show the toolbar (default: false) */
|
|
45
|
+
showToolbar?: boolean;
|
|
46
|
+
/** Custom toolbar content */
|
|
47
|
+
toolbar?: Snippet<[{
|
|
48
|
+
editor: Editor;
|
|
49
|
+
}]>;
|
|
44
50
|
/** Whether to show the bubble menu (default: true) */
|
|
45
51
|
showBubbleMenu?: boolean;
|
|
46
52
|
/** Enable embed option in bubble menu link editor (requires Embed extension) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vizel.svelte.d.ts","sourceRoot":"","sources":["../../src/components/Vizel.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IACvD,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gFAAgF;IAChF,WAAW,CAAC,EAAE,OAAO,CAAC;IACt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AI,CAAC;IAC/C,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACxD,sCAAsC;IACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9C,uCAAuC;IACvC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC9C;AAsHD,QAAA,MAAM,KAAK,wDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -15,6 +15,7 @@ export interface VizelBubbleMenuDefaultProps {
|
|
|
15
15
|
import { createVizelState } from "../runes/createVizelState.svelte.ts";
|
|
16
16
|
import VizelBubbleMenuButton from "./VizelBubbleMenuButton.svelte";
|
|
17
17
|
import VizelBubbleMenuColorPicker from "./VizelBubbleMenuColorPicker.svelte";
|
|
18
|
+
import VizelBubbleMenuDivider from "./VizelBubbleMenuDivider.svelte";
|
|
18
19
|
import VizelLinkEditor from "./VizelLinkEditor.svelte";
|
|
19
20
|
import VizelIcon from "./VizelIcon.svelte";
|
|
20
21
|
import VizelNodeSelector from "./VizelNodeSelector.svelte";
|
|
@@ -57,6 +58,7 @@ const isLinkActive = $derived.by(() => {
|
|
|
57
58
|
{:else}
|
|
58
59
|
<div class="vizel-bubble-menu-toolbar {className ?? ''}">
|
|
59
60
|
<VizelNodeSelector {editor} />
|
|
61
|
+
<VizelBubbleMenuDivider />
|
|
60
62
|
<VizelBubbleMenuButton
|
|
61
63
|
action="bold"
|
|
62
64
|
isActive={isBoldActive}
|
|
@@ -97,6 +99,7 @@ const isLinkActive = $derived.by(() => {
|
|
|
97
99
|
>
|
|
98
100
|
<VizelIcon name="code" />
|
|
99
101
|
</VizelBubbleMenuButton>
|
|
102
|
+
<VizelBubbleMenuDivider />
|
|
100
103
|
<VizelBubbleMenuButton
|
|
101
104
|
action="link"
|
|
102
105
|
isActive={isLinkActive}
|
|
@@ -105,6 +108,7 @@ const isLinkActive = $derived.by(() => {
|
|
|
105
108
|
>
|
|
106
109
|
<VizelIcon name="link" />
|
|
107
110
|
</VizelBubbleMenuButton>
|
|
111
|
+
<VizelBubbleMenuDivider />
|
|
108
112
|
<VizelBubbleMenuColorPicker {editor} type="textColor" />
|
|
109
113
|
<VizelBubbleMenuColorPicker {editor} type="highlight" />
|
|
110
114
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VizelBubbleMenuDefault.svelte.d.ts","sourceRoot":"","sources":["../../src/components/VizelBubbleMenuDefault.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,2BAA2B;IAC1C,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"VizelBubbleMenuDefault.svelte.d.ts","sourceRoot":"","sources":["../../src/components/VizelBubbleMenuDefault.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,2BAA2B;IAC1C,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAwFD,QAAA,MAAM,sBAAsB,iEAAwC,CAAC;AACrE,KAAK,sBAAsB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACxE,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Editor } from "@vizel/core";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
|
|
5
|
+
export interface VizelToolbarProps {
|
|
6
|
+
/** Editor instance. Falls back to context if not provided. */
|
|
7
|
+
editor?: Editor | null;
|
|
8
|
+
/** Custom class name */
|
|
9
|
+
class?: string;
|
|
10
|
+
/** Whether to show the default toolbar (default: true). Set to false when using custom children. */
|
|
11
|
+
showDefaultToolbar?: boolean;
|
|
12
|
+
/** Custom toolbar content */
|
|
13
|
+
children?: Snippet<[{ editor: Editor }]>;
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { getVizelContextSafe } from "./VizelContext.ts";
|
|
19
|
+
import VizelToolbarDefault from "./VizelToolbarDefault.svelte";
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
editor: editorProp,
|
|
23
|
+
class: className,
|
|
24
|
+
showDefaultToolbar = true,
|
|
25
|
+
children,
|
|
26
|
+
}: VizelToolbarProps = $props();
|
|
27
|
+
|
|
28
|
+
const contextEditor = getVizelContextSafe();
|
|
29
|
+
const editor = $derived(editorProp ?? contextEditor?.() ?? null);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
{#if editor}
|
|
33
|
+
<div class="vizel-toolbar {className ?? ''}" role="toolbar" aria-label="Formatting">
|
|
34
|
+
{#if children}
|
|
35
|
+
{@render children({ editor })}
|
|
36
|
+
{:else if showDefaultToolbar}
|
|
37
|
+
<VizelToolbarDefault {editor} />
|
|
38
|
+
{/if}
|
|
39
|
+
</div>
|
|
40
|
+
{/if}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Editor } from "@vizel/core";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
export interface VizelToolbarProps {
|
|
4
|
+
/** Editor instance. Falls back to context if not provided. */
|
|
5
|
+
editor?: Editor | null;
|
|
6
|
+
/** Custom class name */
|
|
7
|
+
class?: string;
|
|
8
|
+
/** Whether to show the default toolbar (default: true). Set to false when using custom children. */
|
|
9
|
+
showDefaultToolbar?: boolean;
|
|
10
|
+
/** Custom toolbar content */
|
|
11
|
+
children?: Snippet<[{
|
|
12
|
+
editor: Editor;
|
|
13
|
+
}]>;
|
|
14
|
+
}
|
|
15
|
+
declare const VizelToolbar: import("svelte").Component<VizelToolbarProps, {}, "">;
|
|
16
|
+
type VizelToolbar = ReturnType<typeof VizelToolbar>;
|
|
17
|
+
export default VizelToolbar;
|
|
18
|
+
//# sourceMappingURL=VizelToolbar.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VizelToolbar.svelte.d.ts","sourceRoot":"","sources":["../../src/components/VizelToolbar.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oGAAoG;IACpG,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CAC1C;AAmCD,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
export interface VizelToolbarButtonProps {
|
|
5
|
+
/** Whether the button is in active state */
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
/** Whether the button is disabled */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Tooltip title */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Custom class name */
|
|
12
|
+
class?: string;
|
|
13
|
+
/** Button content */
|
|
14
|
+
children: Snippet;
|
|
15
|
+
/** Click handler */
|
|
16
|
+
onclick?: () => void;
|
|
17
|
+
/** Action identifier for testing */
|
|
18
|
+
action?: string;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
let {
|
|
24
|
+
isActive = false,
|
|
25
|
+
disabled = false,
|
|
26
|
+
title,
|
|
27
|
+
class: className,
|
|
28
|
+
children,
|
|
29
|
+
onclick,
|
|
30
|
+
action,
|
|
31
|
+
}: VizelToolbarButtonProps = $props();
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<button
|
|
35
|
+
type="button"
|
|
36
|
+
{disabled}
|
|
37
|
+
aria-pressed={isActive}
|
|
38
|
+
class="vizel-toolbar-button {isActive ? 'is-active' : ''} {className ?? ''}"
|
|
39
|
+
{title}
|
|
40
|
+
data-active={isActive || undefined}
|
|
41
|
+
data-action={action}
|
|
42
|
+
{onclick}
|
|
43
|
+
>
|
|
44
|
+
{@render children()}
|
|
45
|
+
</button>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface VizelToolbarButtonProps {
|
|
3
|
+
/** Whether the button is in active state */
|
|
4
|
+
isActive?: boolean;
|
|
5
|
+
/** Whether the button is disabled */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Tooltip title */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Custom class name */
|
|
10
|
+
class?: string;
|
|
11
|
+
/** Button content */
|
|
12
|
+
children: Snippet;
|
|
13
|
+
/** Click handler */
|
|
14
|
+
onclick?: () => void;
|
|
15
|
+
/** Action identifier for testing */
|
|
16
|
+
action?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const VizelToolbarButton: import("svelte").Component<VizelToolbarButtonProps, {}, "">;
|
|
19
|
+
type VizelToolbarButton = ReturnType<typeof VizelToolbarButton>;
|
|
20
|
+
export default VizelToolbarButton;
|
|
21
|
+
//# sourceMappingURL=VizelToolbarButton.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VizelToolbarButton.svelte.d.ts","sourceRoot":"","sources":["../../src/components/VizelToolbarButton.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACtC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAsBD,QAAA,MAAM,kBAAkB,6DAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Editor, VizelToolbarAction } from "@vizel/core";
|
|
3
|
+
|
|
4
|
+
export interface VizelToolbarDefaultProps {
|
|
5
|
+
/** The editor instance */
|
|
6
|
+
editor: Editor;
|
|
7
|
+
/** Custom class name */
|
|
8
|
+
class?: string;
|
|
9
|
+
/** Custom toolbar actions (defaults to vizelDefaultToolbarActions) */
|
|
10
|
+
actions?: VizelToolbarAction[];
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import {
|
|
16
|
+
groupVizelToolbarActions,
|
|
17
|
+
vizelDefaultToolbarActions,
|
|
18
|
+
} from "@vizel/core";
|
|
19
|
+
import { createVizelState } from "../runes/createVizelState.svelte.ts";
|
|
20
|
+
import VizelIcon from "./VizelIcon.svelte";
|
|
21
|
+
import VizelToolbarButton from "./VizelToolbarButton.svelte";
|
|
22
|
+
import VizelToolbarDivider from "./VizelToolbarDivider.svelte";
|
|
23
|
+
|
|
24
|
+
let {
|
|
25
|
+
editor,
|
|
26
|
+
class: className,
|
|
27
|
+
actions = vizelDefaultToolbarActions,
|
|
28
|
+
}: VizelToolbarDefaultProps = $props();
|
|
29
|
+
|
|
30
|
+
// Subscribe to editor state changes to update active/enabled states
|
|
31
|
+
const editorState = createVizelState(() => editor);
|
|
32
|
+
|
|
33
|
+
const groups = $derived.by(() => {
|
|
34
|
+
void editorState.current;
|
|
35
|
+
return groupVizelToolbarActions(actions);
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<div class="vizel-toolbar-content {className ?? ''}" data-vizel-toolbar>
|
|
40
|
+
{#each groups as group, groupIndex (group[0]?.group ?? groupIndex)}
|
|
41
|
+
{#if groupIndex > 0}
|
|
42
|
+
<VizelToolbarDivider />
|
|
43
|
+
{/if}
|
|
44
|
+
{#each group as action (action.id)}
|
|
45
|
+
<VizelToolbarButton
|
|
46
|
+
action={action.id}
|
|
47
|
+
isActive={action.isActive(editor)}
|
|
48
|
+
disabled={!action.isEnabled(editor)}
|
|
49
|
+
title={action.shortcut ? `${action.label} (${action.shortcut})` : action.label}
|
|
50
|
+
onclick={() => action.run(editor)}
|
|
51
|
+
>
|
|
52
|
+
<VizelIcon name={action.icon} />
|
|
53
|
+
</VizelToolbarButton>
|
|
54
|
+
{/each}
|
|
55
|
+
{/each}
|
|
56
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Editor, VizelToolbarAction } from "@vizel/core";
|
|
2
|
+
export interface VizelToolbarDefaultProps {
|
|
3
|
+
/** The editor instance */
|
|
4
|
+
editor: Editor;
|
|
5
|
+
/** Custom class name */
|
|
6
|
+
class?: string;
|
|
7
|
+
/** Custom toolbar actions (defaults to vizelDefaultToolbarActions) */
|
|
8
|
+
actions?: VizelToolbarAction[];
|
|
9
|
+
}
|
|
10
|
+
declare const VizelToolbarDefault: import("svelte").Component<VizelToolbarDefaultProps, {}, "">;
|
|
11
|
+
type VizelToolbarDefault = ReturnType<typeof VizelToolbarDefault>;
|
|
12
|
+
export default VizelToolbarDefault;
|
|
13
|
+
//# sourceMappingURL=VizelToolbarDefault.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VizelToolbarDefault.svelte.d.ts","sourceRoot":"","sources":["../../src/components/VizelToolbarDefault.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,WAAW,wBAAwB;IACvC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAmDD,QAAA,MAAM,mBAAmB,8DAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export interface VizelToolbarDividerProps {
|
|
3
|
+
/** Custom class name */
|
|
4
|
+
class?: string;
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
let { class: className }: VizelToolbarDividerProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<span class="vizel-toolbar-divider {className ?? ''}"></span>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface VizelToolbarDividerProps {
|
|
2
|
+
/** Custom class name */
|
|
3
|
+
class?: string;
|
|
4
|
+
}
|
|
5
|
+
declare const VizelToolbarDivider: import("svelte").Component<VizelToolbarDividerProps, {}, "">;
|
|
6
|
+
type VizelToolbarDivider = ReturnType<typeof VizelToolbarDivider>;
|
|
7
|
+
export default VizelToolbarDivider;
|
|
8
|
+
//# sourceMappingURL=VizelToolbarDivider.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VizelToolbarDivider.svelte.d.ts","sourceRoot":"","sources":["../../src/components/VizelToolbarDivider.svelte.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,wBAAwB;IACvC,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAYD,QAAA,MAAM,mBAAmB,8DAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
|
|
@@ -20,4 +20,8 @@ export { default as VizelSlashMenu, type VizelSlashMenuProps, type VizelSlashMen
|
|
|
20
20
|
export { default as VizelSlashMenuEmpty, type VizelSlashMenuEmptyProps, } from "./VizelSlashMenuEmpty.svelte";
|
|
21
21
|
export { default as VizelSlashMenuItem, type VizelSlashMenuItemProps, } from "./VizelSlashMenuItem.svelte";
|
|
22
22
|
export { default as VizelThemeProvider, type VizelThemeProviderProps, } from "./VizelThemeProvider.svelte";
|
|
23
|
+
export { default as VizelToolbar, type VizelToolbarProps, } from "./VizelToolbar.svelte";
|
|
24
|
+
export { default as VizelToolbarButton, type VizelToolbarButtonProps, } from "./VizelToolbarButton.svelte";
|
|
25
|
+
export { default as VizelToolbarDefault, type VizelToolbarDefaultProps, } from "./VizelToolbarDefault.svelte";
|
|
26
|
+
export { default as VizelToolbarDivider, type VizelToolbarDividerProps, } from "./VizelToolbarDivider.svelte";
|
|
23
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAIlF,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,OAAO,IAAI,qBAAqB,EAChC,KAAK,0BAA0B,GAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,IAAI,0BAA0B,EACrC,KAAK,+BAA+B,GACrC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,OAAO,IAAI,sBAAsB,EACjC,KAAK,2BAA2B,GACjC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,OAAO,IAAI,sBAAsB,EACjC,KAAK,2BAA2B,GACjC,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,OAAO,IAAI,gBAAgB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIzE,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,OAAO,IAAI,cAAc,EACzB,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/E,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,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,OAAO,IAAI,cAAc,EACzB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,IAAI,mBAAmB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,KAAK,iBAAiB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,OAAO,IAAI,mBAAmB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,OAAO,IAAI,mBAAmB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,8BAA8B,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -62,3 +62,10 @@ export { default as VizelSlashMenuItem, } from "./VizelSlashMenuItem.svelte";
|
|
|
62
62
|
// Vizel ThemeProvider component
|
|
63
63
|
// ============================================================================
|
|
64
64
|
export { default as VizelThemeProvider, } from "./VizelThemeProvider.svelte";
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// Vizel Toolbar components
|
|
67
|
+
// ============================================================================
|
|
68
|
+
export { default as VizelToolbar, } from "./VizelToolbar.svelte";
|
|
69
|
+
export { default as VizelToolbarButton, } from "./VizelToolbarButton.svelte";
|
|
70
|
+
export { default as VizelToolbarDefault, } from "./VizelToolbarDefault.svelte";
|
|
71
|
+
export { default as VizelToolbarDivider, } from "./VizelToolbarDivider.svelte";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import "./tiptap-extensions.ts";
|
|
7
7
|
import "./iconRenderer.ts";
|
|
8
|
-
export { getVizelContext, getVizelContextSafe, getVizelIconContext, setVizelIcons, Vizel, VizelBubbleMenu, VizelBubbleMenuButton, type VizelBubbleMenuButtonProps, VizelBubbleMenuColorPicker, type VizelBubbleMenuColorPickerProps, VizelBubbleMenuDefault, type VizelBubbleMenuDefaultProps, VizelBubbleMenuDivider, type VizelBubbleMenuDividerProps, type VizelBubbleMenuProps, VizelColorPicker, type VizelColorPickerProps, VizelEditor, type VizelEditorProps, VizelEmbedView, type VizelEmbedViewProps, type VizelExposed, VizelIcon, type VizelIconProps, VizelIconProvider, type VizelIconProviderProps, VizelLinkEditor, type VizelLinkEditorProps, VizelNodeSelector, type VizelNodeSelectorProps, VizelPortal, type VizelPortalProps, type VizelProps, VizelProvider, type VizelProviderProps, type VizelRef, VizelSaveIndicator, type VizelSaveIndicatorProps, VizelSlashMenu, VizelSlashMenuEmpty, type VizelSlashMenuEmptyProps, VizelSlashMenuItem, type VizelSlashMenuItemProps, type VizelSlashMenuProps, type VizelSlashMenuRef, VizelThemeProvider, type VizelThemeProviderProps, } from "./components/index.ts";
|
|
8
|
+
export { getVizelContext, getVizelContextSafe, getVizelIconContext, setVizelIcons, Vizel, VizelBubbleMenu, VizelBubbleMenuButton, type VizelBubbleMenuButtonProps, VizelBubbleMenuColorPicker, type VizelBubbleMenuColorPickerProps, VizelBubbleMenuDefault, type VizelBubbleMenuDefaultProps, VizelBubbleMenuDivider, type VizelBubbleMenuDividerProps, type VizelBubbleMenuProps, VizelColorPicker, type VizelColorPickerProps, VizelEditor, type VizelEditorProps, VizelEmbedView, type VizelEmbedViewProps, type VizelExposed, VizelIcon, type VizelIconProps, VizelIconProvider, type VizelIconProviderProps, VizelLinkEditor, type VizelLinkEditorProps, VizelNodeSelector, type VizelNodeSelectorProps, VizelPortal, type VizelPortalProps, type VizelProps, VizelProvider, type VizelProviderProps, type VizelRef, VizelSaveIndicator, type VizelSaveIndicatorProps, VizelSlashMenu, VizelSlashMenuEmpty, type VizelSlashMenuEmptyProps, VizelSlashMenuItem, type VizelSlashMenuItemProps, type VizelSlashMenuProps, type VizelSlashMenuRef, VizelThemeProvider, type VizelThemeProviderProps, VizelToolbar, VizelToolbarButton, type VizelToolbarButtonProps, VizelToolbarDefault, type VizelToolbarDefaultProps, VizelToolbarDivider, type VizelToolbarDividerProps, type VizelToolbarProps, } from "./components/index.ts";
|
|
9
9
|
export { type CreateVizelAutoSaveResult, type CreateVizelEditorOptions, type CreateVizelMarkdownOptions, type CreateVizelMarkdownResult, createVizelAutoSave, createVizelEditor, createVizelEditorState, createVizelMarkdown, createVizelSlashMenuRenderer, createVizelState, getVizelTheme, getVizelThemeSafe, type VizelSlashMenuRendererOptions, } from "./runes/index.ts";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,wBAAwB,CAAC;AAGhC,OAAO,mBAAmB,CAAC;AAG3B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EAEb,KAAK,EAEL,eAAe,EACf,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,0BAA0B,EAC1B,KAAK,+BAA+B,EACpC,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAEzB,gBAAgB,EAChB,KAAK,qBAAqB,EAE1B,WAAW,EACX,KAAK,gBAAgB,EAErB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,SAAS,EACT,KAAK,cAAc,EACnB,iBAAiB,EACjB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uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,KAAK,uBAAuB,EAE5B,YAAY,EACZ,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,KAAK,6BAA6B,GACnC,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,8 @@ VizelPortal, VizelProvider,
|
|
|
28
28
|
// SaveIndicator
|
|
29
29
|
VizelSaveIndicator,
|
|
30
30
|
// SlashMenu
|
|
31
|
-
VizelSlashMenu, VizelSlashMenuEmpty, VizelSlashMenuItem, VizelThemeProvider,
|
|
31
|
+
VizelSlashMenu, VizelSlashMenuEmpty, VizelSlashMenuItem, VizelThemeProvider,
|
|
32
|
+
// Toolbar
|
|
33
|
+
VizelToolbar, VizelToolbarButton, VizelToolbarDefault, VizelToolbarDivider, } from "./components/index.ts";
|
|
32
34
|
// Runes (Svelte 5 reactive state)
|
|
33
35
|
export { createVizelAutoSave, createVizelEditor, createVizelEditorState, createVizelMarkdown, createVizelSlashMenuRenderer, createVizelState, getVizelTheme, getVizelThemeSafe, } from "./runes/index.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createVizelEditor.svelte.d.ts","sourceRoot":"","sources":["../../src/runes/createVizelEditor.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EAEX,KAAK,wBAAwB,EAC9B,MAAM,aAAa,CAAC;AAGrB;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B;;
|
|
1
|
+
{"version":3,"file":"createVizelEditor.svelte.d.ts","sourceRoot":"","sources":["../../src/runes/createVizelEditor.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EAEX,KAAK,wBAAwB,EAC9B,MAAM,aAAa,CAAC;AAGrB;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B;;EAiDvE"}
|
|
@@ -38,23 +38,34 @@ export function createVizelEditor(options = {}) {
|
|
|
38
38
|
// Store image upload options for event handler
|
|
39
39
|
const imageOptions = typeof features?.image === "object" ? features.image : {};
|
|
40
40
|
let editor = $state(null);
|
|
41
|
-
// Create editor on mount and cleanup on destroy
|
|
41
|
+
// Create editor on mount and cleanup on destroy (async - optional deps loaded dynamically)
|
|
42
42
|
$effect(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
let isMounted = true;
|
|
44
|
+
let instance = null;
|
|
45
|
+
let cleanupHandler = null;
|
|
46
|
+
void (async () => {
|
|
47
|
+
const result = await createVizelEditorInstance({
|
|
48
|
+
...editorOptions,
|
|
49
|
+
...(features !== undefined && { features }),
|
|
50
|
+
extensions: additionalExtensions,
|
|
51
|
+
createSlashMenuRenderer: createVizelSlashMenuRenderer,
|
|
52
|
+
});
|
|
53
|
+
if (!isMounted) {
|
|
54
|
+
result.editor.destroy();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
instance = result.editor;
|
|
58
|
+
editor = instance;
|
|
59
|
+
// Handle vizel:upload-image custom event from slash command
|
|
60
|
+
cleanupHandler = registerVizelUploadEventHandler({
|
|
61
|
+
getEditor: () => editor,
|
|
62
|
+
getImageOptions: () => imageOptions,
|
|
63
|
+
});
|
|
64
|
+
})();
|
|
55
65
|
return () => {
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
isMounted = false;
|
|
67
|
+
cleanupHandler?.();
|
|
68
|
+
instance?.destroy();
|
|
58
69
|
};
|
|
59
70
|
});
|
|
60
71
|
return {
|
package/package.json
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizel/svelte",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/seijikohara/vizel",
|
|
8
8
|
"directory": "packages/svelte"
|
|
9
9
|
},
|
|
10
|
+
"description": "Svelte 5 components and runes for Vizel block-based Markdown editor",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "Seiji Kohara",
|
|
13
|
+
"homepage": "https://seijikohara.github.io/vizel/",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/seijikohara/vizel/issues"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"vizel",
|
|
22
|
+
"tiptap",
|
|
23
|
+
"editor",
|
|
24
|
+
"markdown",
|
|
25
|
+
"svelte",
|
|
26
|
+
"wysiwyg",
|
|
27
|
+
"rich-text",
|
|
28
|
+
"block-editor"
|
|
29
|
+
],
|
|
10
30
|
"main": "./src/index.ts",
|
|
11
31
|
"types": "./src/index.ts",
|
|
12
32
|
"svelte": "./src/index.ts",
|
|
@@ -37,23 +57,23 @@
|
|
|
37
57
|
"typecheck": "svelte-check --tsconfig ./tsconfig.json"
|
|
38
58
|
},
|
|
39
59
|
"dependencies": {
|
|
40
|
-
"@iconify/svelte": "^5",
|
|
41
|
-
"@vizel/core": "^0.0
|
|
60
|
+
"@iconify/svelte": "^5.2.1",
|
|
61
|
+
"@vizel/core": "^1.0.0"
|
|
42
62
|
},
|
|
43
63
|
"peerDependencies": {
|
|
44
64
|
"svelte": "^5"
|
|
45
65
|
},
|
|
46
66
|
"devDependencies": {
|
|
47
|
-
"@sveltejs/package": "^2",
|
|
48
|
-
"@sveltejs/vite-plugin-svelte": "^6",
|
|
49
|
-
"@tiptap/extension-bold": "^3",
|
|
50
|
-
"@tiptap/extension-code": "^3",
|
|
51
|
-
"@tiptap/extension-color": "^3",
|
|
52
|
-
"@tiptap/extension-highlight": "^3",
|
|
53
|
-
"@tiptap/extension-italic": "^3",
|
|
54
|
-
"@tiptap/extension-strike": "^3",
|
|
55
|
-
"@tiptap/extension-text-style": "^3",
|
|
56
|
-
"@tiptap/extension-underline": "^3",
|
|
57
|
-
"svelte-check": "^4"
|
|
67
|
+
"@sveltejs/package": "^2.5.7",
|
|
68
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
69
|
+
"@tiptap/extension-bold": "^3.18.0",
|
|
70
|
+
"@tiptap/extension-code": "^3.18.0",
|
|
71
|
+
"@tiptap/extension-color": "^3.18.0",
|
|
72
|
+
"@tiptap/extension-highlight": "^3.18.0",
|
|
73
|
+
"@tiptap/extension-italic": "^3.18.0",
|
|
74
|
+
"@tiptap/extension-strike": "^3.18.0",
|
|
75
|
+
"@tiptap/extension-text-style": "^3.18.0",
|
|
76
|
+
"@tiptap/extension-underline": "^3.18.0",
|
|
77
|
+
"svelte-check": "^4.3.5"
|
|
58
78
|
}
|
|
59
79
|
}
|