@lunejs/admin-ui 0.1.5 → 0.2.1

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 (115) hide show
  1. package/dist/_virtual/index10.js +5 -2
  2. package/dist/_virtual/index11.js +4 -0
  3. package/dist/_virtual/index6.js +3 -3
  4. package/dist/_virtual/index8.js +3 -5
  5. package/dist/lib/api/codegen/graphql.d.ts +1 -0
  6. package/dist/lib/api/codegen/graphql.js +8 -8
  7. package/dist/lib/collections/components/collection-details/cards/general-card.js +20 -14
  8. package/dist/lib/custom-fields/components/details/is-list/custom-field-is-list.js +6 -4
  9. package/dist/lib/custom-fields/components/details/use-form/form-schema.d.ts +1 -0
  10. package/dist/lib/custom-fields/components/details/use-form/form-schema.js +4 -3
  11. package/dist/lib/custom-fields/components/fields/color.js +3 -3
  12. package/dist/lib/custom-fields/components/fields/custom-field.js +44 -36
  13. package/dist/lib/custom-fields/components/fields/rich-text.d.ts +8 -0
  14. package/dist/lib/custom-fields/components/fields/rich-text.js +17 -0
  15. package/dist/lib/custom-fields/components/fields/shared/primitive.d.ts +2 -1
  16. package/dist/lib/custom-fields/components/fields/shared/primitive.js +67 -61
  17. package/dist/lib/custom-fields/utils/custom-field.utils.js +63 -51
  18. package/dist/lib/dashboard/pages/dashboard-page.js +5 -5
  19. package/dist/lib/product/components/product-details/cards/general-product-card.js +18 -12
  20. package/dist/lib/translate/components/form/translate-form-row-data.d.ts +2 -1
  21. package/dist/lib/translate/components/form/translate-form-row-data.js +51 -19
  22. package/dist/lib/translate/components/form/translate-rich-text.d.ts +8 -0
  23. package/dist/lib/translate/components/form/translate-rich-text.js +65 -0
  24. package/dist/lib/translate/components/product-form/custom-fields/translate-product-custom-fields.js +95 -63
  25. package/dist/lib/translate/components/product-form/translate-product-form.js +19 -18
  26. package/dist/node_modules/@tiptap/core/dist/index.js +3566 -0
  27. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +17 -0
  28. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +80 -0
  29. package/dist/node_modules/@tiptap/extension-document/dist/index.js +13 -0
  30. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +64 -0
  31. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +78 -0
  32. package/dist/node_modules/@tiptap/extension-link/dist/index.js +305 -0
  33. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  34. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +42 -0
  35. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  36. package/dist/node_modules/@tiptap/extension-text/dist/index.js +14 -0
  37. package/dist/node_modules/@tiptap/extension-text-style/dist/index.js +240 -0
  38. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +66 -0
  39. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  40. package/dist/node_modules/@tiptap/react/dist/index.js +482 -0
  41. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
  42. package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
  43. package/dist/node_modules/eventemitter3/index.js +1 -1
  44. package/dist/node_modules/eventemitter3/index2.js +1 -1
  45. package/dist/node_modules/fast-equals/dist/es/index.js +324 -0
  46. package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
  47. package/dist/node_modules/lucide-react/dist/esm/icons/baseline.js +10 -0
  48. package/dist/node_modules/lucide-react/dist/esm/icons/between-horizontal-end.js +10 -0
  49. package/dist/node_modules/lucide-react/dist/esm/icons/between-vertical-end.js +10 -0
  50. package/dist/node_modules/lucide-react/dist/esm/icons/bold.js +11 -0
  51. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-plus.js +16 -0
  52. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-x.js +16 -0
  53. package/dist/node_modules/lucide-react/dist/esm/icons/italic.js +10 -0
  54. package/dist/node_modules/lucide-react/dist/esm/icons/layout-list.js +13 -0
  55. package/dist/node_modules/lucide-react/dist/esm/icons/link.js +9 -0
  56. package/dist/node_modules/lucide-react/dist/esm/icons/list-ordered.js +13 -0
  57. package/dist/node_modules/lucide-react/dist/esm/icons/table-columns-split.js +18 -0
  58. package/dist/node_modules/lucide-react/dist/esm/icons/table-rows-split.js +18 -0
  59. package/dist/node_modules/lucide-react/dist/esm/icons/table.js +11 -0
  60. package/dist/node_modules/lucide-react/dist/esm/icons/underline.js +9 -0
  61. package/dist/node_modules/orderedmap/dist/index.js +103 -0
  62. package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
  63. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
  64. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
  65. package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
  66. package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
  67. package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
  68. package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
  69. package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
  70. package/dist/node_modules/prosemirror-tables/dist/index.js +1446 -0
  71. package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
  72. package/dist/node_modules/prosemirror-view/dist/index.js +3772 -0
  73. package/dist/node_modules/react-is/index.js +1 -1
  74. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  75. package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
  76. package/dist/node_modules/rope-sequence/dist/index.js +100 -0
  77. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  78. package/dist/node_modules/w3c-keyname/index.js +93 -0
  79. package/dist/packages/lune-ui/dist/_virtual/index3.js +2 -5
  80. package/dist/packages/lune-ui/dist/_virtual/index6.js +5 -2
  81. package/dist/packages/lune-ui/dist/components/popover.js +15 -11
  82. package/dist/packages/lune-ui/dist/components/select.js +6 -6
  83. package/dist/packages/lune-ui/dist/form/form-date-picker.js +2 -2
  84. package/dist/packages/lune-ui/dist/form/form.js +4 -4
  85. package/dist/packages/lune-ui/dist/node_modules/@radix-ui/react-popover/dist/index.js +39 -38
  86. package/dist/packages/lune-ui/dist/node_modules/prop-types/index.js +1 -1
  87. package/dist/packages/lune-ui/dist/packages/lune-ui/node_modules/recharts/es6/util/Events.js +1 -1
  88. package/dist/shared/components/color-picker/color-picker.d.ts +2 -1
  89. package/dist/shared/components/color-picker/color-picker.js +11 -11
  90. package/dist/shared/components/data-table/data-table-filter.js +4 -4
  91. package/dist/shared/components/rich-editor/rich-editor.d.ts +8 -0
  92. package/dist/shared/components/rich-editor/rich-editor.js +97 -0
  93. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.d.ts +1 -0
  94. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +66 -0
  95. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.d.ts +1 -0
  96. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +66 -0
  97. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.d.ts +1 -0
  98. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +115 -0
  99. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.d.ts +1 -0
  100. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +66 -0
  101. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.d.ts +2 -0
  102. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.js +103 -0
  103. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.d.ts +1 -0
  104. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +64 -0
  105. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  106. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +66 -0
  107. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.d.ts +1 -0
  108. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +108 -0
  109. package/dist/shared/components/rich-editor/toolbar/toolbar.d.ts +1 -0
  110. package/dist/shared/components/rich-editor/toolbar/toolbar.js +64 -0
  111. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  112. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +66 -0
  113. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.d.ts +1 -0
  114. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +66 -0
  115. package/package.json +6 -1
@@ -0,0 +1,66 @@
1
+ import { Mark as d, mergeAttributes as a } from "../../core/dist/index.js";
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;
63
+ export {
64
+ s as Underline,
65
+ l as default
66
+ };
@@ -0,0 +1,288 @@
1
+ import { Extension as u, callOrReturn as w, getExtensionField as S, isNodeEmpty as P, isNodeSelection as v } from "../../core/dist/index.js";
2
+ import { Plugin as p, PluginKey as m } from "../../../prosemirror-state/dist/index.js";
3
+ import { dropCursor as z } from "../../../prosemirror-dropcursor/dist/index.js";
4
+ import { DecorationSet as f, Decoration as g } from "../../../prosemirror-view/dist/index.js";
5
+ import { gapCursor as N } from "../../../prosemirror-gapcursor/dist/index.js";
6
+ import { history as E, redo as M, undo as O } from "../../../prosemirror-history/dist/index.js";
7
+ u.create({
8
+ name: "characterCount",
9
+ addOptions() {
10
+ return {
11
+ limit: null,
12
+ mode: "textSize",
13
+ textCounter: (e) => e.length,
14
+ wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
15
+ };
16
+ },
17
+ addStorage() {
18
+ return {
19
+ characters: () => 0,
20
+ words: () => 0
21
+ };
22
+ },
23
+ onBeforeCreate() {
24
+ this.storage.characters = (e) => {
25
+ const t = e?.node || this.editor.state.doc;
26
+ if ((e?.mode || this.options.mode) === "textSize") {
27
+ const r = t.textBetween(0, t.content.size, void 0, " ");
28
+ return this.options.textCounter(r);
29
+ }
30
+ return t.nodeSize;
31
+ }, this.storage.words = (e) => {
32
+ const t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
33
+ return this.options.wordCounter(n);
34
+ };
35
+ },
36
+ addProseMirrorPlugins() {
37
+ let e = !1;
38
+ return [
39
+ new p({
40
+ key: new m("characterCount"),
41
+ appendTransaction: (t, n, r) => {
42
+ if (e)
43
+ return;
44
+ const o = this.options.limit;
45
+ if (o == null || o === 0) {
46
+ e = !0;
47
+ return;
48
+ }
49
+ const s = this.storage.characters({ node: r.doc });
50
+ if (s > o) {
51
+ const i = s - o, d = 0, a = i;
52
+ console.warn(
53
+ `[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`
54
+ );
55
+ const c = r.tr.deleteRange(d, a);
56
+ return e = !0, c;
57
+ }
58
+ e = !0;
59
+ },
60
+ filterTransaction: (t, n) => {
61
+ const r = this.options.limit;
62
+ if (!t.docChanged || r === 0 || r === null || r === void 0)
63
+ return !0;
64
+ const o = this.storage.characters({ node: n.doc }), s = this.storage.characters({ node: t.doc });
65
+ if (s <= r || o > r && s > r && s <= o)
66
+ return !0;
67
+ if (o > r && s > r && s > o || !t.getMeta("paste"))
68
+ return !1;
69
+ const d = t.selection.$head.pos, a = s - r, c = d - a, l = d;
70
+ return t.deleteRange(c, l), !(this.storage.characters({ node: t.doc }) > r);
71
+ }
72
+ })
73
+ ];
74
+ }
75
+ });
76
+ u.create({
77
+ name: "dropCursor",
78
+ addOptions() {
79
+ return {
80
+ color: "currentColor",
81
+ width: 1,
82
+ class: void 0
83
+ };
84
+ },
85
+ addProseMirrorPlugins() {
86
+ return [z(this.options)];
87
+ }
88
+ });
89
+ u.create({
90
+ name: "focus",
91
+ addOptions() {
92
+ return {
93
+ className: "has-focus",
94
+ mode: "all"
95
+ };
96
+ },
97
+ addProseMirrorPlugins() {
98
+ return [
99
+ new p({
100
+ key: new m("focus"),
101
+ props: {
102
+ decorations: ({ doc: e, selection: t }) => {
103
+ const { isEditable: n, isFocused: r } = this.editor, { anchor: o } = t, s = [];
104
+ if (!n || !r)
105
+ return f.create(e, []);
106
+ let i = 0;
107
+ this.options.mode === "deepest" && e.descendants((a, c) => {
108
+ if (a.isText)
109
+ return;
110
+ if (!(o >= c && o <= c + a.nodeSize - 1))
111
+ return !1;
112
+ i += 1;
113
+ });
114
+ let d = 0;
115
+ return e.descendants((a, c) => {
116
+ if (a.isText || !(o >= c && o <= c + a.nodeSize - 1))
117
+ return !1;
118
+ if (d += 1, this.options.mode === "deepest" && i - d > 0 || this.options.mode === "shallowest" && d > 1)
119
+ return this.options.mode === "deepest";
120
+ s.push(
121
+ g.node(c, c + a.nodeSize, {
122
+ class: this.options.className
123
+ })
124
+ );
125
+ }), f.create(e, s);
126
+ }
127
+ }
128
+ })
129
+ ];
130
+ }
131
+ });
132
+ u.create({
133
+ name: "gapCursor",
134
+ addProseMirrorPlugins() {
135
+ return [N()];
136
+ },
137
+ extendNodeSchema(e) {
138
+ var t;
139
+ const n = {
140
+ name: e.name,
141
+ options: e.options,
142
+ storage: e.storage
143
+ };
144
+ return {
145
+ allowGapCursor: (t = w(S(e, "allowGapCursor", n))) != null ? t : null
146
+ };
147
+ }
148
+ });
149
+ u.create({
150
+ name: "placeholder",
151
+ addOptions() {
152
+ return {
153
+ emptyEditorClass: "is-editor-empty",
154
+ emptyNodeClass: "is-empty",
155
+ placeholder: "Write something …",
156
+ showOnlyWhenEditable: !0,
157
+ showOnlyCurrent: !0,
158
+ includeChildren: !1
159
+ };
160
+ },
161
+ addProseMirrorPlugins() {
162
+ return [
163
+ new p({
164
+ key: new m("placeholder"),
165
+ props: {
166
+ decorations: ({ doc: e, selection: t }) => {
167
+ const n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, o = [];
168
+ if (!n)
169
+ return null;
170
+ const s = this.editor.isEmpty;
171
+ return e.descendants((i, d) => {
172
+ const a = r >= d && r <= d + i.nodeSize, c = !i.isLeaf && P(i);
173
+ if ((a || !this.options.showOnlyCurrent) && c) {
174
+ const l = [this.options.emptyNodeClass];
175
+ s && l.push(this.options.emptyEditorClass);
176
+ const h = g.node(d, d + i.nodeSize, {
177
+ class: l.join(" "),
178
+ "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
179
+ editor: this.editor,
180
+ node: i,
181
+ pos: d,
182
+ hasAnchor: a
183
+ }) : this.options.placeholder
184
+ });
185
+ o.push(h);
186
+ }
187
+ return this.options.includeChildren;
188
+ }), f.create(e, o);
189
+ }
190
+ }
191
+ })
192
+ ];
193
+ }
194
+ });
195
+ u.create({
196
+ name: "selection",
197
+ addOptions() {
198
+ return {
199
+ className: "selection"
200
+ };
201
+ },
202
+ addProseMirrorPlugins() {
203
+ const { editor: e, options: t } = this;
204
+ return [
205
+ new p({
206
+ key: new m("selection"),
207
+ props: {
208
+ decorations(n) {
209
+ return n.selection.empty || e.isFocused || !e.isEditable || v(n.selection) || e.view.dragging ? null : f.create(n.doc, [
210
+ g.inline(n.selection.from, n.selection.to, {
211
+ class: t.className
212
+ })
213
+ ]);
214
+ }
215
+ }
216
+ })
217
+ ];
218
+ }
219
+ });
220
+ function y({ types: e, node: t }) {
221
+ return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
222
+ }
223
+ var k = u.create({
224
+ name: "trailingNode",
225
+ addOptions() {
226
+ return {
227
+ node: void 0,
228
+ notAfter: []
229
+ };
230
+ },
231
+ addProseMirrorPlugins() {
232
+ var e;
233
+ const t = new m(this.name), n = this.options.node || ((e = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : e.name) || "paragraph", r = Object.entries(this.editor.schema.nodes).map(([, o]) => o).filter((o) => (this.options.notAfter || []).concat(n).includes(o.name));
234
+ return [
235
+ new p({
236
+ key: t,
237
+ appendTransaction: (o, s, i) => {
238
+ const { doc: d, tr: a, schema: c } = i, l = t.getState(i), h = d.content.size, C = c.nodes[n];
239
+ if (l)
240
+ return a.insert(h, C.create());
241
+ },
242
+ state: {
243
+ init: (o, s) => {
244
+ const i = s.tr.doc.lastChild;
245
+ return !y({ node: i, types: r });
246
+ },
247
+ apply: (o, s) => {
248
+ if (!o.docChanged || o.getMeta("__uniqueIDTransaction"))
249
+ return s;
250
+ const i = o.doc.lastChild;
251
+ return !y({ node: i, types: r });
252
+ }
253
+ }
254
+ })
255
+ ];
256
+ }
257
+ });
258
+ u.create({
259
+ name: "undoRedo",
260
+ addOptions() {
261
+ return {
262
+ depth: 100,
263
+ newGroupDelay: 500
264
+ };
265
+ },
266
+ addCommands() {
267
+ return {
268
+ undo: () => ({ state: e, dispatch: t }) => O(e, t),
269
+ redo: () => ({ state: e, dispatch: t }) => M(e, t)
270
+ };
271
+ },
272
+ addProseMirrorPlugins() {
273
+ return [E(this.options)];
274
+ },
275
+ addKeyboardShortcuts() {
276
+ return {
277
+ "Mod-z": () => this.editor.commands.undo(),
278
+ "Shift-Mod-z": () => this.editor.commands.redo(),
279
+ "Mod-y": () => this.editor.commands.redo(),
280
+ // Russian keyboard layouts
281
+ "Mod-я": () => this.editor.commands.undo(),
282
+ "Shift-Mod-я": () => this.editor.commands.redo()
283
+ };
284
+ }
285
+ });
286
+ export {
287
+ k as TrailingNode
288
+ };