meta-mosaic 1.0.9
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 +12 -0
- package/dist/index.es.js +478 -0
- package/dist/index.umd.js +22 -0
- package/dist/meta-mosaic.css +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# React + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import oe, { useState as _, useEffect as O, useRef as se } from "react";
|
|
2
|
+
var X = { exports: {} }, P = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var K;
|
|
13
|
+
function ae() {
|
|
14
|
+
if (K) return P;
|
|
15
|
+
K = 1;
|
|
16
|
+
var t = Symbol.for("react.transitional.element"), c = Symbol.for("react.fragment");
|
|
17
|
+
function o(u, s, a) {
|
|
18
|
+
var d = null;
|
|
19
|
+
if (a !== void 0 && (d = "" + a), s.key !== void 0 && (d = "" + s.key), "key" in s) {
|
|
20
|
+
a = {};
|
|
21
|
+
for (var m in s)
|
|
22
|
+
m !== "key" && (a[m] = s[m]);
|
|
23
|
+
} else a = s;
|
|
24
|
+
return s = a.ref, {
|
|
25
|
+
$$typeof: t,
|
|
26
|
+
type: u,
|
|
27
|
+
key: d,
|
|
28
|
+
ref: s !== void 0 ? s : null,
|
|
29
|
+
props: a
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return P.Fragment = c, P.jsx = o, P.jsxs = o, P;
|
|
33
|
+
}
|
|
34
|
+
var y = {};
|
|
35
|
+
/**
|
|
36
|
+
* @license React
|
|
37
|
+
* react-jsx-runtime.development.js
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the MIT license found in the
|
|
42
|
+
* LICENSE file in the root directory of this source tree.
|
|
43
|
+
*/
|
|
44
|
+
var Q;
|
|
45
|
+
function le() {
|
|
46
|
+
return Q || (Q = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
+
function t(e) {
|
|
48
|
+
if (e == null) return null;
|
|
49
|
+
if (typeof e == "function")
|
|
50
|
+
return e.$$typeof === re ? null : e.displayName || e.name || null;
|
|
51
|
+
if (typeof e == "string") return e;
|
|
52
|
+
switch (e) {
|
|
53
|
+
case S:
|
|
54
|
+
return "Fragment";
|
|
55
|
+
case I:
|
|
56
|
+
return "Profiler";
|
|
57
|
+
case $:
|
|
58
|
+
return "StrictMode";
|
|
59
|
+
case R:
|
|
60
|
+
return "Suspense";
|
|
61
|
+
case z:
|
|
62
|
+
return "SuspenseList";
|
|
63
|
+
case A:
|
|
64
|
+
return "Activity";
|
|
65
|
+
}
|
|
66
|
+
if (typeof e == "object")
|
|
67
|
+
switch (typeof e.tag == "number" && console.error(
|
|
68
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
+
), e.$$typeof) {
|
|
70
|
+
case N:
|
|
71
|
+
return "Portal";
|
|
72
|
+
case Y:
|
|
73
|
+
return (e.displayName || "Context") + ".Provider";
|
|
74
|
+
case M:
|
|
75
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case x:
|
|
77
|
+
var r = e.render;
|
|
78
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
+
case D:
|
|
80
|
+
return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
|
|
81
|
+
case g:
|
|
82
|
+
r = e._payload, e = e._init;
|
|
83
|
+
try {
|
|
84
|
+
return t(e(r));
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function c(e) {
|
|
91
|
+
return "" + e;
|
|
92
|
+
}
|
|
93
|
+
function o(e) {
|
|
94
|
+
try {
|
|
95
|
+
c(e);
|
|
96
|
+
var r = !1;
|
|
97
|
+
} catch {
|
|
98
|
+
r = !0;
|
|
99
|
+
}
|
|
100
|
+
if (r) {
|
|
101
|
+
r = console;
|
|
102
|
+
var n = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
+
return n.call(
|
|
104
|
+
r,
|
|
105
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
+
l
|
|
107
|
+
), c(e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function u(e) {
|
|
111
|
+
if (e === S) return "<>";
|
|
112
|
+
if (typeof e == "object" && e !== null && e.$$typeof === g)
|
|
113
|
+
return "<...>";
|
|
114
|
+
try {
|
|
115
|
+
var r = t(e);
|
|
116
|
+
return r ? "<" + r + ">" : "<...>";
|
|
117
|
+
} catch {
|
|
118
|
+
return "<...>";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function s() {
|
|
122
|
+
var e = L.A;
|
|
123
|
+
return e === null ? null : e.getOwner();
|
|
124
|
+
}
|
|
125
|
+
function a() {
|
|
126
|
+
return Error("react-stack-top-frame");
|
|
127
|
+
}
|
|
128
|
+
function d(e) {
|
|
129
|
+
if (q.call(e, "key")) {
|
|
130
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
+
if (r && r.isReactWarning) return !1;
|
|
132
|
+
}
|
|
133
|
+
return e.key !== void 0;
|
|
134
|
+
}
|
|
135
|
+
function m(e, r) {
|
|
136
|
+
function n() {
|
|
137
|
+
G || (G = !0, console.error(
|
|
138
|
+
"%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)",
|
|
139
|
+
r
|
|
140
|
+
));
|
|
141
|
+
}
|
|
142
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: n,
|
|
144
|
+
configurable: !0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function E() {
|
|
148
|
+
var e = t(this.type);
|
|
149
|
+
return J[e] || (J[e] = !0, console.error(
|
|
150
|
+
"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."
|
|
151
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
|
+
}
|
|
153
|
+
function b(e, r, n, l, k, v, W, U) {
|
|
154
|
+
return n = v.ref, e = {
|
|
155
|
+
$$typeof: T,
|
|
156
|
+
type: e,
|
|
157
|
+
key: r,
|
|
158
|
+
props: v,
|
|
159
|
+
_owner: k
|
|
160
|
+
}, (n !== void 0 ? n : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
|
+
enumerable: !1,
|
|
162
|
+
get: E
|
|
163
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
|
+
configurable: !1,
|
|
165
|
+
enumerable: !1,
|
|
166
|
+
writable: !0,
|
|
167
|
+
value: 0
|
|
168
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
169
|
+
configurable: !1,
|
|
170
|
+
enumerable: !1,
|
|
171
|
+
writable: !0,
|
|
172
|
+
value: null
|
|
173
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
174
|
+
configurable: !1,
|
|
175
|
+
enumerable: !1,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: W
|
|
178
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
179
|
+
configurable: !1,
|
|
180
|
+
enumerable: !1,
|
|
181
|
+
writable: !0,
|
|
182
|
+
value: U
|
|
183
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
|
+
}
|
|
185
|
+
function h(e, r, n, l, k, v, W, U) {
|
|
186
|
+
var i = r.children;
|
|
187
|
+
if (i !== void 0)
|
|
188
|
+
if (l)
|
|
189
|
+
if (te(i)) {
|
|
190
|
+
for (l = 0; l < i.length; l++)
|
|
191
|
+
w(i[l]);
|
|
192
|
+
Object.freeze && Object.freeze(i);
|
|
193
|
+
} else
|
|
194
|
+
console.error(
|
|
195
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
|
+
);
|
|
197
|
+
else w(i);
|
|
198
|
+
if (q.call(r, "key")) {
|
|
199
|
+
i = t(e);
|
|
200
|
+
var j = Object.keys(r).filter(function(ne) {
|
|
201
|
+
return ne !== "key";
|
|
202
|
+
});
|
|
203
|
+
l = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", Z[i + l] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
205
|
+
let props = %s;
|
|
206
|
+
<%s {...props} />
|
|
207
|
+
React keys must be passed directly to JSX without using spread:
|
|
208
|
+
let props = %s;
|
|
209
|
+
<%s key={someKey} {...props} />`,
|
|
210
|
+
l,
|
|
211
|
+
i,
|
|
212
|
+
j,
|
|
213
|
+
i
|
|
214
|
+
), Z[i + l] = !0);
|
|
215
|
+
}
|
|
216
|
+
if (i = null, n !== void 0 && (o(n), i = "" + n), d(r) && (o(r.key), i = "" + r.key), "key" in r) {
|
|
217
|
+
n = {};
|
|
218
|
+
for (var V in r)
|
|
219
|
+
V !== "key" && (n[V] = r[V]);
|
|
220
|
+
} else n = r;
|
|
221
|
+
return i && m(
|
|
222
|
+
n,
|
|
223
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
+
), b(
|
|
225
|
+
e,
|
|
226
|
+
i,
|
|
227
|
+
v,
|
|
228
|
+
k,
|
|
229
|
+
s(),
|
|
230
|
+
n,
|
|
231
|
+
W,
|
|
232
|
+
U
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function w(e) {
|
|
236
|
+
typeof e == "object" && e !== null && e.$$typeof === T && e._store && (e._store.validated = 1);
|
|
237
|
+
}
|
|
238
|
+
var p = oe, T = Symbol.for("react.transitional.element"), N = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), I = Symbol.for("react.profiler"), M = Symbol.for("react.consumer"), Y = Symbol.for("react.context"), x = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), z = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), A = Symbol.for("react.activity"), re = Symbol.for("react.client.reference"), L = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, te = Array.isArray, F = console.createTask ? console.createTask : function() {
|
|
239
|
+
return null;
|
|
240
|
+
};
|
|
241
|
+
p = {
|
|
242
|
+
"react-stack-bottom-frame": function(e) {
|
|
243
|
+
return e();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
var G, J = {}, B = p["react-stack-bottom-frame"].bind(
|
|
247
|
+
p,
|
|
248
|
+
a
|
|
249
|
+
)(), H = F(u(a)), Z = {};
|
|
250
|
+
y.Fragment = S, y.jsx = function(e, r, n, l, k) {
|
|
251
|
+
var v = 1e4 > L.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return h(
|
|
253
|
+
e,
|
|
254
|
+
r,
|
|
255
|
+
n,
|
|
256
|
+
!1,
|
|
257
|
+
l,
|
|
258
|
+
k,
|
|
259
|
+
v ? Error("react-stack-top-frame") : B,
|
|
260
|
+
v ? F(u(e)) : H
|
|
261
|
+
);
|
|
262
|
+
}, y.jsxs = function(e, r, n, l, k) {
|
|
263
|
+
var v = 1e4 > L.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return h(
|
|
265
|
+
e,
|
|
266
|
+
r,
|
|
267
|
+
n,
|
|
268
|
+
!0,
|
|
269
|
+
l,
|
|
270
|
+
k,
|
|
271
|
+
v ? Error("react-stack-top-frame") : B,
|
|
272
|
+
v ? F(u(e)) : H
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
}()), y;
|
|
276
|
+
}
|
|
277
|
+
process.env.NODE_ENV === "production" ? X.exports = ae() : X.exports = le();
|
|
278
|
+
var f = X.exports;
|
|
279
|
+
const C = {
|
|
280
|
+
sm: 600,
|
|
281
|
+
md: 960,
|
|
282
|
+
lg: 1280,
|
|
283
|
+
xl: 1920
|
|
284
|
+
}, ee = (t) => t >= C.xl ? "xl" : t >= C.lg ? "lg" : t >= C.md ? "md" : t >= C.sm ? "sm" : "xs", ie = () => {
|
|
285
|
+
const [t, c] = _(() => ee(window.innerWidth));
|
|
286
|
+
return O(() => {
|
|
287
|
+
const o = () => {
|
|
288
|
+
c(ee(window.innerWidth));
|
|
289
|
+
};
|
|
290
|
+
return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
|
|
291
|
+
}, []), {
|
|
292
|
+
isXs: t === "xs",
|
|
293
|
+
isSm: t === "sm",
|
|
294
|
+
isMd: t === "md",
|
|
295
|
+
isLg: t === "lg",
|
|
296
|
+
isXl: t === "xl",
|
|
297
|
+
current: t
|
|
298
|
+
};
|
|
299
|
+
}, ce = ({
|
|
300
|
+
image: t,
|
|
301
|
+
bgImageUrl: c,
|
|
302
|
+
width: o,
|
|
303
|
+
height: u,
|
|
304
|
+
bgPosition: s,
|
|
305
|
+
onClickCard: a
|
|
306
|
+
}) => {
|
|
307
|
+
const [d, m] = _(!1);
|
|
308
|
+
return O(() => {
|
|
309
|
+
if (!(t != null && t.link)) return;
|
|
310
|
+
const E = new Image();
|
|
311
|
+
E.src = t.link, E.onload = () => m(!0), E.onerror = () => m(!1);
|
|
312
|
+
}, [t]), /* @__PURE__ */ f.jsx("div", { className: "mosaic-cell-wrapper", children: d ? /* @__PURE__ */ f.jsx(
|
|
313
|
+
"div",
|
|
314
|
+
{
|
|
315
|
+
className: "mosaic-cell",
|
|
316
|
+
style: {
|
|
317
|
+
backgroundImage: `url(${c})`,
|
|
318
|
+
backgroundSize: `${o}px ${u}px`,
|
|
319
|
+
backgroundPosition: s
|
|
320
|
+
},
|
|
321
|
+
onClick: () => a(t),
|
|
322
|
+
children: /* @__PURE__ */ f.jsx(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
className: "mosaic-cell-img",
|
|
326
|
+
style: {
|
|
327
|
+
backgroundImage: `url(${t.link})`,
|
|
328
|
+
backgroundSize: "cover"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
) : null }, t.id);
|
|
334
|
+
}, ue = ({
|
|
335
|
+
image: t,
|
|
336
|
+
onClose: c,
|
|
337
|
+
animationType: o = "bottom",
|
|
338
|
+
position: u,
|
|
339
|
+
setDialog: s
|
|
340
|
+
// 🆕 New prop
|
|
341
|
+
}) => {
|
|
342
|
+
const [a, d] = _(!0), [m, E] = _({}), b = se();
|
|
343
|
+
O(() => (document.body.style.overflow = "hidden", () => {
|
|
344
|
+
document.body.style.overflow = "";
|
|
345
|
+
}), []), O(() => {
|
|
346
|
+
if (o === "position" && b.current && u) {
|
|
347
|
+
const { offsetWidth: p, offsetHeight: T } = b.current;
|
|
348
|
+
E({
|
|
349
|
+
position: "absolute",
|
|
350
|
+
left: u.x - p / 2,
|
|
351
|
+
top: u.y - T / 2
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}, [o, u]);
|
|
355
|
+
const h = () => {
|
|
356
|
+
d(!1), setTimeout(() => {
|
|
357
|
+
c();
|
|
358
|
+
}, 300);
|
|
359
|
+
}, w = a ? o === "position" ? "zoom-in" : `slide-in-${o}` : o === "position" ? "zoom-out" : `slide-out-${o}`;
|
|
360
|
+
return /* @__PURE__ */ f.jsx(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
className: "dialog-overlay",
|
|
364
|
+
onClick: h,
|
|
365
|
+
style: {
|
|
366
|
+
position: "fixed",
|
|
367
|
+
top: 0,
|
|
368
|
+
left: 0,
|
|
369
|
+
width: "100vw",
|
|
370
|
+
height: "100vh",
|
|
371
|
+
backgroundColor: "rgba(0,0,0,0.6)",
|
|
372
|
+
display: "flex",
|
|
373
|
+
justifyContent: "center",
|
|
374
|
+
alignItems: "center",
|
|
375
|
+
zIndex: 1e3
|
|
376
|
+
},
|
|
377
|
+
children: /* @__PURE__ */ f.jsx(
|
|
378
|
+
"div",
|
|
379
|
+
{
|
|
380
|
+
ref: b,
|
|
381
|
+
className: `dialog-content ${w}`,
|
|
382
|
+
onClick: (p) => p.stopPropagation(),
|
|
383
|
+
style: {
|
|
384
|
+
backgroundColor: "#fff",
|
|
385
|
+
padding: "20px",
|
|
386
|
+
borderRadius: "8px",
|
|
387
|
+
maxWidth: "90%",
|
|
388
|
+
maxHeight: "90%",
|
|
389
|
+
overflow: "auto",
|
|
390
|
+
...o === "position" ? m : {}
|
|
391
|
+
},
|
|
392
|
+
children: typeof s == "function" ? s(t) : /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
|
|
393
|
+
/* @__PURE__ */ f.jsx("h3", { children: "Image Info" }),
|
|
394
|
+
/* @__PURE__ */ f.jsx(
|
|
395
|
+
"img",
|
|
396
|
+
{
|
|
397
|
+
src: t.link,
|
|
398
|
+
alt: "Preview",
|
|
399
|
+
style: { width: "100%", height: "auto", borderRadius: "4px" }
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ f.jsxs("p", { children: [
|
|
403
|
+
"ID: ",
|
|
404
|
+
t.id
|
|
405
|
+
] })
|
|
406
|
+
] })
|
|
407
|
+
}
|
|
408
|
+
)
|
|
409
|
+
}
|
|
410
|
+
);
|
|
411
|
+
}, de = ({
|
|
412
|
+
images: t = [],
|
|
413
|
+
size: c = 14,
|
|
414
|
+
bgImageUrl: o = null,
|
|
415
|
+
gridWrapperClassName: u = null,
|
|
416
|
+
gridWrapperStyle: s = {},
|
|
417
|
+
width: a = { xs: 350, md: 500, lg: 700 },
|
|
418
|
+
height: d = { xs: 350, md: 500, lg: 700 },
|
|
419
|
+
bgPosition: m = "center",
|
|
420
|
+
setDialog: E = null
|
|
421
|
+
}) => {
|
|
422
|
+
const [b, h] = _(c), [w, p] = _(!1), [T, N] = _({}), S = (g = null) => {
|
|
423
|
+
g && N(g), p(!0);
|
|
424
|
+
}, $ = () => p(!1), { isXs: I, isMd: M, isLg: Y } = ie();
|
|
425
|
+
let x = 350, R = 350;
|
|
426
|
+
I && (x = a.xs, R = d.xs), M && (x = a.md || 350, R = d.md || 350), Y && (x = a.lg || 350, R = d.lg || 350), O(() => {
|
|
427
|
+
c > 0 && h(c);
|
|
428
|
+
}, [c]), O(() => {
|
|
429
|
+
if (b * b < t.length) {
|
|
430
|
+
const A = Math.ceil(Math.sqrt(t.length));
|
|
431
|
+
A !== b && h(A);
|
|
432
|
+
}
|
|
433
|
+
}, [t.length, b]);
|
|
434
|
+
let z = b, D = b;
|
|
435
|
+
return /* @__PURE__ */ f.jsxs(
|
|
436
|
+
"div",
|
|
437
|
+
{
|
|
438
|
+
className: `mosaic-grid-wrapper ${u || ""}`,
|
|
439
|
+
style: {
|
|
440
|
+
gridTemplateColumns: `repeat(${D}, 1fr)`,
|
|
441
|
+
gridTemplateRows: `repeat(${z}, 1fr)`,
|
|
442
|
+
backgroundImage: `url(${o})`,
|
|
443
|
+
backgroundSize: `${x}px ${R}px`,
|
|
444
|
+
backgroundPosition: m,
|
|
445
|
+
width: `${x}px`,
|
|
446
|
+
height: `${R}px`,
|
|
447
|
+
...s
|
|
448
|
+
},
|
|
449
|
+
children: [
|
|
450
|
+
/* @__PURE__ */ f.jsx("div", { className: "mosaic-grid-wrapper-overlay" }),
|
|
451
|
+
t.map((g) => /* @__PURE__ */ f.jsx(
|
|
452
|
+
ce,
|
|
453
|
+
{
|
|
454
|
+
image: g,
|
|
455
|
+
bgImageUrl: o,
|
|
456
|
+
width: x,
|
|
457
|
+
height: R,
|
|
458
|
+
bgPosition: m,
|
|
459
|
+
onClickCard: S
|
|
460
|
+
}
|
|
461
|
+
)),
|
|
462
|
+
w && /* @__PURE__ */ f.jsx(
|
|
463
|
+
ue,
|
|
464
|
+
{
|
|
465
|
+
image: T,
|
|
466
|
+
onClose: $,
|
|
467
|
+
animationType: "top",
|
|
468
|
+
position: "top",
|
|
469
|
+
setDialog: E
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
]
|
|
473
|
+
}
|
|
474
|
+
);
|
|
475
|
+
};
|
|
476
|
+
export {
|
|
477
|
+
de as MetaMosaic
|
|
478
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(function(_,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(_=typeof globalThis<"u"?globalThis:_||self,s(_.MetaMosaic={},_.React))})(this,function(_,s){"use strict";var N={exports:{}},O={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var J;function re(){if(J)return O;J=1;var t=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function o(f,a,l){var m=null;if(l!==void 0&&(m=""+l),a.key!==void 0&&(m=""+a.key),"key"in a){l={};for(var b in a)b!=="key"&&(l[b]=a[b])}else l=a;return a=l.ref,{$$typeof:t,type:f,key:m,ref:a!==void 0?a:null,props:l}}return O.Fragment=u,O.jsx=o,O.jsxs=o,O}var y={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var B;function te(){return B||(B=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case P:return"Fragment";case Y:return"Profiler";case M:return"StrictMode";case g:return"Suspense";case L:return"SuspenseList";case C:return"Activity"}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){case I:return"Portal";case D:return(e.displayName||"Context")+".Provider";case z:return(e._context.displayName||"Context")+".Consumer";case R:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case k:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function u(e){return""+e}function o(e){try{u(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,c=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",c),u(e)}}function f(e){if(e===P)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=W.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function m(e){if(Z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function n(){$||($=!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)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function x(){var e=t(this.type);return K[e]||(K[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?e:null}function p(e,r,n,c,h,v,V,X){return n=v.ref,e={$$typeof:S,type:e,key:r,props:v,_owner:h},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:x}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function T(e,r,n,c,h,v,V,X){var i=r.children;if(i!==void 0)if(c)if(ce(i)){for(c=0;c<i.length;c++)w(i[c]);Object.freeze&&Object.freeze(i)}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.");else w(i);if(Z.call(r,"key")){i=t(e);var j=Object.keys(r).filter(function(ie){return ie!=="key"});c=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",ee[i+c]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,c,i,j,i),ee[i+c]=!0)}if(i=null,n!==void 0&&(o(n),i=""+n),m(r)&&(o(r.key),i=""+r.key),"key"in r){n={};for(var G in r)G!=="key"&&(n[G]=r[G])}else n=r;return i&&b(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),p(e,i,v,h,a(),n,V,X)}function w(e){typeof e=="object"&&e!==null&&e.$$typeof===S&&e._store&&(e._store.validated=1)}var E=s,S=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),D=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),W=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,ce=Array.isArray,U=console.createTask?console.createTask:function(){return null};E={"react-stack-bottom-frame":function(e){return e()}};var $,K={},Q=E["react-stack-bottom-frame"].bind(E,l)(),q=U(f(l)),ee={};y.Fragment=P,y.jsx=function(e,r,n,c,h){var v=1e4>W.recentlyCreatedOwnerStacks++;return T(e,r,n,!1,c,h,v?Error("react-stack-top-frame"):Q,v?U(f(e)):q)},y.jsxs=function(e,r,n,c,h){var v=1e4>W.recentlyCreatedOwnerStacks++;return T(e,r,n,!0,c,h,v?Error("react-stack-top-frame"):Q,v?U(f(e)):q)}}()),y}process.env.NODE_ENV==="production"?N.exports=re():N.exports=te();var d=N.exports;const A={sm:600,md:960,lg:1280,xl:1920},H=t=>t>=A.xl?"xl":t>=A.lg?"lg":t>=A.md?"md":t>=A.sm?"sm":"xs",ne=()=>{const[t,u]=s.useState(()=>H(window.innerWidth));return s.useEffect(()=>{const o=()=>{u(H(window.innerWidth))};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isXs:t==="xs",isSm:t==="sm",isMd:t==="md",isLg:t==="lg",isXl:t==="xl",current:t}},oe=({image:t,bgImageUrl:u,width:o,height:f,bgPosition:a,onClickCard:l})=>{const[m,b]=s.useState(!1);return s.useEffect(()=>{if(!(t!=null&&t.link))return;const x=new Image;x.src=t.link,x.onload=()=>b(!0),x.onerror=()=>b(!1)},[t]),d.jsx("div",{className:"mosaic-cell-wrapper",children:m?d.jsx("div",{className:"mosaic-cell",style:{backgroundImage:`url(${u})`,backgroundSize:`${o}px ${f}px`,backgroundPosition:a},onClick:()=>l(t),children:d.jsx("div",{className:"mosaic-cell-img",style:{backgroundImage:`url(${t.link})`,backgroundSize:"cover"}})}):null},t.id)},se=({image:t,onClose:u,animationType:o="bottom",position:f,setDialog:a})=>{const[l,m]=s.useState(!0),[b,x]=s.useState({}),p=s.useRef();s.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),s.useEffect(()=>{if(o==="position"&&p.current&&f){const{offsetWidth:E,offsetHeight:S}=p.current;x({position:"absolute",left:f.x-E/2,top:f.y-S/2})}},[o,f]);const T=()=>{m(!1),setTimeout(()=>{u()},300)},w=l?o==="position"?"zoom-in":`slide-in-${o}`:o==="position"?"zoom-out":`slide-out-${o}`;return d.jsx("div",{className:"dialog-overlay",onClick:T,style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0,0,0,0.6)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},children:d.jsx("div",{ref:p,className:`dialog-content ${w}`,onClick:E=>E.stopPropagation(),style:{backgroundColor:"#fff",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",...o==="position"?b:{}},children:typeof a=="function"?a(t):d.jsxs(d.Fragment,{children:[d.jsx("h3",{children:"Image Info"}),d.jsx("img",{src:t.link,alt:"Preview",style:{width:"100%",height:"auto",borderRadius:"4px"}}),d.jsxs("p",{children:["ID: ",t.id]})]})})})},ae=({images:t=[],size:u=14,bgImageUrl:o=null,gridWrapperClassName:f=null,gridWrapperStyle:a={},width:l={xs:350,md:500,lg:700},height:m={xs:350,md:500,lg:700},bgPosition:b="center",setDialog:x=null})=>{const[p,T]=s.useState(u),[w,E]=s.useState(!1),[S,I]=s.useState({}),P=(k=null)=>{k&&I(k),E(!0)},M=()=>E(!1),{isXs:Y,isMd:z,isLg:D}=ne();let R=350,g=350;Y&&(R=l.xs,g=m.xs),z&&(R=l.md||350,g=m.md||350),D&&(R=l.lg||350,g=m.lg||350),s.useEffect(()=>{u>0&&T(u)},[u]),s.useEffect(()=>{if(p*p<t.length){const C=Math.ceil(Math.sqrt(t.length));C!==p&&T(C)}},[t.length,p]);let L=p,F=p;return d.jsxs("div",{className:`mosaic-grid-wrapper ${f||""}`,style:{gridTemplateColumns:`repeat(${F}, 1fr)`,gridTemplateRows:`repeat(${L}, 1fr)`,backgroundImage:`url(${o})`,backgroundSize:`${R}px ${g}px`,backgroundPosition:b,width:`${R}px`,height:`${g}px`,...a},children:[d.jsx("div",{className:"mosaic-grid-wrapper-overlay"}),t.map(k=>d.jsx(oe,{image:k,bgImageUrl:o,width:R,height:g,bgPosition:b,onClickCard:P})),w&&d.jsx(se,{image:S,onClose:M,animationType:"top",position:"top",setDialog:x})]})};_.MetaMosaic=ae,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mosaic-grid-wrapper{display:grid;aspect-ratio:1;margin:0 auto;background-color:"#f9f9f9";background-attachment:fixed;background-repeat:no-repeat;position:relative}.mosaic-grid-wrapper-overlay{position:absolute;top:0;right:0;bottom:0;left:0;backdrop-filter:grayscale(1);-webkit-backdrop-filter:grayscale(1);background-color:#fff3}.mosaic-cell-wrapper{position:relative;z-index:2;cursor:pointer}.mosaic-cell{background-attachment:fixed;background-repeat:no-repeat;height:100%;width:100%}.mosaic-cell-img{width:100%;opacity:.4;height:100%;mix-blend-mode:multiply;position:relative;z-index:1}@keyframes slide-in-top{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slide-out-top{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:0}}@keyframes slide-in-right{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes slide-out-right{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@keyframes slide-in-bottom{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slide-out-bottom{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:0}}@keyframes slide-in-left{0%{transform:translate(-100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes slide-out-left{0%{transform:translate(0);opacity:1}to{transform:translate(-100%);opacity:0}}@keyframes zoom-in{0%{transform:scale(.5);opacity:0}to{transform:scale(1);opacity:1}}@keyframes zoom-out{0%{transform:scale(1);opacity:1}to{transform:scale(.5);opacity:0}}.slide-in-top{animation:slide-in-top .3s forwards}.slide-out-top{animation:slide-out-top .3s forwards}.slide-in-right{animation:slide-in-right .3s forwards}.slide-out-right{animation:slide-out-right .3s forwards}.slide-in-bottom{animation:slide-in-bottom .3s forwards}.slide-out-bottom{animation:slide-out-bottom .3s forwards}.slide-in-left{animation:slide-in-left .3s forwards}.slide-out-left{animation:slide-out-left .3s forwards}.zoom-in{animation:zoom-in .3s forwards}.zoom-out{animation:zoom-out .3s forwards}.custom-mosaic-grid-wrapper{border-radius:.2em;overflow:hidden}.mosaic-cell-wrapper{transition:transform .4s}.mosaic-cell-wrapper:hover{transform:scale(1.1);z-index:3}.mosaic-cell-img{transition:.3s;transition-delay:.5s}.mosaic-cell-wrapper:hover .mosaic-cell-img{opacity:1;mix-blend-mode:normal;transition-delay:0s;border-radius:.1em;z-index:4}
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "meta-mosaic",
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "A React component library to create interactive image mosaics with metadata popups.",
|
|
5
|
+
"main": "dist/index.umd.js",
|
|
6
|
+
"module": "dist/index.es.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.es.js",
|
|
13
|
+
"require": "./dist/index.umd.js"
|
|
14
|
+
},
|
|
15
|
+
"./style.css": "./dist/meta-mosaic.css"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"react",
|
|
19
|
+
"image",
|
|
20
|
+
"mosaic",
|
|
21
|
+
"popup",
|
|
22
|
+
"gallery",
|
|
23
|
+
"photo viewer",
|
|
24
|
+
"react library"
|
|
25
|
+
],
|
|
26
|
+
"author": "Arbaj Ansari",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "vite build"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": "^19.0.0",
|
|
33
|
+
"react-dom": "^19.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"vite": "^5.0.0",
|
|
37
|
+
"@vitejs/plugin-react": "^4.6.0"
|
|
38
|
+
}
|
|
39
|
+
}
|