@vizel/vue 0.0.1-alpha.1 → 0.0.1-alpha.4

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 (55) hide show
  1. package/dist/index.d.ts +7 -7
  2. package/dist/index.js +69 -61
  3. package/dist/index10.js +80 -127
  4. package/dist/index11.js +55 -24
  5. package/dist/index12.js +28 -8
  6. package/dist/index13.js +60 -75
  7. package/dist/index14.js +98 -124
  8. package/dist/index15.js +9 -31
  9. package/dist/index16.js +184 -14
  10. package/dist/index17.js +14 -77
  11. package/dist/index18.js +28 -113
  12. package/dist/index19.js +128 -14
  13. package/dist/index2.js +73 -82
  14. package/dist/index20.js +24 -46
  15. package/dist/index21.js +10 -41
  16. package/dist/index22.js +12 -10
  17. package/dist/index23.js +89 -14
  18. package/dist/index24.js +130 -33
  19. package/dist/index25.js +34 -45
  20. package/dist/index26.js +19 -22
  21. package/dist/index27.js +77 -8
  22. package/dist/index28.js +118 -44
  23. package/dist/index29.js +18 -20
  24. package/dist/index3.js +49 -56
  25. package/dist/index30.js +50 -13
  26. package/dist/index31.js +41 -2
  27. package/dist/index32.js +36 -2
  28. package/dist/index33.js +46 -2
  29. package/dist/index34.js +22 -2
  30. package/dist/index35.js +8 -2
  31. package/dist/index36.js +44 -2
  32. package/dist/index37.js +21 -2
  33. package/dist/index38.js +13 -2
  34. package/dist/index39.js +15 -2
  35. package/dist/index4.js +236 -30
  36. package/dist/index47.js +1 -1
  37. package/dist/index48.js +1 -1
  38. package/dist/index49.js +1 -1
  39. package/dist/index5.js +78 -70
  40. package/dist/index50.js +1 -1
  41. package/dist/index51.js +1 -1
  42. package/dist/index52.js +4 -0
  43. package/dist/index53.js +4 -0
  44. package/dist/index54.js +4 -0
  45. package/dist/index55.js +4 -0
  46. package/dist/index56.js +4 -0
  47. package/dist/index57.js +4 -0
  48. package/dist/index58.js +4 -0
  49. package/dist/index59.js +4 -0
  50. package/dist/index6.js +72 -103
  51. package/dist/index60.js +4 -0
  52. package/dist/index7.js +62 -11
  53. package/dist/index8.js +57 -186
  54. package/dist/index9.js +2 -35
  55. package/package.json +25 -32
package/dist/index17.js CHANGED
@@ -1,79 +1,16 @@
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
- });
1
+ import { inject as t, computed as i } from "vue";
2
+ const o = /* @__PURE__ */ Symbol("vizel-editor");
3
+ function r() {
4
+ const e = t(o);
5
+ if (!e)
6
+ throw new Error("useVizelContext must be used within a VizelProvider");
7
+ return i(() => e());
8
+ }
9
+ function u() {
10
+ return t(o, null);
11
+ }
77
12
  export {
78
- $ as default
13
+ o as VIZEL_CONTEXT_KEY,
14
+ r as useVizelContext,
15
+ u as useVizelContextSafe
79
16
  };
package/dist/index18.js CHANGED
@@ -1,120 +1,35 @@
1
- import { defineComponent as A, useSlots as K, ref as C, computed as z, watch as $, nextTick as M, createElementBlock as u, openBlock as r, normalizeClass as O, Fragment as k, renderSlot as d, createBlock as _, unref as g, renderList as w, createElementVNode as T, toDisplayString as F } from "vue";
2
- import { groupVizelSlashCommands as H } from "@vizel/core";
3
- import L from "./index19.js";
4
- import S from "./index20.js";
5
- const N = {
6
- key: 0,
7
- class: "vizel-slash-menu-group",
8
- "data-vizel-slash-menu-group": ""
9
- }, R = { class: "vizel-slash-menu-group-header" }, P = /* @__PURE__ */ A({
10
- __name: "VizelSlashMenu",
1
+ import { defineComponent as d, ref as m, computed as f, watch as v, createElementBlock as u, createCommentVNode as C, openBlock as _, normalizeClass as w } from "vue";
2
+ import { useVizelContextSafe as E } from "./index17.js";
3
+ const x = /* @__PURE__ */ d({
4
+ __name: "VizelEditor",
11
5
  props: {
12
- items: {},
13
- class: {},
14
- showGroups: { type: Boolean, default: !0 },
15
- groupOrder: {}
6
+ editor: {},
7
+ class: {}
16
8
  },
17
- emits: ["command"],
18
- setup(b, { expose: D, emit: G }) {
19
- const m = b, B = G, p = K(), n = C(0), y = C([]), c = z(() => !m.showGroups || m.items.length <= 5 ? [{ name: "", items: m.items }] : H(m.items, m.groupOrder)), f = z(() => c.value.flatMap((e) => e.items));
20
- $(
21
- () => m.items,
22
- () => {
23
- n.value = 0, y.value = [];
9
+ setup(a, { expose: c }) {
10
+ const l = a, t = m(null), p = E(), i = f(() => l.editor ?? p?.());
11
+ return c({
12
+ get container() {
13
+ return t.value;
24
14
  }
25
- ), $(n, async (e) => {
26
- await M();
27
- const a = y.value[e];
28
- a && a.scrollIntoView({ block: "nearest", behavior: "smooth" });
29
- });
30
- function v(e) {
31
- const a = f.value[e];
32
- a && B("command", a);
33
- }
34
- function E() {
35
- if (c.value.length <= 1) return;
36
- let e = 0, a = 0;
37
- for (let t = 0; t < c.value.length; t++) {
38
- const s = c.value[t];
39
- if (s) {
40
- if (n.value < a + s.items.length) {
41
- e = t;
42
- break;
43
- }
44
- a += s.items.length;
45
- }
46
- }
47
- const i = (e + 1) % c.value.length;
48
- let l = 0;
49
- for (let t = 0; t < i; t++) {
50
- const s = c.value[t];
51
- s && (l += s.items.length);
52
- }
53
- n.value = l;
54
- }
55
- function V(e) {
56
- return e.key === "ArrowUp" ? (n.value = (n.value + f.value.length - 1) % f.value.length, !0) : e.key === "ArrowDown" ? (n.value = (n.value + 1) % f.value.length, !0) : e.key === "Enter" ? (v(n.value), !0) : e.key === "Tab" ? (e.preventDefault(), E(), !0) : !1;
57
- }
58
- D({
59
- onKeyDown: V
60
- });
61
- function o(e, a) {
62
- let i = 0;
63
- for (let l = 0; l < e; l++) {
64
- const t = c.value[l];
65
- t && (i += t.items.length);
66
- }
67
- return i + a;
68
- }
69
- return (e, a) => (r(), u("div", {
70
- class: O(["vizel-slash-menu", e.$props.class]),
71
- "data-vizel-slash-menu": ""
72
- }, [
73
- f.value.length === 0 ? (r(), u(k, { key: 0 }, [
74
- g(p).empty ? d(e.$slots, "empty", { key: 0 }) : (r(), _(L, { key: 1 }))
75
- ], 64)) : (r(!0), u(k, { key: 1 }, w(c.value, (i, l) => (r(), u(k, {
76
- key: i.name || l
77
- }, [
78
- i.name ? (r(), u("div", N, [
79
- T("div", R, F(i.name), 1),
80
- (r(!0), u(k, null, w(i.items, (t, s) => (r(), u("div", {
81
- key: t.title,
82
- ref_for: !0,
83
- ref: (h) => y.value[o(l, s)] = h
84
- }, [
85
- g(p).item ? d(e.$slots, "item", {
86
- key: 0,
87
- item: t,
88
- isSelected: o(l, s) === n.value,
89
- onClick: () => v(o(l, s))
90
- }) : (r(), _(S, {
91
- key: 1,
92
- item: t,
93
- "is-selected": o(l, s) === n.value,
94
- onClick: (h) => v(o(l, s))
95
- }, null, 8, ["item", "is-selected", "onClick"]))
96
- ]))), 128))
97
- ])) : (r(!0), u(k, { key: 1 }, w(i.items, (t, s) => (r(), u("div", {
98
- key: t.title,
99
- ref_for: !0,
100
- ref: (h) => y.value[o(l, s)] = h
101
- }, [
102
- g(p).item ? d(e.$slots, "item", {
103
- key: 0,
104
- item: t,
105
- isSelected: o(l, s) === n.value,
106
- onClick: () => v(o(l, s))
107
- }) : (r(), _(S, {
108
- key: 1,
109
- item: t,
110
- "is-selected": o(l, s) === n.value,
111
- onClick: (h) => v(o(l, s))
112
- }, null, 8, ["item", "is-selected", "onClick"]))
113
- ]))), 128))
114
- ], 64))), 128))
115
- ], 2));
15
+ }), v(
16
+ () => [i.value, t.value],
17
+ ([e, o], s) => {
18
+ const n = s?.[0], r = s?.[1];
19
+ n && r && n.view.dom.parentNode === r && r.removeChild(n.view.dom), e && o && (o.appendChild(e.view.dom), e.view.setProps({
20
+ editable: () => e?.isEditable ?? !1
21
+ }));
22
+ },
23
+ { immediate: !0 }
24
+ ), (e, o) => i.value ? (_(), u("div", {
25
+ key: 0,
26
+ ref_key: "containerRef",
27
+ ref: t,
28
+ class: w(e.$props.class),
29
+ "data-vizel-content": ""
30
+ }, null, 2)) : C("", !0);
116
31
  }
117
32
  });
118
33
  export {
119
- P as default
34
+ x as default
120
35
  };
package/dist/index19.js CHANGED
@@ -1,21 +1,135 @@
1
- import { defineComponent as a, useSlots as o, createElementBlock as s, openBlock as t, normalizeClass as n, renderSlot as r, unref as p, Fragment as m, createTextVNode as u } from "vue";
2
- const f = /* @__PURE__ */ a({
3
- __name: "VizelSlashMenuEmpty",
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 "./index20.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",
4
14
  props: {
5
- class: {}
15
+ data: {},
16
+ class: {},
17
+ selected: { type: Boolean }
6
18
  },
7
- setup(c) {
8
- const l = o();
9
- return (e, d) => (t(), s("div", {
10
- class: n(["vizel-slash-menu-empty", e.$props.class]),
11
- "data-vizel-slash-menu-empty": ""
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
12
57
  }, [
13
- p(l).default ? r(e.$slots, "default", { key: 0 }) : (t(), s(m, { key: 1 }, [
14
- u("No results")
15
- ], 64))
16
- ], 2));
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));
17
131
  }
18
132
  });
19
133
  export {
20
- f as default
134
+ O as default
21
135
  };
package/dist/index2.js CHANGED
@@ -1,88 +1,79 @@
1
- import { defineComponent as B, mergeModels as m, useModel as M, useSlots as g, watch as y, createElementBlock as h, openBlock as n, normalizeClass as C, createBlock as s, createCommentVNode as f, renderSlot as c, unref as a, withCtx as z } from "vue";
2
- import { getVizelMarkdown as b, setVizelMarkdown as D } from "@vizel/core";
3
- import { useVizelEditor as E } from "./index26.js";
4
- import p from "./index3.js";
5
- import U from "./index9.js";
6
- const F = /* @__PURE__ */ B({
7
- __name: "Vizel",
8
- props: /* @__PURE__ */ m({
9
- initialContent: {},
10
- initialMarkdown: {},
11
- transformDiagramsOnImport: { type: Boolean, default: !0 },
12
- placeholder: {},
13
- editable: { type: Boolean, default: !0 },
14
- autofocus: { type: [Boolean, String, Number], default: !1 },
15
- features: {},
16
- class: {},
17
- showBubbleMenu: { type: Boolean, default: !0 },
18
- enableEmbed: { type: Boolean, default: !1 }
19
- }, {
20
- markdown: {},
21
- markdownModifiers: {}
22
- }),
23
- emits: /* @__PURE__ */ m(["update", "create", "destroy", "selectionUpdate", "focus", "blur"], ["update:markdown"]),
24
- setup(r, { expose: k, emit: v }) {
25
- const o = r, l = v, i = M(r, "markdown"), w = g();
26
- let d = !1;
27
- const t = E({
28
- ...o.initialContent !== void 0 && { initialContent: o.initialContent },
29
- ...o.initialMarkdown !== void 0 && { initialMarkdown: o.initialMarkdown },
30
- transformDiagramsOnImport: o.transformDiagramsOnImport,
31
- ...o.placeholder !== void 0 && { placeholder: o.placeholder },
32
- editable: o.editable,
33
- autofocus: o.autofocus,
34
- ...o.features !== void 0 && { features: o.features },
35
- onUpdate: (e) => {
36
- l("update", e), !d && i.value !== void 0 && (i.value = b(e.editor));
1
+ import { Mark as a, markPasteRule as r, markInputRule as s, mergeAttributes as o } from "@tiptap/core";
2
+ import { createElement as n } from "./index39.js";
3
+ var d = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, i = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, l = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, u = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
4
+ a.create({
5
+ name: "bold",
6
+ addOptions() {
7
+ return {
8
+ HTMLAttributes: {}
9
+ };
10
+ },
11
+ parseHTML() {
12
+ return [
13
+ {
14
+ tag: "strong"
37
15
  },
38
- onCreate: (e) => l("create", e),
39
- onDestroy: () => l("destroy"),
40
- onSelectionUpdate: (e) => l("selectionUpdate", e),
41
- onFocus: (e) => l("focus", e),
42
- onBlur: (e) => l("blur", e)
43
- });
44
- return y(i, (e) => {
45
- if (e === void 0 || !t.value) return;
46
- const u = b(t.value);
47
- e !== u && (d = !0, D(t.value, e, {
48
- transformDiagrams: o.transformDiagramsOnImport
49
- }), d = !1);
50
- }), k({
51
- /** The underlying Tiptap editor instance */
52
- get editor() {
53
- return t.value;
16
+ {
17
+ tag: "b",
18
+ getAttrs: (t) => t.style.fontWeight !== "normal" && null
54
19
  },
55
- /**
56
- * Get the underlying Tiptap editor instance
57
- * @deprecated Use the `editor` property instead
58
- */
59
- getEditor: () => t.value
60
- }), (e, u) => (n(), h("div", {
61
- class: C(["vizel-root", e.$props.class]),
62
- "data-vizel-root": ""
63
- }, [
64
- a(t) ? (n(), s(U, {
65
- key: 0,
66
- editor: a(t)
67
- }, null, 8, ["editor"])) : f("", !0),
68
- r.showBubbleMenu && a(t) && a(w)["bubble-menu"] ? (n(), s(p, {
69
- key: 1,
70
- editor: a(t),
71
- "enable-embed": r.enableEmbed ?? !1
72
- }, {
73
- default: z(() => [
74
- c(e.$slots, "bubble-menu", { editor: a(t) })
75
- ]),
76
- _: 3
77
- }, 8, ["editor", "enable-embed"])) : r.showBubbleMenu && a(t) ? (n(), s(p, {
78
- key: 2,
79
- editor: a(t),
80
- "enable-embed": r.enableEmbed ?? !1
81
- }, null, 8, ["editor", "enable-embed"])) : f("", !0),
82
- c(e.$slots, "default", { editor: a(t) })
83
- ], 2));
20
+ {
21
+ style: "font-weight=400",
22
+ clearMark: (t) => t.type.name === this.name
23
+ },
24
+ {
25
+ style: "font-weight",
26
+ getAttrs: (t) => /^(bold(er)?|[5-9]\d{2,})$/.test(t) && null
27
+ }
28
+ ];
29
+ },
30
+ renderHTML({ HTMLAttributes: t }) {
31
+ return /* @__PURE__ */ n("strong", { ...o(this.options.HTMLAttributes, t), children: /* @__PURE__ */ n("slot", {}) });
32
+ },
33
+ markdownTokenName: "strong",
34
+ parseMarkdown: (t, e) => e.applyMark("bold", e.parseInline(t.tokens || [])),
35
+ renderMarkdown: (t, e) => `**${e.renderChildren(t)}**`,
36
+ addCommands() {
37
+ return {
38
+ setBold: () => ({ commands: t }) => t.setMark(this.name),
39
+ toggleBold: () => ({ commands: t }) => t.toggleMark(this.name),
40
+ unsetBold: () => ({ commands: t }) => t.unsetMark(this.name)
41
+ };
42
+ },
43
+ addKeyboardShortcuts() {
44
+ return {
45
+ "Mod-b": () => this.editor.commands.toggleBold(),
46
+ "Mod-B": () => this.editor.commands.toggleBold()
47
+ };
48
+ },
49
+ addInputRules() {
50
+ return [
51
+ s({
52
+ find: d,
53
+ type: this.type
54
+ }),
55
+ s({
56
+ find: l,
57
+ type: this.type
58
+ })
59
+ ];
60
+ },
61
+ addPasteRules() {
62
+ return [
63
+ r({
64
+ find: i,
65
+ type: this.type
66
+ }),
67
+ r({
68
+ find: u,
69
+ type: this.type
70
+ })
71
+ ];
84
72
  }
85
73
  });
86
74
  export {
87
- F as default
75
+ d as starInputRegex,
76
+ i as starPasteRegex,
77
+ l as underscoreInputRegex,
78
+ u as underscorePasteRegex
88
79
  };
package/dist/index20.js CHANGED
@@ -1,52 +1,30 @@
1
- import { defineComponent as r, createElementBlock as t, openBlock as s, normalizeClass as u, createElementVNode as l, createCommentVNode as k, createVNode as v, Fragment as c, renderList as z, unref as f, toDisplayString as n, createTextVNode as y } from "vue";
2
- import { splitVizelTextByMatches as g } from "@vizel/core";
3
- import x from "./index11.js";
4
- const V = ["data-selected"], p = { class: "vizel-slash-menu-icon" }, S = { class: "vizel-slash-menu-text" }, _ = { class: "vizel-slash-menu-title" }, B = {
5
- key: 0,
6
- class: "vizel-slash-menu-highlight"
7
- }, C = { class: "vizel-slash-menu-description" }, M = {
8
- key: 0,
9
- class: "vizel-slash-menu-shortcut"
10
- }, E = /* @__PURE__ */ r({
11
- __name: "VizelSlashMenuItem",
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 "./index21.js";
5
+ const g = /* @__PURE__ */ c({
6
+ __name: "VizelIcon",
12
7
  props: {
13
- item: {},
14
- isSelected: { type: Boolean },
15
- class: {},
16
- titleMatches: {}
8
+ name: {},
9
+ customIcons: {},
10
+ width: {},
11
+ height: {},
12
+ color: {}
17
13
  },
18
- emits: ["click"],
19
- setup(e, { emit: o }) {
20
- const m = o;
21
- return (d, a) => (s(), t("button", {
22
- type: "button",
23
- class: u([
24
- "vizel-slash-menu-item",
25
- { "is-selected": e.isSelected },
26
- d.$props.class
27
- ]),
28
- "data-selected": e.isSelected || void 0,
29
- onClick: a[0] || (a[0] = (i) => m("click"))
30
- }, [
31
- l("span", p, [
32
- v(x, {
33
- name: e.item.icon
34
- }, null, 8, ["name"])
35
- ]),
36
- l("div", S, [
37
- l("span", _, [
38
- (s(!0), t(c, null, z(f(g)(e.item.title, e.titleMatches), (i, h) => (s(), t(c, { key: h }, [
39
- i.highlight ? (s(), t("mark", B, n(i.text), 1)) : (s(), t(c, { key: 1 }, [
40
- y(n(i.text), 1)
41
- ], 64))
42
- ], 64))), 128))
43
- ]),
44
- l("span", C, n(e.item.description), 1)
45
- ]),
46
- e.item.shortcut ? (s(), t("span", M, n(e.item.shortcut), 1)) : k("", !0)
47
- ], 10, V));
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"]));
48
26
  }
49
27
  });
50
28
  export {
51
- E as default
29
+ g as default
52
30
  };