@blitheforge/media-library 1.0.8 → 1.1.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/README.md +51 -15
- package/dist/client.cjs +140 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +68 -0
- package/dist/client.d.ts +68 -0
- package/dist/client.js +106 -0
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +23 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -39
- package/dist/index.js.map +1 -1
- package/dist/style.css +83 -1
- package/package.json +19 -7
package/dist/index.cjs
CHANGED
|
@@ -159,13 +159,6 @@ function isImagePath(path) {
|
|
|
159
159
|
// src/components/media-library-modal.tsx
|
|
160
160
|
var import_react_dom2 = require("react-dom");
|
|
161
161
|
|
|
162
|
-
// src/utils/cn.ts
|
|
163
|
-
var import_clsx = require("clsx");
|
|
164
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
165
|
-
function cn(...inputs) {
|
|
166
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
162
|
// src/utils/bfml-theme.ts
|
|
170
163
|
function bfmlRootProps(theme = "sync") {
|
|
171
164
|
return {
|
|
@@ -181,6 +174,13 @@ function resolveThemeMode(theme) {
|
|
|
181
174
|
var import_react2 = require("react");
|
|
182
175
|
var import_lucide_react3 = require("lucide-react");
|
|
183
176
|
|
|
177
|
+
// src/utils/cn.ts
|
|
178
|
+
var import_clsx = require("clsx");
|
|
179
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
180
|
+
function cn(...inputs) {
|
|
181
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
184
|
// src/components/ui/button.tsx
|
|
185
185
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
186
186
|
var variants = {
|
|
@@ -222,11 +222,10 @@ function ConfirmDialog({
|
|
|
222
222
|
if (!open || typeof document === "undefined") return null;
|
|
223
223
|
const rootProps = bfmlRootProps(theme);
|
|
224
224
|
return (0, import_react_dom.createPortal)(
|
|
225
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
226
226
|
"div",
|
|
227
227
|
{
|
|
228
|
-
|
|
229
|
-
className: cn(rootProps.className, "fixed inset-0 z-[10001] flex items-end justify-center p-0 backdrop-blur-sm sm:items-center sm:p-4"),
|
|
228
|
+
className: "fixed inset-0 z-[10060] flex items-end justify-center p-0 backdrop-blur-sm sm:items-center sm:p-4",
|
|
230
229
|
style: { backgroundColor: "var(--bfml-overlay)" },
|
|
231
230
|
role: "presentation",
|
|
232
231
|
onClick: onCancel,
|
|
@@ -250,7 +249,7 @@ function ConfirmDialog({
|
|
|
250
249
|
}
|
|
251
250
|
)
|
|
252
251
|
}
|
|
253
|
-
),
|
|
252
|
+
) }),
|
|
254
253
|
document.body
|
|
255
254
|
);
|
|
256
255
|
}
|
|
@@ -347,19 +346,12 @@ function ToastCard({ toast }) {
|
|
|
347
346
|
}
|
|
348
347
|
function ToastContainer({ theme = "sync" }) {
|
|
349
348
|
const [items, setItems] = (0, import_react.useState)([]);
|
|
350
|
-
|
|
349
|
+
void theme;
|
|
351
350
|
(0, import_react.useEffect)(() => {
|
|
352
351
|
return subscribeToasts(setItems);
|
|
353
352
|
}, []);
|
|
354
353
|
if (items.length === 0) return null;
|
|
355
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
356
|
-
"div",
|
|
357
|
-
{
|
|
358
|
-
...rootProps,
|
|
359
|
-
className: cn(rootProps.className, "pointer-events-none absolute right-3 top-3 z-[45] flex w-[min(100%,20rem)] flex-col items-end gap-2 sm:right-4 sm:top-4"),
|
|
360
|
-
children: items.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ToastCard, { toast }, toast.id))
|
|
361
|
-
}
|
|
362
|
-
);
|
|
354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "pointer-events-none absolute right-3 top-3 z-[45] flex w-[min(100%,20rem)] flex-col items-end gap-2 sm:right-4 sm:top-4", children: items.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ToastCard, { toast }, toast.id)) });
|
|
363
355
|
}
|
|
364
356
|
|
|
365
357
|
// src/components/upload-preview.tsx
|
|
@@ -786,12 +778,10 @@ function MediaLibraryPanel({
|
|
|
786
778
|
folder.path || "root"
|
|
787
779
|
);
|
|
788
780
|
}) });
|
|
789
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...rootProps, className: "h-full min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
790
782
|
"section",
|
|
791
783
|
{
|
|
792
|
-
...rootProps,
|
|
793
784
|
className: cn(
|
|
794
|
-
rootProps.className,
|
|
795
785
|
"relative flex h-full min-h-0 flex-col overflow-hidden bg-[var(--bfml-surface)]",
|
|
796
786
|
variant === "modal" && "h-[100dvh] w-full max-w-none border-0 shadow-[var(--bfml-shadow-lg)] sm:h-[min(92vh,760px)] sm:max-w-6xl sm:rounded-2xl sm:border sm:border-[var(--bfml-border)]",
|
|
797
787
|
variant === "embedded" && "rounded-none border-0 shadow-none",
|
|
@@ -1058,7 +1048,7 @@ function MediaLibraryPanel({
|
|
|
1058
1048
|
)
|
|
1059
1049
|
]
|
|
1060
1050
|
}
|
|
1061
|
-
);
|
|
1051
|
+
) });
|
|
1062
1052
|
}
|
|
1063
1053
|
|
|
1064
1054
|
// src/components/media-library-modal.tsx
|
|
@@ -1083,14 +1073,10 @@ function MediaLibraryModal({
|
|
|
1083
1073
|
const rootProps = bfmlRootProps(themeMode);
|
|
1084
1074
|
if (!open || typeof document === "undefined") return null;
|
|
1085
1075
|
return (0, import_react_dom2.createPortal)(
|
|
1086
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1087
1077
|
"div",
|
|
1088
1078
|
{
|
|
1089
|
-
|
|
1090
|
-
className: cn(
|
|
1091
|
-
rootProps.className,
|
|
1092
|
-
"fixed inset-0 z-[9999] flex items-stretch justify-center p-0 backdrop-blur-sm sm:items-center sm:p-2 md:p-4"
|
|
1093
|
-
),
|
|
1079
|
+
className: "fixed inset-0 z-[10050] flex items-stretch justify-center p-0 backdrop-blur-sm sm:items-center sm:p-2 md:p-4",
|
|
1094
1080
|
style: { backgroundColor: "var(--bfml-overlay)" },
|
|
1095
1081
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1096
1082
|
MediaLibraryPanel,
|
|
@@ -1113,7 +1099,7 @@ function MediaLibraryModal({
|
|
|
1113
1099
|
}
|
|
1114
1100
|
)
|
|
1115
1101
|
}
|
|
1116
|
-
),
|
|
1102
|
+
) }),
|
|
1117
1103
|
document.body
|
|
1118
1104
|
);
|
|
1119
1105
|
}
|
|
@@ -1145,12 +1131,10 @@ function MediaLibraryWidget({
|
|
|
1145
1131
|
const resolved = { ...defaultMediaLibraryConfig, ...config };
|
|
1146
1132
|
const themeMode = resolveThemeMode(theme ?? resolved.theme);
|
|
1147
1133
|
const rootProps = bfmlRootProps(themeMode);
|
|
1148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1149
1135
|
"div",
|
|
1150
1136
|
{
|
|
1151
|
-
...rootProps,
|
|
1152
1137
|
className: cn(
|
|
1153
|
-
rootProps.className,
|
|
1154
1138
|
"overflow-hidden rounded-2xl border border-[var(--bfml-border)] bg-[var(--bfml-surface)] shadow-[var(--bfml-shadow-lg)]",
|
|
1155
1139
|
className
|
|
1156
1140
|
),
|
|
@@ -1174,7 +1158,7 @@ function MediaLibraryWidget({
|
|
|
1174
1158
|
}
|
|
1175
1159
|
)
|
|
1176
1160
|
}
|
|
1177
|
-
);
|
|
1161
|
+
) });
|
|
1178
1162
|
}
|
|
1179
1163
|
|
|
1180
1164
|
// src/components/media-picker.tsx
|
|
@@ -1270,7 +1254,7 @@ function MediaPicker({
|
|
|
1270
1254
|
}
|
|
1271
1255
|
const currentValue = value ?? selectedPath;
|
|
1272
1256
|
const fileName = currentValue ? fileNameFromPath(currentValue) : null;
|
|
1273
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.
|
|
1257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("space-y-2", className), children: [
|
|
1274
1258
|
label ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-sm font-medium text-[var(--bfml-foreground)]", children: label }) : null,
|
|
1275
1259
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1276
1260
|
"button",
|
|
@@ -1302,7 +1286,7 @@ function MediaPicker({
|
|
|
1302
1286
|
accept
|
|
1303
1287
|
}
|
|
1304
1288
|
)
|
|
1305
|
-
] });
|
|
1289
|
+
] }) });
|
|
1306
1290
|
}
|
|
1307
1291
|
|
|
1308
1292
|
// src/components/media-picker-multi.tsx
|
|
@@ -1351,7 +1335,7 @@ function MediaPickerMulti({
|
|
|
1351
1335
|
return next;
|
|
1352
1336
|
});
|
|
1353
1337
|
}
|
|
1354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.
|
|
1338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("space-y-2", className), children: [
|
|
1355
1339
|
label ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-sm font-medium text-[var(--bfml-foreground)]", children: label }) : null,
|
|
1356
1340
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "overflow-hidden rounded-xl border border-[var(--bfml-border)] bg-[var(--bfml-surface-soft)]", children: [
|
|
1357
1341
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
@@ -1414,7 +1398,7 @@ function MediaPickerMulti({
|
|
|
1414
1398
|
accept
|
|
1415
1399
|
}
|
|
1416
1400
|
)
|
|
1417
|
-
] });
|
|
1401
|
+
] }) });
|
|
1418
1402
|
}
|
|
1419
1403
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1420
1404
|
0 && (module.exports = {
|