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

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 (59) 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/index36.js +1 -1
  30. package/dist/index37.js +41 -57
  31. package/dist/index38.js +64 -4
  32. package/dist/index39.js +4 -123
  33. package/dist/index4.js +10 -86
  34. package/dist/index40.js +111 -315
  35. package/dist/index41.js +321 -481
  36. package/dist/index42.js +481 -42
  37. package/dist/index43.js +143 -138
  38. package/dist/index44.js +1 -1
  39. package/dist/index45.js +1 -1
  40. package/dist/index46.js +1 -1
  41. package/dist/index48.js +3 -3
  42. package/dist/index49.js +158 -1458
  43. package/dist/index5.js +132 -10
  44. package/dist/index50.js +1561 -5
  45. package/dist/index51.js +1408 -1467
  46. package/dist/index52.js +704 -183
  47. package/dist/index53.js +5 -723
  48. package/dist/index6.js +48 -131
  49. package/dist/index61.js +1 -1
  50. package/dist/index62.js +1 -1
  51. package/dist/index65.js +1 -1
  52. package/dist/index66.js +53 -1059
  53. package/dist/index67.js +1059 -53
  54. package/dist/index69.js +90 -3
  55. package/dist/index7.js +228 -409
  56. package/dist/index70.js +3 -90
  57. package/dist/index8.js +111 -45
  58. package/dist/index9.js +409 -228
  59. package/package.json +54 -80
package/dist/index70.js CHANGED
@@ -1,93 +1,6 @@
1
- var t = {
2
- 8: "Backspace",
3
- 9: "Tab",
4
- 10: "Enter",
5
- 12: "NumLock",
6
- 13: "Enter",
7
- 16: "Shift",
8
- 17: "Control",
9
- 18: "Alt",
10
- 20: "CapsLock",
11
- 27: "Escape",
12
- 32: " ",
13
- 33: "PageUp",
14
- 34: "PageDown",
15
- 35: "End",
16
- 36: "Home",
17
- 37: "ArrowLeft",
18
- 38: "ArrowUp",
19
- 39: "ArrowRight",
20
- 40: "ArrowDown",
21
- 44: "PrintScreen",
22
- 45: "Insert",
23
- 46: "Delete",
24
- 59: ";",
25
- 61: "=",
26
- 91: "Meta",
27
- 92: "Meta",
28
- 106: "*",
29
- 107: "+",
30
- 108: ",",
31
- 109: "-",
32
- 110: ".",
33
- 111: "/",
34
- 144: "NumLock",
35
- 145: "ScrollLock",
36
- 160: "Shift",
37
- 161: "Shift",
38
- 162: "Control",
39
- 163: "Control",
40
- 164: "Alt",
41
- 165: "Alt",
42
- 173: "-",
43
- 186: ";",
44
- 187: "=",
45
- 188: ",",
46
- 189: "-",
47
- 190: ".",
48
- 191: "/",
49
- 192: "`",
50
- 219: "[",
51
- 220: "\\",
52
- 221: "]",
53
- 222: "'"
54
- }, a = {
55
- 48: ")",
56
- 49: "!",
57
- 50: "@",
58
- 51: "#",
59
- 52: "$",
60
- 53: "%",
61
- 54: "^",
62
- 55: "&",
63
- 56: "*",
64
- 57: "(",
65
- 59: ":",
66
- 61: "+",
67
- 173: "_",
68
- 186: ":",
69
- 187: "+",
70
- 188: "<",
71
- 189: "_",
72
- 190: ">",
73
- 191: "?",
74
- 192: "~",
75
- 219: "{",
76
- 220: "|",
77
- 221: "}",
78
- 222: '"'
79
- }, n = typeof navigator < "u" && /Mac/.test(navigator.platform), y = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
80
- for (var r = 0; r < 10; r++) t[48 + r] = t[96 + r] = String(r);
81
- for (var r = 1; r <= 24; r++) t[r + 111] = "F" + r;
82
- for (var r = 65; r <= 90; r++)
83
- t[r] = String.fromCharCode(r + 32), a[r] = String.fromCharCode(r);
84
- for (var i in t) a.hasOwnProperty(i) || (a[i] = t[i]);
85
- function g(o) {
86
- var f = n && o.metaKey && o.shiftKey && !o.ctrlKey && !o.altKey || y && o.shiftKey && o.key && o.key.length == 1 || o.key == "Unidentified", e = !f && o.key || (o.shiftKey ? a : t)[o.keyCode] || o.key || "Unidentified";
87
- return e == "Esc" && (e = "Escape"), e == "Del" && (e = "Delete"), e == "Left" && (e = "ArrowLeft"), e == "Up" && (e = "ArrowUp"), e == "Right" && (e = "ArrowRight"), e == "Down" && (e = "ArrowDown"), e;
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
88
3
  }
89
4
  export {
90
- t as base,
91
- g as keyName,
92
- a as shift
5
+ e as getDefaultExportFromCjs
93
6
  };
package/dist/index8.js CHANGED
@@ -1,52 +1,118 @@
1
- import { Details as m, DetailsSummary as M, DetailsContent as p } from "./index40.js";
2
- function A(r = {}) {
3
- const { details: s = {}, detailsContent: i = {}, detailsSummary: o = {} } = r, a = m.extend({
4
- renderMarkdown(t, e) {
5
- const d = t.attrs?.open === !0 ? " open" : "", u = e.renderChildren(t.content ?? [], "");
6
- return `<details${d}>
7
- ${u}</details>
8
-
9
- `;
10
- }
11
- }), l = M.extend({
12
- renderMarkdown(t, e) {
13
- return `<summary>${e.renderChildren(t.content ?? [], "")}</summary>
14
- `;
15
- }
16
- }), c = p.extend({
17
- renderMarkdown(t, e) {
18
- return `
19
- ${e.renderChildren(t.content ?? [], `
20
-
21
- `)}
22
- `;
1
+ import { Extension as f } from "@tiptap/core";
2
+ import p from "@tiptap/extension-drag-handle";
3
+ import { default as B } from "@tiptap/extension-drag-handle";
4
+ import { renderVizelIcon as m } from "./index22.js";
5
+ import { TextSelection as a } from "./index42.js";
6
+ function v(e = {}) {
7
+ const { enabled: o = !0 } = e;
8
+ if (!o)
9
+ return f.create({ name: "vizelDragHandleDisabled" });
10
+ let r = null;
11
+ return p.configure({
12
+ render() {
13
+ const t = document.createElement("div");
14
+ t.classList.add("vizel-drag-handle"), t.setAttribute("data-vizel-drag-handle", ""), t.setAttribute("draggable", "true"), t.setAttribute("aria-label", "Drag to reorder block"), t.setAttribute("role", "button");
15
+ const n = document.createElement("div");
16
+ return n.classList.add("vizel-drag-handle-grip"), n.innerHTML = m("grip", { width: 14, height: 14 }), t.appendChild(n), r = t, t;
17
+ },
18
+ onNodeChange({ node: t }) {
19
+ r && (t ? r.classList.add("is-visible") : r.classList.remove("is-visible"));
20
+ },
21
+ computePositionConfig: {
22
+ placement: "left"
23
23
  }
24
24
  });
25
- return [
26
- a.configure({
27
- HTMLAttributes: {
28
- class: "vizel-details",
29
- ...s.HTMLAttributes
25
+ }
26
+ const b = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
27
+ function u(e) {
28
+ for (let o = e.depth; o > 0; o--) {
29
+ const r = e.node(o), t = r.type.name;
30
+ if (b.has(t))
31
+ return {
32
+ pos: e.before(o),
33
+ node: r,
34
+ depth: o
35
+ };
36
+ }
37
+ if (e.depth >= 1) {
38
+ const o = e.node(1);
39
+ return {
40
+ pos: e.before(1),
41
+ node: o,
42
+ depth: 1
43
+ };
44
+ }
45
+ return null;
46
+ }
47
+ function g(e, o) {
48
+ const r = e.doc.resolve(o.pos), t = r.depth, n = r.start(t), i = r.parent;
49
+ let d = n, l = -1;
50
+ for (let s = 0; s < i.childCount; s++) {
51
+ if (d === o.pos) {
52
+ l = s;
53
+ break;
54
+ }
55
+ d += i.child(s).nodeSize;
56
+ }
57
+ if (l <= 0) return null;
58
+ let c = n;
59
+ for (let s = 0; s < l - 1; s++)
60
+ c += i.child(s).nodeSize;
61
+ return { pos: c, node: i.child(l - 1) };
62
+ }
63
+ function h(e, o) {
64
+ const r = o.pos + o.node.nodeSize, t = e.doc.resolve(r);
65
+ if (r >= t.end(t.depth)) return null;
66
+ const n = e.doc.nodeAt(r);
67
+ return n ? { pos: r, node: n } : null;
68
+ }
69
+ const S = f.create({
70
+ name: "vizelBlockMoveKeymap",
71
+ addCommands() {
72
+ return {
73
+ moveBlockUp: () => ({ tr: e, state: o, dispatch: r }) => {
74
+ const { $from: t } = o.selection, n = u(t);
75
+ if (!n || n.pos <= 0) return !1;
76
+ const i = g(o, n);
77
+ if (!i) return !1;
78
+ if (r) {
79
+ const d = n.pos + n.node.nodeSize;
80
+ e.delete(n.pos, d), e.insert(i.pos, n.node);
81
+ const l = i.pos + 1;
82
+ e.setSelection(a.near(e.doc.resolve(l)));
83
+ }
84
+ return !0;
30
85
  },
31
- persist: !0
32
- }),
33
- c.configure({
34
- HTMLAttributes: {
35
- class: "vizel-details-content",
36
- ...i.HTMLAttributes
37
- }
38
- }),
39
- l.configure({
40
- HTMLAttributes: {
41
- class: "vizel-details-summary",
42
- ...o.HTMLAttributes
86
+ moveBlockDown: () => ({ tr: e, state: o, dispatch: r }) => {
87
+ const { $from: t } = o.selection, n = u(t);
88
+ if (!n) return !1;
89
+ const i = h(o, n);
90
+ if (!i) return !1;
91
+ if (r) {
92
+ const d = n.pos + n.node.nodeSize;
93
+ e.delete(n.pos, d);
94
+ const l = n.pos + i.node.nodeSize;
95
+ e.insert(l, n.node);
96
+ const c = l + 1;
97
+ e.setSelection(a.near(e.doc.resolve(c)));
98
+ }
99
+ return !0;
43
100
  }
44
- })
45
- ];
101
+ };
102
+ },
103
+ addKeyboardShortcuts() {
104
+ return {
105
+ "Alt-ArrowUp": () => this.editor.commands.moveBlockUp(),
106
+ "Alt-ArrowDown": () => this.editor.commands.moveBlockDown()
107
+ };
108
+ }
109
+ });
110
+ function x(e = {}) {
111
+ return [v(e), S];
46
112
  }
47
113
  export {
48
- m as Details,
49
- p as DetailsContent,
50
- M as DetailsSummary,
51
- A as createVizelDetailsExtensions
114
+ S as VizelBlockMoveKeymap,
115
+ B as VizelDragHandle,
116
+ v as createVizelDragHandleExtension,
117
+ x as createVizelDragHandleExtensions
52
118
  };