meta-mosaic 1.0.12 → 1.1.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/dist/index.es.js +198 -189
- package/dist/index.umd.js +4 -4
- package/dist/meta-mosaic.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var X = { exports: {} },
|
|
1
|
+
import ne, { useState as O, useEffect as y, useRef as se } from "react";
|
|
2
|
+
var X = { exports: {} }, C = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -11,27 +11,27 @@ var X = { exports: {} }, P = {};
|
|
|
11
11
|
*/
|
|
12
12
|
var K;
|
|
13
13
|
function ae() {
|
|
14
|
-
if (K) return
|
|
14
|
+
if (K) return C;
|
|
15
15
|
K = 1;
|
|
16
|
-
var t = Symbol.for("react.transitional.element"),
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (a !== void 0 && (
|
|
16
|
+
var t = Symbol.for("react.transitional.element"), u = Symbol.for("react.fragment");
|
|
17
|
+
function n(l, s, a) {
|
|
18
|
+
var m = null;
|
|
19
|
+
if (a !== void 0 && (m = "" + a), s.key !== void 0 && (m = "" + s.key), "key" in s) {
|
|
20
20
|
a = {};
|
|
21
|
-
for (var
|
|
22
|
-
|
|
21
|
+
for (var p in s)
|
|
22
|
+
p !== "key" && (a[p] = s[p]);
|
|
23
23
|
} else a = s;
|
|
24
24
|
return s = a.ref, {
|
|
25
25
|
$$typeof: t,
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
26
|
+
type: l,
|
|
27
|
+
key: m,
|
|
28
28
|
ref: s !== void 0 ? s : null,
|
|
29
29
|
props: a
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return C.Fragment = u, C.jsx = n, C.jsxs = n, C;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var N = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -50,33 +50,33 @@ function le() {
|
|
|
50
50
|
return e.$$typeof === re ? null : e.displayName || e.name || null;
|
|
51
51
|
if (typeof e == "string") return e;
|
|
52
52
|
switch (e) {
|
|
53
|
-
case
|
|
53
|
+
case x:
|
|
54
54
|
return "Fragment";
|
|
55
|
-
case
|
|
55
|
+
case Y:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case M:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case _:
|
|
60
60
|
return "Suspense";
|
|
61
|
-
case
|
|
61
|
+
case $:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case j:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof e == "object")
|
|
67
67
|
switch (typeof e.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
69
|
), e.$$typeof) {
|
|
70
|
-
case
|
|
70
|
+
case A:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case D:
|
|
73
73
|
return (e.displayName || "Context") + ".Provider";
|
|
74
|
-
case
|
|
74
|
+
case z:
|
|
75
75
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case
|
|
76
|
+
case h:
|
|
77
77
|
var r = e.render;
|
|
78
78
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case
|
|
79
|
+
case S:
|
|
80
80
|
return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
|
|
81
81
|
case g:
|
|
82
82
|
r = e._payload, e = e._init;
|
|
@@ -87,28 +87,28 @@ function le() {
|
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function u(e) {
|
|
91
91
|
return "" + e;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function n(e) {
|
|
94
94
|
try {
|
|
95
|
-
|
|
95
|
+
u(e);
|
|
96
96
|
var r = !1;
|
|
97
97
|
} catch {
|
|
98
98
|
r = !0;
|
|
99
99
|
}
|
|
100
100
|
if (r) {
|
|
101
101
|
r = console;
|
|
102
|
-
var
|
|
103
|
-
return
|
|
102
|
+
var o = r.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
+
return o.call(
|
|
104
104
|
r,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
|
|
107
|
-
),
|
|
106
|
+
i
|
|
107
|
+
), u(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (e ===
|
|
110
|
+
function l(e) {
|
|
111
|
+
if (e === x) return "<>";
|
|
112
112
|
if (typeof e == "object" && e !== null && e.$$typeof === g)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
@@ -119,47 +119,47 @@ function le() {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function s() {
|
|
122
|
-
var e =
|
|
122
|
+
var e = F.A;
|
|
123
123
|
return e === null ? null : e.getOwner();
|
|
124
124
|
}
|
|
125
125
|
function a() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function m(e) {
|
|
129
129
|
if (q.call(e, "key")) {
|
|
130
130
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
131
|
if (r && r.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
133
|
return e.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
function
|
|
135
|
+
function p(e, r) {
|
|
136
|
+
function o() {
|
|
137
137
|
G || (G = !0, console.error(
|
|
138
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
139
|
r
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
get:
|
|
142
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: o,
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function T() {
|
|
148
148
|
var e = t(this.type);
|
|
149
149
|
return J[e] || (J[e] = !0, console.error(
|
|
150
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
151
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
155
|
-
$$typeof:
|
|
153
|
+
function f(e, r, o, i, w, E, W, U) {
|
|
154
|
+
return o = E.ref, e = {
|
|
155
|
+
$$typeof: k,
|
|
156
156
|
type: e,
|
|
157
157
|
key: r,
|
|
158
|
-
props:
|
|
159
|
-
_owner:
|
|
160
|
-
}, (
|
|
158
|
+
props: E,
|
|
159
|
+
_owner: w
|
|
160
|
+
}, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
161
|
enumerable: !1,
|
|
162
|
-
get:
|
|
162
|
+
get: T
|
|
163
163
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
@@ -182,112 +182,112 @@ function le() {
|
|
|
182
182
|
value: U
|
|
183
183
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
188
|
-
if (
|
|
189
|
-
if (te(
|
|
190
|
-
for (
|
|
191
|
-
|
|
192
|
-
Object.freeze && Object.freeze(
|
|
185
|
+
function v(e, r, o, i, w, E, W, U) {
|
|
186
|
+
var c = r.children;
|
|
187
|
+
if (c !== void 0)
|
|
188
|
+
if (i)
|
|
189
|
+
if (te(c)) {
|
|
190
|
+
for (i = 0; i < c.length; i++)
|
|
191
|
+
R(c[i]);
|
|
192
|
+
Object.freeze && Object.freeze(c);
|
|
193
193
|
} else
|
|
194
194
|
console.error(
|
|
195
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
196
|
);
|
|
197
|
-
else
|
|
197
|
+
else R(c);
|
|
198
198
|
if (q.call(r, "key")) {
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
return
|
|
199
|
+
c = t(e);
|
|
200
|
+
var P = Object.keys(r).filter(function(oe) {
|
|
201
|
+
return oe !== "key";
|
|
202
202
|
});
|
|
203
|
-
|
|
203
|
+
i = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", Z[c + i] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
204
|
`A props object containing a "key" prop is being spread into JSX:
|
|
205
205
|
let props = %s;
|
|
206
206
|
<%s {...props} />
|
|
207
207
|
React keys must be passed directly to JSX without using spread:
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s key={someKey} {...props} />`,
|
|
210
|
-
l,
|
|
211
210
|
i,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
c,
|
|
212
|
+
P,
|
|
213
|
+
c
|
|
214
|
+
), Z[c + i] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (
|
|
217
|
-
|
|
216
|
+
if (c = null, o !== void 0 && (n(o), c = "" + o), m(r) && (n(r.key), c = "" + r.key), "key" in r) {
|
|
217
|
+
o = {};
|
|
218
218
|
for (var V in r)
|
|
219
|
-
V !== "key" && (
|
|
220
|
-
} else
|
|
221
|
-
return
|
|
222
|
-
|
|
219
|
+
V !== "key" && (o[V] = r[V]);
|
|
220
|
+
} else o = r;
|
|
221
|
+
return c && p(
|
|
222
|
+
o,
|
|
223
223
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
),
|
|
224
|
+
), f(
|
|
225
225
|
e,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
c,
|
|
227
|
+
E,
|
|
228
|
+
w,
|
|
229
229
|
s(),
|
|
230
|
-
|
|
230
|
+
o,
|
|
231
231
|
W,
|
|
232
232
|
U
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
typeof e == "object" && e !== null && e.$$typeof ===
|
|
235
|
+
function R(e) {
|
|
236
|
+
typeof e == "object" && e !== null && e.$$typeof === k && e._store && (e._store.validated = 1);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var b = ne, k = Symbol.for("react.transitional.element"), A = Symbol.for("react.portal"), x = 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"), h = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), $ = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), j = Symbol.for("react.activity"), re = Symbol.for("react.client.reference"), F = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, te = Array.isArray, L = console.createTask ? console.createTask : function() {
|
|
239
239
|
return null;
|
|
240
240
|
};
|
|
241
|
-
|
|
241
|
+
b = {
|
|
242
242
|
"react-stack-bottom-frame": function(e) {
|
|
243
243
|
return e();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var G, J = {},
|
|
247
|
-
|
|
246
|
+
var G, J = {}, H = b["react-stack-bottom-frame"].bind(
|
|
247
|
+
b,
|
|
248
248
|
a
|
|
249
|
-
)(),
|
|
250
|
-
|
|
251
|
-
var
|
|
252
|
-
return
|
|
249
|
+
)(), B = L(l(a)), Z = {};
|
|
250
|
+
N.Fragment = x, N.jsx = function(e, r, o, i, w) {
|
|
251
|
+
var E = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return v(
|
|
253
253
|
e,
|
|
254
254
|
r,
|
|
255
|
-
|
|
255
|
+
o,
|
|
256
256
|
!1,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
i,
|
|
258
|
+
w,
|
|
259
|
+
E ? Error("react-stack-top-frame") : H,
|
|
260
|
+
E ? L(l(e)) : B
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
return
|
|
262
|
+
}, N.jsxs = function(e, r, o, i, w) {
|
|
263
|
+
var E = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return v(
|
|
265
265
|
e,
|
|
266
266
|
r,
|
|
267
|
-
|
|
267
|
+
o,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
i,
|
|
270
|
+
w,
|
|
271
|
+
E ? Error("react-stack-top-frame") : H,
|
|
272
|
+
E ? L(l(e)) : B
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
}()),
|
|
275
|
+
}()), N;
|
|
276
276
|
}
|
|
277
277
|
process.env.NODE_ENV === "production" ? X.exports = ae() : X.exports = le();
|
|
278
|
-
var
|
|
279
|
-
const
|
|
278
|
+
var d = X.exports;
|
|
279
|
+
const I = {
|
|
280
280
|
sm: 600,
|
|
281
281
|
md: 960,
|
|
282
282
|
lg: 1280,
|
|
283
283
|
xl: 1920
|
|
284
|
-
}, ee = (t) => t >=
|
|
285
|
-
const [t,
|
|
286
|
-
return
|
|
287
|
-
const
|
|
288
|
-
|
|
284
|
+
}, ee = (t) => t >= I.xl ? "xl" : t >= I.lg ? "lg" : t >= I.md ? "md" : t >= I.sm ? "sm" : "xs", ie = () => {
|
|
285
|
+
const [t, u] = O(() => ee(window.innerWidth));
|
|
286
|
+
return y(() => {
|
|
287
|
+
const n = () => {
|
|
288
|
+
u(ee(window.innerWidth));
|
|
289
289
|
};
|
|
290
|
-
return window.addEventListener("resize",
|
|
290
|
+
return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
291
291
|
}, []), {
|
|
292
292
|
isXs: t === "xs",
|
|
293
293
|
isSm: t === "sm",
|
|
@@ -298,28 +298,33 @@ const C = {
|
|
|
298
298
|
};
|
|
299
299
|
}, ce = ({
|
|
300
300
|
image: t,
|
|
301
|
-
bgImageUrl:
|
|
302
|
-
width:
|
|
303
|
-
height:
|
|
304
|
-
|
|
305
|
-
|
|
301
|
+
bgImageUrl: u,
|
|
302
|
+
width: n,
|
|
303
|
+
height: l,
|
|
304
|
+
row: s,
|
|
305
|
+
col: a,
|
|
306
|
+
totalRows: m,
|
|
307
|
+
totalCols: p,
|
|
308
|
+
onClickCard: T
|
|
306
309
|
}) => {
|
|
307
|
-
const [
|
|
308
|
-
|
|
310
|
+
const [f, v] = O(!1);
|
|
311
|
+
y(() => {
|
|
309
312
|
if (!(t != null && t.link)) return;
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
}, [t])
|
|
313
|
+
const x = new Image();
|
|
314
|
+
x.src = t.link, x.onload = () => v(!0), x.onerror = () => v(!1);
|
|
315
|
+
}, [t]);
|
|
316
|
+
const R = n / p, b = l / m, k = Number((-(a * R)).toFixed(5)), A = Number((-(s * b)).toFixed(5));
|
|
317
|
+
return /* @__PURE__ */ d.jsx("div", { className: "mosaic-cell-wrapper", children: f ? /* @__PURE__ */ d.jsx(
|
|
313
318
|
"div",
|
|
314
319
|
{
|
|
315
320
|
className: "mosaic-cell",
|
|
316
321
|
style: {
|
|
317
|
-
backgroundImage: `url(${
|
|
318
|
-
backgroundSize: `${
|
|
319
|
-
backgroundPosition:
|
|
322
|
+
backgroundImage: `url(${u})`,
|
|
323
|
+
backgroundSize: `${n}px ${l}px`,
|
|
324
|
+
backgroundPosition: `${k}px ${A}px`
|
|
320
325
|
},
|
|
321
|
-
onClick: () =>
|
|
322
|
-
children: /* @__PURE__ */
|
|
326
|
+
onClick: () => T(t),
|
|
327
|
+
children: /* @__PURE__ */ d.jsx(
|
|
323
328
|
"div",
|
|
324
329
|
{
|
|
325
330
|
className: "mosaic-cell-img",
|
|
@@ -330,38 +335,38 @@ const C = {
|
|
|
330
335
|
}
|
|
331
336
|
)
|
|
332
337
|
}
|
|
333
|
-
) : null }
|
|
338
|
+
) : null });
|
|
334
339
|
}, ue = ({
|
|
335
340
|
image: t,
|
|
336
|
-
onClose:
|
|
337
|
-
animationType:
|
|
338
|
-
position:
|
|
341
|
+
onClose: u,
|
|
342
|
+
animationType: n = "bottom",
|
|
343
|
+
position: l,
|
|
339
344
|
setDialog: s
|
|
340
345
|
// 🆕 New prop
|
|
341
346
|
}) => {
|
|
342
|
-
const [a,
|
|
343
|
-
|
|
347
|
+
const [a, m] = O(!0), [p, T] = O({}), f = se();
|
|
348
|
+
y(() => (document.body.style.overflow = "hidden", () => {
|
|
344
349
|
document.body.style.overflow = "";
|
|
345
|
-
}), []),
|
|
346
|
-
if (
|
|
347
|
-
const { offsetWidth:
|
|
348
|
-
|
|
350
|
+
}), []), y(() => {
|
|
351
|
+
if (n === "position" && f.current && l) {
|
|
352
|
+
const { offsetWidth: b, offsetHeight: k } = f.current;
|
|
353
|
+
T({
|
|
349
354
|
position: "absolute",
|
|
350
|
-
left:
|
|
351
|
-
top:
|
|
355
|
+
left: l.x - b / 2,
|
|
356
|
+
top: l.y - k / 2
|
|
352
357
|
});
|
|
353
358
|
}
|
|
354
|
-
}, [
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
359
|
+
}, [n, l]);
|
|
360
|
+
const v = () => {
|
|
361
|
+
m(!1), setTimeout(() => {
|
|
362
|
+
u();
|
|
358
363
|
}, 300);
|
|
359
|
-
},
|
|
360
|
-
return /* @__PURE__ */
|
|
364
|
+
}, R = a ? n === "position" ? "zoom-in" : `slide-in-${n}` : n === "position" ? "zoom-out" : `slide-out-${n}`;
|
|
365
|
+
return /* @__PURE__ */ d.jsx(
|
|
361
366
|
"div",
|
|
362
367
|
{
|
|
363
368
|
className: "dialog-overlay",
|
|
364
|
-
onClick:
|
|
369
|
+
onClick: v,
|
|
365
370
|
style: {
|
|
366
371
|
position: "fixed",
|
|
367
372
|
top: 0,
|
|
@@ -374,12 +379,12 @@ const C = {
|
|
|
374
379
|
alignItems: "center",
|
|
375
380
|
zIndex: 1e3
|
|
376
381
|
},
|
|
377
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ d.jsx(
|
|
378
383
|
"div",
|
|
379
384
|
{
|
|
380
|
-
ref:
|
|
381
|
-
className: `dialog-content ${
|
|
382
|
-
onClick: (
|
|
385
|
+
ref: f,
|
|
386
|
+
className: `dialog-content ${R}`,
|
|
387
|
+
onClick: (b) => b.stopPropagation(),
|
|
383
388
|
style: {
|
|
384
389
|
backgroundColor: "#fff",
|
|
385
390
|
padding: "20px",
|
|
@@ -387,11 +392,11 @@ const C = {
|
|
|
387
392
|
maxWidth: "90%",
|
|
388
393
|
maxHeight: "90%",
|
|
389
394
|
overflow: "auto",
|
|
390
|
-
...
|
|
395
|
+
...n === "position" ? p : {}
|
|
391
396
|
},
|
|
392
|
-
children: typeof s == "function" ? s(t) : /* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
397
|
+
children: typeof s == "function" ? s(t) : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
|
398
|
+
/* @__PURE__ */ d.jsx("h3", { children: "Image Info" }),
|
|
399
|
+
/* @__PURE__ */ d.jsx(
|
|
395
400
|
"img",
|
|
396
401
|
{
|
|
397
402
|
src: t.link,
|
|
@@ -399,7 +404,7 @@ const C = {
|
|
|
399
404
|
style: { width: "100%", height: "auto", borderRadius: "4px" }
|
|
400
405
|
}
|
|
401
406
|
),
|
|
402
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ d.jsxs("p", { children: [
|
|
403
408
|
"ID: ",
|
|
404
409
|
t.id
|
|
405
410
|
] })
|
|
@@ -410,63 +415,67 @@ const C = {
|
|
|
410
415
|
);
|
|
411
416
|
}, de = ({
|
|
412
417
|
images: t = [],
|
|
413
|
-
size:
|
|
414
|
-
bgImageUrl:
|
|
415
|
-
gridWrapperClassName:
|
|
418
|
+
size: u = 14,
|
|
419
|
+
bgImageUrl: n = null,
|
|
420
|
+
gridWrapperClassName: l = null,
|
|
416
421
|
gridWrapperStyle: s = {},
|
|
417
422
|
width: a = { xs: 350, md: 500, lg: 700 },
|
|
418
|
-
height:
|
|
419
|
-
bgPosition:
|
|
420
|
-
setDialog:
|
|
423
|
+
height: m = { xs: 350, md: 500, lg: 700 },
|
|
424
|
+
bgPosition: p = "center",
|
|
425
|
+
setDialog: T = null
|
|
421
426
|
}) => {
|
|
422
|
-
const [
|
|
423
|
-
g &&
|
|
424
|
-
},
|
|
425
|
-
let
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}, [
|
|
429
|
-
if (
|
|
430
|
-
const
|
|
431
|
-
|
|
427
|
+
const [f, v] = O(u), [R, b] = O(!1), [k, A] = O({}), x = (g = null) => {
|
|
428
|
+
g && A(g), b(!0);
|
|
429
|
+
}, M = () => b(!1), { isXs: Y, isMd: z, isLg: D } = ie();
|
|
430
|
+
let h = 350, _ = 350;
|
|
431
|
+
Y && (h = a.xs, _ = m.xs), z && (h = a.md || 350, _ = m.md || 350), D && (h = a.lg || 350, _ = m.lg || 350), y(() => {
|
|
432
|
+
u > 0 && v(u);
|
|
433
|
+
}, [u]), y(() => {
|
|
434
|
+
if (f * f < t.length) {
|
|
435
|
+
const j = Math.ceil(Math.sqrt(t.length));
|
|
436
|
+
j !== f && v(j);
|
|
432
437
|
}
|
|
433
|
-
}, [t.length,
|
|
434
|
-
let
|
|
435
|
-
return /* @__PURE__ */
|
|
438
|
+
}, [t.length, f]);
|
|
439
|
+
let $ = f, S = f;
|
|
440
|
+
return /* @__PURE__ */ d.jsxs(
|
|
436
441
|
"div",
|
|
437
442
|
{
|
|
438
|
-
className: `mosaic-grid-wrapper ${
|
|
443
|
+
className: `mosaic-grid-wrapper ${l || ""}`,
|
|
439
444
|
style: {
|
|
440
|
-
gridTemplateColumns: `repeat(${
|
|
441
|
-
gridTemplateRows: `repeat(${
|
|
442
|
-
backgroundImage: `url(${
|
|
443
|
-
backgroundSize: `${
|
|
444
|
-
backgroundPosition:
|
|
445
|
-
width: `${
|
|
446
|
-
height: `${
|
|
445
|
+
gridTemplateColumns: `repeat(${S}, 1fr)`,
|
|
446
|
+
gridTemplateRows: `repeat(${$}, 1fr)`,
|
|
447
|
+
backgroundImage: `url(${n})`,
|
|
448
|
+
backgroundSize: `${h}px ${_}px`,
|
|
449
|
+
backgroundPosition: "0px 0px",
|
|
450
|
+
width: `${h}px`,
|
|
451
|
+
height: `${_}px`,
|
|
447
452
|
...s
|
|
448
453
|
},
|
|
449
454
|
children: [
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
t.map((g) => /* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ d.jsx("div", { className: "mosaic-grid-wrapper-overlay" }),
|
|
456
|
+
t.map((g, j) => /* @__PURE__ */ d.jsx(
|
|
452
457
|
ce,
|
|
453
458
|
{
|
|
454
459
|
image: g,
|
|
455
|
-
bgImageUrl:
|
|
456
|
-
width:
|
|
457
|
-
height:
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
460
|
+
bgImageUrl: n,
|
|
461
|
+
width: h,
|
|
462
|
+
height: _,
|
|
463
|
+
row: Math.floor(j / S),
|
|
464
|
+
col: j % S,
|
|
465
|
+
totalRows: $,
|
|
466
|
+
totalCols: S,
|
|
467
|
+
onClickCard: x
|
|
468
|
+
},
|
|
469
|
+
g.id
|
|
461
470
|
)),
|
|
462
|
-
|
|
471
|
+
R && /* @__PURE__ */ d.jsx(
|
|
463
472
|
ue,
|
|
464
473
|
{
|
|
465
|
-
image:
|
|
466
|
-
onClose:
|
|
474
|
+
image: k,
|
|
475
|
+
onClose: M,
|
|
467
476
|
animationType: "top",
|
|
468
477
|
position: "top",
|
|
469
|
-
setDialog:
|
|
478
|
+
setDialog: T
|
|
470
479
|
}
|
|
471
480
|
)
|
|
472
481
|
]
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(S,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(S=typeof globalThis<"u"?globalThis:S||self,s(S.MetaMosaic={},S.React))})(this,function(S,s){"use strict";var Y={exports:{}},A={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var J;function re(){if(J)return
|
|
9
|
+
*/var J;function re(){if(J)return A;J=1;var t=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function o(c,a,l){var b=null;if(l!==void 0&&(b=""+l),a.key!==void 0&&(b=""+a.key),"key"in a){l={};for(var E in a)E!=="key"&&(l[E]=a[E])}else l=a;return a=l.ref,{$$typeof:t,type:c,key:b,ref:a!==void 0?a:null,props:l}}return A.Fragment=f,A.jsx=o,A.jsxs=o,A}var C={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var H;function te(){return H||(H=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 g:return"Fragment";case D:return"Profiler";case z:return"StrictMode";case w:return"Suspense";case M:return"SuspenseList";case O: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 N:return"Portal";case L:return(e.displayName||"Context")+".Provider";case F:return(e._context.displayName||"Context")+".Consumer";case _:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case R:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function f(e){return""+e}function o(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,i=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.",i),f(e)}}function c(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===R)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 b(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 E(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 j(){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 m(e,r,n,i,T,x,V,X){return n=x.ref,e={$$typeof:h,type:e,key:r,props:x,_owner:T},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:j}):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 v(e,r,n,i,T,x,V,X){var u=r.children;if(u!==void 0)if(i)if(ce(u)){for(i=0;i<u.length;i++)k(u[i]);Object.freeze&&Object.freeze(u)}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 k(u);if(Z.call(r,"key")){u=t(e);var y=Object.keys(r).filter(function(ie){return ie!=="key"});i=0<y.length?"{key: someKey, "+y.join(": ..., ")+": ...}":"{key: someKey}",ee[u+i]||(y=0<y.length?"{"+y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,i,u,y,u),ee[u+i]=!0)}if(u=null,n!==void 0&&(o(n),u=""+n),b(r)&&(o(r.key),u=""+r.key),"key"in r){n={};for(var G in r)G!=="key"&&(n[G]=r[G])}else n=r;return u&&E(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,u,x,T,a(),n,V,X)}function k(e){typeof e=="object"&&e!==null&&e.$$typeof===h&&e._store&&(e._store.validated=1)}var p=s,h=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),L=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),W=p.__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};p={"react-stack-bottom-frame":function(e){return e()}};var $,K={},Q=p["react-stack-bottom-frame"].bind(p,l)(),q=U(c(l)),ee={};C.Fragment=g,C.jsx=function(e,r,n,i,T){var x=1e4>W.recentlyCreatedOwnerStacks++;return v(e,r,n,!1,i,T,x?Error("react-stack-top-frame"):Q,x?U(c(e)):q)},C.jsxs=function(e,r,n,i,T){var x=1e4>W.recentlyCreatedOwnerStacks++;return v(e,r,n,!0,i,T,x?Error("react-stack-top-frame"):Q,x?U(c(e)):q)}}()),C}process.env.NODE_ENV==="production"?Y.exports=re():Y.exports=te();var d=Y.exports;const I={sm:600,md:960,lg:1280,xl:1920},B=t=>t>=I.xl?"xl":t>=I.lg?"lg":t>=I.md?"md":t>=I.sm?"sm":"xs",ne=()=>{const[t,f]=s.useState(()=>B(window.innerWidth));return s.useEffect(()=>{const o=()=>{f(B(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:f,width:o,height:c,row:a,col:l,totalRows:b,totalCols:E,onClickCard:j})=>{const[m,v]=s.useState(!1);s.useEffect(()=>{if(!(t!=null&&t.link))return;const g=new Image;g.src=t.link,g.onload=()=>v(!0),g.onerror=()=>v(!1)},[t]);const k=o/E,p=c/b,h=Number((-(l*k)).toFixed(5)),N=Number((-(a*p)).toFixed(5));return d.jsx("div",{className:"mosaic-cell-wrapper",children:m?d.jsx("div",{className:"mosaic-cell",style:{backgroundImage:`url(${f})`,backgroundSize:`${o}px ${c}px`,backgroundPosition:`${h}px ${N}px`},onClick:()=>j(t),children:d.jsx("div",{className:"mosaic-cell-img",style:{backgroundImage:`url(${t.link})`,backgroundSize:"cover"}})}):null})},se=({image:t,onClose:f,animationType:o="bottom",position:c,setDialog:a})=>{const[l,b]=s.useState(!0),[E,j]=s.useState({}),m=s.useRef();s.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),s.useEffect(()=>{if(o==="position"&&m.current&&c){const{offsetWidth:p,offsetHeight:h}=m.current;j({position:"absolute",left:c.x-p/2,top:c.y-h/2})}},[o,c]);const v=()=>{b(!1),setTimeout(()=>{f()},300)},k=l?o==="position"?"zoom-in":`slide-in-${o}`:o==="position"?"zoom-out":`slide-out-${o}`;return d.jsx("div",{className:"dialog-overlay",onClick:v,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:m,className:`dialog-content ${k}`,onClick:p=>p.stopPropagation(),style:{backgroundColor:"#fff",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",...o==="position"?E:{}},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:f=14,bgImageUrl:o=null,gridWrapperClassName:c=null,gridWrapperStyle:a={},width:l={xs:350,md:500,lg:700},height:b={xs:350,md:500,lg:700},bgPosition:E="center",setDialog:j=null})=>{const[m,v]=s.useState(f),[k,p]=s.useState(!1),[h,N]=s.useState({}),g=(R=null)=>{R&&N(R),p(!0)},z=()=>p(!1),{isXs:D,isMd:F,isLg:L}=ne();let _=350,w=350;D&&(_=l.xs,w=b.xs),F&&(_=l.md||350,w=b.md||350),L&&(_=l.lg||350,w=b.lg||350),s.useEffect(()=>{f>0&&v(f)},[f]),s.useEffect(()=>{if(m*m<t.length){const O=Math.ceil(Math.sqrt(t.length));O!==m&&v(O)}},[t.length,m]);let M=m,P=m;return d.jsxs("div",{className:`mosaic-grid-wrapper ${c||""}`,style:{gridTemplateColumns:`repeat(${P}, 1fr)`,gridTemplateRows:`repeat(${M}, 1fr)`,backgroundImage:`url(${o})`,backgroundSize:`${_}px ${w}px`,backgroundPosition:"0px 0px",width:`${_}px`,height:`${w}px`,...a},children:[d.jsx("div",{className:"mosaic-grid-wrapper-overlay"}),t.map((R,O)=>d.jsx(oe,{image:R,bgImageUrl:o,width:_,height:w,row:Math.floor(O/P),col:O%P,totalRows:M,totalCols:P,onClickCard:g},R.id)),k&&d.jsx(se,{image:h,onClose:z,animationType:"top",position:"top",setDialog:j})]})};S.MetaMosaic=ae,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|
package/dist/meta-mosaic.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.mosaic-grid-wrapper{display:grid;aspect-ratio:1;margin:0 auto;background-color:"#f9f9f9";background-attachment:
|
|
1
|
+
.mosaic-grid-wrapper{display:grid;aspect-ratio:1;margin:0 auto;background-color:"#f9f9f9";background-attachment:scroll;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:scroll;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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meta-mosaic",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A simple and responsive React component to create interactive image mosaics with metadata popups, background images, and click-to-enlarge dialogs.",
|
|
5
5
|
"homepage": "https://meta-mosaic-showcase.onrender.com",
|
|
6
6
|
"main": "dist/index.umd.js",
|