@djangocfg/ui-tools 2.1.317 → 2.1.319
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/{DocsLayout-ESVQZO3V.mjs → DocsLayout-CTJINVBM.mjs} +235 -267
- package/dist/DocsLayout-CTJINVBM.mjs.map +1 -0
- package/dist/{DocsLayout-KUPDWJ3G.cjs → DocsLayout-XLDB6CJ2.cjs} +273 -305
- package/dist/DocsLayout-XLDB6CJ2.cjs.map +1 -0
- package/dist/TreeRoot-A3J65L6F.mjs +4 -0
- package/dist/{TreeRoot-R6XVHYQK.mjs.map → TreeRoot-A3J65L6F.mjs.map} +1 -1
- package/dist/TreeRoot-DSK5JILT.cjs +19 -0
- package/dist/{TreeRoot-RAMQSBMO.cjs.map → TreeRoot-DSK5JILT.cjs.map} +1 -1
- package/dist/{chunk-44ZTWYAF.cjs → chunk-3Z3A7FHA.cjs} +17 -6
- package/dist/chunk-3Z3A7FHA.cjs.map +1 -0
- package/dist/{chunk-GBLQTHWT.mjs → chunk-62Y65TGK.mjs} +5 -4
- package/dist/chunk-62Y65TGK.mjs.map +1 -0
- package/dist/{chunk-NTJL2SXK.mjs → chunk-MOME6KYD.mjs} +17 -6
- package/dist/chunk-MOME6KYD.mjs.map +1 -0
- package/dist/{chunk-S44PW6NK.cjs → chunk-TKSFZHCG.cjs} +5 -4
- package/dist/chunk-TKSFZHCG.cjs.map +1 -0
- package/dist/file-icon/index.cjs +59 -3
- package/dist/file-icon/index.cjs.map +1 -1
- package/dist/file-icon/index.d.cts +33 -4
- package/dist/file-icon/index.d.ts +33 -4
- package/dist/file-icon/index.mjs +60 -5
- package/dist/file-icon/index.mjs.map +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/tree/index.cjs +33 -33
- package/dist/tree/index.d.cts +6 -4
- package/dist/tree/index.d.ts +6 -4
- package/dist/tree/index.mjs +1 -1
- package/dist/{types-Cclwv4Hl.d.cts → types-CevSbyfD.d.cts} +6 -0
- package/dist/{types-Cclwv4Hl.d.ts → types-CevSbyfD.d.ts} +6 -0
- package/package.json +6 -6
- package/src/tools/FileIcon/FileIcon.tsx +13 -2
- package/src/tools/FileIcon/index.ts +6 -0
- package/src/tools/FileIcon/specialFolders.ts +93 -0
- package/src/tools/FileIcon/treeAdapter.tsx +8 -0
- package/src/tools/OpenapiViewer/OpenapiViewer.story.tsx +30 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/MetaActions.tsx +35 -50
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/index.tsx +49 -22
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Section/index.tsx +1 -1
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/store/index.ts +10 -11
- package/src/tools/OpenapiViewer/components/DocsLayout/SchemaCopyMenu.tsx +25 -5
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/BrandHeader.tsx +18 -33
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/Toolbar.tsx +40 -24
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/index.tsx +8 -14
- package/src/tools/OpenapiViewer/components/DocsLayout/sidebarLabel.ts +1 -4
- package/src/tools/OpenapiViewer/utils/operationToHar.ts +2 -1
- package/src/tools/OpenapiViewer/utils/url.ts +9 -2
- package/src/tools/Tree/README.md +46 -2
- package/src/tools/Tree/Tree.story.tsx +36 -0
- package/src/tools/Tree/TreeRoot.tsx +2 -0
- package/src/tools/Tree/components/TreeContent.tsx +3 -1
- package/src/tools/Tree/context/TreeContext.tsx +4 -1
- package/src/tools/Tree/data/flatten.ts +10 -1
- package/src/tools/Tree/types.ts +7 -0
- package/dist/DocsLayout-ESVQZO3V.mjs.map +0 -1
- package/dist/DocsLayout-KUPDWJ3G.cjs.map +0 -1
- package/dist/TreeRoot-R6XVHYQK.mjs +0 -4
- package/dist/TreeRoot-RAMQSBMO.cjs +0 -19
- package/dist/chunk-44ZTWYAF.cjs.map +0 -1
- package/dist/chunk-GBLQTHWT.mjs.map +0 -1
- package/dist/chunk-NTJL2SXK.mjs.map +0 -1
- package/dist/chunk-S44PW6NK.cjs.map +0 -1
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/MethodChips.tsx +0 -43
package/dist/tree/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var chunkYXBOAGIM_cjs = require('../chunk-YXBOAGIM.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunk3Z3A7FHA_cjs = require('../chunk-3Z3A7FHA.cjs');
|
|
7
7
|
require('../chunk-WGEGR3DF.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
@@ -22,131 +22,131 @@ Object.defineProperty(exports, "createDemoTree", {
|
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "DEFAULT_TREE_APPEARANCE", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk3Z3A7FHA_cjs.DEFAULT_TREE_APPEARANCE; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "DEFAULT_TREE_LABELS", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk3Z3A7FHA_cjs.DEFAULT_TREE_LABELS; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "Tree", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeRoot; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "TreeChevron", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeChevron; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "TreeContent", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeContent; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "TreeEmpty", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeEmpty; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "TreeIcon", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeIcon; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "TreeIndentGuides", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeIndentGuides; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "TreeLabel", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeLabel; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "TreeProvider", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeProvider; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "TreeRoot", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeRoot; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "TreeRow", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeRow; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "TreeSearchInput", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeSearchInput; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "appearanceToStyle", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunk3Z3A7FHA_cjs.appearanceToStyle; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "clearTreeState", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunk3Z3A7FHA_cjs.clearTreeState; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "createChildCache", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunk3Z3A7FHA_cjs.createChildCache; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "default", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunk3Z3A7FHA_cjs.TreeRoot_default; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "flattenTree", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunk3Z3A7FHA_cjs.flattenTree; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "loadTreeState", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunk3Z3A7FHA_cjs.loadTreeState; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "resolveAppearance", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk3Z3A7FHA_cjs.resolveAppearance; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "resolveChildren", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunk3Z3A7FHA_cjs.resolveChildren; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "saveTreeState", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunk3Z3A7FHA_cjs.saveTreeState; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "useTreeActions", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeActions; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "useTreeContext", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeContext; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "useTreeExpansion", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeExpansion; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "useTreeFocus", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeFocus; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "useTreeKeyboard", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeKeyboard; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "useTreeLabels", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeLabels; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "useTreeRows", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeRows; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "useTreeSearch", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeSearch; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "useTreeSelection", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeSelection; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "useTreeTypeAhead", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunk3Z3A7FHA_cjs.useTreeTypeAhead; }
|
|
150
150
|
});
|
|
151
151
|
//# sourceMappingURL=index.cjs.map
|
|
152
152
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tree/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { b as TreeRootProps, f as TreeItemId, T as TreeNode, F as FlatRow, o as TreeActivateOptions, g as TreeLabels, R as ResolvedAppearance, h as TreeSelectionMode, p as TreeActivationMode, a as TreeRowSlot, e as TreeContextMenuSlot } from '../types-
|
|
3
|
-
export { c as DEFAULT_TREE_APPEARANCE, D as DEFAULT_TREE_LABELS, m as TreeAccentIntensity, k as TreeAppearance, l as TreeDensity, j as TreeLoadChildren, n as TreeRadius, i as TreeRowRenderProps, d as appearanceToStyle, r as resolveAppearance } from '../types-
|
|
2
|
+
import { b as TreeRootProps, f as TreeItemId, T as TreeNode, F as FlatRow, o as TreeActivateOptions, g as TreeLabels, R as ResolvedAppearance, h as TreeSelectionMode, p as TreeActivationMode, a as TreeRowSlot, e as TreeContextMenuSlot } from '../types-CevSbyfD.cjs';
|
|
3
|
+
export { c as DEFAULT_TREE_APPEARANCE, D as DEFAULT_TREE_LABELS, m as TreeAccentIntensity, k as TreeAppearance, l as TreeDensity, j as TreeLoadChildren, n as TreeRadius, i as TreeRowRenderProps, d as appearanceToStyle, r as resolveAppearance } from '../types-CevSbyfD.cjs';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -70,7 +70,7 @@ interface TreeContextValue<T> {
|
|
|
70
70
|
renderContextMenu?: TreeContextMenuSlot<T>;
|
|
71
71
|
}
|
|
72
72
|
declare function useTreeContext<T>(): TreeContextValue<T>;
|
|
73
|
-
interface TreeProviderProps<T> extends Pick<TreeRootProps<T>, 'data' | 'getItemName' | 'loadChildren' | 'selectionMode' | 'activationMode' | 'initialExpandedIds' | 'initialSelectedIds' | 'indent' | 'appearance' | 'onSelectionChange' | 'onExpansionChange' | 'onActivate' | 'enableSearch' | 'showIndentGuides' | 'renderIcon' | 'renderLabel' | 'renderActions' | 'renderContextMenu' | 'labels' | 'persistKey' | 'persistSelection'> {
|
|
73
|
+
interface TreeProviderProps<T> extends Pick<TreeRootProps<T>, 'data' | 'getItemName' | 'loadChildren' | 'selectionMode' | 'activationMode' | 'initialExpandedIds' | 'initialSelectedIds' | 'indent' | 'appearance' | 'onSelectionChange' | 'onExpansionChange' | 'onActivate' | 'filterNode' | 'enableSearch' | 'showIndentGuides' | 'renderIcon' | 'renderLabel' | 'renderActions' | 'renderContextMenu' | 'labels' | 'persistKey' | 'persistSelection'> {
|
|
74
74
|
children: React$1.ReactNode;
|
|
75
75
|
}
|
|
76
76
|
declare function TreeProvider<T>(props: TreeProviderProps<T>): react_jsx_runtime.JSX.Element;
|
|
@@ -241,6 +241,8 @@ interface FlattenInput<T> {
|
|
|
241
241
|
roots: TreeNode<T>[];
|
|
242
242
|
expandedIds: ReadonlySet<TreeItemId>;
|
|
243
243
|
cache: ChildCache<T>;
|
|
244
|
+
/** Optional predicate. Nodes returning `false` (and their descendants) are excluded. */
|
|
245
|
+
filterNode?: (node: TreeNode<T>) => boolean;
|
|
244
246
|
}
|
|
245
247
|
/**
|
|
246
248
|
* Walk the tree top-to-bottom and produce a flat list of visible rows.
|
|
@@ -249,7 +251,7 @@ interface FlattenInput<T> {
|
|
|
249
251
|
* `expandedIds`. The output is ordered exactly as it should render,
|
|
250
252
|
* which keeps keyboard navigation (next/prev row) trivial.
|
|
251
253
|
*/
|
|
252
|
-
declare function flattenTree<T>({ roots, expandedIds, cache }: FlattenInput<T>): FlatRow<T>[];
|
|
254
|
+
declare function flattenTree<T>({ roots, expandedIds, cache, filterNode, }: FlattenInput<T>): FlatRow<T>[];
|
|
253
255
|
|
|
254
256
|
interface PersistedTreeState {
|
|
255
257
|
expandedItems: TreeItemId[];
|
package/dist/tree/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { b as TreeRootProps, f as TreeItemId, T as TreeNode, F as FlatRow, o as TreeActivateOptions, g as TreeLabels, R as ResolvedAppearance, h as TreeSelectionMode, p as TreeActivationMode, a as TreeRowSlot, e as TreeContextMenuSlot } from '../types-
|
|
3
|
-
export { c as DEFAULT_TREE_APPEARANCE, D as DEFAULT_TREE_LABELS, m as TreeAccentIntensity, k as TreeAppearance, l as TreeDensity, j as TreeLoadChildren, n as TreeRadius, i as TreeRowRenderProps, d as appearanceToStyle, r as resolveAppearance } from '../types-
|
|
2
|
+
import { b as TreeRootProps, f as TreeItemId, T as TreeNode, F as FlatRow, o as TreeActivateOptions, g as TreeLabels, R as ResolvedAppearance, h as TreeSelectionMode, p as TreeActivationMode, a as TreeRowSlot, e as TreeContextMenuSlot } from '../types-CevSbyfD.js';
|
|
3
|
+
export { c as DEFAULT_TREE_APPEARANCE, D as DEFAULT_TREE_LABELS, m as TreeAccentIntensity, k as TreeAppearance, l as TreeDensity, j as TreeLoadChildren, n as TreeRadius, i as TreeRowRenderProps, d as appearanceToStyle, r as resolveAppearance } from '../types-CevSbyfD.js';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -70,7 +70,7 @@ interface TreeContextValue<T> {
|
|
|
70
70
|
renderContextMenu?: TreeContextMenuSlot<T>;
|
|
71
71
|
}
|
|
72
72
|
declare function useTreeContext<T>(): TreeContextValue<T>;
|
|
73
|
-
interface TreeProviderProps<T> extends Pick<TreeRootProps<T>, 'data' | 'getItemName' | 'loadChildren' | 'selectionMode' | 'activationMode' | 'initialExpandedIds' | 'initialSelectedIds' | 'indent' | 'appearance' | 'onSelectionChange' | 'onExpansionChange' | 'onActivate' | 'enableSearch' | 'showIndentGuides' | 'renderIcon' | 'renderLabel' | 'renderActions' | 'renderContextMenu' | 'labels' | 'persistKey' | 'persistSelection'> {
|
|
73
|
+
interface TreeProviderProps<T> extends Pick<TreeRootProps<T>, 'data' | 'getItemName' | 'loadChildren' | 'selectionMode' | 'activationMode' | 'initialExpandedIds' | 'initialSelectedIds' | 'indent' | 'appearance' | 'onSelectionChange' | 'onExpansionChange' | 'onActivate' | 'filterNode' | 'enableSearch' | 'showIndentGuides' | 'renderIcon' | 'renderLabel' | 'renderActions' | 'renderContextMenu' | 'labels' | 'persistKey' | 'persistSelection'> {
|
|
74
74
|
children: React$1.ReactNode;
|
|
75
75
|
}
|
|
76
76
|
declare function TreeProvider<T>(props: TreeProviderProps<T>): react_jsx_runtime.JSX.Element;
|
|
@@ -241,6 +241,8 @@ interface FlattenInput<T> {
|
|
|
241
241
|
roots: TreeNode<T>[];
|
|
242
242
|
expandedIds: ReadonlySet<TreeItemId>;
|
|
243
243
|
cache: ChildCache<T>;
|
|
244
|
+
/** Optional predicate. Nodes returning `false` (and their descendants) are excluded. */
|
|
245
|
+
filterNode?: (node: TreeNode<T>) => boolean;
|
|
244
246
|
}
|
|
245
247
|
/**
|
|
246
248
|
* Walk the tree top-to-bottom and produce a flat list of visible rows.
|
|
@@ -249,7 +251,7 @@ interface FlattenInput<T> {
|
|
|
249
251
|
* `expandedIds`. The output is ordered exactly as it should render,
|
|
250
252
|
* which keeps keyboard navigation (next/prev row) trivial.
|
|
251
253
|
*/
|
|
252
|
-
declare function flattenTree<T>({ roots, expandedIds, cache }: FlattenInput<T>): FlatRow<T>[];
|
|
254
|
+
declare function flattenTree<T>({ roots, expandedIds, cache, filterNode, }: FlattenInput<T>): FlatRow<T>[];
|
|
253
255
|
|
|
254
256
|
interface PersistedTreeState {
|
|
255
257
|
expandedItems: TreeItemId[];
|
package/dist/tree/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { TreeError, TreeSkeleton, createDemoTree } from '../chunk-KR6B3LVY.mjs';
|
|
2
|
-
export { DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, TreeRoot as Tree, TreeChevron, TreeContent, TreeEmpty, TreeIcon, TreeIndentGuides, TreeLabel, TreeProvider, TreeRoot, TreeRow, TreeSearchInput, appearanceToStyle, clearTreeState, createChildCache, TreeRoot_default as default, flattenTree, loadTreeState, resolveAppearance, resolveChildren, saveTreeState, useTreeActions, useTreeContext, useTreeExpansion, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead } from '../chunk-
|
|
2
|
+
export { DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, TreeRoot as Tree, TreeChevron, TreeContent, TreeEmpty, TreeIcon, TreeIndentGuides, TreeLabel, TreeProvider, TreeRoot, TreeRow, TreeSearchInput, appearanceToStyle, clearTreeState, createChildCache, TreeRoot_default as default, flattenTree, loadTreeState, resolveAppearance, resolveChildren, saveTreeState, useTreeActions, useTreeContext, useTreeExpansion, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead } from '../chunk-MOME6KYD.mjs';
|
|
3
3
|
import '../chunk-CGILA3WO.mjs';
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
|
5
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -159,6 +159,12 @@ interface TreeRootProps<T> {
|
|
|
159
159
|
* on `activationMode`). Folders never call this — they toggle instead.
|
|
160
160
|
*/
|
|
161
161
|
onActivate?: (node: TreeNode<T>, opts: TreeActivateOptions) => void;
|
|
162
|
+
/**
|
|
163
|
+
* Optional predicate. Nodes returning `false` (and their descendants) are
|
|
164
|
+
* not rendered and not searchable. Use this to hide dot-files, system
|
|
165
|
+
* entries, or anything else the consumer wants to filter out.
|
|
166
|
+
*/
|
|
167
|
+
filterNode?: (node: TreeNode<T>) => boolean;
|
|
162
168
|
/** Show built-in search input. Default: false. */
|
|
163
169
|
enableSearch?: boolean;
|
|
164
170
|
/** Type printable letters to jump to a matching name. Default: true. */
|
|
@@ -159,6 +159,12 @@ interface TreeRootProps<T> {
|
|
|
159
159
|
* on `activationMode`). Folders never call this — they toggle instead.
|
|
160
160
|
*/
|
|
161
161
|
onActivate?: (node: TreeNode<T>, opts: TreeActivateOptions) => void;
|
|
162
|
+
/**
|
|
163
|
+
* Optional predicate. Nodes returning `false` (and their descendants) are
|
|
164
|
+
* not rendered and not searchable. Use this to hide dot-files, system
|
|
165
|
+
* entries, or anything else the consumer wants to filter out.
|
|
166
|
+
*/
|
|
167
|
+
filterNode?: (node: TreeNode<T>) => boolean;
|
|
162
168
|
/** Show built-in search input. Default: false. */
|
|
163
169
|
enableSearch?: boolean;
|
|
164
170
|
/** Type printable letters to jump to a matching name. Default: true. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-tools",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.319",
|
|
4
4
|
"description": "Heavy React tools with lazy loading - for Electron, Vite, CRA, Next.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-tools",
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"check": "tsc --noEmit"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@djangocfg/i18n": "^2.1.
|
|
105
|
-
"@djangocfg/ui-core": "^2.1.
|
|
104
|
+
"@djangocfg/i18n": "^2.1.319",
|
|
105
|
+
"@djangocfg/ui-core": "^2.1.319",
|
|
106
106
|
"consola": "^3.4.2",
|
|
107
107
|
"lodash-es": "^4.18.1",
|
|
108
108
|
"lucide-react": "^0.545.0",
|
|
@@ -155,10 +155,10 @@
|
|
|
155
155
|
"material-file-icons": "^2.4.0"
|
|
156
156
|
},
|
|
157
157
|
"devDependencies": {
|
|
158
|
-
"@djangocfg/i18n": "^2.1.
|
|
158
|
+
"@djangocfg/i18n": "^2.1.319",
|
|
159
159
|
"@djangocfg/playground": "workspace:*",
|
|
160
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
161
|
-
"@djangocfg/ui-core": "^2.1.
|
|
160
|
+
"@djangocfg/typescript-config": "^2.1.319",
|
|
161
|
+
"@djangocfg/ui-core": "^2.1.319",
|
|
162
162
|
"@types/lodash-es": "^4.17.12",
|
|
163
163
|
"@types/mapbox__mapbox-gl-draw": "^1.4.8",
|
|
164
164
|
"@types/node": "^24.7.2",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import { File as FileFallback
|
|
4
|
+
import { File as FileFallback } from 'lucide-react';
|
|
5
5
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
6
6
|
|
|
7
7
|
import { getMaterialIconsSync, loadMaterialIcons } from './loader';
|
|
8
|
+
import { resolveFolderIcon, type FolderIconOverrides } from './specialFolders';
|
|
8
9
|
|
|
9
10
|
export type FileIconSize = 12 | 14 | 16 | 18 | 20 | 24 | 28 | 32 | 40 | 48 | 64;
|
|
10
11
|
|
|
@@ -17,6 +18,11 @@ export interface FileIconProps {
|
|
|
17
18
|
isExpanded?: boolean;
|
|
18
19
|
/** Pixel size of the icon. */
|
|
19
20
|
size?: FileIconSize;
|
|
21
|
+
/**
|
|
22
|
+
* Override or extend the built-in special-folder mapping. Keys are
|
|
23
|
+
* matched case-insensitively. Only used when `isFolder` is true.
|
|
24
|
+
*/
|
|
25
|
+
folderOverrides?: FolderIconOverrides;
|
|
20
26
|
className?: string;
|
|
21
27
|
}
|
|
22
28
|
|
|
@@ -35,6 +41,7 @@ export function FileIcon({
|
|
|
35
41
|
isFolder = false,
|
|
36
42
|
isExpanded = false,
|
|
37
43
|
size = 16,
|
|
44
|
+
folderOverrides,
|
|
38
45
|
className,
|
|
39
46
|
}: FileIconProps) {
|
|
40
47
|
const [svg, setSvg] = useState<string | null>(() => {
|
|
@@ -59,7 +66,11 @@ export function FileIcon({
|
|
|
59
66
|
}, [isFolder, name]);
|
|
60
67
|
|
|
61
68
|
if (isFolder) {
|
|
62
|
-
const Icon =
|
|
69
|
+
const Icon = resolveFolderIcon({
|
|
70
|
+
name,
|
|
71
|
+
isExpanded,
|
|
72
|
+
overrides: folderOverrides,
|
|
73
|
+
});
|
|
63
74
|
return (
|
|
64
75
|
<Icon
|
|
65
76
|
className={cn('shrink-0 text-amber-500', className)}
|
|
@@ -6,4 +6,10 @@ export type { FileIconProps, FileIconSize } from './FileIcon';
|
|
|
6
6
|
export { createFileIconSlot } from './treeAdapter';
|
|
7
7
|
export type { CreateFileIconSlotOptions } from './treeAdapter';
|
|
8
8
|
|
|
9
|
+
export { resolveFolderIcon } from './specialFolders';
|
|
10
|
+
export type {
|
|
11
|
+
ResolveFolderIconOptions,
|
|
12
|
+
FolderIconOverrides,
|
|
13
|
+
} from './specialFolders';
|
|
14
|
+
|
|
9
15
|
export { loadMaterialIcons, getMaterialIconsSync } from './loader';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BookOpen,
|
|
5
|
+
FlaskConical,
|
|
6
|
+
Folder,
|
|
7
|
+
FolderCode,
|
|
8
|
+
FolderGit2,
|
|
9
|
+
FolderInput,
|
|
10
|
+
FolderOpen,
|
|
11
|
+
FolderOutput,
|
|
12
|
+
Github,
|
|
13
|
+
Image as ImageIcon,
|
|
14
|
+
Package,
|
|
15
|
+
Settings,
|
|
16
|
+
Terminal,
|
|
17
|
+
type LucideIcon,
|
|
18
|
+
} from 'lucide-react';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Conventional folder names → Lucide icon. Lookup is case-insensitive and
|
|
22
|
+
* trimmed. Anything not in this map falls back to a generic folder icon.
|
|
23
|
+
*
|
|
24
|
+
* Designed to feel "right" across the common dev project layouts (Node,
|
|
25
|
+
* Python, Go, Rust, Django, Next, Vite). Not exhaustive on purpose —
|
|
26
|
+
* keeps the bundle light and the behaviour predictable.
|
|
27
|
+
*/
|
|
28
|
+
const SPECIAL_FOLDERS: Record<string, LucideIcon> = {
|
|
29
|
+
src: FolderCode,
|
|
30
|
+
source: FolderCode,
|
|
31
|
+
lib: FolderCode,
|
|
32
|
+
app: FolderCode,
|
|
33
|
+
packages: Package,
|
|
34
|
+
node_modules: Package,
|
|
35
|
+
vendor: Package,
|
|
36
|
+
public: FolderInput,
|
|
37
|
+
static: FolderInput,
|
|
38
|
+
assets: ImageIcon,
|
|
39
|
+
images: ImageIcon,
|
|
40
|
+
media: ImageIcon,
|
|
41
|
+
dist: FolderOutput,
|
|
42
|
+
build: FolderOutput,
|
|
43
|
+
out: FolderOutput,
|
|
44
|
+
'.next': FolderOutput,
|
|
45
|
+
'.nuxt': FolderOutput,
|
|
46
|
+
'.turbo': FolderOutput,
|
|
47
|
+
docs: BookOpen,
|
|
48
|
+
documentation: BookOpen,
|
|
49
|
+
tests: FlaskConical,
|
|
50
|
+
test: FlaskConical,
|
|
51
|
+
__tests__: FlaskConical,
|
|
52
|
+
__test__: FlaskConical,
|
|
53
|
+
scripts: Terminal,
|
|
54
|
+
bin: Terminal,
|
|
55
|
+
config: Settings,
|
|
56
|
+
configs: Settings,
|
|
57
|
+
'.config': Settings,
|
|
58
|
+
'.vscode': Settings,
|
|
59
|
+
'.idea': Settings,
|
|
60
|
+
'.git': FolderGit2,
|
|
61
|
+
'.github': Github,
|
|
62
|
+
'.gitlab': FolderGit2,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export interface ResolveFolderIconOptions {
|
|
66
|
+
/** Folder display name (no path). */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Open / closed state — only used for the *generic* folder fallback. */
|
|
69
|
+
isExpanded?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Optional override map. Wins over the built-in table. Keys are
|
|
72
|
+
* matched case-insensitively after `trim()`.
|
|
73
|
+
*/
|
|
74
|
+
overrides?: Record<string, LucideIcon>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Pick the right folder icon for `name`. Returns `Folder` / `FolderOpen`
|
|
79
|
+
* for unknown names so callers can render the generic open/closed pair.
|
|
80
|
+
*/
|
|
81
|
+
export function resolveFolderIcon({
|
|
82
|
+
name,
|
|
83
|
+
isExpanded = false,
|
|
84
|
+
overrides,
|
|
85
|
+
}: ResolveFolderIconOptions): LucideIcon {
|
|
86
|
+
const key = name.trim().toLowerCase();
|
|
87
|
+
if (overrides?.[key]) return overrides[key];
|
|
88
|
+
const special = SPECIAL_FOLDERS[key];
|
|
89
|
+
if (special) return special;
|
|
90
|
+
return isExpanded ? FolderOpen : Folder;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type FolderIconOverrides = Record<string, LucideIcon>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { TreeNode, TreeRowSlot } from '../Tree/types';
|
|
4
4
|
import { FileIcon, type FileIconSize } from './FileIcon';
|
|
5
|
+
import type { FolderIconOverrides } from './specialFolders';
|
|
5
6
|
|
|
6
7
|
export interface CreateFileIconSlotOptions<T> {
|
|
7
8
|
/**
|
|
@@ -11,6 +12,11 @@ export interface CreateFileIconSlotOptions<T> {
|
|
|
11
12
|
getName: (node: TreeNode<T>) => string;
|
|
12
13
|
/** Pixel size for both file and folder icons. Default: 16. */
|
|
13
14
|
size?: FileIconSize;
|
|
15
|
+
/**
|
|
16
|
+
* Override or extend the built-in special-folder mapping (e.g. give
|
|
17
|
+
* `tests` a custom icon). Keys are matched case-insensitively.
|
|
18
|
+
*/
|
|
19
|
+
folderOverrides?: FolderIconOverrides;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
/**
|
|
@@ -29,6 +35,7 @@ export interface CreateFileIconSlotOptions<T> {
|
|
|
29
35
|
export function createFileIconSlot<T>({
|
|
30
36
|
getName,
|
|
31
37
|
size = 16,
|
|
38
|
+
folderOverrides,
|
|
32
39
|
}: CreateFileIconSlotOptions<T>): TreeRowSlot<T> {
|
|
33
40
|
return ({ node, isFolder, isExpanded }) => (
|
|
34
41
|
<FileIcon
|
|
@@ -36,6 +43,7 @@ export function createFileIconSlot<T>({
|
|
|
36
43
|
isFolder={isFolder}
|
|
37
44
|
isExpanded={isExpanded}
|
|
38
45
|
size={size}
|
|
46
|
+
folderOverrides={folderOverrides}
|
|
39
47
|
/>
|
|
40
48
|
);
|
|
41
49
|
}
|
|
@@ -181,6 +181,36 @@ export const Errors = () => {
|
|
|
181
181
|
);
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* UnfilledPathParams — regression guard for the ``%7Bid%7D`` bug.
|
|
186
|
+
*
|
|
187
|
+
* When a path template like ``/pet/{petId}`` is rendered before the
|
|
188
|
+
* user types a value, the path stays a template — not a percent-
|
|
189
|
+
* encoded string. Previously the URL parser turned ``{`` / ``}`` into
|
|
190
|
+
* ``%7B`` / ``%7D``, and the same encoded form leaked into every
|
|
191
|
+
* generated code sample (curl, axios, python, …) via the HAR
|
|
192
|
+
* intermediate.
|
|
193
|
+
*
|
|
194
|
+
* To verify visually:
|
|
195
|
+
* 1. Open any endpoint with a path param, e.g. ``GET /pet/{petId}``,
|
|
196
|
+
* ``GET /store/order/{orderId}``, or ``GET /user/{username}``.
|
|
197
|
+
* 2. Without filling the parameter, look at the header path and
|
|
198
|
+
* every Code Samples tab.
|
|
199
|
+
* 3. All occurrences must read ``{petId}``, never ``%7BpetId%7D``.
|
|
200
|
+
*/
|
|
201
|
+
export const UnfilledPathParams = () => {
|
|
202
|
+
const config: PlaygroundConfig = {
|
|
203
|
+
schemas: [PETSTORE_SCHEMA],
|
|
204
|
+
defaultSchemaId: 'petstore',
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<div className="min-h-[600px]">
|
|
209
|
+
<Playground config={config} />
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
184
214
|
/**
|
|
185
215
|
* Lazy — production lazy-loaded variant. Shows the loading spinner
|
|
186
216
|
* while the ~400 KB OpenAPI viewer chunk is fetched. Only path you
|