musae 0.5.8 → 0.5.9

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.
@@ -57,8 +57,8 @@ var styles = {
57
57
  borderBottomLeftRadius: null,
58
58
  borderBottomRightRadius: null,
59
59
  pointerEvents: "musaex-67bb7w",
60
- willChange: "musaex-1enemt",
61
- transitionProperty: "musaex-qzan4j",
60
+ willChange: "musaex-1larqbn",
61
+ transitionProperty: "musaex-19991ni",
62
62
  transitionDuration: "musaex-1g2r6go",
63
63
  display: "musaex-1s85apg",
64
64
  opacity: "musaex-g01cxk",
@@ -55,8 +55,8 @@ var styles = {
55
55
  borderBottomLeftRadius: null,
56
56
  borderBottomRightRadius: null,
57
57
  pointerEvents: "musaex-67bb7w",
58
- willChange: "musaex-1enemt",
59
- transitionProperty: "musaex-qzan4j",
58
+ willChange: "musaex-1larqbn",
59
+ transitionProperty: "musaex-19991ni",
60
60
  transitionDuration: "musaex-1g2r6go",
61
61
  display: "musaex-1s85apg",
62
62
  opacity: "musaex-g01cxk",
@@ -4,20 +4,26 @@ var _createClass = require('@babel/runtime/helpers/createClass');
4
4
  var _callSuper = require('@babel/runtime/helpers/callSuper');
5
5
  var _inherits = require('@babel/runtime/helpers/inherits');
6
6
  var _superPropGet = require('@babel/runtime/helpers/superPropGet');
7
+ var _classPrivateMethodInitSpec = require('@babel/runtime/helpers/classPrivateMethodInitSpec');
7
8
  var _classPrivateFieldInitSpec = require('@babel/runtime/helpers/classPrivateFieldInitSpec');
9
+ var _classPrivateGetter = require('@babel/runtime/helpers/classPrivateGetter');
8
10
  var _classPrivateFieldGet = require('@babel/runtime/helpers/classPrivateFieldGet2');
9
11
  var _classPrivateFieldSet = require('@babel/runtime/helpers/classPrivateFieldSet2');
10
12
  var list = require('@lexical/list');
11
13
 
12
14
  var _disabled = /*#__PURE__*/new WeakMap();
15
+ var _checkboxElement = /*#__PURE__*/new WeakMap();
16
+ var _CheckableListItemNode_brand = /*#__PURE__*/new WeakSet();
13
17
  var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
14
18
  function CheckableListItemNode(value, checked, key, disabled) {
15
- var _this;
19
+ var _this2;
16
20
  _classCallCheck(this, CheckableListItemNode);
17
- _this = _callSuper(this, CheckableListItemNode, [value, checked, key]);
18
- _classPrivateFieldInitSpec(_this, _disabled, void 0);
19
- _classPrivateFieldSet(_disabled, _this, disabled);
20
- return _this;
21
+ _this2 = _callSuper(this, CheckableListItemNode, [value, checked, key]);
22
+ _classPrivateMethodInitSpec(_this2, _CheckableListItemNode_brand);
23
+ _classPrivateFieldInitSpec(_this2, _disabled, void 0);
24
+ _classPrivateFieldInitSpec(_this2, _checkboxElement, null);
25
+ _classPrivateFieldSet(_disabled, _this2, disabled);
26
+ return _this2;
21
27
  }
22
28
  _inherits(CheckableListItemNode, _ListItemNode);
23
29
  return _createClass(CheckableListItemNode, [{
@@ -27,11 +33,11 @@ var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
27
33
  }
28
34
  }, {
29
35
  key: "toggleDisabled",
30
- value: function toggleDisabled(dom) {
31
- _classPrivateFieldSet(_disabled, this, !_classPrivateFieldGet(_disabled, this));
32
- var checkbox = dom.firstElementChild;
33
- if (!checkbox) return;
34
- checkbox.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
36
+ value: function toggleDisabled() {
37
+ var _classPrivateFieldGet2;
38
+ var _node = this.getWritable();
39
+ _classPrivateFieldSet(_disabled, _node, !_classPrivateFieldGet(_disabled, _node));
40
+ (_classPrivateFieldGet2 = _classPrivateFieldGet(_checkboxElement, _node)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
35
41
  }
36
42
  }, {
37
43
  key: "exportJSON",
@@ -48,30 +54,24 @@ var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
48
54
  value: function createDOM(config) {
49
55
  var _config$theme$checkbo;
50
56
  var listItem = _superPropGet(CheckableListItemNode, "createDOM", this, 3)([config]);
51
- var parent = this.getParent();
52
- var isCheckList = list.$isListNode(parent) && parent.getListType() === "check";
53
- if (!isCheckList) return listItem;
57
+ if (!_classPrivateGetter(_CheckableListItemNode_brand, this, _get_isCheckList)) return listItem;
58
+ _classPrivateFieldSet(_checkboxElement, this, document.createElement("input"));
54
59
  var isChecked = this.getChecked();
55
- var checkbox = document.createElement("input");
56
- checkbox.setAttribute("type", "checkbox");
57
- checkbox.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
58
- checkbox.setAttribute("aria-checked", String(isChecked));
59
- checkbox.className = (_config$theme$checkbo = config.theme.checkbox) !== null && _config$theme$checkbo !== void 0 ? _config$theme$checkbo : "";
60
- listItem.appendChild(checkbox);
60
+ _classPrivateFieldGet(_checkboxElement, this).setAttribute("type", "checkbox");
61
+ _classPrivateFieldGet(_checkboxElement, this).setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
62
+ _classPrivateFieldGet(_checkboxElement, this).setAttribute("aria-checked", String(isChecked));
63
+ _classPrivateFieldGet(_checkboxElement, this).className = (_config$theme$checkbo = config.theme.checkbox) !== null && _config$theme$checkbo !== void 0 ? _config$theme$checkbo : "";
64
+ listItem.appendChild(_classPrivateFieldGet(_checkboxElement, this));
61
65
  return listItem;
62
66
  }
63
67
  }, {
64
68
  key: "updateDOM",
65
69
  value: function updateDOM(prevNode, dom, config) {
66
- _superPropGet(CheckableListItemNode, "updateDOM", this, 3)([prevNode, dom, config]);
67
- var checkbox = dom.firstElementChild;
68
- if (checkbox) {
69
- var _this$getChecked, _config$theme$checkbo2;
70
- checkbox.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
71
- checkbox.setAttribute("aria-checked", String((_this$getChecked = this.getChecked()) !== null && _this$getChecked !== void 0 ? _this$getChecked : false));
72
- checkbox.className = (_config$theme$checkbo2 = config.theme.checkbox) !== null && _config$theme$checkbo2 !== void 0 ? _config$theme$checkbo2 : "";
73
- }
74
- return true;
70
+ var _classPrivateFieldGet3, _this$getChecked;
71
+ var isReplace = _superPropGet(CheckableListItemNode, "updateDOM", this, 3)([prevNode, dom, config]);
72
+ (_classPrivateFieldGet3 = _classPrivateFieldGet(_checkboxElement, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.setAttribute("aria-checked", String((_this$getChecked = this.getChecked()) !== null && _this$getChecked !== void 0 ? _this$getChecked : false));
73
+ // if user clear all text, just replace new item node
74
+ return isReplace || this.getTextContentSize() === 0;
75
75
  }
76
76
  }], [{
77
77
  key: "getType",
@@ -90,6 +90,10 @@ var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
90
90
  }
91
91
  }]);
92
92
  }(list.ListItemNode);
93
+ function _get_isCheckList(_this) {
94
+ var parent = _this.getParent();
95
+ return list.$isListNode(parent) && parent.getListType() === "check";
96
+ }
93
97
  var replacement = function replacement(disabled) {
94
98
  return {
95
99
  replace: list.ListItemNode,
@@ -8,7 +8,7 @@ declare class CheckableListItemNode extends ListItemNode {
8
8
  static importJSON(serializedNode: SerializedListItemNode): ListItemNode;
9
9
  constructor(value: number, checked: Partialable<boolean>, key: Partialable<string>, disabled: boolean);
10
10
  get disabled(): boolean;
11
- toggleDisabled(dom: HTMLElement): void;
11
+ toggleDisabled(): void;
12
12
  exportJSON(): SerializedListItemNode;
13
13
  createDOM(config: EditorConfig): HTMLElement;
14
14
  updateDOM(prevNode: CheckableListItemNode, dom: HTMLElement, config: EditorConfig): boolean;
@@ -4,20 +4,26 @@ import _createClass from '@babel/runtime/helpers/createClass';
4
4
  import _callSuper from '@babel/runtime/helpers/callSuper';
5
5
  import _inherits from '@babel/runtime/helpers/inherits';
6
6
  import _superPropGet from '@babel/runtime/helpers/superPropGet';
7
+ import _classPrivateMethodInitSpec from '@babel/runtime/helpers/classPrivateMethodInitSpec';
7
8
  import _classPrivateFieldInitSpec from '@babel/runtime/helpers/classPrivateFieldInitSpec';
9
+ import _classPrivateGetter from '@babel/runtime/helpers/classPrivateGetter';
8
10
  import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet2';
9
11
  import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet2';
10
- import { $isListNode, ListItemNode } from '@lexical/list';
12
+ import { ListItemNode, $isListNode } from '@lexical/list';
11
13
 
12
14
  var _disabled = /*#__PURE__*/new WeakMap();
15
+ var _checkboxElement = /*#__PURE__*/new WeakMap();
16
+ var _CheckableListItemNode_brand = /*#__PURE__*/new WeakSet();
13
17
  var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
14
18
  function CheckableListItemNode(value, checked, key, disabled) {
15
- var _this;
19
+ var _this2;
16
20
  _classCallCheck(this, CheckableListItemNode);
17
- _this = _callSuper(this, CheckableListItemNode, [value, checked, key]);
18
- _classPrivateFieldInitSpec(_this, _disabled, void 0);
19
- _classPrivateFieldSet(_disabled, _this, disabled);
20
- return _this;
21
+ _this2 = _callSuper(this, CheckableListItemNode, [value, checked, key]);
22
+ _classPrivateMethodInitSpec(_this2, _CheckableListItemNode_brand);
23
+ _classPrivateFieldInitSpec(_this2, _disabled, void 0);
24
+ _classPrivateFieldInitSpec(_this2, _checkboxElement, null);
25
+ _classPrivateFieldSet(_disabled, _this2, disabled);
26
+ return _this2;
21
27
  }
22
28
  _inherits(CheckableListItemNode, _ListItemNode);
23
29
  return _createClass(CheckableListItemNode, [{
@@ -27,11 +33,11 @@ var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
27
33
  }
28
34
  }, {
29
35
  key: "toggleDisabled",
30
- value: function toggleDisabled(dom) {
31
- _classPrivateFieldSet(_disabled, this, !_classPrivateFieldGet(_disabled, this));
32
- var checkbox = dom.firstElementChild;
33
- if (!checkbox) return;
34
- checkbox.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
36
+ value: function toggleDisabled() {
37
+ var _classPrivateFieldGet2;
38
+ var _node = this.getWritable();
39
+ _classPrivateFieldSet(_disabled, _node, !_classPrivateFieldGet(_disabled, _node));
40
+ (_classPrivateFieldGet2 = _classPrivateFieldGet(_checkboxElement, _node)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
35
41
  }
36
42
  }, {
37
43
  key: "exportJSON",
@@ -48,30 +54,24 @@ var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
48
54
  value: function createDOM(config) {
49
55
  var _config$theme$checkbo;
50
56
  var listItem = _superPropGet(CheckableListItemNode, "createDOM", this, 3)([config]);
51
- var parent = this.getParent();
52
- var isCheckList = $isListNode(parent) && parent.getListType() === "check";
53
- if (!isCheckList) return listItem;
57
+ if (!_classPrivateGetter(_CheckableListItemNode_brand, this, _get_isCheckList)) return listItem;
58
+ _classPrivateFieldSet(_checkboxElement, this, document.createElement("input"));
54
59
  var isChecked = this.getChecked();
55
- var checkbox = document.createElement("input");
56
- checkbox.setAttribute("type", "checkbox");
57
- checkbox.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
58
- checkbox.setAttribute("aria-checked", String(isChecked));
59
- checkbox.className = (_config$theme$checkbo = config.theme.checkbox) !== null && _config$theme$checkbo !== void 0 ? _config$theme$checkbo : "";
60
- listItem.appendChild(checkbox);
60
+ _classPrivateFieldGet(_checkboxElement, this).setAttribute("type", "checkbox");
61
+ _classPrivateFieldGet(_checkboxElement, this).setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
62
+ _classPrivateFieldGet(_checkboxElement, this).setAttribute("aria-checked", String(isChecked));
63
+ _classPrivateFieldGet(_checkboxElement, this).className = (_config$theme$checkbo = config.theme.checkbox) !== null && _config$theme$checkbo !== void 0 ? _config$theme$checkbo : "";
64
+ listItem.appendChild(_classPrivateFieldGet(_checkboxElement, this));
61
65
  return listItem;
62
66
  }
63
67
  }, {
64
68
  key: "updateDOM",
65
69
  value: function updateDOM(prevNode, dom, config) {
66
- _superPropGet(CheckableListItemNode, "updateDOM", this, 3)([prevNode, dom, config]);
67
- var checkbox = dom.firstElementChild;
68
- if (checkbox) {
69
- var _this$getChecked, _config$theme$checkbo2;
70
- checkbox.setAttribute("aria-disabled", String(_classPrivateFieldGet(_disabled, this)));
71
- checkbox.setAttribute("aria-checked", String((_this$getChecked = this.getChecked()) !== null && _this$getChecked !== void 0 ? _this$getChecked : false));
72
- checkbox.className = (_config$theme$checkbo2 = config.theme.checkbox) !== null && _config$theme$checkbo2 !== void 0 ? _config$theme$checkbo2 : "";
73
- }
74
- return true;
70
+ var _classPrivateFieldGet3, _this$getChecked;
71
+ var isReplace = _superPropGet(CheckableListItemNode, "updateDOM", this, 3)([prevNode, dom, config]);
72
+ (_classPrivateFieldGet3 = _classPrivateFieldGet(_checkboxElement, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.setAttribute("aria-checked", String((_this$getChecked = this.getChecked()) !== null && _this$getChecked !== void 0 ? _this$getChecked : false));
73
+ // if user clear all text, just replace new item node
74
+ return isReplace || this.getTextContentSize() === 0;
75
75
  }
76
76
  }], [{
77
77
  key: "getType",
@@ -90,6 +90,10 @@ var CheckableListItemNode = /*#__PURE__*/function (_ListItemNode) {
90
90
  }
91
91
  }]);
92
92
  }(ListItemNode);
93
+ function _get_isCheckList(_this) {
94
+ var parent = _this.getParent();
95
+ return $isListNode(parent) && parent.getListType() === "check";
96
+ }
93
97
  var replacement = function replacement(disabled) {
94
98
  return {
95
99
  replace: ListItemNode,
@@ -21,11 +21,11 @@ var EditablePlugin = function EditablePlugin(_ref) {
21
21
  editor.update(function () {
22
22
  editor._keyToDOMMap.entries().forEach(function (_ref2) {
23
23
  var _ref3 = _slicedToArray(_ref2, 2),
24
- key = _ref3[0],
25
- dom = _ref3[1];
24
+ key = _ref3[0];
25
+ _ref3[1];
26
26
  var node = lexical.$getNodeByKey(key);
27
27
  if (!(node instanceof checkableListItem.CheckableListItemNode)) return;
28
- node.toggleDisabled(dom);
28
+ node.toggleDisabled();
29
29
  });
30
30
  });
31
31
  }, [isEditable, editor]);
@@ -19,11 +19,11 @@ var EditablePlugin = function EditablePlugin(_ref) {
19
19
  editor.update(function () {
20
20
  editor._keyToDOMMap.entries().forEach(function (_ref2) {
21
21
  var _ref3 = _slicedToArray(_ref2, 2),
22
- key = _ref3[0],
23
- dom = _ref3[1];
22
+ key = _ref3[0];
23
+ _ref3[1];
24
24
  var node = $getNodeByKey(key);
25
25
  if (!(node instanceof CheckableListItemNode)) return;
26
- node.toggleDisabled(dom);
26
+ node.toggleDisabled();
27
27
  });
28
28
  });
29
29
  }, [isEditable, editor]);
@@ -354,7 +354,7 @@ var RichTextEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
354
354
  },
355
355
  checkbox: styled.checkbox.className
356
356
  };
357
- return {
357
+ return _objectSpread({
358
358
  namespace: id,
359
359
  onError: function onError(error) {
360
360
  messager.error({
@@ -363,8 +363,9 @@ var RichTextEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
363
363
  },
364
364
  nodes: [richText.HeadingNode, richText.QuoteNode, code.CodeNode, link.LinkNode, list.ListNode, checkableListItem.CheckableListItemNode, checkableListItem.replacement(disabled), LexicalHorizontalRuleNode.HorizontalRuleNode],
365
365
  theme: theme,
366
- editable: !disabled,
367
- editorState: defaultValue && function (editor) {
366
+ editable: !disabled
367
+ }, defaultValue && {
368
+ editorState: function editorState(editor) {
368
369
  // different value usage, use different serialization
369
370
  switch (_use) {
370
371
  case "markdown":
@@ -375,7 +376,7 @@ var RichTextEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
375
376
  break;
376
377
  }
377
378
  }
378
- };
379
+ });
379
380
  });
380
381
  React.useImperativeHandle(ref, function () {
381
382
  return {
@@ -352,7 +352,7 @@ var RichTextEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
352
352
  },
353
353
  checkbox: styled.checkbox.className
354
354
  };
355
- return {
355
+ return _objectSpread({
356
356
  namespace: id,
357
357
  onError: function onError(error) {
358
358
  messager.error({
@@ -361,8 +361,9 @@ var RichTextEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
361
361
  },
362
362
  nodes: [HeadingNode, QuoteNode, CodeNode, LinkNode, ListNode, CheckableListItemNode, replacement(disabled), HorizontalRuleNode],
363
363
  theme: theme,
364
- editable: !disabled,
365
- editorState: defaultValue && function (editor) {
364
+ editable: !disabled
365
+ }, defaultValue && {
366
+ editorState: function editorState(editor) {
366
367
  // different value usage, use different serialization
367
368
  switch (_use) {
368
369
  case "markdown":
@@ -373,7 +374,7 @@ var RichTextEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
373
374
  break;
374
375
  }
375
376
  }
376
- };
377
+ });
377
378
  });
378
379
  useImperativeHandle(ref, function () {
379
380
  return {
package/dist/styles.css CHANGED
@@ -1547,10 +1547,6 @@
1547
1547
  transition-property: transform;
1548
1548
  }
1549
1549
 
1550
- .musaex-qzan4j {
1551
- transition-property: translate, opacity;
1552
- }
1553
-
1554
1550
  .musaex-87ps6o {
1555
1551
  -webkit-user-select: none;
1556
1552
  user-select: none;
@@ -1588,12 +1584,12 @@
1588
1584
  will-change: color;
1589
1585
  }
1590
1586
 
1591
- .musaex-1so62im {
1592
- will-change: transform;
1587
+ .musaex-1larqbn {
1588
+ will-change: opacity;
1593
1589
  }
1594
1590
 
1595
- .musaex-1enemt {
1596
- will-change: translate, opacity;
1591
+ .musaex-1so62im {
1592
+ will-change: transform;
1597
1593
  }
1598
1594
 
1599
1595
  .musaex-13faqbe {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musae",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "musae-ui",
5
5
  "author": "tutu@fantufantu.com",
6
6
  "license": "MIT",
@@ -60,24 +60,24 @@
60
60
  "pnpm": ">=9"
61
61
  },
62
62
  "dependencies": {
63
- "@aiszlab/fuzzy": "^1.5.5",
64
- "@aiszlab/relax": "^1.5.6",
63
+ "@aiszlab/fuzzy": "^1.5.7",
64
+ "@aiszlab/relax": "^1.5.7",
65
65
  "@babel/runtime": "^7.26.0",
66
66
  "@emotion/is-prop-valid": "^1.3.1",
67
67
  "@floating-ui/dom": "^1.6.12",
68
- "@lexical/code": "^0.19.0",
69
- "@lexical/link": "^0.19.0",
70
- "@lexical/list": "^0.19.0",
71
- "@lexical/markdown": "^0.19.0",
72
- "@lexical/react": "^0.19.0",
73
- "@lexical/rich-text": "^0.19.0",
74
- "@lexical/selection": "^0.19.0",
75
- "@lexical/utils": "^0.19.0",
68
+ "@lexical/code": "^0.20.0",
69
+ "@lexical/link": "^0.20.0",
70
+ "@lexical/list": "^0.20.0",
71
+ "@lexical/markdown": "^0.20.0",
72
+ "@lexical/react": "^0.20.0",
73
+ "@lexical/rich-text": "^0.20.0",
74
+ "@lexical/selection": "^0.20.0",
75
+ "@lexical/utils": "^0.20.0",
76
76
  "@tanstack/react-table": "^8.20.5",
77
77
  "dayjs": "^1.11.13",
78
78
  "framer-motion": "^11.11.11",
79
- "lexical": "^0.19.0",
80
- "react-hook-form": "^7.53.1",
79
+ "lexical": "^0.20.0",
80
+ "react-hook-form": "^7.53.2",
81
81
  "rxjs": "^7.8.1"
82
82
  },
83
83
  "devDependencies": {
@@ -109,9 +109,9 @@
109
109
  "jest-environment-jsdom": "^29.7.0",
110
110
  "react": "^18.3.1",
111
111
  "react-dom": "^18.3.1",
112
- "rollup": "^4.24.4",
112
+ "rollup": "^4.25.0",
113
113
  "typescript": "^5.6.3",
114
- "zx": "^8.2.0"
114
+ "zx": "^8.2.1"
115
115
  },
116
116
  "peerDependencies": {
117
117
  "react": "^18",