@ppg_pl/pallete 0.0.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/cjs/{index-160fcb6c.js → index-53e78fc8.js} +3 -1
- package/dist/cjs/index-53e78fc8.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/my-backdrop_8.cjs.entry.js +527 -261
- package/dist/cjs/my-backdrop_8.cjs.entry.js.map +1 -1
- package/dist/cjs/pallete.cjs.js +2 -2
- package/dist/collection/components/api/index.js +4 -2
- package/dist/collection/components/api/index.js.map +1 -1
- package/dist/collection/components/api/services.js +31 -64
- package/dist/collection/components/api/services.js.map +1 -1
- package/dist/collection/components/my-colorinfo/my-colorinfo.js +6 -4
- package/dist/collection/components/my-colorinfo/my-colorinfo.js.map +1 -1
- package/dist/collection/components/my-loader/my-loader.css +1 -1
- package/dist/collection/components/my-modal/my-modal.js +65 -47
- package/dist/collection/components/my-modal/my-modal.js.map +1 -1
- package/dist/collection/components/my-search/my-search.js +28 -2
- package/dist/collection/components/my-search/my-search.js.map +1 -1
- package/dist/collection/components/my-slider/index.js +5 -8
- package/dist/collection/components/my-slider/index.js.map +1 -1
- package/dist/collection/types.js.map +1 -1
- package/dist/components/index2.js +25 -3
- package/dist/components/index2.js.map +1 -1
- package/dist/components/my-colorinfo2.js +4 -3
- package/dist/components/my-colorinfo2.js.map +1 -1
- package/dist/components/my-loader2.js +1 -1
- package/dist/components/my-loader2.js.map +1 -1
- package/dist/components/my-modal2.js +482 -256
- package/dist/components/my-modal2.js.map +1 -1
- package/dist/components/my-search2.js +20 -3
- package/dist/components/my-search2.js.map +1 -1
- package/dist/esm/{index-943c259f.js → index-b0145abf.js} +3 -1
- package/dist/esm/index-b0145abf.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/my-backdrop_8.entry.js +527 -261
- package/dist/esm/my-backdrop_8.entry.js.map +1 -1
- package/dist/esm/pallete.js +3 -3
- package/dist/pallete/p-037cfde2.entry.js +2 -0
- package/dist/pallete/p-037cfde2.entry.js.map +1 -0
- package/dist/pallete/{p-c77aaa54.js → p-c6a049a2.js} +2 -2
- package/dist/pallete/p-c6a049a2.js.map +1 -0
- package/dist/pallete/pallete.esm.js +1 -1
- package/dist/pallete/pallete.esm.js.map +1 -1
- package/dist/types/components/api/index.d.ts +2 -1
- package/dist/types/components/api/services.d.ts +3 -3
- package/dist/types/components/my-modal/my-modal.d.ts +1 -0
- package/dist/types/components/my-search/my-search.d.ts +2 -0
- package/dist/types/components/my-slider/index.d.ts +2 -2
- package/dist/types/components.d.ts +5 -4
- package/dist/types/types.d.ts +35 -24
- package/package.json +5 -5
- package/www/build/p-037cfde2.entry.js +2 -0
- package/www/build/p-037cfde2.entry.js.map +1 -0
- package/www/build/{p-c77aaa54.js → p-c6a049a2.js} +2 -2
- package/www/build/p-c6a049a2.js.map +1 -0
- package/www/build/pallete.esm.js +1 -1
- package/www/build/pallete.esm.js.map +1 -1
- package/www/index.html +1 -1
- package/dist/cjs/index-160fcb6c.js.map +0 -1
- package/dist/esm/index-943c259f.js.map +0 -1
- package/dist/pallete/p-9a7eff4f.entry.js +0 -2
- package/dist/pallete/p-9a7eff4f.entry.js.map +0 -1
- package/dist/pallete/p-c77aaa54.js.map +0 -1
- package/www/build/p-825a7d1d.js +0 -163
- package/www/build/p-9a7eff4f.entry.js +0 -2
- package/www/build/p-9a7eff4f.entry.js.map +0 -1
- package/www/build/p-c77aaa54.js.map +0 -1
- package/www/build/p-fd390eef.css +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, c as createEvent, g as getAssetPath, a as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, h, c as createEvent, g as getAssetPath, a as getElement } from './index-b0145abf.js';
|
|
2
2
|
|
|
3
3
|
const myBackdropCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}my-backdrop{width:100%;height:100%;background-color:rgba(0, 0, 0, 0.7);position:fixed;z-index:100;left:0;top:0}";
|
|
4
4
|
|
|
@@ -58,6 +58,28 @@ const MyColorBox = class {
|
|
|
58
58
|
};
|
|
59
59
|
MyColorBox.style = myColorboxCss;
|
|
60
60
|
|
|
61
|
+
const APIURL = 'http://147.135.211.144:8055'; //'https://pallete-colors-backend.herokuapp.com';
|
|
62
|
+
const accessToken = 'uBKzhiNM4rkdZSe_PQvKJp9pE-DSTmtu';
|
|
63
|
+
class API {
|
|
64
|
+
async getData(ep) {
|
|
65
|
+
try {
|
|
66
|
+
const request = await fetch(`${APIURL}/${ep}`, {
|
|
67
|
+
method: 'GET',
|
|
68
|
+
headers: {
|
|
69
|
+
'Authorization': `Bearer ${accessToken}`,
|
|
70
|
+
'Content-Type': 'application/json',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const response = await request.json();
|
|
74
|
+
return response;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error(error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const ApiService = new API();
|
|
82
|
+
|
|
61
83
|
const MyColorInfo = class {
|
|
62
84
|
constructor(hostRef) {
|
|
63
85
|
registerInstance(this, hostRef);
|
|
@@ -84,13 +106,14 @@ const MyColorInfo = class {
|
|
|
84
106
|
this.closeImage = 'close.png';
|
|
85
107
|
}
|
|
86
108
|
render() {
|
|
87
|
-
var _a, _b, _c, _d, _e, _f
|
|
109
|
+
var _a, _b, _c, _d, _e, _f;
|
|
110
|
+
console.log('current', this.currentColor);
|
|
88
111
|
return (h("div", { class: `boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`, style: {
|
|
89
112
|
background: this.currentColor.hex,
|
|
90
113
|
maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,
|
|
91
114
|
} }, this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("div", { class: "boxes__box-content__info", style: {
|
|
92
115
|
maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,
|
|
93
|
-
} }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), !this.isMobile && h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "boxes__box-content__info__value-image" }, ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.image
|
|
116
|
+
} }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), !this.isMobile && h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "boxes__box-content__info__value-image" }, ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.image) && h("img", { src: `${APIURL}/assets/${this.currentColor.image}?access_token=${accessToken}`, alt: "color-image" })), h("div", { class: "boxes__box-content__info__value-product" }, h("div", null, !this.isMobile && h("p", null, "Produkt:"), this.isMobile && h("h2", null, (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.name), " ", h("p", null, this.product)), this.isMobile && h("div", { class: 'divider' }), this.currentColor && ((_c = this.currentColor.links) === null || _c === void 0 ? void 0 : _c.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) && (h("a", { onClick: this.goToProduct, class: `${this.currentColor.buttonInverse ? 'inverse' : ''}`, target: "_blank", href: (_e = (_d = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _d === void 0 ? void 0 : _d.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _e === void 0 ? void 0 : _e.path }, "przejd\u017A do produktu"))))), h("div", { class: "boxes__box-content__slider" }, h("my-slider", { color: this.currentColor.name, shop: this.shop, product: this.product, slides: (_f = this.data) === null || _f === void 0 ? void 0 : _f.images }), ' ')));
|
|
94
117
|
}
|
|
95
118
|
};
|
|
96
119
|
|
|
@@ -254,7 +277,7 @@ const MyModalBundle = class {
|
|
|
254
277
|
};
|
|
255
278
|
MyModalBundle.style = myComponentCss;
|
|
256
279
|
|
|
257
|
-
const myLoaderCss = ".container.sc-my-loader{display:flex;justify-content:center;align-items:center;height:
|
|
280
|
+
const myLoaderCss = ".container.sc-my-loader{display:flex;justify-content:center;align-items:center;height:190px;overflow:hidden}.item.sc-my-loader{width:20px;height:20px;margin:3px;list-style-type:none;transition:0.5s all ease}.item.sc-my-loader:nth-child(1){animation:right-1 1s infinite alternate;background-color:#b8cf40;animation-delay:20ms}@keyframes right-1{0%{transform:translateY(-18px)}100%{transform:translateY(18px)}}.item.sc-my-loader:nth-child(2){animation:right-2 1s infinite alternate;background-color:#ee4b5e;animation-delay:40ms}@keyframes right-2{0%{transform:translateY(-21px)}100%{transform:translateY(21px)}}.item.sc-my-loader:nth-child(3){animation:right-3 1s infinite alternate;background-color:#ea0f47;animation-delay:60ms}@keyframes right-3{0%{transform:translateY(-24px)}100%{transform:translateY(24px)}}.item.sc-my-loader:nth-child(4){animation:right-4 1s infinite alternate;background-color:#d42840;animation-delay:80ms}@keyframes right-4{0%{transform:translateY(-27px)}100%{transform:translateY(27px)}}.item.sc-my-loader:nth-child(5){animation:right-5 1s infinite alternate;background-color:#8b2850;animation-delay:100ms}@keyframes right-5{0%{transform:translateY(-30px)}100%{transform:translateY(30px)}}";
|
|
258
281
|
|
|
259
282
|
const MyLoader = class {
|
|
260
283
|
constructor(hostRef) {
|
|
@@ -266,25 +289,26 @@ const MyLoader = class {
|
|
|
266
289
|
};
|
|
267
290
|
MyLoader.style = myLoaderCss;
|
|
268
291
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
292
|
+
/** @type {import('.')} */
|
|
293
|
+
var esErrors = Error;
|
|
294
|
+
|
|
295
|
+
/** @type {import('./eval')} */
|
|
296
|
+
var _eval = EvalError;
|
|
297
|
+
|
|
298
|
+
/** @type {import('./range')} */
|
|
299
|
+
var range = RangeError;
|
|
300
|
+
|
|
301
|
+
/** @type {import('./ref')} */
|
|
302
|
+
var ref = ReferenceError;
|
|
303
|
+
|
|
304
|
+
/** @type {import('./syntax')} */
|
|
305
|
+
var syntax = SyntaxError;
|
|
306
|
+
|
|
307
|
+
/** @type {import('./type')} */
|
|
308
|
+
var type = TypeError;
|
|
309
|
+
|
|
310
|
+
/** @type {import('./uri')} */
|
|
311
|
+
var uri = URIError;
|
|
288
312
|
|
|
289
313
|
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
290
314
|
var shams = function hasSymbols() {
|
|
@@ -339,46 +363,92 @@ var hasSymbols$1 = function hasNativeSymbols() {
|
|
|
339
363
|
return shams();
|
|
340
364
|
};
|
|
341
365
|
|
|
366
|
+
var test = {
|
|
367
|
+
__proto__: null,
|
|
368
|
+
foo: {}
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
var $Object = Object;
|
|
372
|
+
|
|
373
|
+
/** @type {import('.')} */
|
|
374
|
+
var hasProto$1 = function hasProto() {
|
|
375
|
+
// @ts-expect-error: TS errors on an inherited property for some reason
|
|
376
|
+
return { __proto__: test }.foo === test.foo
|
|
377
|
+
&& !(test instanceof $Object);
|
|
378
|
+
};
|
|
379
|
+
|
|
342
380
|
/* eslint no-invalid-this: 1 */
|
|
343
381
|
|
|
344
382
|
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
345
|
-
var slice = Array.prototype.slice;
|
|
346
383
|
var toStr$1 = Object.prototype.toString;
|
|
384
|
+
var max = Math.max;
|
|
347
385
|
var funcType = '[object Function]';
|
|
348
386
|
|
|
387
|
+
var concatty = function concatty(a, b) {
|
|
388
|
+
var arr = [];
|
|
389
|
+
|
|
390
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
391
|
+
arr[i] = a[i];
|
|
392
|
+
}
|
|
393
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
394
|
+
arr[j + a.length] = b[j];
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return arr;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
var slicy = function slicy(arrLike, offset) {
|
|
401
|
+
var arr = [];
|
|
402
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
403
|
+
arr[j] = arrLike[i];
|
|
404
|
+
}
|
|
405
|
+
return arr;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
var joiny = function (arr, joiner) {
|
|
409
|
+
var str = '';
|
|
410
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
411
|
+
str += arr[i];
|
|
412
|
+
if (i + 1 < arr.length) {
|
|
413
|
+
str += joiner;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return str;
|
|
417
|
+
};
|
|
418
|
+
|
|
349
419
|
var implementation = function bind(that) {
|
|
350
420
|
var target = this;
|
|
351
|
-
if (typeof target !== 'function' || toStr$1.
|
|
421
|
+
if (typeof target !== 'function' || toStr$1.apply(target) !== funcType) {
|
|
352
422
|
throw new TypeError(ERROR_MESSAGE + target);
|
|
353
423
|
}
|
|
354
|
-
var args =
|
|
424
|
+
var args = slicy(arguments, 1);
|
|
355
425
|
|
|
356
426
|
var bound;
|
|
357
427
|
var binder = function () {
|
|
358
428
|
if (this instanceof bound) {
|
|
359
429
|
var result = target.apply(
|
|
360
430
|
this,
|
|
361
|
-
args
|
|
431
|
+
concatty(args, arguments)
|
|
362
432
|
);
|
|
363
433
|
if (Object(result) === result) {
|
|
364
434
|
return result;
|
|
365
435
|
}
|
|
366
436
|
return this;
|
|
367
|
-
} else {
|
|
368
|
-
return target.apply(
|
|
369
|
-
that,
|
|
370
|
-
args.concat(slice.call(arguments))
|
|
371
|
-
);
|
|
372
437
|
}
|
|
438
|
+
return target.apply(
|
|
439
|
+
that,
|
|
440
|
+
concatty(args, arguments)
|
|
441
|
+
);
|
|
442
|
+
|
|
373
443
|
};
|
|
374
444
|
|
|
375
|
-
var boundLength =
|
|
445
|
+
var boundLength = max(0, target.length - args.length);
|
|
376
446
|
var boundArgs = [];
|
|
377
447
|
for (var i = 0; i < boundLength; i++) {
|
|
378
|
-
boundArgs
|
|
448
|
+
boundArgs[i] = '$' + i;
|
|
379
449
|
}
|
|
380
450
|
|
|
381
|
-
bound = Function('binder', 'return function (' + boundArgs
|
|
451
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
382
452
|
|
|
383
453
|
if (target.prototype) {
|
|
384
454
|
var Empty = function Empty() {};
|
|
@@ -392,13 +462,24 @@ var implementation = function bind(that) {
|
|
|
392
462
|
|
|
393
463
|
var functionBind = Function.prototype.bind || implementation;
|
|
394
464
|
|
|
395
|
-
var
|
|
465
|
+
var call = Function.prototype.call;
|
|
466
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
/** @type {import('.')} */
|
|
470
|
+
var hasown = functionBind.call(call, $hasOwn);
|
|
396
471
|
|
|
397
472
|
var undefined$1;
|
|
398
473
|
|
|
399
|
-
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
400
482
|
var $Function = Function;
|
|
401
|
-
var $TypeError$1 = TypeError;
|
|
402
483
|
|
|
403
484
|
// eslint-disable-next-line consistent-return
|
|
404
485
|
var getEvalledConstructor = function (expressionSyntax) {
|
|
@@ -407,19 +488,19 @@ var getEvalledConstructor = function (expressionSyntax) {
|
|
|
407
488
|
} catch (e) {}
|
|
408
489
|
};
|
|
409
490
|
|
|
410
|
-
var $gOPD = Object.getOwnPropertyDescriptor;
|
|
491
|
+
var $gOPD$1 = Object.getOwnPropertyDescriptor;
|
|
411
492
|
|
|
412
493
|
var throwTypeError = function () {
|
|
413
|
-
throw new
|
|
494
|
+
throw new type();
|
|
414
495
|
};
|
|
415
|
-
var ThrowTypeError = $gOPD
|
|
496
|
+
var ThrowTypeError = $gOPD$1
|
|
416
497
|
? (function () {
|
|
417
498
|
try {
|
|
418
499
|
return throwTypeError;
|
|
419
500
|
} catch (calleeThrows) {
|
|
420
501
|
try {
|
|
421
502
|
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
422
|
-
return $gOPD(arguments, 'callee').get;
|
|
503
|
+
return $gOPD$1(arguments, 'callee').get;
|
|
423
504
|
} catch (gOPDthrows) {
|
|
424
505
|
return throwTypeError;
|
|
425
506
|
}
|
|
@@ -428,18 +509,24 @@ var ThrowTypeError = $gOPD
|
|
|
428
509
|
: throwTypeError;
|
|
429
510
|
|
|
430
511
|
var hasSymbols = hasSymbols$1();
|
|
512
|
+
var hasProto = hasProto$1();
|
|
431
513
|
|
|
432
|
-
var getProto = Object.getPrototypeOf ||
|
|
514
|
+
var getProto = Object.getPrototypeOf || (
|
|
515
|
+
hasProto
|
|
516
|
+
? function (x) { return x.__proto__; } // eslint-disable-line no-proto
|
|
517
|
+
: null
|
|
518
|
+
);
|
|
433
519
|
|
|
434
520
|
var needsEval = {};
|
|
435
521
|
|
|
436
|
-
var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
|
|
522
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
437
523
|
|
|
438
524
|
var INTRINSICS = {
|
|
525
|
+
__proto__: null,
|
|
439
526
|
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
440
527
|
'%Array%': Array,
|
|
441
528
|
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
442
|
-
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
529
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
443
530
|
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
444
531
|
'%AsyncFunction%': needsEval,
|
|
445
532
|
'%AsyncGenerator%': needsEval,
|
|
@@ -456,9 +543,9 @@ var INTRINSICS = {
|
|
|
456
543
|
'%decodeURIComponent%': decodeURIComponent,
|
|
457
544
|
'%encodeURI%': encodeURI,
|
|
458
545
|
'%encodeURIComponent%': encodeURIComponent,
|
|
459
|
-
'%Error%':
|
|
546
|
+
'%Error%': esErrors,
|
|
460
547
|
'%eval%': eval, // eslint-disable-line no-eval
|
|
461
|
-
'%EvalError%':
|
|
548
|
+
'%EvalError%': _eval,
|
|
462
549
|
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
463
550
|
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
464
551
|
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
|
@@ -469,10 +556,10 @@ var INTRINSICS = {
|
|
|
469
556
|
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
470
557
|
'%isFinite%': isFinite,
|
|
471
558
|
'%isNaN%': isNaN,
|
|
472
|
-
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
559
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
473
560
|
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
474
561
|
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
475
|
-
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
562
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
476
563
|
'%Math%': Math,
|
|
477
564
|
'%Number%': Number,
|
|
478
565
|
'%Object%': Object,
|
|
@@ -480,25 +567,25 @@ var INTRINSICS = {
|
|
|
480
567
|
'%parseInt%': parseInt,
|
|
481
568
|
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
|
482
569
|
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
|
483
|
-
'%RangeError%':
|
|
484
|
-
'%ReferenceError%':
|
|
570
|
+
'%RangeError%': range,
|
|
571
|
+
'%ReferenceError%': ref,
|
|
485
572
|
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
486
573
|
'%RegExp%': RegExp,
|
|
487
574
|
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
488
|
-
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
575
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
489
576
|
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
490
577
|
'%String%': String,
|
|
491
|
-
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
578
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
492
579
|
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
|
493
|
-
'%SyntaxError%':
|
|
580
|
+
'%SyntaxError%': syntax,
|
|
494
581
|
'%ThrowTypeError%': ThrowTypeError,
|
|
495
582
|
'%TypedArray%': TypedArray,
|
|
496
|
-
'%TypeError%':
|
|
583
|
+
'%TypeError%': type,
|
|
497
584
|
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
|
498
585
|
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
|
499
586
|
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
|
500
587
|
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
|
501
|
-
'%URIError%':
|
|
588
|
+
'%URIError%': uri,
|
|
502
589
|
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
|
503
590
|
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
|
|
504
591
|
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
|
@@ -519,7 +606,7 @@ var doEval = function doEval(name) {
|
|
|
519
606
|
}
|
|
520
607
|
} else if (name === '%AsyncIteratorPrototype%') {
|
|
521
608
|
var gen = doEval('%AsyncGenerator%');
|
|
522
|
-
if (gen) {
|
|
609
|
+
if (gen && getProto) {
|
|
523
610
|
value = getProto(gen.prototype);
|
|
524
611
|
}
|
|
525
612
|
}
|
|
@@ -530,6 +617,7 @@ var doEval = function doEval(name) {
|
|
|
530
617
|
};
|
|
531
618
|
|
|
532
619
|
var LEGACY_ALIASES = {
|
|
620
|
+
__proto__: null,
|
|
533
621
|
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
534
622
|
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
535
623
|
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
@@ -598,9 +686,9 @@ var stringToPath = function stringToPath(string) {
|
|
|
598
686
|
var first = $strSlice(string, 0, 1);
|
|
599
687
|
var last = $strSlice(string, -1);
|
|
600
688
|
if (first === '%' && last !== '%') {
|
|
601
|
-
throw new
|
|
689
|
+
throw new syntax('invalid intrinsic syntax, expected closing `%`');
|
|
602
690
|
} else if (last === '%' && first !== '%') {
|
|
603
|
-
throw new
|
|
691
|
+
throw new syntax('invalid intrinsic syntax, expected opening `%`');
|
|
604
692
|
}
|
|
605
693
|
var result = [];
|
|
606
694
|
$replace$1(string, rePropName, function (match, number, quote, subString) {
|
|
@@ -613,18 +701,18 @@ var stringToPath = function stringToPath(string) {
|
|
|
613
701
|
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
614
702
|
var intrinsicName = name;
|
|
615
703
|
var alias;
|
|
616
|
-
if (
|
|
704
|
+
if (hasown(LEGACY_ALIASES, intrinsicName)) {
|
|
617
705
|
alias = LEGACY_ALIASES[intrinsicName];
|
|
618
706
|
intrinsicName = '%' + alias[0] + '%';
|
|
619
707
|
}
|
|
620
708
|
|
|
621
|
-
if (
|
|
709
|
+
if (hasown(INTRINSICS, intrinsicName)) {
|
|
622
710
|
var value = INTRINSICS[intrinsicName];
|
|
623
711
|
if (value === needsEval) {
|
|
624
712
|
value = doEval(intrinsicName);
|
|
625
713
|
}
|
|
626
714
|
if (typeof value === 'undefined' && !allowMissing) {
|
|
627
|
-
throw new
|
|
715
|
+
throw new type('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
628
716
|
}
|
|
629
717
|
|
|
630
718
|
return {
|
|
@@ -634,19 +722,19 @@ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
|
634
722
|
};
|
|
635
723
|
}
|
|
636
724
|
|
|
637
|
-
throw new
|
|
725
|
+
throw new syntax('intrinsic ' + name + ' does not exist!');
|
|
638
726
|
};
|
|
639
727
|
|
|
640
728
|
var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
641
729
|
if (typeof name !== 'string' || name.length === 0) {
|
|
642
|
-
throw new
|
|
730
|
+
throw new type('intrinsic name must be a non-empty string');
|
|
643
731
|
}
|
|
644
732
|
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
645
|
-
throw new
|
|
733
|
+
throw new type('"allowMissing" argument must be a boolean');
|
|
646
734
|
}
|
|
647
735
|
|
|
648
736
|
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
649
|
-
throw new
|
|
737
|
+
throw new syntax('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
|
650
738
|
}
|
|
651
739
|
var parts = stringToPath(name);
|
|
652
740
|
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
@@ -673,7 +761,7 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
673
761
|
)
|
|
674
762
|
&& first !== last
|
|
675
763
|
) {
|
|
676
|
-
throw new
|
|
764
|
+
throw new syntax('property names with quotes must have matching quotes');
|
|
677
765
|
}
|
|
678
766
|
if (part === 'constructor' || !isOwn) {
|
|
679
767
|
skipFurtherCaching = true;
|
|
@@ -682,17 +770,17 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
682
770
|
intrinsicBaseName += '.' + part;
|
|
683
771
|
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
684
772
|
|
|
685
|
-
if (
|
|
773
|
+
if (hasown(INTRINSICS, intrinsicRealName)) {
|
|
686
774
|
value = INTRINSICS[intrinsicRealName];
|
|
687
775
|
} else if (value != null) {
|
|
688
776
|
if (!(part in value)) {
|
|
689
777
|
if (!allowMissing) {
|
|
690
|
-
throw new
|
|
778
|
+
throw new type('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
691
779
|
}
|
|
692
780
|
return void undefined$1;
|
|
693
781
|
}
|
|
694
|
-
if ($gOPD && (i + 1) >= parts.length) {
|
|
695
|
-
var desc = $gOPD(value, part);
|
|
782
|
+
if ($gOPD$1 && (i + 1) >= parts.length) {
|
|
783
|
+
var desc = $gOPD$1(value, part);
|
|
696
784
|
isOwn = !!desc;
|
|
697
785
|
|
|
698
786
|
// By convention, when a data property is converted to an accessor
|
|
@@ -708,7 +796,7 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
708
796
|
value = value[part];
|
|
709
797
|
}
|
|
710
798
|
} else {
|
|
711
|
-
isOwn =
|
|
799
|
+
isOwn = hasown(value, part);
|
|
712
800
|
value = value[part];
|
|
713
801
|
}
|
|
714
802
|
|
|
@@ -720,6 +808,8 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
720
808
|
return value;
|
|
721
809
|
};
|
|
722
810
|
|
|
811
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
812
|
+
|
|
723
813
|
function createCommonjsModule(fn, basedir, module) {
|
|
724
814
|
return module = {
|
|
725
815
|
path: basedir,
|
|
@@ -749,50 +839,170 @@ function commonjsRequire () {
|
|
|
749
839
|
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
750
840
|
}
|
|
751
841
|
|
|
842
|
+
/** @type {import('.')} */
|
|
843
|
+
var $defineProperty = getIntrinsic('%Object.defineProperty%', true) || false;
|
|
844
|
+
if ($defineProperty) {
|
|
845
|
+
try {
|
|
846
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
847
|
+
} catch (e) {
|
|
848
|
+
// IE 8 has a broken defineProperty
|
|
849
|
+
$defineProperty = false;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
var esDefineProperty = $defineProperty;
|
|
854
|
+
|
|
855
|
+
var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
856
|
+
|
|
857
|
+
if ($gOPD) {
|
|
858
|
+
try {
|
|
859
|
+
$gOPD([], 'length');
|
|
860
|
+
} catch (e) {
|
|
861
|
+
// IE 8 has a broken gOPD
|
|
862
|
+
$gOPD = null;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
var gopd = $gOPD;
|
|
867
|
+
|
|
868
|
+
/** @type {import('.')} */
|
|
869
|
+
var defineDataProperty = function defineDataProperty(
|
|
870
|
+
obj,
|
|
871
|
+
property,
|
|
872
|
+
value
|
|
873
|
+
) {
|
|
874
|
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
875
|
+
throw new type('`obj` must be an object or a function`');
|
|
876
|
+
}
|
|
877
|
+
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
|
878
|
+
throw new type('`property` must be a string or a symbol`');
|
|
879
|
+
}
|
|
880
|
+
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
|
881
|
+
throw new type('`nonEnumerable`, if provided, must be a boolean or null');
|
|
882
|
+
}
|
|
883
|
+
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
|
884
|
+
throw new type('`nonWritable`, if provided, must be a boolean or null');
|
|
885
|
+
}
|
|
886
|
+
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
|
887
|
+
throw new type('`nonConfigurable`, if provided, must be a boolean or null');
|
|
888
|
+
}
|
|
889
|
+
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
|
890
|
+
throw new type('`loose`, if provided, must be a boolean');
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
|
894
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
|
895
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
|
896
|
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
|
897
|
+
|
|
898
|
+
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
|
899
|
+
var desc = !!gopd && gopd(obj, property);
|
|
900
|
+
|
|
901
|
+
if (esDefineProperty) {
|
|
902
|
+
esDefineProperty(obj, property, {
|
|
903
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
|
904
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
|
905
|
+
value: value,
|
|
906
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
|
907
|
+
});
|
|
908
|
+
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
|
909
|
+
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
|
910
|
+
obj[property] = value; // eslint-disable-line no-param-reassign
|
|
911
|
+
} else {
|
|
912
|
+
throw new syntax('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
var hasPropertyDescriptors = function hasPropertyDescriptors() {
|
|
917
|
+
return !!esDefineProperty;
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
|
921
|
+
// node v0.6 has a bug where array lengths can be Set but not Defined
|
|
922
|
+
if (!esDefineProperty) {
|
|
923
|
+
return null;
|
|
924
|
+
}
|
|
925
|
+
try {
|
|
926
|
+
return esDefineProperty([], 'length', { value: 1 }).length !== 1;
|
|
927
|
+
} catch (e) {
|
|
928
|
+
// In Firefox 4-22, defining length on an array throws an exception.
|
|
929
|
+
return true;
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
var hasPropertyDescriptors_1 = hasPropertyDescriptors;
|
|
934
|
+
|
|
935
|
+
var hasDescriptors = hasPropertyDescriptors_1();
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
var $floor$1 = getIntrinsic('%Math.floor%');
|
|
940
|
+
|
|
941
|
+
/** @type {import('.')} */
|
|
942
|
+
var setFunctionLength = function setFunctionLength(fn, length) {
|
|
943
|
+
if (typeof fn !== 'function') {
|
|
944
|
+
throw new type('`fn` is not a function');
|
|
945
|
+
}
|
|
946
|
+
if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor$1(length) !== length) {
|
|
947
|
+
throw new type('`length` must be a positive 32-bit integer');
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
var loose = arguments.length > 2 && !!arguments[2];
|
|
951
|
+
|
|
952
|
+
var functionLengthIsConfigurable = true;
|
|
953
|
+
var functionLengthIsWritable = true;
|
|
954
|
+
if ('length' in fn && gopd) {
|
|
955
|
+
var desc = gopd(fn, 'length');
|
|
956
|
+
if (desc && !desc.configurable) {
|
|
957
|
+
functionLengthIsConfigurable = false;
|
|
958
|
+
}
|
|
959
|
+
if (desc && !desc.writable) {
|
|
960
|
+
functionLengthIsWritable = false;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
|
|
965
|
+
if (hasDescriptors) {
|
|
966
|
+
defineDataProperty(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
|
|
967
|
+
} else {
|
|
968
|
+
defineDataProperty(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return fn;
|
|
972
|
+
};
|
|
973
|
+
|
|
752
974
|
var callBind = createCommonjsModule(function (module) {
|
|
753
975
|
|
|
754
976
|
|
|
755
977
|
|
|
756
978
|
|
|
979
|
+
|
|
980
|
+
|
|
757
981
|
var $apply = getIntrinsic('%Function.prototype.apply%');
|
|
758
982
|
var $call = getIntrinsic('%Function.prototype.call%');
|
|
759
983
|
var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
|
|
760
984
|
|
|
761
|
-
var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
762
|
-
var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
|
|
763
|
-
var $max = getIntrinsic('%Math.max%');
|
|
764
985
|
|
|
765
|
-
|
|
766
|
-
try {
|
|
767
|
-
$defineProperty({}, 'a', { value: 1 });
|
|
768
|
-
} catch (e) {
|
|
769
|
-
// IE 8 has a broken defineProperty
|
|
770
|
-
$defineProperty = null;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
986
|
+
var $max = getIntrinsic('%Math.max%');
|
|
773
987
|
|
|
774
988
|
module.exports = function callBind(originalFunction) {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
var desc = $gOPD(func, 'length');
|
|
778
|
-
if (desc.configurable) {
|
|
779
|
-
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
780
|
-
$defineProperty(
|
|
781
|
-
func,
|
|
782
|
-
'length',
|
|
783
|
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
784
|
-
);
|
|
785
|
-
}
|
|
989
|
+
if (typeof originalFunction !== 'function') {
|
|
990
|
+
throw new type('a function is required');
|
|
786
991
|
}
|
|
787
|
-
|
|
992
|
+
var func = $reflectApply(functionBind, $call, arguments);
|
|
993
|
+
return setFunctionLength(
|
|
994
|
+
func,
|
|
995
|
+
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
|
996
|
+
true
|
|
997
|
+
);
|
|
788
998
|
};
|
|
789
999
|
|
|
790
1000
|
var applyBind = function applyBind() {
|
|
791
1001
|
return $reflectApply(functionBind, $apply, arguments);
|
|
792
1002
|
};
|
|
793
1003
|
|
|
794
|
-
if (
|
|
795
|
-
|
|
1004
|
+
if (esDefineProperty) {
|
|
1005
|
+
esDefineProperty(module.exports, 'apply', { value: applyBind });
|
|
796
1006
|
} else {
|
|
797
1007
|
module.exports.apply = applyBind;
|
|
798
1008
|
}
|
|
@@ -1058,6 +1268,14 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
|
1058
1268
|
if (isString(obj)) {
|
|
1059
1269
|
return markBoxed(inspect(String(obj)));
|
|
1060
1270
|
}
|
|
1271
|
+
// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
|
|
1272
|
+
/* eslint-env browser */
|
|
1273
|
+
if (typeof window !== 'undefined' && obj === window) {
|
|
1274
|
+
return '{ [object Window] }';
|
|
1275
|
+
}
|
|
1276
|
+
if (obj === commonjsGlobal) {
|
|
1277
|
+
return '{ [object globalThis] }';
|
|
1278
|
+
}
|
|
1061
1279
|
if (!isDate(obj) && !isRegExp$1(obj)) {
|
|
1062
1280
|
var ys = arrObjKeys(obj, inspect);
|
|
1063
1281
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
@@ -1334,7 +1552,6 @@ function arrObjKeys(obj, inspect) {
|
|
|
1334
1552
|
return xs;
|
|
1335
1553
|
}
|
|
1336
1554
|
|
|
1337
|
-
var $TypeError = getIntrinsic('%TypeError%');
|
|
1338
1555
|
var $WeakMap = getIntrinsic('%WeakMap%', true);
|
|
1339
1556
|
var $Map = getIntrinsic('%Map%', true);
|
|
1340
1557
|
|
|
@@ -1346,53 +1563,62 @@ var $mapSet = callBound('Map.prototype.set', true);
|
|
|
1346
1563
|
var $mapHas = callBound('Map.prototype.has', true);
|
|
1347
1564
|
|
|
1348
1565
|
/*
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
* used nodes can be accessed relatively quickly.
|
|
1355
|
-
*/
|
|
1566
|
+
* This function traverses the list returning the node corresponding to the given key.
|
|
1567
|
+
*
|
|
1568
|
+
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly.
|
|
1569
|
+
*/
|
|
1570
|
+
/** @type {import('.').listGetNode} */
|
|
1356
1571
|
var listGetNode = function (list, key) { // eslint-disable-line consistent-return
|
|
1357
|
-
|
|
1572
|
+
/** @type {typeof list | NonNullable<(typeof list)['next']>} */
|
|
1573
|
+
var prev = list;
|
|
1574
|
+
/** @type {(typeof list)['next']} */
|
|
1575
|
+
var curr;
|
|
1576
|
+
for (; (curr = prev.next) !== null; prev = curr) {
|
|
1358
1577
|
if (curr.key === key) {
|
|
1359
1578
|
prev.next = curr.next;
|
|
1360
|
-
|
|
1579
|
+
// eslint-disable-next-line no-extra-parens
|
|
1580
|
+
curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
|
|
1361
1581
|
list.next = curr; // eslint-disable-line no-param-reassign
|
|
1362
1582
|
return curr;
|
|
1363
1583
|
}
|
|
1364
1584
|
}
|
|
1365
1585
|
};
|
|
1366
1586
|
|
|
1587
|
+
/** @type {import('.').listGet} */
|
|
1367
1588
|
var listGet = function (objects, key) {
|
|
1368
1589
|
var node = listGetNode(objects, key);
|
|
1369
1590
|
return node && node.value;
|
|
1370
1591
|
};
|
|
1592
|
+
/** @type {import('.').listSet} */
|
|
1371
1593
|
var listSet = function (objects, key, value) {
|
|
1372
1594
|
var node = listGetNode(objects, key);
|
|
1373
1595
|
if (node) {
|
|
1374
1596
|
node.value = value;
|
|
1375
1597
|
} else {
|
|
1376
1598
|
// Prepend the new node to the beginning of the list
|
|
1377
|
-
objects.next = { // eslint-disable-line no-param-reassign
|
|
1599
|
+
objects.next = /** @type {import('.').ListNode<typeof value>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
|
|
1378
1600
|
key: key,
|
|
1379
1601
|
next: objects.next,
|
|
1380
1602
|
value: value
|
|
1381
|
-
};
|
|
1603
|
+
});
|
|
1382
1604
|
}
|
|
1383
1605
|
};
|
|
1606
|
+
/** @type {import('.').listHas} */
|
|
1384
1607
|
var listHas = function (objects, key) {
|
|
1385
1608
|
return !!listGetNode(objects, key);
|
|
1386
1609
|
};
|
|
1387
1610
|
|
|
1611
|
+
/** @type {import('.')} */
|
|
1388
1612
|
var sideChannel = function getSideChannel() {
|
|
1389
|
-
var $wm;
|
|
1390
|
-
var $m;
|
|
1391
|
-
var $o;
|
|
1613
|
+
/** @type {WeakMap<object, unknown>} */ var $wm;
|
|
1614
|
+
/** @type {Map<object, unknown>} */ var $m;
|
|
1615
|
+
/** @type {import('.').RootNode<unknown>} */ var $o;
|
|
1616
|
+
|
|
1617
|
+
/** @type {import('.').Channel} */
|
|
1392
1618
|
var channel = {
|
|
1393
1619
|
assert: function (key) {
|
|
1394
1620
|
if (!channel.has(key)) {
|
|
1395
|
-
throw new
|
|
1621
|
+
throw new type('Side channel does not contain ' + objectInspect(key));
|
|
1396
1622
|
}
|
|
1397
1623
|
},
|
|
1398
1624
|
get: function (key) { // eslint-disable-line consistent-return
|
|
@@ -1439,11 +1665,7 @@ var sideChannel = function getSideChannel() {
|
|
|
1439
1665
|
$mapSet($m, key, value);
|
|
1440
1666
|
} else {
|
|
1441
1667
|
if (!$o) {
|
|
1442
|
-
|
|
1443
|
-
* Initialize the linked list as an empty node, so that we don't have
|
|
1444
|
-
* to special-case handling of the first node: we can always refer to
|
|
1445
|
-
* it as (previous node).next, instead of something like (list).head
|
|
1446
|
-
*/
|
|
1668
|
+
// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
|
|
1447
1669
|
$o = { key: {}, next: null };
|
|
1448
1670
|
}
|
|
1449
1671
|
listSet($o, key, value);
|
|
@@ -1751,10 +1973,13 @@ var defaultFormat = formats['default'];
|
|
|
1751
1973
|
var defaults$2 = {
|
|
1752
1974
|
addQueryPrefix: false,
|
|
1753
1975
|
allowDots: false,
|
|
1976
|
+
allowEmptyArrays: false,
|
|
1977
|
+
arrayFormat: 'indices',
|
|
1754
1978
|
charset: 'utf-8',
|
|
1755
1979
|
charsetSentinel: false,
|
|
1756
1980
|
delimiter: '&',
|
|
1757
1981
|
encode: true,
|
|
1982
|
+
encodeDotInKeys: false,
|
|
1758
1983
|
encoder: utils.encode,
|
|
1759
1984
|
encodeValuesOnly: false,
|
|
1760
1985
|
format: defaultFormat,
|
|
@@ -1783,8 +2008,10 @@ var stringify = function stringify(
|
|
|
1783
2008
|
prefix,
|
|
1784
2009
|
generateArrayPrefix,
|
|
1785
2010
|
commaRoundTrip,
|
|
2011
|
+
allowEmptyArrays,
|
|
1786
2012
|
strictNullHandling,
|
|
1787
2013
|
skipNulls,
|
|
2014
|
+
encodeDotInKeys,
|
|
1788
2015
|
encoder,
|
|
1789
2016
|
filter,
|
|
1790
2017
|
sort,
|
|
@@ -1866,7 +2093,13 @@ var stringify = function stringify(
|
|
|
1866
2093
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
1867
2094
|
}
|
|
1868
2095
|
|
|
1869
|
-
var
|
|
2096
|
+
var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, '%2E') : prefix;
|
|
2097
|
+
|
|
2098
|
+
var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
|
|
2099
|
+
|
|
2100
|
+
if (allowEmptyArrays && isArray$1(obj) && obj.length === 0) {
|
|
2101
|
+
return adjustedPrefix + '[]';
|
|
2102
|
+
}
|
|
1870
2103
|
|
|
1871
2104
|
for (var j = 0; j < objKeys.length; ++j) {
|
|
1872
2105
|
var key = objKeys[j];
|
|
@@ -1876,9 +2109,10 @@ var stringify = function stringify(
|
|
|
1876
2109
|
continue;
|
|
1877
2110
|
}
|
|
1878
2111
|
|
|
2112
|
+
var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key;
|
|
1879
2113
|
var keyPrefix = isArray$1(obj)
|
|
1880
|
-
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix,
|
|
1881
|
-
: adjustedPrefix + (allowDots ? '.' +
|
|
2114
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix
|
|
2115
|
+
: adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');
|
|
1882
2116
|
|
|
1883
2117
|
sideChannel$1.set(object, step);
|
|
1884
2118
|
var valueSideChannel = sideChannel();
|
|
@@ -1888,8 +2122,10 @@ var stringify = function stringify(
|
|
|
1888
2122
|
keyPrefix,
|
|
1889
2123
|
generateArrayPrefix,
|
|
1890
2124
|
commaRoundTrip,
|
|
2125
|
+
allowEmptyArrays,
|
|
1891
2126
|
strictNullHandling,
|
|
1892
2127
|
skipNulls,
|
|
2128
|
+
encodeDotInKeys,
|
|
1893
2129
|
generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$1(obj) ? null : encoder,
|
|
1894
2130
|
filter,
|
|
1895
2131
|
sort,
|
|
@@ -1911,6 +2147,14 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
|
1911
2147
|
return defaults$2;
|
|
1912
2148
|
}
|
|
1913
2149
|
|
|
2150
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
2151
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {
|
|
2155
|
+
throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
2156
|
+
}
|
|
2157
|
+
|
|
1914
2158
|
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
1915
2159
|
throw new TypeError('Encoder has to be a function.');
|
|
1916
2160
|
}
|
|
@@ -1934,13 +2178,32 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
|
1934
2178
|
filter = opts.filter;
|
|
1935
2179
|
}
|
|
1936
2180
|
|
|
2181
|
+
var arrayFormat;
|
|
2182
|
+
if (opts.arrayFormat in arrayPrefixGenerators) {
|
|
2183
|
+
arrayFormat = opts.arrayFormat;
|
|
2184
|
+
} else if ('indices' in opts) {
|
|
2185
|
+
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
2186
|
+
} else {
|
|
2187
|
+
arrayFormat = defaults$2.arrayFormat;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
2191
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults$2.allowDots : !!opts.allowDots;
|
|
2195
|
+
|
|
1937
2196
|
return {
|
|
1938
2197
|
addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$2.addQueryPrefix,
|
|
1939
|
-
allowDots:
|
|
2198
|
+
allowDots: allowDots,
|
|
2199
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults$2.allowEmptyArrays,
|
|
2200
|
+
arrayFormat: arrayFormat,
|
|
1940
2201
|
charset: charset,
|
|
1941
2202
|
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$2.charsetSentinel,
|
|
2203
|
+
commaRoundTrip: opts.commaRoundTrip,
|
|
1942
2204
|
delimiter: typeof opts.delimiter === 'undefined' ? defaults$2.delimiter : opts.delimiter,
|
|
1943
2205
|
encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$2.encode,
|
|
2206
|
+
encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults$2.encodeDotInKeys,
|
|
1944
2207
|
encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$2.encoder,
|
|
1945
2208
|
encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$2.encodeValuesOnly,
|
|
1946
2209
|
filter: filter,
|
|
@@ -1974,20 +2237,8 @@ var stringify_1 = function (object, opts) {
|
|
|
1974
2237
|
return '';
|
|
1975
2238
|
}
|
|
1976
2239
|
|
|
1977
|
-
var arrayFormat;
|
|
1978
|
-
|
|
1979
|
-
arrayFormat = opts.arrayFormat;
|
|
1980
|
-
} else if (opts && 'indices' in opts) {
|
|
1981
|
-
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
1982
|
-
} else {
|
|
1983
|
-
arrayFormat = 'indices';
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
|
1987
|
-
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
1988
|
-
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
1989
|
-
}
|
|
1990
|
-
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
|
2240
|
+
var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
|
|
2241
|
+
var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;
|
|
1991
2242
|
|
|
1992
2243
|
if (!objKeys) {
|
|
1993
2244
|
objKeys = Object.keys(obj);
|
|
@@ -2009,8 +2260,10 @@ var stringify_1 = function (object, opts) {
|
|
|
2009
2260
|
key,
|
|
2010
2261
|
generateArrayPrefix,
|
|
2011
2262
|
commaRoundTrip,
|
|
2263
|
+
options.allowEmptyArrays,
|
|
2012
2264
|
options.strictNullHandling,
|
|
2013
2265
|
options.skipNulls,
|
|
2266
|
+
options.encodeDotInKeys,
|
|
2014
2267
|
options.encode ? options.encoder : null,
|
|
2015
2268
|
options.filter,
|
|
2016
2269
|
options.sort,
|
|
@@ -2045,15 +2298,18 @@ var isArray = Array.isArray;
|
|
|
2045
2298
|
|
|
2046
2299
|
var defaults$1 = {
|
|
2047
2300
|
allowDots: false,
|
|
2301
|
+
allowEmptyArrays: false,
|
|
2048
2302
|
allowPrototypes: false,
|
|
2049
2303
|
allowSparse: false,
|
|
2050
2304
|
arrayLimit: 20,
|
|
2051
2305
|
charset: 'utf-8',
|
|
2052
2306
|
charsetSentinel: false,
|
|
2053
2307
|
comma: false,
|
|
2308
|
+
decodeDotInKeys: true,
|
|
2054
2309
|
decoder: utils.decode,
|
|
2055
2310
|
delimiter: '&',
|
|
2056
2311
|
depth: 5,
|
|
2312
|
+
duplicates: 'combine',
|
|
2057
2313
|
ignoreQueryPrefix: false,
|
|
2058
2314
|
interpretNumericEntities: false,
|
|
2059
2315
|
parameterLimit: 1000,
|
|
@@ -2087,7 +2343,8 @@ var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')
|
|
|
2087
2343
|
var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
|
2088
2344
|
|
|
2089
2345
|
var parseValues = function parseQueryStringValues(str, options) {
|
|
2090
|
-
var obj = {};
|
|
2346
|
+
var obj = { __proto__: null };
|
|
2347
|
+
|
|
2091
2348
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
2092
2349
|
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
2093
2350
|
var parts = cleanStr.split(options.delimiter, limit);
|
|
@@ -2140,9 +2397,10 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
2140
2397
|
val = isArray(val) ? [val] : val;
|
|
2141
2398
|
}
|
|
2142
2399
|
|
|
2143
|
-
|
|
2400
|
+
var existing = has.call(obj, key);
|
|
2401
|
+
if (existing && options.duplicates === 'combine') {
|
|
2144
2402
|
obj[key] = utils.combine(obj[key], val);
|
|
2145
|
-
} else {
|
|
2403
|
+
} else if (!existing || options.duplicates === 'last') {
|
|
2146
2404
|
obj[key] = val;
|
|
2147
2405
|
}
|
|
2148
2406
|
}
|
|
@@ -2158,24 +2416,25 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
2158
2416
|
var root = chain[i];
|
|
2159
2417
|
|
|
2160
2418
|
if (root === '[]' && options.parseArrays) {
|
|
2161
|
-
obj = [].concat(leaf);
|
|
2419
|
+
obj = options.allowEmptyArrays && leaf === '' ? [] : [].concat(leaf);
|
|
2162
2420
|
} else {
|
|
2163
2421
|
obj = options.plainObjects ? Object.create(null) : {};
|
|
2164
2422
|
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
2165
|
-
var
|
|
2166
|
-
|
|
2423
|
+
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
|
|
2424
|
+
var index = parseInt(decodedRoot, 10);
|
|
2425
|
+
if (!options.parseArrays && decodedRoot === '') {
|
|
2167
2426
|
obj = { 0: leaf };
|
|
2168
2427
|
} else if (
|
|
2169
2428
|
!isNaN(index)
|
|
2170
|
-
&& root !==
|
|
2171
|
-
&& String(index) ===
|
|
2429
|
+
&& root !== decodedRoot
|
|
2430
|
+
&& String(index) === decodedRoot
|
|
2172
2431
|
&& index >= 0
|
|
2173
2432
|
&& (options.parseArrays && index <= options.arrayLimit)
|
|
2174
2433
|
) {
|
|
2175
2434
|
obj = [];
|
|
2176
2435
|
obj[index] = leaf;
|
|
2177
|
-
} else if (
|
|
2178
|
-
obj[
|
|
2436
|
+
} else if (decodedRoot !== '__proto__') {
|
|
2437
|
+
obj[decodedRoot] = leaf;
|
|
2179
2438
|
}
|
|
2180
2439
|
}
|
|
2181
2440
|
|
|
@@ -2244,7 +2503,15 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
|
|
|
2244
2503
|
return defaults$1;
|
|
2245
2504
|
}
|
|
2246
2505
|
|
|
2247
|
-
if (
|
|
2506
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
2507
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {
|
|
2511
|
+
throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {
|
|
2248
2515
|
throw new TypeError('Decoder has to be a function.');
|
|
2249
2516
|
}
|
|
2250
2517
|
|
|
@@ -2253,18 +2520,29 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
|
|
|
2253
2520
|
}
|
|
2254
2521
|
var charset = typeof opts.charset === 'undefined' ? defaults$1.charset : opts.charset;
|
|
2255
2522
|
|
|
2523
|
+
var duplicates = typeof opts.duplicates === 'undefined' ? defaults$1.duplicates : opts.duplicates;
|
|
2524
|
+
|
|
2525
|
+
if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {
|
|
2526
|
+
throw new TypeError('The duplicates option must be either combine, first, or last');
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults$1.allowDots : !!opts.allowDots;
|
|
2530
|
+
|
|
2256
2531
|
return {
|
|
2257
|
-
allowDots:
|
|
2532
|
+
allowDots: allowDots,
|
|
2533
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults$1.allowEmptyArrays,
|
|
2258
2534
|
allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults$1.allowPrototypes,
|
|
2259
2535
|
allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults$1.allowSparse,
|
|
2260
2536
|
arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults$1.arrayLimit,
|
|
2261
2537
|
charset: charset,
|
|
2262
2538
|
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
|
|
2263
2539
|
comma: typeof opts.comma === 'boolean' ? opts.comma : defaults$1.comma,
|
|
2540
|
+
decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults$1.decodeDotInKeys,
|
|
2264
2541
|
decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults$1.decoder,
|
|
2265
2542
|
delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults$1.delimiter,
|
|
2266
2543
|
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
2267
2544
|
depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults$1.depth,
|
|
2545
|
+
duplicates: duplicates,
|
|
2268
2546
|
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
|
2269
2547
|
interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults$1.interpretNumericEntities,
|
|
2270
2548
|
parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults$1.parameterLimit,
|
|
@@ -2306,85 +2584,52 @@ var lib = {
|
|
|
2306
2584
|
stringify: stringify_1
|
|
2307
2585
|
};
|
|
2308
2586
|
|
|
2587
|
+
const limit = 100;
|
|
2309
2588
|
const fetchProductColorsQuery = (id, page) => lib.stringify({
|
|
2310
|
-
|
|
2589
|
+
fields: ['*', 'products.*'].join(','),
|
|
2590
|
+
filter: {
|
|
2311
2591
|
products: {
|
|
2312
|
-
|
|
2313
|
-
|
|
2592
|
+
Product_id: {
|
|
2593
|
+
_eq: id,
|
|
2314
2594
|
},
|
|
2315
2595
|
},
|
|
2316
2596
|
},
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
page: page || 1,
|
|
2321
|
-
pageSize: 100,
|
|
2322
|
-
},
|
|
2597
|
+
meta: '*',
|
|
2598
|
+
page: page || 1,
|
|
2599
|
+
limit,
|
|
2323
2600
|
}, {
|
|
2324
|
-
encodeValuesOnly: true,
|
|
2601
|
+
encodeValuesOnly: true,
|
|
2325
2602
|
});
|
|
2326
|
-
const fetchCategoryColorsQuery = (
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2603
|
+
const fetchCategoryColorsQuery = (id, page) => lib.stringify({
|
|
2604
|
+
fields: ['*', 'Category.*', 'products.*'].join(','),
|
|
2605
|
+
filter: {
|
|
2606
|
+
Category: {
|
|
2607
|
+
Category_id: {
|
|
2608
|
+
_eq: id,
|
|
2331
2609
|
},
|
|
2332
2610
|
},
|
|
2333
2611
|
},
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
page: 1,
|
|
2338
|
-
pageSize: 100,
|
|
2339
|
-
},
|
|
2612
|
+
meta: '*',
|
|
2613
|
+
page: page || 1,
|
|
2614
|
+
limit,
|
|
2340
2615
|
}, {
|
|
2341
|
-
encodeValuesOnly: true,
|
|
2616
|
+
encodeValuesOnly: true,
|
|
2342
2617
|
});
|
|
2343
|
-
const fetchColorByNumber = (
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
number: {
|
|
2350
|
-
$contains: colorNumber,
|
|
2351
|
-
},
|
|
2352
|
-
},
|
|
2353
|
-
{
|
|
2354
|
-
products: {
|
|
2355
|
-
id: {
|
|
2356
|
-
$eq: productId,
|
|
2357
|
-
},
|
|
2358
|
-
},
|
|
2359
|
-
},
|
|
2360
|
-
],
|
|
2361
|
-
},
|
|
2362
|
-
{
|
|
2363
|
-
$and: [
|
|
2364
|
-
{
|
|
2365
|
-
name: {
|
|
2366
|
-
$contains: colorNumber,
|
|
2367
|
-
},
|
|
2368
|
-
},
|
|
2369
|
-
{
|
|
2370
|
-
products: {
|
|
2371
|
-
id: {
|
|
2372
|
-
$eq: productId,
|
|
2373
|
-
},
|
|
2374
|
-
},
|
|
2375
|
-
},
|
|
2376
|
-
],
|
|
2618
|
+
const fetchColorByNumber = (id, colorNumber) => lib.stringify({
|
|
2619
|
+
fields: ['*', 'Category.*'].join(','),
|
|
2620
|
+
filter: {
|
|
2621
|
+
Category: {
|
|
2622
|
+
Category_id: {
|
|
2623
|
+
_eq: id,
|
|
2377
2624
|
},
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
pagination: {
|
|
2383
|
-
page: 1,
|
|
2384
|
-
pageSize: 100,
|
|
2625
|
+
},
|
|
2626
|
+
number: {
|
|
2627
|
+
_contains: colorNumber,
|
|
2628
|
+
},
|
|
2385
2629
|
},
|
|
2630
|
+
meta: '*',
|
|
2386
2631
|
}, {
|
|
2387
|
-
encodeValuesOnly: true,
|
|
2632
|
+
encodeValuesOnly: true,
|
|
2388
2633
|
});
|
|
2389
2634
|
|
|
2390
2635
|
const myModalCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}.my-modal{box-shadow:1px 1px 1px #ccc;background-color:#fff;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);max-width:1555px;width:90%;z-index:1000;text-align:center;padding:35px 40px;max-height:calc(100vh - 100px);overflow-y:auto}@media (max-width: 1024px){.my-modal{padding:80px 20px 20px}}.my-modal::-webkit-scrollbar{display:none}.my-modal .loader{display:flex;flex-direction:column;align-items:center;justify-content:center;height:300px}.my-modal>img{width:300px;object-fit:cover}@media (max-width: 768px){.my-modal>img{width:200px}}.my-modal__close{position:absolute;right:20px;top:20px;background:transparent;border:none}.my-modal__close>img{width:45px;height:45px;object-fit:cover;cursor:pointer}@media (max-width: 1024px){.my-modal__close{top:65px}}.my-modal__see-more{font-size:22px;margin-bottom:27px;display:flex;justify-content:center;align-items:center}@media (max-width: 1024px){.my-modal__see-more{font-size:18px}}.my-modal__see-more img{width:45px;height:45px}@media (max-width: 1024px){.my-modal__see-more img{display:none}}.my-modal__wrapper{display:flex;flex-direction:column;position:relative}.my-modal__wrapper .boxes{display:flex;flex-direction:column;flex-wrap:wrap}.my-modal__wrapper .boxes__list{display:flex;flex-wrap:wrap;gap:5px 5px}@media (max-width: 1024px){.my-modal__wrapper .boxes__list{justify-content:center}}.my-modal__wrapper .boxes__box-content{width:100%;margin-bottom:5px;height:500px;text-align:left;display:flex;flex-direction:row;justify-content:space-between;position:relative}.my-modal__wrapper .boxes__box-content .closebtn{position:absolute;right:10px;top:10px;width:53px;height:53px;cursor:pointer;object-fit:cover;z-index:9999}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content{flex-direction:column-reverse;height:auto}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content{margin:0 auto}}.my-modal__wrapper .boxes__box-content__info{width:40%;padding:50px 40px;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info{width:100%;padding:15px;min-height:100px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info{min-height:auto}}.my-modal__wrapper .boxes__box-content__info h2{font-size:35px;font-weight:normal;text-transform:capitalize;margin-bottom:7px;color:#232323}.my-modal__wrapper .boxes__box-content__info h4{margin-top:0px;margin-bottom:15px;font-size:16px;color:#4c4c4c}.my-modal__wrapper .boxes__box-content__info .divider{border:1px solid #4c4c4c;opacity:0.2;margin-bottom:20px}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info .divider{margin:10px 0px}}.my-modal__wrapper .boxes__box-content__info__value{display:flex;flex-direction:row;justify-content:flex-start}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value{justify-content:flex-start}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value{flex-direction:column}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-image{margin:0 auto;margin-bottom:10px}}.my-modal__wrapper .boxes__box-content__info__value-image img{width:114px;object-fit:cover}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-image img{width:75px}}.my-modal__wrapper .boxes__box-content__info__value-product{color:#232323;margin-left:10px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:26px;margin:0;margin-right:10px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:16px}}.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:20px;margin-top:0px;margin-bottom:0px}.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:20px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:0}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:10px}}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product>div{display:flex;justify-content:flex-start;align-items:center}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product>div{flex-direction:column}}.my-modal__wrapper .boxes__box-content__slider{width:60%;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__slider{width:100%;display:block}}.my-modal__wrapper .boxes__box-content__white *{color:#fff}.my-modal__wrapper .boxes__box-content__white h2{color:#fff}.my-modal__wrapper .pagination{margin:10px 0px;font-size:16px;display:flex;flex-direction:row;align-items:center;justify-content:center}.my-modal__wrapper .pagination>span{margin:0 3px;cursor:pointer;min-width:20px;padding:5px;box-shadow:1px 1px 1px #ccc}.my-modal__wrapper .pagination .current{background-color:wheat}.my-modal .categories{padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid #dfdfdf;display:flex;flex-direction:column;align-items:flex-start}.my-modal .categories__container{display:flex;flex-wrap:nowrap;gap:5px 5px;overflow-x:auto;width:100%}@media (max-width: 1024px){.my-modal .categories__container{padding-bottom:5px}}.my-modal .categories__slide-information{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.my-modal .categories__slide-information span{color:#4c4c4c;font-size:16px;font-weight:normal}.my-modal .categories__slide-information span:first-of-type{margin-left:7px}.my-modal .categories__slide-information span:last-of-type{margin-right:7px}.my-modal .button,.my-modal a{background-color:#fff;font-size:16px;box-shadow:0 10px 20px 0 rgba(0, 0, 0, 0.1);border-radius:22.5px;padding:15px 30px;color:#232323;text-decoration:none;display:block;text-align:center;transition:all 0.7s ease-in-out;border:none;cursor:pointer}.my-modal .button:hover,.my-modal a:hover{color:#fff;background-color:#232323}.my-modal .button.inverse,.my-modal a.inverse{background-color:#232323;color:#fff}.my-modal .button.inverse:hover,.my-modal a.inverse:hover{color:#232323;background-color:#fff}@media (max-width: 1024px){.my-modal .button,.my-modal a{max-width:150px;font-size:13px;padding:12px 25px}}@media (max-width: 768px){.my-modal .button,.my-modal a{margin:0 auto}}.my-modal>.button{margin:10px auto}";
|
|
@@ -2392,6 +2637,7 @@ const myModalCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}.my-m
|
|
|
2392
2637
|
const MyModal = class {
|
|
2393
2638
|
constructor(hostRef) {
|
|
2394
2639
|
registerInstance(this, hostRef);
|
|
2640
|
+
this.clearSearchText = createEvent(this, "clearSearchText", 7);
|
|
2395
2641
|
this.close = createEvent(this, "close", 7);
|
|
2396
2642
|
this.readyToCLose = createEvent(this, "readyToCLose", 7);
|
|
2397
2643
|
this.boxDesktopWidth = 130;
|
|
@@ -2447,10 +2693,18 @@ const MyModal = class {
|
|
|
2447
2693
|
};
|
|
2448
2694
|
this.fetchProductData = async () => {
|
|
2449
2695
|
try {
|
|
2450
|
-
const
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2696
|
+
const shopResponse = await ApiService.getData(`items/Shop?filter[name][_eq]=${this.shop}`);
|
|
2697
|
+
const shop = shopResponse === null || shopResponse === void 0 ? void 0 : shopResponse.data[0];
|
|
2698
|
+
if (shop.id) {
|
|
2699
|
+
const response = await ApiService.getData(`items/Product?filter[name][_eq]=${this.product}&fields=*,images.*,Shop.*,Category.*.*.*.*`);
|
|
2700
|
+
const product = response === null || response === void 0 ? void 0 : response.data[0];
|
|
2701
|
+
if (product) {
|
|
2702
|
+
if (product.Shop.find((s) => s.Shop_id === shop.id)) {
|
|
2703
|
+
this.data = Object.assign(Object.assign({}, response.data[0]), { id: response.data[0].id });
|
|
2704
|
+
}
|
|
2705
|
+
else {
|
|
2706
|
+
return null;
|
|
2707
|
+
}
|
|
2454
2708
|
}
|
|
2455
2709
|
}
|
|
2456
2710
|
}
|
|
@@ -2461,17 +2715,16 @@ const MyModal = class {
|
|
|
2461
2715
|
this.preloader = false;
|
|
2462
2716
|
}
|
|
2463
2717
|
};
|
|
2464
|
-
// TODO:
|
|
2465
2718
|
this.fetchProductColors = async (id, page) => {
|
|
2466
2719
|
this.loading = true;
|
|
2467
2720
|
try {
|
|
2468
|
-
const response = await ApiService.getData(`
|
|
2721
|
+
const response = await ApiService.getData(`items/Color?${fetchProductColorsQuery(id, page)}`);
|
|
2469
2722
|
if (response) {
|
|
2470
2723
|
this.colors = {
|
|
2471
2724
|
list: response &&
|
|
2472
2725
|
response.data &&
|
|
2473
|
-
response.data.map((item) => (Object.assign({
|
|
2474
|
-
pagination: response.meta
|
|
2726
|
+
response.data.map((item) => (Object.assign({}, item))),
|
|
2727
|
+
pagination: response.meta,
|
|
2475
2728
|
};
|
|
2476
2729
|
}
|
|
2477
2730
|
}
|
|
@@ -2482,16 +2735,16 @@ const MyModal = class {
|
|
|
2482
2735
|
this.loading = false;
|
|
2483
2736
|
}
|
|
2484
2737
|
};
|
|
2485
|
-
this.fetchCategoryColors = async (
|
|
2738
|
+
this.fetchCategoryColors = async (id, page) => {
|
|
2486
2739
|
this.loading = true;
|
|
2487
2740
|
try {
|
|
2488
|
-
const response = await ApiService.getData(`
|
|
2741
|
+
const response = await ApiService.getData(`items/Color?${fetchCategoryColorsQuery(id, page)}`);
|
|
2489
2742
|
if (response) {
|
|
2490
2743
|
this.colors = {
|
|
2491
2744
|
list: response &&
|
|
2492
2745
|
response.data &&
|
|
2493
|
-
response.data.map((item) => (Object.assign({
|
|
2494
|
-
pagination: response.meta
|
|
2746
|
+
response.data.map((item) => (Object.assign({}, item))),
|
|
2747
|
+
pagination: response.meta,
|
|
2495
2748
|
};
|
|
2496
2749
|
}
|
|
2497
2750
|
}
|
|
@@ -2502,29 +2755,21 @@ const MyModal = class {
|
|
|
2502
2755
|
this.loading = false;
|
|
2503
2756
|
}
|
|
2504
2757
|
};
|
|
2505
|
-
// private onIntersection = async (entries: any) => {
|
|
2506
|
-
// console.log(entries[0]);
|
|
2507
|
-
// if (entries[0].intersectionRatio === 0) {
|
|
2508
|
-
// console.log('d');
|
|
2509
|
-
// }
|
|
2510
|
-
// };
|
|
2511
|
-
// private handleObserve = () => {
|
|
2512
|
-
// console.log(this.modalEl.shadowRoot);
|
|
2513
|
-
// const boxesList: any = (this.modalEl as any).querySelector('.my-modal__wrapper');
|
|
2514
|
-
// console.log(boxesList);
|
|
2515
|
-
// if (boxesList) {
|
|
2516
|
-
// this.observer = new IntersectionObserver(this.onIntersection);
|
|
2517
|
-
// this.observer.observe(boxesList);
|
|
2518
|
-
// }
|
|
2519
|
-
// };
|
|
2520
2758
|
this.onPage = (page) => {
|
|
2521
|
-
|
|
2759
|
+
if (this.data) {
|
|
2760
|
+
if (this.selectedCategory) {
|
|
2761
|
+
this.fetchCategoryColors(this.selectedCategory, page);
|
|
2762
|
+
}
|
|
2763
|
+
else {
|
|
2764
|
+
this.fetchProductColors(String(this.data.id), page);
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2522
2767
|
this.page = page;
|
|
2523
2768
|
this.currentColor = null;
|
|
2524
2769
|
this.currentIndex = null;
|
|
2525
2770
|
};
|
|
2526
2771
|
this.handleCategoryClick = (color) => {
|
|
2527
|
-
if (this.selectedCategory && color && this.selectedCategory
|
|
2772
|
+
if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {
|
|
2528
2773
|
this.data && this.fetchProductColors(String(this.data.id));
|
|
2529
2774
|
this.selectedCategory = null;
|
|
2530
2775
|
}
|
|
@@ -2533,6 +2778,7 @@ const MyModal = class {
|
|
|
2533
2778
|
this.selectedCategory = color;
|
|
2534
2779
|
}
|
|
2535
2780
|
this.currentColor = null;
|
|
2781
|
+
this.clearSearchText.emit();
|
|
2536
2782
|
};
|
|
2537
2783
|
this.shop = undefined;
|
|
2538
2784
|
this.product = undefined;
|
|
@@ -2558,9 +2804,9 @@ const MyModal = class {
|
|
|
2558
2804
|
this.infoBoxWidth = newValue * this.boxWidth;
|
|
2559
2805
|
}
|
|
2560
2806
|
watchPropHandler(newValue) {
|
|
2561
|
-
if (newValue.
|
|
2807
|
+
if (newValue.Category.length > 0) {
|
|
2562
2808
|
this.showRange = true;
|
|
2563
|
-
this.handleCategoryClick(newValue.
|
|
2809
|
+
this.handleCategoryClick(newValue.Category[0].Category_id.id);
|
|
2564
2810
|
}
|
|
2565
2811
|
else {
|
|
2566
2812
|
this.fetchProductColors(String(newValue.id));
|
|
@@ -2584,21 +2830,23 @@ const MyModal = class {
|
|
|
2584
2830
|
this.displayForMobile();
|
|
2585
2831
|
}
|
|
2586
2832
|
async searchColorsHandler(event) {
|
|
2587
|
-
|
|
2833
|
+
this.loading = true;
|
|
2834
|
+
this.currentColor = null;
|
|
2588
2835
|
// if search is empty set to first category to not showing whole product colors
|
|
2589
2836
|
if (event.detail === '') {
|
|
2590
|
-
this.handleCategoryClick(
|
|
2837
|
+
this.handleCategoryClick(this.selectedCategory);
|
|
2838
|
+
this.loading = true;
|
|
2591
2839
|
}
|
|
2592
2840
|
try {
|
|
2593
2841
|
if (this.data && this.data.id && event.detail !== '') {
|
|
2594
|
-
this.selectedCategory
|
|
2595
|
-
const response = await ApiService.getData(`colors?${fetchColorByNumber(Number(this.data.id), event.detail)}`);
|
|
2842
|
+
const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);
|
|
2596
2843
|
if (response) {
|
|
2597
2844
|
this.colors = {
|
|
2598
|
-
list: response &&
|
|
2845
|
+
list: (response &&
|
|
2599
2846
|
response.data &&
|
|
2600
|
-
response.data.map((item) => (Object.assign({
|
|
2601
|
-
|
|
2847
|
+
response.data.map((item) => (Object.assign({}, item)))) ||
|
|
2848
|
+
[],
|
|
2849
|
+
pagination: response.meta,
|
|
2602
2850
|
};
|
|
2603
2851
|
}
|
|
2604
2852
|
}
|
|
@@ -2606,6 +2854,9 @@ const MyModal = class {
|
|
|
2606
2854
|
catch (error) {
|
|
2607
2855
|
console.error(error);
|
|
2608
2856
|
}
|
|
2857
|
+
finally {
|
|
2858
|
+
this.loading = false;
|
|
2859
|
+
}
|
|
2609
2860
|
}
|
|
2610
2861
|
componentWillLoad() {
|
|
2611
2862
|
this.preloader = true;
|
|
@@ -2617,11 +2868,9 @@ const MyModal = class {
|
|
|
2617
2868
|
this.colorTimer();
|
|
2618
2869
|
}
|
|
2619
2870
|
render() {
|
|
2620
|
-
var _a, _b, _c, _d
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
return (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c), color: c.attributes.hex, name: c.attributes.name, shop: this.shop, product: this.product, isCategoryActive: ((_a = this.selectedCategory) === null || _a === void 0 ? void 0 : _a.id) === c.id }));
|
|
2624
|
-
})), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
|
|
2871
|
+
var _a, _b, _c, _d;
|
|
2872
|
+
console.log(this.colors);
|
|
2873
|
+
return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))), !this.preloader && this.data && this.data.modalLogo && h("img", { src: `${APIURL}/assets/${(_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo}?access_token=${accessToken}`, alt: "modal-logo" }), !this.preloader && this.data && (h("p", { class: "my-modal__see-more" }, (_b = this.data) === null || _b === void 0 ? void 0 : _b.modalDescription)), this.showRange && (h("div", { class: 'categories' }, this.data && h("my-search", { productId: Number((_c = this.data) === null || _c === void 0 ? void 0 : _c.id), isMobile: this.isMobile }), h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_d = this.data) === null || _d === void 0 ? void 0 : _d.Category.map((c) => (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c.Category_id.id), color: c.Category_id.hex, name: c.Category_id.category_name, shop: this.shop, product: this.product, isCategoryActive: this.selectedCategory === c.Category_id.id })))), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
|
|
2625
2874
|
var _a;
|
|
2626
2875
|
return (h("div", { key: index, class: "boxes" }, h("div", { class: "boxes__list" }, color.map((c) => {
|
|
2627
2876
|
var _a;
|
|
@@ -2640,10 +2889,10 @@ const MyModal = class {
|
|
|
2640
2889
|
];
|
|
2641
2890
|
}, color: c.hex, name: c.name, isActive: ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) === c.id, shop: this.shop, product: this.product }));
|
|
2642
2891
|
})), ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) && index === this.currentIndex && (h("my-colorinfo", { currentColor: this.currentColor, shop: this.shop, product: this.product, data: this.data, isMobile: this.isMobile, infoBoxWidth: this.infoBoxWidth }))));
|
|
2643
|
-
})) : (h("p", null, "Brak wynik\u00F3w")), this.colors.pagination.
|
|
2892
|
+
})) : (h("p", null, "Brak wynik\u00F3w")), this.colors.pagination.filter_count > limit && (h("div", { class: 'pagination' }, Array.from({ length: Math.ceil(this.colors.pagination.filter_count / limit) }).map((_, i) => (h("span", { class: i + 1 === this.page ? 'current' : '', onClick: e => {
|
|
2644
2893
|
e.preventDefault();
|
|
2645
2894
|
this.onPage(i + 1);
|
|
2646
|
-
}, key: `#${i + 1
|
|
2895
|
+
}, key: `#${i + 1}` }, i + 1)))))))), !this.preloader && this.isMobile && (h("button", { class: "button", onClick: () => this.closeModalHandler() }, "Zamknij"))));
|
|
2647
2896
|
}
|
|
2648
2897
|
static get assetsDirs() { return ["assets"]; }
|
|
2649
2898
|
get modalEl() { return getElement(this); }
|
|
@@ -2656,6 +2905,17 @@ MyModal.style = myModalCss;
|
|
|
2656
2905
|
|
|
2657
2906
|
const mySearchCss = ".pallete-wrapper.sc-my-search *.sc-my-search{font-family:\"Galatea\", sans-serif}.search.sc-my-search{position:relative;width:400px}@media (max-width: 768px){.search.sc-my-search{width:100%}}.search.sc-my-search input.sc-my-search{margin-bottom:12px;font-size:16px;padding:19px;border-radius:27.35px;border:1px solid #dfdfdf;width:100%}.search.sc-my-search button.sc-my-search{position:absolute;border:none;background-color:transparent;right:-20px;top:0;width:50px;height:calc(100% - 12px);display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer}";
|
|
2658
2907
|
|
|
2908
|
+
function debounce(func, wait) {
|
|
2909
|
+
let timeout;
|
|
2910
|
+
return function executedFunction(...args) {
|
|
2911
|
+
const later = () => {
|
|
2912
|
+
clearTimeout(timeout);
|
|
2913
|
+
func(...args);
|
|
2914
|
+
};
|
|
2915
|
+
clearTimeout(timeout);
|
|
2916
|
+
timeout = setTimeout(later, wait);
|
|
2917
|
+
};
|
|
2918
|
+
}
|
|
2659
2919
|
const MySearch = class {
|
|
2660
2920
|
constructor(hostRef) {
|
|
2661
2921
|
registerInstance(this, hostRef);
|
|
@@ -2663,6 +2923,10 @@ const MySearch = class {
|
|
|
2663
2923
|
this.fetchColorsByName = (text) => {
|
|
2664
2924
|
this.searchColors.emit(text);
|
|
2665
2925
|
};
|
|
2926
|
+
this.debouncedInputChangeValue = debounce((value) => {
|
|
2927
|
+
this.fetchColorsByName(value);
|
|
2928
|
+
this.searchText = value;
|
|
2929
|
+
}, 300);
|
|
2666
2930
|
this.productId = undefined;
|
|
2667
2931
|
this.isMobile = undefined;
|
|
2668
2932
|
this.searchIcon = 'search.svg';
|
|
@@ -2670,12 +2934,14 @@ const MySearch = class {
|
|
|
2670
2934
|
}
|
|
2671
2935
|
onInputChangeValue(event) {
|
|
2672
2936
|
const value = event.target.value;
|
|
2673
|
-
this.
|
|
2674
|
-
this.searchText = value;
|
|
2937
|
+
this.debouncedInputChangeValue(value);
|
|
2675
2938
|
}
|
|
2676
2939
|
fetchColorsByNameHandle(newValue) {
|
|
2677
2940
|
this.fetchColorsByName(newValue);
|
|
2678
2941
|
}
|
|
2942
|
+
clearSearchTextHandler() {
|
|
2943
|
+
this.searchText = null;
|
|
2944
|
+
}
|
|
2679
2945
|
render() {
|
|
2680
2946
|
return (h("div", { class: 'search' }, h("input", { placeholder: this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie bądź numerze', value: this.searchText || '', type: "text", onInput: this.onInputChangeValue.bind(this) }), h("button", { onClick: () => {
|
|
2681
2947
|
this.searchText && this.fetchColorsByName(this.searchText);
|
|
@@ -7961,9 +8227,9 @@ const JcSwiper = class {
|
|
|
7961
8227
|
render() {
|
|
7962
8228
|
return (h("div", { class: "slider-wrapper" }, h("div", { class: "swiper mySwiper2" }, h("div", { class: "swiper-wrapper" }, this.slides &&
|
|
7963
8229
|
this.slides.length > 0 &&
|
|
7964
|
-
this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: slide.
|
|
8230
|
+
this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: `${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`, alt: "room_image" }))))), h("div", { onClick: this.colorInteraction, class: "swiper-button-next" }), h("div", { onClick: this.colorInteraction, class: "swiper-button-prev" })), h("div", { class: "swiper mySwiper" }, h("div", { class: "swiper-wrapper" }, this.slides &&
|
|
7965
8231
|
this.slides.length > 0 &&
|
|
7966
|
-
this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: slide.
|
|
8232
|
+
this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: `${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`, alt: "room_image" }))))))));
|
|
7967
8233
|
}
|
|
7968
8234
|
get modalEl() { return getElement(this); }
|
|
7969
8235
|
};
|