@antscorp/antsomi-ui 2.0.82 → 2.0.83-text-editor-beta.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.
- package/es/assets/css/main.scss +4 -2
- package/es/components/index.scss +1 -0
- package/es/components/molecules/AccountSelection/AccountListing.js +14 -3
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +5 -1
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +77 -0
- package/es/components/molecules/FontSizeInput/constants.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/constants.js +5 -0
- package/es/components/molecules/FontSizeInput/index.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/index.js +1 -0
- package/es/components/molecules/FontSizeInput/types.d.ts +21 -0
- package/es/components/molecules/FontSizeInput/types.js +1 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -2
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +2550 -938
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +4 -3
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +24 -22
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +1 -2
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +59 -31
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.optimized.d.ts +19 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.optimized.js +233 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +2 -1
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/styled.js +11 -3
- package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -8
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +7 -5
- package/es/components/molecules/VirtualizedMenu/utils.js +12 -18
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/molecules/index.js +1 -0
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -0
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -0
- package/es/components/organism/TextEditor/TextEditor.d.ts +3 -0
- package/es/components/organism/TextEditor/TextEditor.js +239 -0
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +38 -0
- package/es/components/organism/TextEditor/constants.d.ts +135 -0
- package/es/components/organism/TextEditor/constants.js +280 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +41 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +130 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +247 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +31 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
- package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/Color.js +19 -0
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
- package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.js +43 -0
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +32 -0
- package/es/components/organism/TextEditor/extensions/FontSize.js +47 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
- package/es/components/organism/TextEditor/extensions/Highlight.d.ts +1 -0
- package/es/components/organism/TextEditor/extensions/Highlight.js +14 -0
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +28 -0
- package/es/components/organism/TextEditor/extensions/Indent.js +66 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.js +36 -0
- package/es/components/organism/TextEditor/extensions/Link.d.ts +3 -0
- package/es/components/organism/TextEditor/extensions/Link.js +47 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
- package/es/components/organism/TextEditor/extensions/Selection.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/Selection.js +40 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +33 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.js +162 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +31 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.js +35 -0
- package/es/components/organism/TextEditor/hooks/index.d.ts +6 -0
- package/es/components/organism/TextEditor/hooks/index.js +6 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
- package/es/components/organism/TextEditor/hooks/useLinkHandler.d.ts +27 -0
- package/es/components/organism/TextEditor/hooks/useLinkHandler.js +279 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +68 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
- package/es/components/organism/TextEditor/index.d.ts +5 -0
- package/es/components/organism/TextEditor/index.js +2 -0
- package/es/components/organism/TextEditor/index.scss +26 -0
- package/es/components/organism/TextEditor/provider.d.ts +10 -0
- package/es/components/organism/TextEditor/provider.js +20 -0
- package/es/components/organism/TextEditor/store.d.ts +11 -0
- package/es/components/organism/TextEditor/store.js +12 -0
- package/es/components/organism/TextEditor/styled.d.ts +5 -0
- package/es/components/organism/TextEditor/styled.js +69 -0
- package/es/components/organism/TextEditor/types.d.ts +95 -0
- package/es/components/organism/TextEditor/types.js +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +78 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +43 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +120 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +11 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +72 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +51 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +7 -0
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +49 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +14 -0
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +42 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +13 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +42 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +4 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +9 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +22 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +13 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +13 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +15 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +14 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +28 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +20 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +20 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +1 -0
- package/es/components/organism/TextEditor/utils/documentState.d.ts +57 -0
- package/es/components/organism/TextEditor/utils/documentState.js +100 -0
- package/es/components/organism/TextEditor/utils/font.d.ts +84 -0
- package/es/components/organism/TextEditor/utils/font.js +175 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +62 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +304 -0
- package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
- package/es/components/organism/TextEditor/utils/index.js +16 -0
- package/es/components/organism/TextEditor/utils/link.d.ts +100 -0
- package/es/components/organism/TextEditor/utils/link.js +149 -0
- package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
- package/es/components/organism/TextEditor/utils/menu.js +317 -0
- package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
- package/es/components/organism/TextEditor/utils/selection.js +57 -0
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
- package/es/components/organism/TextEditor/utils/smartTag.js +89 -0
- package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
- package/es/components/organism/TextEditor/utils/style.js +193 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/organism/index.scss +1 -0
- package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
- package/es/hooks/useBroadcastedLocalStorage.js +71 -0
- package/es/utils/common.d.ts +6 -9
- package/es/utils/common.js +44 -23
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/tree.d.ts +225 -0
- package/es/utils/tree.js +469 -0
- package/es/utils/web.d.ts +4 -0
- package/es/utils/web.js +25 -0
- package/package.json +29 -3
package/es/utils/tree.js
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree utilities with performance optimizations using level-based operations.
|
|
3
|
+
*
|
|
4
|
+
* Key performance improvements:
|
|
5
|
+
* - Level property enables O(1) depth checks and early exit conditions
|
|
6
|
+
* - Pre-allocated arrays for path operations avoid costly array resizing
|
|
7
|
+
* - Level-based filtering for efficient node selection
|
|
8
|
+
* - Optimized tree traversal with level-aware recursion control
|
|
9
|
+
*
|
|
10
|
+
* @file src/utils/tree.ts
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes a tree structure from a nested format to a flat, relational format.
|
|
14
|
+
* Each node is stored in a map by its ID, and relationships are maintained via `parentId` and `childIds`.
|
|
15
|
+
*
|
|
16
|
+
* @template T The type of data in the tree nodes.
|
|
17
|
+
* @param {TreeNode<T>[]} nodes - An array of root tree nodes in their original nested structure.
|
|
18
|
+
* @returns {NormalizedTreeState<T>} The normalized tree state, containing a map of items and a set of root item IDs.
|
|
19
|
+
*/
|
|
20
|
+
export function normalizeTreeData(nodes) {
|
|
21
|
+
const items = new Map();
|
|
22
|
+
const rootItemIds = new Set();
|
|
23
|
+
/**
|
|
24
|
+
* Recursively visits each node to flatten it.
|
|
25
|
+
* @param {TreeNode<T>} node - The current node to process.
|
|
26
|
+
* @param {string | null} parentId - The ID of the parent of the current node.
|
|
27
|
+
* @param {number} level - The depth/level of the current node.
|
|
28
|
+
*/
|
|
29
|
+
function visit(node, parentId, level) {
|
|
30
|
+
const { children, ...restOfNode } = node;
|
|
31
|
+
const normalizedNode = {
|
|
32
|
+
...restOfNode,
|
|
33
|
+
parentId,
|
|
34
|
+
childIds: children ? children.map(child => child.id) : [],
|
|
35
|
+
level,
|
|
36
|
+
};
|
|
37
|
+
items.set(node.id, normalizedNode);
|
|
38
|
+
if (parentId === null) {
|
|
39
|
+
rootItemIds.add(node.id);
|
|
40
|
+
}
|
|
41
|
+
if (children && children.length > 0) {
|
|
42
|
+
children.forEach(child => visit(child, node.id, level + 1));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
nodes.forEach(node => visit(node, null, 0));
|
|
46
|
+
return { items, rootItemIds };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves all normalized nodes from the items store as an array.
|
|
50
|
+
*
|
|
51
|
+
* @template T The type of data in the nodes.
|
|
52
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
53
|
+
* @returns {NormalizedNode<T>[]} An array of all normalized nodes.
|
|
54
|
+
*/
|
|
55
|
+
export function getAllItems(itemsStore) {
|
|
56
|
+
return Array.from(itemsStore.values());
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Recursively reconstructs a subtree (or a portion of it) from the normalized data,
|
|
60
|
+
* starting from a given item ID.
|
|
61
|
+
*
|
|
62
|
+
* @template T The type of data in the nodes.
|
|
63
|
+
* @param {string} itemId - The ID of the node from which to start reconstructing the subtree.
|
|
64
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
65
|
+
* @param {number} [maxLevels=Infinity] - The maximum number of levels of children to retrieve.
|
|
66
|
+
* @param {number} [startLevel] - The starting level for depth calculation (used internally).
|
|
67
|
+
* @returns {TreeNode<T>[]} An array of reconstructed tree nodes (children of the `itemId` node).
|
|
68
|
+
* Returns an empty array if the item has no children or `maxLevels` is reached.
|
|
69
|
+
*/
|
|
70
|
+
export function getChildrenRecursively(itemId, itemsStore, maxLevels = Infinity, startLevel) {
|
|
71
|
+
const item = itemsStore.get(itemId);
|
|
72
|
+
if (!item || !item.childIds || item.childIds.length === 0) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
// Use the stored level for performance optimization
|
|
76
|
+
const currentStartLevel = startLevel ?? item.level;
|
|
77
|
+
return item.childIds
|
|
78
|
+
.map((childId) => {
|
|
79
|
+
const childItem = itemsStore.get(childId);
|
|
80
|
+
if (!childItem) {
|
|
81
|
+
// This case should ideally not happen if data integrity is maintained
|
|
82
|
+
// (e.g., childId in parent's childIds list actually exists in itemsStore).
|
|
83
|
+
// Consider logging a warning here if such inconsistencies are possible.
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
// Performance optimization: Check level difference instead of tracking recursion depth
|
|
87
|
+
const levelDifference = childItem.level - currentStartLevel;
|
|
88
|
+
if (levelDifference >= maxLevels) {
|
|
89
|
+
return {
|
|
90
|
+
id: childItem.id,
|
|
91
|
+
data: childItem.data,
|
|
92
|
+
children: [], // Don't recurse further if max levels reached
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Exclude childIds, level, and parentId from the reconstructed node as children are handled by recursion.
|
|
96
|
+
const { childIds: _childIds, level: _level, parentId: _parentId, ...baseChildItem } = childItem;
|
|
97
|
+
return {
|
|
98
|
+
...baseChildItem, // Spread properties like id, data, parentId
|
|
99
|
+
children: getChildrenRecursively(childId, itemsStore, maxLevels, currentStartLevel),
|
|
100
|
+
};
|
|
101
|
+
})
|
|
102
|
+
.filter((node) => node !== null); // Type guard to filter out nulls and ensure correct type.
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves a single normalized node by its ID from the items store.
|
|
106
|
+
*
|
|
107
|
+
* @template T The type of data in the node.
|
|
108
|
+
* @param {string} itemId - The ID of the node to retrieve.
|
|
109
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
110
|
+
* @returns {NormalizedNode<T> | undefined} The normalized node if found, otherwise undefined.
|
|
111
|
+
*/
|
|
112
|
+
export function getNode(itemId, itemsStore) {
|
|
113
|
+
return itemsStore.get(itemId);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves the parent of a given node from the items store.
|
|
117
|
+
*
|
|
118
|
+
* @template T The type of data in the nodes.
|
|
119
|
+
* @param {string} itemId - The ID of the node whose parent is to be retrieved.
|
|
120
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
121
|
+
* @returns {NormalizedNode<T> | undefined} The parent node if found, otherwise undefined.
|
|
122
|
+
*/
|
|
123
|
+
export function getParent(itemId, itemsStore) {
|
|
124
|
+
const node = itemsStore.get(itemId);
|
|
125
|
+
if (node?.parentId) {
|
|
126
|
+
// Optional chaining for conciseness
|
|
127
|
+
return itemsStore.get(node.parentId);
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Retrieves the path (an array of nodes) from the root to a specified node.
|
|
133
|
+
* The path includes the target node itself as the last element.
|
|
134
|
+
* Performance optimized using the level property to pre-allocate array size.
|
|
135
|
+
*
|
|
136
|
+
* @template T The type of data in the nodes.
|
|
137
|
+
* @param {string} itemId - The ID of the target node.
|
|
138
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
139
|
+
* @returns {NormalizedNode<T>[]} An array of nodes representing the path from a root to the target node.
|
|
140
|
+
* Returns an empty array if the node is not found.
|
|
141
|
+
*/
|
|
142
|
+
export function getPathToNode(itemId, itemsStore) {
|
|
143
|
+
const targetNode = itemsStore.get(itemId);
|
|
144
|
+
if (!targetNode) {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
// Performance optimization: pre-allocate array with exact size needed
|
|
148
|
+
const path = new Array(targetNode.level + 1);
|
|
149
|
+
let currentNode = targetNode;
|
|
150
|
+
let index = targetNode.level;
|
|
151
|
+
// Fill the array from end to beginning to avoid unshift operations
|
|
152
|
+
while (currentNode && index >= 0) {
|
|
153
|
+
path[index] = currentNode;
|
|
154
|
+
index--;
|
|
155
|
+
currentNode = currentNode.parentId ? itemsStore.get(currentNode.parentId) : undefined;
|
|
156
|
+
}
|
|
157
|
+
return path;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Finds all nodes in the items store that satisfy a given predicate function.
|
|
161
|
+
*
|
|
162
|
+
* @template T The type of data in the nodes.
|
|
163
|
+
* @param {(node: NormalizedNode<T>) => boolean} predicate - A function that takes a node and returns true if it matches the criteria.
|
|
164
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
165
|
+
* @returns {NormalizedNode<T>[]} An array of nodes that satisfy the predicate.
|
|
166
|
+
*/
|
|
167
|
+
export function findNodes(predicate, itemsStore) {
|
|
168
|
+
const results = [];
|
|
169
|
+
for (const node of itemsStore.values()) {
|
|
170
|
+
if (predicate(node)) {
|
|
171
|
+
results.push(node);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return results;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Checks if a node is a descendant of another node.
|
|
178
|
+
* Performance optimized using level comparison for early exit.
|
|
179
|
+
*
|
|
180
|
+
* @template T The type of data in the nodes.
|
|
181
|
+
* @param {string} potentialDescendantId - The ID of the node to check if it's a descendant.
|
|
182
|
+
* @param {string} ancestorId - The ID of the potential ancestor node.
|
|
183
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
184
|
+
* @returns {boolean} True if `potentialDescendantId` is a descendant of `ancestorId`, false otherwise.
|
|
185
|
+
*/
|
|
186
|
+
export function isDescendant(potentialDescendantId, ancestorId, itemsStore) {
|
|
187
|
+
const descendantNode = itemsStore.get(potentialDescendantId);
|
|
188
|
+
const ancestorNode = itemsStore.get(ancestorId);
|
|
189
|
+
// A node cannot be a descendant of itself in this context.
|
|
190
|
+
// Also, if either node doesn't exist, it can't be a descendant.
|
|
191
|
+
if (!descendantNode ||
|
|
192
|
+
!ancestorNode ||
|
|
193
|
+
!descendantNode.parentId ||
|
|
194
|
+
potentialDescendantId === ancestorId) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
// Performance optimization: if descendant's level is not greater than ancestor's level,
|
|
198
|
+
// it cannot be a descendant
|
|
199
|
+
if (descendantNode.level <= ancestorNode.level) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
let currentNode = descendantNode;
|
|
203
|
+
while (currentNode?.parentId) {
|
|
204
|
+
// Traverse up towards the root
|
|
205
|
+
if (currentNode.parentId === ancestorId) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
currentNode = itemsStore.get(currentNode.parentId);
|
|
209
|
+
}
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Updates the data of a specific node in an immutable way.
|
|
214
|
+
*
|
|
215
|
+
* @template T The type of data in the node.
|
|
216
|
+
* @param {string} itemId - The ID of the node to update.
|
|
217
|
+
* @param {Partial<T>} newData - An object containing the new data fields to merge into the existing node's data.
|
|
218
|
+
* @param {NormalizedTreeState<T>} currentState - The current normalized tree state.
|
|
219
|
+
* @returns {NormalizedTreeState<T>} A new tree state with the specified node's data updated.
|
|
220
|
+
* Returns the original state if the node is not found.
|
|
221
|
+
*/
|
|
222
|
+
export function updateNodeData(itemId, newData, currentState) {
|
|
223
|
+
const originalNode = currentState.items.get(itemId);
|
|
224
|
+
if (!originalNode) {
|
|
225
|
+
// eslint-disable-next-line no-console
|
|
226
|
+
console.warn(`[updateNodeData] Node with ID "${itemId}" not found. Cannot update.`);
|
|
227
|
+
return currentState; // Return original state if node doesn't exist
|
|
228
|
+
}
|
|
229
|
+
// Create the updated node immutably
|
|
230
|
+
const updatedNode = {
|
|
231
|
+
...originalNode,
|
|
232
|
+
data: {
|
|
233
|
+
...originalNode.data, // Preserve existing data
|
|
234
|
+
...newData, // Apply new partial data, overwriting existing fields if they overlap
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
// Create a new Map for items and set the updated node
|
|
238
|
+
const newItems = new Map(currentState.items);
|
|
239
|
+
newItems.set(itemId, updatedNode);
|
|
240
|
+
return {
|
|
241
|
+
...currentState, // Preserve other parts of the state (e.g., rootItemIds)
|
|
242
|
+
items: newItems,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Adds a new node to the tree in an immutable way.
|
|
247
|
+
*
|
|
248
|
+
* @template T The type of data for the new node.
|
|
249
|
+
* @param {string} newNodeId - The ID for the new node. Must be unique.
|
|
250
|
+
* @param {T} nodeData - The data payload for the new node.
|
|
251
|
+
* @param {string | null} parentId - The ID of the parent node. If null, the new node is added as a root.
|
|
252
|
+
* @param {NormalizedTreeState<T>} currentState - The current normalized tree state.
|
|
253
|
+
* @returns {NormalizedTreeState<T>} A new tree state with the new node added.
|
|
254
|
+
* If `newNodeId` already exists, it logs a warning and returns the original state.
|
|
255
|
+
* If `parentId` is provided but not found, the node is added as a root.
|
|
256
|
+
*/
|
|
257
|
+
export function addNode(newNodeId, nodeData, parentId, currentState) {
|
|
258
|
+
if (currentState.items.has(newNodeId)) {
|
|
259
|
+
// eslint-disable-next-line no-console
|
|
260
|
+
console.warn(`[addNode] Node with ID "${newNodeId}" already exists. Cannot add duplicate.`);
|
|
261
|
+
return currentState;
|
|
262
|
+
}
|
|
263
|
+
const newItems = new Map(currentState.items);
|
|
264
|
+
const newRootItemIds = new Set(currentState.rootItemIds); // Ensure immutability for rootItemIds
|
|
265
|
+
// Prepare the new node. Its parentId might change if the specified parent is not found.
|
|
266
|
+
let actualParentId = parentId;
|
|
267
|
+
let nodeLevel = 0; // Default level for root nodes
|
|
268
|
+
if (parentId) {
|
|
269
|
+
const parentNode = newItems.get(parentId);
|
|
270
|
+
if (parentNode) {
|
|
271
|
+
nodeLevel = parentNode.level + 1; // Set level based on parent's level
|
|
272
|
+
const updatedParentNode = {
|
|
273
|
+
...parentNode,
|
|
274
|
+
childIds: [...parentNode.childIds, newNodeId], // Add new child ID immutably
|
|
275
|
+
};
|
|
276
|
+
newItems.set(parentId, updatedParentNode); // Update parent in the newItems Map
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
// eslint-disable-next-line no-console
|
|
280
|
+
console.warn(`[addNode] Parent node with ID "${parentId}" not found. Adding node "${newNodeId}" as a root.`);
|
|
281
|
+
actualParentId = null; // Set as root if parent not found
|
|
282
|
+
nodeLevel = 0; // Root level
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const newNode = {
|
|
286
|
+
id: newNodeId,
|
|
287
|
+
parentId: actualParentId,
|
|
288
|
+
data: nodeData,
|
|
289
|
+
childIds: [], // New nodes have no children initially
|
|
290
|
+
level: nodeLevel,
|
|
291
|
+
};
|
|
292
|
+
newItems.set(newNodeId, newNode);
|
|
293
|
+
if (actualParentId === null) {
|
|
294
|
+
newRootItemIds.add(newNodeId); // Add to new set of root IDs
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
items: newItems,
|
|
298
|
+
rootItemIds: newRootItemIds,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Helper function to recursively get all descendant IDs of a given node,
|
|
303
|
+
* including the starting node's ID itself.
|
|
304
|
+
* Uses a Set for efficient addition and lookup, and to avoid reprocessing.
|
|
305
|
+
*
|
|
306
|
+
* @template T The type of data in the nodes (not directly used but good for consistency).
|
|
307
|
+
* @param {string} itemId - The ID of the starting node.
|
|
308
|
+
* @param {Map<string, NormalizedNode<T>>} itemsMap - The map of all normalized nodes.
|
|
309
|
+
* @param {Set<string>} [idsFound=new Set()] - Accumulator for descendant IDs (used internally for recursion).
|
|
310
|
+
* @returns {Set<string>} A Set containing the IDs of the starting node and all its descendants.
|
|
311
|
+
*/
|
|
312
|
+
export function getAllDescendantIdsRecursive(itemId, itemsMap, idsFound = new Set()) {
|
|
313
|
+
// Avoid processing if already visited (e.g., in case of unexpected cycles, though unlikely in a tree)
|
|
314
|
+
if (idsFound.has(itemId)) {
|
|
315
|
+
return idsFound;
|
|
316
|
+
}
|
|
317
|
+
idsFound.add(itemId); // Add current node's ID
|
|
318
|
+
const node = itemsMap.get(itemId);
|
|
319
|
+
if (node?.childIds) {
|
|
320
|
+
for (const childId of node.childIds) {
|
|
321
|
+
getAllDescendantIdsRecursive(childId, itemsMap, idsFound); // Recurse for children
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return idsFound;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Removes a node and all its descendants from the tree in an immutable way.
|
|
328
|
+
*
|
|
329
|
+
* @template T The type of data in the nodes.
|
|
330
|
+
* @param {string} itemIdToRemove - The ID of the node to remove.
|
|
331
|
+
* @param {NormalizedTreeState<T>} currentState - The current normalized tree state.
|
|
332
|
+
* @returns {NormalizedTreeState<T>} A new tree state with the specified node and its descendants removed.
|
|
333
|
+
* Returns the original state if the node to remove is not found.
|
|
334
|
+
*/
|
|
335
|
+
export function removeNode(itemIdToRemove, currentState) {
|
|
336
|
+
const nodeToRemove = currentState.items.get(itemIdToRemove);
|
|
337
|
+
if (!nodeToRemove) {
|
|
338
|
+
// eslint-disable-next-line no-console
|
|
339
|
+
console.warn(`[removeNode] Node with ID "${itemIdToRemove}" not found. Cannot remove.`);
|
|
340
|
+
return currentState; // Node doesn't exist, return original state
|
|
341
|
+
}
|
|
342
|
+
// 1. Identify all nodes to remove (the node itself and all its descendants)
|
|
343
|
+
const idsToDelete = getAllDescendantIdsRecursive(itemIdToRemove, currentState.items);
|
|
344
|
+
// 2. Create the new items Map by excluding all nodes identified for removal
|
|
345
|
+
const newItems = new Map();
|
|
346
|
+
for (const [id, node] of currentState.items.entries()) {
|
|
347
|
+
if (!idsToDelete.has(id)) {
|
|
348
|
+
newItems.set(id, node);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
// 3. Update the parent node (if any, and if it's not also being deleted)
|
|
352
|
+
const { parentId } = nodeToRemove;
|
|
353
|
+
if (parentId && newItems.has(parentId)) {
|
|
354
|
+
// Check if parent exists in the new map (i.e., wasn't deleted)
|
|
355
|
+
const parentNode = newItems.get(parentId); // Safe due to newItems.has(parentId) check
|
|
356
|
+
const updatedParentNode = {
|
|
357
|
+
...parentNode,
|
|
358
|
+
childIds: parentNode.childIds.filter(id => id !== itemIdToRemove), // Remove child ID immutably
|
|
359
|
+
};
|
|
360
|
+
newItems.set(parentId, updatedParentNode);
|
|
361
|
+
}
|
|
362
|
+
// 4. Update rootItemIds: create a new set excluding any deleted root IDs
|
|
363
|
+
const newRootItemIds = new Set();
|
|
364
|
+
for (const rootId of currentState.rootItemIds) {
|
|
365
|
+
if (!idsToDelete.has(rootId)) {
|
|
366
|
+
// Only keep roots that were not deleted
|
|
367
|
+
newRootItemIds.add(rootId);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return {
|
|
371
|
+
items: newItems,
|
|
372
|
+
rootItemIds: newRootItemIds,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Gets all nodes at a specific level in the tree.
|
|
377
|
+
* Performance optimized using the level property.
|
|
378
|
+
*
|
|
379
|
+
* @template T The type of data in the nodes.
|
|
380
|
+
* @param {number} targetLevel - The level to retrieve nodes from (0 for root nodes).
|
|
381
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
382
|
+
* @returns {NormalizedNode<T>[]} An array of nodes at the specified level.
|
|
383
|
+
*/
|
|
384
|
+
export function getNodesAtLevel(targetLevel, itemsStore) {
|
|
385
|
+
const results = [];
|
|
386
|
+
for (const node of itemsStore.values()) {
|
|
387
|
+
if (node.level === targetLevel) {
|
|
388
|
+
results.push(node);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return results;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Gets the maximum depth/level of the tree.
|
|
395
|
+
* Performance optimized using the level property.
|
|
396
|
+
*
|
|
397
|
+
* @template T The type of data in the nodes.
|
|
398
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
399
|
+
* @returns {number} The maximum level in the tree, or -1 if the tree is empty.
|
|
400
|
+
*/
|
|
401
|
+
export function getTreeDepth(itemsStore) {
|
|
402
|
+
let maxLevel = -1;
|
|
403
|
+
for (const node of itemsStore.values()) {
|
|
404
|
+
if (node.level > maxLevel) {
|
|
405
|
+
maxLevel = node.level;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return maxLevel;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Gets all nodes within a specified level range (inclusive).
|
|
412
|
+
* Performance optimized using the level property.
|
|
413
|
+
*
|
|
414
|
+
* @template T The type of data in the nodes.
|
|
415
|
+
* @param {number} minLevel - The minimum level (inclusive).
|
|
416
|
+
* @param {number} maxLevel - The maximum level (inclusive).
|
|
417
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
418
|
+
* @returns {NormalizedNode<T>[]} An array of nodes within the specified level range.
|
|
419
|
+
*/
|
|
420
|
+
export function getNodesInLevelRange(minLevel, maxLevel, itemsStore) {
|
|
421
|
+
const results = [];
|
|
422
|
+
for (const node of itemsStore.values()) {
|
|
423
|
+
if (node.level >= minLevel && node.level <= maxLevel) {
|
|
424
|
+
results.push(node);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return results;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Gets all ancestor nodes of a specified node.
|
|
431
|
+
* Performance optimized using the level property for early termination.
|
|
432
|
+
*
|
|
433
|
+
* @template T The type of data in the nodes.
|
|
434
|
+
* @param {string} itemId - The ID of the node to get ancestors for.
|
|
435
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
436
|
+
* @returns {NormalizedNode<T>[]} An array of ancestor nodes, ordered from root to immediate parent.
|
|
437
|
+
*/
|
|
438
|
+
export function getAncestors(itemId, itemsStore) {
|
|
439
|
+
const node = itemsStore.get(itemId);
|
|
440
|
+
if (!node || node.level === 0) {
|
|
441
|
+
return []; // Root nodes have no ancestors
|
|
442
|
+
}
|
|
443
|
+
const ancestors = [];
|
|
444
|
+
let currentNode = node;
|
|
445
|
+
while (currentNode?.parentId) {
|
|
446
|
+
const parentNode = itemsStore.get(currentNode.parentId);
|
|
447
|
+
if (parentNode) {
|
|
448
|
+
ancestors.unshift(parentNode); // Add to beginning to maintain root-to-parent order
|
|
449
|
+
currentNode = parentNode;
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return ancestors;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Checks if a node is at a leaf level (has no children).
|
|
459
|
+
* This is a convenience function that leverages the existing childIds property.
|
|
460
|
+
*
|
|
461
|
+
* @template T The type of data in the nodes.
|
|
462
|
+
* @param {string} itemId - The ID of the node to check.
|
|
463
|
+
* @param {Map<string, NormalizedNode<T>>} itemsStore - The map of normalized nodes.
|
|
464
|
+
* @returns {boolean} True if the node is a leaf (has no children), false otherwise.
|
|
465
|
+
*/
|
|
466
|
+
export function isLeafNode(itemId, itemsStore) {
|
|
467
|
+
const node = itemsStore.get(itemId);
|
|
468
|
+
return node ? node.childIds.length === 0 : false;
|
|
469
|
+
}
|
package/es/utils/web.d.ts
CHANGED
|
@@ -8,3 +8,7 @@ export declare const getPreventKeyboardAction: (actions?: Array<'undo' | 'copy'
|
|
|
8
8
|
onKeyDown: (e: React.KeyboardEvent | KeyboardEvent) => false | undefined;
|
|
9
9
|
onKeyUp: (e: React.KeyboardEvent | KeyboardEvent) => void;
|
|
10
10
|
};
|
|
11
|
+
export declare const getPlatform: () => "mac" | "window" | "linux" | "unknown";
|
|
12
|
+
export declare const isMacOS: () => boolean;
|
|
13
|
+
export declare const isWindows: () => boolean;
|
|
14
|
+
export declare const isLinux: () => boolean;
|
package/es/utils/web.js
CHANGED
|
@@ -24,3 +24,28 @@ export const getPreventKeyboardAction = (actions = []) => ({
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
|
+
export const getPlatform = () => {
|
|
28
|
+
// Modern API (userAgentData)
|
|
29
|
+
const navAny = navigator;
|
|
30
|
+
if (navAny.userAgentData && typeof navAny.userAgentData.platform === 'string') {
|
|
31
|
+
const platform = navAny.userAgentData.platform.toLowerCase();
|
|
32
|
+
if (platform.includes('mac'))
|
|
33
|
+
return 'mac';
|
|
34
|
+
if (platform.includes('win'))
|
|
35
|
+
return 'window';
|
|
36
|
+
if (platform.includes('linux') || platform.includes('x11'))
|
|
37
|
+
return 'linux';
|
|
38
|
+
}
|
|
39
|
+
// Fallback for older browsers
|
|
40
|
+
const ua = navigator.userAgent.toLowerCase();
|
|
41
|
+
if (ua.includes('mac'))
|
|
42
|
+
return 'mac';
|
|
43
|
+
if (ua.includes('win'))
|
|
44
|
+
return 'window';
|
|
45
|
+
if (ua.includes('linux') || ua.includes('x11'))
|
|
46
|
+
return 'linux';
|
|
47
|
+
return 'unknown';
|
|
48
|
+
};
|
|
49
|
+
export const isMacOS = () => getPlatform() === 'mac';
|
|
50
|
+
export const isWindows = () => getPlatform() === 'window';
|
|
51
|
+
export const isLinux = () => getPlatform() === 'linux';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.83-text-editor-beta.1",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test:ui": "vitest --ui",
|
|
37
37
|
"coverage": "vitest run --coverage",
|
|
38
38
|
"ts-compile": "tsc -p tsconfig.esm.json",
|
|
39
|
-
"copy-files": "copyfiles -u 1 src/**/*.json src/**/*.svg src/**/*.
|
|
39
|
+
"copy-files": "copyfiles -u 1 \"src/**/*.json\" \"src/**/*.svg\" \"src/**/*.png\" \"src/**/*.scss\" es",
|
|
40
40
|
"icons:export": "sh -e scripts/generate-export-icon.sh",
|
|
41
41
|
"icons:format": "prettier --loglevel warn --write \"src/components/icons/*.tsx\"",
|
|
42
42
|
"icons:update": "sh -e scripts/update-icons.sh",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"@dnd-kit/sortable": "^8.0.0",
|
|
70
70
|
"@dnd-kit/utilities": "^3.2.2",
|
|
71
71
|
"@emotion/react": "^11.11.1",
|
|
72
|
+
"@floating-ui/react": "^0.27.8",
|
|
72
73
|
"@fortawesome/fontawesome-svg-core": "6.1.1",
|
|
73
74
|
"@fortawesome/free-brands-svg-icons": "6.1.1",
|
|
74
75
|
"@fortawesome/free-regular-svg-icons": "6.1.1",
|
|
@@ -78,6 +79,26 @@
|
|
|
78
79
|
"@tanstack/react-query": "4.20.4",
|
|
79
80
|
"@tanstack/react-query-devtools": "4.20.4",
|
|
80
81
|
"@tinymce/tinymce-react": "^3.7.0",
|
|
82
|
+
"@tiptap/core": "^2.12.0",
|
|
83
|
+
"@tiptap/extension-color": "^2.12.0",
|
|
84
|
+
"@tiptap/extension-font-family": "^2.12.0",
|
|
85
|
+
"@tiptap/extension-highlight": "^2.12.0",
|
|
86
|
+
"@tiptap/extension-image": "^2.12.0",
|
|
87
|
+
"@tiptap/extension-link": "^2.12.0",
|
|
88
|
+
"@tiptap/extension-list-item": "^2.12.0",
|
|
89
|
+
"@tiptap/extension-strike": "^2.12.0",
|
|
90
|
+
"@tiptap/extension-subscript": "^2.12.0",
|
|
91
|
+
"@tiptap/extension-superscript": "^2.12.0",
|
|
92
|
+
"@tiptap/extension-task-item": "^2.12.0",
|
|
93
|
+
"@tiptap/extension-task-list": "^2.12.0",
|
|
94
|
+
"@tiptap/extension-text-align": "^2.12.0",
|
|
95
|
+
"@tiptap/extension-text-style": "^2.12.0",
|
|
96
|
+
"@tiptap/extension-typography": "^2.12.0",
|
|
97
|
+
"@tiptap/extension-underline": "^2.12.0",
|
|
98
|
+
"@tiptap/pm": "^2.12.0",
|
|
99
|
+
"@tiptap/react": "^2.12.0",
|
|
100
|
+
"@tiptap/starter-kit": "^2.12.0",
|
|
101
|
+
"@tiptap/suggestion": "^2.12.0",
|
|
81
102
|
"@types/currency-formatter": "1.5.1",
|
|
82
103
|
"@types/react-custom-scrollbars": "^4.0.13",
|
|
83
104
|
"@types/react-frame-component": "^4.1.6",
|
|
@@ -108,6 +129,7 @@
|
|
|
108
129
|
"immer": "3.0.0",
|
|
109
130
|
"konva": "^9.3.6",
|
|
110
131
|
"lodash": "^4.17.21",
|
|
132
|
+
"lucide-react": "^0.510.0",
|
|
111
133
|
"moment": "2.29.2",
|
|
112
134
|
"pako": "2.0.4",
|
|
113
135
|
"qs": "6.10.3",
|
|
@@ -120,6 +142,7 @@
|
|
|
120
142
|
"react-custom-scrollbars": "^4.2.1",
|
|
121
143
|
"react-device-detect": "^2.2.3",
|
|
122
144
|
"react-draggable": "^4.4.5",
|
|
145
|
+
"react-fast-compare": "^3.2.1",
|
|
123
146
|
"react-frame-component": "^5.2.6",
|
|
124
147
|
"react-google-recaptcha": "^3.1.0",
|
|
125
148
|
"react-helmet": "^6.1.0",
|
|
@@ -136,9 +159,11 @@
|
|
|
136
159
|
"socket.io-client": "^4.7.5",
|
|
137
160
|
"string-replace-to-array": "^2.1.0",
|
|
138
161
|
"swiper": "^11.0.7",
|
|
162
|
+
"tinycolor2": "^1.6.0",
|
|
139
163
|
"tui-image-editor": "^3.15.3",
|
|
140
164
|
"uniqid": "^5.4.0",
|
|
141
165
|
"use-context-selector": "^1.4.4",
|
|
166
|
+
"use-debounce": "^10.0.4",
|
|
142
167
|
"use-image": "^1.1.1",
|
|
143
168
|
"use-immer": "^0.4.1",
|
|
144
169
|
"zustand": "^4.5.2"
|
|
@@ -187,6 +212,8 @@
|
|
|
187
212
|
"@types/react-resizable": "^3.0.7",
|
|
188
213
|
"@types/react-syntax-highlighter": "^15.5.11",
|
|
189
214
|
"@types/styled-components": "^5.1.26",
|
|
215
|
+
"@types/tinycolor2": "^1.4.6",
|
|
216
|
+
"@types/uniqid": "^5.3.4",
|
|
190
217
|
"@types/yaireo__tagify": "^4.27.0",
|
|
191
218
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
192
219
|
"@typescript-eslint/parser": "^5.55.0",
|
|
@@ -226,7 +253,6 @@
|
|
|
226
253
|
"prettier": "^3.3.3",
|
|
227
254
|
"react": "18.2.0",
|
|
228
255
|
"react-dom": "18.2.0",
|
|
229
|
-
"react-fast-compare": "^3.2.1",
|
|
230
256
|
"react-i18next": "11.16.7",
|
|
231
257
|
"react-router-dom": "5.1.0 || 6.14.2",
|
|
232
258
|
"sass": "^1.77.8",
|