@degallery/next 0.0.0-stage → 0.6.0
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 +117 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +204 -0
- package/dist/lib/hello-server.d.ts +2 -0
- package/dist/lib/hello-server.d.ts.map +1 -0
- package/dist/lib/next.d.ts +6 -0
- package/dist/lib/next.d.ts.map +1 -0
- package/dist/server.d.ts +23 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +40 -0
- package/package.json +34 -3
package/README.md
CHANGED
|
@@ -1,3 +1,118 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @degallery/next
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Next.js integration for DeGallery. It provides a `next/image` renderer for the
|
|
4
|
+
React gallery views and server helpers for loading gallery data during server
|
|
5
|
+
rendering.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @degallery/next @degallery/react @degallery/sdk @tanstack/react-query
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Use compatible versions of Next.js 15 or 16 and React 19.
|
|
14
|
+
|
|
15
|
+
## Add the provider
|
|
16
|
+
|
|
17
|
+
Place `GalleryProvider` in a Client Component and use it from the root layout.
|
|
18
|
+
The provider uses `next/image` for gallery images; private and expiring image
|
|
19
|
+
URLs bypass the Next.js image optimizer so authenticated delivery continues to
|
|
20
|
+
work.
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
// app/gallery-provider.tsx
|
|
24
|
+
'use client';
|
|
25
|
+
|
|
26
|
+
import { GalleryProvider } from '@degallery/next';
|
|
27
|
+
|
|
28
|
+
export function AppGalleryProvider({ children }: { children: React.ReactNode }) {
|
|
29
|
+
return (
|
|
30
|
+
<GalleryProvider
|
|
31
|
+
apiUrl={process.env.NEXT_PUBLIC_DEGALLERY_API_URL!}
|
|
32
|
+
mediaUrl={process.env.NEXT_PUBLIC_DEGALLERY_MEDIA_URL}
|
|
33
|
+
publishableKey={process.env.NEXT_PUBLIC_DEGALLERY_PUBLISHABLE_KEY}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
</GalleryProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Add the provider to `app/layout.tsx`:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { AppGalleryProvider } from './gallery-provider';
|
|
45
|
+
|
|
46
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
47
|
+
return (
|
|
48
|
+
<html lang="en">
|
|
49
|
+
<body><AppGalleryProvider>{children}</AppGalleryProvider></body>
|
|
50
|
+
</html>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Server-render a gallery
|
|
56
|
+
|
|
57
|
+
Use the server-only subpath from a Server Component. The initial gallery page
|
|
58
|
+
is fetched on the server and rendered into the HTML, then the client view can
|
|
59
|
+
continue loading pages and provide its interactive lightbox.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { ServerGallery } from '@degallery/next/server';
|
|
63
|
+
|
|
64
|
+
export default async function GalleryPage({
|
|
65
|
+
params,
|
|
66
|
+
}: {
|
|
67
|
+
params: Promise<{ slug: string }>;
|
|
68
|
+
}) {
|
|
69
|
+
const { slug } = await params;
|
|
70
|
+
return (
|
|
71
|
+
<ServerGallery
|
|
72
|
+
apiUrl={process.env.NEXT_PUBLIC_DEGALLERY_API_URL!}
|
|
73
|
+
mediaUrl={process.env.NEXT_PUBLIC_DEGALLERY_MEDIA_URL}
|
|
74
|
+
galleryIdOrSlug={slug}
|
|
75
|
+
limit={24}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
For private galleries, pass a short-lived read token from a Server Component or
|
|
82
|
+
server action. Never expose a private API key to a Client Component. `getGallery`
|
|
83
|
+
is also exported for applications that need to render their own markup:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { getGallery } from '@degallery/next/server';
|
|
87
|
+
|
|
88
|
+
const gallery = await getGallery({ apiUrl, galleryIdOrSlug: 'my-gallery' });
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The default server fetch uses `cache: 'no-store'` because delivery URLs can be
|
|
92
|
+
private or expire. A custom `fetch` implementation may provide application
|
|
93
|
+
caching when that is appropriate.
|
|
94
|
+
|
|
95
|
+
## Next.js image configuration
|
|
96
|
+
|
|
97
|
+
If your app uses Next.js image optimization for externally hosted public
|
|
98
|
+
images, allow the hosts used by your galleries in `next.config`:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import type { NextConfig } from 'next';
|
|
102
|
+
|
|
103
|
+
const nextConfig: NextConfig = {
|
|
104
|
+
images: {
|
|
105
|
+
remotePatterns: [
|
|
106
|
+
{ protocol: 'https', hostname: 'images.unsplash.com' },
|
|
107
|
+
{ protocol: 'https', hostname: 'media.degallery.dev' },
|
|
108
|
+
{ protocol: 'https', hostname: 'res.cloudinary.com' },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default nextConfig;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Use the actual media and Cloudinary hostnames configured for your deployment.
|
|
117
|
+
The gallery renderer supplies responsive sizing and image dimensions when
|
|
118
|
+
available. Set the surrounding layout dimensions with CSS as usual.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACnE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "next/image";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { Asset as n, Gallery as r, GalleryProvider as i } from "@degallery/react";
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var a = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), o = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
7
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
8
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
9
|
+
}), s = /* @__PURE__ */ a(((e) => {
|
|
10
|
+
e.Fragment = Symbol.for("react.fragment"), e.jsxDEV = void 0;
|
|
11
|
+
})), c = /* @__PURE__ */ a(((e) => {
|
|
12
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
13
|
+
function t(e) {
|
|
14
|
+
if (e == null) return null;
|
|
15
|
+
if (typeof e == "function") return e.$$typeof === A ? null : e.displayName || e.name || null;
|
|
16
|
+
if (typeof e == "string") return e;
|
|
17
|
+
switch (e) {
|
|
18
|
+
case v: return "Fragment";
|
|
19
|
+
case b: return "Profiler";
|
|
20
|
+
case y: return "StrictMode";
|
|
21
|
+
case w: return "Suspense";
|
|
22
|
+
case T: return "SuspenseList";
|
|
23
|
+
case O: return "Activity";
|
|
24
|
+
case k: return "ViewTransition";
|
|
25
|
+
}
|
|
26
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
27
|
+
case _: return "Portal";
|
|
28
|
+
case S: return e.displayName || "Context";
|
|
29
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
30
|
+
case C:
|
|
31
|
+
var n = e.render;
|
|
32
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
33
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
34
|
+
case D:
|
|
35
|
+
n = e._payload, e = e._init;
|
|
36
|
+
try {
|
|
37
|
+
return t(e(n));
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
function n(e) {
|
|
43
|
+
return "" + e;
|
|
44
|
+
}
|
|
45
|
+
function r(e) {
|
|
46
|
+
try {
|
|
47
|
+
n(e);
|
|
48
|
+
var t = !1;
|
|
49
|
+
} catch {
|
|
50
|
+
t = !0;
|
|
51
|
+
}
|
|
52
|
+
if (t) {
|
|
53
|
+
t = console;
|
|
54
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
55
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function i(e) {
|
|
59
|
+
if (e === v) return "<>";
|
|
60
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
61
|
+
try {
|
|
62
|
+
var n = t(e);
|
|
63
|
+
return n ? "<" + n + ">" : "<...>";
|
|
64
|
+
} catch {
|
|
65
|
+
return "<...>";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function a() {
|
|
69
|
+
var e = j.A;
|
|
70
|
+
return e === null ? null : e.getOwner();
|
|
71
|
+
}
|
|
72
|
+
function s() {
|
|
73
|
+
return Error("react-stack-top-frame");
|
|
74
|
+
}
|
|
75
|
+
function c(e) {
|
|
76
|
+
if (M.call(e, "key")) {
|
|
77
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
78
|
+
if (t && t.isReactWarning) return !1;
|
|
79
|
+
}
|
|
80
|
+
return e.key !== void 0;
|
|
81
|
+
}
|
|
82
|
+
function l(e, t) {
|
|
83
|
+
function n() {
|
|
84
|
+
F || (F = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
85
|
+
}
|
|
86
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
87
|
+
get: n,
|
|
88
|
+
configurable: !0
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function u() {
|
|
92
|
+
var e = t(this.type);
|
|
93
|
+
return I[e] || (I[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
94
|
+
}
|
|
95
|
+
function d(e, t, n, r, i, a) {
|
|
96
|
+
var o = n.ref;
|
|
97
|
+
return e = {
|
|
98
|
+
$$typeof: g,
|
|
99
|
+
type: e,
|
|
100
|
+
key: t,
|
|
101
|
+
props: n,
|
|
102
|
+
_owner: r
|
|
103
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
104
|
+
enumerable: !1,
|
|
105
|
+
value: null
|
|
106
|
+
}) : Object.defineProperty(e, "ref", {
|
|
107
|
+
enumerable: !1,
|
|
108
|
+
get: u
|
|
109
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
110
|
+
configurable: !1,
|
|
111
|
+
enumerable: !1,
|
|
112
|
+
writable: !0,
|
|
113
|
+
value: 0
|
|
114
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
115
|
+
configurable: !1,
|
|
116
|
+
enumerable: !1,
|
|
117
|
+
writable: !0,
|
|
118
|
+
value: null
|
|
119
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
120
|
+
configurable: !1,
|
|
121
|
+
enumerable: !1,
|
|
122
|
+
writable: !0,
|
|
123
|
+
value: i
|
|
124
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
125
|
+
configurable: !1,
|
|
126
|
+
enumerable: !1,
|
|
127
|
+
writable: !0,
|
|
128
|
+
value: a
|
|
129
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
130
|
+
}
|
|
131
|
+
function f(e, n, i, o, s, u) {
|
|
132
|
+
var f = n.children;
|
|
133
|
+
if (f !== void 0) {
|
|
134
|
+
if (o) {
|
|
135
|
+
if (N(f)) {
|
|
136
|
+
for (o = 0; o < f.length; o++) p(f[o]);
|
|
137
|
+
Object.freeze && Object.freeze(f);
|
|
138
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
139
|
+
} else p(f);
|
|
140
|
+
}
|
|
141
|
+
if (M.call(n, "key")) {
|
|
142
|
+
f = t(e);
|
|
143
|
+
var m = Object.keys(n).filter(function(e) {
|
|
144
|
+
return e !== "key";
|
|
145
|
+
});
|
|
146
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", z[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), z[f + o] = !0);
|
|
147
|
+
}
|
|
148
|
+
if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
149
|
+
else i = n;
|
|
150
|
+
return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), s, u);
|
|
151
|
+
}
|
|
152
|
+
function p(e) {
|
|
153
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
154
|
+
}
|
|
155
|
+
function m(e) {
|
|
156
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
157
|
+
}
|
|
158
|
+
var h = o("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.view_transition"), A = Symbol.for("react.client.reference"), j = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, N = Array.isArray, P = console.createTask ? console.createTask : function() {
|
|
159
|
+
return null;
|
|
160
|
+
};
|
|
161
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
162
|
+
return e();
|
|
163
|
+
} };
|
|
164
|
+
var F, I = {}, L = h.react_stack_bottom_frame.bind(h, s)(), R = P(i(s)), z = {};
|
|
165
|
+
e.Fragment = v, e.jsxDEV = function(e, t, n, r) {
|
|
166
|
+
var a = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
167
|
+
if (a) {
|
|
168
|
+
var o = Error.stackTraceLimit;
|
|
169
|
+
Error.stackTraceLimit = 10;
|
|
170
|
+
var s = Error("react-stack-top-frame");
|
|
171
|
+
Error.stackTraceLimit = o;
|
|
172
|
+
} else s = L;
|
|
173
|
+
return f(e, t, n, r, s, a ? P(i(e)) : R);
|
|
174
|
+
};
|
|
175
|
+
})();
|
|
176
|
+
})), l = (/* @__PURE__ */ a(((e, t) => {
|
|
177
|
+
t.exports = process.env.NODE_ENV === "production" ? s() : c();
|
|
178
|
+
})))(), u = "/Users/ManelisiM/Documents/my-projects/monorepo/thegallery/packages/next/src/lib/next.tsx", d = t(function({ src: t, srcSet: n, unoptimized: r, ...i }, a) {
|
|
179
|
+
return typeof t != "string" || !t ? null : /* @__PURE__ */ (0, l.jsxDEV)(e, {
|
|
180
|
+
...i,
|
|
181
|
+
ref: a,
|
|
182
|
+
src: t,
|
|
183
|
+
alt: i.alt ?? "",
|
|
184
|
+
width: typeof i.width == "number" ? i.width : 1600,
|
|
185
|
+
height: typeof i.height == "number" ? i.height : 1e3,
|
|
186
|
+
unoptimized: r
|
|
187
|
+
}, void 0, !1, {
|
|
188
|
+
fileName: u,
|
|
189
|
+
lineNumber: 23,
|
|
190
|
+
columnNumber: 5
|
|
191
|
+
}, this);
|
|
192
|
+
});
|
|
193
|
+
function f(e) {
|
|
194
|
+
return /* @__PURE__ */ (0, l.jsxDEV)(i, {
|
|
195
|
+
...e,
|
|
196
|
+
imageComponent: d
|
|
197
|
+
}, void 0, !1, {
|
|
198
|
+
fileName: u,
|
|
199
|
+
lineNumber: 41,
|
|
200
|
+
columnNumber: 10
|
|
201
|
+
}, this);
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
export { n as Asset, r as Gallery, f as GalleryProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hello-server.d.ts","sourceRoot":"","sources":["../../src/lib/hello-server.tsx"],"names":[],"mappings":"AACA,wBAAsB,WAAW,yCAEhC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Asset, Gallery, AssetProps, GalleryProviderProps as ReactGalleryProviderProps } from '@degallery/react';
|
|
2
|
+
export type GalleryProviderProps = Omit<ReactGalleryProviderProps, 'imageComponent'>;
|
|
3
|
+
export declare function GalleryProvider(props: GalleryProviderProps): import("react").JSX.Element;
|
|
4
|
+
export { Asset, Gallery };
|
|
5
|
+
export type { AssetProps };
|
|
6
|
+
//# sourceMappingURL=next.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/lib/next.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,EACL,OAAO,EAER,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,UAAU,EAEV,oBAAoB,IAAI,yBAAyB,EAClD,MAAM,kBAAkB,CAAC;AAqB1B,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,yBAAyB,EACzB,gBAAgB,CACjB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,+BAE1D;AAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC1B,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GalleryProps, GalleryViewData } from '@degallery/react';
|
|
2
|
+
import { ClientOptions } from '@degallery/sdk';
|
|
3
|
+
export type GetGalleryOptions = Pick<ClientOptions, 'apiUrl' | 'fetch' | 'mediaUrl' | 'publishableKey' | 'readToken'> & {
|
|
4
|
+
galleryIdOrSlug: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
};
|
|
7
|
+
/** Fetches the first page of gallery data for a Next.js Server Component. */
|
|
8
|
+
export declare function getGallery({ apiUrl, fetch: fetchImplementation, galleryIdOrSlug, limit, mediaUrl, publishableKey, readToken, }: GetGalleryOptions): Promise<GalleryViewData>;
|
|
9
|
+
export type ServerGalleryProps = GetGalleryOptions & Omit<GalleryProps, 'gallery' | 'galleryId' | 'slug' | 'limit'>;
|
|
10
|
+
/** Loads gallery data on the server, then hydrates the interactive React view. */
|
|
11
|
+
export declare function ServerGallery({ apiUrl, fetch: fetchImplementation, galleryIdOrSlug, limit, mediaUrl, publishableKey, readToken, ...galleryProps }: ServerGalleryProps): Promise<import('react').FunctionComponentElement<Readonly<{
|
|
12
|
+
gallery?: GalleryViewData;
|
|
13
|
+
galleryId?: string;
|
|
14
|
+
slug?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
layout?: import('@degallery/react').GalleryLayout;
|
|
17
|
+
limit?: number;
|
|
18
|
+
loadingFallback?: import('react').ReactNode;
|
|
19
|
+
errorFallback?: import('react').ReactNode;
|
|
20
|
+
emptyFallback?: import('react').ReactNode;
|
|
21
|
+
refreshPrivateItems?: (items: GalleryViewData["items"]) => Promise<GalleryViewData["items"]>;
|
|
22
|
+
}>>>;
|
|
23
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,aAAa,EACb,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,gBAAgB,GAAG,WAAW,CACjE,GAAG;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,6EAA6E;AAC7E,wBAAsB,UAAU,CAAC,EAC/B,MAAM,EACN,KAAK,EAAE,mBAAmB,EAC1B,eAAe,EACf,KAAS,EACT,QAAQ,EACR,cAAc,EACd,SAAS,GACV,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAa9C;AAED,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAChD,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEjE,kFAAkF;AAClF,wBAAsB,aAAa,CAAC,EAClC,MAAM,EACN,KAAK,EAAE,mBAAmB,EAC1B,eAAe,EACf,KAAS,EACT,QAAQ,EACR,cAAc,EACd,SAAS,EACT,GAAG,YAAY,EAChB,EAAE,kBAAkB;;;;;;;;;;;KAgBpB"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createElement as e } from "react";
|
|
2
|
+
import { Gallery as t, toGalleryViewData as n } from "@degallery/react";
|
|
3
|
+
import "server-only";
|
|
4
|
+
import { GalleryClient as r } from "@degallery/sdk";
|
|
5
|
+
//#region src/server.ts
|
|
6
|
+
async function i({ apiUrl: e, fetch: t, galleryIdOrSlug: i, limit: a = 9, mediaUrl: s, publishableKey: c, readToken: l }) {
|
|
7
|
+
let { gallery: u } = await new r({
|
|
8
|
+
apiUrl: e,
|
|
9
|
+
fetch: t ?? o,
|
|
10
|
+
mediaUrl: s,
|
|
11
|
+
publishableKey: c,
|
|
12
|
+
readToken: l
|
|
13
|
+
}).galleries.retrievePage(i, {
|
|
14
|
+
includeAssets: !0,
|
|
15
|
+
limit: a
|
|
16
|
+
});
|
|
17
|
+
return n(u);
|
|
18
|
+
}
|
|
19
|
+
async function a({ apiUrl: n, fetch: r, galleryIdOrSlug: a, limit: o = 9, mediaUrl: s, publishableKey: c, readToken: l, ...u }) {
|
|
20
|
+
let d = await i({
|
|
21
|
+
apiUrl: n,
|
|
22
|
+
fetch: r,
|
|
23
|
+
galleryIdOrSlug: a,
|
|
24
|
+
limit: o,
|
|
25
|
+
mediaUrl: s,
|
|
26
|
+
publishableKey: c,
|
|
27
|
+
readToken: l
|
|
28
|
+
});
|
|
29
|
+
return e(t, {
|
|
30
|
+
...u,
|
|
31
|
+
gallery: d,
|
|
32
|
+
galleryId: d.id
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
var o = (e, t) => fetch(e, {
|
|
36
|
+
...t,
|
|
37
|
+
cache: "no-store"
|
|
38
|
+
});
|
|
39
|
+
//#endregion
|
|
40
|
+
export { a as ServerGallery, i as getGallery };
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degallery/next",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"!**/*.tsbuildinfo"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
".": {
|
|
15
|
+
"@degallery/source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./server": {
|
|
21
|
+
"@degallery/source": "./src/server.ts",
|
|
22
|
+
"types": "./dist/server.d.ts",
|
|
23
|
+
"import": "./dist/server.js",
|
|
24
|
+
"default": "./dist/server.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@degallery/react": "0.6.0",
|
|
29
|
+
"@degallery/sdk": "0.6.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@tanstack/react-query": "^5.102.8",
|
|
33
|
+
"next": ">=15 <17",
|
|
34
|
+
"react": "^19.0.0",
|
|
35
|
+
"react-dom": "^19.0.0"
|
|
36
|
+
}
|
|
6
37
|
}
|