@templatical/media-library 0.0.6 → 0.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/LICENSE +56 -0
- package/README.md +94 -0
- package/dist/cdn/chunks/{icons-C3RsNALX.js → icons-DY7nhIJb.js} +5 -5
- package/dist/cdn/chunks/icons-DY7nhIJb.js.map +1 -0
- package/dist/cdn/media-library.js +4 -4
- package/dist/cdn/media-library.js.map +1 -1
- package/dist/templatical-media-library.css +1 -1
- package/package.json +24 -11
- package/dist/cdn/chunks/icons-C3RsNALX.js.map +0 -1
- package/dist/templatical-media-library.umd.cjs +0 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Templatical
|
|
4
|
+
|
|
5
|
+
## Terms and Conditions
|
|
6
|
+
|
|
7
|
+
### Licensor ("We")
|
|
8
|
+
|
|
9
|
+
Templatical
|
|
10
|
+
|
|
11
|
+
### The Software
|
|
12
|
+
|
|
13
|
+
Templatical Email Editor — the visual drag-and-drop email template editor
|
|
14
|
+
(@templatical/core, @templatical/editor, and @templatical/media-library
|
|
15
|
+
packages).
|
|
16
|
+
|
|
17
|
+
### Grant of Rights
|
|
18
|
+
|
|
19
|
+
Subject to the terms and conditions of this License, We hereby grant You a
|
|
20
|
+
non-exclusive, worldwide, non-transferable license to use, copy, modify,
|
|
21
|
+
create derivative works, and redistribute the Software, subject to the
|
|
22
|
+
following conditions:
|
|
23
|
+
|
|
24
|
+
### Permitted Uses
|
|
25
|
+
|
|
26
|
+
You may use the Software for any purpose, including commercial purposes,
|
|
27
|
+
**provided that** you do not offer the Software, or a substantially similar
|
|
28
|
+
product built using the Software, as a hosted or managed service that
|
|
29
|
+
competes with Templatical's commercial offerings.
|
|
30
|
+
|
|
31
|
+
### Change Date
|
|
32
|
+
|
|
33
|
+
Two (2) years from the date of each release of the Software.
|
|
34
|
+
|
|
35
|
+
### Change License
|
|
36
|
+
|
|
37
|
+
MIT License
|
|
38
|
+
|
|
39
|
+
On the Change Date, the above copyright notice and this permission notice
|
|
40
|
+
shall be replaced with the MIT License, and the Software will be available
|
|
41
|
+
under the MIT License for all purposes without restriction.
|
|
42
|
+
|
|
43
|
+
### Notices
|
|
44
|
+
|
|
45
|
+
You must retain this license notice in all copies or substantial portions
|
|
46
|
+
of the Software.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
Note: The @templatical/types, @templatical/renderer, and
|
|
55
|
+
@templatical/import-beefree packages are licensed separately under the MIT
|
|
56
|
+
License. See LICENSE-MIT for those packages' terms.
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# @templatical/media-library
|
|
2
|
+
|
|
3
|
+
> Media library for Templatical — composable, Vue components, and a standalone visual SDK.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@templatical/media-library)
|
|
6
|
+
[](https://github.com/templatical/sdk/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
Browse, upload, organize, crop, and replace media assets. Used by [`@templatical/editor`](https://www.npmjs.com/package/@templatical/editor)'s Cloud build, and available as a standalone SDK for any app that needs a media manager.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @templatical/media-library
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Peer deps: `vue@^3.5`, `tailwindcss@^4`.
|
|
17
|
+
|
|
18
|
+
> **Authentication.** The media library connects to Templatical Cloud and authenticates against your backend. Your server exposes a token endpoint (returning a short-lived JWT for the current user/project), and you pass that endpoint URL as `auth.url`. See the [authentication guide](https://docs.templatical.com/cloud/authentication) for the full setup.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Standalone visual SDK (mount anywhere)
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { init } from '@templatical/media-library';
|
|
26
|
+
import '@templatical/media-library/style.css';
|
|
27
|
+
|
|
28
|
+
const media = await init({
|
|
29
|
+
container: '#media',
|
|
30
|
+
auth: {
|
|
31
|
+
url: 'https://your-app.com/api/templatical/token',
|
|
32
|
+
},
|
|
33
|
+
onSelect(item) {
|
|
34
|
+
console.log('Picked:', item.url);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Later
|
|
39
|
+
media.unmount();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Vue component
|
|
43
|
+
|
|
44
|
+
Use `MediaLibraryModal` inside a Vue 3 app. See [docs](https://docs.templatical.com/cloud/media-library) for the full prop reference.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { MediaLibraryModal } from '@templatical/media-library';
|
|
48
|
+
import '@templatical/media-library/style.css';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Composable (build your own UI)
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { AuthManager } from '@templatical/core/cloud';
|
|
55
|
+
import { useMediaLibrary } from '@templatical/media-library';
|
|
56
|
+
|
|
57
|
+
const authManager = new AuthManager({
|
|
58
|
+
url: 'https://your-app.com/api/templatical/token',
|
|
59
|
+
});
|
|
60
|
+
await authManager.initialize();
|
|
61
|
+
|
|
62
|
+
const lib = useMediaLibrary({
|
|
63
|
+
projectId: authManager.projectId,
|
|
64
|
+
authManager,
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### API client (low-level)
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { AuthManager } from '@templatical/core/cloud';
|
|
72
|
+
import { MediaApiClient } from '@templatical/media-library';
|
|
73
|
+
|
|
74
|
+
const api = new MediaApiClient(authManager);
|
|
75
|
+
const response = await api.browseMedia({ folder_id: null });
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Exports
|
|
79
|
+
|
|
80
|
+
- **Standalone SDK** — `init()`, `unmount()`
|
|
81
|
+
- **Vue components** — `MediaLibraryModal` + 12 sub-components (grid, upload zone, folder tree, preview panel, edit/replace/import modals)
|
|
82
|
+
- **Composables** — `useMediaLibrary`, `useMediaCategories`, `useMediaPicker`, `useI18n`
|
|
83
|
+
- **API client** — `MediaApiClient`
|
|
84
|
+
- **Types** — `MediaItem`, `MediaFolder`, `MediaCategory`, `MediaConversion`, `MediaBrowseParams/Response`, `MediaUsageInfo/Response`, `MediaConfig`, etc.
|
|
85
|
+
|
|
86
|
+
## Documentation
|
|
87
|
+
|
|
88
|
+
- [Media library guide](https://docs.templatical.com/cloud/media-library)
|
|
89
|
+
|
|
90
|
+
Full reference at **[docs.templatical.com](https://docs.templatical.com)**.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
[FSL-1.1-MIT](https://github.com/templatical/sdk/blob/main/LICENSE) — free for any non-competing commercial use, automatically converts to MIT after 2 years per release.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@vue+shared@3.5.33/node_modules/@vue/shared/dist/shared.esm-bundler.js
|
|
2
2
|
/* @__NO_SIDE_EFFECTS__ */
|
|
3
3
|
function e(e) {
|
|
4
4
|
let t = /* @__PURE__ */ Object.create(null);
|
|
@@ -876,7 +876,7 @@ function cn(e, t = Infinity, n) {
|
|
|
876
876
|
return e;
|
|
877
877
|
}
|
|
878
878
|
//#endregion
|
|
879
|
-
//#region ../../node_modules/.
|
|
879
|
+
//#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.33/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
|
|
880
880
|
function ln(e, t, n, r) {
|
|
881
881
|
try {
|
|
882
882
|
return r ? e(...r) : e();
|
|
@@ -3207,7 +3207,7 @@ function ys(e) {
|
|
|
3207
3207
|
return g(e) ? document.querySelector(e) : e;
|
|
3208
3208
|
}
|
|
3209
3209
|
//#endregion
|
|
3210
|
-
//#region ../../node_modules/.
|
|
3210
|
+
//#region ../../node_modules/.pnpm/@lucide+vue@1.14.0_vue@3.5.33_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/isEmptyString.mjs
|
|
3211
3211
|
var bs = (e) => e === "", xs = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ss = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Cs = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ws = (e) => {
|
|
3212
3212
|
let t = Cs(e);
|
|
3213
3213
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
@@ -3226,7 +3226,7 @@ function Ds() {
|
|
|
3226
3226
|
return Mn(Es, {});
|
|
3227
3227
|
}
|
|
3228
3228
|
//#endregion
|
|
3229
|
-
//#region ../../node_modules/.
|
|
3229
|
+
//#region ../../node_modules/.pnpm/@lucide+vue@1.14.0_vue@3.5.33_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
|
|
3230
3230
|
var Os = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o, color: s, ...c }, { slots: l }) => {
|
|
3231
3231
|
let { size: u, color: d, strokeWidth: f = 2, absoluteStrokeWidth: p = !1, class: m = "" } = Ds(), h = Ja(() => {
|
|
3232
3232
|
let e = bs(n) || bs(r) || n === !0 || r === !0 || p === !0, t = i || a || f || Ts["stroke-width"];
|
|
@@ -3411,4 +3411,4 @@ var Os = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width
|
|
|
3411
3411
|
//#endregion
|
|
3412
3412
|
export { Kt as $, da as A, jn as B, ds as C, _a as D, Ja as E, Ya as F, In as G, Wr as H, Mn as I, kn as J, Fn as K, Ta as L, X as M, pr as N, fa as O, Aa as P, Rt as Q, Or as R, ps as S, Zn as T, Rr as U, Ur as V, Br as W, R as X, Ee as Y, De as Z, ks as _, Vs as a, he as at, cs as b, Rs as c, Fs as d, zt as et, Ps as f, As as g, js as h, Hs as i, Xt as it, xa as j, Sa as k, Ls as l, Ms as m, Ws as n, I as nt, Bs as o, ue as ot, Ns as p, On as q, Us as r, Zt as rt, zs as s, Se as st, Gs as t, qt as tt, Is as u, uo as v, q as w, Oo as x, _s as y, oa as z };
|
|
3413
3413
|
|
|
3414
|
-
//# sourceMappingURL=icons-
|
|
3414
|
+
//# sourceMappingURL=icons-DY7nhIJb.js.map
|