@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/index37.js CHANGED
@@ -1,66 +1,50 @@
1
- import { Mark as d, mergeAttributes as a } from "@tiptap/core";
2
- var s = d.create({
3
- name: "underline",
1
+ import { Extension as u } from "@tiptap/core";
2
+ import { PluginKey as p, Plugin as h } from "./index42.js";
3
+ var g = ({ key: d, editor: o, onPaste: n, onDrop: s, allowedMimeTypes: a }) => new h({
4
+ key: d || new p("fileHandler"),
5
+ props: {
6
+ handleDrop(f, r) {
7
+ var i;
8
+ if (!s || !((i = r.dataTransfer) != null && i.files.length))
9
+ return !1;
10
+ const e = f.posAtCoords({
11
+ left: r.clientX,
12
+ top: r.clientY
13
+ });
14
+ let t = Array.from(r.dataTransfer.files);
15
+ return a && (t = t.filter((l) => a.includes(l.type))), t.length === 0 ? !1 : (r.preventDefault(), r.stopPropagation(), s(o, t, e?.pos || 0), !0);
16
+ },
17
+ handlePaste(f, r) {
18
+ var i;
19
+ if (!n || !((i = r.clipboardData) != null && i.files.length))
20
+ return !1;
21
+ let e = Array.from(r.clipboardData.files);
22
+ const t = r.clipboardData.getData("text/html");
23
+ return a && (e = e.filter((l) => a.includes(l.type))), !(e.length === 0 || (r.preventDefault(), r.stopPropagation(), n(o, e, t), t.length > 0));
24
+ }
25
+ }
26
+ }), m = u.create({
27
+ name: "fileHandler",
4
28
  addOptions() {
5
29
  return {
6
- HTMLAttributes: {}
30
+ onPaste: void 0,
31
+ onDrop: void 0,
32
+ allowedMimeTypes: void 0
7
33
  };
8
34
  },
9
- parseHTML() {
35
+ addProseMirrorPlugins() {
10
36
  return [
11
- {
12
- tag: "u"
13
- },
14
- {
15
- style: "text-decoration",
16
- consuming: !1,
17
- getAttrs: (e) => e.includes("underline") ? {} : !1
18
- }
37
+ g({
38
+ key: new p(this.name),
39
+ editor: this.editor,
40
+ allowedMimeTypes: this.options.allowedMimeTypes,
41
+ onDrop: this.options.onDrop,
42
+ onPaste: this.options.onPaste
43
+ })
19
44
  ];
20
- },
21
- renderHTML({ HTMLAttributes: e }) {
22
- return ["u", a(this.options.HTMLAttributes, e), 0];
23
- },
24
- parseMarkdown(e, n) {
25
- return n.applyMark(this.name || "underline", n.parseInline(e.tokens || []));
26
- },
27
- renderMarkdown(e, n) {
28
- return `++${n.renderChildren(e)}++`;
29
- },
30
- markdownTokenizer: {
31
- name: "underline",
32
- level: "inline",
33
- start(e) {
34
- return e.indexOf("++");
35
- },
36
- tokenize(e, n, i) {
37
- const r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
38
- if (!r)
39
- return;
40
- const t = r[2].trim();
41
- return {
42
- type: "underline",
43
- raw: r[0],
44
- text: t,
45
- tokens: i.inlineTokens(t)
46
- };
47
- }
48
- },
49
- addCommands() {
50
- return {
51
- setUnderline: () => ({ commands: e }) => e.setMark(this.name),
52
- toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
53
- unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
54
- };
55
- },
56
- addKeyboardShortcuts() {
57
- return {
58
- "Mod-u": () => this.editor.commands.toggleUnderline(),
59
- "Mod-U": () => this.editor.commands.toggleUnderline()
60
- };
61
45
  }
62
- }), l = s;
46
+ });
63
47
  export {
64
- s as Underline,
65
- l as default
48
+ g as FileHandlePlugin,
49
+ m as FileHandler
66
50
  };
package/dist/index38.js CHANGED
@@ -1,6 +1,66 @@
1
- import { CharacterCount as a } from "./index48.js";
2
- var t = a;
1
+ import { Mark as d, mergeAttributes as a } from "@tiptap/core";
2
+ var s = d.create({
3
+ name: "underline",
4
+ addOptions() {
5
+ return {
6
+ HTMLAttributes: {}
7
+ };
8
+ },
9
+ parseHTML() {
10
+ return [
11
+ {
12
+ tag: "u"
13
+ },
14
+ {
15
+ style: "text-decoration",
16
+ consuming: !1,
17
+ getAttrs: (e) => e.includes("underline") ? {} : !1
18
+ }
19
+ ];
20
+ },
21
+ renderHTML({ HTMLAttributes: e }) {
22
+ return ["u", a(this.options.HTMLAttributes, e), 0];
23
+ },
24
+ parseMarkdown(e, n) {
25
+ return n.applyMark(this.name || "underline", n.parseInline(e.tokens || []));
26
+ },
27
+ renderMarkdown(e, n) {
28
+ return `++${n.renderChildren(e)}++`;
29
+ },
30
+ markdownTokenizer: {
31
+ name: "underline",
32
+ level: "inline",
33
+ start(e) {
34
+ return e.indexOf("++");
35
+ },
36
+ tokenize(e, n, i) {
37
+ const r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
38
+ if (!r)
39
+ return;
40
+ const t = r[2].trim();
41
+ return {
42
+ type: "underline",
43
+ raw: r[0],
44
+ text: t,
45
+ tokens: i.inlineTokens(t)
46
+ };
47
+ }
48
+ },
49
+ addCommands() {
50
+ return {
51
+ setUnderline: () => ({ commands: e }) => e.setMark(this.name),
52
+ toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
53
+ unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
54
+ };
55
+ },
56
+ addKeyboardShortcuts() {
57
+ return {
58
+ "Mod-u": () => this.editor.commands.toggleUnderline(),
59
+ "Mod-U": () => this.editor.commands.toggleUnderline()
60
+ };
61
+ }
62
+ }), l = s;
3
63
  export {
4
- a as CharacterCount,
5
- t as default
64
+ s as Underline,
65
+ l as default
6
66
  };
package/dist/index39.js CHANGED
@@ -1,125 +1,6 @@
1
- import x from "@tiptap/extension-code-block";
2
- import { findChildren as p } from "@tiptap/core";
3
- import { Plugin as y, PluginKey as w } from "./index41.js";
4
- import { Decoration as N, DecorationSet as L } from "./index49.js";
5
- import C from "./index50.js";
6
- function v(e, i = []) {
7
- return e.flatMap((t) => {
8
- const a = [...i, ...t.properties ? t.properties.className : []];
9
- return t.children ? v(t.children, a) : {
10
- text: t.value,
11
- classes: a
12
- };
13
- });
14
- }
15
- function f(e) {
16
- return e.value || e.children || [];
17
- }
18
- function P(e) {
19
- return !!C.getLanguage(e);
20
- }
21
- function m({
22
- doc: e,
23
- name: i,
24
- lowlight: t,
25
- defaultLanguage: a
26
- }) {
27
- const n = [];
28
- return p(e, (r) => r.type.name === i).forEach((r) => {
29
- var u;
30
- let l = r.pos + 1;
31
- const s = r.node.attrs.language || a, h = t.listLanguages(), d = s && (h.includes(s) || P(s) || (u = t.registered) != null && u.call(t, s)) ? f(t.highlight(s, r.node.textContent)) : f(t.highlightAuto(r.node.textContent));
32
- v(d).forEach((g) => {
33
- const o = l + g.text.length;
34
- if (g.classes.length) {
35
- const c = N.inline(l, o, {
36
- class: g.classes.join(" ")
37
- });
38
- n.push(c);
39
- }
40
- l = o;
41
- });
42
- }), L.create(e, n);
43
- }
44
- function _(e) {
45
- return typeof e == "function";
46
- }
47
- function A({
48
- name: e,
49
- lowlight: i,
50
- defaultLanguage: t
51
- }) {
52
- if (!["highlight", "highlightAuto", "listLanguages"].every((n) => _(i[n])))
53
- throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");
54
- const a = new y({
55
- key: new w("lowlight"),
56
- state: {
57
- init: (n, { doc: r }) => m({
58
- doc: r,
59
- name: e,
60
- lowlight: i,
61
- defaultLanguage: t
62
- }),
63
- apply: (n, r, u, l) => {
64
- const s = u.selection.$head.parent.type.name, h = l.selection.$head.parent.type.name, d = p(u.doc, (o) => o.type.name === e), g = p(l.doc, (o) => o.type.name === e);
65
- return n.docChanged && // Apply decorations if:
66
- // selection includes named node,
67
- ([s, h].includes(e) || // OR transaction adds/removes named node,
68
- g.length !== d.length || // OR transaction has changes that completely encapsulte a node
69
- // (for example, a transaction that affects the entire document).
70
- // Such transactions can happen during collab syncing via y-prosemirror, for example.
71
- n.steps.some((o) => (
72
- // @ts-ignore
73
- o.from !== void 0 && // @ts-ignore
74
- o.to !== void 0 && d.some((c) => (
75
- // @ts-ignore
76
- c.pos >= o.from && // @ts-ignore
77
- c.pos + c.node.nodeSize <= o.to
78
- ))
79
- ))) ? m({
80
- doc: n.doc,
81
- name: e,
82
- lowlight: i,
83
- defaultLanguage: t
84
- }) : r.map(n.mapping, n.doc);
85
- }
86
- },
87
- props: {
88
- decorations(n) {
89
- return a.getState(n);
90
- }
91
- }
92
- });
93
- return a;
94
- }
95
- var D = x.extend({
96
- addOptions() {
97
- var e;
98
- return {
99
- ...(e = this.parent) == null ? void 0 : e.call(this),
100
- lowlight: {},
101
- languageClassPrefix: "language-",
102
- exitOnTripleEnter: !0,
103
- exitOnArrowDown: !0,
104
- defaultLanguage: null,
105
- enableTabIndentation: !1,
106
- tabSize: 4,
107
- HTMLAttributes: {}
108
- };
109
- },
110
- addProseMirrorPlugins() {
111
- var e;
112
- return [
113
- ...((e = this.parent) == null ? void 0 : e.call(this)) || [],
114
- A({
115
- name: this.name,
116
- lowlight: this.options.lowlight,
117
- defaultLanguage: this.options.defaultLanguage
118
- })
119
- ];
120
- }
121
- }), S = D;
1
+ import { CharacterCount as a } from "./index48.js";
2
+ var t = a;
122
3
  export {
123
- D as CodeBlockLowlight,
124
- S as default
4
+ a as CharacterCount,
5
+ t as default
125
6
  };
package/dist/index4.js CHANGED
@@ -1,89 +1,13 @@
1
- import { TextStyle as t, Color as l } from "./index46.js";
2
- import { Highlight as i } from "./index47.js";
3
- const h = [
4
- // Row 1: Grayscale
5
- { name: "Default", color: "inherit" },
6
- { name: "Dark Gray", color: "#374151" },
7
- { name: "Gray", color: "#6b7280" },
8
- { name: "Light Gray", color: "#9ca3af" },
9
- // Row 2: Warm colors
10
- { name: "Dark Red", color: "#b91c1c" },
11
- { name: "Red", color: "#ef4444" },
12
- { name: "Orange", color: "#f97316" },
13
- { name: "Amber", color: "#f59e0b" },
14
- // Row 3: Cool colors
15
- { name: "Yellow", color: "#eab308" },
16
- { name: "Lime", color: "#84cc16" },
17
- { name: "Green", color: "#22c55e" },
18
- { name: "Emerald", color: "#10b981" },
19
- // Row 4: Blue spectrum
20
- { name: "Teal", color: "#14b8a6" },
21
- { name: "Cyan", color: "#06b6d4" },
22
- { name: "Blue", color: "#3b82f6" },
23
- { name: "Indigo", color: "#6366f1" },
24
- // Row 5: Purple/Pink spectrum
25
- { name: "Violet", color: "#8b5cf6" },
26
- { name: "Purple", color: "#a855f7" },
27
- { name: "Fuchsia", color: "#d946ef" },
28
- { name: "Pink", color: "#ec4899" }
29
- ], s = [
30
- // Row 1: Basics
31
- { name: "None", color: "transparent" },
32
- { name: "Light Gray", color: "#e5e7eb" },
33
- { name: "Warm Gray", color: "#e7e5e4" },
34
- { name: "Cool Gray", color: "#e2e8f0" },
35
- // Row 2: Warm highlights
36
- { name: "Light Red", color: "#fecaca" },
37
- { name: "Light Orange", color: "#fed7aa" },
38
- { name: "Light Amber", color: "#fde68a" },
39
- { name: "Yellow", color: "#fef08a" },
40
- // Row 3: Green highlights
41
- { name: "Light Lime", color: "#d9f99d" },
42
- { name: "Light Green", color: "#bbf7d0" },
43
- { name: "Light Emerald", color: "#a7f3d0" },
44
- { name: "Light Teal", color: "#99f6e4" },
45
- // Row 4: Blue highlights
46
- { name: "Light Cyan", color: "#a5f3fc" },
47
- { name: "Light Blue", color: "#bfdbfe" },
48
- { name: "Light Indigo", color: "#c7d2fe" },
49
- { name: "Light Violet", color: "#ddd6fe" },
50
- // Row 5: Purple/Pink highlights
51
- { name: "Light Purple", color: "#e9d5ff" },
52
- { name: "Light Fuchsia", color: "#f5d0fe" },
53
- { name: "Light Pink", color: "#fbcfe8" },
54
- { name: "Light Rose", color: "#fecdd3" }
55
- ], r = "vizel-recent-colors", m = 8;
56
- function f(o) {
57
- if (typeof window > "u") return [];
58
- try {
59
- const e = localStorage.getItem(`${r}-${o}`);
60
- return e ? JSON.parse(e) : [];
61
- } catch {
62
- return [];
63
- }
64
- }
65
- function u(o, e) {
66
- if (!(typeof window > "u") && !(e === "inherit" || e === "transparent"))
67
- try {
68
- const n = f(o).filter((c) => c !== e), a = [e, ...n].slice(0, m);
69
- localStorage.setItem(`${r}-${o}`, JSON.stringify(a));
70
- } catch {
71
- }
72
- }
73
- function b(o = {}) {
74
- const { multicolor: e = !0 } = o;
75
- return [
76
- t,
77
- l,
78
- i.configure({
79
- multicolor: e
80
- })
81
- ];
1
+ import n from "./index39.js";
2
+ function u(e = {}) {
3
+ const { limit: o = null, mode: r = "textSize", wordCounter: t } = e;
4
+ return n.configure({
5
+ limit: o,
6
+ mode: r,
7
+ ...t !== void 0 && { wordCounter: t }
8
+ });
82
9
  }
83
10
  export {
84
- s as VIZEL_HIGHLIGHT_COLORS,
85
- h as VIZEL_TEXT_COLORS,
86
- u as addVizelRecentColor,
87
- b as createVizelTextColorExtensions,
88
- f as getVizelRecentColors
11
+ n as CharacterCount,
12
+ u as createVizelCharacterCountExtension
89
13
  };