@lunejs/admin-ui 0.1.4 → 0.2.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.
- package/dist/_virtual/index10.js +5 -2
- package/dist/_virtual/index11.js +4 -0
- package/dist/_virtual/index6.js +3 -3
- package/dist/_virtual/index8.js +3 -5
- package/dist/lib/api/fetchers/gql-fetcher.js +6 -6
- package/dist/lib/collections/components/collection-details/cards/general-card.js +20 -14
- package/dist/lib/custom-fields/components/fields/color.js +3 -3
- package/dist/lib/dashboard/pages/dashboard-page.js +5 -5
- package/dist/lib/product/components/product-details/cards/general-product-card.js +18 -12
- package/dist/node_modules/@tiptap/core/dist/index.js +3562 -0
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +17 -0
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +80 -0
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +13 -0
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +64 -0
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +78 -0
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +305 -0
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +42 -0
- package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +14 -0
- package/dist/node_modules/@tiptap/extension-text-style/dist/index.js +240 -0
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +66 -0
- package/dist/node_modules/@tiptap/react/dist/index.js +481 -0
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +324 -0
- package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/baseline.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/between-horizontal-end.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/between-vertical-end.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/bold.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-plus.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-x.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/italic.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/link.js +9 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/list-ordered.js +13 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/table-columns-split.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/table-rows-split.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/table.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/underline.js +9 -0
- package/dist/node_modules/orderedmap/dist/index.js +103 -0
- package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
- package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
- package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
- package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
- package/dist/node_modules/prosemirror-tables/dist/index.js +1446 -0
- package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
- package/dist/node_modules/prosemirror-view/dist/index.js +3772 -0
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/node_modules/w3c-keyname/index.js +93 -0
- package/dist/packages/lune-ui/dist/_virtual/index3.js +2 -5
- package/dist/packages/lune-ui/dist/_virtual/index6.js +5 -2
- package/dist/packages/lune-ui/dist/components/popover.js +15 -11
- package/dist/packages/lune-ui/dist/components/select.js +6 -6
- package/dist/packages/lune-ui/dist/form/form-date-picker.js +2 -2
- package/dist/packages/lune-ui/dist/form/form.js +4 -4
- package/dist/packages/lune-ui/dist/node_modules/@radix-ui/react-popover/dist/index.js +39 -38
- package/dist/packages/lune-ui/dist/node_modules/prop-types/index.js +1 -1
- package/dist/packages/lune-ui/dist/packages/lune-ui/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/shared/components/color-picker/color-picker.d.ts +2 -1
- package/dist/shared/components/color-picker/color-picker.js +11 -11
- package/dist/shared/components/data-table/data-table-filter.js +4 -4
- package/dist/shared/components/rich-editor/rich-editor.d.ts +6 -0
- package/dist/shared/components/rich-editor/rich-editor.js +93 -0
- package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +65 -0
- package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +65 -0
- package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +114 -0
- package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +65 -0
- package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.d.ts +2 -0
- package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.js +103 -0
- package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +63 -0
- package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +65 -0
- package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +107 -0
- package/dist/shared/components/rich-editor/toolbar/toolbar.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/toolbar.js +64 -0
- package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +65 -0
- package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.d.ts +1 -0
- package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +65 -0
- package/package.json +6 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "../createLucideIcon.js";
|
|
2
|
+
const t = [
|
|
3
|
+
["path", { d: "M4 20h16", key: "14thso" }],
|
|
4
|
+
["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
|
|
5
|
+
["path", { d: "M8 12h8", key: "1wcyev" }]
|
|
6
|
+
], a = e("baseline", t);
|
|
7
|
+
export {
|
|
8
|
+
t as __iconNode,
|
|
9
|
+
a as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "../createLucideIcon.js";
|
|
2
|
+
const t = [
|
|
3
|
+
["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
|
|
4
|
+
["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
|
|
5
|
+
["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
|
|
6
|
+
], n = e("between-horizontal-end", t);
|
|
7
|
+
export {
|
|
8
|
+
t as __iconNode,
|
|
9
|
+
n as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "../createLucideIcon.js";
|
|
2
|
+
const t = [
|
|
3
|
+
["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
|
|
4
|
+
["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
|
|
5
|
+
["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
|
|
6
|
+
], r = e("between-vertical-end", t);
|
|
7
|
+
export {
|
|
8
|
+
t as __iconNode,
|
|
9
|
+
r as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import a from "../createLucideIcon.js";
|
|
2
|
+
const e = [
|
|
3
|
+
[
|
|
4
|
+
"path",
|
|
5
|
+
{
|
|
6
|
+
d: "M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",
|
|
7
|
+
key: "11za1p"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
["path", { d: "M16 19h6", key: "xwg31i" }],
|
|
11
|
+
["path", { d: "M19 22v-6", key: "qhmiwi" }]
|
|
12
|
+
], d = a("grid-2x2-plus", e);
|
|
13
|
+
export {
|
|
14
|
+
e as __iconNode,
|
|
15
|
+
d as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import a from "../createLucideIcon.js";
|
|
2
|
+
const t = [
|
|
3
|
+
[
|
|
4
|
+
"path",
|
|
5
|
+
{
|
|
6
|
+
d: "M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",
|
|
7
|
+
key: "11za1p"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
["path", { d: "m16 16 5 5", key: "8tpb07" }],
|
|
11
|
+
["path", { d: "m16 21 5-5", key: "193jll" }]
|
|
12
|
+
], d = a("grid-2x2-x", t);
|
|
13
|
+
export {
|
|
14
|
+
t as __iconNode,
|
|
15
|
+
d as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "../createLucideIcon.js";
|
|
2
|
+
const c = [
|
|
3
|
+
["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
|
|
4
|
+
["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
|
|
5
|
+
["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
|
|
6
|
+
], y = e("italic", c);
|
|
7
|
+
export {
|
|
8
|
+
c as __iconNode,
|
|
9
|
+
y as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import a from "../createLucideIcon.js";
|
|
2
|
+
const e = [
|
|
3
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
4
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
5
|
+
], t = a("link", e);
|
|
6
|
+
export {
|
|
7
|
+
e as __iconNode,
|
|
8
|
+
t as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import e from "../createLucideIcon.js";
|
|
2
|
+
const d = [
|
|
3
|
+
["path", { d: "M10 12h11", key: "6m4ad9" }],
|
|
4
|
+
["path", { d: "M10 18h11", key: "11hvi2" }],
|
|
5
|
+
["path", { d: "M10 6h11", key: "c7qv1k" }],
|
|
6
|
+
["path", { d: "M4 10h2", key: "16xx2s" }],
|
|
7
|
+
["path", { d: "M4 6h1v4", key: "cnovpq" }],
|
|
8
|
+
["path", { d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1", key: "m9a95d" }]
|
|
9
|
+
], h = e("list-ordered", d);
|
|
10
|
+
export {
|
|
11
|
+
d as __iconNode,
|
|
12
|
+
h as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import a from "../createLucideIcon.js";
|
|
2
|
+
const e = [
|
|
3
|
+
["path", { d: "M14 14v2", key: "w2a1xv" }],
|
|
4
|
+
["path", { d: "M14 20v2", key: "1lq872" }],
|
|
5
|
+
["path", { d: "M14 2v2", key: "6buw04" }],
|
|
6
|
+
["path", { d: "M14 8v2", key: "i67w9a" }],
|
|
7
|
+
["path", { d: "M2 15h8", key: "82wtch" }],
|
|
8
|
+
["path", { d: "M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2", key: "up0l64" }],
|
|
9
|
+
["path", { d: "M2 9h8", key: "yelfik" }],
|
|
10
|
+
["path", { d: "M22 15h-4", key: "1es58f" }],
|
|
11
|
+
["path", { d: "M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2", key: "pdjoqf" }],
|
|
12
|
+
["path", { d: "M22 9h-4", key: "1luja7" }],
|
|
13
|
+
["path", { d: "M5 3v18", key: "14hmio" }]
|
|
14
|
+
], h = a("table-columns-split", e);
|
|
15
|
+
export {
|
|
16
|
+
e as __iconNode,
|
|
17
|
+
h as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import a from "../createLucideIcon.js";
|
|
2
|
+
const t = [
|
|
3
|
+
["path", { d: "M14 10h2", key: "1lstlu" }],
|
|
4
|
+
["path", { d: "M15 22v-8", key: "1fwwgm" }],
|
|
5
|
+
["path", { d: "M15 2v4", key: "1044rn" }],
|
|
6
|
+
["path", { d: "M2 10h2", key: "1r8dkt" }],
|
|
7
|
+
["path", { d: "M20 10h2", key: "1ug425" }],
|
|
8
|
+
["path", { d: "M3 19h18", key: "awlh7x" }],
|
|
9
|
+
["path", { d: "M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6", key: "ibqhof" }],
|
|
10
|
+
["path", { d: "M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2", key: "1uenja" }],
|
|
11
|
+
["path", { d: "M8 10h2", key: "66od0" }],
|
|
12
|
+
["path", { d: "M9 22v-8", key: "fmnu31" }],
|
|
13
|
+
["path", { d: "M9 2v4", key: "j1yeou" }]
|
|
14
|
+
], h = a("table-rows-split", t);
|
|
15
|
+
export {
|
|
16
|
+
t as __iconNode,
|
|
17
|
+
h as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import t from "../createLucideIcon.js";
|
|
2
|
+
const e = [
|
|
3
|
+
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
4
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
5
|
+
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
6
|
+
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
7
|
+
], a = t("table", e);
|
|
8
|
+
export {
|
|
9
|
+
e as __iconNode,
|
|
10
|
+
a as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
function e(t) {
|
|
2
|
+
this.content = t;
|
|
3
|
+
}
|
|
4
|
+
e.prototype = {
|
|
5
|
+
constructor: e,
|
|
6
|
+
find: function(t) {
|
|
7
|
+
for (var n = 0; n < this.content.length; n += 2)
|
|
8
|
+
if (this.content[n] === t) return n;
|
|
9
|
+
return -1;
|
|
10
|
+
},
|
|
11
|
+
// :: (string) → ?any
|
|
12
|
+
// Retrieve the value stored under `key`, or return undefined when
|
|
13
|
+
// no such key exists.
|
|
14
|
+
get: function(t) {
|
|
15
|
+
var n = this.find(t);
|
|
16
|
+
return n == -1 ? void 0 : this.content[n + 1];
|
|
17
|
+
},
|
|
18
|
+
// :: (string, any, ?string) → OrderedMap
|
|
19
|
+
// Create a new map by replacing the value of `key` with a new
|
|
20
|
+
// value, or adding a binding to the end of the map. If `newKey` is
|
|
21
|
+
// given, the key of the binding will be replaced with that key.
|
|
22
|
+
update: function(t, n, r) {
|
|
23
|
+
var i = r && r != t ? this.remove(r) : this, o = i.find(t), c = i.content.slice();
|
|
24
|
+
return o == -1 ? c.push(r || t, n) : (c[o + 1] = n, r && (c[o] = r)), new e(c);
|
|
25
|
+
},
|
|
26
|
+
// :: (string) → OrderedMap
|
|
27
|
+
// Return a map with the given key removed, if it existed.
|
|
28
|
+
remove: function(t) {
|
|
29
|
+
var n = this.find(t);
|
|
30
|
+
if (n == -1) return this;
|
|
31
|
+
var r = this.content.slice();
|
|
32
|
+
return r.splice(n, 2), new e(r);
|
|
33
|
+
},
|
|
34
|
+
// :: (string, any) → OrderedMap
|
|
35
|
+
// Add a new key to the start of the map.
|
|
36
|
+
addToStart: function(t, n) {
|
|
37
|
+
return new e([t, n].concat(this.remove(t).content));
|
|
38
|
+
},
|
|
39
|
+
// :: (string, any) → OrderedMap
|
|
40
|
+
// Add a new key to the end of the map.
|
|
41
|
+
addToEnd: function(t, n) {
|
|
42
|
+
var r = this.remove(t).content.slice();
|
|
43
|
+
return r.push(t, n), new e(r);
|
|
44
|
+
},
|
|
45
|
+
// :: (string, string, any) → OrderedMap
|
|
46
|
+
// Add a key after the given key. If `place` is not found, the new
|
|
47
|
+
// key is added to the end.
|
|
48
|
+
addBefore: function(t, n, r) {
|
|
49
|
+
var i = this.remove(n), o = i.content.slice(), c = i.find(t);
|
|
50
|
+
return o.splice(c == -1 ? o.length : c, 0, n, r), new e(o);
|
|
51
|
+
},
|
|
52
|
+
// :: ((key: string, value: any))
|
|
53
|
+
// Call the given function for each key/value pair in the map, in
|
|
54
|
+
// order.
|
|
55
|
+
forEach: function(t) {
|
|
56
|
+
for (var n = 0; n < this.content.length; n += 2)
|
|
57
|
+
t(this.content[n], this.content[n + 1]);
|
|
58
|
+
},
|
|
59
|
+
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
60
|
+
// Create a new map by prepending the keys in this map that don't
|
|
61
|
+
// appear in `map` before the keys in `map`.
|
|
62
|
+
prepend: function(t) {
|
|
63
|
+
return t = e.from(t), t.size ? new e(t.content.concat(this.subtract(t).content)) : this;
|
|
64
|
+
},
|
|
65
|
+
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
66
|
+
// Create a new map by appending the keys in this map that don't
|
|
67
|
+
// appear in `map` after the keys in `map`.
|
|
68
|
+
append: function(t) {
|
|
69
|
+
return t = e.from(t), t.size ? new e(this.subtract(t).content.concat(t.content)) : this;
|
|
70
|
+
},
|
|
71
|
+
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
72
|
+
// Create a map containing all the keys in this map that don't
|
|
73
|
+
// appear in `map`.
|
|
74
|
+
subtract: function(t) {
|
|
75
|
+
var n = this;
|
|
76
|
+
t = e.from(t);
|
|
77
|
+
for (var r = 0; r < t.content.length; r += 2)
|
|
78
|
+
n = n.remove(t.content[r]);
|
|
79
|
+
return n;
|
|
80
|
+
},
|
|
81
|
+
// :: () → Object
|
|
82
|
+
// Turn ordered map into a plain object.
|
|
83
|
+
toObject: function() {
|
|
84
|
+
var t = {};
|
|
85
|
+
return this.forEach(function(n, r) {
|
|
86
|
+
t[n] = r;
|
|
87
|
+
}), t;
|
|
88
|
+
},
|
|
89
|
+
// :: number
|
|
90
|
+
// The amount of keys in this map.
|
|
91
|
+
get size() {
|
|
92
|
+
return this.content.length >> 1;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
e.from = function(t) {
|
|
96
|
+
if (t instanceof e) return t;
|
|
97
|
+
var n = [];
|
|
98
|
+
if (t) for (var r in t) n.push(r, t[r]);
|
|
99
|
+
return new e(n);
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
e as default
|
|
103
|
+
};
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { canJoin as T, joinPoint as F, liftTarget as A, replaceStep as B, canSplit as h, findWrapping as J, ReplaceAroundStep as v, ReplaceStep as U } from "../../prosemirror-transform/dist/index.js";
|
|
2
|
+
import { Slice as y, Fragment as S } from "../../prosemirror-model/dist/index.js";
|
|
3
|
+
import { AllSelection as P, TextSelection as I, Selection as V, NodeSelection as d } from "../../prosemirror-state/dist/index.js";
|
|
4
|
+
const M = (t, e) => t.selection.empty ? !1 : (e && e(t.tr.deleteSelection().scrollIntoView()), !0);
|
|
5
|
+
function N(t, e) {
|
|
6
|
+
let { $cursor: r } = t.selection;
|
|
7
|
+
return !r || (e ? !e.endOfTextblock("backward", t) : r.parentOffset > 0) ? null : r;
|
|
8
|
+
}
|
|
9
|
+
const G = (t, e, r) => {
|
|
10
|
+
let n = N(t, r);
|
|
11
|
+
if (!n)
|
|
12
|
+
return !1;
|
|
13
|
+
let o = z(n);
|
|
14
|
+
if (!o) {
|
|
15
|
+
let i = n.blockRange(), f = i && A(i);
|
|
16
|
+
return f == null ? !1 : (e && e(t.tr.lift(i, f).scrollIntoView()), !0);
|
|
17
|
+
}
|
|
18
|
+
let l = o.nodeBefore;
|
|
19
|
+
if (D(t, o, e, -1))
|
|
20
|
+
return !0;
|
|
21
|
+
if (n.parent.content.size == 0 && (x(l, "end") || d.isSelectable(l)))
|
|
22
|
+
for (let i = n.depth; ; i--) {
|
|
23
|
+
let f = B(t.doc, n.before(i), n.after(i), y.empty);
|
|
24
|
+
if (f && f.slice.size < f.to - f.from) {
|
|
25
|
+
if (e) {
|
|
26
|
+
let c = t.tr.step(f);
|
|
27
|
+
c.setSelection(x(l, "end") ? V.findFrom(c.doc.resolve(c.mapping.map(o.pos, -1)), -1) : d.create(c.doc, o.pos - l.nodeSize)), e(c.scrollIntoView());
|
|
28
|
+
}
|
|
29
|
+
return !0;
|
|
30
|
+
}
|
|
31
|
+
if (i == 1 || n.node(i - 1).childCount > 1)
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
return l.isAtom && o.depth == n.depth - 1 ? (e && e(t.tr.delete(o.pos - l.nodeSize, o.pos).scrollIntoView()), !0) : !1;
|
|
35
|
+
}, oe = (t, e, r) => {
|
|
36
|
+
let n = N(t, r);
|
|
37
|
+
if (!n)
|
|
38
|
+
return !1;
|
|
39
|
+
let o = z(n);
|
|
40
|
+
return o ? E(t, o, e) : !1;
|
|
41
|
+
}, le = (t, e, r) => {
|
|
42
|
+
let n = W(t, r);
|
|
43
|
+
if (!n)
|
|
44
|
+
return !1;
|
|
45
|
+
let o = R(n);
|
|
46
|
+
return o ? E(t, o, e) : !1;
|
|
47
|
+
};
|
|
48
|
+
function E(t, e, r) {
|
|
49
|
+
let n = e.nodeBefore, o = n, l = e.pos - 1;
|
|
50
|
+
for (; !o.isTextblock; l--) {
|
|
51
|
+
if (o.type.spec.isolating)
|
|
52
|
+
return !1;
|
|
53
|
+
let s = o.lastChild;
|
|
54
|
+
if (!s)
|
|
55
|
+
return !1;
|
|
56
|
+
o = s;
|
|
57
|
+
}
|
|
58
|
+
let i = e.nodeAfter, f = i, c = e.pos + 1;
|
|
59
|
+
for (; !f.isTextblock; c++) {
|
|
60
|
+
if (f.type.spec.isolating)
|
|
61
|
+
return !1;
|
|
62
|
+
let s = f.firstChild;
|
|
63
|
+
if (!s)
|
|
64
|
+
return !1;
|
|
65
|
+
f = s;
|
|
66
|
+
}
|
|
67
|
+
let p = B(t.doc, l, c, y.empty);
|
|
68
|
+
if (!p || p.from != l || p instanceof U && p.slice.size >= c - l)
|
|
69
|
+
return !1;
|
|
70
|
+
if (r) {
|
|
71
|
+
let s = t.tr.step(p);
|
|
72
|
+
s.setSelection(I.create(s.doc, l)), r(s.scrollIntoView());
|
|
73
|
+
}
|
|
74
|
+
return !0;
|
|
75
|
+
}
|
|
76
|
+
function x(t, e, r = !1) {
|
|
77
|
+
for (let n = t; n; n = e == "start" ? n.firstChild : n.lastChild) {
|
|
78
|
+
if (n.isTextblock)
|
|
79
|
+
return !0;
|
|
80
|
+
if (r && n.childCount != 1)
|
|
81
|
+
return !1;
|
|
82
|
+
}
|
|
83
|
+
return !1;
|
|
84
|
+
}
|
|
85
|
+
const H = (t, e, r) => {
|
|
86
|
+
let { $head: n, empty: o } = t.selection, l = n;
|
|
87
|
+
if (!o)
|
|
88
|
+
return !1;
|
|
89
|
+
if (n.parent.isTextblock) {
|
|
90
|
+
if (r ? !r.endOfTextblock("backward", t) : n.parentOffset > 0)
|
|
91
|
+
return !1;
|
|
92
|
+
l = z(n);
|
|
93
|
+
}
|
|
94
|
+
let i = l && l.nodeBefore;
|
|
95
|
+
return !i || !d.isSelectable(i) ? !1 : (e && e(t.tr.setSelection(d.create(t.doc, l.pos - i.nodeSize)).scrollIntoView()), !0);
|
|
96
|
+
};
|
|
97
|
+
function z(t) {
|
|
98
|
+
if (!t.parent.type.spec.isolating)
|
|
99
|
+
for (let e = t.depth - 1; e >= 0; e--) {
|
|
100
|
+
if (t.index(e) > 0)
|
|
101
|
+
return t.doc.resolve(t.before(e + 1));
|
|
102
|
+
if (t.node(e).type.spec.isolating)
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
function W(t, e) {
|
|
108
|
+
let { $cursor: r } = t.selection;
|
|
109
|
+
return !r || (e ? !e.endOfTextblock("forward", t) : r.parentOffset < r.parent.content.size) ? null : r;
|
|
110
|
+
}
|
|
111
|
+
const K = (t, e, r) => {
|
|
112
|
+
let n = W(t, r);
|
|
113
|
+
if (!n)
|
|
114
|
+
return !1;
|
|
115
|
+
let o = R(n);
|
|
116
|
+
if (!o)
|
|
117
|
+
return !1;
|
|
118
|
+
let l = o.nodeAfter;
|
|
119
|
+
if (D(t, o, e, 1))
|
|
120
|
+
return !0;
|
|
121
|
+
if (n.parent.content.size == 0 && (x(l, "start") || d.isSelectable(l))) {
|
|
122
|
+
let i = B(t.doc, n.before(), n.after(), y.empty);
|
|
123
|
+
if (i && i.slice.size < i.to - i.from) {
|
|
124
|
+
if (e) {
|
|
125
|
+
let f = t.tr.step(i);
|
|
126
|
+
f.setSelection(x(l, "start") ? V.findFrom(f.doc.resolve(f.mapping.map(o.pos)), 1) : d.create(f.doc, f.mapping.map(o.pos))), e(f.scrollIntoView());
|
|
127
|
+
}
|
|
128
|
+
return !0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return l.isAtom && o.depth == n.depth - 1 ? (e && e(t.tr.delete(o.pos, o.pos + l.nodeSize).scrollIntoView()), !0) : !1;
|
|
132
|
+
}, L = (t, e, r) => {
|
|
133
|
+
let { $head: n, empty: o } = t.selection, l = n;
|
|
134
|
+
if (!o)
|
|
135
|
+
return !1;
|
|
136
|
+
if (n.parent.isTextblock) {
|
|
137
|
+
if (r ? !r.endOfTextblock("forward", t) : n.parentOffset < n.parent.content.size)
|
|
138
|
+
return !1;
|
|
139
|
+
l = R(n);
|
|
140
|
+
}
|
|
141
|
+
let i = l && l.nodeAfter;
|
|
142
|
+
return !i || !d.isSelectable(i) ? !1 : (e && e(t.tr.setSelection(d.create(t.doc, l.pos)).scrollIntoView()), !0);
|
|
143
|
+
};
|
|
144
|
+
function R(t) {
|
|
145
|
+
if (!t.parent.type.spec.isolating)
|
|
146
|
+
for (let e = t.depth - 1; e >= 0; e--) {
|
|
147
|
+
let r = t.node(e);
|
|
148
|
+
if (t.index(e) + 1 < r.childCount)
|
|
149
|
+
return t.doc.resolve(t.after(e + 1));
|
|
150
|
+
if (r.type.spec.isolating)
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
const ie = (t, e) => {
|
|
156
|
+
let r = t.selection, n = r instanceof d, o;
|
|
157
|
+
if (n) {
|
|
158
|
+
if (r.node.isTextblock || !T(t.doc, r.from))
|
|
159
|
+
return !1;
|
|
160
|
+
o = r.from;
|
|
161
|
+
} else if (o = F(t.doc, r.from, -1), o == null)
|
|
162
|
+
return !1;
|
|
163
|
+
if (e) {
|
|
164
|
+
let l = t.tr.join(o);
|
|
165
|
+
n && l.setSelection(d.create(l.doc, o - t.doc.resolve(o).nodeBefore.nodeSize)), e(l.scrollIntoView());
|
|
166
|
+
}
|
|
167
|
+
return !0;
|
|
168
|
+
}, fe = (t, e) => {
|
|
169
|
+
let r = t.selection, n;
|
|
170
|
+
if (r instanceof d) {
|
|
171
|
+
if (r.node.isTextblock || !T(t.doc, r.to))
|
|
172
|
+
return !1;
|
|
173
|
+
n = r.to;
|
|
174
|
+
} else if (n = F(t.doc, r.to, 1), n == null)
|
|
175
|
+
return !1;
|
|
176
|
+
return e && e(t.tr.join(n).scrollIntoView()), !0;
|
|
177
|
+
}, ce = (t, e) => {
|
|
178
|
+
let { $from: r, $to: n } = t.selection, o = r.blockRange(n), l = o && A(o);
|
|
179
|
+
return l == null ? !1 : (e && e(t.tr.lift(o, l).scrollIntoView()), !0);
|
|
180
|
+
}, Q = (t, e) => {
|
|
181
|
+
let { $head: r, $anchor: n } = t.selection;
|
|
182
|
+
return !r.parent.type.spec.code || !r.sameParent(n) ? !1 : (e && e(t.tr.insertText(`
|
|
183
|
+
`).scrollIntoView()), !0);
|
|
184
|
+
};
|
|
185
|
+
function j(t) {
|
|
186
|
+
for (let e = 0; e < t.edgeCount; e++) {
|
|
187
|
+
let { type: r } = t.edge(e);
|
|
188
|
+
if (r.isTextblock && !r.hasRequiredAttrs())
|
|
189
|
+
return r;
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const se = (t, e) => {
|
|
194
|
+
let { $head: r, $anchor: n } = t.selection;
|
|
195
|
+
if (!r.parent.type.spec.code || !r.sameParent(n))
|
|
196
|
+
return !1;
|
|
197
|
+
let o = r.node(-1), l = r.indexAfter(-1), i = j(o.contentMatchAt(l));
|
|
198
|
+
if (!i || !o.canReplaceWith(l, l, i))
|
|
199
|
+
return !1;
|
|
200
|
+
if (e) {
|
|
201
|
+
let f = r.after(), c = t.tr.replaceWith(f, f, i.createAndFill());
|
|
202
|
+
c.setSelection(V.near(c.doc.resolve(f), 1)), e(c.scrollIntoView());
|
|
203
|
+
}
|
|
204
|
+
return !0;
|
|
205
|
+
}, X = (t, e) => {
|
|
206
|
+
let r = t.selection, { $from: n, $to: o } = r;
|
|
207
|
+
if (r instanceof P || n.parent.inlineContent || o.parent.inlineContent)
|
|
208
|
+
return !1;
|
|
209
|
+
let l = j(o.parent.contentMatchAt(o.indexAfter()));
|
|
210
|
+
if (!l || !l.isTextblock)
|
|
211
|
+
return !1;
|
|
212
|
+
if (e) {
|
|
213
|
+
let i = (!n.parentOffset && o.index() < o.parent.childCount ? n : o).pos, f = t.tr.insert(i, l.createAndFill());
|
|
214
|
+
f.setSelection(I.create(f.doc, i + 1)), e(f.scrollIntoView());
|
|
215
|
+
}
|
|
216
|
+
return !0;
|
|
217
|
+
}, Y = (t, e) => {
|
|
218
|
+
let { $cursor: r } = t.selection;
|
|
219
|
+
if (!r || r.parent.content.size)
|
|
220
|
+
return !1;
|
|
221
|
+
if (r.depth > 1 && r.after() != r.end(-1)) {
|
|
222
|
+
let l = r.before();
|
|
223
|
+
if (h(t.doc, l))
|
|
224
|
+
return e && e(t.tr.split(l).scrollIntoView()), !0;
|
|
225
|
+
}
|
|
226
|
+
let n = r.blockRange(), o = n && A(n);
|
|
227
|
+
return o == null ? !1 : (e && e(t.tr.lift(n, o).scrollIntoView()), !0);
|
|
228
|
+
};
|
|
229
|
+
function Z(t) {
|
|
230
|
+
return (e, r) => {
|
|
231
|
+
let { $from: n, $to: o } = e.selection;
|
|
232
|
+
if (e.selection instanceof d && e.selection.node.isBlock)
|
|
233
|
+
return !n.parentOffset || !h(e.doc, n.pos) ? !1 : (r && r(e.tr.split(n.pos).scrollIntoView()), !0);
|
|
234
|
+
if (!n.depth)
|
|
235
|
+
return !1;
|
|
236
|
+
let l = [], i, f, c = !1, p = !1;
|
|
237
|
+
for (let u = n.depth; ; u--)
|
|
238
|
+
if (n.node(u).isBlock) {
|
|
239
|
+
c = n.end(u) == n.pos + (n.depth - u), p = n.start(u) == n.pos - (n.depth - u), f = j(n.node(u - 1).contentMatchAt(n.indexAfter(u - 1))), l.unshift(c && f ? { type: f } : null), i = u;
|
|
240
|
+
break;
|
|
241
|
+
} else {
|
|
242
|
+
if (u == 1)
|
|
243
|
+
return !1;
|
|
244
|
+
l.unshift(null);
|
|
245
|
+
}
|
|
246
|
+
let s = e.tr;
|
|
247
|
+
(e.selection instanceof I || e.selection instanceof P) && s.deleteSelection();
|
|
248
|
+
let m = s.mapping.map(n.pos), k = h(s.doc, m, l.length, l);
|
|
249
|
+
if (k || (l[0] = f ? { type: f } : null, k = h(s.doc, m, l.length, l)), !k)
|
|
250
|
+
return !1;
|
|
251
|
+
if (s.split(m, l.length, l), !c && p && n.node(i).type != f) {
|
|
252
|
+
let u = s.mapping.map(n.before(i)), a = s.doc.resolve(u);
|
|
253
|
+
f && n.node(i - 1).canReplaceWith(a.index(), a.index() + 1, f) && s.setNodeMarkup(s.mapping.map(n.before(i)), f);
|
|
254
|
+
}
|
|
255
|
+
return r && r(s.scrollIntoView()), !0;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const _ = Z(), ue = (t, e) => {
|
|
259
|
+
let { $from: r, to: n } = t.selection, o, l = r.sharedDepth(n);
|
|
260
|
+
return l == 0 ? !1 : (o = r.before(l), e && e(t.tr.setSelection(d.create(t.doc, o))), !0);
|
|
261
|
+
};
|
|
262
|
+
function ee(t, e, r) {
|
|
263
|
+
let n = e.nodeBefore, o = e.nodeAfter, l = e.index();
|
|
264
|
+
return !n || !o || !n.type.compatibleContent(o.type) ? !1 : !n.content.size && e.parent.canReplace(l - 1, l) ? (r && r(t.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(l, l + 1) || !(o.isTextblock || T(t.doc, e.pos)) ? !1 : (r && r(t.tr.join(e.pos).scrollIntoView()), !0);
|
|
265
|
+
}
|
|
266
|
+
function D(t, e, r, n) {
|
|
267
|
+
let o = e.nodeBefore, l = e.nodeAfter, i, f, c = o.type.spec.isolating || l.type.spec.isolating;
|
|
268
|
+
if (!c && ee(t, e, r))
|
|
269
|
+
return !0;
|
|
270
|
+
let p = !c && e.parent.canReplace(e.index(), e.index() + 1);
|
|
271
|
+
if (p && (i = (f = o.contentMatchAt(o.childCount)).findWrapping(l.type)) && f.matchType(i[0] || l.type).validEnd) {
|
|
272
|
+
if (r) {
|
|
273
|
+
let u = e.pos + l.nodeSize, a = S.empty;
|
|
274
|
+
for (let w = i.length - 1; w >= 0; w--)
|
|
275
|
+
a = S.from(i[w].create(null, a));
|
|
276
|
+
a = S.from(o.copy(a));
|
|
277
|
+
let b = t.tr.step(new v(e.pos - 1, u, e.pos, u, new y(a, 1, 0), i.length, !0)), g = b.doc.resolve(u + 2 * i.length);
|
|
278
|
+
g.nodeAfter && g.nodeAfter.type == o.type && T(b.doc, g.pos) && b.join(g.pos), r(b.scrollIntoView());
|
|
279
|
+
}
|
|
280
|
+
return !0;
|
|
281
|
+
}
|
|
282
|
+
let s = l.type.spec.isolating || n > 0 && c ? null : V.findFrom(e, 1), m = s && s.$from.blockRange(s.$to), k = m && A(m);
|
|
283
|
+
if (k != null && k >= e.depth)
|
|
284
|
+
return r && r(t.tr.lift(m, k).scrollIntoView()), !0;
|
|
285
|
+
if (p && x(l, "start", !0) && x(o, "end")) {
|
|
286
|
+
let u = o, a = [];
|
|
287
|
+
for (; a.push(u), !u.isTextblock; )
|
|
288
|
+
u = u.lastChild;
|
|
289
|
+
let b = l, g = 1;
|
|
290
|
+
for (; !b.isTextblock; b = b.firstChild)
|
|
291
|
+
g++;
|
|
292
|
+
if (u.canReplace(u.childCount, u.childCount, b.content)) {
|
|
293
|
+
if (r) {
|
|
294
|
+
let w = S.empty;
|
|
295
|
+
for (let C = a.length - 1; C >= 0; C--)
|
|
296
|
+
w = S.from(a[C].copy(w));
|
|
297
|
+
let q = t.tr.step(new v(e.pos - a.length, e.pos + l.nodeSize, e.pos + g, e.pos + l.nodeSize - g, new y(w, a.length, 0), 0, !0));
|
|
298
|
+
r(q.scrollIntoView());
|
|
299
|
+
}
|
|
300
|
+
return !0;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return !1;
|
|
304
|
+
}
|
|
305
|
+
function $(t) {
|
|
306
|
+
return function(e, r) {
|
|
307
|
+
let n = e.selection, o = t < 0 ? n.$from : n.$to, l = o.depth;
|
|
308
|
+
for (; o.node(l).isInline; ) {
|
|
309
|
+
if (!l)
|
|
310
|
+
return !1;
|
|
311
|
+
l--;
|
|
312
|
+
}
|
|
313
|
+
return o.node(l).isTextblock ? (r && r(e.tr.setSelection(I.create(e.doc, t < 0 ? o.start(l) : o.end(l)))), !0) : !1;
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
const ae = $(-1), pe = $(1);
|
|
317
|
+
function de(t, e = null) {
|
|
318
|
+
return function(r, n) {
|
|
319
|
+
let { $from: o, $to: l } = r.selection, i = o.blockRange(l), f = i && J(i, t, e);
|
|
320
|
+
return f ? (n && n(r.tr.wrap(i, f).scrollIntoView()), !0) : !1;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function me(t, e = null) {
|
|
324
|
+
return function(r, n) {
|
|
325
|
+
let o = !1;
|
|
326
|
+
for (let l = 0; l < r.selection.ranges.length && !o; l++) {
|
|
327
|
+
let { $from: { pos: i }, $to: { pos: f } } = r.selection.ranges[l];
|
|
328
|
+
r.doc.nodesBetween(i, f, (c, p) => {
|
|
329
|
+
if (o)
|
|
330
|
+
return !1;
|
|
331
|
+
if (!(!c.isTextblock || c.hasMarkup(t, e)))
|
|
332
|
+
if (c.type == t)
|
|
333
|
+
o = !0;
|
|
334
|
+
else {
|
|
335
|
+
let s = r.doc.resolve(p), m = s.index();
|
|
336
|
+
o = s.parent.canReplaceWith(m, m + 1, t);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if (!o)
|
|
341
|
+
return !1;
|
|
342
|
+
if (n) {
|
|
343
|
+
let l = r.tr;
|
|
344
|
+
for (let i = 0; i < r.selection.ranges.length; i++) {
|
|
345
|
+
let { $from: { pos: f }, $to: { pos: c } } = r.selection.ranges[i];
|
|
346
|
+
l.setBlockType(f, c, t, e);
|
|
347
|
+
}
|
|
348
|
+
n(l.scrollIntoView());
|
|
349
|
+
}
|
|
350
|
+
return !0;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function O(...t) {
|
|
354
|
+
return function(e, r, n) {
|
|
355
|
+
for (let o = 0; o < t.length; o++)
|
|
356
|
+
if (t[o](e, r, n))
|
|
357
|
+
return !0;
|
|
358
|
+
return !1;
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
O(M, G, H);
|
|
362
|
+
O(M, K, L);
|
|
363
|
+
O(Q, X, Y, _);
|
|
364
|
+
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
|
|
365
|
+
export {
|
|
366
|
+
O as chainCommands,
|
|
367
|
+
X as createParagraphNear,
|
|
368
|
+
M as deleteSelection,
|
|
369
|
+
se as exitCode,
|
|
370
|
+
G as joinBackward,
|
|
371
|
+
fe as joinDown,
|
|
372
|
+
K as joinForward,
|
|
373
|
+
oe as joinTextblockBackward,
|
|
374
|
+
le as joinTextblockForward,
|
|
375
|
+
ie as joinUp,
|
|
376
|
+
ce as lift,
|
|
377
|
+
Y as liftEmptyBlock,
|
|
378
|
+
Q as newlineInCode,
|
|
379
|
+
H as selectNodeBackward,
|
|
380
|
+
L as selectNodeForward,
|
|
381
|
+
ue as selectParentNode,
|
|
382
|
+
pe as selectTextblockEnd,
|
|
383
|
+
ae as selectTextblockStart,
|
|
384
|
+
me as setBlockType,
|
|
385
|
+
_ as splitBlock,
|
|
386
|
+
Z as splitBlockAs,
|
|
387
|
+
de as wrapIn
|
|
388
|
+
};
|