@vizel/vue 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/dist/index33.js CHANGED
@@ -1,48 +1,34 @@
1
- import { VIZEL_DEFAULT_AUTO_SAVE_OPTIONS as h, createVizelAutoSaveHandlers as f } from "@vizel/core";
2
- import { reactive as i, onMounted as U, watch as S, onBeforeUnmount as C, computed as t } from "vue";
3
- function A(o, u = {}) {
4
- const r = { ...h, ...u }, a = i({
5
- status: "saved",
6
- hasUnsavedChanges: !1,
7
- lastSaved: null,
8
- error: null
9
- });
10
- let n = null, e = null;
11
- const l = (s) => {
12
- s.status !== void 0 && (a.status = s.status), s.hasUnsavedChanges !== void 0 && (a.hasUnsavedChanges = s.hasUnsavedChanges), s.lastSaved !== void 0 && (a.lastSaved = s.lastSaved), s.error !== void 0 && (a.error = s.error);
13
- }, d = () => {
14
- const s = o();
15
- if (n && e && (n.off("update", e.handleUpdate), e.cancel()), n = s ?? null, !(n && r.enabled)) {
16
- e = null;
17
- return;
18
- }
19
- e = f(() => n, r, l), n.on("update", e.handleUpdate);
20
- };
21
- U(() => {
22
- d();
23
- }), S(
24
- () => o(),
25
- () => {
26
- d();
27
- }
28
- ), C(() => {
29
- n && e && (n.off("update", e.handleUpdate), e.cancel());
30
- });
31
- async function v() {
32
- await e?.saveNow();
1
+ import { defineComponent as l, createElementBlock as n, openBlock as c, normalizeClass as d, renderSlot as r } from "vue";
2
+ const m = ["disabled", "aria-pressed", "title", "data-active", "data-action"], u = /* @__PURE__ */ l({
3
+ __name: "VizelToolbarButton",
4
+ props: {
5
+ isActive: { type: Boolean },
6
+ disabled: { type: Boolean },
7
+ title: {},
8
+ class: {},
9
+ action: {}
10
+ },
11
+ emits: ["click"],
12
+ setup(t, { emit: a }) {
13
+ const o = t, s = a;
14
+ return (e, i) => (c(), n("button", {
15
+ type: "button",
16
+ disabled: t.disabled,
17
+ "aria-pressed": t.isActive,
18
+ class: d([
19
+ "vizel-toolbar-button",
20
+ { "is-active": t.isActive },
21
+ e.$props.class
22
+ ]),
23
+ title: t.title,
24
+ "data-active": t.isActive || void 0,
25
+ "data-action": o.action,
26
+ onClick: i[0] || (i[0] = (v) => s("click"))
27
+ }, [
28
+ r(e.$slots, "default")
29
+ ], 10, m));
33
30
  }
34
- async function c() {
35
- return await e?.restore() ?? null;
36
- }
37
- return {
38
- status: t(() => a.status),
39
- hasUnsavedChanges: t(() => a.hasUnsavedChanges),
40
- lastSaved: t(() => a.lastSaved),
41
- error: t(() => a.error),
42
- save: v,
43
- restore: c
44
- };
45
- }
31
+ });
46
32
  export {
47
- A as useVizelAutoSave
33
+ u as default
48
34
  };
package/dist/index34.js CHANGED
@@ -1,24 +1,45 @@
1
- import { createVizelEditorInstance as l, registerVizelUploadEventHandler as d } from "@vizel/core";
2
- import { shallowRef as u, onMounted as c, onBeforeUnmount as m } from "vue";
3
- import { createVizelSlashMenuRenderer as p } from "./index32.js";
4
- function E(o = {}) {
5
- const { features: e, extensions: r = [], ...i } = o, a = typeof e?.image == "object" ? e.image : {}, t = u(null);
6
- let n = null;
7
- return c(() => {
8
- const { editor: s } = l({
9
- ...i,
10
- ...e !== void 0 && { features: e },
11
- extensions: r,
12
- createSlashMenuRenderer: p
13
- });
14
- t.value = s, n = d({
15
- getEditor: () => t.value,
16
- getImageOptions: () => a
17
- });
18
- }), m(() => {
19
- n?.(), t.value?.destroy();
20
- }), t;
21
- }
1
+ import { defineComponent as p, computed as f, createElementBlock as r, openBlock as t, normalizeClass as _, Fragment as l, renderList as s, createBlock as n, createCommentVNode as v, withCtx as b, createVNode as k } from "vue";
2
+ import { vizelDefaultToolbarActions as z, groupVizelToolbarActions as $ } from "@vizel/core";
3
+ import { useVizelState as C } from "./index41.js";
4
+ import V from "./index20.js";
5
+ import h from "./index33.js";
6
+ import y from "./index35.js";
7
+ const w = /* @__PURE__ */ p({
8
+ __name: "VizelToolbarDefault",
9
+ props: {
10
+ editor: {},
11
+ class: {},
12
+ actions: { default: () => z }
13
+ },
14
+ setup(c) {
15
+ const o = c, m = C(() => o.editor), u = f(() => (m.value, $(o.actions)));
16
+ return (d, A) => (t(), r("div", {
17
+ class: _(["vizel-toolbar-content", d.$props.class]),
18
+ "data-vizel-toolbar": ""
19
+ }, [
20
+ (t(!0), r(l, null, s(u.value, (i, a) => (t(), r(l, {
21
+ key: i[0]?.group ?? a
22
+ }, [
23
+ a > 0 ? (t(), n(y, { key: 0 })) : v("", !0),
24
+ (t(!0), r(l, null, s(i, (e) => (t(), n(h, {
25
+ key: e.id,
26
+ action: e.id,
27
+ "is-active": e.isActive(o.editor),
28
+ disabled: !e.isEnabled(o.editor),
29
+ title: e.shortcut ? `${e.label} (${e.shortcut})` : e.label,
30
+ onClick: (B) => e.run(o.editor)
31
+ }, {
32
+ default: b(() => [
33
+ k(V, {
34
+ name: e.icon
35
+ }, null, 8, ["name"])
36
+ ]),
37
+ _: 2
38
+ }, 1032, ["action", "is-active", "disabled", "title", "onClick"]))), 128))
39
+ ], 64))), 128))
40
+ ], 2));
41
+ }
42
+ });
22
43
  export {
23
- E as useVizelEditor
44
+ w as default
24
45
  };
package/dist/index35.js CHANGED
@@ -1,10 +1,15 @@
1
- import { getVizelEditorState as o } from "@vizel/core";
2
- import { computed as r } from "vue";
3
- import { useVizelState as i } from "./index37.js";
4
- function p(t) {
5
- const e = i(t);
6
- return r(() => (e.value, o(t())));
7
- }
1
+ import { defineComponent as o, createElementBlock as r, openBlock as s, normalizeClass as l } from "vue";
2
+ const t = /* @__PURE__ */ o({
3
+ __name: "VizelToolbarDivider",
4
+ props: {
5
+ class: {}
6
+ },
7
+ setup(a) {
8
+ return (e, n) => (s(), r("span", {
9
+ class: l(["vizel-toolbar-divider", e.$props.class])
10
+ }, null, 2));
11
+ }
12
+ });
8
13
  export {
9
- p as useVizelEditorState
14
+ t as default
10
15
  };
package/dist/index36.js CHANGED
@@ -1,46 +1,38 @@
1
- import { getVizelMarkdown as k, createVizelMarkdownSyncHandlers as p } from "@vizel/core";
2
- import { ref as d, watch as w, onBeforeUnmount as M, computed as g } from "vue";
3
- function y(o, f = {}) {
4
- const { initialValue: s, ...m } = f, t = d(s ?? ""), a = d(!1);
5
- let l = null;
6
- const i = () => (l || (l = p(m)), l);
7
- let r = !1;
8
- w(
9
- o,
10
- (e) => {
11
- if (!e || r) return;
12
- const n = i();
13
- s !== void 0 ? (n.setMarkdown(e, s), t.value = s) : t.value = k(e), r = !0;
14
- const u = () => {
15
- n.handleUpdate(e), a.value = n.isPending();
16
- const c = () => {
17
- n.isPending() ? requestAnimationFrame(c) : (t.value = n.getMarkdown(), a.value = !1);
18
- };
19
- requestAnimationFrame(c);
20
- };
21
- e.on("update", u);
22
- },
23
- { immediate: !0 }
24
- ), M(() => {
25
- l?.destroy();
26
- });
27
- const h = (e) => {
28
- const n = o();
29
- if (!n) return;
30
- i().setMarkdown(n, e), t.value = e, a.value = !1;
31
- }, v = () => {
32
- const e = o();
33
- if (!e) return;
34
- const n = i();
35
- n.flush(e), t.value = n.getMarkdown(), a.value = !1;
36
- };
1
+ import { handleVizelSuggestionEscape as m, createVizelSuggestionContainer as c } from "@vizel/core";
2
+ import { ref as l, createApp as s, h as d } from "vue";
3
+ import "@iconify/vue";
4
+ import f from "./index28.js";
5
+ function R(u = {}) {
37
6
  return {
38
- markdown: t,
39
- setMarkdown: h,
40
- isPending: g(() => a.value),
41
- flush: v
7
+ render: () => {
8
+ let t = null, n = null;
9
+ const r = l(null), o = l([]), a = l(null);
10
+ return {
11
+ onStart: (e) => {
12
+ o.value = e.items, a.value = e.command, n = c(), t = s({
13
+ setup() {
14
+ return () => d(f, {
15
+ items: o.value,
16
+ ...u.className !== void 0 && { class: u.className },
17
+ ref: r,
18
+ onCommand: (i) => {
19
+ a.value?.(i);
20
+ }
21
+ });
22
+ }
23
+ }), t.mount(n.menuContainer), n.updatePosition(e.clientRect);
24
+ },
25
+ onUpdate: (e) => {
26
+ o.value = e.items, a.value = e.command, n?.updatePosition(e.clientRect);
27
+ },
28
+ onKeyDown: (e) => m(e.event) ? !0 : r.value?.onKeyDown(e.event) ?? !1,
29
+ onExit: () => {
30
+ t?.unmount(), n?.destroy(), t = null, n = null;
31
+ }
32
+ };
33
+ }
42
34
  };
43
35
  }
44
36
  export {
45
- y as useVizelMarkdown
37
+ R as createVizelSlashMenuRenderer
46
38
  };
package/dist/index37.js CHANGED
@@ -1,23 +1,48 @@
1
- import { ref as a, watch as u, onBeforeUnmount as f } from "vue";
2
- function l(i) {
3
- const e = a(0);
4
- let n = null;
5
- function o() {
6
- e.value++;
1
+ import { VIZEL_DEFAULT_AUTO_SAVE_OPTIONS as h, createVizelAutoSaveHandlers as f } from "@vizel/core";
2
+ import { reactive as i, onMounted as U, watch as S, onBeforeUnmount as C, computed as t } from "vue";
3
+ function A(o, u = {}) {
4
+ const r = { ...h, ...u }, a = i({
5
+ status: "saved",
6
+ hasUnsavedChanges: !1,
7
+ lastSaved: null,
8
+ error: null
9
+ });
10
+ let n = null, e = null;
11
+ const l = (s) => {
12
+ s.status !== void 0 && (a.status = s.status), s.hasUnsavedChanges !== void 0 && (a.hasUnsavedChanges = s.hasUnsavedChanges), s.lastSaved !== void 0 && (a.lastSaved = s.lastSaved), s.error !== void 0 && (a.error = s.error);
13
+ }, d = () => {
14
+ const s = o();
15
+ if (n && e && (n.off("update", e.handleUpdate), e.cancel()), n = s ?? null, !(n && r.enabled)) {
16
+ e = null;
17
+ return;
18
+ }
19
+ e = f(() => n, r, l), n.on("update", e.handleUpdate);
20
+ };
21
+ U(() => {
22
+ d();
23
+ }), S(
24
+ () => o(),
25
+ () => {
26
+ d();
27
+ }
28
+ ), C(() => {
29
+ n && e && (n.off("update", e.handleUpdate), e.cancel());
30
+ });
31
+ async function v() {
32
+ await e?.saveNow();
7
33
  }
8
- function r(t) {
9
- n && n !== t && n.off("transaction", o), n = t ?? null, n && n.on("transaction", o);
34
+ async function c() {
35
+ return await e?.restore() ?? null;
10
36
  }
11
- return u(
12
- i,
13
- (t) => {
14
- r(t);
15
- },
16
- { immediate: !0 }
17
- ), f(() => {
18
- n && n.off("transaction", o);
19
- }), e;
37
+ return {
38
+ status: t(() => a.status),
39
+ hasUnsavedChanges: t(() => a.hasUnsavedChanges),
40
+ lastSaved: t(() => a.lastSaved),
41
+ error: t(() => a.error),
42
+ save: v,
43
+ restore: c
44
+ };
20
45
  }
21
46
  export {
22
- l as useVizelState
47
+ A as useVizelAutoSave
23
48
  };
package/dist/index38.js CHANGED
@@ -1,15 +1,24 @@
1
- import { inject as r } from "vue";
2
- import { VIZEL_THEME_CONTEXT_KEY as t } from "./index60.js";
3
- function o() {
4
- const e = r(t);
5
- if (!e)
6
- throw new Error("useVizelTheme must be used within a VizelThemeProvider");
7
- return e;
8
- }
9
- function u() {
10
- return r(t, null);
1
+ import { createVizelEditorInstance as l, registerVizelUploadEventHandler as d } from "@vizel/core";
2
+ import { shallowRef as u, onMounted as c, onBeforeUnmount as m } from "vue";
3
+ import { createVizelSlashMenuRenderer as p } from "./index36.js";
4
+ function E(n = {}) {
5
+ const { features: e, extensions: r = [], ...i } = n, a = typeof e?.image == "object" ? e.image : {}, t = u(null);
6
+ let o = null;
7
+ return c(async () => {
8
+ const s = await l({
9
+ ...i,
10
+ ...e !== void 0 && { features: e },
11
+ extensions: r,
12
+ createSlashMenuRenderer: p
13
+ });
14
+ t.value = s.editor, o = d({
15
+ getEditor: () => t.value,
16
+ getImageOptions: () => a
17
+ });
18
+ }), m(() => {
19
+ o?.(), t.value?.destroy();
20
+ }), t;
11
21
  }
12
22
  export {
13
- o as useVizelTheme,
14
- u as useVizelThemeSafe
23
+ E as useVizelEditor
15
24
  };
package/dist/index39.js CHANGED
@@ -1,17 +1,10 @@
1
- var t = (e, n) => {
2
- if (e === "slot")
3
- return 0;
4
- if (e instanceof Function)
5
- return e(n);
6
- const { children: r, ...s } = n ?? {};
7
- if (e === "svg")
8
- throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
9
- return [e, s, r];
10
- };
1
+ import { getVizelEditorState as o } from "@vizel/core";
2
+ import { computed as r } from "vue";
3
+ import { useVizelState as i } from "./index41.js";
4
+ function p(t) {
5
+ const e = i(t);
6
+ return r(() => (e.value, o(t())));
7
+ }
11
8
  export {
12
- t as createElement,
13
- t as h,
14
- t as jsx,
15
- t as jsxDEV,
16
- t as jsxs
9
+ p as useVizelEditorState
17
10
  };
package/dist/index40.js CHANGED
@@ -1,4 +1,46 @@
1
- import f from "./index10.js";
1
+ import { getVizelMarkdown as k, createVizelMarkdownSyncHandlers as p } from "@vizel/core";
2
+ import { ref as d, watch as w, onBeforeUnmount as M, computed as g } from "vue";
3
+ function y(o, f = {}) {
4
+ const { initialValue: s, ...m } = f, t = d(s ?? ""), a = d(!1);
5
+ let l = null;
6
+ const i = () => (l || (l = p(m)), l);
7
+ let r = !1;
8
+ w(
9
+ o,
10
+ (e) => {
11
+ if (!e || r) return;
12
+ const n = i();
13
+ s !== void 0 ? (n.setMarkdown(e, s), t.value = s) : t.value = k(e), r = !0;
14
+ const u = () => {
15
+ n.handleUpdate(e), a.value = n.isPending();
16
+ const c = () => {
17
+ n.isPending() ? requestAnimationFrame(c) : (t.value = n.getMarkdown(), a.value = !1);
18
+ };
19
+ requestAnimationFrame(c);
20
+ };
21
+ e.on("update", u);
22
+ },
23
+ { immediate: !0 }
24
+ ), M(() => {
25
+ l?.destroy();
26
+ });
27
+ const h = (e) => {
28
+ const n = o();
29
+ if (!n) return;
30
+ i().setMarkdown(n, e), t.value = e, a.value = !1;
31
+ }, v = () => {
32
+ const e = o();
33
+ if (!e) return;
34
+ const n = i();
35
+ n.flush(e), t.value = n.getMarkdown(), a.value = !1;
36
+ };
37
+ return {
38
+ markdown: t,
39
+ setMarkdown: h,
40
+ isPending: g(() => a.value),
41
+ flush: v
42
+ };
43
+ }
2
44
  export {
3
- f as default
45
+ y as useVizelMarkdown
4
46
  };
package/dist/index41.js CHANGED
@@ -1,4 +1,23 @@
1
- import f from "./index11.js";
1
+ import { ref as a, watch as u, onBeforeUnmount as f } from "vue";
2
+ function l(i) {
3
+ const e = a(0);
4
+ let n = null;
5
+ function o() {
6
+ e.value++;
7
+ }
8
+ function r(t) {
9
+ n && n !== t && n.off("transaction", o), n = t ?? null, n && n.on("transaction", o);
10
+ }
11
+ return u(
12
+ i,
13
+ (t) => {
14
+ r(t);
15
+ },
16
+ { immediate: !0 }
17
+ ), f(() => {
18
+ n && n.off("transaction", o);
19
+ }), e;
20
+ }
2
21
  export {
3
- f as default
22
+ l as useVizelState
4
23
  };
package/dist/index42.js CHANGED
@@ -1,4 +1,15 @@
1
- import f from "./index12.js";
1
+ import { inject as r } from "vue";
2
+ import { VIZEL_THEME_CONTEXT_KEY as t } from "./index68.js";
3
+ function o() {
4
+ const e = r(t);
5
+ if (!e)
6
+ throw new Error("useVizelTheme must be used within a VizelThemeProvider");
7
+ return e;
8
+ }
9
+ function u() {
10
+ return r(t, null);
11
+ }
2
12
  export {
3
- f as default
13
+ o as useVizelTheme,
14
+ u as useVizelThemeSafe
4
15
  };
package/dist/index43.js CHANGED
@@ -1,4 +1,17 @@
1
- import f from "./index13.js";
1
+ var t = (e, n) => {
2
+ if (e === "slot")
3
+ return 0;
4
+ if (e instanceof Function)
5
+ return e(n);
6
+ const { children: r, ...s } = n ?? {};
7
+ if (e === "svg")
8
+ throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
9
+ return [e, s, r];
10
+ };
2
11
  export {
3
- f as default
12
+ t as createElement,
13
+ t as h,
14
+ t as jsx,
15
+ t as jsxDEV,
16
+ t as jsxs
4
17
  };
package/dist/index44.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index14.js";
1
+ import f from "./index10.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index45.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index15.js";
1
+ import f from "./index11.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index46.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index16.js";
1
+ import f from "./index12.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index47.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index18.js";
1
+ import f from "./index13.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index48.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index19.js";
1
+ import f from "./index14.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index49.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index20.js";
1
+ import f from "./index15.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index50.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index22.js";
1
+ import f from "./index16.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index51.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index23.js";
1
+ import f from "./index18.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index52.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index24.js";
1
+ import f from "./index19.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index53.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index25.js";
1
+ import f from "./index20.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index54.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index26.js";
1
+ import f from "./index22.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index55.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index27.js";
1
+ import f from "./index23.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index56.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index28.js";
1
+ import f from "./index24.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index57.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index29.js";
1
+ import f from "./index25.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index58.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index30.js";
1
+ import f from "./index26.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index59.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index31.js";
1
+ import f from "./index27.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index60.js CHANGED
@@ -1,4 +1,4 @@
1
- const e = /* @__PURE__ */ Symbol("VizelThemeContext");
1
+ import f from "./index28.js";
2
2
  export {
3
- e as VIZEL_THEME_CONTEXT_KEY
3
+ f as default
4
4
  };
@@ -0,0 +1,4 @@
1
+ import f from "./index29.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index30.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index31.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index32.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index33.js";
2
+ export {
3
+ f as default
4
+ };