@vizel/core 0.0.1-alpha.5 → 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 +84 -55
  27. package/dist/index35.js +64 -4
  28. package/dist/index36.js +4 -123
  29. package/dist/index37.js +111 -315
  30. package/dist/index38.js +321 -481
  31. package/dist/index39.js +12 -47
  32. package/dist/index4.js +1 -1
  33. package/dist/index40.js +463 -655
  34. package/dist/index41.js +48 -4
  35. package/dist/index42.js +694 -4
  36. package/dist/index43.js +4 -238
  37. package/dist/index44.js +4 -82
  38. package/dist/index45.js +237 -16
  39. package/dist/index46.js +81 -57
  40. package/dist/index47.js +17 -15
  41. package/dist/index48.js +57 -285
  42. package/dist/index49.js +15 -202
  43. package/dist/index5.js +78 -68
  44. package/dist/index50.js +281 -1497
  45. package/dist/index51.js +202 -5
  46. package/dist/index52.js +1408 -1467
  47. package/dist/index53.js +5 -723
  48. package/dist/index54.js +1109 -81
  49. package/dist/index55.js +703 -226
  50. package/dist/index56.js +84 -3
  51. package/dist/index57.js +219 -1205
  52. package/dist/index58.js +3 -734
  53. package/dist/index59.js +1232 -21
  54. package/dist/index6.js +1 -1
  55. package/dist/index60.js +734 -10
  56. package/dist/index61.js +21 -7
  57. package/dist/index62.js +10 -8
  58. package/dist/index63.js +6 -13
  59. package/dist/index64.js +7 -18
  60. package/dist/index65.js +12 -23
  61. package/dist/index66.js +17 -53
  62. package/dist/index67.js +23 -1059
  63. package/dist/index68.js +54 -90
  64. package/dist/index69.js +1061 -98
  65. package/dist/index7.js +108 -96
  66. package/dist/index70.js +98 -4
  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/index51.js CHANGED
@@ -1,7 +1,204 @@
1
- import { getDefaultExportFromCjs as r } from "./index70.js";
2
- import { __require as o } from "./index67.js";
3
- var e = /* @__PURE__ */ o();
4
- const a = /* @__PURE__ */ r(e);
1
+ import { keydownHandler as v } from "./index68.js";
2
+ import { Plugin as w, TextSelection as m, NodeSelection as x, Selection as u } from "./index40.js";
3
+ import { Fragment as h, Slice as g } from "./index59.js";
4
+ import { DecorationSet as S, Decoration as A } from "./index52.js";
5
+ class i extends u {
6
+ /**
7
+ Create a gap cursor.
8
+ */
9
+ constructor(e) {
10
+ super(e, e);
11
+ }
12
+ map(e, t) {
13
+ let o = e.resolve(t.map(this.head));
14
+ return i.valid(o) ? new i(o) : u.near(o);
15
+ }
16
+ content() {
17
+ return g.empty;
18
+ }
19
+ eq(e) {
20
+ return e instanceof i && e.head == this.head;
21
+ }
22
+ toJSON() {
23
+ return { type: "gapcursor", pos: this.head };
24
+ }
25
+ /**
26
+ @internal
27
+ */
28
+ static fromJSON(e, t) {
29
+ if (typeof t.pos != "number")
30
+ throw new RangeError("Invalid input for GapCursor.fromJSON");
31
+ return new i(e.resolve(t.pos));
32
+ }
33
+ /**
34
+ @internal
35
+ */
36
+ getBookmark() {
37
+ return new d(this.anchor);
38
+ }
39
+ /**
40
+ @internal
41
+ */
42
+ static valid(e) {
43
+ let t = e.parent;
44
+ if (t.isTextblock || !b(e) || !y(e))
45
+ return !1;
46
+ let o = t.type.spec.allowGapCursor;
47
+ if (o != null)
48
+ return o;
49
+ let r = t.contentMatchAt(e.index()).defaultType;
50
+ return r && r.isTextblock;
51
+ }
52
+ /**
53
+ @internal
54
+ */
55
+ static findGapCursorFrom(e, t, o = !1) {
56
+ e: for (; ; ) {
57
+ if (!o && i.valid(e))
58
+ return e;
59
+ let r = e.pos, s = null;
60
+ for (let l = e.depth; ; l--) {
61
+ let a = e.node(l);
62
+ if (t > 0 ? e.indexAfter(l) < a.childCount : e.index(l) > 0) {
63
+ s = a.child(t > 0 ? e.indexAfter(l) : e.index(l) - 1);
64
+ break;
65
+ } else if (l == 0)
66
+ return null;
67
+ r += t;
68
+ let f = e.doc.resolve(r);
69
+ if (i.valid(f))
70
+ return f;
71
+ }
72
+ for (; ; ) {
73
+ let l = t > 0 ? s.firstChild : s.lastChild;
74
+ if (!l) {
75
+ if (s.isAtom && !s.isText && !x.isSelectable(s)) {
76
+ e = e.doc.resolve(r + s.nodeSize * t), o = !1;
77
+ continue e;
78
+ }
79
+ break;
80
+ }
81
+ s = l, r += t;
82
+ let a = e.doc.resolve(r);
83
+ if (i.valid(a))
84
+ return a;
85
+ }
86
+ return null;
87
+ }
88
+ }
89
+ }
90
+ i.prototype.visible = !1;
91
+ i.findFrom = i.findGapCursorFrom;
92
+ u.jsonID("gapcursor", i);
93
+ class d {
94
+ constructor(e) {
95
+ this.pos = e;
96
+ }
97
+ map(e) {
98
+ return new d(e.map(this.pos));
99
+ }
100
+ resolve(e) {
101
+ let t = e.resolve(this.pos);
102
+ return i.valid(t) ? new i(t) : u.near(t);
103
+ }
104
+ }
105
+ function C(n) {
106
+ return n.isAtom || n.spec.isolating || n.spec.createGapCursor;
107
+ }
108
+ function b(n) {
109
+ for (let e = n.depth; e >= 0; e--) {
110
+ let t = n.index(e), o = n.node(e);
111
+ if (t == 0) {
112
+ if (o.type.spec.isolating)
113
+ return !0;
114
+ continue;
115
+ }
116
+ for (let r = o.child(t - 1); ; r = r.lastChild) {
117
+ if (r.childCount == 0 && !r.inlineContent || C(r.type))
118
+ return !0;
119
+ if (r.inlineContent)
120
+ return !1;
121
+ }
122
+ }
123
+ return !0;
124
+ }
125
+ function y(n) {
126
+ for (let e = n.depth; e >= 0; e--) {
127
+ let t = n.indexAfter(e), o = n.node(e);
128
+ if (t == o.childCount) {
129
+ if (o.type.spec.isolating)
130
+ return !0;
131
+ continue;
132
+ }
133
+ for (let r = o.child(t); ; r = r.firstChild) {
134
+ if (r.childCount == 0 && !r.inlineContent || C(r.type))
135
+ return !0;
136
+ if (r.inlineContent)
137
+ return !1;
138
+ }
139
+ }
140
+ return !0;
141
+ }
142
+ function B() {
143
+ return new w({
144
+ props: {
145
+ decorations: F,
146
+ createSelectionBetween(n, e, t) {
147
+ return e.pos == t.pos && i.valid(t) ? new i(t) : null;
148
+ },
149
+ handleClick: T,
150
+ handleKeyDown: k,
151
+ handleDOMEvents: { beforeinput: D }
152
+ }
153
+ });
154
+ }
155
+ const k = v({
156
+ ArrowLeft: c("horiz", -1),
157
+ ArrowRight: c("horiz", 1),
158
+ ArrowUp: c("vert", -1),
159
+ ArrowDown: c("vert", 1)
160
+ });
161
+ function c(n, e) {
162
+ const t = n == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
163
+ return function(o, r, s) {
164
+ let l = o.selection, a = e > 0 ? l.$to : l.$from, f = l.empty;
165
+ if (l instanceof m) {
166
+ if (!s.endOfTextblock(t) || a.depth == 0)
167
+ return !1;
168
+ f = !1, a = o.doc.resolve(e > 0 ? a.after() : a.before());
169
+ }
170
+ let p = i.findGapCursorFrom(a, e, f);
171
+ return p ? (r && r(o.tr.setSelection(new i(p))), !0) : !1;
172
+ };
173
+ }
174
+ function T(n, e, t) {
175
+ if (!n || !n.editable)
176
+ return !1;
177
+ let o = n.state.doc.resolve(e);
178
+ if (!i.valid(o))
179
+ return !1;
180
+ let r = n.posAtCoords({ left: t.clientX, top: t.clientY });
181
+ return r && r.inside > -1 && x.isSelectable(n.state.doc.nodeAt(r.inside)) ? !1 : (n.dispatch(n.state.tr.setSelection(new i(o))), !0);
182
+ }
183
+ function D(n, e) {
184
+ if (e.inputType != "insertCompositionText" || !(n.state.selection instanceof i))
185
+ return !1;
186
+ let { $from: t } = n.state.selection, o = t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);
187
+ if (!o)
188
+ return !1;
189
+ let r = h.empty;
190
+ for (let l = o.length - 1; l >= 0; l--)
191
+ r = h.from(o[l].createAndFill(null, r));
192
+ let s = n.state.tr.replace(t.pos, t.pos, new g(r, 0, 0));
193
+ return s.setSelection(m.near(s.doc.resolve(t.pos + 1))), n.dispatch(s), !1;
194
+ }
195
+ function F(n) {
196
+ if (!(n.selection instanceof i))
197
+ return null;
198
+ let e = document.createElement("div");
199
+ return e.className = "ProseMirror-gapcursor", S.create(n.doc, [A.widget(n.selection.head, e, { key: "gapcursor" })]);
200
+ }
5
201
  export {
6
- a as default
202
+ i as GapCursor,
203
+ B as gapCursor
7
204
  };