clefbase 1.2.4 → 1.3.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/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/StorageImage.d.ts +77 -0
- package/dist/react/StorageImage.d.ts.map +1 -0
- package/dist/react/StorageImage.js +150 -0
- package/dist/react/StorageImage.js.map +1 -0
- package/dist/vue/StorageImage.d.ts +101 -0
- package/dist/vue/StorageImage.d.ts.map +1 -0
- package/dist/vue/StorageImage.js +138 -0
- package/dist/vue/StorageImage.js.map +1 -0
- package/package.json +17 -3
package/dist/cli.js
CHANGED
|
@@ -34405,7 +34405,7 @@ async function runSitesList(cwd = process.cwd()) {
|
|
|
34405
34405
|
}
|
|
34406
34406
|
|
|
34407
34407
|
// package.json
|
|
34408
|
-
var version = "1.
|
|
34408
|
+
var version = "1.3.1";
|
|
34409
34409
|
|
|
34410
34410
|
// src/cli/index.ts
|
|
34411
34411
|
var program2 = new Command();
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { Database, CollectionReference, DocumentReference, Query } from "./db";
|
|
|
21
21
|
export { Auth } from "./auth";
|
|
22
22
|
export { ClefbaseStorage, StorageReference, BucketReference } from "./storage";
|
|
23
23
|
export type { StorageFile } from "./storage";
|
|
24
|
+
export type { StorageImageStatus } from "./react/StorageImage";
|
|
24
25
|
export { ClefbaseHosting, SiteReference } from "./hosting";
|
|
25
26
|
export type { HostingSite, HostingDeploy, HostingFile, DeployResult, DeployOptions, HostingStatus, DeployStatus, } from "./hosting";
|
|
26
27
|
export type { ClefbaseConfig, ClefbaseDocument, QueryOptions, QueryResult, FilterOperator, WhereClause, WhereValue, AuthUser, AuthSession, AuthResult, } from "./types";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","s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W,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,iFAAiF;AACjF,6BAQe;AAPb,kGAAA,WAAW,OAAA;AACX,mGAAA,YAAY,OAAA;AACZ,6FAAA,MAAM,OAAA;AACN,kGAAA,WAAW,OAAA;AACX,8FAAA,OAAO,OAAA;AACP,iGAAA,UAAU,OAAA;AACV,iGAAA,UAAU,OAAA;AAGZ,iFAAiF;AACjF,2BAA+E;AAAtE,8FAAA,QAAQ,OAAA;AAAE,yGAAA,mBAAmB,OAAA;AAAE,uGAAA,iBAAiB,OAAA;AAAE,2FAAA,KAAK,OAAA;AAEhE,iFAAiF;AACjF,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iFAAiF;AACjF,qCAA+E;AAAtE,0GAAA,eAAe,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,0GAAA,eAAe,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,iFAAiF;AACjF,6BAQe;AAPb,kGAAA,WAAW,OAAA;AACX,mGAAA,YAAY,OAAA;AACZ,6FAAA,MAAM,OAAA;AACN,kGAAA,WAAW,OAAA;AACX,8FAAA,OAAO,OAAA;AACP,iGAAA,UAAU,OAAA;AACV,iGAAA,UAAU,OAAA;AAGZ,iFAAiF;AACjF,2BAA+E;AAAtE,8FAAA,QAAQ,OAAA;AAAE,yGAAA,mBAAmB,OAAA;AAAE,uGAAA,iBAAiB,OAAA;AAAE,2FAAA,KAAK,OAAA;AAEhE,iFAAiF;AACjF,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iFAAiF;AACjF,qCAA+E;AAAtE,0GAAA,eAAe,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAW3D,iFAAiF;AACjF,qCAA2D;AAAlD,0GAAA,eAAe,OAAA;AAAE,wGAAA,aAAa,OAAA;AAyBvC,iCAAwC;AAA/B,sGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { type ImgHTMLAttributes } from "react";
|
|
2
|
+
import type { ClefbaseStorage } from "../storage";
|
|
3
|
+
export type StorageImageStatus = "loading" | "loaded" | "error";
|
|
4
|
+
export interface StorageImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src"> {
|
|
5
|
+
/**
|
|
6
|
+
* The ClefbaseStorage instance returned by `getStorage(app)`.
|
|
7
|
+
*/
|
|
8
|
+
storage: ClefbaseStorage;
|
|
9
|
+
/**
|
|
10
|
+
* Path inside the default bucket, e.g. `"avatars/user-123.jpg"`.
|
|
11
|
+
* Mutually exclusive with `bucket` + `path`.
|
|
12
|
+
*/
|
|
13
|
+
src?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Named bucket to read from. Pair with `path`.
|
|
16
|
+
*/
|
|
17
|
+
bucket?: string;
|
|
18
|
+
/**
|
|
19
|
+
* File path inside `bucket`.
|
|
20
|
+
*/
|
|
21
|
+
path?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Shown while the download URL is being resolved.
|
|
24
|
+
* Accepts a URL string or any React node.
|
|
25
|
+
*/
|
|
26
|
+
placeholder?: React.ReactNode | string;
|
|
27
|
+
/**
|
|
28
|
+
* Shown when the URL cannot be resolved or the image fails to load.
|
|
29
|
+
* Accepts a URL string or any React node.
|
|
30
|
+
*/
|
|
31
|
+
fallback?: React.ReactNode | string;
|
|
32
|
+
/**
|
|
33
|
+
* Called with the resolved download URL once ready.
|
|
34
|
+
*/
|
|
35
|
+
onResolve?: (url: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Called if URL resolution or image loading fails.
|
|
38
|
+
*/
|
|
39
|
+
onError?: (err: unknown) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Called whenever the loading status changes.
|
|
42
|
+
*/
|
|
43
|
+
onStatusChange?: (status: StorageImageStatus) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A drop-in replacement for `<img>` that resolves Clefbase storage paths to
|
|
47
|
+
* authenticated download URLs automatically.
|
|
48
|
+
*
|
|
49
|
+
* @example — default bucket
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const storage = getStorage(app);
|
|
52
|
+
*
|
|
53
|
+
* <StorageImage
|
|
54
|
+
* storage={storage}
|
|
55
|
+
* src="avatars/user-123.jpg"
|
|
56
|
+
* alt="User avatar"
|
|
57
|
+
* width={64}
|
|
58
|
+
* height={64}
|
|
59
|
+
* style={{ borderRadius: "50%" }}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example — named bucket
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <StorageImage
|
|
66
|
+
* storage={storage}
|
|
67
|
+
* bucket="media"
|
|
68
|
+
* path="products/shoe.webp"
|
|
69
|
+
* alt="Product photo"
|
|
70
|
+
* placeholder={<Spinner />}
|
|
71
|
+
* fallback={<img src="/no-image.svg" alt="Not found" />}
|
|
72
|
+
* />
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const StorageImage: React.ForwardRefExoticComponent<StorageImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
76
|
+
export default StorageImage;
|
|
77
|
+
//# sourceMappingURL=StorageImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageImage.d.ts","sourceRoot":"","sources":["../../src/react/StorageImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACxD;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAEvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACvD;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,YAAY,4FAuKxB,CAAC;AAIF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorageImage = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
// ─── StorageImage ─────────────────────────────────────────────────────────────
|
|
7
|
+
/**
|
|
8
|
+
* A drop-in replacement for `<img>` that resolves Clefbase storage paths to
|
|
9
|
+
* authenticated download URLs automatically.
|
|
10
|
+
*
|
|
11
|
+
* @example — default bucket
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const storage = getStorage(app);
|
|
14
|
+
*
|
|
15
|
+
* <StorageImage
|
|
16
|
+
* storage={storage}
|
|
17
|
+
* src="avatars/user-123.jpg"
|
|
18
|
+
* alt="User avatar"
|
|
19
|
+
* width={64}
|
|
20
|
+
* height={64}
|
|
21
|
+
* style={{ borderRadius: "50%" }}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example — named bucket
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <StorageImage
|
|
28
|
+
* storage={storage}
|
|
29
|
+
* bucket="media"
|
|
30
|
+
* path="products/shoe.webp"
|
|
31
|
+
* alt="Product photo"
|
|
32
|
+
* placeholder={<Spinner />}
|
|
33
|
+
* fallback={<img src="/no-image.svg" alt="Not found" />}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
exports.StorageImage = (0, react_1.forwardRef)(function StorageImage({ storage, src, bucket, path, placeholder, fallback, onResolve, onError, onStatusChange, alt = "", ...imgProps }, ref) {
|
|
38
|
+
// Resolve the URL synchronously where possible (_directUrl is pure/sync)
|
|
39
|
+
// to avoid an async waterfall that exhausts the browser's per-host
|
|
40
|
+
// connection pool (typically 6 connections) when many cards mount at once.
|
|
41
|
+
const getDirectUrl = () => {
|
|
42
|
+
try {
|
|
43
|
+
if (bucket && path)
|
|
44
|
+
return storage._directUrl(bucket, path);
|
|
45
|
+
if (src)
|
|
46
|
+
return storage._directUrl(storage["_defaultBucket"] ?? "default", src);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const initialUrl = getDirectUrl();
|
|
54
|
+
const [resolvedUrl, setResolvedUrl] = (0, react_1.useState)(initialUrl);
|
|
55
|
+
const [status, setStatus] = (0, react_1.useState)(initialUrl ? "loaded" : "loading");
|
|
56
|
+
// Keep a ref to the latest callbacks so the effect closure stays stable.
|
|
57
|
+
const onResolveRef = (0, react_1.useRef)(onResolve);
|
|
58
|
+
const onErrorRef = (0, react_1.useRef)(onError);
|
|
59
|
+
const onStatusRef = (0, react_1.useRef)(onStatusChange);
|
|
60
|
+
onResolveRef.current = onResolve;
|
|
61
|
+
onErrorRef.current = onError;
|
|
62
|
+
onStatusRef.current = onStatusChange;
|
|
63
|
+
// Determine the key that uniquely identifies the requested file.
|
|
64
|
+
const fileKey = bucket && path ? `${bucket}::${path}` : src ?? null;
|
|
65
|
+
(0, react_1.useEffect)(() => {
|
|
66
|
+
// If we already resolved synchronously, notify callers and skip the
|
|
67
|
+
// async effect entirely — no extra network round-trip needed.
|
|
68
|
+
if (initialUrl) {
|
|
69
|
+
onResolveRef.current?.(initialUrl);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!fileKey)
|
|
73
|
+
return;
|
|
74
|
+
let cancelled = false;
|
|
75
|
+
setStatus("loading");
|
|
76
|
+
onStatusRef.current?.("loading");
|
|
77
|
+
const resolve = async () => {
|
|
78
|
+
try {
|
|
79
|
+
let url;
|
|
80
|
+
if (bucket && path) {
|
|
81
|
+
url = storage.bucket(bucket).ref(path).getDownloadURL
|
|
82
|
+
? await storage.bucket(bucket).ref(path).getDownloadURL()
|
|
83
|
+
: storage._directUrl(bucket, path);
|
|
84
|
+
}
|
|
85
|
+
else if (src) {
|
|
86
|
+
url = await storage.ref(src).getDownloadURL();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
throw new Error("StorageImage: provide either `src` or both `bucket` + `path`.");
|
|
90
|
+
}
|
|
91
|
+
if (cancelled)
|
|
92
|
+
return;
|
|
93
|
+
setResolvedUrl(url);
|
|
94
|
+
onResolveRef.current?.(url);
|
|
95
|
+
// status moves to "loaded" in the <img> onLoad handler below
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
if (cancelled)
|
|
99
|
+
return;
|
|
100
|
+
setStatus("error");
|
|
101
|
+
onStatusRef.current?.("error");
|
|
102
|
+
onErrorRef.current?.(err);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
resolve();
|
|
106
|
+
return () => {
|
|
107
|
+
cancelled = true;
|
|
108
|
+
};
|
|
109
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
|
+
}, [fileKey]);
|
|
111
|
+
// ── Render helpers ────────────────────────────────────────────────────────
|
|
112
|
+
const handleLoad = () => {
|
|
113
|
+
setStatus("loaded");
|
|
114
|
+
onStatusRef.current?.("loaded");
|
|
115
|
+
};
|
|
116
|
+
const handleImgError = (e) => {
|
|
117
|
+
setStatus("error");
|
|
118
|
+
onStatusRef.current?.("error");
|
|
119
|
+
onErrorRef.current?.(e);
|
|
120
|
+
};
|
|
121
|
+
// Show placeholder while resolving URL
|
|
122
|
+
if (status === "loading" && !resolvedUrl) {
|
|
123
|
+
if (placeholder === undefined) {
|
|
124
|
+
// Invisible img keeps layout stable
|
|
125
|
+
return ((0, jsx_runtime_1.jsx)("img", { ...imgProps, ref: ref, src: "", alt: alt, style: { ...imgProps.style, visibility: "hidden" } }));
|
|
126
|
+
}
|
|
127
|
+
if (typeof placeholder === "string") {
|
|
128
|
+
return ((0, jsx_runtime_1.jsx)("img", { ...imgProps, ref: ref, src: placeholder, alt: alt }));
|
|
129
|
+
}
|
|
130
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: placeholder });
|
|
131
|
+
}
|
|
132
|
+
// Show fallback on error
|
|
133
|
+
if (status === "error" || !resolvedUrl) {
|
|
134
|
+
if (fallback === undefined) {
|
|
135
|
+
return ((0, jsx_runtime_1.jsx)("img", { ...imgProps, ref: ref, src: "", alt: alt, style: { ...imgProps.style, visibility: "hidden" } }));
|
|
136
|
+
}
|
|
137
|
+
if (typeof fallback === "string") {
|
|
138
|
+
return (0, jsx_runtime_1.jsx)("img", { ...imgProps, ref: ref, src: fallback, alt: alt });
|
|
139
|
+
}
|
|
140
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fallback });
|
|
141
|
+
}
|
|
142
|
+
// Resolved — render the real image.
|
|
143
|
+
// `loading="lazy"` defers off-screen fetches so the browser never
|
|
144
|
+
// saturates its per-host connection pool (typically 6) when many
|
|
145
|
+
// cards render simultaneously. Callers may override with loading="eager".
|
|
146
|
+
return ((0, jsx_runtime_1.jsx)("img", { loading: "lazy", ...imgProps, ref: ref, src: resolvedUrl, alt: alt, onLoad: handleLoad, onError: handleImgError }));
|
|
147
|
+
});
|
|
148
|
+
exports.StorageImage.displayName = "StorageImage";
|
|
149
|
+
exports.default = exports.StorageImage;
|
|
150
|
+
//# sourceMappingURL=StorageImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageImage.js","sourceRoot":"","sources":["../../src/react/StorageImage.tsx"],"names":[],"mappings":";;;;AAAA,iCAMe;AA0Df,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACU,QAAA,YAAY,GAAG,IAAA,kBAAU,EACpC,SAAS,YAAY,CACnB,EACE,OAAO,EACP,GAAG,EACH,MAAM,EACN,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,SAAS,EACT,OAAO,EACP,cAAc,EACd,GAAG,GAAG,EAAE,EACR,GAAG,QAAQ,EACZ,EACD,GAAG;IAEH,yEAAyE;IACzE,mEAAmE;IACnE,2EAA2E;IAC3E,MAAM,YAAY,GAAG,GAAkB,EAAE;QACvC,IAAI,CAAC;YACH,IAAI,MAAM,IAAI,IAAI;gBAAE,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC5D,IAAI,GAAG;gBAAa,OAAO,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,SAAS,EAAE,GAAG,CAAC,CAAC;YAC3F,OAAO,IAAI,CAAC;QACd,CAAC;QAAC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E,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;QAClE,CAAC;QACD,OAAO,2DAAG,QAAQ,GAAI,CAAC;IACzB,CAAC;IAED,oCAAoC;IACpC,kEAAkE;IAClE,iEAAiE;IACjE,0EAA0E;IAC1E,OAAO,CACL,gCACE,OAAO,EAAC,MAAM,KACV,QAAQ,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,cAAc,GACvB,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,kBAAe,oBAAY,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorageImage for Vue 3 — plain TypeScript, no SFC compiler needed.
|
|
3
|
+
*
|
|
4
|
+
* Place at: src/vue/StorageImage.ts
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { StorageImage } from "clefbase/vue";
|
|
8
|
+
*
|
|
9
|
+
* // Template usage:
|
|
10
|
+
* <StorageImage :storage="storage" src="avatars/user-123.jpg" alt="Avatar" />
|
|
11
|
+
*
|
|
12
|
+
* // Named bucket + slots:
|
|
13
|
+
* <StorageImage :storage="storage" bucket="media" path="photo.webp" alt="Photo">
|
|
14
|
+
* <template #placeholder><Spinner /></template>
|
|
15
|
+
* <template #fallback><img src="/no-image.svg" alt="" /></template>
|
|
16
|
+
* </StorageImage>
|
|
17
|
+
*/
|
|
18
|
+
import { type PropType } from "vue";
|
|
19
|
+
import type { ClefbaseStorage } from "../storage";
|
|
20
|
+
export type StorageImageStatus = "loading" | "loaded" | "error";
|
|
21
|
+
export declare const StorageImage: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
22
|
+
/** The ClefbaseStorage instance returned by `getStorage(app)`. */
|
|
23
|
+
storage: {
|
|
24
|
+
type: PropType<ClefbaseStorage>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Path inside the default bucket, e.g. `"avatars/user-123.jpg"`.
|
|
29
|
+
* Mutually exclusive with `bucket` + `path`.
|
|
30
|
+
*/
|
|
31
|
+
src: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
/** Named bucket to read from. Pair with `path`. */
|
|
36
|
+
bucket: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
/** File path inside `bucket`. */
|
|
41
|
+
path: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
/** Alt text forwarded to the underlying <img>. */
|
|
46
|
+
alt: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
default: string;
|
|
49
|
+
};
|
|
50
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
55
|
+
/** Emitted with the resolved download URL once ready. */
|
|
56
|
+
resolve: (_url: string) => true;
|
|
57
|
+
/** Emitted if URL resolution or image loading fails. */
|
|
58
|
+
error: (_err: unknown) => true;
|
|
59
|
+
/** Emitted whenever the loading status changes. */
|
|
60
|
+
"status-change": (_status: StorageImageStatus) => true;
|
|
61
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
62
|
+
/** The ClefbaseStorage instance returned by `getStorage(app)`. */
|
|
63
|
+
storage: {
|
|
64
|
+
type: PropType<ClefbaseStorage>;
|
|
65
|
+
required: true;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Path inside the default bucket, e.g. `"avatars/user-123.jpg"`.
|
|
69
|
+
* Mutually exclusive with `bucket` + `path`.
|
|
70
|
+
*/
|
|
71
|
+
src: {
|
|
72
|
+
type: StringConstructor;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
/** Named bucket to read from. Pair with `path`. */
|
|
76
|
+
bucket: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
80
|
+
/** File path inside `bucket`. */
|
|
81
|
+
path: {
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
default: undefined;
|
|
84
|
+
};
|
|
85
|
+
/** Alt text forwarded to the underlying <img>. */
|
|
86
|
+
alt: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
default: string;
|
|
89
|
+
};
|
|
90
|
+
}>> & Readonly<{
|
|
91
|
+
onError?: ((_err: unknown) => any) | undefined;
|
|
92
|
+
onResolve?: ((_url: string) => any) | undefined;
|
|
93
|
+
"onStatus-change"?: ((_status: StorageImageStatus) => any) | undefined;
|
|
94
|
+
}>, {
|
|
95
|
+
src: string;
|
|
96
|
+
bucket: string;
|
|
97
|
+
path: string;
|
|
98
|
+
alt: string;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
100
|
+
export default StorageImage;
|
|
101
|
+
//# sourceMappingURL=StorageImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageImage.d.ts","sourceRoot":"","sources":["../../src/vue/StorageImage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE,eAAO,MAAM,YAAY;IAMrB,kEAAkE;;cAEhD,QAAQ,CAAC,eAAe,CAAC;;;IAG3C;;;OAGG;;;;;IAKH,mDAAmD;;;;;IAKnD,iCAAiC;;;;;IAKjC,kDAAkD;;;;;;;;;;IAQlD,yDAAyD;oBACzC,MAAM;IACtB,wDAAwD;kBAC1C,OAAO;IACrB,mDAAmD;+BACxB,kBAAkB;;IApC7C,kEAAkE;;cAEhD,QAAQ,CAAC,eAAe,CAAC;;;IAG3C;;;OAGG;;;;;IAKH,mDAAmD;;;;;IAKnD,iCAAiC;;;;;IAKjC,kDAAkD;;;;;;;;;;;;;;4EAuGpD,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* StorageImage for Vue 3 — plain TypeScript, no SFC compiler needed.
|
|
4
|
+
*
|
|
5
|
+
* Place at: src/vue/StorageImage.ts
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import { StorageImage } from "clefbase/vue";
|
|
9
|
+
*
|
|
10
|
+
* // Template usage:
|
|
11
|
+
* <StorageImage :storage="storage" src="avatars/user-123.jpg" alt="Avatar" />
|
|
12
|
+
*
|
|
13
|
+
* // Named bucket + slots:
|
|
14
|
+
* <StorageImage :storage="storage" bucket="media" path="photo.webp" alt="Photo">
|
|
15
|
+
* <template #placeholder><Spinner /></template>
|
|
16
|
+
* <template #fallback><img src="/no-image.svg" alt="" /></template>
|
|
17
|
+
* </StorageImage>
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.StorageImage = void 0;
|
|
21
|
+
const vue_1 = require("vue");
|
|
22
|
+
exports.StorageImage = (0, vue_1.defineComponent)({
|
|
23
|
+
name: "StorageImage",
|
|
24
|
+
inheritAttrs: false,
|
|
25
|
+
props: {
|
|
26
|
+
/** The ClefbaseStorage instance returned by `getStorage(app)`. */
|
|
27
|
+
storage: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Path inside the default bucket, e.g. `"avatars/user-123.jpg"`.
|
|
33
|
+
* Mutually exclusive with `bucket` + `path`.
|
|
34
|
+
*/
|
|
35
|
+
src: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: undefined,
|
|
38
|
+
},
|
|
39
|
+
/** Named bucket to read from. Pair with `path`. */
|
|
40
|
+
bucket: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: undefined,
|
|
43
|
+
},
|
|
44
|
+
/** File path inside `bucket`. */
|
|
45
|
+
path: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: undefined,
|
|
48
|
+
},
|
|
49
|
+
/** Alt text forwarded to the underlying <img>. */
|
|
50
|
+
alt: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
emits: {
|
|
56
|
+
/** Emitted with the resolved download URL once ready. */
|
|
57
|
+
resolve: (_url) => true,
|
|
58
|
+
/** Emitted if URL resolution or image loading fails. */
|
|
59
|
+
error: (_err) => true,
|
|
60
|
+
/** Emitted whenever the loading status changes. */
|
|
61
|
+
"status-change": (_status) => true,
|
|
62
|
+
},
|
|
63
|
+
setup(props, { attrs, slots, emit }) {
|
|
64
|
+
const resolvedUrl = (0, vue_1.ref)(null);
|
|
65
|
+
const status = (0, vue_1.ref)("loading");
|
|
66
|
+
let cancelled = false;
|
|
67
|
+
async function resolveUrl() {
|
|
68
|
+
cancelled = true; // cancel any in-flight request
|
|
69
|
+
cancelled = false;
|
|
70
|
+
resolvedUrl.value = null;
|
|
71
|
+
status.value = "loading";
|
|
72
|
+
emit("status-change", "loading");
|
|
73
|
+
// Snapshot cancellation flag for this call's closure
|
|
74
|
+
const thisCancelled = () => cancelled;
|
|
75
|
+
try {
|
|
76
|
+
let url;
|
|
77
|
+
if (props.bucket && props.path) {
|
|
78
|
+
url = await props.storage
|
|
79
|
+
.bucket(props.bucket)
|
|
80
|
+
.ref(props.path)
|
|
81
|
+
.getDownloadURL();
|
|
82
|
+
}
|
|
83
|
+
else if (props.src) {
|
|
84
|
+
url = await props.storage.ref(props.src).getDownloadURL();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw new Error("StorageImage: provide either `src` or both `bucket` + `path`.");
|
|
88
|
+
}
|
|
89
|
+
if (thisCancelled())
|
|
90
|
+
return;
|
|
91
|
+
resolvedUrl.value = url;
|
|
92
|
+
emit("resolve", url);
|
|
93
|
+
// status → "loaded" is set in the img onLoad handler
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
if (thisCancelled())
|
|
97
|
+
return;
|
|
98
|
+
status.value = "error";
|
|
99
|
+
emit("status-change", "error");
|
|
100
|
+
emit("error", err);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
(0, vue_1.watch)(() => [props.src, props.bucket, props.path], () => resolveUrl(), { immediate: true });
|
|
104
|
+
(0, vue_1.onUnmounted)(() => {
|
|
105
|
+
cancelled = true;
|
|
106
|
+
});
|
|
107
|
+
function handleLoad() {
|
|
108
|
+
status.value = "loaded";
|
|
109
|
+
emit("status-change", "loaded");
|
|
110
|
+
}
|
|
111
|
+
function handleError(e) {
|
|
112
|
+
status.value = "error";
|
|
113
|
+
emit("status-change", "error");
|
|
114
|
+
emit("error", e);
|
|
115
|
+
}
|
|
116
|
+
return () => {
|
|
117
|
+
if (status.value === "loading" && !resolvedUrl.value) {
|
|
118
|
+
return slots.placeholder
|
|
119
|
+
? slots.placeholder()
|
|
120
|
+
: (0, vue_1.h)("img", { ...attrs, src: "", alt: props.alt, style: "visibility:hidden" });
|
|
121
|
+
}
|
|
122
|
+
if (status.value === "error" || !resolvedUrl.value) {
|
|
123
|
+
return slots.fallback
|
|
124
|
+
? slots.fallback()
|
|
125
|
+
: (0, vue_1.h)("img", { ...attrs, src: "", alt: props.alt, style: "visibility:hidden" });
|
|
126
|
+
}
|
|
127
|
+
return (0, vue_1.h)("img", {
|
|
128
|
+
...attrs,
|
|
129
|
+
src: resolvedUrl.value,
|
|
130
|
+
alt: props.alt,
|
|
131
|
+
onLoad: handleLoad,
|
|
132
|
+
onError: handleError,
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
exports.default = exports.StorageImage;
|
|
138
|
+
//# sourceMappingURL=StorageImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageImage.js","sourceRoot":"","sources":["../../src/vue/StorageImage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,6BAOa;AAKA,QAAA,YAAY,GAAG,IAAA,qBAAe,EAAC;IAC1C,IAAI,EAAE,cAAc;IAEpB,YAAY,EAAE,KAAK;IAEnB,KAAK,EAAE;QACL,kEAAkE;QAClE,OAAO,EAAE;YACP,IAAI,EAAE,MAAmC;YACzC,QAAQ,EAAE,IAAI;SACf;QACD;;;WAGG;QACH,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,SAAS;SACnB;QACD,mDAAmD;QACnD,MAAM,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,SAAS;SACnB;QACD,iCAAiC;QACjC,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,SAAS;SACnB;QACD,kDAAkD;QAClD,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;KACF;IAED,KAAK,EAAE;QACL,yDAAyD;QACzD,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI;QAC/B,wDAAwD;QACxD,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI;QAC9B,mDAAmD;QACnD,eAAe,EAAE,CAAC,OAA2B,EAAE,EAAE,CAAC,IAAI;KACvD;IAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;QACjC,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CAAC,KAAK,CAAC,QAAQ,EAAE;oBAClB,CAAC,CAAC,IAAA,OAAC,EAAC,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC;YAClF,CAAC;YAED,OAAO,IAAA,OAAC,EAAC,KAAK,EAAE;gBACd,GAAG,KAAK;gBACR,GAAG,EAAE,WAAW,CAAC,KAAK;gBACtB,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,WAAW;aACrB,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,kBAAe,oBAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clefbase",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Firebase-style SDK and CLI for Clefbase — database, auth, storage, and hosting",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"require": "./dist/index.js",
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
14
|
"types": "./dist/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./react": {
|
|
17
|
+
"require": "./dist/react/StorageImage.js",
|
|
18
|
+
"import": "./dist/react/StorageImage.js",
|
|
19
|
+
"types": "./dist/react/StorageImage.d.ts"
|
|
15
20
|
}
|
|
16
21
|
},
|
|
17
22
|
"files": [
|
|
@@ -40,7 +45,7 @@
|
|
|
40
45
|
"firebase-alternative",
|
|
41
46
|
"cli"
|
|
42
47
|
],
|
|
43
|
-
"author": "",
|
|
48
|
+
"author": "Cleforyx",
|
|
44
49
|
"license": "MIT",
|
|
45
50
|
"dependencies": {
|
|
46
51
|
"form-data": "^4.0.0",
|
|
@@ -49,13 +54,22 @@
|
|
|
49
54
|
"devDependencies": {
|
|
50
55
|
"@types/inquirer": "^9.0.9",
|
|
51
56
|
"@types/node": "^20.0.0",
|
|
57
|
+
"@types/react": "^18.0.0",
|
|
52
58
|
"esbuild": "^0.21.0",
|
|
53
59
|
"typescript": "^5.0.0"
|
|
54
60
|
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"react": ">=17.0.0",
|
|
63
|
+
"react-dom": ">=17.0.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"react": { "optional": true },
|
|
67
|
+
"react-dom": { "optional": true }
|
|
68
|
+
},
|
|
55
69
|
"optionalDependencies": {
|
|
56
70
|
"chalk": "^5.3.0",
|
|
57
71
|
"commander": "^12.1.0",
|
|
58
72
|
"inquirer": "^9.2.23",
|
|
59
73
|
"ora": "^8.0.1"
|
|
60
74
|
}
|
|
61
|
-
}
|
|
75
|
+
}
|