musae 1.0.27-beta.2 → 1.0.27-beta.21
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/components/calendar/calendar.cjs +2 -2
- package/dist/components/calendar/calendar.mjs +2 -2
- package/dist/components/calendar/hooks.cjs +17 -17
- package/dist/components/calendar/hooks.d.ts +2 -2
- package/dist/components/calendar/hooks.mjs +17 -17
- package/dist/components/checkbox/checkbox.cjs +5 -26
- package/dist/components/checkbox/checkbox.mjs +3 -24
- package/dist/components/icon/icons/action/calendar-today.cjs +22 -0
- package/dist/components/icon/icons/action/calendar-today.d.ts +3 -0
- package/dist/components/icon/icons/action/calendar-today.mjs +18 -0
- package/dist/components/icon/icons/action/index.cjs +2 -0
- package/dist/components/icon/icons/action/index.d.ts +2 -1
- package/dist/components/icon/icons/action/index.mjs +1 -0
- package/dist/components/icon/icons/communication/index.d.ts +2 -0
- package/dist/components/icon/icons/communication/location-on.cjs +25 -0
- package/dist/components/icon/icons/communication/location-on.d.ts +3 -0
- package/dist/components/icon/icons/communication/location-on.mjs +21 -0
- package/dist/components/icon/icons/content/add.cjs +22 -0
- package/dist/components/icon/icons/content/add.d.ts +3 -0
- package/dist/components/icon/icons/content/add.mjs +18 -0
- package/dist/components/icon/icons/content/clear.cjs +2 -2
- package/dist/components/icon/icons/content/clear.d.ts +2 -2
- package/dist/components/icon/icons/content/clear.mjs +2 -2
- package/dist/components/icon/icons/content/index.cjs +4 -0
- package/dist/components/icon/icons/content/index.d.ts +3 -1
- package/dist/components/icon/icons/content/index.mjs +2 -0
- package/dist/components/icon/icons/content/remove.cjs +22 -0
- package/dist/components/icon/icons/content/remove.d.ts +3 -0
- package/dist/components/icon/icons/content/remove.mjs +18 -0
- package/dist/components/icon/icons/index.cjs +10 -0
- package/dist/components/icon/icons/index.d.ts +2 -0
- package/dist/components/icon/icons/index.mjs +5 -0
- package/dist/components/icon/icons/social/index.d.ts +2 -0
- package/dist/components/icon/icons/social/share.cjs +22 -0
- package/dist/components/icon/icons/social/share.d.ts +3 -0
- package/dist/components/icon/icons/social/share.mjs +18 -0
- package/dist/components/progress/linear.cjs +2 -2
- package/dist/components/progress/linear.mjs +2 -2
- package/dist/components/rich-text-editor/plugins/controlled-state/index.cjs +12 -26
- package/dist/components/rich-text-editor/plugins/controlled-state/index.mjs +13 -27
- package/dist/components/rich-text-editor/rich-text-editor.cjs +3 -11
- package/dist/components/rich-text-editor/rich-text-editor.mjs +3 -11
- package/dist/components/tabs/context.cjs +1 -4
- package/dist/components/tabs/context.d.ts +2 -2
- package/dist/components/tabs/context.mjs +1 -4
- package/dist/components/tabs/hooks/use-navigation.cjs +87 -0
- package/dist/components/tabs/hooks/use-navigation.d.ts +12 -0
- package/dist/components/tabs/hooks/use-navigation.mjs +85 -0
- package/dist/components/tabs/hooks/use-tabs-context.cjs +18 -0
- package/dist/components/tabs/hooks/use-tabs-context.d.ts +7 -0
- package/dist/components/tabs/hooks/use-tabs-context.mjs +16 -0
- package/dist/components/tabs/hooks/use-tabs.cjs +46 -0
- package/dist/components/tabs/hooks/use-tabs.d.ts +17 -0
- package/dist/components/tabs/hooks/use-tabs.mjs +44 -0
- package/dist/components/tabs/navigation.cjs +48 -18
- package/dist/components/tabs/navigation.mjs +47 -17
- package/dist/components/tabs/panels.cjs +56 -39
- package/dist/components/tabs/panels.mjs +56 -39
- package/dist/components/tabs/tab.cjs +6 -4
- package/dist/components/tabs/tab.mjs +5 -3
- package/dist/components/tabs/tabs.cjs +11 -6
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.mjs +10 -5
- package/dist/components/tag/tag.cjs +51 -28
- package/dist/components/tag/tag.d.ts +1 -1
- package/dist/components/tag/tag.mjs +51 -28
- package/dist/components/theme/tokens.stylex.d.ts +2 -0
- package/dist/hooks/use-theme-color-vars.cjs +7 -9
- package/dist/hooks/use-theme-color-vars.d.ts +2 -1
- package/dist/hooks/use-theme-color-vars.mjs +6 -8
- package/dist/styles.css +37 -21
- package/dist/types/tabs.d.ts +18 -2
- package/dist/types/tag.d.ts +7 -0
- package/package.json +6 -6
- package/dist/components/tabs/hooks.cjs +0 -145
- package/dist/components/tabs/hooks.d.ts +0 -43
- package/dist/components/tabs/hooks.mjs +0 -140
|
@@ -3,3 +3,5 @@ export { default as Redo } from './redo.mjs';
|
|
|
3
3
|
export { default as Undo } from './undo.mjs';
|
|
4
4
|
export { default as LinkOff } from './link-off.mjs';
|
|
5
5
|
export { default as FontDownload } from './font-download.mjs';
|
|
6
|
+
export { default as Remove } from './remove.mjs';
|
|
7
|
+
export { default as Add } from './add.mjs';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var hoc = require('../../hoc.cjs');
|
|
7
|
+
|
|
8
|
+
var Remove = hoc.withIcon(function (_ref) {
|
|
9
|
+
var size = _ref.size;
|
|
10
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
width: size,
|
|
13
|
+
height: size,
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
fill: "none"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M19 13H5V11H19V13Z",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports.default = Remove;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withIcon } from '../../hoc.mjs';
|
|
3
|
+
|
|
4
|
+
var Remove = withIcon(function (_ref) {
|
|
5
|
+
var size = _ref.size;
|
|
6
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
width: size,
|
|
9
|
+
height: size,
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
13
|
+
d: "M19 13H5V11H19V13Z",
|
|
14
|
+
fill: "currentColor"
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { Remove as default };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var accountCircle = require('./action/account-circle.cjs');
|
|
4
|
+
var add = require('./content/add.cjs');
|
|
4
5
|
var addAlert = require('./alert/add-alert.cjs');
|
|
5
6
|
var attchFile = require('./editor/attch-file.cjs');
|
|
6
7
|
var autoDelete = require('./alert/auto-delete.cjs');
|
|
7
8
|
var bedtime = require('./image/bedtime.cjs');
|
|
9
|
+
var calendarToday = require('./action/calendar-today.cjs');
|
|
8
10
|
var cancel = require('./navigation/cancel.cjs');
|
|
9
11
|
var check = require('./navigation/check.cjs');
|
|
10
12
|
var checkCircle = require('./action/check-circle.cjs');
|
|
@@ -37,6 +39,7 @@ var keyboardDoubleArrowRight = require('./hardware/keyboard-double-arrow-right.c
|
|
|
37
39
|
var lightMode = require('./device/light-mode.cjs');
|
|
38
40
|
var linkOff = require('./content/link-off.cjs');
|
|
39
41
|
var loading = require('./mock/loading.cjs');
|
|
42
|
+
var locationOn = require('./communication/location-on.cjs');
|
|
40
43
|
var logout = require('./action/logout.cjs');
|
|
41
44
|
var looksFive = require('./image/looks-five.cjs');
|
|
42
45
|
var looksFour = require('./image/looks-four.cjs');
|
|
@@ -52,10 +55,12 @@ var notificationImportant = require('./alert/notification-important.cjs');
|
|
|
52
55
|
var openInNew = require('./action/open-in-new.cjs');
|
|
53
56
|
var preview = require('./action/preview.cjs');
|
|
54
57
|
var redo = require('./content/redo.cjs');
|
|
58
|
+
var remove = require('./content/remove.cjs');
|
|
55
59
|
var rocketLaunch = require('./action/rocket-launch.cjs');
|
|
56
60
|
var rotateLeft = require('./image/rotate-left.cjs');
|
|
57
61
|
var rotateRight = require('./image/rotate-right.cjs');
|
|
58
62
|
var schedule = require('./action/schedule.cjs');
|
|
63
|
+
var share = require('./social/share.cjs');
|
|
59
64
|
var smartToy = require('./home/smart-toy.cjs');
|
|
60
65
|
var star = require('./toggle/star.cjs');
|
|
61
66
|
var starHalf = require('./toggle/star-half.cjs');
|
|
@@ -81,10 +86,12 @@ var zoomOut = require('./action/zoom-out.cjs');
|
|
|
81
86
|
|
|
82
87
|
|
|
83
88
|
exports.AccountCircle = accountCircle.default;
|
|
89
|
+
exports.Add = add.default;
|
|
84
90
|
exports.AddAlert = addAlert.default;
|
|
85
91
|
exports.AttachFile = attchFile.default;
|
|
86
92
|
exports.AutoDelete = autoDelete.default;
|
|
87
93
|
exports.Bedtime = bedtime.default;
|
|
94
|
+
exports.CalendarToday = calendarToday.default;
|
|
88
95
|
exports.Cancel = cancel.default;
|
|
89
96
|
exports.Check = check.default;
|
|
90
97
|
exports.CheckCircle = checkCircle.default;
|
|
@@ -117,6 +124,7 @@ exports.KeyboardDoubleArrowRight = keyboardDoubleArrowRight.default;
|
|
|
117
124
|
exports.LightMode = lightMode.default;
|
|
118
125
|
exports.LinkOff = linkOff.default;
|
|
119
126
|
exports.Loading = loading.default;
|
|
127
|
+
exports.LocationOn = locationOn.default;
|
|
120
128
|
exports.Logout = logout.default;
|
|
121
129
|
exports.LooksFive = looksFive.default;
|
|
122
130
|
exports.LooksFour = looksFour.default;
|
|
@@ -132,10 +140,12 @@ exports.NotificationImportant = notificationImportant.default;
|
|
|
132
140
|
exports.OpenInNew = openInNew.default;
|
|
133
141
|
exports.Preview = preview.default;
|
|
134
142
|
exports.Redo = redo.default;
|
|
143
|
+
exports.Remove = remove.default;
|
|
135
144
|
exports.RocketLaunch = rocketLaunch.default;
|
|
136
145
|
exports.RotateLeft = rotateLeft.default;
|
|
137
146
|
exports.RotateRight = rotateRight.default;
|
|
138
147
|
exports.Schedule = schedule.default;
|
|
148
|
+
exports.Share = share.default;
|
|
139
149
|
exports.SmartToy = smartToy.default;
|
|
140
150
|
exports.Star = star.default;
|
|
141
151
|
exports.StarHalf = starHalf.default;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { default as AccountCircle } from './action/account-circle.mjs';
|
|
2
|
+
export { default as Add } from './content/add.mjs';
|
|
2
3
|
export { default as AddAlert } from './alert/add-alert.mjs';
|
|
3
4
|
export { default as AttachFile } from './editor/attch-file.mjs';
|
|
4
5
|
export { default as AutoDelete } from './alert/auto-delete.mjs';
|
|
5
6
|
export { default as Bedtime } from './image/bedtime.mjs';
|
|
7
|
+
export { default as CalendarToday } from './action/calendar-today.mjs';
|
|
6
8
|
export { default as Cancel } from './navigation/cancel.mjs';
|
|
7
9
|
export { default as Check } from './navigation/check.mjs';
|
|
8
10
|
export { default as CheckCircle } from './action/check-circle.mjs';
|
|
@@ -35,6 +37,7 @@ export { default as KeyboardDoubleArrowRight } from './hardware/keyboard-double-
|
|
|
35
37
|
export { default as LightMode } from './device/light-mode.mjs';
|
|
36
38
|
export { default as LinkOff } from './content/link-off.mjs';
|
|
37
39
|
export { default as Loading } from './mock/loading.mjs';
|
|
40
|
+
export { default as LocationOn } from './communication/location-on.mjs';
|
|
38
41
|
export { default as Logout } from './action/logout.mjs';
|
|
39
42
|
export { default as LooksFive } from './image/looks-five.mjs';
|
|
40
43
|
export { default as LooksFour } from './image/looks-four.mjs';
|
|
@@ -50,10 +53,12 @@ export { default as NotificationImportant } from './alert/notification-important
|
|
|
50
53
|
export { default as OpenInNew } from './action/open-in-new.mjs';
|
|
51
54
|
export { default as Preview } from './action/preview.mjs';
|
|
52
55
|
export { default as Redo } from './content/redo.mjs';
|
|
56
|
+
export { default as Remove } from './content/remove.mjs';
|
|
53
57
|
export { default as RocketLaunch } from './action/rocket-launch.mjs';
|
|
54
58
|
export { default as RotateLeft } from './image/rotate-left.mjs';
|
|
55
59
|
export { default as RotateRight } from './image/rotate-right.mjs';
|
|
56
60
|
export { default as Schedule } from './action/schedule.mjs';
|
|
61
|
+
export { default as Share } from './social/share.mjs';
|
|
57
62
|
export { default as SmartToy } from './home/smart-toy.mjs';
|
|
58
63
|
export { default as Star } from './toggle/star.mjs';
|
|
59
64
|
export { default as StarHalf } from './toggle/star-half.mjs';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var hoc = require('../../hoc.cjs');
|
|
7
|
+
|
|
8
|
+
var Share = hoc.withIcon(function (_ref) {
|
|
9
|
+
var size = _ref.size;
|
|
10
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
width: size,
|
|
13
|
+
height: size,
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
fill: "none"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M18 16.12C17.24 16.12 16.56 16.42 16.04 16.89L8.91 12.74C8.96 12.51 9 12.28 9 12.04C9 11.8 8.96 11.57 8.91 11.34L15.96 7.23004C16.5 7.73004 17.21 8.04004 18 8.04004C19.66 8.04004 21 6.70004 21 5.04004C21 3.38004 19.66 2.04004 18 2.04004C16.34 2.04004 15 3.38004 15 5.04004C15 5.28004 15.04 5.51004 15.09 5.74004L8.04 9.85004C7.5 9.35004 6.79 9.04004 6 9.04004C4.34 9.04004 3 10.38 3 12.04C3 13.7 4.34 15.04 6 15.04C6.79 15.04 7.5 14.73 8.04 14.23L15.16 18.39C15.11 18.6 15.08 18.82 15.08 19.04C15.08 20.65 16.39 21.96 18 21.96C19.61 21.96 20.92 20.65 20.92 19.04C20.92 17.43 19.61 16.12 18 16.12ZM18 4.04004C18.55 4.04004 19 4.49004 19 5.04004C19 5.59004 18.55 6.04004 18 6.04004C17.45 6.04004 17 5.59004 17 5.04004C17 4.49004 17.45 4.04004 18 4.04004ZM6 13.04C5.45 13.04 5 12.59 5 12.04C5 11.49 5.45 11.04 6 11.04C6.55 11.04 7 11.49 7 12.04C7 12.59 6.55 13.04 6 13.04ZM18 20.06C17.45 20.06 17 19.61 17 19.06C17 18.51 17.45 18.06 18 18.06C18.55 18.06 19 18.51 19 19.06C19 19.61 18.55 20.06 18 20.06Z",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports.default = Share;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withIcon } from '../../hoc.mjs';
|
|
3
|
+
|
|
4
|
+
var Share = withIcon(function (_ref) {
|
|
5
|
+
var size = _ref.size;
|
|
6
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
width: size,
|
|
9
|
+
height: size,
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
13
|
+
d: "M18 16.12C17.24 16.12 16.56 16.42 16.04 16.89L8.91 12.74C8.96 12.51 9 12.28 9 12.04C9 11.8 8.96 11.57 8.91 11.34L15.96 7.23004C16.5 7.73004 17.21 8.04004 18 8.04004C19.66 8.04004 21 6.70004 21 5.04004C21 3.38004 19.66 2.04004 18 2.04004C16.34 2.04004 15 3.38004 15 5.04004C15 5.28004 15.04 5.51004 15.09 5.74004L8.04 9.85004C7.5 9.35004 6.79 9.04004 6 9.04004C4.34 9.04004 3 10.38 3 12.04C3 13.7 4.34 15.04 6 15.04C6.79 15.04 7.5 14.73 8.04 14.23L15.16 18.39C15.11 18.6 15.08 18.82 15.08 19.04C15.08 20.65 16.39 21.96 18 21.96C19.61 21.96 20.92 20.65 20.92 19.04C20.92 17.43 19.61 16.12 18 16.12ZM18 4.04004C18.55 4.04004 19 4.49004 19 5.04004C19 5.59004 18.55 6.04004 18 6.04004C17.45 6.04004 17 5.59004 17 5.04004C17 4.49004 17.45 4.04004 18 4.04004ZM6 13.04C5.45 13.04 5 12.59 5 12.04C5 11.49 5.45 11.04 6 11.04C6.55 11.04 7 11.49 7 12.04C7 12.59 6.55 13.04 6 13.04ZM18 20.06C17.45 20.06 17 19.61 17 19.06C17 18.51 17.45 18.06 18 18.06C18.55 18.06 19 18.51 19 19.06C19 19.61 18.55 20.06 18 20.06Z",
|
|
14
|
+
fill: "currentColor"
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { Share as default };
|
|
@@ -25,13 +25,13 @@ var Linear = function Linear(_ref) {
|
|
|
25
25
|
className: "musaex-92755x musaex-rntz3j musaex-1ncffr6 musaex-shxsqp"
|
|
26
26
|
},
|
|
27
27
|
segment: {
|
|
28
|
-
className: "musaex-
|
|
28
|
+
className: "musaex-1bl4301 musaex-qg7gut musaex-shxsqp musaex-19fix8x"
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
32
|
className: className.stringify(classNames.progress, className$1, styled.progress.className),
|
|
33
33
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styled.progress.style), style), _themeColorVars), {}, {
|
|
34
|
-
"--
|
|
34
|
+
"--width": value + "%"
|
|
35
35
|
})
|
|
36
36
|
}, /*#__PURE__*/React.createElement("div", {
|
|
37
37
|
className: className.stringify(classNames.segment, styled.segment.className),
|
|
@@ -21,13 +21,13 @@ var Linear = function Linear(_ref) {
|
|
|
21
21
|
className: "musaex-92755x musaex-rntz3j musaex-1ncffr6 musaex-shxsqp"
|
|
22
22
|
},
|
|
23
23
|
segment: {
|
|
24
|
-
className: "musaex-
|
|
24
|
+
className: "musaex-1bl4301 musaex-qg7gut musaex-shxsqp musaex-19fix8x"
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
28
|
className: stringify(classNames.progress, className, styled.progress.className),
|
|
29
29
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styled.progress.style), style), _themeColorVars), {}, {
|
|
30
|
-
"--
|
|
30
|
+
"--width": value + "%"
|
|
31
31
|
})
|
|
32
32
|
}, /*#__PURE__*/React.createElement("div", {
|
|
33
33
|
className: stringify(classNames.segment, styled.segment.className),
|
|
@@ -17,21 +17,7 @@ var ControlledStatePlugin = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
17
17
|
var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
|
|
18
18
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
19
19
|
editor = _useLexicalComposerCo2[0];
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @description
|
|
23
|
-
* 监听受控值变化
|
|
24
|
-
* 发生值变化时,更新内部状态和编辑器状态
|
|
25
|
-
*/
|
|
26
|
-
onChange: function onChange(nextValue) {
|
|
27
|
-
_setEditorState(nextValue);
|
|
28
|
-
}
|
|
29
|
-
}),
|
|
30
|
-
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
31
|
-
_setValue = _useControlledState2[1];
|
|
32
|
-
/**
|
|
33
|
-
* @description 根据数据,设置编辑器状态
|
|
34
|
-
*/
|
|
20
|
+
// 更新编辑器状态
|
|
35
21
|
var _setEditorState = relax.useEvent(function (updatedValue) {
|
|
36
22
|
if (use === "markdown") {
|
|
37
23
|
editor.update(function () {
|
|
@@ -39,17 +25,17 @@ var ControlledStatePlugin = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
39
25
|
});
|
|
40
26
|
return;
|
|
41
27
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
editor.setEditorState(editorState);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
console.error(error);
|
|
47
|
-
}
|
|
28
|
+
var editorState = editor.parseEditorState(updatedValue);
|
|
29
|
+
editor.setEditorState(editorState);
|
|
48
30
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
var _useControlledState = relax.useControlledState(value),
|
|
32
|
+
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
33
|
+
_value = _useControlledState2[0],
|
|
34
|
+
_setValue = _useControlledState2[1];
|
|
35
|
+
relax.useUpdateEffect(function () {
|
|
36
|
+
_setEditorState(_value);
|
|
37
|
+
}, [_value]);
|
|
38
|
+
// 富文本组件发生数据变更时,同步更新受控数据
|
|
53
39
|
var change = relax.useEvent(function (state, editor) {
|
|
54
40
|
editor.read(function () {
|
|
55
41
|
if (use === "serialized") {
|
|
@@ -65,7 +51,7 @@ var ControlledStatePlugin = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
65
51
|
});
|
|
66
52
|
React.useImperativeHandle(ref, function () {
|
|
67
53
|
return {
|
|
68
|
-
setValue:
|
|
54
|
+
setValue: _setValue
|
|
69
55
|
};
|
|
70
56
|
});
|
|
71
57
|
return /*#__PURE__*/React.createElement(LexicalOnChangePlugin.OnChangePlugin, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
3
|
-
import { useControlledState,
|
|
3
|
+
import { useEvent, useControlledState, useUpdateEffect } from '@aiszlab/relax';
|
|
4
4
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
5
5
|
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
6
6
|
import { $convertFromMarkdownString, $convertToMarkdownString } from '@lexical/markdown';
|
|
@@ -13,21 +13,7 @@ var ControlledStatePlugin = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13
13
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
14
14
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
15
15
|
editor = _useLexicalComposerCo2[0];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @description
|
|
19
|
-
* 监听受控值变化
|
|
20
|
-
* 发生值变化时,更新内部状态和编辑器状态
|
|
21
|
-
*/
|
|
22
|
-
onChange: function onChange(nextValue) {
|
|
23
|
-
_setEditorState(nextValue);
|
|
24
|
-
}
|
|
25
|
-
}),
|
|
26
|
-
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
27
|
-
_setValue = _useControlledState2[1];
|
|
28
|
-
/**
|
|
29
|
-
* @description 根据数据,设置编辑器状态
|
|
30
|
-
*/
|
|
16
|
+
// 更新编辑器状态
|
|
31
17
|
var _setEditorState = useEvent(function (updatedValue) {
|
|
32
18
|
if (use === "markdown") {
|
|
33
19
|
editor.update(function () {
|
|
@@ -35,17 +21,17 @@ var ControlledStatePlugin = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
21
|
});
|
|
36
22
|
return;
|
|
37
23
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
editor.setEditorState(editorState);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
console.error(error);
|
|
43
|
-
}
|
|
24
|
+
var editorState = editor.parseEditorState(updatedValue);
|
|
25
|
+
editor.setEditorState(editorState);
|
|
44
26
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
var _useControlledState = useControlledState(value),
|
|
28
|
+
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
29
|
+
_value = _useControlledState2[0],
|
|
30
|
+
_setValue = _useControlledState2[1];
|
|
31
|
+
useUpdateEffect(function () {
|
|
32
|
+
_setEditorState(_value);
|
|
33
|
+
}, [_value]);
|
|
34
|
+
// 富文本组件发生数据变更时,同步更新受控数据
|
|
49
35
|
var change = useEvent(function (state, editor) {
|
|
50
36
|
editor.read(function () {
|
|
51
37
|
if (use === "serialized") {
|
|
@@ -61,7 +47,7 @@ var ControlledStatePlugin = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
61
47
|
});
|
|
62
48
|
useImperativeHandle(ref, function () {
|
|
63
49
|
return {
|
|
64
|
-
setValue:
|
|
50
|
+
setValue: _setValue
|
|
65
51
|
};
|
|
66
52
|
});
|
|
67
53
|
return /*#__PURE__*/React.createElement(OnChangePlugin, {
|
|
@@ -21,7 +21,6 @@ var relax = require('@aiszlab/relax');
|
|
|
21
21
|
var hooks = require('../message/hooks.cjs');
|
|
22
22
|
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.17.5/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
23
23
|
var className = require('@aiszlab/relax/class-name');
|
|
24
|
-
var hooks$1 = require('../theme/hooks.cjs');
|
|
25
24
|
var index$1 = require('./plugins/toolbar/index.cjs');
|
|
26
25
|
var index = require('./plugins/markdown-shortcut/index.cjs');
|
|
27
26
|
var markdown = require('@lexical/markdown');
|
|
@@ -29,6 +28,7 @@ var context = require('./context.cjs');
|
|
|
29
28
|
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
30
29
|
var utils = require('./utils.cjs');
|
|
31
30
|
var theme = require('../theme/theme.cjs');
|
|
31
|
+
var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
|
|
32
32
|
|
|
33
33
|
var _excluded = ["placeholder", "disabled", "defaultValue", "onChange", "value", "className", "style", "use"];
|
|
34
34
|
var styles = {
|
|
@@ -62,10 +62,10 @@ var RichTextEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
62
62
|
_useMessage2 = _slicedToArray(_useMessage, 2),
|
|
63
63
|
messager = _useMessage2[0],
|
|
64
64
|
holder = _useMessage2[1];
|
|
65
|
-
var theme$1 = hooks$1.useTheme();
|
|
66
65
|
var controlledStatePluginRef = React.useRef(null);
|
|
67
66
|
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
68
67
|
var defaultValue = value !== null && value !== void 0 ? value : _defaultValue;
|
|
68
|
+
var themeColorVars = useThemeColorVars.useThemeColorVars(["primary", "on-primary", "on-surface", "surface-container", "surface-container-highest", "outline", "outline-variant"]);
|
|
69
69
|
var styled = {
|
|
70
70
|
editor: stylex.props(styles.editor, disabled && styles.disabled, theme.$body.medium),
|
|
71
71
|
textarea: {
|
|
@@ -115,15 +115,7 @@ var RichTextEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
115
115
|
initialConfig: initialConfig
|
|
116
116
|
}, /*#__PURE__*/React.createElement("div", {
|
|
117
117
|
className: className.stringify(classNames["default"], className$1, styled.editor.className),
|
|
118
|
-
style: _objectSpread(_objectSpread(_objectSpread({}, styled.editor.style), style),
|
|
119
|
-
"--color-primary": theme$1.colors.primary,
|
|
120
|
-
"--color-on-primary": theme$1.colors["on-primary"],
|
|
121
|
-
"--color-on-surface": theme$1.colors["on-surface"],
|
|
122
|
-
"--color-surface-container": theme$1.colors["surface-container"],
|
|
123
|
-
"--color-surface-container-highest": theme$1.colors["surface-container-highest"],
|
|
124
|
-
"--color-outline": theme$1.colors.outline,
|
|
125
|
-
"--color-outline-variant": theme$1.colors["outline-variant"]
|
|
126
|
-
})
|
|
118
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styled.editor.style), style), themeColorVars)
|
|
127
119
|
}, /*#__PURE__*/React.createElement(index.default, null), !disabled && /*#__PURE__*/React.createElement(index$1.default, null), /*#__PURE__*/React.createElement(LexicalRichTextPlugin.RichTextPlugin, {
|
|
128
120
|
contentEditable: /*#__PURE__*/React.createElement(LexicalContentEditable.ContentEditable, {
|
|
129
121
|
className: className.stringify(classNames.textarea, styled.textarea.className),
|
|
@@ -17,7 +17,6 @@ import { useIdentity, useDefault } from '@aiszlab/relax';
|
|
|
17
17
|
import { useMessage } from '../message/hooks.mjs';
|
|
18
18
|
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.17.5/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
19
19
|
import { stringify } from '@aiszlab/relax/class-name';
|
|
20
|
-
import { useTheme } from '../theme/hooks.mjs';
|
|
21
20
|
import ToolbarPlugin from './plugins/toolbar/index.mjs';
|
|
22
21
|
import MarkdownShortcutPlugin, { TRANSFORMERS } from './plugins/markdown-shortcut/index.mjs';
|
|
23
22
|
import { $convertFromMarkdownString } from '@lexical/markdown';
|
|
@@ -25,6 +24,7 @@ import { CLASS_NAMES, Context } from './context.mjs';
|
|
|
25
24
|
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
26
25
|
import { usingEditor } from './utils.mjs';
|
|
27
26
|
import { $body } from '../theme/theme.mjs';
|
|
27
|
+
import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
|
|
28
28
|
|
|
29
29
|
var _excluded = ["placeholder", "disabled", "defaultValue", "onChange", "value", "className", "style", "use"];
|
|
30
30
|
var styles = {
|
|
@@ -58,10 +58,10 @@ var RichTextEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
58
58
|
_useMessage2 = _slicedToArray(_useMessage, 2),
|
|
59
59
|
messager = _useMessage2[0],
|
|
60
60
|
holder = _useMessage2[1];
|
|
61
|
-
var theme = useTheme();
|
|
62
61
|
var controlledStatePluginRef = useRef(null);
|
|
63
62
|
var classNames = useClassNames(CLASS_NAMES);
|
|
64
63
|
var defaultValue = value !== null && value !== void 0 ? value : _defaultValue;
|
|
64
|
+
var themeColorVars = useThemeColorVars(["primary", "on-primary", "on-surface", "surface-container", "surface-container-highest", "outline", "outline-variant"]);
|
|
65
65
|
var styled = {
|
|
66
66
|
editor: props(styles.editor, disabled && styles.disabled, $body.medium),
|
|
67
67
|
textarea: {
|
|
@@ -111,15 +111,7 @@ var RichTextEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
111
111
|
initialConfig: initialConfig
|
|
112
112
|
}, /*#__PURE__*/React.createElement("div", {
|
|
113
113
|
className: stringify(classNames["default"], className, styled.editor.className),
|
|
114
|
-
style: _objectSpread(_objectSpread(_objectSpread({}, styled.editor.style), style),
|
|
115
|
-
"--color-primary": theme.colors.primary,
|
|
116
|
-
"--color-on-primary": theme.colors["on-primary"],
|
|
117
|
-
"--color-on-surface": theme.colors["on-surface"],
|
|
118
|
-
"--color-surface-container": theme.colors["surface-container"],
|
|
119
|
-
"--color-surface-container-highest": theme.colors["surface-container-highest"],
|
|
120
|
-
"--color-outline": theme.colors.outline,
|
|
121
|
-
"--color-outline-variant": theme.colors["outline-variant"]
|
|
122
|
-
})
|
|
114
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styled.editor.style), style), themeColorVars)
|
|
123
115
|
}, /*#__PURE__*/React.createElement(MarkdownShortcutPlugin, null), !disabled && /*#__PURE__*/React.createElement(ToolbarPlugin, null), /*#__PURE__*/React.createElement(RichTextPlugin, {
|
|
124
116
|
contentEditable: /*#__PURE__*/React.createElement(ContentEditable, {
|
|
125
117
|
className: stringify(classNames.textarea, styled.textarea.className),
|
|
@@ -16,10 +16,7 @@ var CLASS_NAMES = {
|
|
|
16
16
|
panels: "tabs__panels",
|
|
17
17
|
panel: "tabs__panel"
|
|
18
18
|
};
|
|
19
|
-
var Context = /*#__PURE__*/React.createContext(
|
|
20
|
-
items: [],
|
|
21
|
-
classNames: CLASS_NAMES
|
|
22
|
-
});
|
|
19
|
+
var Context = /*#__PURE__*/React.createContext(null);
|
|
23
20
|
|
|
24
21
|
exports.CLASS_NAMES = CLASS_NAMES;
|
|
25
22
|
exports.Context = Context;
|
|
@@ -13,6 +13,6 @@ export declare const CLASS_NAMES: {
|
|
|
13
13
|
readonly panels: "tabs__panels";
|
|
14
14
|
readonly panel: "tabs__panel";
|
|
15
15
|
};
|
|
16
|
-
export declare const Context: import("react").Context<ContextValue & {
|
|
16
|
+
export declare const Context: import("react").Context<(ContextValue & {
|
|
17
17
|
classNames: typeof CLASS_NAMES;
|
|
18
|
-
}>;
|
|
18
|
+
}) | null>;
|
|
@@ -14,9 +14,6 @@ var CLASS_NAMES = {
|
|
|
14
14
|
panels: "tabs__panels",
|
|
15
15
|
panel: "tabs__panel"
|
|
16
16
|
};
|
|
17
|
-
var Context = /*#__PURE__*/createContext(
|
|
18
|
-
items: [],
|
|
19
|
-
classNames: CLASS_NAMES
|
|
20
|
-
});
|
|
17
|
+
var Context = /*#__PURE__*/createContext(null);
|
|
21
18
|
|
|
22
19
|
export { CLASS_NAMES, Context };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var relax = require('@aiszlab/relax');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description
|
|
9
|
+
* count dom ele size
|
|
10
|
+
*/
|
|
11
|
+
var useNavigation = function useNavigation() {
|
|
12
|
+
var navigatorRef = React.useRef(null);
|
|
13
|
+
var tabsRef = React.useRef(null);
|
|
14
|
+
var _useState = React.useState(0),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
offset = _useState2[0],
|
|
17
|
+
setOffset = _useState2[1];
|
|
18
|
+
// navigator size
|
|
19
|
+
var _useState3 = React.useState(0),
|
|
20
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
21
|
+
navigatorSize = _useState4[0],
|
|
22
|
+
setNavigatorSize = _useState4[1];
|
|
23
|
+
// tabs size
|
|
24
|
+
var _useState5 = React.useState(0),
|
|
25
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
26
|
+
tabsSize = _useState6[0],
|
|
27
|
+
setTabsSize = _useState6[1];
|
|
28
|
+
var _useMemo = React.useMemo(function () {
|
|
29
|
+
return {
|
|
30
|
+
maxOffset: Math.max(0, tabsSize - navigatorSize),
|
|
31
|
+
minOffset: 0
|
|
32
|
+
};
|
|
33
|
+
}, [navigatorSize, tabsSize]),
|
|
34
|
+
maxOffset = _useMemo.maxOffset,
|
|
35
|
+
minOffset = _useMemo.minOffset;
|
|
36
|
+
// handle scroll
|
|
37
|
+
var scrollNavigation = relax.useEvent(function (delta) {
|
|
38
|
+
setOffset(relax.clamp(delta, minOffset, maxOffset));
|
|
39
|
+
});
|
|
40
|
+
var resize = relax.useEvent(function () {
|
|
41
|
+
var _navigatorRef$current, _navigatorRef$current2, _tabsRef$current$getB, _tabsRef$current;
|
|
42
|
+
var _navigatorSize = (_navigatorRef$current = (_navigatorRef$current2 = navigatorRef.current) === null || _navigatorRef$current2 === void 0 ? void 0 : _navigatorRef$current2.getBoundingClientRect().width) !== null && _navigatorRef$current !== void 0 ? _navigatorRef$current : 0;
|
|
43
|
+
var _tabsSize = (_tabsRef$current$getB = (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 ? void 0 : _tabsRef$current.getBoundingClientRect().width) !== null && _tabsRef$current$getB !== void 0 ? _tabsRef$current$getB : 0;
|
|
44
|
+
setNavigatorSize(_navigatorSize);
|
|
45
|
+
setTabsSize(_tabsSize);
|
|
46
|
+
scrollNavigation(0);
|
|
47
|
+
});
|
|
48
|
+
var _useMemo2 = React.useMemo(function () {
|
|
49
|
+
return {
|
|
50
|
+
isLeadingOverflow: offset > minOffset,
|
|
51
|
+
isTrailingOverflow: offset < maxOffset
|
|
52
|
+
};
|
|
53
|
+
}, [minOffset, maxOffset, offset]),
|
|
54
|
+
isLeadingOverflow = _useMemo2.isLeadingOverflow,
|
|
55
|
+
isTrailingOverflow = _useMemo2.isTrailingOverflow;
|
|
56
|
+
// if window resize
|
|
57
|
+
// re-calculate offsets range
|
|
58
|
+
relax.useResize(resize);
|
|
59
|
+
// mouse wheel
|
|
60
|
+
var scrollByWheel = relax.useEvent(function (event) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
var deltaY = event.deltaY;
|
|
63
|
+
scrollNavigation(offset + deltaY);
|
|
64
|
+
});
|
|
65
|
+
// calculate size once at mounting step
|
|
66
|
+
relax.useMount(function () {
|
|
67
|
+
resize();
|
|
68
|
+
});
|
|
69
|
+
relax.useMounted(function () {
|
|
70
|
+
var _navigatorRef$current3;
|
|
71
|
+
(_navigatorRef$current3 = navigatorRef.current) === null || _navigatorRef$current3 === void 0 || _navigatorRef$current3.addEventListener("wheel", scrollByWheel);
|
|
72
|
+
return function () {
|
|
73
|
+
var _navigatorRef$current4;
|
|
74
|
+
(_navigatorRef$current4 = navigatorRef.current) === null || _navigatorRef$current4 === void 0 || _navigatorRef$current4.removeEventListener("wheel", scrollByWheel);
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
navigatorRef: navigatorRef,
|
|
79
|
+
tabsRef: tabsRef,
|
|
80
|
+
offset: offset,
|
|
81
|
+
isLeadingOverflow: isLeadingOverflow,
|
|
82
|
+
isTrailingOverflow: isTrailingOverflow,
|
|
83
|
+
scrollNavigation: scrollNavigation
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.useNavigation = useNavigation;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* count dom ele size
|
|
4
|
+
*/
|
|
5
|
+
export declare const useNavigation: () => {
|
|
6
|
+
navigatorRef: import("react").RefObject<HTMLDivElement | null>;
|
|
7
|
+
tabsRef: import("react").RefObject<HTMLDivElement | null>;
|
|
8
|
+
offset: number;
|
|
9
|
+
isLeadingOverflow: boolean;
|
|
10
|
+
isTrailingOverflow: boolean;
|
|
11
|
+
scrollNavigation: (delta: number) => void;
|
|
12
|
+
};
|