@vizel/core 0.0.1-alpha.1 → 0.0.1-alpha.3

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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +13 -13
  3. package/dist/index.js +141 -141
  4. package/dist/index10.js +70 -110
  5. package/dist/index11.js +135 -168
  6. package/dist/index12.js +83 -74
  7. package/dist/index13.js +13 -134
  8. package/dist/index14.js +13 -146
  9. package/dist/index15.js +303 -15
  10. package/dist/index16.js +69 -14
  11. package/dist/index17.js +26 -295
  12. package/dist/index18.js +2 -2
  13. package/dist/index19.js +355 -24
  14. package/dist/index20.js +25 -264
  15. package/dist/index21.js +85 -68
  16. package/dist/index22.js +97 -353
  17. package/dist/index23.js +66 -84
  18. package/dist/index24.js +12 -36
  19. package/dist/index25.js +53 -92
  20. package/dist/index26.js +132 -96
  21. package/dist/index27.js +59 -126
  22. package/dist/index28.js +37 -53
  23. package/dist/index29.js +19 -62
  24. package/dist/index3.js +165 -60
  25. package/dist/index30.js +9 -37
  26. package/dist/index31.js +143 -19
  27. package/dist/index32.js +264 -11
  28. package/dist/index33.js +92 -9
  29. package/dist/index34.js +63 -16
  30. package/dist/index35.js +4 -58
  31. package/dist/index36.js +123 -15
  32. package/dist/index37.js +305 -42
  33. package/dist/index38.js +487 -4
  34. package/dist/index39.js +37 -112
  35. package/dist/index4.js +10 -86
  36. package/dist/index40.js +653 -301
  37. package/dist/index41.js +4 -487
  38. package/dist/index42.js +4 -48
  39. package/dist/index43.js +206 -642
  40. package/dist/index44.js +82 -4
  41. package/dist/index45.js +17 -4
  42. package/dist/index46.js +57 -237
  43. package/dist/index47.js +15 -82
  44. package/dist/index48.js +190 -274
  45. package/dist/index49.js +281 -1497
  46. package/dist/index5.js +132 -10
  47. package/dist/index50.js +1502 -5
  48. package/dist/index51.js +5 -1561
  49. package/dist/index52.js +1551 -192
  50. package/dist/index53.js +1 -1
  51. package/dist/index54.js +84 -21
  52. package/dist/index55.js +246 -10
  53. package/dist/index56.js +3 -7
  54. package/dist/index57.js +1231 -7
  55. package/dist/index58.js +731 -11
  56. package/dist/index59.js +21 -19
  57. package/dist/index6.js +48 -131
  58. package/dist/index60.js +10 -25
  59. package/dist/index61.js +6 -83
  60. package/dist/index62.js +7 -245
  61. package/dist/index63.js +11 -1229
  62. package/dist/index64.js +17 -732
  63. package/dist/index65.js +25 -3
  64. package/dist/index66.js +53 -1059
  65. package/dist/index67.js +1059 -53
  66. package/dist/index69.js +90 -3
  67. package/dist/index7.js +228 -409
  68. package/dist/index70.js +3 -90
  69. package/dist/index8.js +111 -45
  70. package/dist/index9.js +409 -228
  71. package/package.json +54 -80
package/dist/index27.js CHANGED
@@ -1,136 +1,69 @@
1
- import { createVizelImageUploader as p } from "./index14.js";
2
- function y(e) {
3
- const { features: t, createSlashMenuRenderer: a } = e;
4
- if (!t)
5
- return {
6
- slashCommand: {
7
- suggestion: a()
8
- }
9
- };
10
- if (t.slashCommand === !1)
11
- return t;
12
- const o = typeof t.slashCommand == "object" ? t.slashCommand : {};
13
- return o.suggestion ? t : {
14
- ...t,
15
- slashCommand: {
16
- ...o,
17
- suggestion: a()
18
- }
19
- };
1
+ import { transformVizelDiagramCodeBlocks as c, convertVizelCodeBlocksToDiagrams as d } from "./index26.js";
2
+ const m = 300;
3
+ function u(n) {
4
+ return typeof n.getMarkdown == "function";
20
5
  }
21
- const f = (e) => e instanceof CustomEvent && typeof e.detail == "object" && e.detail !== null && "file" in e.detail && "editor" in e.detail;
22
- function g(e) {
23
- return (t) => {
24
- const a = e.getEditor();
25
- if (!a || !f(t)) return;
26
- const { file: o } = t.detail, n = a.state.selection.from, r = e.getImageOptions();
27
- p({
28
- onUpload: r.onUpload ?? ((i) => new Promise((l) => {
29
- const s = new FileReader();
30
- s.onload = () => {
31
- typeof s.result == "string" && l(s.result);
32
- }, s.readAsDataURL(i);
33
- })),
34
- ...r.maxFileSize !== void 0 && { maxFileSize: r.maxFileSize },
35
- ...r.allowedTypes !== void 0 && { allowedTypes: r.allowedTypes },
36
- ...r.onValidationError !== void 0 && {
37
- onValidationError: r.onValidationError
38
- },
39
- ...r.onUploadError !== void 0 && {
40
- onUploadError: r.onUploadError
41
- }
42
- })(o, a.view, n);
43
- };
44
- }
45
- const u = "vizel:upload-image";
46
- function z(e) {
47
- const t = g(e);
48
- return document.addEventListener(u, t), () => {
49
- document.removeEventListener(u, t);
50
- };
6
+ function s(n) {
7
+ return n ? u(n) ? n.getMarkdown() : (console.warn(
8
+ "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
9
+ ), "") : "";
51
10
  }
52
- const v = {
53
- attributes: {
54
- class: "vizel-editor"
11
+ function f(n, r, a = {}) {
12
+ if (!n) return;
13
+ const { transformDiagrams: t = !0 } = a;
14
+ if (!u(n)) {
15
+ console.warn(
16
+ "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
17
+ );
18
+ return;
55
19
  }
56
- };
57
- function h(e) {
58
- return "characterCount" in e && typeof e.characterCount == "object" && e.characterCount !== null && "characters" in e.characterCount && "words" in e.characterCount;
20
+ n.commands.setContent(r, { contentType: "markdown" }), t && d(n);
59
21
  }
60
- function U(e) {
61
- if (!e)
62
- return {
63
- isFocused: !1,
64
- isEmpty: !0,
65
- canUndo: !1,
66
- canRedo: !1,
67
- characterCount: 0,
68
- wordCount: 0
69
- };
70
- const t = e.storage;
71
- let a = 0, o = 0;
72
- return h(t) && (a = t.characterCount.characters(), o = t.characterCount.words()), {
73
- isFocused: e.isFocused,
74
- isEmpty: e.isEmpty,
75
- canUndo: e.can().undo(),
76
- canRedo: e.can().redo(),
77
- characterCount: a,
78
- wordCount: o
79
- };
22
+ function g(n, r, a = {}) {
23
+ if (!n) return null;
24
+ const { transformDiagrams: t = !0 } = a, o = n.markdown;
25
+ if (!o?.parse)
26
+ return console.warn(
27
+ "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
28
+ ), null;
29
+ const e = o.parse(r);
30
+ return t && e?.type ? c(e) : e;
80
31
  }
81
- const d = {
82
- mermaid: "mermaid",
83
- dot: "graphviz",
84
- graphviz: "graphviz"
85
- };
86
- function E(e) {
87
- if (!e) return e;
88
- const t = e.attrs?.language;
89
- return e.type === "codeBlock" && t && t in d ? {
90
- type: "diagram",
91
- attrs: {
92
- code: e.content?.map((o) => o.text || "").join("").trim() || "",
93
- type: d[t]
94
- }
95
- } : e.content && Array.isArray(e.content) ? {
96
- ...e,
97
- content: e.content.map(E)
98
- } : e;
32
+ function z(n, r, a = {}) {
33
+ const { transformDiagrams: t = !0 } = a;
34
+ f(n, r, { transformDiagrams: t });
99
35
  }
100
- function V(e) {
101
- const t = e.schema.nodes.diagram;
102
- if (!t) return;
103
- const a = [];
104
- if (e.state.doc.descendants((n, r) => {
105
- if (n.type.name === "codeBlock") {
106
- const c = n.attrs.language, i = c ? d[c] : void 0;
107
- i && a.push({
108
- from: r,
109
- to: r + n.nodeSize,
110
- code: n.textContent.trim(),
111
- type: i
112
- });
36
+ function V(n = {}) {
37
+ const { debounceMs: r = m, transformDiagrams: a = !0 } = n;
38
+ let t = "", o = !1, e = null;
39
+ return {
40
+ handleUpdate: (i) => {
41
+ if (r === 0) {
42
+ t = s(i);
43
+ return;
44
+ }
45
+ o = !0, e && clearTimeout(e), e = setTimeout(() => {
46
+ t = s(i), o = !1, e = null;
47
+ }, r);
48
+ },
49
+ getMarkdown: () => t,
50
+ setMarkdown: (i, l) => {
51
+ e && (clearTimeout(e), e = null), o = !1, f(i, l, { transformDiagrams: a }), t = l;
52
+ },
53
+ isPending: () => o,
54
+ flush: (i) => {
55
+ e && (clearTimeout(e), e = null), t = s(i), o = !1;
56
+ },
57
+ destroy: () => {
58
+ e && (clearTimeout(e), e = null);
113
59
  }
114
- }), a.length === 0) return;
115
- let { tr: o } = e.state;
116
- for (let n = a.length - 1; n >= 0; n--) {
117
- const r = a[n];
118
- if (!r) continue;
119
- const { from: c, to: i, code: l, type: s } = r, m = t.create({
120
- code: l,
121
- type: s
122
- });
123
- o = o.replaceWith(c, i, m);
124
- }
125
- e.view.dispatch(o);
60
+ };
126
61
  }
127
62
  export {
128
- u as VIZEL_UPLOAD_IMAGE_EVENT,
129
- V as convertVizelCodeBlocksToDiagrams,
130
- g as createVizelUploadEventHandler,
131
- U as getVizelEditorState,
132
- z as registerVizelUploadEventHandler,
133
- y as resolveVizelFeatures,
134
- E as transformVizelDiagramCodeBlocks,
135
- v as vizelDefaultEditorProps
63
+ m as VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS,
64
+ V as createVizelMarkdownSyncHandlers,
65
+ s as getVizelMarkdown,
66
+ z as initializeVizelMarkdownContent,
67
+ g as parseVizelMarkdown,
68
+ f as setVizelMarkdown
136
69
  };
package/dist/index28.js CHANGED
@@ -1,56 +1,40 @@
1
- import { Editor as E } from "@tiptap/core";
2
- import { createVizelExtensions as w } from "./index11.js";
3
- import { resolveVizelFeatures as D, vizelDefaultEditorProps as V } from "./index27.js";
4
- import { initializeVizelMarkdownContent as F } from "./index29.js";
5
- function y(f) {
6
- const {
7
- initialContent: o,
8
- initialMarkdown: t,
9
- transformDiagramsOnImport: p = !0,
10
- placeholder: r,
11
- editable: v = !0,
12
- autofocus: z = !1,
13
- features: e,
14
- extensions: g = [],
15
- createSlashMenuRenderer: x,
16
- onUpdate: n,
17
- onCreate: i,
18
- onDestroy: a,
19
- onSelectionUpdate: s,
20
- onFocus: d,
21
- onBlur: l
22
- } = f, c = D({
23
- ...e !== void 0 && { features: e },
24
- createSlashMenuRenderer: x
25
- }), C = typeof e?.image == "object" ? e.image : {}, m = t ? (u) => {
26
- F(u.editor, t, {
27
- transformDiagrams: p
28
- }), i?.(u);
29
- } : i;
30
- return {
31
- editor: new E({
32
- extensions: [
33
- ...w({
34
- ...r !== void 0 && { placeholder: r },
35
- ...c !== void 0 && { features: c }
36
- }),
37
- ...g
38
- ],
39
- // Only set initialContent if initialMarkdown is not provided
40
- ...!t && o !== void 0 && { content: o },
41
- editable: v,
42
- autofocus: z,
43
- editorProps: V,
44
- ...n && { onUpdate: n },
45
- ...m && { onCreate: m },
46
- ...a && { onDestroy: a },
47
- ...s && { onSelectionUpdate: s },
48
- ...d && { onFocus: d },
49
- ...l && { onBlur: l }
50
- }),
51
- imageOptions: C
52
- };
1
+ const o = "vizel-portal-root", i = {
2
+ /** Base layer for dropdowns and menus */
3
+ dropdown: 50,
4
+ /** Layer for modals and dialogs */
5
+ modal: 100,
6
+ /** Layer for tooltips (highest priority) */
7
+ tooltip: 150
8
+ };
9
+ function a() {
10
+ let e = document.getElementById(o);
11
+ return e || (e = document.createElement("div"), e.id = o, e.setAttribute("data-vizel-portal", ""), document.body.appendChild(e)), e;
12
+ }
13
+ function c() {
14
+ return document.getElementById(o) !== null;
15
+ }
16
+ function u() {
17
+ const e = document.getElementById(o);
18
+ e?.parentNode && e.parentNode.removeChild(e);
19
+ }
20
+ function d(e = "dropdown") {
21
+ const t = document.createElement("div");
22
+ return t.setAttribute("data-vizel-portal-layer", e), t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.zIndex = String(i[e]), t;
23
+ }
24
+ function m(e, t = {}) {
25
+ const { layer: r = "dropdown", className: l } = t, n = d(r);
26
+ return l && (n.className = l), n.appendChild(e), a().appendChild(n), n;
27
+ }
28
+ function s(e) {
29
+ e.parentNode && e.parentNode.removeChild(e);
53
30
  }
54
31
  export {
55
- y as createVizelEditorInstance
32
+ o as VIZEL_PORTAL_ID,
33
+ i as VIZEL_PORTAL_Z_INDEX,
34
+ d as createVizelPortalElement,
35
+ a as getVizelPortalContainer,
36
+ c as hasVizelPortalContainer,
37
+ m as mountToVizelPortal,
38
+ u as removeVizelPortalContainer,
39
+ s as unmountFromVizelPortal
56
40
  };
package/dist/index29.js CHANGED
@@ -1,69 +1,26 @@
1
- import { transformVizelDiagramCodeBlocks as c, convertVizelCodeBlocksToDiagrams as d } from "./index27.js";
2
- const m = 300;
3
- function u(n) {
4
- return typeof n.getMarkdown == "function";
5
- }
6
- function s(n) {
7
- return n ? u(n) ? n.getMarkdown() : (console.warn(
8
- "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
9
- ), "") : "";
10
- }
11
- function f(n, r, a = {}) {
12
- if (!n) return;
13
- const { transformDiagrams: t = !0 } = a;
14
- if (!u(n)) {
15
- console.warn(
16
- "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
17
- );
18
- return;
19
- }
20
- n.commands.setContent(r, { contentType: "markdown" }), t && d(n);
21
- }
22
- function g(n, r, a = {}) {
23
- if (!n) return null;
24
- const { transformDiagrams: t = !0 } = a, o = n.markdown;
25
- if (!o?.parse)
26
- return console.warn(
27
- "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
28
- ), null;
29
- const e = o.parse(r);
30
- return t && e?.type ? c(e) : e;
31
- }
32
- function z(n, r, a = {}) {
33
- const { transformDiagrams: t = !0 } = a;
34
- f(n, r, { transformDiagrams: t });
35
- }
36
- function V(n = {}) {
37
- const { debounceMs: r = m, transformDiagrams: a = !0 } = n;
38
- let t = "", o = !1, e = null;
39
- return {
40
- handleUpdate: (i) => {
41
- if (r === 0) {
42
- t = s(i);
43
- return;
44
- }
45
- o = !0, e && clearTimeout(e), e = setTimeout(() => {
46
- t = s(i), o = !1, e = null;
47
- }, r);
48
- },
49
- getMarkdown: () => t,
50
- setMarkdown: (i, l) => {
51
- e && (clearTimeout(e), e = null), o = !1, f(i, l, { transformDiagrams: a }), t = l;
52
- },
53
- isPending: () => o,
54
- flush: (i) => {
55
- e && (clearTimeout(e), e = null), t = s(i), o = !1;
1
+ const r = "50";
2
+ function c() {
3
+ const e = document.createElement("div");
4
+ e.style.position = "absolute", e.style.zIndex = "50", document.body.appendChild(e);
5
+ const n = document.createElement("div");
6
+ return e.appendChild(n), {
7
+ container: e,
8
+ menuContainer: n,
9
+ updatePosition: (o) => {
10
+ if (!o) return;
11
+ const t = o();
12
+ t && (e.style.top = `${t.bottom + window.scrollY}px`, e.style.left = `${t.left + window.scrollX}px`);
56
13
  },
57
14
  destroy: () => {
58
- e && (clearTimeout(e), e = null);
15
+ e.remove();
59
16
  }
60
17
  };
61
18
  }
19
+ function d(e) {
20
+ return e.key === "Escape";
21
+ }
62
22
  export {
63
- m as VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS,
64
- V as createVizelMarkdownSyncHandlers,
65
- s as getVizelMarkdown,
66
- z as initializeVizelMarkdownContent,
67
- g as parseVizelMarkdown,
68
- f as setVizelMarkdown
23
+ r as VIZEL_SUGGESTION_Z_INDEX,
24
+ c as createVizelSuggestionContainer,
25
+ d as handleVizelSuggestionEscape
69
26
  };
package/dist/index3.js CHANGED
@@ -1,69 +1,174 @@
1
- const a = "system", d = "vizel-theme", i = "data-vizel-theme";
2
- function c() {
3
- return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1
+ import s from "@tiptap/extension-blockquote";
2
+ import m from "@tiptap/extension-bold";
3
+ import l from "@tiptap/extension-bullet-list";
4
+ import d from "@tiptap/extension-code";
5
+ import c from "@tiptap/extension-document";
6
+ import p from "@tiptap/extension-dropcursor";
7
+ import f from "@tiptap/extension-gapcursor";
8
+ import u from "@tiptap/extension-hard-break";
9
+ import h from "@tiptap/extension-heading";
10
+ import x from "@tiptap/extension-history";
11
+ import E from "@tiptap/extension-horizontal-rule";
12
+ import g from "@tiptap/extension-italic";
13
+ import b from "@tiptap/extension-list-item";
14
+ import k from "@tiptap/extension-list-keymap";
15
+ import z from "@tiptap/extension-ordered-list";
16
+ import y from "@tiptap/extension-paragraph";
17
+ import C from "@tiptap/extension-placeholder";
18
+ import V from "@tiptap/extension-strike";
19
+ import O from "@tiptap/extension-text";
20
+ import j from "./index34.js";
21
+ import { createVizelCharacterCountExtension as B } from "./index4.js";
22
+ import { createVizelCodeBlockExtension as a } from "./index5.js";
23
+ import { createVizelDetailsExtensions as L } from "./index6.js";
24
+ import { createVizelDiagramExtension as v } from "./index7.js";
25
+ import { createVizelDragHandleExtensions as w } from "./index8.js";
26
+ import { createVizelEmbedExtension as H } from "./index9.js";
27
+ import { vizelDefaultBase64Upload as T, createVizelImageUploadExtensions as D, defaultImageResizeOptions as S } from "./index11.js";
28
+ import { createVizelLinkExtension as U } from "./index13.js";
29
+ import { createVizelMarkdownExtension as I } from "./index14.js";
30
+ import { createVizelMathematicsExtensions as M } from "./index15.js";
31
+ import { VizelSlashCommand as F } from "./index17.js";
32
+ import { createVizelTableExtensions as P } from "./index18.js";
33
+ import { createVizelTaskListExtensions as R } from "./index20.js";
34
+ import { createVizelTextColorExtensions as q } from "./index21.js";
35
+ import { defaultSlashCommands as G } from "./index32.js";
36
+ function K(e = {}) {
37
+ const { headingLevels: o = [1, 2, 3] } = e;
38
+ return [
39
+ // Nodes
40
+ c,
41
+ y,
42
+ O,
43
+ h.configure({ levels: o }),
44
+ s,
45
+ l,
46
+ z,
47
+ b,
48
+ // CodeBlock is added separately based on feature options
49
+ u,
50
+ E,
51
+ // Marks
52
+ m,
53
+ d,
54
+ g,
55
+ V,
56
+ j,
57
+ // Functionality
58
+ p.configure({ color: "#3b82f6", width: 2 }),
59
+ f,
60
+ x,
61
+ k
62
+ ];
4
63
  }
5
- function m(t, e) {
6
- return t === "system" ? e : t;
64
+ function N(e, o) {
65
+ if (o.slashCommand === !1) return;
66
+ const t = typeof o.slashCommand == "object" ? o.slashCommand : {}, i = t.items ?? G;
67
+ e.push(
68
+ F.configure({
69
+ items: i,
70
+ ...t.suggestion !== void 0 && {
71
+ suggestion: t.suggestion
72
+ }
73
+ })
74
+ );
7
75
  }
8
- function s(t) {
9
- if (typeof window > "u")
10
- return null;
11
- try {
12
- const e = localStorage.getItem(t);
13
- if (e === "light" || e === "dark" || e === "system")
14
- return e;
15
- } catch {
16
- }
17
- return null;
76
+ function _(e, o) {
77
+ if (o.image === !1) return;
78
+ const t = typeof o.image == "object" ? o.image : {}, i = t.onUpload ?? T, n = t.resize !== !1;
79
+ e.push(
80
+ ...D({
81
+ upload: {
82
+ onUpload: i,
83
+ ...t.maxFileSize !== void 0 && { maxFileSize: t.maxFileSize },
84
+ ...t.allowedTypes !== void 0 && { allowedTypes: t.allowedTypes },
85
+ ...t.onValidationError !== void 0 && {
86
+ onValidationError: t.onValidationError
87
+ },
88
+ ...t.onUploadError !== void 0 && {
89
+ onUploadError: t.onUploadError
90
+ }
91
+ },
92
+ resize: n ? S : !1
93
+ })
94
+ );
18
95
  }
19
- function u(t, e) {
20
- if (!(typeof window > "u"))
21
- try {
22
- localStorage.setItem(t, e);
23
- } catch {
24
- }
96
+ function A(e, o) {
97
+ if (o.markdown === !1) return;
98
+ const t = typeof o.markdown == "object" ? o.markdown : {};
99
+ e.push(I(t));
25
100
  }
26
- function l(t, e, n) {
27
- if (typeof document > "u")
28
- return;
29
- const r = e ? document.querySelector(e) : document.documentElement;
30
- if (r) {
31
- if (n) {
32
- const o = document.createElement("style");
33
- o.appendChild(
34
- document.createTextNode(
35
- "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}"
36
- )
37
- ), document.head.appendChild(o), window.getComputedStyle(document.body), setTimeout(() => {
38
- document.head.removeChild(o);
39
- }, 1);
40
- }
41
- r.setAttribute(i, t);
42
- }
101
+ function J(e, o) {
102
+ if (o.taskList === !1) return;
103
+ const t = typeof o.taskList == "object" ? o.taskList : {};
104
+ e.push(...R(t));
105
+ }
106
+ function Q(e, o) {
107
+ if (o.characterCount === !1) return;
108
+ const t = typeof o.characterCount == "object" ? o.characterCount : {};
109
+ e.push(B(t));
110
+ }
111
+ function W(e, o) {
112
+ if (o.textColor === !1) return;
113
+ const t = typeof o.textColor == "object" ? o.textColor : {};
114
+ e.push(...q(t));
115
+ }
116
+ function X(e, o) {
117
+ if (o.codeBlock !== !1)
118
+ if (o.codeBlock === !0 || typeof o.codeBlock == "object") {
119
+ const t = typeof o.codeBlock == "object" ? o.codeBlock : {};
120
+ e.push(...a(t));
121
+ } else
122
+ e.push(...a());
123
+ }
124
+ function Y(e, o) {
125
+ if (o.mathematics === !1) return;
126
+ const t = typeof o.mathematics == "object" ? o.mathematics : {};
127
+ e.push(...M(t));
43
128
  }
44
- function h(t) {
45
- if (typeof window > "u")
46
- return () => {
47
- };
48
- const e = window.matchMedia("(prefers-color-scheme: dark)"), n = (r) => {
49
- t(r.matches ? "dark" : "light");
50
- };
51
- return e.addEventListener("change", n), () => {
52
- e.removeEventListener("change", n);
53
- };
129
+ function Z(e, o) {
130
+ if (o.dragHandle === !1) return;
131
+ const t = typeof o.dragHandle == "object" ? o.dragHandle : {};
132
+ e.push(...w(t));
54
133
  }
55
- function f(t = d) {
56
- return `(function(){try{var s=localStorage.getItem('${t}');var d=window.matchMedia('(prefers-color-scheme: dark)').matches;var t=s==='dark'?'dark':s==='light'?'light':d?'dark':'light';document.documentElement.setAttribute('${i}',t)}catch(e){}})()`;
134
+ function $(e, o) {
135
+ if (o.details === !1) return;
136
+ const t = typeof o.details == "object" ? o.details : {};
137
+ e.push(...L(t));
138
+ }
139
+ function oo(e, o) {
140
+ if (o.embed === !1) return;
141
+ const t = typeof o.embed == "object" ? o.embed : {};
142
+ e.push(H(t));
143
+ }
144
+ function to(e, o) {
145
+ if (o.diagram === !1) return;
146
+ const t = typeof o.diagram == "object" ? o.diagram : {};
147
+ e.push(v(t));
148
+ }
149
+ function Fo(e = {}) {
150
+ const {
151
+ placeholder: o = "Type '/' for commands...",
152
+ headingLevels: t = [1, 2, 3],
153
+ features: i = {}
154
+ } = e, n = [
155
+ ...K({ headingLevels: t }),
156
+ C.configure({
157
+ placeholder: o,
158
+ emptyEditorClass: "vizel-editor-empty",
159
+ emptyNodeClass: "vizel-node-empty"
160
+ })
161
+ ];
162
+ if (N(n, i), i.table !== !1) {
163
+ const r = typeof i.table == "object" ? i.table : {};
164
+ n.push(...P(r));
165
+ }
166
+ if (i.link !== !1) {
167
+ const r = typeof i.link == "object" ? i.link : {};
168
+ n.push(U(r));
169
+ }
170
+ return _(n, i), A(n, i), J(n, i), Q(n, i), W(n, i), X(n, i), Y(n, i), Z(n, i), $(n, i), oo(n, i), to(n, i), n;
57
171
  }
58
172
  export {
59
- a as VIZEL_DEFAULT_THEME,
60
- d as VIZEL_DEFAULT_THEME_STORAGE_KEY,
61
- i as VIZEL_THEME_DATA_ATTRIBUTE,
62
- l as applyVizelTheme,
63
- h as createVizelSystemThemeListener,
64
- s as getStoredVizelTheme,
65
- c as getVizelSystemTheme,
66
- f as getVizelThemeInitScript,
67
- m as resolveVizelTheme,
68
- u as storeVizelTheme
173
+ Fo as createVizelExtensions
69
174
  };
package/dist/index30.js CHANGED
@@ -1,40 +1,12 @@
1
- const o = "vizel-portal-root", i = {
2
- /** Base layer for dropdowns and menus */
3
- dropdown: 50,
4
- /** Layer for modals and dialogs */
5
- modal: 100,
6
- /** Layer for tooltips (highest priority) */
7
- tooltip: 150
8
- };
9
- function a() {
10
- let e = document.getElementById(o);
11
- return e || (e = document.createElement("div"), e.id = o, e.setAttribute("data-vizel-portal", ""), document.body.appendChild(e)), e;
12
- }
13
- function c() {
14
- return document.getElementById(o) !== null;
15
- }
16
- function u() {
17
- const e = document.getElementById(o);
18
- e?.parentNode && e.parentNode.removeChild(e);
19
- }
20
- function d(e = "dropdown") {
21
- const t = document.createElement("div");
22
- return t.setAttribute("data-vizel-portal-layer", e), t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.zIndex = String(i[e]), t;
23
- }
24
- function m(e, t = {}) {
25
- const { layer: r = "dropdown", className: l } = t, n = d(r);
26
- return l && (n.className = l), n.appendChild(e), a().appendChild(n), n;
27
- }
28
- function s(e) {
29
- e.parentNode && e.parentNode.removeChild(e);
1
+ function g(i, e) {
2
+ if (!e || e.length === 0)
3
+ return [{ text: i, highlight: !1 }];
4
+ const t = [];
5
+ let l = 0;
6
+ for (const [h, s] of e)
7
+ h > l && t.push({ text: i.slice(l, h), highlight: !1 }), t.push({ text: i.slice(h, s + 1), highlight: !0 }), l = s + 1;
8
+ return l < i.length && t.push({ text: i.slice(l), highlight: !1 }), t;
30
9
  }
31
10
  export {
32
- o as VIZEL_PORTAL_ID,
33
- i as VIZEL_PORTAL_Z_INDEX,
34
- d as createVizelPortalElement,
35
- a as getVizelPortalContainer,
36
- c as hasVizelPortalContainer,
37
- m as mountToVizelPortal,
38
- u as removeVizelPortalContainer,
39
- s as unmountFromVizelPortal
11
+ g as splitVizelTextByMatches
40
12
  };