@vizel/core 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.
Files changed (75) hide show
  1. package/dist/components.css +1 -1
  2. package/dist/components.css.map +1 -1
  3. package/dist/index.d.ts +230 -15
  4. package/dist/index.js +78 -75
  5. package/dist/index10.js +1 -1
  6. package/dist/index11.js +4 -4
  7. package/dist/index14.js +1 -1
  8. package/dist/index15.js +134 -127
  9. package/dist/index17.js +2 -2
  10. package/dist/index18.js +1 -1
  11. package/dist/index19.js +86 -86
  12. package/dist/index20.js +2 -2
  13. package/dist/index21.js +2 -2
  14. package/dist/index22.js +16 -13
  15. package/dist/index24.js +164 -11
  16. package/dist/index25.js +12 -53
  17. package/dist/index26.js +49 -136
  18. package/dist/index27.js +132 -59
  19. package/dist/index28.js +66 -32
  20. package/dist/index29.js +35 -21
  21. package/dist/index3.js +91 -90
  22. package/dist/index30.js +23 -9
  23. package/dist/index31.js +9 -147
  24. package/dist/index32.js +138 -256
  25. package/dist/index33.js +258 -85
  26. package/dist/index34.js +91 -15
  27. package/dist/index35.js +63 -57
  28. package/dist/index36.js +4 -15
  29. package/dist/index37.js +115 -56
  30. package/dist/index38.js +327 -4
  31. package/dist/index39.js +11 -121
  32. package/dist/index4.js +1 -1
  33. package/dist/index40.js +481 -321
  34. package/dist/index41.js +42 -481
  35. package/dist/index42.js +683 -37
  36. package/dist/index43.js +4 -679
  37. package/dist/index44.js +4 -4
  38. package/dist/index45.js +238 -4
  39. package/dist/index46.js +54 -210
  40. package/dist/index47.js +16 -81
  41. package/dist/index48.js +57 -285
  42. package/dist/index49.js +14 -1501
  43. package/dist/index5.js +78 -68
  44. package/dist/index50.js +286 -5
  45. package/dist/index51.js +4 -4
  46. package/dist/index52.js +1408 -1467
  47. package/dist/index53.js +5 -723
  48. package/dist/index54.js +1112 -21
  49. package/dist/index55.js +722 -9
  50. package/dist/index56.js +83 -6
  51. package/dist/index57.js +245 -7
  52. package/dist/index58.js +3 -14
  53. package/dist/index59.js +1230 -17
  54. package/dist/index6.js +1 -1
  55. package/dist/index60.js +733 -24
  56. package/dist/index61.js +21 -84
  57. package/dist/index62.js +10 -246
  58. package/dist/index63.js +7 -3
  59. package/dist/index64.js +7 -1231
  60. package/dist/index65.js +11 -731
  61. package/dist/index66.js +17 -1059
  62. package/dist/index67.js +21 -51
  63. package/dist/index68.js +54 -3
  64. package/dist/index69.js +1061 -98
  65. package/dist/index7.js +108 -96
  66. package/dist/index70.js +98 -91
  67. package/dist/index71.js +93 -0
  68. package/dist/index72.js +6 -0
  69. package/dist/index8.js +1 -1
  70. package/dist/index9.js +75 -65
  71. package/dist/mathematics.css +1 -0
  72. package/dist/mathematics.css.map +1 -0
  73. package/dist/styles.css +1 -1
  74. package/dist/styles.css.map +1 -1
  75. package/package.json +90 -52
package/dist/index25.js CHANGED
@@ -1,56 +1,15 @@
1
- import { Editor as E } from "@tiptap/core";
2
- import { createVizelExtensions as w } from "./index3.js";
3
- import { resolveVizelFeatures as D, vizelDefaultEditorProps as V } from "./index26.js";
4
- import { initializeVizelMarkdownContent as F } from "./index27.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
+ function s(t) {
2
+ return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t);
3
+ }
4
+ function a(t) {
5
+ const e = t.trim(), r = e.startsWith("#") ? e : `#${e}`;
6
+ if (r.length === 4) {
7
+ const [, o, i, n] = r;
8
+ return `#${o}${o}${i}${i}${n}${n}`.toUpperCase();
9
+ }
10
+ return r.toUpperCase();
53
11
  }
54
12
  export {
55
- y as createVizelEditorInstance
13
+ s as isVizelValidHexColor,
14
+ a as normalizeVizelHexColor
56
15
  };
package/dist/index26.js CHANGED
@@ -1,140 +1,53 @@
1
- import "@tiptap/core";
2
- import "./index42.js";
3
- import "@tiptap/extension-image";
4
- import { createVizelImageUploader as p } from "./index31.js";
5
- import "./index12.js";
6
- function V(e) {
7
- const { features: t, createSlashMenuRenderer: a } = e;
8
- if (!t)
9
- return {
10
- slashCommand: {
11
- suggestion: a()
12
- }
13
- };
14
- if (t.slashCommand === !1)
15
- return t;
16
- const o = typeof t.slashCommand == "object" ? t.slashCommand : {};
17
- return o.suggestion ? t : {
18
- ...t,
19
- slashCommand: {
20
- ...o,
21
- suggestion: a()
22
- }
1
+ import { Editor as C } from "@tiptap/core";
2
+ import { createVizelExtensions as D } from "./index3.js";
3
+ import { resolveVizelFeatures as V, vizelDefaultEditorProps as y } from "./index27.js";
4
+ import { initializeVizelMarkdownContent as F } from "./index28.js";
5
+ async function I(f) {
6
+ const {
7
+ initialContent: o,
8
+ initialMarkdown: t,
9
+ transformDiagramsOnImport: p = !0,
10
+ placeholder: n,
11
+ editable: v = !0,
12
+ autofocus: z = !1,
13
+ features: e,
14
+ extensions: x = [],
15
+ createSlashMenuRenderer: E,
16
+ onUpdate: i,
17
+ onCreate: r,
18
+ onDestroy: a,
19
+ onSelectionUpdate: s,
20
+ onFocus: d,
21
+ onBlur: l
22
+ } = f, c = V({
23
+ ...e !== void 0 && { features: e },
24
+ createSlashMenuRenderer: E
25
+ }), g = typeof e?.image == "object" ? e.image : {}, m = t ? (u) => {
26
+ F(u.editor, t, {
27
+ transformDiagrams: p
28
+ }), r?.(u);
29
+ } : r, w = await D({
30
+ ...n !== void 0 && { placeholder: n },
31
+ ...c !== void 0 && { features: c }
32
+ });
33
+ return {
34
+ editor: new C({
35
+ extensions: [...w, ...x],
36
+ // Only set initialContent if initialMarkdown is not provided
37
+ ...!t && o !== void 0 && { content: o },
38
+ editable: v,
39
+ autofocus: z,
40
+ editorProps: y,
41
+ ...i && { onUpdate: i },
42
+ ...m && { onCreate: m },
43
+ ...a && { onDestroy: a },
44
+ ...s && { onSelectionUpdate: s },
45
+ ...d && { onFocus: d },
46
+ ...l && { onBlur: l }
47
+ }),
48
+ imageOptions: g
23
49
  };
24
50
  }
25
- const f = (e) => e instanceof CustomEvent && typeof e.detail == "object" && e.detail !== null && "file" in e.detail && "editor" in e.detail;
26
- function g(e) {
27
- return (t) => {
28
- const a = e.getEditor();
29
- if (!a || !f(t)) return;
30
- const { file: o } = t.detail, n = a.state.selection.from, r = e.getImageOptions();
31
- p({
32
- onUpload: r.onUpload ?? ((i) => new Promise((l) => {
33
- const s = new FileReader();
34
- s.onload = () => {
35
- typeof s.result == "string" && l(s.result);
36
- }, s.readAsDataURL(i);
37
- })),
38
- ...r.maxFileSize !== void 0 && { maxFileSize: r.maxFileSize },
39
- ...r.allowedTypes !== void 0 && { allowedTypes: r.allowedTypes },
40
- ...r.onValidationError !== void 0 && {
41
- onValidationError: r.onValidationError
42
- },
43
- ...r.onUploadError !== void 0 && {
44
- onUploadError: r.onUploadError
45
- }
46
- })(o, a.view, n);
47
- };
48
- }
49
- const u = "vizel:upload-image";
50
- function w(e) {
51
- const t = g(e);
52
- return document.addEventListener(u, t), () => {
53
- document.removeEventListener(u, t);
54
- };
55
- }
56
- const F = {
57
- attributes: {
58
- class: "vizel-editor"
59
- }
60
- };
61
- function h(e) {
62
- return "characterCount" in e && typeof e.characterCount == "object" && e.characterCount !== null && "characters" in e.characterCount && "words" in e.characterCount;
63
- }
64
- function A(e) {
65
- if (!e)
66
- return {
67
- isFocused: !1,
68
- isEmpty: !0,
69
- canUndo: !1,
70
- canRedo: !1,
71
- characterCount: 0,
72
- wordCount: 0
73
- };
74
- const t = e.storage;
75
- let a = 0, o = 0;
76
- return h(t) && (a = t.characterCount.characters(), o = t.characterCount.words()), {
77
- isFocused: e.isFocused,
78
- isEmpty: e.isEmpty,
79
- canUndo: e.can().undo(),
80
- canRedo: e.can().redo(),
81
- characterCount: a,
82
- wordCount: o
83
- };
84
- }
85
- const d = {
86
- mermaid: "mermaid",
87
- dot: "graphviz",
88
- graphviz: "graphviz"
89
- };
90
- function E(e) {
91
- if (!e) return e;
92
- const t = e.attrs?.language;
93
- return e.type === "codeBlock" && t && t in d ? {
94
- type: "diagram",
95
- attrs: {
96
- code: e.content?.map((o) => o.text || "").join("").trim() || "",
97
- type: d[t]
98
- }
99
- } : e.content && Array.isArray(e.content) ? {
100
- ...e,
101
- content: e.content.map(E)
102
- } : e;
103
- }
104
- function S(e) {
105
- const t = e.schema.nodes.diagram;
106
- if (!t) return;
107
- const a = [];
108
- if (e.state.doc.descendants((n, r) => {
109
- if (n.type.name === "codeBlock") {
110
- const c = n.attrs.language, i = c ? d[c] : void 0;
111
- i && a.push({
112
- from: r,
113
- to: r + n.nodeSize,
114
- code: n.textContent.trim(),
115
- type: i
116
- });
117
- }
118
- }), a.length === 0) return;
119
- let { tr: o } = e.state;
120
- for (let n = a.length - 1; n >= 0; n--) {
121
- const r = a[n];
122
- if (!r) continue;
123
- const { from: c, to: i, code: l, type: s } = r, m = t.create({
124
- code: l,
125
- type: s
126
- });
127
- o = o.replaceWith(c, i, m);
128
- }
129
- e.view.dispatch(o);
130
- }
131
51
  export {
132
- u as VIZEL_UPLOAD_IMAGE_EVENT,
133
- S as convertVizelCodeBlocksToDiagrams,
134
- g as createVizelUploadEventHandler,
135
- A as getVizelEditorState,
136
- w as registerVizelUploadEventHandler,
137
- V as resolveVizelFeatures,
138
- E as transformVizelDiagramCodeBlocks,
139
- F as vizelDefaultEditorProps
52
+ I as createVizelEditorInstance
140
53
  };
package/dist/index27.js CHANGED
@@ -1,69 +1,142 @@
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";
1
+ import "@tiptap/core";
2
+ import "./index41.js";
3
+ import "@tiptap/extension-image";
4
+ import { createVizelImageUploader as p } from "./index32.js";
5
+ import "./index12.js";
6
+ function V(e) {
7
+ const { features: t, createSlashMenuRenderer: o } = e;
8
+ if (!t)
9
+ return {
10
+ slashCommand: {
11
+ suggestion: o()
12
+ }
13
+ };
14
+ if (t.slashCommand === !1)
15
+ return t;
16
+ const a = typeof t.slashCommand == "object" ? t.slashCommand : {};
17
+ return a.suggestion ? t : {
18
+ ...t,
19
+ slashCommand: {
20
+ ...a,
21
+ suggestion: o()
22
+ }
23
+ };
5
24
  }
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
- ), "") : "";
25
+ const f = (e) => e instanceof CustomEvent && typeof e.detail == "object" && e.detail !== null && "file" in e.detail && "editor" in e.detail;
26
+ function g(e) {
27
+ return (t) => {
28
+ const o = e.getEditor();
29
+ if (!o || !f(t)) return;
30
+ const { file: a } = t.detail, n = o.state.selection.from, r = e.getImageOptions();
31
+ p({
32
+ onUpload: r.onUpload ?? ((i) => new Promise((l) => {
33
+ const s = new FileReader();
34
+ s.onload = () => {
35
+ typeof s.result == "string" && l(s.result);
36
+ }, s.readAsDataURL(i);
37
+ })),
38
+ ...r.maxFileSize !== void 0 && { maxFileSize: r.maxFileSize },
39
+ ...r.allowedTypes !== void 0 && { allowedTypes: r.allowedTypes },
40
+ ...r.onValidationError !== void 0 && {
41
+ onValidationError: r.onValidationError
42
+ },
43
+ ...r.onUploadError !== void 0 && {
44
+ onUploadError: r.onUploadError
45
+ }
46
+ })(a, o.view, n);
47
+ };
48
+ }
49
+ const u = "vizel:upload-image";
50
+ function w(e) {
51
+ const t = g(e);
52
+ return document.addEventListener(u, t), () => {
53
+ document.removeEventListener(u, t);
54
+ };
10
55
  }
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;
56
+ const F = {
57
+ attributes: {
58
+ class: "vizel-editor"
19
59
  }
20
- n.commands.setContent(r, { contentType: "markdown" }), t && d(n);
60
+ };
61
+ function h(e) {
62
+ if (typeof e != "object" || e === null || !("characterCount" in e)) return !1;
63
+ const t = e.characterCount;
64
+ return typeof t == "object" && t !== null && "characters" in t && typeof t.characters == "function" && "words" in t && typeof t.words == "function";
21
65
  }
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;
66
+ function A(e) {
67
+ if (!e)
68
+ return {
69
+ isFocused: !1,
70
+ isEmpty: !0,
71
+ canUndo: !1,
72
+ canRedo: !1,
73
+ characterCount: 0,
74
+ wordCount: 0
75
+ };
76
+ let t = 0, o = 0;
77
+ const a = e.storage;
78
+ return h(a) && (t = a.characterCount.characters(), o = a.characterCount.words()), {
79
+ isFocused: e.isFocused,
80
+ isEmpty: e.isEmpty,
81
+ canUndo: e.can().undo(),
82
+ canRedo: e.can().redo(),
83
+ characterCount: t,
84
+ wordCount: o
85
+ };
31
86
  }
32
- function z(n, r, a = {}) {
33
- const { transformDiagrams: t = !0 } = a;
34
- f(n, r, { transformDiagrams: t });
87
+ const d = {
88
+ mermaid: "mermaid",
89
+ dot: "graphviz",
90
+ graphviz: "graphviz"
91
+ };
92
+ function y(e) {
93
+ if (!e) return e;
94
+ const t = e.attrs?.language;
95
+ return e.type === "codeBlock" && t && t in d ? {
96
+ type: "diagram",
97
+ attrs: {
98
+ code: e.content?.map((a) => a.text || "").join("").trim() || "",
99
+ type: d[t]
100
+ }
101
+ } : e.content && Array.isArray(e.content) ? {
102
+ ...e,
103
+ content: e.content.map(y)
104
+ } : e;
35
105
  }
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);
106
+ function S(e) {
107
+ const t = e.schema.nodes.diagram;
108
+ if (!t) return;
109
+ const o = [];
110
+ if (e.state.doc.descendants((n, r) => {
111
+ if (n.type.name === "codeBlock") {
112
+ const c = n.attrs.language, i = c ? d[c] : void 0;
113
+ i && o.push({
114
+ from: r,
115
+ to: r + n.nodeSize,
116
+ code: n.textContent.trim(),
117
+ type: i
118
+ });
59
119
  }
60
- };
120
+ }), o.length === 0) return;
121
+ let { tr: a } = e.state;
122
+ for (let n = o.length - 1; n >= 0; n--) {
123
+ const r = o[n];
124
+ if (!r) continue;
125
+ const { from: c, to: i, code: l, type: s } = r, m = t.create({
126
+ code: l,
127
+ type: s
128
+ });
129
+ a = a.replaceWith(c, i, m);
130
+ }
131
+ e.view.dispatch(a);
61
132
  }
62
133
  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
134
+ u as VIZEL_UPLOAD_IMAGE_EVENT,
135
+ S as convertVizelCodeBlocksToDiagrams,
136
+ g as createVizelUploadEventHandler,
137
+ A as getVizelEditorState,
138
+ w as registerVizelUploadEventHandler,
139
+ V as resolveVizelFeatures,
140
+ y as transformVizelDiagramCodeBlocks,
141
+ F as vizelDefaultEditorProps
69
142
  };
package/dist/index28.js CHANGED
@@ -1,40 +1,74 @@
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;
1
+ import { transformVizelDiagramCodeBlocks as c, convertVizelCodeBlocksToDiagrams as d } from "./index27.js";
2
+ const m = 300;
3
+ function u(n) {
4
+ return "getMarkdown" in n && typeof n.getMarkdown == "function";
5
+ }
6
+ function w(n) {
7
+ if (!("markdown" in n)) return !1;
8
+ const e = n.markdown;
9
+ return typeof e == "object" && e !== null && "parse" in e && typeof e.parse == "function";
12
10
  }
13
- function c() {
14
- return document.getElementById(o) !== null;
11
+ function s(n) {
12
+ return n ? u(n) ? n.getMarkdown() : (console.warn(
13
+ "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
14
+ ), "") : "";
15
15
  }
16
- function u() {
17
- const e = document.getElementById(o);
18
- e?.parentNode && e.parentNode.removeChild(e);
16
+ function f(n, e, a = {}) {
17
+ if (!n) return;
18
+ const { transformDiagrams: r = !0 } = a;
19
+ if (!u(n)) {
20
+ console.warn(
21
+ "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
22
+ );
23
+ return;
24
+ }
25
+ n.commands.setContent(e, { contentType: "markdown" }), r && d(n);
19
26
  }
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;
27
+ function z(n, e, a = {}) {
28
+ if (!n) return null;
29
+ const { transformDiagrams: r = !0 } = a;
30
+ if (!w(n))
31
+ return console.warn(
32
+ "[Vizel] Markdown extension is not enabled. Enable it via features.markdown option."
33
+ ), null;
34
+ const o = n.markdown.parse(e);
35
+ return r && o?.type ? c(o) : o;
23
36
  }
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;
37
+ function V(n, e, a = {}) {
38
+ const { transformDiagrams: r = !0 } = a;
39
+ f(n, e, { transformDiagrams: r });
27
40
  }
28
- function s(e) {
29
- e.parentNode && e.parentNode.removeChild(e);
41
+ function D(n = {}) {
42
+ const { debounceMs: e = m, transformDiagrams: a = !0 } = n;
43
+ let r = "", o = !1, t = null;
44
+ return {
45
+ handleUpdate: (i) => {
46
+ if (e === 0) {
47
+ r = s(i);
48
+ return;
49
+ }
50
+ o = !0, t && clearTimeout(t), t = setTimeout(() => {
51
+ r = s(i), o = !1, t = null;
52
+ }, e);
53
+ },
54
+ getMarkdown: () => r,
55
+ setMarkdown: (i, l) => {
56
+ t && (clearTimeout(t), t = null), o = !1, f(i, l, { transformDiagrams: a }), r = l;
57
+ },
58
+ isPending: () => o,
59
+ flush: (i) => {
60
+ t && (clearTimeout(t), t = null), r = s(i), o = !1;
61
+ },
62
+ destroy: () => {
63
+ t && (clearTimeout(t), t = null);
64
+ }
65
+ };
30
66
  }
31
67
  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
68
+ m as VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS,
69
+ D as createVizelMarkdownSyncHandlers,
70
+ s as getVizelMarkdown,
71
+ V as initializeVizelMarkdownContent,
72
+ z as parseVizelMarkdown,
73
+ f as setVizelMarkdown
40
74
  };
package/dist/index29.js CHANGED
@@ -1,26 +1,40 @@
1
- const r = "50";
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
+ }
2
13
  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`);
13
- },
14
- destroy: () => {
15
- e.remove();
16
- }
17
- };
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;
18
27
  }
19
- function d(e) {
20
- return e.key === "Escape";
28
+ function s(e) {
29
+ e.parentNode && e.parentNode.removeChild(e);
21
30
  }
22
31
  export {
23
- r as VIZEL_SUGGESTION_Z_INDEX,
24
- c as createVizelSuggestionContainer,
25
- d as handleVizelSuggestionEscape
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
26
40
  };