@egjs/react-flicking 4.15.0 → 4.16.0-beta.10
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/.env +1 -0
- package/{declaration → dist}/CrossFlicking.d.ts +3 -5
- package/{declaration → dist}/CrossGroup.d.ts +1 -1
- package/{declaration → dist}/Flicking.d.ts +8 -8
- package/{declaration → dist}/NonStrictPanel.d.ts +1 -1
- package/{declaration → dist}/ReactRenderer.d.ts +1 -1
- package/{declaration → dist}/StrictPanel.d.ts +1 -1
- package/{declaration → dist}/ViewportSlot.d.ts +1 -1
- package/dist/flicking.cjs.js +1514 -579
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +1573 -651
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +1634 -0
- package/dist/flicking.js.map +1 -0
- package/{declaration → dist}/index.d.ts +3 -3
- package/{declaration → dist}/types.d.ts +1 -2
- package/package.json +18 -33
- package/src/react-flicking/CrossFlicking.tsx +28 -37
- package/src/react-flicking/CrossGroup.tsx +6 -8
- package/src/react-flicking/Flicking.tsx +81 -69
- package/src/react-flicking/NonStrictPanel.tsx +15 -7
- package/src/react-flicking/ReactElementProvider.ts +6 -4
- package/src/react-flicking/ReactRenderer.ts +1 -2
- package/src/react-flicking/StrictPanel.tsx +10 -6
- package/src/react-flicking/consts.ts +14 -14
- package/src/react-flicking/index.ts +4 -7
- package/src/react-flicking/index.umd.ts +1 -1
- package/src/react-flicking/reactive.ts +3 -3
- package/src/react-flicking/types.ts +17 -17
- package/dist/flicking.umd.js +0 -699
- package/dist/flicking.umd.js.map +0 -1
- package/tsconfig.json +0 -30
- /package/{declaration → dist}/ReactElementProvider.d.ts +0 -0
- /package/{declaration → dist}/consts.d.ts +0 -0
- /package/{declaration → dist}/index.umd.d.ts +0 -0
- /package/{declaration → dist}/reactive.d.ts +0 -0
package/dist/flicking.js
ADDED
|
@@ -0,0 +1,1634 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory(require("react"), require("@egjs/component"), require("@egjs/flicking"), require("@egjs/list-differ")) : typeof define === "function" && define.amd ? define(["react", "@egjs/component", "@egjs/flicking", "@egjs/list-differ"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.ReactFlicking = factory(global.React, global.Component, global.Flicking, global.eg.ListDiffer));
|
|
3
|
+
})(this, (function(React, Component, VanillaFlicking, ListDiffer) {
|
|
4
|
+
"use strict";
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
22
|
+
var jsxRuntime = { exports: {} };
|
|
23
|
+
var reactJsxRuntime_production_min = {};
|
|
24
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
25
|
+
function requireReactJsxRuntime_production_min() {
|
|
26
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
27
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
28
|
+
var f = React, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
29
|
+
function q(c, a, g) {
|
|
30
|
+
var b, d = {}, e = null, h = null;
|
|
31
|
+
void 0 !== g && (e = "" + g);
|
|
32
|
+
void 0 !== a.key && (e = "" + a.key);
|
|
33
|
+
void 0 !== a.ref && (h = a.ref);
|
|
34
|
+
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
35
|
+
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
36
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
37
|
+
}
|
|
38
|
+
reactJsxRuntime_production_min.Fragment = l;
|
|
39
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
40
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
41
|
+
return reactJsxRuntime_production_min;
|
|
42
|
+
}
|
|
43
|
+
var reactJsxRuntime_development = {};
|
|
44
|
+
var hasRequiredReactJsxRuntime_development;
|
|
45
|
+
function requireReactJsxRuntime_development() {
|
|
46
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
47
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
48
|
+
if (process.env.NODE_ENV !== "production") {
|
|
49
|
+
(function() {
|
|
50
|
+
var React$1 = React;
|
|
51
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
52
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
53
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
54
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
55
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
56
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
57
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
58
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
59
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
60
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
61
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
62
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
63
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
64
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
65
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
66
|
+
function getIteratorFn(maybeIterable) {
|
|
67
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
71
|
+
if (typeof maybeIterator === "function") {
|
|
72
|
+
return maybeIterator;
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
77
|
+
function error(format) {
|
|
78
|
+
{
|
|
79
|
+
{
|
|
80
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
81
|
+
args[_key2 - 1] = arguments[_key2];
|
|
82
|
+
}
|
|
83
|
+
printWarning("error", format, args);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function printWarning(level, format, args) {
|
|
88
|
+
{
|
|
89
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
90
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
91
|
+
if (stack !== "") {
|
|
92
|
+
format += "%s";
|
|
93
|
+
args = args.concat([stack]);
|
|
94
|
+
}
|
|
95
|
+
var argsWithFormat = args.map(function(item) {
|
|
96
|
+
return String(item);
|
|
97
|
+
});
|
|
98
|
+
argsWithFormat.unshift("Warning: " + format);
|
|
99
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
var enableScopeAPI = false;
|
|
103
|
+
var enableCacheElement = false;
|
|
104
|
+
var enableTransitionTracing = false;
|
|
105
|
+
var enableLegacyHidden = false;
|
|
106
|
+
var enableDebugTracing = false;
|
|
107
|
+
var REACT_MODULE_REFERENCE;
|
|
108
|
+
{
|
|
109
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
110
|
+
}
|
|
111
|
+
function isValidElementType(type) {
|
|
112
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
if (typeof type === "object" && type !== null) {
|
|
119
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
120
|
+
// types supported by any Flight configuration anywhere since
|
|
121
|
+
// we don't know which Flight build this will end up being used
|
|
122
|
+
// with.
|
|
123
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
130
|
+
var displayName = outerType.displayName;
|
|
131
|
+
if (displayName) {
|
|
132
|
+
return displayName;
|
|
133
|
+
}
|
|
134
|
+
var functionName = innerType.displayName || innerType.name || "";
|
|
135
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
136
|
+
}
|
|
137
|
+
function getContextName(type) {
|
|
138
|
+
return type.displayName || "Context";
|
|
139
|
+
}
|
|
140
|
+
function getComponentNameFromType(type) {
|
|
141
|
+
if (type == null) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
{
|
|
145
|
+
if (typeof type.tag === "number") {
|
|
146
|
+
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (typeof type === "function") {
|
|
150
|
+
return type.displayName || type.name || null;
|
|
151
|
+
}
|
|
152
|
+
if (typeof type === "string") {
|
|
153
|
+
return type;
|
|
154
|
+
}
|
|
155
|
+
switch (type) {
|
|
156
|
+
case REACT_FRAGMENT_TYPE:
|
|
157
|
+
return "Fragment";
|
|
158
|
+
case REACT_PORTAL_TYPE:
|
|
159
|
+
return "Portal";
|
|
160
|
+
case REACT_PROFILER_TYPE:
|
|
161
|
+
return "Profiler";
|
|
162
|
+
case REACT_STRICT_MODE_TYPE:
|
|
163
|
+
return "StrictMode";
|
|
164
|
+
case REACT_SUSPENSE_TYPE:
|
|
165
|
+
return "Suspense";
|
|
166
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
167
|
+
return "SuspenseList";
|
|
168
|
+
}
|
|
169
|
+
if (typeof type === "object") {
|
|
170
|
+
switch (type.$$typeof) {
|
|
171
|
+
case REACT_CONTEXT_TYPE:
|
|
172
|
+
var context = type;
|
|
173
|
+
return getContextName(context) + ".Consumer";
|
|
174
|
+
case REACT_PROVIDER_TYPE:
|
|
175
|
+
var provider = type;
|
|
176
|
+
return getContextName(provider._context) + ".Provider";
|
|
177
|
+
case REACT_FORWARD_REF_TYPE:
|
|
178
|
+
return getWrappedName(type, type.render, "ForwardRef");
|
|
179
|
+
case REACT_MEMO_TYPE:
|
|
180
|
+
var outerName = type.displayName || null;
|
|
181
|
+
if (outerName !== null) {
|
|
182
|
+
return outerName;
|
|
183
|
+
}
|
|
184
|
+
return getComponentNameFromType(type.type) || "Memo";
|
|
185
|
+
case REACT_LAZY_TYPE: {
|
|
186
|
+
var lazyComponent = type;
|
|
187
|
+
var payload = lazyComponent._payload;
|
|
188
|
+
var init = lazyComponent._init;
|
|
189
|
+
try {
|
|
190
|
+
return getComponentNameFromType(init(payload));
|
|
191
|
+
} catch (x) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
var assign = Object.assign;
|
|
200
|
+
var disabledDepth = 0;
|
|
201
|
+
var prevLog;
|
|
202
|
+
var prevInfo;
|
|
203
|
+
var prevWarn;
|
|
204
|
+
var prevError;
|
|
205
|
+
var prevGroup;
|
|
206
|
+
var prevGroupCollapsed;
|
|
207
|
+
var prevGroupEnd;
|
|
208
|
+
function disabledLog() {
|
|
209
|
+
}
|
|
210
|
+
disabledLog.__reactDisabledLog = true;
|
|
211
|
+
function disableLogs() {
|
|
212
|
+
{
|
|
213
|
+
if (disabledDepth === 0) {
|
|
214
|
+
prevLog = console.log;
|
|
215
|
+
prevInfo = console.info;
|
|
216
|
+
prevWarn = console.warn;
|
|
217
|
+
prevError = console.error;
|
|
218
|
+
prevGroup = console.group;
|
|
219
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
220
|
+
prevGroupEnd = console.groupEnd;
|
|
221
|
+
var props = {
|
|
222
|
+
configurable: true,
|
|
223
|
+
enumerable: true,
|
|
224
|
+
value: disabledLog,
|
|
225
|
+
writable: true
|
|
226
|
+
};
|
|
227
|
+
Object.defineProperties(console, {
|
|
228
|
+
info: props,
|
|
229
|
+
log: props,
|
|
230
|
+
warn: props,
|
|
231
|
+
error: props,
|
|
232
|
+
group: props,
|
|
233
|
+
groupCollapsed: props,
|
|
234
|
+
groupEnd: props
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
disabledDepth++;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function reenableLogs() {
|
|
241
|
+
{
|
|
242
|
+
disabledDepth--;
|
|
243
|
+
if (disabledDepth === 0) {
|
|
244
|
+
var props = {
|
|
245
|
+
configurable: true,
|
|
246
|
+
enumerable: true,
|
|
247
|
+
writable: true
|
|
248
|
+
};
|
|
249
|
+
Object.defineProperties(console, {
|
|
250
|
+
log: assign({}, props, {
|
|
251
|
+
value: prevLog
|
|
252
|
+
}),
|
|
253
|
+
info: assign({}, props, {
|
|
254
|
+
value: prevInfo
|
|
255
|
+
}),
|
|
256
|
+
warn: assign({}, props, {
|
|
257
|
+
value: prevWarn
|
|
258
|
+
}),
|
|
259
|
+
error: assign({}, props, {
|
|
260
|
+
value: prevError
|
|
261
|
+
}),
|
|
262
|
+
group: assign({}, props, {
|
|
263
|
+
value: prevGroup
|
|
264
|
+
}),
|
|
265
|
+
groupCollapsed: assign({}, props, {
|
|
266
|
+
value: prevGroupCollapsed
|
|
267
|
+
}),
|
|
268
|
+
groupEnd: assign({}, props, {
|
|
269
|
+
value: prevGroupEnd
|
|
270
|
+
})
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
if (disabledDepth < 0) {
|
|
274
|
+
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
279
|
+
var prefix;
|
|
280
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
281
|
+
{
|
|
282
|
+
if (prefix === void 0) {
|
|
283
|
+
try {
|
|
284
|
+
throw Error();
|
|
285
|
+
} catch (x) {
|
|
286
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
287
|
+
prefix = match && match[1] || "";
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return "\n" + prefix + name;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
var reentry = false;
|
|
294
|
+
var componentFrameCache;
|
|
295
|
+
{
|
|
296
|
+
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
297
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
298
|
+
}
|
|
299
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
300
|
+
if (!fn || reentry) {
|
|
301
|
+
return "";
|
|
302
|
+
}
|
|
303
|
+
{
|
|
304
|
+
var frame = componentFrameCache.get(fn);
|
|
305
|
+
if (frame !== void 0) {
|
|
306
|
+
return frame;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
var control;
|
|
310
|
+
reentry = true;
|
|
311
|
+
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
312
|
+
Error.prepareStackTrace = void 0;
|
|
313
|
+
var previousDispatcher;
|
|
314
|
+
{
|
|
315
|
+
previousDispatcher = ReactCurrentDispatcher.current;
|
|
316
|
+
ReactCurrentDispatcher.current = null;
|
|
317
|
+
disableLogs();
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
if (construct) {
|
|
321
|
+
var Fake = function() {
|
|
322
|
+
throw Error();
|
|
323
|
+
};
|
|
324
|
+
Object.defineProperty(Fake.prototype, "props", {
|
|
325
|
+
set: function() {
|
|
326
|
+
throw Error();
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
if (typeof Reflect === "object" && Reflect.construct) {
|
|
330
|
+
try {
|
|
331
|
+
Reflect.construct(Fake, []);
|
|
332
|
+
} catch (x) {
|
|
333
|
+
control = x;
|
|
334
|
+
}
|
|
335
|
+
Reflect.construct(fn, [], Fake);
|
|
336
|
+
} else {
|
|
337
|
+
try {
|
|
338
|
+
Fake.call();
|
|
339
|
+
} catch (x) {
|
|
340
|
+
control = x;
|
|
341
|
+
}
|
|
342
|
+
fn.call(Fake.prototype);
|
|
343
|
+
}
|
|
344
|
+
} else {
|
|
345
|
+
try {
|
|
346
|
+
throw Error();
|
|
347
|
+
} catch (x) {
|
|
348
|
+
control = x;
|
|
349
|
+
}
|
|
350
|
+
fn();
|
|
351
|
+
}
|
|
352
|
+
} catch (sample) {
|
|
353
|
+
if (sample && control && typeof sample.stack === "string") {
|
|
354
|
+
var sampleLines = sample.stack.split("\n");
|
|
355
|
+
var controlLines = control.stack.split("\n");
|
|
356
|
+
var s = sampleLines.length - 1;
|
|
357
|
+
var c = controlLines.length - 1;
|
|
358
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
359
|
+
c--;
|
|
360
|
+
}
|
|
361
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
362
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
363
|
+
if (s !== 1 || c !== 1) {
|
|
364
|
+
do {
|
|
365
|
+
s--;
|
|
366
|
+
c--;
|
|
367
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
368
|
+
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
369
|
+
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
370
|
+
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
371
|
+
}
|
|
372
|
+
{
|
|
373
|
+
if (typeof fn === "function") {
|
|
374
|
+
componentFrameCache.set(fn, _frame);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return _frame;
|
|
378
|
+
}
|
|
379
|
+
} while (s >= 1 && c >= 0);
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
} finally {
|
|
386
|
+
reentry = false;
|
|
387
|
+
{
|
|
388
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
|
389
|
+
reenableLogs();
|
|
390
|
+
}
|
|
391
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
392
|
+
}
|
|
393
|
+
var name = fn ? fn.displayName || fn.name : "";
|
|
394
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
395
|
+
{
|
|
396
|
+
if (typeof fn === "function") {
|
|
397
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return syntheticFrame;
|
|
401
|
+
}
|
|
402
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
403
|
+
{
|
|
404
|
+
return describeNativeComponentFrame(fn, false);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function shouldConstruct(Component2) {
|
|
408
|
+
var prototype = Component2.prototype;
|
|
409
|
+
return !!(prototype && prototype.isReactComponent);
|
|
410
|
+
}
|
|
411
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
412
|
+
if (type == null) {
|
|
413
|
+
return "";
|
|
414
|
+
}
|
|
415
|
+
if (typeof type === "function") {
|
|
416
|
+
{
|
|
417
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (typeof type === "string") {
|
|
421
|
+
return describeBuiltInComponentFrame(type);
|
|
422
|
+
}
|
|
423
|
+
switch (type) {
|
|
424
|
+
case REACT_SUSPENSE_TYPE:
|
|
425
|
+
return describeBuiltInComponentFrame("Suspense");
|
|
426
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
427
|
+
return describeBuiltInComponentFrame("SuspenseList");
|
|
428
|
+
}
|
|
429
|
+
if (typeof type === "object") {
|
|
430
|
+
switch (type.$$typeof) {
|
|
431
|
+
case REACT_FORWARD_REF_TYPE:
|
|
432
|
+
return describeFunctionComponentFrame(type.render);
|
|
433
|
+
case REACT_MEMO_TYPE:
|
|
434
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
435
|
+
case REACT_LAZY_TYPE: {
|
|
436
|
+
var lazyComponent = type;
|
|
437
|
+
var payload = lazyComponent._payload;
|
|
438
|
+
var init = lazyComponent._init;
|
|
439
|
+
try {
|
|
440
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
441
|
+
} catch (x) {
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return "";
|
|
447
|
+
}
|
|
448
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
449
|
+
var loggedTypeFailures = {};
|
|
450
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
451
|
+
function setCurrentlyValidatingElement(element) {
|
|
452
|
+
{
|
|
453
|
+
if (element) {
|
|
454
|
+
var owner = element._owner;
|
|
455
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
456
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
457
|
+
} else {
|
|
458
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
463
|
+
{
|
|
464
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
465
|
+
for (var typeSpecName in typeSpecs) {
|
|
466
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
467
|
+
var error$1 = void 0;
|
|
468
|
+
try {
|
|
469
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
470
|
+
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
471
|
+
err.name = "Invariant Violation";
|
|
472
|
+
throw err;
|
|
473
|
+
}
|
|
474
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
475
|
+
} catch (ex) {
|
|
476
|
+
error$1 = ex;
|
|
477
|
+
}
|
|
478
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
479
|
+
setCurrentlyValidatingElement(element);
|
|
480
|
+
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
481
|
+
setCurrentlyValidatingElement(null);
|
|
482
|
+
}
|
|
483
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
484
|
+
loggedTypeFailures[error$1.message] = true;
|
|
485
|
+
setCurrentlyValidatingElement(element);
|
|
486
|
+
error("Failed %s type: %s", location, error$1.message);
|
|
487
|
+
setCurrentlyValidatingElement(null);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
var isArrayImpl = Array.isArray;
|
|
494
|
+
function isArray(a) {
|
|
495
|
+
return isArrayImpl(a);
|
|
496
|
+
}
|
|
497
|
+
function typeName(value) {
|
|
498
|
+
{
|
|
499
|
+
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
500
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
501
|
+
return type;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function willCoercionThrow(value) {
|
|
505
|
+
{
|
|
506
|
+
try {
|
|
507
|
+
testStringCoercion(value);
|
|
508
|
+
return false;
|
|
509
|
+
} catch (e) {
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function testStringCoercion(value) {
|
|
515
|
+
return "" + value;
|
|
516
|
+
}
|
|
517
|
+
function checkKeyStringCoercion(value) {
|
|
518
|
+
{
|
|
519
|
+
if (willCoercionThrow(value)) {
|
|
520
|
+
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
521
|
+
return testStringCoercion(value);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
526
|
+
var RESERVED_PROPS = {
|
|
527
|
+
key: true,
|
|
528
|
+
ref: true,
|
|
529
|
+
__self: true,
|
|
530
|
+
__source: true
|
|
531
|
+
};
|
|
532
|
+
var specialPropKeyWarningShown;
|
|
533
|
+
var specialPropRefWarningShown;
|
|
534
|
+
function hasValidRef(config) {
|
|
535
|
+
{
|
|
536
|
+
if (hasOwnProperty.call(config, "ref")) {
|
|
537
|
+
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
538
|
+
if (getter && getter.isReactWarning) {
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return config.ref !== void 0;
|
|
544
|
+
}
|
|
545
|
+
function hasValidKey(config) {
|
|
546
|
+
{
|
|
547
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
548
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
549
|
+
if (getter && getter.isReactWarning) {
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return config.key !== void 0;
|
|
555
|
+
}
|
|
556
|
+
function warnIfStringRefCannotBeAutoConverted(config, self2) {
|
|
557
|
+
{
|
|
558
|
+
if (typeof config.ref === "string" && ReactCurrentOwner.current && self2) ;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
562
|
+
{
|
|
563
|
+
var warnAboutAccessingKey = function() {
|
|
564
|
+
if (!specialPropKeyWarningShown) {
|
|
565
|
+
specialPropKeyWarningShown = true;
|
|
566
|
+
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://reactjs.org/link/special-props)", displayName);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
570
|
+
Object.defineProperty(props, "key", {
|
|
571
|
+
get: warnAboutAccessingKey,
|
|
572
|
+
configurable: true
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
577
|
+
{
|
|
578
|
+
var warnAboutAccessingRef = function() {
|
|
579
|
+
if (!specialPropRefWarningShown) {
|
|
580
|
+
specialPropRefWarningShown = true;
|
|
581
|
+
error("%s: `ref` 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://reactjs.org/link/special-props)", displayName);
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
585
|
+
Object.defineProperty(props, "ref", {
|
|
586
|
+
get: warnAboutAccessingRef,
|
|
587
|
+
configurable: true
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
var ReactElement = function(type, key, ref, self2, source, owner, props) {
|
|
592
|
+
var element = {
|
|
593
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
594
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
595
|
+
// Built-in properties that belong on the element
|
|
596
|
+
type,
|
|
597
|
+
key,
|
|
598
|
+
ref,
|
|
599
|
+
props,
|
|
600
|
+
// Record the component responsible for creating this element.
|
|
601
|
+
_owner: owner
|
|
602
|
+
};
|
|
603
|
+
{
|
|
604
|
+
element._store = {};
|
|
605
|
+
Object.defineProperty(element._store, "validated", {
|
|
606
|
+
configurable: false,
|
|
607
|
+
enumerable: false,
|
|
608
|
+
writable: true,
|
|
609
|
+
value: false
|
|
610
|
+
});
|
|
611
|
+
Object.defineProperty(element, "_self", {
|
|
612
|
+
configurable: false,
|
|
613
|
+
enumerable: false,
|
|
614
|
+
writable: false,
|
|
615
|
+
value: self2
|
|
616
|
+
});
|
|
617
|
+
Object.defineProperty(element, "_source", {
|
|
618
|
+
configurable: false,
|
|
619
|
+
enumerable: false,
|
|
620
|
+
writable: false,
|
|
621
|
+
value: source
|
|
622
|
+
});
|
|
623
|
+
if (Object.freeze) {
|
|
624
|
+
Object.freeze(element.props);
|
|
625
|
+
Object.freeze(element);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return element;
|
|
629
|
+
};
|
|
630
|
+
function jsxDEV(type, config, maybeKey, source, self2) {
|
|
631
|
+
{
|
|
632
|
+
var propName;
|
|
633
|
+
var props = {};
|
|
634
|
+
var key = null;
|
|
635
|
+
var ref = null;
|
|
636
|
+
if (maybeKey !== void 0) {
|
|
637
|
+
{
|
|
638
|
+
checkKeyStringCoercion(maybeKey);
|
|
639
|
+
}
|
|
640
|
+
key = "" + maybeKey;
|
|
641
|
+
}
|
|
642
|
+
if (hasValidKey(config)) {
|
|
643
|
+
{
|
|
644
|
+
checkKeyStringCoercion(config.key);
|
|
645
|
+
}
|
|
646
|
+
key = "" + config.key;
|
|
647
|
+
}
|
|
648
|
+
if (hasValidRef(config)) {
|
|
649
|
+
ref = config.ref;
|
|
650
|
+
warnIfStringRefCannotBeAutoConverted(config, self2);
|
|
651
|
+
}
|
|
652
|
+
for (propName in config) {
|
|
653
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
654
|
+
props[propName] = config[propName];
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (type && type.defaultProps) {
|
|
658
|
+
var defaultProps = type.defaultProps;
|
|
659
|
+
for (propName in defaultProps) {
|
|
660
|
+
if (props[propName] === void 0) {
|
|
661
|
+
props[propName] = defaultProps[propName];
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
if (key || ref) {
|
|
666
|
+
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
667
|
+
if (key) {
|
|
668
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
669
|
+
}
|
|
670
|
+
if (ref) {
|
|
671
|
+
defineRefPropWarningGetter(props, displayName);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
678
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
679
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
680
|
+
{
|
|
681
|
+
if (element) {
|
|
682
|
+
var owner = element._owner;
|
|
683
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
684
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
685
|
+
} else {
|
|
686
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
var propTypesMisspellWarningShown;
|
|
691
|
+
{
|
|
692
|
+
propTypesMisspellWarningShown = false;
|
|
693
|
+
}
|
|
694
|
+
function isValidElement(object) {
|
|
695
|
+
{
|
|
696
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function getDeclarationErrorAddendum() {
|
|
700
|
+
{
|
|
701
|
+
if (ReactCurrentOwner$1.current) {
|
|
702
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
703
|
+
if (name) {
|
|
704
|
+
return "\n\nCheck the render method of `" + name + "`.";
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return "";
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
function getSourceInfoErrorAddendum(source) {
|
|
711
|
+
{
|
|
712
|
+
return "";
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
var ownerHasKeyUseWarning = {};
|
|
716
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
717
|
+
{
|
|
718
|
+
var info = getDeclarationErrorAddendum();
|
|
719
|
+
if (!info) {
|
|
720
|
+
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
721
|
+
if (parentName) {
|
|
722
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return info;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
function validateExplicitKey(element, parentType) {
|
|
729
|
+
{
|
|
730
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
element._store.validated = true;
|
|
734
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
735
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
739
|
+
var childOwner = "";
|
|
740
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
741
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
742
|
+
}
|
|
743
|
+
setCurrentlyValidatingElement$1(element);
|
|
744
|
+
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
745
|
+
setCurrentlyValidatingElement$1(null);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
function validateChildKeys(node, parentType) {
|
|
749
|
+
{
|
|
750
|
+
if (typeof node !== "object") {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
if (isArray(node)) {
|
|
754
|
+
for (var i = 0; i < node.length; i++) {
|
|
755
|
+
var child = node[i];
|
|
756
|
+
if (isValidElement(child)) {
|
|
757
|
+
validateExplicitKey(child, parentType);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
} else if (isValidElement(node)) {
|
|
761
|
+
if (node._store) {
|
|
762
|
+
node._store.validated = true;
|
|
763
|
+
}
|
|
764
|
+
} else if (node) {
|
|
765
|
+
var iteratorFn = getIteratorFn(node);
|
|
766
|
+
if (typeof iteratorFn === "function") {
|
|
767
|
+
if (iteratorFn !== node.entries) {
|
|
768
|
+
var iterator = iteratorFn.call(node);
|
|
769
|
+
var step;
|
|
770
|
+
while (!(step = iterator.next()).done) {
|
|
771
|
+
if (isValidElement(step.value)) {
|
|
772
|
+
validateExplicitKey(step.value, parentType);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function validatePropTypes(element) {
|
|
781
|
+
{
|
|
782
|
+
var type = element.type;
|
|
783
|
+
if (type === null || type === void 0 || typeof type === "string") {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
var propTypes;
|
|
787
|
+
if (typeof type === "function") {
|
|
788
|
+
propTypes = type.propTypes;
|
|
789
|
+
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
790
|
+
// Inner props are checked in the reconciler.
|
|
791
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
792
|
+
propTypes = type.propTypes;
|
|
793
|
+
} else {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (propTypes) {
|
|
797
|
+
var name = getComponentNameFromType(type);
|
|
798
|
+
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
799
|
+
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
800
|
+
propTypesMisspellWarningShown = true;
|
|
801
|
+
var _name = getComponentNameFromType(type);
|
|
802
|
+
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
803
|
+
}
|
|
804
|
+
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
805
|
+
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
function validateFragmentProps(fragment) {
|
|
810
|
+
{
|
|
811
|
+
var keys2 = Object.keys(fragment.props);
|
|
812
|
+
for (var i = 0; i < keys2.length; i++) {
|
|
813
|
+
var key = keys2[i];
|
|
814
|
+
if (key !== "children" && key !== "key") {
|
|
815
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
816
|
+
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
817
|
+
setCurrentlyValidatingElement$1(null);
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if (fragment.ref !== null) {
|
|
822
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
823
|
+
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
824
|
+
setCurrentlyValidatingElement$1(null);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
var didWarnAboutKeySpread = {};
|
|
829
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self2) {
|
|
830
|
+
{
|
|
831
|
+
var validType = isValidElementType(type);
|
|
832
|
+
if (!validType) {
|
|
833
|
+
var info = "";
|
|
834
|
+
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
835
|
+
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
836
|
+
}
|
|
837
|
+
var sourceInfo = getSourceInfoErrorAddendum();
|
|
838
|
+
if (sourceInfo) {
|
|
839
|
+
info += sourceInfo;
|
|
840
|
+
} else {
|
|
841
|
+
info += getDeclarationErrorAddendum();
|
|
842
|
+
}
|
|
843
|
+
var typeString;
|
|
844
|
+
if (type === null) {
|
|
845
|
+
typeString = "null";
|
|
846
|
+
} else if (isArray(type)) {
|
|
847
|
+
typeString = "array";
|
|
848
|
+
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
849
|
+
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
850
|
+
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
851
|
+
} else {
|
|
852
|
+
typeString = typeof type;
|
|
853
|
+
}
|
|
854
|
+
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
|
855
|
+
}
|
|
856
|
+
var element = jsxDEV(type, props, key, source, self2);
|
|
857
|
+
if (element == null) {
|
|
858
|
+
return element;
|
|
859
|
+
}
|
|
860
|
+
if (validType) {
|
|
861
|
+
var children = props.children;
|
|
862
|
+
if (children !== void 0) {
|
|
863
|
+
if (isStaticChildren) {
|
|
864
|
+
if (isArray(children)) {
|
|
865
|
+
for (var i = 0; i < children.length; i++) {
|
|
866
|
+
validateChildKeys(children[i], type);
|
|
867
|
+
}
|
|
868
|
+
if (Object.freeze) {
|
|
869
|
+
Object.freeze(children);
|
|
870
|
+
}
|
|
871
|
+
} else {
|
|
872
|
+
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.");
|
|
873
|
+
}
|
|
874
|
+
} else {
|
|
875
|
+
validateChildKeys(children, type);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
{
|
|
880
|
+
if (hasOwnProperty.call(props, "key")) {
|
|
881
|
+
var componentName = getComponentNameFromType(type);
|
|
882
|
+
var keys2 = Object.keys(props).filter(function(k) {
|
|
883
|
+
return k !== "key";
|
|
884
|
+
});
|
|
885
|
+
var beforeExample = keys2.length > 0 ? "{key: someKey, " + keys2.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
886
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
887
|
+
var afterExample = keys2.length > 0 ? "{" + keys2.join(": ..., ") + ": ...}" : "{}";
|
|
888
|
+
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} />', beforeExample, componentName, afterExample, componentName);
|
|
889
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
894
|
+
validateFragmentProps(element);
|
|
895
|
+
} else {
|
|
896
|
+
validatePropTypes(element);
|
|
897
|
+
}
|
|
898
|
+
return element;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
902
|
+
{
|
|
903
|
+
return jsxWithValidation(type, props, key, true);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
907
|
+
{
|
|
908
|
+
return jsxWithValidation(type, props, key, false);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
var jsx = jsxWithValidationDynamic;
|
|
912
|
+
var jsxs = jsxWithValidationStatic;
|
|
913
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
914
|
+
reactJsxRuntime_development.jsx = jsx;
|
|
915
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
|
916
|
+
})();
|
|
917
|
+
}
|
|
918
|
+
return reactJsxRuntime_development;
|
|
919
|
+
}
|
|
920
|
+
var hasRequiredJsxRuntime;
|
|
921
|
+
function requireJsxRuntime() {
|
|
922
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
923
|
+
hasRequiredJsxRuntime = 1;
|
|
924
|
+
if (process.env.NODE_ENV === "production") {
|
|
925
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
926
|
+
} else {
|
|
927
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
928
|
+
}
|
|
929
|
+
return jsxRuntime.exports;
|
|
930
|
+
}
|
|
931
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
932
|
+
const DEFAULT_PROPS = {
|
|
933
|
+
viewportTag: "div",
|
|
934
|
+
cameraTag: "div",
|
|
935
|
+
cameraClass: "",
|
|
936
|
+
firstPanelSize: "",
|
|
937
|
+
renderOnSameKey: false,
|
|
938
|
+
plugins: [],
|
|
939
|
+
useFindDOMNode: false,
|
|
940
|
+
hideBeforeInit: false,
|
|
941
|
+
onReady: (e) => {
|
|
942
|
+
},
|
|
943
|
+
onBeforeResize: (e) => {
|
|
944
|
+
},
|
|
945
|
+
onAfterResize: (e) => {
|
|
946
|
+
},
|
|
947
|
+
onHoldStart: (e) => {
|
|
948
|
+
},
|
|
949
|
+
onHoldEnd: (e) => {
|
|
950
|
+
},
|
|
951
|
+
onMoveStart: (e) => {
|
|
952
|
+
},
|
|
953
|
+
onMove: (e) => {
|
|
954
|
+
},
|
|
955
|
+
onMoveEnd: (e) => {
|
|
956
|
+
},
|
|
957
|
+
onWillChange: (e) => {
|
|
958
|
+
},
|
|
959
|
+
onChanged: (e) => {
|
|
960
|
+
},
|
|
961
|
+
onWillRestore: (e) => {
|
|
962
|
+
},
|
|
963
|
+
onRestored: (e) => {
|
|
964
|
+
},
|
|
965
|
+
onSelect: (e) => {
|
|
966
|
+
},
|
|
967
|
+
onNeedPanel: (e) => {
|
|
968
|
+
},
|
|
969
|
+
onVisibleChange: (e) => {
|
|
970
|
+
},
|
|
971
|
+
onReachEdge: (e) => {
|
|
972
|
+
},
|
|
973
|
+
onPanelChange: (e) => {
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
class ReactElementProvider {
|
|
977
|
+
get element() {
|
|
978
|
+
return this._el?.nativeElement;
|
|
979
|
+
}
|
|
980
|
+
get rendered() {
|
|
981
|
+
return this._el?.rendered;
|
|
982
|
+
}
|
|
983
|
+
constructor(el) {
|
|
984
|
+
this._el = el;
|
|
985
|
+
}
|
|
986
|
+
show() {
|
|
987
|
+
this._el?.show();
|
|
988
|
+
}
|
|
989
|
+
hide() {
|
|
990
|
+
this._el?.hide();
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
class ReactRenderer extends VanillaFlicking.ExternalRenderer {
|
|
994
|
+
constructor(options) {
|
|
995
|
+
super(options);
|
|
996
|
+
this._reactFlicking = options.reactFlicking;
|
|
997
|
+
}
|
|
998
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
999
|
+
async render() {
|
|
1000
|
+
const flicking = VanillaFlicking.getFlickingAttached(this._flicking);
|
|
1001
|
+
const reactFlicking = this._reactFlicking;
|
|
1002
|
+
const strategy = this._strategy;
|
|
1003
|
+
if (flicking.virtualEnabled) {
|
|
1004
|
+
strategy.updateRenderingPanels(flicking);
|
|
1005
|
+
this._rendering = true;
|
|
1006
|
+
} else {
|
|
1007
|
+
this._rendering = true;
|
|
1008
|
+
strategy.updateRenderingPanels(flicking);
|
|
1009
|
+
}
|
|
1010
|
+
strategy.renderPanels(flicking);
|
|
1011
|
+
return new Promise((resolve) => {
|
|
1012
|
+
reactFlicking.renderEmitter.once("render", () => {
|
|
1013
|
+
this._rendering = false;
|
|
1014
|
+
this._afterRender();
|
|
1015
|
+
resolve();
|
|
1016
|
+
});
|
|
1017
|
+
reactFlicking.forceUpdate();
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
async forceRenderAllPanels() {
|
|
1021
|
+
const reactFlicking = this._reactFlicking;
|
|
1022
|
+
this._rendering = true;
|
|
1023
|
+
await super.forceRenderAllPanels();
|
|
1024
|
+
return new Promise((resolve) => {
|
|
1025
|
+
reactFlicking.renderEmitter.once("render", () => {
|
|
1026
|
+
this._rendering = false;
|
|
1027
|
+
resolve();
|
|
1028
|
+
});
|
|
1029
|
+
reactFlicking.forceUpdate();
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
destroy() {
|
|
1033
|
+
super.destroy();
|
|
1034
|
+
this._reactFlicking.renderEmitter.off("render");
|
|
1035
|
+
}
|
|
1036
|
+
_collectPanels() {
|
|
1037
|
+
const flicking = VanillaFlicking.getFlickingAttached(this._flicking);
|
|
1038
|
+
const reactFlicking = this._reactFlicking;
|
|
1039
|
+
const reactPanels = reactFlicking.reactPanels;
|
|
1040
|
+
this._panels = this._strategy.collectPanels(flicking, reactPanels);
|
|
1041
|
+
}
|
|
1042
|
+
_createPanel(externalComponent, options) {
|
|
1043
|
+
return this._strategy.createPanel(externalComponent, options);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
class StrictPanel extends React__namespace.Component {
|
|
1047
|
+
constructor() {
|
|
1048
|
+
super(...arguments);
|
|
1049
|
+
this._hide = false;
|
|
1050
|
+
this._elRef = React__namespace.createRef();
|
|
1051
|
+
}
|
|
1052
|
+
get nativeElement() {
|
|
1053
|
+
return this._elRef.current;
|
|
1054
|
+
}
|
|
1055
|
+
get rendered() {
|
|
1056
|
+
return !this._hide;
|
|
1057
|
+
}
|
|
1058
|
+
get elRef() {
|
|
1059
|
+
return this._elRef;
|
|
1060
|
+
}
|
|
1061
|
+
render() {
|
|
1062
|
+
return this._hide ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}) : this._getElement();
|
|
1063
|
+
}
|
|
1064
|
+
show() {
|
|
1065
|
+
this._hide = false;
|
|
1066
|
+
}
|
|
1067
|
+
hide() {
|
|
1068
|
+
this._hide = true;
|
|
1069
|
+
}
|
|
1070
|
+
_getElement() {
|
|
1071
|
+
return React__namespace.cloneElement(React__namespace.Children.only(this.props.children), {
|
|
1072
|
+
ref: this._elRef
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const ViewportSlot = React.memo((props) => /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props.children }));
|
|
1077
|
+
var __defProp = Object.defineProperty;
|
|
1078
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
1079
|
+
var result = void 0;
|
|
1080
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1081
|
+
if (decorator = decorators[i])
|
|
1082
|
+
result = decorator(target, key, result) || result;
|
|
1083
|
+
if (result) __defProp(target, key, result);
|
|
1084
|
+
return result;
|
|
1085
|
+
};
|
|
1086
|
+
const _Flicking = class _Flicking extends React__namespace.Component {
|
|
1087
|
+
constructor(props) {
|
|
1088
|
+
super(props);
|
|
1089
|
+
this._panels = [];
|
|
1090
|
+
this._renderEmitter = new Component();
|
|
1091
|
+
const children = this._getChildren();
|
|
1092
|
+
this._panels = this._createPanelRefs(props, children);
|
|
1093
|
+
this._prevChildren = children;
|
|
1094
|
+
}
|
|
1095
|
+
get reactPanels() {
|
|
1096
|
+
return this._panels.map((panel) => panel.current);
|
|
1097
|
+
}
|
|
1098
|
+
get renderEmitter() {
|
|
1099
|
+
return this._renderEmitter;
|
|
1100
|
+
}
|
|
1101
|
+
componentDidMount() {
|
|
1102
|
+
const props = this.props;
|
|
1103
|
+
const rendererOptions = {
|
|
1104
|
+
reactFlicking: this,
|
|
1105
|
+
align: props.align,
|
|
1106
|
+
strategy: props.virtual && props.panelsPerView > 0 ? new VanillaFlicking.VirtualRenderingStrategy() : new VanillaFlicking.NormalRenderingStrategy({
|
|
1107
|
+
providerCtor: ReactElementProvider
|
|
1108
|
+
})
|
|
1109
|
+
};
|
|
1110
|
+
const flicking = new VanillaFlicking(this._viewportElement, {
|
|
1111
|
+
...props,
|
|
1112
|
+
externalRenderer: new ReactRenderer(rendererOptions)
|
|
1113
|
+
});
|
|
1114
|
+
this._vanillaFlicking = flicking;
|
|
1115
|
+
const children = this._getChildren();
|
|
1116
|
+
this._jsxDiffer = new ListDiffer(children, (panel) => panel.key);
|
|
1117
|
+
this._pluginsDiffer = new ListDiffer();
|
|
1118
|
+
this._prevChildren = children;
|
|
1119
|
+
this._bindEvents();
|
|
1120
|
+
this._checkPlugins();
|
|
1121
|
+
if (props.status) {
|
|
1122
|
+
flicking.setStatus(props.status);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
componentWillUnmount() {
|
|
1126
|
+
this._vanillaFlicking?.destroy();
|
|
1127
|
+
}
|
|
1128
|
+
shouldComponentUpdate(nextProps) {
|
|
1129
|
+
const vanillaFlicking = this._vanillaFlicking;
|
|
1130
|
+
const prevProps = this.props;
|
|
1131
|
+
if (!vanillaFlicking || !vanillaFlicking.initialized) return false;
|
|
1132
|
+
const { children, ...restProps } = nextProps;
|
|
1133
|
+
for (const key in restProps) {
|
|
1134
|
+
if (prevProps[key] !== nextProps[key]) {
|
|
1135
|
+
return true;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
const prevChildren = this._prevChildren;
|
|
1139
|
+
const nextChildren = this._getChildren(children);
|
|
1140
|
+
if (nextProps.renderOnSameKey || !this._hasSameChildren(prevChildren, nextChildren)) return true;
|
|
1141
|
+
return false;
|
|
1142
|
+
}
|
|
1143
|
+
beforeRender() {
|
|
1144
|
+
const vanillaFlicking = this._vanillaFlicking;
|
|
1145
|
+
const props = this.props;
|
|
1146
|
+
const prevChildren = this._prevChildren;
|
|
1147
|
+
if (!vanillaFlicking || !vanillaFlicking.initialized || this._diffResult) return;
|
|
1148
|
+
const nextChildren = this._getChildren(props.children);
|
|
1149
|
+
if (props.renderOnSameKey || !this._hasSameChildren(prevChildren, nextChildren)) {
|
|
1150
|
+
this._panels = this._createPanelRefs(props, nextChildren);
|
|
1151
|
+
this._diffResult = this._jsxDiffer.update(nextChildren);
|
|
1152
|
+
this._prevChildren = nextChildren;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
componentDidUpdate() {
|
|
1156
|
+
const flicking = this._vanillaFlicking;
|
|
1157
|
+
const renderEmitter = this._renderEmitter;
|
|
1158
|
+
const diffResult = this._diffResult;
|
|
1159
|
+
this._checkPlugins();
|
|
1160
|
+
renderEmitter.trigger("render");
|
|
1161
|
+
flicking.camera.updateOffset();
|
|
1162
|
+
const { virtual, ...props } = this.props;
|
|
1163
|
+
for (const key in props) {
|
|
1164
|
+
if (key in flicking && flicking[key] !== props[key]) {
|
|
1165
|
+
flicking[key] = props[key];
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
if (!diffResult || !flicking.initialized) return;
|
|
1169
|
+
VanillaFlicking.sync(flicking, diffResult, this.reactPanels);
|
|
1170
|
+
this._diffResult = null;
|
|
1171
|
+
}
|
|
1172
|
+
render() {
|
|
1173
|
+
const props = this.props;
|
|
1174
|
+
const Viewport = props.viewportTag;
|
|
1175
|
+
const Camera = props.cameraTag;
|
|
1176
|
+
const attributes = {};
|
|
1177
|
+
this.beforeRender();
|
|
1178
|
+
for (const name in props) {
|
|
1179
|
+
if (!(name in DEFAULT_PROPS) && !(name in VanillaFlicking.prototype)) {
|
|
1180
|
+
attributes[name] = props[name];
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
const { viewportClasses, cameraClasses, cameraProps } = this._getClasses(attributes, props);
|
|
1184
|
+
const panels = !!props.virtual && (props.panelsPerView ?? -1) > 0 ? this._getVirtualPanels() : this._getPanels();
|
|
1185
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1186
|
+
Viewport,
|
|
1187
|
+
{
|
|
1188
|
+
...attributes,
|
|
1189
|
+
className: viewportClasses.join(" "),
|
|
1190
|
+
ref: (e) => {
|
|
1191
|
+
e && (this._viewportElement = e);
|
|
1192
|
+
},
|
|
1193
|
+
children: [
|
|
1194
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Camera, { className: cameraClasses.join(" "), ...cameraProps, children: panels }),
|
|
1195
|
+
this._getViewportSlot()
|
|
1196
|
+
]
|
|
1197
|
+
}
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
_createPanelRefs(props, children) {
|
|
1201
|
+
const panelsPerView = props.panelsPerView ?? -1;
|
|
1202
|
+
return panelsPerView > 0 && !!props.virtual ? VanillaFlicking.range(panelsPerView + 1).map(() => React__namespace.createRef()) : children.map(() => React__namespace.createRef());
|
|
1203
|
+
}
|
|
1204
|
+
_bindEvents() {
|
|
1205
|
+
const flicking = this._vanillaFlicking;
|
|
1206
|
+
Object.keys(VanillaFlicking.EVENTS).forEach((eventKey) => {
|
|
1207
|
+
const eventName = VanillaFlicking.EVENTS[eventKey];
|
|
1208
|
+
this._bindEvent(eventName);
|
|
1209
|
+
});
|
|
1210
|
+
flicking.once(VanillaFlicking.EVENTS.READY, () => {
|
|
1211
|
+
this.forceUpdate();
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
_bindEvent(eventName) {
|
|
1215
|
+
const propName = `on${eventName.charAt(0).toUpperCase() + eventName.slice(1)}`;
|
|
1216
|
+
this._vanillaFlicking.on(eventName, (e) => {
|
|
1217
|
+
e.currentTarget = this;
|
|
1218
|
+
const evtHandler = this.props[propName];
|
|
1219
|
+
evtHandler(e);
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
_checkPlugins() {
|
|
1223
|
+
const flicking = this._vanillaFlicking;
|
|
1224
|
+
const { list, added, removed, prevList } = this._pluginsDiffer.update(this.props.plugins);
|
|
1225
|
+
flicking.addPlugins(...added.map((index) => list[index]));
|
|
1226
|
+
flicking.removePlugins(...removed.map((index) => prevList[index]));
|
|
1227
|
+
}
|
|
1228
|
+
_getClasses(attributes, props) {
|
|
1229
|
+
const flicking = this._vanillaFlicking;
|
|
1230
|
+
const initialized = flicking?.initialized;
|
|
1231
|
+
const viewportClasses = ["flicking-viewport"];
|
|
1232
|
+
const cameraClasses = ["flicking-camera"];
|
|
1233
|
+
const isHorizontal = flicking ? flicking.horizontal : props.horizontal ?? true;
|
|
1234
|
+
if (!isHorizontal) {
|
|
1235
|
+
viewportClasses.push("vertical");
|
|
1236
|
+
}
|
|
1237
|
+
if (props.hideBeforeInit && !initialized) {
|
|
1238
|
+
viewportClasses.push("flicking-hidden");
|
|
1239
|
+
}
|
|
1240
|
+
if (attributes.className) {
|
|
1241
|
+
viewportClasses.push(attributes.className);
|
|
1242
|
+
}
|
|
1243
|
+
if (props.cameraClass) {
|
|
1244
|
+
cameraClasses.push(props.cameraClass);
|
|
1245
|
+
}
|
|
1246
|
+
const cameraProps = !initialized && props.firstPanelSize ? {
|
|
1247
|
+
style: {
|
|
1248
|
+
transform: VanillaFlicking.getDefaultCameraTransform(this.props.align, this.props.horizontal, this.props.firstPanelSize)
|
|
1249
|
+
}
|
|
1250
|
+
} : {};
|
|
1251
|
+
return {
|
|
1252
|
+
viewportClasses,
|
|
1253
|
+
cameraClasses,
|
|
1254
|
+
cameraProps
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
_hasSameChildren(prevChildren, nextChildren) {
|
|
1258
|
+
if (prevChildren.length !== nextChildren.length || prevChildren.length === 0) return false;
|
|
1259
|
+
const same = prevChildren.every((child, idx) => {
|
|
1260
|
+
const nextChild = nextChildren[idx];
|
|
1261
|
+
return child === nextChild;
|
|
1262
|
+
});
|
|
1263
|
+
return same;
|
|
1264
|
+
}
|
|
1265
|
+
_getChildren(children = this.props.children) {
|
|
1266
|
+
return React__namespace.Children.toArray(children).filter((child) => child.type !== ViewportSlot).reduce((all, child) => {
|
|
1267
|
+
return [...all, ...this._unpackFragment(child)];
|
|
1268
|
+
}, []);
|
|
1269
|
+
}
|
|
1270
|
+
_getViewportSlot() {
|
|
1271
|
+
return React__namespace.Children.toArray(this.props.children).filter(
|
|
1272
|
+
(child) => child.type === ViewportSlot
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
_unpackFragment(child) {
|
|
1276
|
+
return this._isFragment(child) ? React__namespace.Children.toArray(child.props.children).reduce(
|
|
1277
|
+
(allChilds, fragChild) => [
|
|
1278
|
+
...allChilds,
|
|
1279
|
+
...this._unpackFragment(fragChild)
|
|
1280
|
+
],
|
|
1281
|
+
[]
|
|
1282
|
+
) : [child];
|
|
1283
|
+
}
|
|
1284
|
+
_getVirtualPanels() {
|
|
1285
|
+
const { panelClass = "flicking-panel" } = this.props.virtual;
|
|
1286
|
+
const panelsPerView = this.props.panelsPerView;
|
|
1287
|
+
const flicking = this._vanillaFlicking;
|
|
1288
|
+
const initialized = flicking?.initialized;
|
|
1289
|
+
const renderingIndexes = initialized ? flicking.renderer.strategy.getRenderingIndexesByOrder(flicking) : VanillaFlicking.range(panelsPerView + 1);
|
|
1290
|
+
const firstPanel = flicking?.panels[0];
|
|
1291
|
+
const size = firstPanel ? flicking.horizontal ? { width: firstPanel.size } : { height: firstPanel.size } : {};
|
|
1292
|
+
return renderingIndexes.map((idx) => {
|
|
1293
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(StrictPanel, { ref: this._panels[idx], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "data-element-index": idx, className: panelClass, style: size }) }, idx);
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
_getPanels() {
|
|
1297
|
+
const origChildren = this._getChildren();
|
|
1298
|
+
const vanillaFlicking = this._vanillaFlicking;
|
|
1299
|
+
const diffResult = this._diffResult;
|
|
1300
|
+
const children = vanillaFlicking?.initialized ? diffResult ? VanillaFlicking.getRenderingPanels(vanillaFlicking, diffResult) : VanillaFlicking.getRenderingPanels(vanillaFlicking, ListDiffer.diff(origChildren, origChildren)) : origChildren;
|
|
1301
|
+
return children.map((child, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(StrictPanel, { ref: this._panels[idx], children: child }, child.key));
|
|
1302
|
+
}
|
|
1303
|
+
_isFragment(child) {
|
|
1304
|
+
if (child.type) {
|
|
1305
|
+
return child.type === React__namespace.Fragment;
|
|
1306
|
+
}
|
|
1307
|
+
return child === React__namespace.Fragment;
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
_Flicking.defaultProps = DEFAULT_PROPS;
|
|
1311
|
+
let Flicking = _Flicking;
|
|
1312
|
+
__decorateClass([
|
|
1313
|
+
VanillaFlicking.withFlickingMethods
|
|
1314
|
+
], Flicking.prototype, "_vanillaFlicking");
|
|
1315
|
+
function keys(obj) {
|
|
1316
|
+
return Object.keys(obj);
|
|
1317
|
+
}
|
|
1318
|
+
function camelize(str) {
|
|
1319
|
+
return str.replace(/[\s-_]([a-z])/g, function(all, letter) {
|
|
1320
|
+
return letter.toUpperCase();
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
function isFunction(val) {
|
|
1324
|
+
return typeof val === "function";
|
|
1325
|
+
}
|
|
1326
|
+
var OBSERVERS_PATH = "__observers__";
|
|
1327
|
+
var COMPUTED_PATH = "__computed__";
|
|
1328
|
+
function __spreadArray(to, from, pack) {
|
|
1329
|
+
if (arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1330
|
+
if (ar || !(i in from)) {
|
|
1331
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1332
|
+
ar[i] = from[i];
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1336
|
+
}
|
|
1337
|
+
function withReactiveMethods(ref, methods) {
|
|
1338
|
+
var obj = {};
|
|
1339
|
+
if (!methods) {
|
|
1340
|
+
return obj;
|
|
1341
|
+
}
|
|
1342
|
+
methods.forEach(function(name) {
|
|
1343
|
+
obj[name] = function() {
|
|
1344
|
+
var args = [];
|
|
1345
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1346
|
+
args[_i] = arguments[_i];
|
|
1347
|
+
}
|
|
1348
|
+
var current = ref.current || ref.value;
|
|
1349
|
+
return current[name].apply(current, args);
|
|
1350
|
+
};
|
|
1351
|
+
});
|
|
1352
|
+
return obj;
|
|
1353
|
+
}
|
|
1354
|
+
function defineObservers(instance) {
|
|
1355
|
+
var observers = {};
|
|
1356
|
+
Object.defineProperty(instance, OBSERVERS_PATH, {
|
|
1357
|
+
get: function() {
|
|
1358
|
+
return observers;
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
return observers;
|
|
1362
|
+
}
|
|
1363
|
+
function getObservers(instance, isComputed) {
|
|
1364
|
+
var _a, _b;
|
|
1365
|
+
if (!instance[OBSERVERS_PATH]) {
|
|
1366
|
+
defineObservers(instance);
|
|
1367
|
+
}
|
|
1368
|
+
var observers = instance[OBSERVERS_PATH];
|
|
1369
|
+
{
|
|
1370
|
+
var computedList = (_b = (_a = instance === null || instance === void 0 ? void 0 : instance.constructor) === null || _a === void 0 ? void 0 : _a.prototype) === null || _b === void 0 ? void 0 : _b[COMPUTED_PATH];
|
|
1371
|
+
if (computedList) {
|
|
1372
|
+
computedList.forEach(function(name) {
|
|
1373
|
+
if (!(name in observers) && name in instance) {
|
|
1374
|
+
instance[name];
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
return observers;
|
|
1380
|
+
}
|
|
1381
|
+
function adaptReactive(adapter, props) {
|
|
1382
|
+
var objectAdapter = isFunction(adapter) ? {
|
|
1383
|
+
setup: adapter
|
|
1384
|
+
} : adapter;
|
|
1385
|
+
function getProps() {
|
|
1386
|
+
var _a, _b, _c, _d, _e;
|
|
1387
|
+
return (_e = (_c = (_a = props === null || props === void 0 ? void 0 : props()) !== null && _a !== void 0 ? _a : (_b = objectAdapter.props) === null || _b === void 0 ? void 0 : _b.call(objectAdapter)) !== null && _c !== void 0 ? _c : (_d = objectAdapter.data) === null || _d === void 0 ? void 0 : _d.call(objectAdapter)) !== null && _e !== void 0 ? _e : {};
|
|
1388
|
+
}
|
|
1389
|
+
var eventEmitter = new Component();
|
|
1390
|
+
var mountedHooks = [];
|
|
1391
|
+
var initHooks = [];
|
|
1392
|
+
var destroyHooks = [];
|
|
1393
|
+
var onHooks = [];
|
|
1394
|
+
var instanceRef = {
|
|
1395
|
+
current: null
|
|
1396
|
+
};
|
|
1397
|
+
var offHooksList = [];
|
|
1398
|
+
var initialState = null;
|
|
1399
|
+
var eventNames = [];
|
|
1400
|
+
var methodNames = [];
|
|
1401
|
+
var onMounted = function(callback) {
|
|
1402
|
+
mountedHooks.push(callback);
|
|
1403
|
+
};
|
|
1404
|
+
var onInit = function(callback) {
|
|
1405
|
+
initHooks.push(callback);
|
|
1406
|
+
};
|
|
1407
|
+
var onDestroy = function(callback) {
|
|
1408
|
+
destroyHooks.push(callback);
|
|
1409
|
+
};
|
|
1410
|
+
var on = function(callback) {
|
|
1411
|
+
onHooks.push(callback);
|
|
1412
|
+
};
|
|
1413
|
+
var emit = function(eventName) {
|
|
1414
|
+
var params = [];
|
|
1415
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1416
|
+
params[_i - 1] = arguments[_i];
|
|
1417
|
+
}
|
|
1418
|
+
eventEmitter.trigger.apply(eventEmitter, __spreadArray([eventName], params, false));
|
|
1419
|
+
};
|
|
1420
|
+
var setInitialState = function(state) {
|
|
1421
|
+
initialState = state;
|
|
1422
|
+
};
|
|
1423
|
+
var setEvents = function(events) {
|
|
1424
|
+
eventNames = events;
|
|
1425
|
+
};
|
|
1426
|
+
var setMethods = function(methods) {
|
|
1427
|
+
methodNames = methods;
|
|
1428
|
+
};
|
|
1429
|
+
if (objectAdapter.setup) {
|
|
1430
|
+
instanceRef.current = objectAdapter.setup({
|
|
1431
|
+
getProps,
|
|
1432
|
+
setInitialState,
|
|
1433
|
+
setEvents,
|
|
1434
|
+
setMethods,
|
|
1435
|
+
onMounted,
|
|
1436
|
+
onDestroy,
|
|
1437
|
+
onInit,
|
|
1438
|
+
emit,
|
|
1439
|
+
on
|
|
1440
|
+
}) || null;
|
|
1441
|
+
}
|
|
1442
|
+
if (objectAdapter.created) {
|
|
1443
|
+
instanceRef.current = objectAdapter.created(getProps()) || null;
|
|
1444
|
+
}
|
|
1445
|
+
if (objectAdapter.events) {
|
|
1446
|
+
setEvents(objectAdapter.events);
|
|
1447
|
+
}
|
|
1448
|
+
if (objectAdapter.state) {
|
|
1449
|
+
setInitialState(objectAdapter.state);
|
|
1450
|
+
}
|
|
1451
|
+
if (objectAdapter.methods) {
|
|
1452
|
+
setMethods(objectAdapter.methods);
|
|
1453
|
+
}
|
|
1454
|
+
if (objectAdapter.mounted) {
|
|
1455
|
+
onMounted(objectAdapter.mounted);
|
|
1456
|
+
}
|
|
1457
|
+
if (objectAdapter.destroy) {
|
|
1458
|
+
destroyHooks.push(objectAdapter.destroy);
|
|
1459
|
+
}
|
|
1460
|
+
if (objectAdapter.init) {
|
|
1461
|
+
initHooks.push(objectAdapter.init);
|
|
1462
|
+
}
|
|
1463
|
+
if (objectAdapter.on) {
|
|
1464
|
+
onHooks.push(function(instance, eventName, listener) {
|
|
1465
|
+
var off = objectAdapter.on(instance, eventName, listener);
|
|
1466
|
+
return function() {
|
|
1467
|
+
var _a;
|
|
1468
|
+
off && off();
|
|
1469
|
+
(_a = objectAdapter.off) === null || _a === void 0 ? void 0 : _a.call(objectAdapter, instance, eventName, listener);
|
|
1470
|
+
};
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
return {
|
|
1474
|
+
events: function() {
|
|
1475
|
+
return eventNames;
|
|
1476
|
+
},
|
|
1477
|
+
state: function() {
|
|
1478
|
+
var inst = instanceRef.current;
|
|
1479
|
+
if (initialState) {
|
|
1480
|
+
return initialState;
|
|
1481
|
+
}
|
|
1482
|
+
if (inst) {
|
|
1483
|
+
var observers_1 = getObservers(inst);
|
|
1484
|
+
setInitialState(keys(observers_1).reduce(function(prev, cur) {
|
|
1485
|
+
prev[cur] = observers_1[cur].current;
|
|
1486
|
+
return prev;
|
|
1487
|
+
}, {}));
|
|
1488
|
+
}
|
|
1489
|
+
return initialState || {};
|
|
1490
|
+
},
|
|
1491
|
+
instance: function() {
|
|
1492
|
+
return instanceRef.current;
|
|
1493
|
+
},
|
|
1494
|
+
mounted: function() {
|
|
1495
|
+
var props2 = getProps();
|
|
1496
|
+
mountedHooks.forEach(function(hook) {
|
|
1497
|
+
instanceRef.current = hook(props2, instanceRef.current) || instanceRef.current;
|
|
1498
|
+
});
|
|
1499
|
+
},
|
|
1500
|
+
init: function() {
|
|
1501
|
+
var instance = instanceRef.current;
|
|
1502
|
+
var props2 = getProps();
|
|
1503
|
+
offHooksList = eventNames.map(function(eventName) {
|
|
1504
|
+
var listener = function() {
|
|
1505
|
+
var _a;
|
|
1506
|
+
var params = [];
|
|
1507
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1508
|
+
params[_i] = arguments[_i];
|
|
1509
|
+
}
|
|
1510
|
+
(_a = eventEmitter).trigger.apply(_a, __spreadArray([eventName], params, false));
|
|
1511
|
+
};
|
|
1512
|
+
var instance2 = instanceRef.current;
|
|
1513
|
+
return onHooks.map(function(hook) {
|
|
1514
|
+
return hook(instance2, eventName, listener);
|
|
1515
|
+
}).filter(Boolean);
|
|
1516
|
+
});
|
|
1517
|
+
initHooks.forEach(function(hook) {
|
|
1518
|
+
hook(instance, props2);
|
|
1519
|
+
});
|
|
1520
|
+
},
|
|
1521
|
+
destroy: function() {
|
|
1522
|
+
offHooksList.forEach(function(offHooks) {
|
|
1523
|
+
offHooks.forEach(function(hook) {
|
|
1524
|
+
hook();
|
|
1525
|
+
});
|
|
1526
|
+
});
|
|
1527
|
+
eventEmitter.off();
|
|
1528
|
+
var instance = instanceRef.current;
|
|
1529
|
+
var props2 = getProps();
|
|
1530
|
+
destroyHooks.forEach(function(hook) {
|
|
1531
|
+
hook(instance, props2);
|
|
1532
|
+
});
|
|
1533
|
+
},
|
|
1534
|
+
methods: function() {
|
|
1535
|
+
return withReactiveMethods(instanceRef, methodNames);
|
|
1536
|
+
},
|
|
1537
|
+
on: function(eventName, listener) {
|
|
1538
|
+
eventEmitter.on(eventName, listener);
|
|
1539
|
+
},
|
|
1540
|
+
off: function(eventName, listener) {
|
|
1541
|
+
eventEmitter.off(eventName, listener);
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
function useReactive(reactiveAdapter, props) {
|
|
1546
|
+
var readRef = React.useRef(true);
|
|
1547
|
+
var adaptResult = React.useMemo(function() {
|
|
1548
|
+
return adaptReactive(reactiveAdapter, props);
|
|
1549
|
+
}, []);
|
|
1550
|
+
var reactiveState = adaptResult.state();
|
|
1551
|
+
var names = keys(reactiveState);
|
|
1552
|
+
var states = React.useState({})[0];
|
|
1553
|
+
var _loop_1 = function(name2) {
|
|
1554
|
+
var state = React.useState(function() {
|
|
1555
|
+
return reactiveState[name2];
|
|
1556
|
+
});
|
|
1557
|
+
states[name2] = {
|
|
1558
|
+
getter: false,
|
|
1559
|
+
set: state[1],
|
|
1560
|
+
value: state[0]
|
|
1561
|
+
};
|
|
1562
|
+
};
|
|
1563
|
+
for (var name in reactiveState) {
|
|
1564
|
+
_loop_1(name);
|
|
1565
|
+
}
|
|
1566
|
+
readRef.current = true;
|
|
1567
|
+
var methods = React.useMemo(function() {
|
|
1568
|
+
return adaptResult.methods();
|
|
1569
|
+
}, []);
|
|
1570
|
+
React.useEffect(function() {
|
|
1571
|
+
readRef.current = false;
|
|
1572
|
+
});
|
|
1573
|
+
React.useEffect(function() {
|
|
1574
|
+
adaptResult.mounted();
|
|
1575
|
+
var inst = adaptResult.instance();
|
|
1576
|
+
names.forEach(function(name2) {
|
|
1577
|
+
inst.subscribe(name2, function(value) {
|
|
1578
|
+
states[name2].value = value;
|
|
1579
|
+
if (states[name2].getter) {
|
|
1580
|
+
states[name2].set(value);
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
});
|
|
1584
|
+
adaptResult.init();
|
|
1585
|
+
return function() {
|
|
1586
|
+
adaptResult.destroy();
|
|
1587
|
+
};
|
|
1588
|
+
}, []);
|
|
1589
|
+
var result = names.reduce(function(result2, name2) {
|
|
1590
|
+
if (!methods[name2]) {
|
|
1591
|
+
Object.defineProperty(result2, name2, {
|
|
1592
|
+
enumerable: true,
|
|
1593
|
+
get: function() {
|
|
1594
|
+
if (readRef.current) {
|
|
1595
|
+
states[name2].getter = true;
|
|
1596
|
+
}
|
|
1597
|
+
return states[name2].value;
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
return result2;
|
|
1602
|
+
}, {});
|
|
1603
|
+
var reactiveEvents = adaptResult.events();
|
|
1604
|
+
reactiveEvents.forEach(function(name2) {
|
|
1605
|
+
result[camelize("on ".concat(name2))] = function(callback, dependencies) {
|
|
1606
|
+
var listener = React.useMemo(function() {
|
|
1607
|
+
adaptResult.on(name2, callback);
|
|
1608
|
+
return callback;
|
|
1609
|
+
}, dependencies);
|
|
1610
|
+
React.useEffect(function() {
|
|
1611
|
+
adaptResult.off(name2, listener);
|
|
1612
|
+
adaptResult.on(name2, listener);
|
|
1613
|
+
return function() {
|
|
1614
|
+
adaptResult.off(name2, listener);
|
|
1615
|
+
};
|
|
1616
|
+
}, [listener]);
|
|
1617
|
+
};
|
|
1618
|
+
});
|
|
1619
|
+
keys(methods).forEach(function(name2) {
|
|
1620
|
+
result[name2] = methods[name2];
|
|
1621
|
+
});
|
|
1622
|
+
return result;
|
|
1623
|
+
}
|
|
1624
|
+
const useFlickingReactiveAPI = (flickingRef, options) => {
|
|
1625
|
+
return useReactive(VanillaFlicking.flickingReactiveAPIAdapter, () => ({
|
|
1626
|
+
flicking: flickingRef.current ?? void 0,
|
|
1627
|
+
options
|
|
1628
|
+
}));
|
|
1629
|
+
};
|
|
1630
|
+
Flicking.ViewportSlot = ViewportSlot;
|
|
1631
|
+
Flicking.useFlickingReactiveAPI = useFlickingReactiveAPI;
|
|
1632
|
+
return Flicking;
|
|
1633
|
+
}));
|
|
1634
|
+
//# sourceMappingURL=flicking.js.map
|