zs_library 0.2.3 → 0.3.4

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 (67) hide show
  1. package/README.md +0 -33
  2. package/dist/{Desktop → components/Desktop}/ContextMenu/index.d.ts +1 -2
  3. package/dist/{Desktop → components/Desktop}/Items/GroupItem.d.ts +1 -2
  4. package/dist/{Desktop → components/Desktop}/Items/Modal/GroupItemModal.d.ts +1 -2
  5. package/dist/{Desktop → components/Desktop}/Items/Modal/InfoModal.d.ts +0 -1
  6. package/dist/{Desktop → components/Desktop}/Items/SortableItem.d.ts +3 -4
  7. package/dist/{Desktop → components/Desktop}/Sortable.d.ts +3 -5
  8. package/dist/{Desktop → components/Desktop}/context/config/context.d.ts +2 -2
  9. package/dist/components/Desktop/context/config/hooks.d.ts +1 -0
  10. package/dist/{Desktop → components/Desktop}/context/state/context.d.ts +2 -2
  11. package/dist/components/Desktop/context/state/hooks.d.ts +1 -0
  12. package/dist/{Desktop → components/Desktop}/index.d.ts +1 -2
  13. package/dist/components/Desktop/utils.d.ts +33 -0
  14. package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/index.d.ts +146 -0
  15. package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/types/types.d.ts +172 -0
  16. package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/ui.d.ts +132 -0
  17. package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/uploader.d.ts +60 -0
  18. package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/utils/dom.d.ts +10 -0
  19. package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/utils/isPromise.d.ts +7 -0
  20. package/dist/components/Editor/components/BlockTools/TextAndTypography/Alert/index.d.ts +238 -0
  21. package/dist/components/Editor/components/BlockTools/TextAndTypography/Delimiter/index.d.ts +270 -0
  22. package/dist/components/Editor/components/BlockTools/TextAndTypography/Header/index.d.ts +249 -0
  23. package/dist/components/Editor/components/BlockTools/TextAndTypography/Paragraph/index.d.ts +189 -0
  24. package/dist/components/Editor/components/BlockTools/TextAndTypography/Paragraph/utils/makeFragment.d.ts +7 -0
  25. package/dist/components/Editor/components/BlockTools/TextAndTypography/Quote/index.d.ts +282 -0
  26. package/dist/components/Editor/components/BlockTuneTools/Delete/index.d.ts +33 -0
  27. package/dist/components/Editor/components/BlockTuneTools/MoveDown/index.d.ts +37 -0
  28. package/dist/components/Editor/components/BlockTuneTools/MoveUp/index.d.ts +37 -0
  29. package/dist/components/Editor/index.d.ts +9 -0
  30. package/dist/components/MdEditor/i18n/index.d.ts +4 -0
  31. package/dist/components/MdEditor/i18n/zh_CN.d.ts +5 -0
  32. package/dist/components/MdEditor/index.d.ts +54 -0
  33. package/dist/components/index.d.ts +2 -0
  34. package/dist/index.d.ts +1 -2
  35. package/dist/index.js +1651 -2
  36. package/package.json +57 -67
  37. package/.eslintrc.js +0 -3
  38. package/LICENSE +0 -21
  39. package/dist/Desktop/ContextMenu/index.js +0 -209
  40. package/dist/Desktop/Items/GroupItem.js +0 -179
  41. package/dist/Desktop/Items/Modal/GroupItemModal.js +0 -159
  42. package/dist/Desktop/Items/Modal/InfoModal.js +0 -34
  43. package/dist/Desktop/Items/SortableItem.js +0 -78
  44. package/dist/Desktop/Sortable.js +0 -185
  45. package/dist/Desktop/config.js +0 -16
  46. package/dist/Desktop/context/config/context.js +0 -36
  47. package/dist/Desktop/context/config/hooks.d.ts +0 -1
  48. package/dist/Desktop/context/config/hooks.js +0 -6
  49. package/dist/Desktop/context/state/context.js +0 -362
  50. package/dist/Desktop/context/state/hooks.d.ts +0 -1
  51. package/dist/Desktop/context/state/hooks.js +0 -6
  52. package/dist/Desktop/index.js +0 -40
  53. package/dist/Desktop/style.js +0 -4
  54. package/dist/Desktop/theme.js +0 -28
  55. package/dist/Desktop/types.js +0 -1
  56. package/dist/Desktop/utils.d.ts +0 -33
  57. package/dist/Desktop/utils.js +0 -37
  58. package/dist/Editor/Blocks/CodeBlock/CodeBlock.d.ts +0 -23
  59. package/dist/Editor/Blocks/CodeBlock/CodeBlock.js +0 -196
  60. package/dist/Editor/Blocks/CodeBlock/index.d.ts +0 -30
  61. package/dist/Editor/Blocks/CodeBlock/index.js +0 -21
  62. package/dist/Editor/index.d.ts +0 -17
  63. package/dist/Editor/index.js +0 -132
  64. /package/dist/{Desktop → components/Desktop}/config.d.ts +0 -0
  65. /package/dist/{Desktop → components/Desktop}/style.d.ts +0 -0
  66. /package/dist/{Desktop → components/Desktop}/theme.d.ts +0 -0
  67. /package/dist/{Desktop → components/Desktop}/types.d.ts +0 -0
@@ -1,362 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- import { useDebounceEffect, useLocalStorageState } from 'ahooks';
18
- import React, { createContext, useEffect, useRef, useState } from 'react';
19
- import { v4 as uuidv4 } from 'uuid';
20
- import { configMap } from "../../config";
21
- import SortableUtils from "../../utils";
22
- export var SortableStateContext = /*#__PURE__*/createContext({
23
- list: [],
24
- setList: function setList() {},
25
- contextMenu: null,
26
- setContextMenu: function setContextMenu() {},
27
- listStatus: null,
28
- setListStatus: function setListStatus() {},
29
- contextMenuFuns: function contextMenuFuns() {},
30
- hideContextMenu: function hideContextMenu() {},
31
- showInfoItemData: null,
32
- setShowInfoItemData: function setShowInfoItemData() {},
33
- openGroupItemData: null,
34
- setOpenGroupItemData: function setOpenGroupItemData() {},
35
- longPressTriggered: false,
36
- updateItem: function updateItem() {},
37
- updateItemConfig: function updateItemConfig() {},
38
- removeItem: function removeItem() {},
39
- addItem: function addItem() {},
40
- moveItemId: null,
41
- setMoveItemId: function setMoveItemId() {},
42
- moveTargetId: null,
43
- setMoveTargetId: function setMoveTargetId() {}
44
- });
45
- export var SortableStateProvider = function SortableStateProvider(props) {
46
- var children = props.children,
47
- _props$list = props.list,
48
- propList = _props$list === void 0 ? [] : _props$list,
49
- propOnChange = props.onChange,
50
- _props$storageKey = props.storageKey,
51
- storageKey = _props$storageKey === void 0 ? 'ZS_LIBRARY_DESKTOP_SORTABLE_CONFIG' : _props$storageKey,
52
- _props$enableCaching = props.enableCaching,
53
- enableCaching = _props$enableCaching === void 0 ? true : _props$enableCaching;
54
- var _useState = useState(),
55
- _useState2 = _slicedToArray(_useState, 2),
56
- contextMenuTimer = _useState2[0],
57
- setContextMenuTimer = _useState2[1];
58
- var _useState3 = useState(),
59
- _useState4 = _slicedToArray(_useState3, 2),
60
- pressTimer = _useState4[0],
61
- setPressTimer = _useState4[1];
62
- var _useState5 = useState(null),
63
- _useState6 = _slicedToArray(_useState5, 2),
64
- listStatus = _useState6[0],
65
- setListStatus = _useState6[1];
66
- var listStatusRef = useRef(listStatus);
67
- var _useState7 = useState(null),
68
- _useState8 = _slicedToArray(_useState7, 2),
69
- contextMenu = _useState8[0],
70
- setContextMenu = _useState8[1];
71
- var _useState9 = useState([]),
72
- _useState10 = _slicedToArray(_useState9, 2),
73
- list = _useState10[0],
74
- setList = _useState10[1];
75
- var _useState11 = useState(null),
76
- _useState12 = _slicedToArray(_useState11, 2),
77
- showInfoItemData = _useState12[0],
78
- setShowInfoItemData = _useState12[1];
79
- var _useState13 = useState(null),
80
- _useState14 = _slicedToArray(_useState13, 2),
81
- openGroupItemData = _useState14[0],
82
- setOpenGroupItemData = _useState14[1];
83
- var _useState15 = useState(false),
84
- _useState16 = _slicedToArray(_useState15, 2),
85
- longPressTriggered = _useState16[0],
86
- setLongPressTriggered = _useState16[1];
87
- var _useState17 = useState(null),
88
- _useState18 = _slicedToArray(_useState17, 2),
89
- moveItemId = _useState18[0],
90
- setMoveItemId = _useState18[1];
91
- var _useState19 = useState(null),
92
- _useState20 = _slicedToArray(_useState19, 2),
93
- moveTargetId = _useState20[0],
94
- setMoveTargetId = _useState20[1];
95
- var _useState21 = useState(false),
96
- _useState22 = _slicedToArray(_useState21, 2),
97
- init = _useState22[0],
98
- setInit = _useState22[1];
99
- var _useLocalStorageState = useLocalStorageState(storageKey, {
100
- defaultValue: [],
101
- listenStorageChange: true
102
- }),
103
- _useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 2),
104
- localList = _useLocalStorageState2[0],
105
- setLocalList = _useLocalStorageState2[1];
106
- var hideContextMenu = function hideContextMenu() {
107
- setContextMenu(null);
108
- clearTimeout(contextMenuTimer);
109
- setContextMenuTimer(undefined);
110
- listStatusRef.current = null;
111
- };
112
- var getItemRectAndSetContextMenu = function getItemRectAndSetContextMenu(e, data) {
113
- setContextMenu(_objectSpread(_objectSpread({}, e), {}, {
114
- pageX: e.pageX,
115
- pageY: e.pageY,
116
- data: data
117
- }));
118
- clearTimeout(contextMenuTimer);
119
- };
120
- var contextMenuFuns = function contextMenuFuns(data) {
121
- var enable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
122
- var _data$config = data.config,
123
- config = _data$config === void 0 ? {} : _data$config;
124
- if (config.allowContextMenu === false) {
125
- return {};
126
- }
127
- return {
128
- onMouseDown: function onMouseDown(e) {
129
- setContextMenuTimer(setTimeout(function () {
130
- if (!enable) return;
131
- // 解决闭包导致拖拽时右键菜单不消失的问题
132
- if (listStatusRef.current !== null) return;
133
- getItemRectAndSetContextMenu(e, data);
134
- }, 800));
135
- setLongPressTriggered(false);
136
- setPressTimer(setTimeout(function () {
137
- setLongPressTriggered(true);
138
- // 这里处理长按事件
139
- }, 800));
140
- },
141
- onMouseUp: function onMouseUp() {
142
- clearTimeout(pressTimer);
143
- setPressTimer(undefined);
144
- clearTimeout(contextMenuTimer);
145
- setContextMenuTimer(undefined);
146
- },
147
- onContextMenu: function onContextMenu(e) {
148
- if (!enable) return;
149
- e.preventDefault();
150
- getItemRectAndSetContextMenu(e, data);
151
- }
152
- };
153
- };
154
- var _setList = function _setList(newList, parentIds) {
155
- var _parentIds = _toConsumableArray(parentIds || []);
156
- if (_parentIds.length > 0) {
157
- setList(function (oldList) {
158
- var _items = _toConsumableArray(oldList);
159
- var updateChild = function updateChild(_list) {
160
- var parentId = _parentIds.shift();
161
- var parent = _list.find(function (item) {
162
- return item.id === parentId;
163
- });
164
- var parentIndex = _list.findIndex(function (item) {
165
- return item.id === parentId;
166
- });
167
-
168
- /** 当第一个 parentId 匹配到,但剩余 parentIds > 0 表明需要继续向下匹配 */
169
- if (_parentIds.length && parent) {
170
- var _parent$children;
171
- /** 如果当前数据实际只有一个子数据,则取消 group 状态 */
172
- if (((_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.filter(function (i) {
173
- return !newList.some(function (k) {
174
- return k.id === i.id;
175
- });
176
- }).length) === 1 && newList.length === 1) {
177
- var current = _objectSpread({}, newList[0]);
178
- _list.splice(parentIndex, 1, current);
179
- propOnChange === null || propOnChange === void 0 || propOnChange(_list);
180
- return _list;
181
- }
182
- parent.children = updateChild(parent.children || []);
183
- _list.splice(parentIndex, 1, parent);
184
- propOnChange === null || propOnChange === void 0 || propOnChange(_list);
185
- return _list;
186
- }
187
-
188
- /** 当 parentIds = 0 且匹配到,表明当前为实际需要更新的数据 */
189
- if (parent) {
190
- var _parent$children2;
191
- /** 没有子数据,且有新增数据,则将当前数据更改为 group 类型 */
192
- if (!((_parent$children2 = parent.children) !== null && _parent$children2 !== void 0 && _parent$children2.length) && newList.length) {
193
- var _current = _objectSpread({}, parent);
194
- parent.data = {
195
- name: '文件夹'
196
- };
197
- parent.type = 'group';
198
- parent.children = [_current].concat(_toConsumableArray(newList));
199
- parent.id = uuidv4();
200
- _list.splice(parentIndex, 1, parent);
201
- propOnChange === null || propOnChange === void 0 || propOnChange(_list);
202
- return _list;
203
- }
204
-
205
- // ! 当前已经是 group 时,直接将 children 更改为最新的 list
206
- parent.children = SortableUtils.uniqueArray(newList);
207
- _list.splice(parentIndex, 1, parent);
208
- propOnChange === null || propOnChange === void 0 || propOnChange(_list);
209
- return _list;
210
- }
211
- return SortableUtils.uniqueArray(newList);
212
- };
213
- return SortableUtils.uniqueArray(updateChild(_items));
214
- });
215
- } else {
216
- var _newList = SortableUtils.uniqueArray(newList);
217
-
218
- // ! 根节点直接排序
219
- propOnChange === null || propOnChange === void 0 || propOnChange(_newList);
220
- setList(_newList);
221
- }
222
- };
223
- var updateItemConfig = function updateItemConfig(id, config) {
224
- setList(function (prevList) {
225
- var _list = _toConsumableArray(prevList);
226
- var updateItem = function updateItem(list) {
227
- for (var i = 0; i < list.length; i++) {
228
- var _list$i$children;
229
- if (list[i].id === id) {
230
- list[i].config = config;
231
- break;
232
- } else if (((_list$i$children = list[i].children) === null || _list$i$children === void 0 ? void 0 : _list$i$children.length) !== undefined) {
233
- updateItem(list[i].children);
234
- }
235
- }
236
- };
237
- updateItem(_list);
238
- propOnChange === null || propOnChange === void 0 || propOnChange(_list);
239
- return _list;
240
- });
241
- };
242
- var updateItem = function updateItem(id, data) {
243
- setList(function (prevList) {
244
- var _list = _toConsumableArray(prevList);
245
- var updateItem = function updateItem(list) {
246
- for (var i = 0; i < list.length; i++) {
247
- var _list$i$children2;
248
- if (list[i].id === id) {
249
- list[i].data = data;
250
- break;
251
- } else if (((_list$i$children2 = list[i].children) === null || _list$i$children2 === void 0 ? void 0 : _list$i$children2.length) !== undefined) {
252
- updateItem(list[i].children);
253
- }
254
- }
255
- };
256
- updateItem(_list);
257
- propOnChange === null || propOnChange === void 0 || propOnChange(_list);
258
- return _list;
259
- });
260
- };
261
- var removeItem = function removeItem(id) {
262
- setList(function (prevList) {
263
- var _list = _toConsumableArray(prevList);
264
- var removeItem = function removeItem(list) {
265
- for (var i = 0; i < list.length; i++) {
266
- var _list$i$children3;
267
- if (list[i].id === id) {
268
- list.splice(i, 1);
269
- break;
270
- } else if (((_list$i$children3 = list[i].children) === null || _list$i$children3 === void 0 ? void 0 : _list$i$children3.length) !== undefined) {
271
- removeItem(list[i].children);
272
- }
273
- }
274
- };
275
- removeItem(_list);
276
- propOnChange === null || propOnChange === void 0 || propOnChange(_list);
277
- return _list;
278
- });
279
- };
280
- var addItem = function addItem(data, parentIds) {
281
- var _list = _toConsumableArray(list);
282
-
283
- // 根据 parentIds 递归查找,放置到对应的父级下
284
- var addToChild = function addToChild(list, parentIds) {
285
- var parentId = parentIds.shift();
286
- var parent = list.find(function (item) {
287
- return item.id === parentId;
288
- });
289
- var parentIndex = list.findIndex(function (item) {
290
- return item.id === parentId;
291
- });
292
- if (!parent) {
293
- return list;
294
- } else {
295
- if (parentIds.length) {
296
- parent.children = addToChild(parent.children || [], parentIds);
297
- } else {
298
- var _data$type, _parent$children3, _data$config2;
299
- var type = (_data$type = data === null || data === void 0 ? void 0 : data.type) !== null && _data$type !== void 0 ? _data$type : 'app';
300
- parent.children = [].concat(_toConsumableArray((_parent$children3 = parent.children) !== null && _parent$children3 !== void 0 ? _parent$children3 : []), [_objectSpread(_objectSpread({}, data), {}, {
301
- id: uuidv4(),
302
- config: (_data$config2 = data === null || data === void 0 ? void 0 : data.config) !== null && _data$config2 !== void 0 ? _data$config2 : configMap[type]
303
- })]);
304
- }
305
- list.splice(parentIndex, 1, parent);
306
- return list;
307
- }
308
- };
309
- setList(addToChild(_list, parentIds));
310
- };
311
- useEffect(function () {
312
- if ((propList === null || propList === void 0 ? void 0 : propList.length) > 0 && list.length === 0) {
313
- _setList(propList);
314
- }
315
- // eslint-disable-next-line
316
- }, [propList]);
317
- useEffect(function () {
318
- listStatusRef.current = listStatus;
319
- if (listStatus !== null) {
320
- hideContextMenu();
321
- }
322
- // eslint-disable-next-line
323
- }, [listStatus]);
324
- useEffect(function () {
325
- if (!enableCaching) return;
326
- if (localList !== null && localList !== void 0 && localList.length && !init) {
327
- _setList(localList);
328
- setInit(true);
329
- }
330
- }, [localList, init, enableCaching]);
331
- useDebounceEffect(function () {
332
- if (!enableCaching) return;
333
- setLocalList(list);
334
- }, [list, enableCaching], {
335
- wait: 1000
336
- });
337
- return /*#__PURE__*/React.createElement(SortableStateContext.Provider, {
338
- value: {
339
- list: list,
340
- setList: _setList,
341
- contextMenu: contextMenu,
342
- setContextMenu: setContextMenu,
343
- listStatus: listStatus,
344
- setListStatus: setListStatus,
345
- contextMenuFuns: contextMenuFuns,
346
- hideContextMenu: hideContextMenu,
347
- showInfoItemData: showInfoItemData,
348
- setShowInfoItemData: setShowInfoItemData,
349
- openGroupItemData: openGroupItemData,
350
- setOpenGroupItemData: setOpenGroupItemData,
351
- longPressTriggered: longPressTriggered,
352
- updateItemConfig: updateItemConfig,
353
- updateItem: updateItem,
354
- removeItem: removeItem,
355
- addItem: addItem,
356
- moveItemId: moveItemId,
357
- setMoveItemId: setMoveItemId,
358
- moveTargetId: moveTargetId,
359
- setMoveTargetId: setMoveTargetId
360
- }
361
- }, children);
362
- };
@@ -1 +0,0 @@
1
- export declare const useSortableState: () => import("./context").SortableState;
@@ -1,6 +0,0 @@
1
- import { useContext } from 'react';
2
- import { SortableStateContext } from "./context";
3
- export var useSortableState = function useSortableState() {
4
- var state = useContext(SortableStateContext);
5
- return state;
6
- };
@@ -1,40 +0,0 @@
1
- var _excluded = ["list", "onChange", "storageKey", "enableCaching", "theme", "noLetters", "contextMenu", "contextMenuBuilder", "itemBuilder", "itemIconBuilder", "pagingDotBuilder", "pagingDotsBuilder"];
2
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- import React from 'react';
5
- import Sortable from "./Sortable";
6
- import { SortableConfigProvider } from "./context/config/context";
7
- import { SortableStateProvider } from "./context/state/context";
8
- var Desktop = function Desktop(props) {
9
- var list = props.list,
10
- onChange = props.onChange,
11
- storageKey = props.storageKey,
12
- enableCaching = props.enableCaching,
13
- theme = props.theme,
14
- noLetters = props.noLetters,
15
- contextMenu = props.contextMenu,
16
- contextMenuBuilder = props.contextMenuBuilder,
17
- itemBuilder = props.itemBuilder,
18
- itemIconBuilder = props.itemIconBuilder,
19
- pagingDotBuilder = props.pagingDotBuilder,
20
- pagingDotsBuilder = props.pagingDotsBuilder,
21
- rest = _objectWithoutProperties(props, _excluded);
22
- var state = {
23
- list: list,
24
- onChange: onChange,
25
- storageKey: storageKey,
26
- enableCaching: enableCaching
27
- };
28
- var config = {
29
- theme: theme,
30
- noLetters: noLetters,
31
- contextMenu: contextMenu,
32
- pagingDotsBuilder: pagingDotsBuilder,
33
- pagingDotBuilder: pagingDotBuilder,
34
- itemBuilder: itemBuilder,
35
- itemIconBuilder: itemIconBuilder,
36
- contextMenuBuilder: contextMenuBuilder
37
- };
38
- return /*#__PURE__*/React.createElement(SortableStateProvider, state, /*#__PURE__*/React.createElement(SortableConfigProvider, config, /*#__PURE__*/React.createElement(Sortable, rest)));
39
- };
40
- export default Desktop;
@@ -1,4 +0,0 @@
1
- var _templateObject;
2
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
- import { css } from '@emotion/css';
4
- export var ghostClass = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px;\n transition: all 0.2s;\n > div {\n transition: all 0.2s;\n border: 2px solid aquamarine;\n background-color: transparent;\n > div {\n opacity: 0;\n transition: all 0.2s;\n }\n }\n"])));
@@ -1,28 +0,0 @@
1
- export var themeLight = {
2
- token: {
3
- itemNameColor: '#1a1a1a',
4
- itemIconBackgroundColor: 'white',
5
- itemIconShadowColor: 'rgba(0, 0, 0, 0.1)',
6
- groupItemIconBackgroundColor: 'rgba(255, 255, 255, 0.1)',
7
- groupItemIconShadowColor: 'rgba(0, 0, 0, 0.1)',
8
- groupItemModalBackgroundColor: 'rgba(255, 255, 255, 0.8)',
9
- contextMenuTextColor: 'black',
10
- contextMenuActiveColor: '#f3f4f6',
11
- contextMenuBackgroundColor: 'white',
12
- contextMenuShadowColor: 'rgba(0, 0, 0, 0.1)'
13
- }
14
- };
15
- export var themeDark = {
16
- token: {
17
- itemNameColor: 'white',
18
- itemIconBackgroundColor: '#1f2937',
19
- itemIconShadowColor: 'rgba(0, 0, 0, 0.1)',
20
- groupItemIconBackgroundColor: 'rgba(0, 0, 0, 0.1)',
21
- groupItemIconShadowColor: 'rgba(0, 0, 0, 0.1)',
22
- groupItemModalBackgroundColor: 'rgba(0, 0, 0, 0.1)',
23
- contextMenuTextColor: 'white',
24
- contextMenuActiveColor: '#1a1a1a',
25
- contextMenuBackgroundColor: '#1a1a1a',
26
- contextMenuShadowColor: 'rgba(255, 255, 255, 0.1)'
27
- }
28
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import { Theme } from './theme';
2
- import { SortItem } from './types';
3
- declare class SortableUtils {
4
- /** 清理重复id */
5
- static uniqueArray: (array: SortItem[]) => SortItem<any, any>[];
6
- static getTheme: (theme?: Theme) => {
7
- light: {
8
- itemNameColor?: string | undefined;
9
- itemIconBackgroundColor?: string | undefined;
10
- itemIconShadowColor?: string | undefined;
11
- groupItemIconBackgroundColor?: string | undefined;
12
- groupItemIconShadowColor?: string | undefined;
13
- groupItemModalBackgroundColor?: string | undefined;
14
- contextMenuTextColor?: string | undefined;
15
- contextMenuActiveColor?: string | undefined;
16
- contextMenuBackgroundColor?: string | undefined;
17
- contextMenuShadowColor?: string | undefined;
18
- };
19
- dark: {
20
- itemNameColor?: string | undefined;
21
- itemIconBackgroundColor?: string | undefined;
22
- itemIconShadowColor?: string | undefined;
23
- groupItemIconBackgroundColor?: string | undefined;
24
- groupItemIconShadowColor?: string | undefined;
25
- groupItemModalBackgroundColor?: string | undefined;
26
- contextMenuTextColor?: string | undefined;
27
- contextMenuActiveColor?: string | undefined;
28
- contextMenuBackgroundColor?: string | undefined;
29
- contextMenuShadowColor?: string | undefined;
30
- };
31
- };
32
- }
33
- export default SortableUtils;
@@ -1,37 +0,0 @@
1
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
- import { themeDark, themeLight } from "./theme";
11
- var SortableUtils = /*#__PURE__*/_createClass(function SortableUtils() {
12
- _classCallCheck(this, SortableUtils);
13
- });
14
- /** 清理重复id */
15
- _defineProperty(SortableUtils, "uniqueArray", function (array) {
16
- return array.reduce(function (acc, current) {
17
- var x = acc.find(function (item) {
18
- return item.id === current.id;
19
- });
20
- if (!x) {
21
- return acc.concat([current]);
22
- } else {
23
- return acc;
24
- }
25
- }, []);
26
- });
27
- _defineProperty(SortableUtils, "getTheme", function (theme) {
28
- var tlt = themeLight.token;
29
- var tdt = themeDark.token;
30
- var tl = _objectSpread(_objectSpread({}, tlt), theme === null || theme === void 0 ? void 0 : theme.token);
31
- var dl = _objectSpread(_objectSpread({}, tdt), theme === null || theme === void 0 ? void 0 : theme.token);
32
- return {
33
- light: tl,
34
- dark: dl
35
- };
36
- });
37
- export default SortableUtils;
@@ -1,23 +0,0 @@
1
- /// <reference types="ace-builds/ace-modules" />
2
- import { ReactCustomBlockRenderProps } from '@blocknote/react';
3
- import '@mantine/core/styles.css';
4
- import 'ace-builds/src-noconflict/ace';
5
- import 'ace-builds/src-noconflict/ext-beautify';
6
- import 'ace-builds/src-noconflict/ext-language_tools';
7
- import 'ace-builds/src-noconflict/mode-css';
8
- import 'ace-builds/src-noconflict/mode-dockerfile';
9
- import 'ace-builds/src-noconflict/mode-html';
10
- import 'ace-builds/src-noconflict/mode-javascript';
11
- import 'ace-builds/src-noconflict/mode-json';
12
- import 'ace-builds/src-noconflict/mode-text';
13
- import 'ace-builds/src-noconflict/mode-typescript';
14
- import 'ace-builds/src-noconflict/theme-cloud9_day';
15
- import 'ace-builds/src-noconflict/theme-cloud9_night';
16
- import 'ace-builds/src-noconflict/theme-cloud_editor';
17
- import 'ace-builds/src-noconflict/theme-cloud_editor_dark';
18
- import 'ace-builds/src-noconflict/theme-github';
19
- import 'ace-builds/src-noconflict/theme-github_dark';
20
- import 'ace-builds/src-noconflict/theme-monokai';
21
- import { FC } from 'react';
22
- declare const CodeBlock: FC<ReactCustomBlockRenderProps<any, any, any>>;
23
- export default CodeBlock;