@lunejs/admin-ui 0.2.0 → 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 (39) hide show
  1. package/dist/lib/api/codegen/graphql.d.ts +1 -0
  2. package/dist/lib/api/codegen/graphql.js +8 -8
  3. package/dist/lib/custom-fields/components/details/is-list/custom-field-is-list.js +6 -4
  4. package/dist/lib/custom-fields/components/details/use-form/form-schema.d.ts +1 -0
  5. package/dist/lib/custom-fields/components/details/use-form/form-schema.js +4 -3
  6. package/dist/lib/custom-fields/components/fields/custom-field.js +44 -36
  7. package/dist/lib/custom-fields/components/fields/rich-text.d.ts +8 -0
  8. package/dist/lib/custom-fields/components/fields/rich-text.js +17 -0
  9. package/dist/lib/custom-fields/components/fields/shared/primitive.d.ts +2 -1
  10. package/dist/lib/custom-fields/components/fields/shared/primitive.js +67 -61
  11. package/dist/lib/custom-fields/utils/custom-field.utils.js +63 -51
  12. package/dist/lib/translate/components/form/translate-form-row-data.d.ts +2 -1
  13. package/dist/lib/translate/components/form/translate-form-row-data.js +51 -19
  14. package/dist/lib/translate/components/form/translate-rich-text.d.ts +8 -0
  15. package/dist/lib/translate/components/form/translate-rich-text.js +65 -0
  16. package/dist/lib/translate/components/product-form/custom-fields/translate-product-custom-fields.js +95 -63
  17. package/dist/lib/translate/components/product-form/translate-product-form.js +19 -18
  18. package/dist/node_modules/@tiptap/core/dist/index.js +876 -872
  19. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  20. package/dist/node_modules/@tiptap/react/dist/index.js +35 -34
  21. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
  22. package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
  23. package/dist/node_modules/lucide-react/dist/esm/icons/layout-list.js +13 -0
  24. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
  25. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
  26. package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
  27. package/dist/node_modules/rope-sequence/dist/index.js +100 -0
  28. package/dist/shared/components/rich-editor/rich-editor.d.ts +3 -1
  29. package/dist/shared/components/rich-editor/rich-editor.js +40 -36
  30. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +10 -9
  31. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +1 -0
  32. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +1 -0
  33. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +5 -4
  34. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +8 -7
  35. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +1 -0
  36. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +9 -8
  37. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +7 -6
  38. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +3 -2
  39. package/package.json +1 -1
@@ -32,23 +32,24 @@ import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-toggle
32
32
  import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
33
33
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
34
34
  import "../../../../../packages/lune-ui/dist/form/form.js";
35
- import { useCurrentEditor as n, useEditorState as s } from "../../../../../node_modules/@tiptap/react/dist/index.js";
36
- import c from "../../../../../node_modules/lucide-react/dist/esm/icons/bold.js";
35
+ import { useCurrentEditor as s, useEditorState as n } from "../../../../../node_modules/@tiptap/react/dist/index.js";
36
+ import d from "../../../../../node_modules/lucide-react/dist/esm/icons/bold.js";
37
37
  const U = () => {
38
- const { editor: o } = n(), i = s({
39
- editor: o,
40
- selector({ editor: t }) {
41
- if (t)
38
+ const { editor: t } = s(), i = n({
39
+ editor: t,
40
+ selector({ editor: o }) {
41
+ if (o)
42
42
  return {
43
- isBoldActive: t.isActive("bold")
43
+ isBoldActive: o.isActive("bold")
44
44
  };
45
45
  }
46
46
  }), m = () => {
47
- o?.commands.toggleBold();
47
+ t?.commands.toggleBold();
48
48
  };
49
49
  return /* @__PURE__ */ r(
50
50
  e,
51
51
  {
52
+ disabled: !t?.isEditable,
52
53
  type: "button",
53
54
  variant: "ghost",
54
55
  className: p(
@@ -56,7 +57,7 @@ const U = () => {
56
57
  i?.isBoldActive && "bg-input/75! hover:bg-input/75!"
57
58
  ),
58
59
  onClick: m,
59
- children: /* @__PURE__ */ r(c, {})
60
+ children: /* @__PURE__ */ r(d, {})
60
61
  }
61
62
  );
62
63
  };
@@ -50,6 +50,7 @@ const W = () => {
50
50
  }, onOpenChange: (o) => t?.setEditable(!o), children: /* @__PURE__ */ r(
51
51
  p,
52
52
  {
53
+ disabled: !t?.isEditable,
53
54
  type: "button",
54
55
  variant: "ghost",
55
56
  className: m(
@@ -53,6 +53,7 @@ const ee = () => {
53
53
  /* @__PURE__ */ r(p, { asChild: !0, children: /* @__PURE__ */ i(
54
54
  m,
55
55
  {
56
+ disabled: !e?.isEditable,
56
57
  type: "button",
57
58
  variant: "ghost",
58
59
  size: "sm",
@@ -32,10 +32,10 @@ import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-toggle
32
32
  import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
33
33
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
34
34
  import "../../../../../packages/lune-ui/dist/form/form.js";
35
- import { useCurrentEditor as c, useEditorState as n } from "../../../../../node_modules/@tiptap/react/dist/index.js";
36
- import s from "../../../../../node_modules/lucide-react/dist/esm/icons/italic.js";
35
+ import { useCurrentEditor as c, useEditorState as s } from "../../../../../node_modules/@tiptap/react/dist/index.js";
36
+ import a from "../../../../../node_modules/lucide-react/dist/esm/icons/italic.js";
37
37
  const U = () => {
38
- const { editor: t } = c(), r = n({
38
+ const { editor: t } = c(), r = s({
39
39
  editor: t,
40
40
  selector({ editor: i }) {
41
41
  if (i)
@@ -49,6 +49,7 @@ const U = () => {
49
49
  return /* @__PURE__ */ o(
50
50
  e,
51
51
  {
52
+ disabled: !t?.isEditable,
52
53
  type: "button",
53
54
  variant: "ghost",
54
55
  className: p(
@@ -56,7 +57,7 @@ const U = () => {
56
57
  r?.isItalicActive && "bg-input/75! hover:bg-input/75!"
57
58
  ),
58
59
  onClick: m,
59
- children: /* @__PURE__ */ o(s, {})
60
+ children: /* @__PURE__ */ o(a, {})
60
61
  }
61
62
  );
62
63
  };
@@ -20,7 +20,7 @@ import "../../../../../packages/lune-ui/dist/components/dialog.js";
20
20
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js";
21
21
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-label/dist/index.js";
22
22
  import "../../../../../packages/lune-ui/dist/components/phone-input.js";
23
- import { Popover as n, PopoverTrigger as s, PopoverContent as a } from "../../../../../packages/lune-ui/dist/components/popover.js";
23
+ import { Popover as s, PopoverTrigger as n, PopoverContent as a } from "../../../../../packages/lune-ui/dist/components/popover.js";
24
24
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-radio-group/dist/index.js";
25
25
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-select/dist/index.js";
26
26
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-dialog/dist/index.js";
@@ -36,21 +36,22 @@ import { useCurrentEditor as c, useEditorState as d } from "../../../../../node_
36
36
  import { RickEditorToolbarLinkForm as l } from "./rich-editor-toolbar-link-form.js";
37
37
  import u from "../../../../../node_modules/lucide-react/dist/esm/icons/link.js";
38
38
  const Z = () => {
39
- const { editor: r } = c(), t = d({
39
+ const { editor: r } = c(), i = d({
40
40
  editor: r,
41
- selector: (i) => ({
42
- isLink: i.editor?.isActive("link")
41
+ selector: (t) => ({
42
+ isLink: t.editor?.isActive("link")
43
43
  })
44
44
  });
45
- return /* @__PURE__ */ m(n, { children: [
46
- /* @__PURE__ */ o(s, { asChild: !0, children: /* @__PURE__ */ o(
45
+ return /* @__PURE__ */ m(s, { children: [
46
+ /* @__PURE__ */ o(n, { asChild: !0, children: /* @__PURE__ */ o(
47
47
  e,
48
48
  {
49
+ disabled: !r?.isEditable,
49
50
  type: "button",
50
51
  variant: "ghost",
51
52
  className: p(
52
53
  "size-8! hover:bg-input/30!",
53
- t?.isLink && "bg-input/75! hover:bg-input/75!"
54
+ i?.isLink && "bg-input/75! hover:bg-input/75!"
54
55
  ),
55
56
  children: /* @__PURE__ */ o(u, {})
56
57
  }
@@ -49,6 +49,7 @@ const Q = () => {
49
49
  return /* @__PURE__ */ o(
50
50
  s,
51
51
  {
52
+ disabled: !t?.isEditable,
52
53
  type: "button",
53
54
  variant: "ghost",
54
55
  className: p(
@@ -33,8 +33,8 @@ import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
33
33
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
34
34
  import "../../../../../packages/lune-ui/dist/form/form.js";
35
35
  import { useCurrentEditor as w } from "../../../../../node_modules/@tiptap/react/dist/index.js";
36
- import C from "../../../../../node_modules/lucide-react/dist/esm/icons/table.js";
37
- import b from "../../../../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
36
+ import b from "../../../../../node_modules/lucide-react/dist/esm/icons/table.js";
37
+ import C from "../../../../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
38
38
  import T from "../../../../../node_modules/lucide-react/dist/esm/icons/grid-2x2-plus.js";
39
39
  import R from "../../../../../node_modules/lucide-react/dist/esm/icons/between-horizontal-end.js";
40
40
  import v from "../../../../../node_modules/lucide-react/dist/esm/icons/between-vertical-end.js";
@@ -50,15 +50,16 @@ const ho = () => {
50
50
  t?.chain().focus().deleteColumn().run();
51
51
  }, l = () => {
52
52
  t?.chain().focus().deleteRow().run();
53
- }, c = () => {
54
- t?.chain().focus().addRowAfter().run();
55
53
  }, a = () => {
54
+ t?.chain().focus().addRowAfter().run();
55
+ }, c = () => {
56
56
  t?.chain().focus().deleteTable().run();
57
57
  };
58
58
  return /* @__PURE__ */ r(u, { children: [
59
59
  /* @__PURE__ */ o(f, { asChild: !0, children: /* @__PURE__ */ r(
60
60
  d,
61
61
  {
62
+ disabled: !t?.isEditable,
62
63
  type: "button",
63
64
  variant: "ghost",
64
65
  size: "icon",
@@ -67,8 +68,8 @@ const ho = () => {
67
68
  !1
68
69
  ),
69
70
  children: [
70
- /* @__PURE__ */ o(C, {}),
71
- /* @__PURE__ */ o(b, {})
71
+ /* @__PURE__ */ o(b, {}),
72
+ /* @__PURE__ */ o(C, {})
72
73
  ]
73
74
  }
74
75
  ) }),
@@ -78,7 +79,7 @@ const ho = () => {
78
79
  "Insert table"
79
80
  ] }),
80
81
  /* @__PURE__ */ o(e, {}),
81
- /* @__PURE__ */ r(i, { onClick: c, children: [
82
+ /* @__PURE__ */ r(i, { onClick: a, children: [
82
83
  /* @__PURE__ */ o(R, {}),
83
84
  "Insert row"
84
85
  ] }),
@@ -95,7 +96,7 @@ const ho = () => {
95
96
  /* @__PURE__ */ o(g, {}),
96
97
  "Remove column"
97
98
  ] }),
98
- /* @__PURE__ */ r(i, { onClick: a, children: [
99
+ /* @__PURE__ */ r(i, { onClick: c, children: [
99
100
  /* @__PURE__ */ o(D, {}),
100
101
  "Remove table"
101
102
  ] })
@@ -1,4 +1,4 @@
1
- import { jsx as o } from "react/jsx-runtime";
1
+ import { jsx as i } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-accordion/dist/index.js";
4
4
  import { cn as p } from "../../../../../packages/lune-ui/dist/lib/utils.js";
@@ -33,9 +33,9 @@ import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
33
33
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
34
34
  import "../../../../../packages/lune-ui/dist/form/form.js";
35
35
  import { useCurrentEditor as s, useEditorState as n } from "../../../../../node_modules/@tiptap/react/dist/index.js";
36
- import c from "../../../../../node_modules/lucide-react/dist/esm/icons/list-ordered.js";
36
+ import d from "../../../../../node_modules/lucide-react/dist/esm/icons/list-ordered.js";
37
37
  const U = () => {
38
- const { editor: t } = s(), i = n({
38
+ const { editor: t } = s(), o = n({
39
39
  editor: t,
40
40
  selector({ editor: r }) {
41
41
  if (r)
@@ -46,17 +46,18 @@ const U = () => {
46
46
  }), m = () => {
47
47
  t?.commands.toggleOrderedList();
48
48
  };
49
- return /* @__PURE__ */ o(
49
+ return /* @__PURE__ */ i(
50
50
  e,
51
51
  {
52
+ disabled: !t?.isEditable,
52
53
  type: "button",
53
54
  variant: "ghost",
54
55
  className: p(
55
56
  "size-8! hover:bg-input/30!",
56
- i?.isListActive && "bg-input/75! hover:bg-input/75!"
57
+ o?.isListActive && "bg-input/75! hover:bg-input/75!"
57
58
  ),
58
59
  onClick: m,
59
- children: /* @__PURE__ */ o(c, {})
60
+ children: /* @__PURE__ */ i(d, {})
60
61
  }
61
62
  );
62
63
  };
@@ -33,7 +33,7 @@ import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
33
33
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
34
34
  import "../../../../../packages/lune-ui/dist/form/form.js";
35
35
  import { useCurrentEditor as n, useEditorState as s } from "../../../../../node_modules/@tiptap/react/dist/index.js";
36
- import c from "../../../../../node_modules/lucide-react/dist/esm/icons/underline.js";
36
+ import l from "../../../../../node_modules/lucide-react/dist/esm/icons/underline.js";
37
37
  const Q = () => {
38
38
  const { editor: t } = n(), o = s({
39
39
  editor: t,
@@ -49,6 +49,7 @@ const Q = () => {
49
49
  return /* @__PURE__ */ i(
50
50
  e,
51
51
  {
52
+ disabled: !t?.isEditable,
52
53
  type: "button",
53
54
  variant: "ghost",
54
55
  className: p(
@@ -56,7 +57,7 @@ const Q = () => {
56
57
  o?.isUnderlineActive && "bg-input/75! hover:bg-input/75!"
57
58
  ),
58
59
  onClick: m,
59
- children: /* @__PURE__ */ i(c, {})
60
+ children: /* @__PURE__ */ i(l, {})
60
61
  }
61
62
  );
62
63
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@lunejs/admin-ui",
3
3
  "description": "Admin UI for Lune",
4
4
  "license": "AGPL-3.0",
5
- "version": "0.2.0",
5
+ "version": "0.2.1",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"