@vizel/vue 0.0.1-alpha.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.
Files changed (54) hide show
  1. package/README.md +87 -0
  2. package/dist/index.d.ts +981 -0
  3. package/dist/index.js +63 -0
  4. package/dist/index10.js +135 -0
  5. package/dist/index11.js +30 -0
  6. package/dist/index12.js +14 -0
  7. package/dist/index13.js +91 -0
  8. package/dist/index14.js +134 -0
  9. package/dist/index15.js +37 -0
  10. package/dist/index16.js +21 -0
  11. package/dist/index17.js +79 -0
  12. package/dist/index18.js +120 -0
  13. package/dist/index19.js +21 -0
  14. package/dist/index2.js +88 -0
  15. package/dist/index20.js +52 -0
  16. package/dist/index21.js +43 -0
  17. package/dist/index22.js +12 -0
  18. package/dist/index23.js +16 -0
  19. package/dist/index24.js +37 -0
  20. package/dist/index25.js +48 -0
  21. package/dist/index26.js +24 -0
  22. package/dist/index27.js +10 -0
  23. package/dist/index28.js +46 -0
  24. package/dist/index29.js +23 -0
  25. package/dist/index3.js +61 -0
  26. package/dist/index30.js +15 -0
  27. package/dist/index31.js +4 -0
  28. package/dist/index32.js +4 -0
  29. package/dist/index33.js +4 -0
  30. package/dist/index34.js +4 -0
  31. package/dist/index35.js +4 -0
  32. package/dist/index36.js +4 -0
  33. package/dist/index37.js +4 -0
  34. package/dist/index38.js +4 -0
  35. package/dist/index39.js +4 -0
  36. package/dist/index4.js +34 -0
  37. package/dist/index40.js +4 -0
  38. package/dist/index41.js +4 -0
  39. package/dist/index42.js +4 -0
  40. package/dist/index43.js +4 -0
  41. package/dist/index44.js +4 -0
  42. package/dist/index45.js +4 -0
  43. package/dist/index46.js +4 -0
  44. package/dist/index47.js +4 -0
  45. package/dist/index48.js +4 -0
  46. package/dist/index49.js +4 -0
  47. package/dist/index5.js +76 -0
  48. package/dist/index50.js +4 -0
  49. package/dist/index51.js +4 -0
  50. package/dist/index6.js +108 -0
  51. package/dist/index7.js +15 -0
  52. package/dist/index8.js +191 -0
  53. package/dist/index9.js +35 -0
  54. package/package.json +63 -0
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ import { default as r } from "./index2.js";
2
+ import { default as l } from "./index3.js";
3
+ import { default as f } from "./index4.js";
4
+ import { default as u } from "./index5.js";
5
+ import { default as s } from "./index6.js";
6
+ import { default as V } from "./index7.js";
7
+ import { default as z } from "./index8.js";
8
+ import { default as n } from "./index9.js";
9
+ import { default as S } from "./index10.js";
10
+ import { default as c } from "./index11.js";
11
+ import { default as v } from "./index12.js";
12
+ import { default as E } from "./index13.js";
13
+ import { default as P } from "./index14.js";
14
+ import { default as k } from "./index15.js";
15
+ import { default as w } from "./index16.js";
16
+ import { default as y } from "./index17.js";
17
+ import { default as L } from "./index18.js";
18
+ import { default as R } from "./index19.js";
19
+ import { default as j } from "./index20.js";
20
+ import { default as F } from "./index21.js";
21
+ import { provideVizelIcons as H, useVizelIconContext as J } from "./index22.js";
22
+ import { useVizelContext as O, useVizelContextSafe as Q } from "./index23.js";
23
+ import { createVizelSlashMenuRenderer as W } from "./index24.js";
24
+ import { useVizelAutoSave as Y } from "./index25.js";
25
+ import { useVizelEditor as _ } from "./index26.js";
26
+ import { useVizelEditorState as ee } from "./index27.js";
27
+ import { useVizelMarkdown as re } from "./index28.js";
28
+ import { useVizelState as le } from "./index29.js";
29
+ import { useVizelTheme as fe, useVizelThemeSafe as ie } from "./index30.js";
30
+ export {
31
+ r as Vizel,
32
+ l as VizelBubbleMenu,
33
+ f as VizelBubbleMenuButton,
34
+ u as VizelBubbleMenuColorPicker,
35
+ s as VizelBubbleMenuDefault,
36
+ V as VizelBubbleMenuDivider,
37
+ z as VizelColorPicker,
38
+ n as VizelEditor,
39
+ S as VizelEmbedView,
40
+ c as VizelIcon,
41
+ v as VizelIconProvider,
42
+ E as VizelLinkEditor,
43
+ P as VizelNodeSelector,
44
+ k as VizelPortal,
45
+ w as VizelProvider,
46
+ y as VizelSaveIndicator,
47
+ L as VizelSlashMenu,
48
+ R as VizelSlashMenuEmpty,
49
+ j as VizelSlashMenuItem,
50
+ F as VizelThemeProvider,
51
+ W as createVizelSlashMenuRenderer,
52
+ H as provideVizelIcons,
53
+ Y as useVizelAutoSave,
54
+ O as useVizelContext,
55
+ Q as useVizelContextSafe,
56
+ _ as useVizelEditor,
57
+ ee as useVizelEditorState,
58
+ J as useVizelIconContext,
59
+ re as useVizelMarkdown,
60
+ le as useVizelState,
61
+ fe as useVizelTheme,
62
+ ie as useVizelThemeSafe
63
+ };
@@ -0,0 +1,135 @@
1
+ import { defineComponent as g, ref as w, computed as m, onMounted as p, watch as C, createElementBlock as d, openBlock as i, normalizeClass as s, createElementVNode as a, createCommentVNode as o, toDisplayString as r, createVNode as f } from "vue";
2
+ import k from "./index11.js";
3
+ const N = ["data-embed-provider"], x = ["data-embed-provider"], V = ["innerHTML"], B = ["data-embed-provider"], E = ["href"], L = ["src"], M = { class: "vizel-embed-card-content" }, S = {
4
+ key: 0,
5
+ class: "vizel-embed-card-site"
6
+ }, R = ["src"], H = { key: 1 }, T = {
7
+ key: 1,
8
+ class: "vizel-embed-card-title"
9
+ }, j = {
10
+ key: 2,
11
+ class: "vizel-embed-card-description"
12
+ }, q = { class: "vizel-embed-card-url" }, A = ["data-embed-provider"], D = ["href"], I = { class: "vizel-embed-link-icon" }, P = { class: "vizel-embed-link-text" }, U = ["data-embed-provider"], $ = ["href"], F = { class: "vizel-embed-link-icon" }, G = { class: "vizel-embed-link-text" }, O = /* @__PURE__ */ g({
13
+ __name: "VizelEmbedView",
14
+ props: {
15
+ data: {},
16
+ class: {},
17
+ selected: { type: Boolean }
18
+ },
19
+ setup(e) {
20
+ const t = e, v = w(null), c = m(() => {
21
+ const n = ["vizel-embed"];
22
+ return t.data.loading && n.push("is-loading"), t.selected && n.push("ProseMirror-selectednode"), t.class && n.push(t.class), n.join(" ");
23
+ }), y = m(() => ["youtube", "vimeo", "loom", "tiktok"].includes(t.data.provider ?? "")), b = m(() => !!t.data.image), z = m(() => {
24
+ try {
25
+ return new URL(t.data.url).hostname;
26
+ } catch {
27
+ return t.data.url;
28
+ }
29
+ });
30
+ function h() {
31
+ if (t.data.type === "oembed" && t.data.html && v.value) {
32
+ const n = v.value.querySelectorAll("script");
33
+ for (const l of n) {
34
+ const u = document.createElement("script");
35
+ l.src ? u.src = l.src : u.textContent = l.textContent, l.parentNode?.replaceChild(u, l);
36
+ }
37
+ t.data.provider === "twitter" && "twttr" in window && window.twttr?.widgets?.load?.();
38
+ }
39
+ }
40
+ return p(h), C(() => [t.data.type, t.data.html], h), (n, l) => e.data.loading ? (i(), d("div", {
41
+ key: 0,
42
+ class: s(c.value),
43
+ "data-embed-type": "loading",
44
+ "data-embed-provider": e.data.provider
45
+ }, [...l[0] || (l[0] = [
46
+ a("div", { class: "vizel-embed-loading" }, [
47
+ a("div", { class: "vizel-embed-loading-spinner" }),
48
+ a("span", null, "Loading embed...")
49
+ ], -1)
50
+ ])], 10, N)) : e.data.type === "oembed" && e.data.html ? (i(), d("div", {
51
+ key: 1,
52
+ ref_key: "containerRef",
53
+ ref: v,
54
+ class: s(c.value),
55
+ "data-embed-type": "oembed",
56
+ "data-embed-provider": e.data.provider
57
+ }, [
58
+ a("div", {
59
+ class: s(y.value ? "vizel-embed-video" : "vizel-embed-oembed"),
60
+ innerHTML: e.data.html
61
+ }, null, 10, V)
62
+ ], 10, x)) : e.data.type === "ogp" ? (i(), d("div", {
63
+ key: 2,
64
+ class: s(c.value),
65
+ "data-embed-type": "ogp",
66
+ "data-embed-provider": e.data.provider
67
+ }, [
68
+ a("a", {
69
+ href: e.data.url,
70
+ target: "_blank",
71
+ rel: "noopener noreferrer",
72
+ class: s(["vizel-embed-card", b.value ? "vizel-embed-card-horizontal" : ""])
73
+ }, [
74
+ b.value ? (i(), d("img", {
75
+ key: 0,
76
+ src: e.data.image,
77
+ alt: "",
78
+ class: "vizel-embed-card-image",
79
+ loading: "lazy"
80
+ }, null, 8, L)) : o("", !0),
81
+ a("div", M, [
82
+ e.data.siteName || e.data.favicon ? (i(), d("div", S, [
83
+ e.data.favicon ? (i(), d("img", {
84
+ key: 0,
85
+ src: e.data.favicon,
86
+ alt: "",
87
+ class: "vizel-embed-card-favicon"
88
+ }, null, 8, R)) : o("", !0),
89
+ e.data.siteName ? (i(), d("span", H, r(e.data.siteName), 1)) : o("", !0)
90
+ ])) : o("", !0),
91
+ e.data.title ? (i(), d("div", T, r(e.data.title), 1)) : o("", !0),
92
+ e.data.description ? (i(), d("div", j, r(e.data.description), 1)) : o("", !0),
93
+ a("div", q, r(z.value), 1)
94
+ ])
95
+ ], 10, E)
96
+ ], 10, B)) : e.data.type === "title" && e.data.title ? (i(), d("div", {
97
+ key: 3,
98
+ class: s(c.value),
99
+ "data-embed-type": "title",
100
+ "data-embed-provider": e.data.provider
101
+ }, [
102
+ a("a", {
103
+ href: e.data.url,
104
+ target: "_blank",
105
+ rel: "noopener noreferrer",
106
+ class: "vizel-embed-link"
107
+ }, [
108
+ a("span", I, [
109
+ f(k, { name: "link" })
110
+ ]),
111
+ a("span", P, r(e.data.title), 1)
112
+ ], 8, D)
113
+ ], 10, A)) : (i(), d("div", {
114
+ key: 4,
115
+ class: s(c.value),
116
+ "data-embed-type": "link",
117
+ "data-embed-provider": e.data.provider
118
+ }, [
119
+ a("a", {
120
+ href: e.data.url,
121
+ target: "_blank",
122
+ rel: "noopener noreferrer",
123
+ class: "vizel-embed-link"
124
+ }, [
125
+ a("span", F, [
126
+ f(k, { name: "link" })
127
+ ]),
128
+ a("span", G, r(e.data.url), 1)
129
+ ], 8, $)
130
+ ], 10, U));
131
+ }
132
+ });
133
+ export {
134
+ O as default
135
+ };
@@ -0,0 +1,30 @@
1
+ import { defineComponent as c, computed as i, createBlock as r, openBlock as s, unref as m, mergeProps as l } from "vue";
2
+ import { Icon as p } from "@iconify/vue";
3
+ import { vizelDefaultIconIds as h } from "@vizel/core";
4
+ import { useVizelIconContext as u } from "./index22.js";
5
+ const g = /* @__PURE__ */ c({
6
+ __name: "VizelIcon",
7
+ props: {
8
+ name: {},
9
+ customIcons: {},
10
+ width: {},
11
+ height: {},
12
+ color: {}
13
+ },
14
+ setup(e) {
15
+ const o = e, { customIcons: t } = u(), n = i(
16
+ () => o.customIcons?.[o.name] ?? t?.[o.name] ?? h[o.name]
17
+ );
18
+ return (a, d) => (s(), r(m(p), l({
19
+ icon: n.value,
20
+ style: { pointerEvents: "none" }
21
+ }, {
22
+ ...o.width !== void 0 && { width: o.width },
23
+ ...o.height !== void 0 && { height: o.height },
24
+ ...o.color !== void 0 && { color: o.color }
25
+ }), null, 16, ["icon"]));
26
+ }
27
+ });
28
+ export {
29
+ g as default
30
+ };
@@ -0,0 +1,14 @@
1
+ import { defineComponent as r, renderSlot as n } from "vue";
2
+ import { provideVizelIcons as s } from "./index22.js";
3
+ const m = /* @__PURE__ */ r({
4
+ __name: "VizelIconProvider",
5
+ props: {
6
+ icons: {}
7
+ },
8
+ setup(o) {
9
+ return s(o.icons), (e, p) => n(e.$slots, "default");
10
+ }
11
+ });
12
+ export {
13
+ m as default
14
+ };
@@ -0,0 +1,91 @@
1
+ import { defineComponent as R, ref as r, computed as d, onMounted as V, onUnmounted as C, createElementBlock as m, openBlock as c, normalizeClass as M, createElementVNode as i, createCommentVNode as E, withDirectives as h, vModelText as U, createVNode as y, vModelCheckbox as D } from "vue";
2
+ import { detectVizelEmbedProvider as B } from "@vizel/core";
3
+ import g from "./index11.js";
4
+ const N = { class: "vizel-link-editor-row" }, P = {
5
+ type: "submit",
6
+ class: "vizel-link-button",
7
+ title: "Apply"
8
+ }, A = {
9
+ key: 0,
10
+ class: "vizel-link-editor-embed-toggle"
11
+ }, H = /* @__PURE__ */ R({
12
+ __name: "VizelLinkEditor",
13
+ props: {
14
+ editor: {},
15
+ class: {},
16
+ enableEmbed: { type: Boolean, default: !1 }
17
+ },
18
+ emits: ["close"],
19
+ setup(z, { emit: L }) {
20
+ const n = z, o = L, s = r(null), f = r(null), v = d(() => n.editor.getAttributes("link").href || ""), l = r(v.value), u = r(!1), p = d(() => n.enableEmbed ? n.editor.extensionManager.extensions.some((e) => e.name === "embed") : !1), x = d(() => l.value.trim() ? B(l.value.trim()) !== null : !1);
21
+ function k(t) {
22
+ s.value && !s.value.contains(t.target) && o("close");
23
+ }
24
+ function b(t) {
25
+ t.key === "Escape" && (t.preventDefault(), t.stopImmediatePropagation(), o("close"));
26
+ }
27
+ V(() => {
28
+ f.value?.focus(), setTimeout(() => {
29
+ document.addEventListener("mousedown", k);
30
+ }, 0), document.addEventListener("keydown", b, !0);
31
+ }), C(() => {
32
+ document.removeEventListener("mousedown", k), document.removeEventListener("keydown", b, !0);
33
+ });
34
+ function _(t) {
35
+ t.preventDefault();
36
+ const e = l.value.trim();
37
+ if (!e) {
38
+ n.editor.chain().focus().unsetLink().run(), o("close");
39
+ return;
40
+ }
41
+ u.value && p.value ? n.editor.chain().focus().unsetLink().setEmbed({ url: e }).run() : n.editor.chain().focus().setLink({ href: e }).run(), o("close");
42
+ }
43
+ function w() {
44
+ n.editor.chain().focus().unsetLink().run(), o("close");
45
+ }
46
+ return (t, e) => (c(), m("form", {
47
+ ref_key: "formRef",
48
+ ref: s,
49
+ class: M(["vizel-link-editor", t.$props.class]),
50
+ onSubmit: _
51
+ }, [
52
+ i("div", N, [
53
+ h(i("input", {
54
+ ref_key: "inputRef",
55
+ ref: f,
56
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => l.value = a),
57
+ type: "url",
58
+ placeholder: "Enter URL...",
59
+ class: "vizel-link-input"
60
+ }, null, 512), [
61
+ [U, l.value]
62
+ ]),
63
+ i("button", P, [
64
+ y(g, { name: "check" })
65
+ ]),
66
+ v.value ? (c(), m("button", {
67
+ key: 0,
68
+ type: "button",
69
+ class: "vizel-link-button vizel-link-remove",
70
+ title: "Remove link",
71
+ onClick: w
72
+ }, [
73
+ y(g, { name: "x" })
74
+ ])) : E("", !0)
75
+ ]),
76
+ p.value && x.value ? (c(), m("div", A, [
77
+ h(i("input", {
78
+ id: "vizel-embed-toggle",
79
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => u.value = a),
80
+ type: "checkbox"
81
+ }, null, 512), [
82
+ [D, u.value]
83
+ ]),
84
+ e[2] || (e[2] = i("label", { for: "vizel-embed-toggle" }, "Embed as rich content", -1))
85
+ ])) : E("", !0)
86
+ ], 34));
87
+ }
88
+ });
89
+ export {
90
+ H as default
91
+ };
@@ -0,0 +1,134 @@
1
+ import { defineComponent as E, ref as i, computed as m, onMounted as V, onUnmounted as A, watch as $, nextTick as S, createElementBlock as r, openBlock as c, normalizeClass as D, createElementVNode as l, createCommentVNode as g, createVNode as d, toDisplayString as N, Fragment as L, renderList as R } from "vue";
2
+ import { vizelDefaultNodeTypes as B, getVizelActiveNodeType as K } from "@vizel/core";
3
+ import { useVizelState as M } from "./index29.js";
4
+ import u from "./index11.js";
5
+ const I = ["aria-expanded", "aria-label"], O = { class: "vizel-node-selector-icon" }, U = { class: "vizel-node-selector-label" }, F = {
6
+ class: "vizel-node-selector-chevron",
7
+ "aria-hidden": "true"
8
+ }, H = ["aria-selected", "tabindex", "onClick", "onMouseenter"], j = { class: "vizel-node-selector-option-icon" }, q = { class: "vizel-node-selector-option-label" }, G = {
9
+ key: 0,
10
+ class: "vizel-node-selector-check",
11
+ "aria-hidden": "true"
12
+ }, X = /* @__PURE__ */ E({
13
+ __name: "VizelNodeSelector",
14
+ props: {
15
+ editor: {},
16
+ nodeTypes: { default: () => B },
17
+ class: {}
18
+ },
19
+ setup(T) {
20
+ const o = T, k = M(() => o.editor), n = i(!1), t = i(0), p = i(null), y = i(null), h = m(() => (k.value, K(o.editor, o.nodeTypes))), b = m(() => h.value?.label ?? "Text"), C = m(() => h.value?.icon ?? "paragraph");
21
+ function _(e) {
22
+ p.value && !p.value.contains(e.target) && (n.value = !1);
23
+ }
24
+ V(() => {
25
+ document.addEventListener("mousedown", _);
26
+ }), A(() => {
27
+ document.removeEventListener("mousedown", _);
28
+ }), $(n, (e) => {
29
+ e && S(() => {
30
+ y.value?.focus();
31
+ });
32
+ });
33
+ function w(e) {
34
+ if (!n.value) {
35
+ (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), n.value = !0, t.value = 0);
36
+ return;
37
+ }
38
+ switch (e.key) {
39
+ case "Escape":
40
+ e.preventDefault(), n.value = !1;
41
+ break;
42
+ case "ArrowDown":
43
+ e.preventDefault(), t.value = (t.value + 1) % o.nodeTypes.length;
44
+ break;
45
+ case "ArrowUp":
46
+ e.preventDefault(), t.value = (t.value - 1 + o.nodeTypes.length) % o.nodeTypes.length;
47
+ break;
48
+ case "Enter":
49
+ case " ": {
50
+ e.preventDefault();
51
+ const s = o.nodeTypes[t.value];
52
+ s && z(s);
53
+ break;
54
+ }
55
+ case "Home":
56
+ e.preventDefault(), t.value = 0;
57
+ break;
58
+ case "End":
59
+ e.preventDefault(), t.value = o.nodeTypes.length - 1;
60
+ break;
61
+ }
62
+ }
63
+ function z(e) {
64
+ e.command(o.editor), n.value = !1;
65
+ }
66
+ function v(e) {
67
+ return k.value, e.isActive(o.editor);
68
+ }
69
+ return (e, s) => (c(), r("div", {
70
+ ref_key: "containerRef",
71
+ ref: p,
72
+ class: D(["vizel-node-selector", e.$props.class]),
73
+ "data-vizel-node-selector": ""
74
+ }, [
75
+ l("button", {
76
+ type: "button",
77
+ class: "vizel-node-selector-trigger",
78
+ "aria-haspopup": !0,
79
+ "aria-expanded": n.value,
80
+ "aria-label": `Current block type: ${b.value}`,
81
+ title: "Change block type",
82
+ onClick: s[0] || (s[0] = (a) => n.value = !n.value),
83
+ onKeydown: w
84
+ }, [
85
+ l("span", O, [
86
+ d(u, { name: C.value }, null, 8, ["name"])
87
+ ]),
88
+ l("span", U, N(b.value), 1),
89
+ l("span", F, [
90
+ d(u, { name: "chevronDown" })
91
+ ])
92
+ ], 40, I),
93
+ n.value ? (c(), r("div", {
94
+ key: 0,
95
+ ref_key: "dropdownRef",
96
+ ref: y,
97
+ class: "vizel-node-selector-dropdown",
98
+ role: "listbox",
99
+ "aria-label": "Block types",
100
+ "data-vizel-node-selector-dropdown": "",
101
+ tabindex: "-1",
102
+ onKeydown: w
103
+ }, [
104
+ (c(!0), r(L, null, R(o.nodeTypes, (a, f) => (c(), r("button", {
105
+ key: a.name,
106
+ type: "button",
107
+ role: "option",
108
+ "aria-selected": v(a),
109
+ class: D([
110
+ "vizel-node-selector-option",
111
+ { "is-active": v(a) },
112
+ { "is-focused": f === t.value }
113
+ ]),
114
+ tabindex: f === t.value ? 0 : -1,
115
+ onClick: (x) => z(a),
116
+ onMouseenter: (x) => t.value = f
117
+ }, [
118
+ l("span", j, [
119
+ d(u, {
120
+ name: a.icon
121
+ }, null, 8, ["name"])
122
+ ]),
123
+ l("span", q, N(a.label), 1),
124
+ v(a) ? (c(), r("span", G, [
125
+ d(u, { name: "check" })
126
+ ])) : g("", !0)
127
+ ], 42, H))), 128))
128
+ ], 544)) : g("", !0)
129
+ ], 2));
130
+ }
131
+ });
132
+ export {
133
+ X as default
134
+ };
@@ -0,0 +1,37 @@
1
+ import { defineComponent as d, ref as p, onMounted as i, computed as o, createBlock as u, renderSlot as a, openBlock as c, Teleport as f, createElementVNode as m, normalizeStyle as y, normalizeClass as v } from "vue";
2
+ import { getVizelPortalContainer as z, VIZEL_PORTAL_ID as _, VIZEL_PORTAL_Z_INDEX as I } from "@vizel/core";
3
+ const V = ["data-vizel-portal-layer"], P = /* @__PURE__ */ d({
4
+ __name: "VizelPortal",
5
+ props: {
6
+ layer: { default: "dropdown" },
7
+ class: {},
8
+ disabled: { type: Boolean, default: !1 }
9
+ },
10
+ setup(e) {
11
+ const r = e, l = p(!1);
12
+ i(() => {
13
+ z(), l.value = !0;
14
+ });
15
+ const s = o(() => `#${_}`), n = o(() => ({
16
+ position: "absolute",
17
+ top: 0,
18
+ left: 0,
19
+ zIndex: I[r.layer]
20
+ }));
21
+ return (t, k) => l.value && !e.disabled ? (c(), u(f, {
22
+ key: 0,
23
+ to: s.value
24
+ }, [
25
+ m("div", {
26
+ "data-vizel-portal-layer": e.layer,
27
+ class: v(t.$props.class),
28
+ style: y(n.value)
29
+ }, [
30
+ a(t.$slots, "default")
31
+ ], 14, V)
32
+ ], 8, ["to"])) : a(t.$slots, "default", { key: 1 });
33
+ }
34
+ });
35
+ export {
36
+ P as default
37
+ };
@@ -0,0 +1,21 @@
1
+ import { defineComponent as s, provide as t, createElementBlock as a, openBlock as l, normalizeClass as n, renderSlot as p } from "vue";
2
+ import { VIZEL_CONTEXT_KEY as i } from "./index23.js";
3
+ const f = /* @__PURE__ */ s({
4
+ __name: "VizelProvider",
5
+ props: {
6
+ editor: {},
7
+ class: {}
8
+ },
9
+ setup(o) {
10
+ const r = o;
11
+ return t(i, () => r.editor), (e, c) => (l(), a("div", {
12
+ class: n(e.$props.class),
13
+ "data-vizel-root": ""
14
+ }, [
15
+ p(e.$slots, "default")
16
+ ], 2));
17
+ }
18
+ });
19
+ export {
20
+ f as default
21
+ };
@@ -0,0 +1,79 @@
1
+ import { defineComponent as _, ref as h, onMounted as z, watch as S, onBeforeUnmount as k, computed as l, createElementBlock as i, openBlock as a, normalizeClass as y, createElementVNode as c, createCommentVNode as v, createBlock as o, createVNode as T, toDisplayString as d } from "vue";
2
+ import { formatVizelRelativeTime as g } from "@vizel/core";
3
+ import s from "./index11.js";
4
+ const w = {
5
+ class: "vizel-save-indicator-icon",
6
+ "aria-hidden": "true"
7
+ }, B = {
8
+ key: 1,
9
+ class: "vizel-save-indicator-spinner",
10
+ "aria-hidden": "true"
11
+ }, V = { class: "vizel-save-indicator-text" }, I = {
12
+ key: 0,
13
+ class: "vizel-save-indicator-timestamp"
14
+ }, $ = /* @__PURE__ */ _({
15
+ __name: "VizelSaveIndicator",
16
+ props: {
17
+ status: {},
18
+ lastSaved: {},
19
+ showTimestamp: { type: Boolean, default: !0 },
20
+ class: {}
21
+ },
22
+ setup(u) {
23
+ const e = u, t = h("");
24
+ let n = null;
25
+ function r() {
26
+ e.lastSaved ? t.value = g(e.lastSaved) : t.value = "";
27
+ }
28
+ z(() => {
29
+ r(), n = setInterval(r, 1e4);
30
+ }), S(
31
+ () => e.lastSaved,
32
+ () => {
33
+ r();
34
+ }
35
+ ), k(() => {
36
+ n && clearInterval(n);
37
+ });
38
+ const m = l(() => {
39
+ switch (e.status) {
40
+ case "saved":
41
+ return "Saved";
42
+ case "saving":
43
+ return "Saving...";
44
+ case "unsaved":
45
+ return "Unsaved";
46
+ case "error":
47
+ return "Error saving";
48
+ default:
49
+ return "";
50
+ }
51
+ }), p = l(() => e.showTimestamp && e.lastSaved && t.value && e.status === "saved");
52
+ return (f, x) => (a(), i("div", {
53
+ class: y(["vizel-save-indicator", `vizel-save-indicator--${e.status}`, f.$props.class]),
54
+ role: "status",
55
+ "aria-live": "polite",
56
+ "data-vizel-save-indicator": ""
57
+ }, [
58
+ c("span", w, [
59
+ e.status === "saved" ? (a(), o(s, {
60
+ key: 0,
61
+ name: "check"
62
+ })) : e.status === "saving" ? (a(), i("span", B, [
63
+ T(s, { name: "loader" })
64
+ ])) : e.status === "unsaved" ? (a(), o(s, {
65
+ key: 2,
66
+ name: "circle"
67
+ })) : e.status === "error" ? (a(), o(s, {
68
+ key: 3,
69
+ name: "warning"
70
+ })) : v("", !0)
71
+ ]),
72
+ c("span", V, d(m.value), 1),
73
+ p.value ? (a(), i("span", I, d(t.value), 1)) : v("", !0)
74
+ ], 2));
75
+ }
76
+ });
77
+ export {
78
+ $ as default
79
+ };