@vizel/core 0.0.1-alpha.5 → 0.0.1-alpha.6

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 (49) hide show
  1. package/dist/index10.js +1 -1
  2. package/dist/index11.js +2 -2
  3. package/dist/index14.js +1 -1
  4. package/dist/index20.js +2 -2
  5. package/dist/index21.js +2 -2
  6. package/dist/index22.js +3 -3
  7. package/dist/index26.js +1 -1
  8. package/dist/index3.js +1 -1
  9. package/dist/index31.js +2 -2
  10. package/dist/index34.js +16 -63
  11. package/dist/index35.js +58 -4
  12. package/dist/index36.js +15 -123
  13. package/dist/index37.js +42 -305
  14. package/dist/index38.js +4 -487
  15. package/dist/index39.js +112 -37
  16. package/dist/index4.js +1 -1
  17. package/dist/index40.js +301 -653
  18. package/dist/index41.js +487 -4
  19. package/dist/index42.js +48 -4
  20. package/dist/index43.js +647 -206
  21. package/dist/index44.js +4 -82
  22. package/dist/index45.js +4 -17
  23. package/dist/index46.js +237 -57
  24. package/dist/index47.js +82 -15
  25. package/dist/index48.js +5 -5
  26. package/dist/index49.js +1458 -158
  27. package/dist/index5.js +1 -1
  28. package/dist/index50.js +5 -1502
  29. package/dist/index51.js +202 -5
  30. package/dist/index54.js +21 -84
  31. package/dist/index55.js +10 -246
  32. package/dist/index56.js +7 -3
  33. package/dist/index57.js +7 -1231
  34. package/dist/index58.js +11 -731
  35. package/dist/index59.js +19 -21
  36. package/dist/index6.js +1 -1
  37. package/dist/index60.js +25 -10
  38. package/dist/index61.js +83 -6
  39. package/dist/index62.js +245 -7
  40. package/dist/index63.js +3 -14
  41. package/dist/index64.js +1230 -17
  42. package/dist/index65.js +733 -24
  43. package/dist/index66.js +1059 -53
  44. package/dist/index67.js +53 -1059
  45. package/dist/index68.js +3 -90
  46. package/dist/index70.js +90 -3
  47. package/dist/index8.js +1 -1
  48. package/dist/index9.js +1 -1
  49. package/package.json +1 -1
package/dist/index44.js CHANGED
@@ -1,84 +1,6 @@
1
- import { Mark as a, markPasteRule as s, markInputRule as l, mergeAttributes as u } from "@tiptap/core";
2
- var h = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, d = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, m = a.create({
3
- name: "highlight",
4
- addOptions() {
5
- return {
6
- multicolor: !1,
7
- HTMLAttributes: {}
8
- };
9
- },
10
- addAttributes() {
11
- return this.options.multicolor ? {
12
- color: {
13
- default: null,
14
- parseHTML: (r) => r.getAttribute("data-color") || r.style.backgroundColor,
15
- renderHTML: (r) => r.color ? {
16
- "data-color": r.color,
17
- style: `background-color: ${r.color}; color: inherit`
18
- } : {}
19
- }
20
- } : {};
21
- },
22
- parseHTML() {
23
- return [
24
- {
25
- tag: "mark"
26
- }
27
- ];
28
- },
29
- renderHTML({ HTMLAttributes: r }) {
30
- return ["mark", u(this.options.HTMLAttributes, r), 0];
31
- },
32
- renderMarkdown: (r, t) => `==${t.renderChildren(r)}==`,
33
- parseMarkdown: (r, t) => t.applyMark("highlight", t.parseInline(r.tokens || [])),
34
- markdownTokenizer: {
35
- name: "highlight",
36
- level: "inline",
37
- start: (r) => r.indexOf("=="),
38
- tokenize(r, t, i) {
39
- const e = /^(==)([^=]+)(==)/.exec(r);
40
- if (e) {
41
- const n = e[2].trim(), o = i.inlineTokens(n);
42
- return {
43
- type: "highlight",
44
- raw: e[0],
45
- text: n,
46
- tokens: o
47
- };
48
- }
49
- }
50
- },
51
- addCommands() {
52
- return {
53
- setHighlight: (r) => ({ commands: t }) => t.setMark(this.name, r),
54
- toggleHighlight: (r) => ({ commands: t }) => t.toggleMark(this.name, r),
55
- unsetHighlight: () => ({ commands: r }) => r.unsetMark(this.name)
56
- };
57
- },
58
- addKeyboardShortcuts() {
59
- return {
60
- "Mod-Shift-h": () => this.editor.commands.toggleHighlight()
61
- };
62
- },
63
- addInputRules() {
64
- return [
65
- l({
66
- find: h,
67
- type: this.type
68
- })
69
- ];
70
- },
71
- addPasteRules() {
72
- return [
73
- s({
74
- find: d,
75
- type: this.type
76
- })
77
- ];
78
- }
79
- });
1
+ import { TaskItem as a } from "./index53.js";
2
+ var t = a;
80
3
  export {
81
- m as Highlight,
82
- h as inputRegex,
83
- d as pasteRegex
4
+ a as TaskItem,
5
+ t as default
84
6
  };
package/dist/index45.js CHANGED
@@ -1,19 +1,6 @@
1
- import { mergeIconData as s } from "./index62.js";
2
- import { getIconsTree as f } from "./index63.js";
3
- function i(r, o, n) {
4
- const u = r.icons, l = r.aliases || /* @__PURE__ */ Object.create(null);
5
- let t = {};
6
- function c(e) {
7
- t = s(u[e] || l[e], t);
8
- }
9
- return c(o), n.forEach(c), s(r, t);
10
- }
11
- function g(r, o) {
12
- if (r.icons[o]) return i(r, o, []);
13
- const n = f(r, [o])[o];
14
- return n ? i(r, o, n) : null;
15
- }
1
+ import { TaskList as a } from "./index53.js";
2
+ var e = a;
16
3
  export {
17
- g as getIconData,
18
- i as internalGetIconData
4
+ a as TaskList,
5
+ e as default
19
6
  };
package/dist/index46.js CHANGED
@@ -1,60 +1,240 @@
1
- import { defaultIconProps as k } from "./index59.js";
2
- import { defaultIconCustomisations as y } from "./index60.js";
3
- import { calculateSize as b } from "./index64.js";
4
- import { wrapSVGContent as C } from "./index65.js";
5
- const I = (s) => s === "unset" || s === "undefined" || s === "none";
6
- function H(s, x) {
7
- const n = {
8
- ...k,
9
- ...s
10
- }, g = {
11
- ...y,
12
- ...x
13
- }, t = {
14
- left: n.left,
15
- top: n.top,
16
- width: n.width,
17
- height: n.height
18
- };
19
- let u = n.body;
20
- [n, g].forEach((r) => {
21
- const o = [], F = r.hFlip, S = r.vFlip;
22
- let e = r.rotate;
23
- F ? S ? e += 2 : (o.push("translate(" + (t.width + t.left).toString() + " " + (0 - t.top).toString() + ")"), o.push("scale(-1 1)"), t.top = t.left = 0) : S && (o.push("translate(" + (0 - t.left).toString() + " " + (t.height + t.top).toString() + ")"), o.push("scale(1 -1)"), t.top = t.left = 0);
24
- let i;
25
- switch (e < 0 && (e -= Math.floor(e / 4) * 4), e = e % 4, e) {
26
- case 1:
27
- i = t.height / 2 + t.top, o.unshift("rotate(90 " + i.toString() + " " + i.toString() + ")");
28
- break;
29
- case 2:
30
- o.unshift("rotate(180 " + (t.width / 2 + t.left).toString() + " " + (t.height / 2 + t.top).toString() + ")");
31
- break;
32
- case 3:
33
- i = t.width / 2 + t.left, o.unshift("rotate(-90 " + i.toString() + " " + i.toString() + ")");
34
- break;
35
- }
36
- e % 2 === 1 && (t.left !== t.top && (i = t.left, t.left = t.top, t.top = i), t.width !== t.height && (i = t.width, t.width = t.height, t.height = i)), o.length && (u = C(u, '<g transform="' + o.join(" ") + '">', "</g>"));
1
+ import { Mark as y, mergeAttributes as p, Extension as l } from "@tiptap/core";
2
+ var d = 20, u = (t, e = 0) => {
3
+ const r = [];
4
+ return !t.children.length || e > d || Array.from(t.children).forEach((o) => {
5
+ o.tagName === "SPAN" ? r.push(o) : o.children.length && r.push(...u(o, e + 1));
6
+ }), r;
7
+ }, f = (t) => {
8
+ if (!t.children.length)
9
+ return;
10
+ const e = u(t);
11
+ e && e.forEach((r) => {
12
+ var o, n;
13
+ const s = r.getAttribute("style"), i = (n = (o = r.parentElement) == null ? void 0 : o.closest("span")) == null ? void 0 : n.getAttribute("style");
14
+ r.setAttribute("style", `${i};${s}`);
37
15
  });
38
- const p = g.width, h = g.height, f = t.width, l = t.height;
39
- let a, c;
40
- p === null ? (c = h === null ? "1em" : h === "auto" ? l : h, a = b(c, f / l)) : (a = p === "auto" ? f : p, c = h === null ? b(a, l / f) : h === "auto" ? l : h);
41
- const d = {}, w = (r, o) => {
42
- I(o) || (d[r] = o.toString());
43
- };
44
- w("width", a), w("height", c);
45
- const m = [
46
- t.left,
47
- t.top,
48
- f,
49
- l
50
- ];
51
- return d.viewBox = m.join(" "), {
52
- attributes: d,
53
- viewBox: m,
54
- body: u
55
- };
56
- }
16
+ }, c = y.create({
17
+ name: "textStyle",
18
+ priority: 101,
19
+ addOptions() {
20
+ return {
21
+ HTMLAttributes: {},
22
+ mergeNestedSpanStyles: !0
23
+ };
24
+ },
25
+ parseHTML() {
26
+ return [
27
+ {
28
+ tag: "span",
29
+ consuming: !1,
30
+ getAttrs: (t) => t.hasAttribute("style") ? (this.options.mergeNestedSpanStyles && f(t), {}) : !1
31
+ }
32
+ ];
33
+ },
34
+ renderHTML({ HTMLAttributes: t }) {
35
+ return ["span", p(this.options.HTMLAttributes, t), 0];
36
+ },
37
+ addCommands() {
38
+ return {
39
+ toggleTextStyle: (t) => ({ commands: e }) => e.toggleMark(this.name, t),
40
+ removeEmptyTextStyle: () => ({ tr: t }) => {
41
+ const { selection: e } = t;
42
+ return t.doc.nodesBetween(e.from, e.to, (r, o) => {
43
+ if (r.isTextblock)
44
+ return !0;
45
+ r.marks.filter((n) => n.type === this.type).some((n) => Object.values(n.attrs).some((s) => !!s)) || t.removeMark(o, o + r.nodeSize, this.type);
46
+ }), !0;
47
+ }
48
+ };
49
+ }
50
+ }), m = l.create({
51
+ name: "backgroundColor",
52
+ addOptions() {
53
+ return {
54
+ types: ["textStyle"]
55
+ };
56
+ },
57
+ addGlobalAttributes() {
58
+ return [
59
+ {
60
+ types: this.options.types,
61
+ attributes: {
62
+ backgroundColor: {
63
+ default: null,
64
+ parseHTML: (t) => {
65
+ var e;
66
+ const r = t.getAttribute("style");
67
+ if (r) {
68
+ const o = r.split(";").map((n) => n.trim()).filter(Boolean);
69
+ for (let n = o.length - 1; n >= 0; n -= 1) {
70
+ const s = o[n].split(":");
71
+ if (s.length >= 2) {
72
+ const i = s[0].trim().toLowerCase(), a = s.slice(1).join(":").trim();
73
+ if (i === "background-color")
74
+ return a.replace(/['"]+/g, "");
75
+ }
76
+ }
77
+ }
78
+ return (e = t.style.backgroundColor) == null ? void 0 : e.replace(/['"]+/g, "");
79
+ },
80
+ renderHTML: (t) => t.backgroundColor ? {
81
+ style: `background-color: ${t.backgroundColor}`
82
+ } : {}
83
+ }
84
+ }
85
+ }
86
+ ];
87
+ },
88
+ addCommands() {
89
+ return {
90
+ setBackgroundColor: (t) => ({ chain: e }) => e().setMark("textStyle", { backgroundColor: t }).run(),
91
+ unsetBackgroundColor: () => ({ chain: t }) => t().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run()
92
+ };
93
+ }
94
+ }), g = l.create({
95
+ name: "color",
96
+ addOptions() {
97
+ return {
98
+ types: ["textStyle"]
99
+ };
100
+ },
101
+ addGlobalAttributes() {
102
+ return [
103
+ {
104
+ types: this.options.types,
105
+ attributes: {
106
+ color: {
107
+ default: null,
108
+ parseHTML: (t) => {
109
+ var e;
110
+ const r = t.getAttribute("style");
111
+ if (r) {
112
+ const o = r.split(";").map((n) => n.trim()).filter(Boolean);
113
+ for (let n = o.length - 1; n >= 0; n -= 1) {
114
+ const s = o[n].split(":");
115
+ if (s.length >= 2) {
116
+ const i = s[0].trim().toLowerCase(), a = s.slice(1).join(":").trim();
117
+ if (i === "color")
118
+ return a.replace(/['"]+/g, "");
119
+ }
120
+ }
121
+ }
122
+ return (e = t.style.color) == null ? void 0 : e.replace(/['"]+/g, "");
123
+ },
124
+ renderHTML: (t) => t.color ? {
125
+ style: `color: ${t.color}`
126
+ } : {}
127
+ }
128
+ }
129
+ }
130
+ ];
131
+ },
132
+ addCommands() {
133
+ return {
134
+ setColor: (t) => ({ chain: e }) => e().setMark("textStyle", { color: t }).run(),
135
+ unsetColor: () => ({ chain: t }) => t().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
136
+ };
137
+ }
138
+ }), h = l.create({
139
+ name: "fontFamily",
140
+ addOptions() {
141
+ return {
142
+ types: ["textStyle"]
143
+ };
144
+ },
145
+ addGlobalAttributes() {
146
+ return [
147
+ {
148
+ types: this.options.types,
149
+ attributes: {
150
+ fontFamily: {
151
+ default: null,
152
+ parseHTML: (t) => t.style.fontFamily,
153
+ renderHTML: (t) => t.fontFamily ? {
154
+ style: `font-family: ${t.fontFamily}`
155
+ } : {}
156
+ }
157
+ }
158
+ }
159
+ ];
160
+ },
161
+ addCommands() {
162
+ return {
163
+ setFontFamily: (t) => ({ chain: e }) => e().setMark("textStyle", { fontFamily: t }).run(),
164
+ unsetFontFamily: () => ({ chain: t }) => t().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
165
+ };
166
+ }
167
+ }), S = l.create({
168
+ name: "fontSize",
169
+ addOptions() {
170
+ return {
171
+ types: ["textStyle"]
172
+ };
173
+ },
174
+ addGlobalAttributes() {
175
+ return [
176
+ {
177
+ types: this.options.types,
178
+ attributes: {
179
+ fontSize: {
180
+ default: null,
181
+ parseHTML: (t) => t.style.fontSize,
182
+ renderHTML: (t) => t.fontSize ? {
183
+ style: `font-size: ${t.fontSize}`
184
+ } : {}
185
+ }
186
+ }
187
+ }
188
+ ];
189
+ },
190
+ addCommands() {
191
+ return {
192
+ setFontSize: (t) => ({ chain: e }) => e().setMark("textStyle", { fontSize: t }).run(),
193
+ unsetFontSize: () => ({ chain: t }) => t().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
194
+ };
195
+ }
196
+ }), b = l.create({
197
+ name: "lineHeight",
198
+ addOptions() {
199
+ return {
200
+ types: ["textStyle"]
201
+ };
202
+ },
203
+ addGlobalAttributes() {
204
+ return [
205
+ {
206
+ types: this.options.types,
207
+ attributes: {
208
+ lineHeight: {
209
+ default: null,
210
+ parseHTML: (t) => t.style.lineHeight,
211
+ renderHTML: (t) => t.lineHeight ? {
212
+ style: `line-height: ${t.lineHeight}`
213
+ } : {}
214
+ }
215
+ }
216
+ }
217
+ ];
218
+ },
219
+ addCommands() {
220
+ return {
221
+ setLineHeight: (t) => ({ chain: e }) => e().setMark("textStyle", { lineHeight: t }).run(),
222
+ unsetLineHeight: () => ({ chain: t }) => t().setMark("textStyle", { lineHeight: null }).removeEmptyTextStyle().run()
223
+ };
224
+ }
225
+ });
226
+ l.create({
227
+ name: "textStyleKit",
228
+ addExtensions() {
229
+ const t = [];
230
+ return this.options.backgroundColor !== !1 && t.push(m.configure(this.options.backgroundColor)), this.options.color !== !1 && t.push(g.configure(this.options.color)), this.options.fontFamily !== !1 && t.push(h.configure(this.options.fontFamily)), this.options.fontSize !== !1 && t.push(S.configure(this.options.fontSize)), this.options.lineHeight !== !1 && t.push(b.configure(this.options.lineHeight)), this.options.textStyle !== !1 && t.push(c.configure(this.options.textStyle)), t;
231
+ }
232
+ });
57
233
  export {
58
- H as iconToSVG,
59
- I as isUnsetKeyword
234
+ m as BackgroundColor,
235
+ g as Color,
236
+ h as FontFamily,
237
+ S as FontSize,
238
+ b as LineHeight,
239
+ c as TextStyle
60
240
  };