@eightshift/ui-components 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Button-CQ5ZZJ2w.js → Button-BhEIfWLY.js} +1 -1
- package/dist/{Dialog-BMgMUQuN.js → Dialog-B8p4Ymh7.js} +7 -7
- package/dist/{List-BiAnh5G5.js → List-Bll1lQEW.js} +1 -1
- package/dist/{ListBox-DggfiuO_.js → ListBox-CEpKw7yC.js} +5 -5
- package/dist/{OverlayArrow-DraDOoRn.js → OverlayArrow-DDfa8khI.js} +1 -1
- package/dist/{SearchField-DWGdCvnn.js → SearchField-D6mPli0i.js} +2 -2
- package/dist/{Select-BvggcFOX.js → Select-CHzjZxXy.js} +7 -7
- package/dist/{Select-ef7c0426.esm-CmTkSxDx.js → Select-ef7c0426.esm-BJmjGGzK.js} +1 -1
- package/dist/{SelectionManager-B6-b5NM2.js → SelectionManager-D77bfEbg.js} +2 -2
- package/dist/{Separator-B-xeqOkC.js → Separator-DcqCdD4k.js} +1 -1
- package/dist/{SharedElementTransition-fML-zIv6.js → SharedElementTransition-BjRNHsjx.js} +1 -1
- package/dist/_commonjsHelpers-BhWcALO8.js +38 -0
- package/dist/assets/style-admin.css +2 -8247
- package/dist/assets/style-editor.css +2 -8247
- package/dist/assets/style.css +2 -8253
- package/dist/assets/wp-font-enhancements.css +2 -8
- package/dist/assets/wp-ui-enhancements.css +2 -387
- package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -0
- package/dist/components/button/button.js +2 -2
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/color-pickers/color-picker.js +1 -1
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +2 -2
- package/dist/components/component-toggle/component-toggle.js +1 -1
- package/dist/components/draggable/draggable-handle.js +1 -1
- package/dist/components/draggable/draggable.js +2 -2
- package/dist/components/draggable-list/draggable-list-item.js +1 -1
- package/dist/components/draggable-list/draggable-list.js +2 -2
- package/dist/components/expandable/expandable.js +3 -3
- package/dist/components/index.js +2 -0
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +11 -11
- package/dist/components/matrix-align/matrix-align.js +2 -1
- package/dist/components/menu/menu.js +3 -3
- package/dist/components/modal/modal.js +4 -4
- package/dist/components/number-picker/number-picker.js +3 -3
- package/dist/components/option-select/option-select.js +1 -1
- package/dist/components/placeholders/file-picker-shell.js +72 -39
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/popover/popover.js +2 -2
- package/dist/components/radio/radio.js +2 -2
- package/dist/components/repeater/repeater-item.js +1 -1
- package/dist/components/repeater/repeater.js +2 -2
- package/dist/components/responsive/mini-responsive.js +2 -1
- package/dist/components/responsive/responsive-legacy.js +2 -1
- package/dist/components/responsive/responsive.js +2 -1
- package/dist/components/responsive-preview/responsive-preview.js +2 -1
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +1 -1
- package/dist/components/select/multi-select-components.js +1 -1
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +1 -1
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/v2/async-multi-select.js +7 -6
- package/dist/components/select/v2/async-select.js +7 -6
- package/dist/components/select/v2/multi-select.js +8 -7
- package/dist/components/select/v2/shared.js +1 -1
- package/dist/components/select/v2/single-select.js +7 -7
- package/dist/components/slider/column-config-slider.js +1 -1
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/smart-image/smart-image.js +159 -0
- package/dist/components/smart-image/worker-inline.js +4 -0
- package/dist/components/tabs/tabs.js +6 -6
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +2 -2
- package/dist/{default-i18n-CN_q3KUs.js → default-i18n-DBm-GqWM.js} +167 -50
- package/dist/general-6STKQIrk.js +4371 -0
- package/dist/icons/icons.js +10 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons/spinner.js +18 -0
- package/dist/{index-641ee5b8.esm-DVp0njHa.js → index-641ee5b8.esm-DiwvO-RP.js} +1 -1
- package/dist/{index-D8-Zjpbd.js → index-DjyEH0Gg.js} +1 -3
- package/dist/index.js +2 -0
- package/dist/{multi-select-components-CT_W0Cy9.js → multi-select-components-B3KuDyYd.js} +1 -1
- package/dist/{react-select-async.esm-Zl1LPaPb.js → react-select-async.esm-_4pk-41v.js} +3 -3
- package/dist/{react-select.esm-Bu36HujU.js → react-select.esm-BeuAkAyY.js} +3 -3
- package/dist/sha256-C56UDWfQ.js +533 -0
- package/dist/{useButton-v9ngEj50.js → useButton-B2EaQJT_.js} +1 -1
- package/dist/{useDragAndDrop-C08ZXv4F.js → useDragAndDrop-DUXKDS0N.js} +5 -5
- package/dist/{useFilter-BlkUH1Ma.js → useFilter-BPcJ-Jzv.js} +1 -1
- package/dist/{useListState-RdLrYsMP.js → useListState-DZycqxCn.js} +1 -1
- package/dist/{useNumberField-D16dDfYF.js → useNumberField-CEA9Q4w_.js} +1 -1
- package/dist/{usePress-DJskZBH9.js → usePress-BCEPS3hl.js} +1 -1
- package/dist/{useSingleSelectListState-n0AVMr3Y.js → useSingleSelectListState-BFZEfeqI.js} +1 -1
- package/dist/{useToggle-DSBDAfdw.js → useToggle-DNoP2bvV.js} +1 -1
- package/dist/utilities/general.js +10 -0
- package/dist/utilities/index.js +14 -2
- package/dist/utilities/web-workers.js +50 -0
- package/dist/workers/image-analysis.worker.js +52 -0
- package/package.json +17 -10
|
@@ -272,42 +272,118 @@ const createI18n = (initialData, initialDomain, hooks) => {
|
|
|
272
272
|
if (!hooks) {
|
|
273
273
|
return translation;
|
|
274
274
|
}
|
|
275
|
-
translation = hooks.applyFilters(
|
|
276
|
-
|
|
275
|
+
translation = hooks.applyFilters(
|
|
276
|
+
"i18n.gettext",
|
|
277
|
+
translation,
|
|
278
|
+
text,
|
|
279
|
+
domain
|
|
280
|
+
);
|
|
281
|
+
return hooks.applyFilters(
|
|
282
|
+
"i18n.gettext_" + getFilterDomain(domain),
|
|
283
|
+
translation,
|
|
284
|
+
text,
|
|
285
|
+
domain
|
|
286
|
+
);
|
|
277
287
|
};
|
|
278
288
|
const _x = (text, context, domain) => {
|
|
279
289
|
let translation = dcnpgettext(domain, context, text);
|
|
280
290
|
if (!hooks) {
|
|
281
291
|
return translation;
|
|
282
292
|
}
|
|
283
|
-
translation = hooks.applyFilters(
|
|
284
|
-
|
|
293
|
+
translation = hooks.applyFilters(
|
|
294
|
+
"i18n.gettext_with_context",
|
|
295
|
+
translation,
|
|
296
|
+
text,
|
|
297
|
+
context,
|
|
298
|
+
domain
|
|
299
|
+
);
|
|
300
|
+
return hooks.applyFilters(
|
|
301
|
+
"i18n.gettext_with_context_" + getFilterDomain(domain),
|
|
302
|
+
translation,
|
|
303
|
+
text,
|
|
304
|
+
context,
|
|
305
|
+
domain
|
|
306
|
+
);
|
|
285
307
|
};
|
|
286
308
|
const _n2 = (single, plural, number, domain) => {
|
|
287
|
-
let translation = dcnpgettext(
|
|
309
|
+
let translation = dcnpgettext(
|
|
310
|
+
domain,
|
|
311
|
+
void 0,
|
|
312
|
+
single,
|
|
313
|
+
plural,
|
|
314
|
+
number
|
|
315
|
+
);
|
|
288
316
|
if (!hooks) {
|
|
289
317
|
return translation;
|
|
290
318
|
}
|
|
291
|
-
translation = hooks.applyFilters(
|
|
292
|
-
|
|
319
|
+
translation = hooks.applyFilters(
|
|
320
|
+
"i18n.ngettext",
|
|
321
|
+
translation,
|
|
322
|
+
single,
|
|
323
|
+
plural,
|
|
324
|
+
number,
|
|
325
|
+
domain
|
|
326
|
+
);
|
|
327
|
+
return hooks.applyFilters(
|
|
328
|
+
"i18n.ngettext_" + getFilterDomain(domain),
|
|
329
|
+
translation,
|
|
330
|
+
single,
|
|
331
|
+
plural,
|
|
332
|
+
number,
|
|
333
|
+
domain
|
|
334
|
+
);
|
|
293
335
|
};
|
|
294
336
|
const _nx = (single, plural, number, context, domain) => {
|
|
295
|
-
let translation = dcnpgettext(
|
|
337
|
+
let translation = dcnpgettext(
|
|
338
|
+
domain,
|
|
339
|
+
context,
|
|
340
|
+
single,
|
|
341
|
+
plural,
|
|
342
|
+
number
|
|
343
|
+
);
|
|
296
344
|
if (!hooks) {
|
|
297
345
|
return translation;
|
|
298
346
|
}
|
|
299
|
-
translation = hooks.applyFilters(
|
|
300
|
-
|
|
347
|
+
translation = hooks.applyFilters(
|
|
348
|
+
"i18n.ngettext_with_context",
|
|
349
|
+
translation,
|
|
350
|
+
single,
|
|
351
|
+
plural,
|
|
352
|
+
number,
|
|
353
|
+
context,
|
|
354
|
+
domain
|
|
355
|
+
);
|
|
356
|
+
return hooks.applyFilters(
|
|
357
|
+
"i18n.ngettext_with_context_" + getFilterDomain(domain),
|
|
358
|
+
translation,
|
|
359
|
+
single,
|
|
360
|
+
plural,
|
|
361
|
+
number,
|
|
362
|
+
context,
|
|
363
|
+
domain
|
|
364
|
+
);
|
|
301
365
|
};
|
|
302
366
|
const isRTL = () => {
|
|
303
367
|
return "rtl" === _x("ltr", "text direction");
|
|
304
368
|
};
|
|
305
369
|
const hasTranslation = (single, context, domain) => {
|
|
306
370
|
const key = context ? context + "" + single : single;
|
|
307
|
-
let result = !!tannin.data?.[domain
|
|
371
|
+
let result = !!tannin.data?.[domain ?? "default"]?.[key];
|
|
308
372
|
if (hooks) {
|
|
309
|
-
result = hooks.applyFilters(
|
|
310
|
-
|
|
373
|
+
result = hooks.applyFilters(
|
|
374
|
+
"i18n.has_translation",
|
|
375
|
+
result,
|
|
376
|
+
single,
|
|
377
|
+
context,
|
|
378
|
+
domain
|
|
379
|
+
);
|
|
380
|
+
result = hooks.applyFilters(
|
|
381
|
+
"i18n.has_translation_" + getFilterDomain(domain),
|
|
382
|
+
result,
|
|
383
|
+
single,
|
|
384
|
+
context,
|
|
385
|
+
domain
|
|
386
|
+
);
|
|
311
387
|
}
|
|
312
388
|
return result;
|
|
313
389
|
};
|
|
@@ -340,11 +416,14 @@ function validateNamespace(namespace) {
|
|
|
340
416
|
return false;
|
|
341
417
|
}
|
|
342
418
|
if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
|
|
343
|
-
console.error(
|
|
419
|
+
console.error(
|
|
420
|
+
"The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."
|
|
421
|
+
);
|
|
344
422
|
return false;
|
|
345
423
|
}
|
|
346
424
|
return true;
|
|
347
425
|
}
|
|
426
|
+
var validateNamespace_default = validateNamespace;
|
|
348
427
|
function validateHookName(hookName) {
|
|
349
428
|
if ("string" !== typeof hookName || "" === hookName) {
|
|
350
429
|
console.error("The hook name must be a non-empty string.");
|
|
@@ -355,18 +434,21 @@ function validateHookName(hookName) {
|
|
|
355
434
|
return false;
|
|
356
435
|
}
|
|
357
436
|
if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
|
|
358
|
-
console.error(
|
|
437
|
+
console.error(
|
|
438
|
+
"The hook name can only contain numbers, letters, dashes, periods and underscores."
|
|
439
|
+
);
|
|
359
440
|
return false;
|
|
360
441
|
}
|
|
361
442
|
return true;
|
|
362
443
|
}
|
|
444
|
+
var validateHookName_default = validateHookName;
|
|
363
445
|
function createAddHook(hooks, storeKey) {
|
|
364
446
|
return function addHook(hookName, namespace, callback, priority = 10) {
|
|
365
447
|
const hooksStore = hooks[storeKey];
|
|
366
|
-
if (!
|
|
448
|
+
if (!validateHookName_default(hookName)) {
|
|
367
449
|
return;
|
|
368
450
|
}
|
|
369
|
-
if (!
|
|
451
|
+
if (!validateNamespace_default(namespace)) {
|
|
370
452
|
return;
|
|
371
453
|
}
|
|
372
454
|
if ("function" !== typeof callback) {
|
|
@@ -374,14 +456,12 @@ function createAddHook(hooks, storeKey) {
|
|
|
374
456
|
return;
|
|
375
457
|
}
|
|
376
458
|
if ("number" !== typeof priority) {
|
|
377
|
-
console.error(
|
|
459
|
+
console.error(
|
|
460
|
+
"If specified, the hook priority must be a number."
|
|
461
|
+
);
|
|
378
462
|
return;
|
|
379
463
|
}
|
|
380
|
-
const handler = {
|
|
381
|
-
callback,
|
|
382
|
-
priority,
|
|
383
|
-
namespace
|
|
384
|
-
};
|
|
464
|
+
const handler = { callback, priority, namespace };
|
|
385
465
|
if (hooksStore[hookName]) {
|
|
386
466
|
const handlers = hooksStore[hookName].handlers;
|
|
387
467
|
let i;
|
|
@@ -407,17 +487,24 @@ function createAddHook(hooks, storeKey) {
|
|
|
407
487
|
};
|
|
408
488
|
}
|
|
409
489
|
if (hookName !== "hookAdded") {
|
|
410
|
-
hooks.doAction(
|
|
490
|
+
hooks.doAction(
|
|
491
|
+
"hookAdded",
|
|
492
|
+
hookName,
|
|
493
|
+
namespace,
|
|
494
|
+
callback,
|
|
495
|
+
priority
|
|
496
|
+
);
|
|
411
497
|
}
|
|
412
498
|
};
|
|
413
499
|
}
|
|
500
|
+
var createAddHook_default = createAddHook;
|
|
414
501
|
function createRemoveHook(hooks, storeKey, removeAll = false) {
|
|
415
502
|
return function removeHook(hookName, namespace) {
|
|
416
503
|
const hooksStore = hooks[storeKey];
|
|
417
|
-
if (!
|
|
504
|
+
if (!validateHookName_default(hookName)) {
|
|
418
505
|
return;
|
|
419
506
|
}
|
|
420
|
-
if (!removeAll && !
|
|
507
|
+
if (!removeAll && !validateNamespace_default(namespace)) {
|
|
421
508
|
return;
|
|
422
509
|
}
|
|
423
510
|
if (!hooksStore[hookName]) {
|
|
@@ -450,15 +537,19 @@ function createRemoveHook(hooks, storeKey, removeAll = false) {
|
|
|
450
537
|
return handlersRemoved;
|
|
451
538
|
};
|
|
452
539
|
}
|
|
540
|
+
var createRemoveHook_default = createRemoveHook;
|
|
453
541
|
function createHasHook(hooks, storeKey) {
|
|
454
542
|
return function hasHook(hookName, namespace) {
|
|
455
543
|
const hooksStore = hooks[storeKey];
|
|
456
544
|
if ("undefined" !== typeof namespace) {
|
|
457
|
-
return hookName in hooksStore && hooksStore[hookName].handlers.some(
|
|
545
|
+
return hookName in hooksStore && hooksStore[hookName].handlers.some(
|
|
546
|
+
(hook) => hook.namespace === namespace
|
|
547
|
+
);
|
|
458
548
|
}
|
|
459
549
|
return hookName in hooksStore;
|
|
460
550
|
};
|
|
461
551
|
}
|
|
552
|
+
var createHasHook_default = createHasHook;
|
|
462
553
|
function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
463
554
|
return function runHook(hookName, ...args) {
|
|
464
555
|
const hooksStore = hooks[storeKey];
|
|
@@ -519,62 +610,88 @@ function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
|
519
610
|
return (async ? asyncRunner : syncRunner)();
|
|
520
611
|
};
|
|
521
612
|
}
|
|
613
|
+
var createRunHook_default = createRunHook;
|
|
522
614
|
function createCurrentHook(hooks, storeKey) {
|
|
523
615
|
return function currentHook() {
|
|
524
|
-
var _currentArray$at$name;
|
|
525
616
|
const hooksStore = hooks[storeKey];
|
|
526
617
|
const currentArray = Array.from(hooksStore.__current);
|
|
527
|
-
return
|
|
618
|
+
return currentArray.at(-1)?.name ?? null;
|
|
528
619
|
};
|
|
529
620
|
}
|
|
621
|
+
var createCurrentHook_default = createCurrentHook;
|
|
530
622
|
function createDoingHook(hooks, storeKey) {
|
|
531
623
|
return function doingHook(hookName) {
|
|
532
624
|
const hooksStore = hooks[storeKey];
|
|
533
625
|
if ("undefined" === typeof hookName) {
|
|
534
626
|
return hooksStore.__current.size > 0;
|
|
535
627
|
}
|
|
536
|
-
return Array.from(hooksStore.__current).some(
|
|
628
|
+
return Array.from(hooksStore.__current).some(
|
|
629
|
+
(hook) => hook.name === hookName
|
|
630
|
+
);
|
|
537
631
|
};
|
|
538
632
|
}
|
|
633
|
+
var createDoingHook_default = createDoingHook;
|
|
539
634
|
function createDidHook(hooks, storeKey) {
|
|
540
635
|
return function didHook(hookName) {
|
|
541
636
|
const hooksStore = hooks[storeKey];
|
|
542
|
-
if (!
|
|
637
|
+
if (!validateHookName_default(hookName)) {
|
|
543
638
|
return;
|
|
544
639
|
}
|
|
545
640
|
return hooksStore[hookName] && hooksStore[hookName].runs ? hooksStore[hookName].runs : 0;
|
|
546
641
|
};
|
|
547
642
|
}
|
|
643
|
+
var createDidHook_default = createDidHook;
|
|
548
644
|
class _Hooks {
|
|
645
|
+
actions;
|
|
646
|
+
filters;
|
|
647
|
+
addAction;
|
|
648
|
+
addFilter;
|
|
649
|
+
removeAction;
|
|
650
|
+
removeFilter;
|
|
651
|
+
hasAction;
|
|
652
|
+
hasFilter;
|
|
653
|
+
removeAllActions;
|
|
654
|
+
removeAllFilters;
|
|
655
|
+
doAction;
|
|
656
|
+
doActionAsync;
|
|
657
|
+
applyFilters;
|
|
658
|
+
applyFiltersAsync;
|
|
659
|
+
currentAction;
|
|
660
|
+
currentFilter;
|
|
661
|
+
doingAction;
|
|
662
|
+
doingFilter;
|
|
663
|
+
didAction;
|
|
664
|
+
didFilter;
|
|
549
665
|
constructor() {
|
|
550
666
|
this.actions = /* @__PURE__ */ Object.create(null);
|
|
551
667
|
this.actions.__current = /* @__PURE__ */ new Set();
|
|
552
668
|
this.filters = /* @__PURE__ */ Object.create(null);
|
|
553
669
|
this.filters.__current = /* @__PURE__ */ new Set();
|
|
554
|
-
this.addAction =
|
|
555
|
-
this.addFilter =
|
|
556
|
-
this.removeAction =
|
|
557
|
-
this.removeFilter =
|
|
558
|
-
this.hasAction =
|
|
559
|
-
this.hasFilter =
|
|
560
|
-
this.removeAllActions =
|
|
561
|
-
this.removeAllFilters =
|
|
562
|
-
this.doAction =
|
|
563
|
-
this.doActionAsync =
|
|
564
|
-
this.applyFilters =
|
|
565
|
-
this.applyFiltersAsync =
|
|
566
|
-
this.currentAction =
|
|
567
|
-
this.currentFilter =
|
|
568
|
-
this.doingAction =
|
|
569
|
-
this.doingFilter =
|
|
570
|
-
this.didAction =
|
|
571
|
-
this.didFilter =
|
|
670
|
+
this.addAction = createAddHook_default(this, "actions");
|
|
671
|
+
this.addFilter = createAddHook_default(this, "filters");
|
|
672
|
+
this.removeAction = createRemoveHook_default(this, "actions");
|
|
673
|
+
this.removeFilter = createRemoveHook_default(this, "filters");
|
|
674
|
+
this.hasAction = createHasHook_default(this, "actions");
|
|
675
|
+
this.hasFilter = createHasHook_default(this, "filters");
|
|
676
|
+
this.removeAllActions = createRemoveHook_default(this, "actions", true);
|
|
677
|
+
this.removeAllFilters = createRemoveHook_default(this, "filters", true);
|
|
678
|
+
this.doAction = createRunHook_default(this, "actions", false, false);
|
|
679
|
+
this.doActionAsync = createRunHook_default(this, "actions", false, true);
|
|
680
|
+
this.applyFilters = createRunHook_default(this, "filters", true, false);
|
|
681
|
+
this.applyFiltersAsync = createRunHook_default(this, "filters", true, true);
|
|
682
|
+
this.currentAction = createCurrentHook_default(this, "actions");
|
|
683
|
+
this.currentFilter = createCurrentHook_default(this, "filters");
|
|
684
|
+
this.doingAction = createDoingHook_default(this, "actions");
|
|
685
|
+
this.doingFilter = createDoingHook_default(this, "filters");
|
|
686
|
+
this.didAction = createDidHook_default(this, "actions");
|
|
687
|
+
this.didFilter = createDidHook_default(this, "filters");
|
|
572
688
|
}
|
|
573
689
|
}
|
|
574
690
|
function createHooks() {
|
|
575
691
|
return new _Hooks();
|
|
576
692
|
}
|
|
577
|
-
|
|
693
|
+
var createHooks_default = createHooks;
|
|
694
|
+
const defaultHooks = createHooks_default();
|
|
578
695
|
const {
|
|
579
696
|
addAction,
|
|
580
697
|
addFilter,
|