@djangocfg/ui-tools 2.1.429 → 2.1.431
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/tree/index.cjs +43 -8
- package/dist/tree/index.cjs.map +1 -1
- package/dist/tree/index.d.cts +31 -1
- package/dist/tree/index.d.ts +31 -1
- package/dist/tree/index.mjs +43 -8
- package/dist/tree/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/tools/chat/README.md +21 -0
- package/src/tools/chat/composer/PastedTextDialog.tsx +88 -0
- package/src/tools/chat/composer/index.ts +9 -0
- package/src/tools/chat/composer/textToAttachment.ts +69 -0
- package/src/tools/chat/composer/types.ts +13 -0
- package/src/tools/chat/composer/useComposerAttach.tsx +47 -0
- package/src/tools/chat/messages/Attachments.tsx +72 -8
- package/src/tools/chat/types/attachment.ts +12 -1
- package/src/tools/data/Tree/README.md +30 -0
- package/src/tools/data/Tree/components/TreeRow.tsx +11 -2
- package/src/tools/data/Tree/context/menu/render.tsx +56 -27
- package/src/tools/data/Tree/data/appearance.ts +65 -3
- package/src/tools/data/Tree/data/index.ts +2 -0
- package/src/tools/data/Tree/index.tsx +2 -0
package/dist/tree/index.cjs
CHANGED
|
@@ -141,6 +141,20 @@ var DENSITY_PRESETS = {
|
|
|
141
141
|
cozy: { rowHeight: 28, iconSize: 16, fontSize: 13, gap: 8 },
|
|
142
142
|
comfortable: { rowHeight: 32, iconSize: 16, fontSize: 14, gap: 8 }
|
|
143
143
|
};
|
|
144
|
+
var VARIANT_DEFAULTS = {
|
|
145
|
+
explorer: {
|
|
146
|
+
hideLeafIcons: false,
|
|
147
|
+
hideFolderIcons: false,
|
|
148
|
+
rowSizing: "fixed",
|
|
149
|
+
showActiveIndicator: true
|
|
150
|
+
},
|
|
151
|
+
list: {
|
|
152
|
+
hideLeafIcons: true,
|
|
153
|
+
hideFolderIcons: true,
|
|
154
|
+
rowSizing: "auto",
|
|
155
|
+
showActiveIndicator: false
|
|
156
|
+
}
|
|
157
|
+
};
|
|
144
158
|
var DEFAULT_TREE_APPEARANCE = {
|
|
145
159
|
density: "cozy",
|
|
146
160
|
...DENSITY_PRESETS.cozy,
|
|
@@ -149,12 +163,14 @@ var DEFAULT_TREE_APPEARANCE = {
|
|
|
149
163
|
accent: "default",
|
|
150
164
|
radius: "sm",
|
|
151
165
|
indentGuideOpacity: 0.4,
|
|
152
|
-
|
|
166
|
+
...VARIANT_DEFAULTS.explorer
|
|
153
167
|
};
|
|
154
168
|
function resolveAppearance(input, outerIndent) {
|
|
155
169
|
if (!input && outerIndent === void 0) return DEFAULT_TREE_APPEARANCE;
|
|
156
170
|
const density = input?.density ?? "cozy";
|
|
157
171
|
const preset = DENSITY_PRESETS[density];
|
|
172
|
+
const variant = input?.variant ?? "explorer";
|
|
173
|
+
const v = VARIANT_DEFAULTS[variant];
|
|
158
174
|
return {
|
|
159
175
|
density,
|
|
160
176
|
rowHeight: input?.rowHeight ?? preset.rowHeight,
|
|
@@ -166,7 +182,10 @@ function resolveAppearance(input, outerIndent) {
|
|
|
166
182
|
accent: input?.accent ?? DEFAULT_TREE_APPEARANCE.accent,
|
|
167
183
|
radius: input?.radius ?? DEFAULT_TREE_APPEARANCE.radius,
|
|
168
184
|
indentGuideOpacity: input?.indentGuideOpacity ?? DEFAULT_TREE_APPEARANCE.indentGuideOpacity,
|
|
169
|
-
showActiveIndicator: input?.showActiveIndicator ??
|
|
185
|
+
showActiveIndicator: input?.showActiveIndicator ?? v.showActiveIndicator,
|
|
186
|
+
hideLeafIcons: input?.hideLeafIcons ?? v.hideLeafIcons,
|
|
187
|
+
hideFolderIcons: input?.hideFolderIcons ?? v.hideFolderIcons,
|
|
188
|
+
rowSizing: input?.rowSizing ?? v.rowSizing
|
|
170
189
|
};
|
|
171
190
|
}
|
|
172
191
|
chunkPK6SKIKE_cjs.__name(resolveAppearance, "resolveAppearance");
|
|
@@ -1071,10 +1090,15 @@ function useResolvedMenu(opts) {
|
|
|
1071
1090
|
]);
|
|
1072
1091
|
}
|
|
1073
1092
|
chunkPK6SKIKE_cjs.__name(useResolvedMenu, "useResolvedMenu");
|
|
1074
|
-
function
|
|
1075
|
-
|
|
1093
|
+
function RowContextMenu({
|
|
1094
|
+
rowProps,
|
|
1095
|
+
items,
|
|
1096
|
+
trigger
|
|
1097
|
+
}) {
|
|
1098
|
+
const [open, setOpen] = React.useState(false);
|
|
1099
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components.ContextMenu, { onOpenChange: setOpen, children: [
|
|
1076
1100
|
/* @__PURE__ */ jsxRuntime.jsx(components.ContextMenuTrigger, { asChild: true, children: trigger }),
|
|
1077
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.ContextMenuContent, { children: items.map((item, idx) => {
|
|
1101
|
+
open ? /* @__PURE__ */ jsxRuntime.jsx(components.ContextMenuContent, { children: items.map((item, idx) => {
|
|
1078
1102
|
if (item === "separator") {
|
|
1079
1103
|
return /* @__PURE__ */ jsxRuntime.jsx(components.ContextMenuSeparator, {}, `sep-${idx}`);
|
|
1080
1104
|
}
|
|
@@ -1093,9 +1117,13 @@ function renderItemsAsContextMenu(rowProps, items, trigger) {
|
|
|
1093
1117
|
},
|
|
1094
1118
|
item.id
|
|
1095
1119
|
);
|
|
1096
|
-
}) })
|
|
1120
|
+
}) }) : null
|
|
1097
1121
|
] });
|
|
1098
1122
|
}
|
|
1123
|
+
chunkPK6SKIKE_cjs.__name(RowContextMenu, "RowContextMenu");
|
|
1124
|
+
function renderItemsAsContextMenu(rowProps, items, trigger) {
|
|
1125
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RowContextMenu, { rowProps, items, trigger });
|
|
1126
|
+
}
|
|
1099
1127
|
chunkPK6SKIKE_cjs.__name(renderItemsAsContextMenu, "renderItemsAsContextMenu");
|
|
1100
1128
|
function tidyMenuItems(items) {
|
|
1101
1129
|
const out = [];
|
|
@@ -1990,7 +2018,14 @@ function TreeRowRaw({ row, className }) {
|
|
|
1990
2018
|
tabIndex: -1,
|
|
1991
2019
|
style: {
|
|
1992
2020
|
paddingLeft: 6 + level * appearance.indent,
|
|
1993
|
-
|
|
2021
|
+
// `auto` sizing lets a multi-line label (e.g. title + meta in a
|
|
2022
|
+
// chat-history list) grow the row instead of overflowing a fixed
|
|
2023
|
+
// height. `fixed` keeps the classic single-line explorer row.
|
|
2024
|
+
...appearance.rowSizing === "auto" ? {
|
|
2025
|
+
minHeight: "var(--tree-row-height)",
|
|
2026
|
+
paddingTop: 4,
|
|
2027
|
+
paddingBottom: 4
|
|
2028
|
+
} : { height: "var(--tree-row-height)" },
|
|
1994
2029
|
gap: "var(--tree-gap)"
|
|
1995
2030
|
},
|
|
1996
2031
|
...dnd.active ? draggable.listeners : {},
|
|
@@ -2041,7 +2076,7 @@ function TreeRowRaw({ row, className }) {
|
|
|
2041
2076
|
style: { width: "var(--tree-icon-size)", height: "var(--tree-icon-size)" },
|
|
2042
2077
|
className: "shrink-0 animate-spin text-muted-foreground/70"
|
|
2043
2078
|
}
|
|
2044
|
-
) : renderIcon ? renderIcon(slot) : /* @__PURE__ */ jsxRuntime.jsx(TreeIcon, { isFolder, isExpanded }),
|
|
2079
|
+
) : renderIcon ? renderIcon(slot) : (isFolder ? appearance.hideFolderIcons : appearance.hideLeafIcons) ? null : /* @__PURE__ */ jsxRuntime.jsx(TreeIcon, { isFolder, isExpanded }),
|
|
2045
2080
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2046
2081
|
"span",
|
|
2047
2082
|
{
|