@watermarkinsights/ripple 3.7.0 → 3.8.0-2
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/cjs/{functions-13b0e88e.js → functions-edfdd03f.js} +67 -41
- package/dist/cjs/{global-c802d13c.js → global-ffd0392c.js} +1 -1
- package/dist/cjs/{index-cd179539.js → index-0e7e3668.js} +96 -64
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/priv-chart-popover.cjs.entry.js +4 -4
- package/dist/cjs/priv-datepicker.cjs.entry.js +23 -18
- package/dist/cjs/priv-navigator-button.cjs.entry.js +3 -3
- package/dist/cjs/priv-navigator-item.cjs.entry.js +2 -2
- package/dist/cjs/ripple.cjs.js +4 -4
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +5 -5
- package/dist/cjs/wm-button.cjs.entry.js +4 -4
- package/dist/cjs/wm-chart-slice.cjs.entry.js +2 -2
- package/dist/cjs/wm-chart.cjs.entry.js +5 -5
- package/dist/cjs/wm-datepicker.cjs.entry.js +13 -4
- package/dist/cjs/wm-input.cjs.entry.js +4 -4
- package/dist/cjs/wm-modal-footer.cjs.entry.js +3 -3
- package/dist/cjs/wm-modal-header.cjs.entry.js +3 -3
- package/dist/cjs/wm-modal.cjs.entry.js +7 -5
- package/dist/cjs/wm-navigation-hamburger.cjs.entry.js +56 -0
- package/dist/cjs/wm-navigation-item.cjs.entry.js +31 -0
- package/dist/cjs/wm-navigation.cjs.entry.js +87 -0
- package/dist/cjs/wm-navigator.cjs.entry.js +4 -4
- package/dist/cjs/wm-network-uploader.cjs.entry.js +4 -4
- package/dist/cjs/wm-option_2.cjs.entry.js +6 -6
- package/dist/cjs/wm-pagination.cjs.entry.js +4 -4
- package/dist/cjs/wm-search.cjs.entry.js +4 -4
- package/dist/cjs/wm-snackbar.cjs.entry.js +4 -4
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +7 -7
- package/dist/cjs/wm-tag-input.cjs.entry.js +13 -4
- package/dist/cjs/wm-timepicker.cjs.entry.js +9 -6
- package/dist/cjs/wm-toggletip.cjs.entry.js +4 -4
- package/dist/cjs/wm-uploader.cjs.entry.js +4 -4
- package/dist/cjs/wm-wrapper.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +10 -2
- package/dist/collection/components/wm-action-menu/wm-action-menu.css +0 -1
- package/dist/collection/components/wm-button/wm-button.css +1 -3
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.css +0 -1
- package/dist/collection/components/wm-chart/wm-chart-slice.js +51 -0
- package/dist/collection/components/wm-chart/wm-chart.css +3 -1
- package/dist/collection/components/wm-chart/wm-chart.js +1 -1
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +3 -5
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +39 -15
- package/dist/collection/components/wm-datepicker/wm-datepicker.css +1 -3
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +15 -0
- package/dist/collection/components/wm-input/wm-input.css +1 -3
- package/dist/collection/components/wm-menuitem/wm-menuitem.css +0 -1
- package/dist/collection/components/wm-modal/wm-modal-footer.css +0 -1
- package/dist/collection/components/wm-modal/wm-modal-header.css +0 -1
- package/dist/collection/components/wm-modal/wm-modal.css +0 -1
- package/dist/collection/components/wm-modal/wm-modal.js +3 -1
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.css +86 -0
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +96 -0
- package/dist/collection/components/wm-navigation/wm-navigation-item.css +85 -0
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +101 -0
- package/dist/collection/components/wm-navigation/wm-navigation.css +117 -0
- package/dist/collection/components/wm-navigation/wm-navigation.js +142 -0
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.css +0 -1
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.css +0 -1
- package/dist/collection/components/wm-navigator/wm-navigator.css +0 -1
- package/dist/collection/components/wm-option/wm-option.css +2 -4
- package/dist/collection/components/wm-pagination/wm-pagination.css +0 -1
- package/dist/collection/components/wm-search/wm-search.css +0 -1
- package/dist/collection/components/wm-select/wm-select.css +2 -4
- package/dist/collection/components/wm-snackbar/wm-snackbar.css +2 -4
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +0 -1
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +0 -1
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.css +0 -1
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +2 -4
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +9 -0
- package/dist/collection/components/wm-timepicker/wm-timepicker.css +2 -4
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +5 -2
- package/dist/collection/components/wm-toggletip/wm-toggletip.css +1 -3
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +1 -3
- package/dist/collection/components/wm-uploader/wm-uploader.css +1 -3
- package/dist/esm/{functions-6ddad20e.js → functions-6cd52dcf.js} +67 -41
- package/dist/esm/{global-a4da88c7.js → global-51d6ea5f.js} +1 -1
- package/dist/esm/{index-66f8130e.js → index-cd8f9ae2.js} +96 -64
- package/dist/esm/loader.js +4 -4
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/priv-chart-popover.entry.js +4 -4
- package/dist/esm/priv-datepicker.entry.js +23 -18
- package/dist/esm/priv-navigator-button.entry.js +3 -3
- package/dist/esm/priv-navigator-item.entry.js +2 -2
- package/dist/esm/ripple.js +4 -4
- package/dist/esm/wm-action-menu_2.entry.js +5 -5
- package/dist/esm/wm-button.entry.js +4 -4
- package/dist/esm/wm-chart-slice.entry.js +2 -2
- package/dist/esm/wm-chart.entry.js +5 -5
- package/dist/esm/wm-datepicker.entry.js +13 -4
- package/dist/esm/wm-input.entry.js +4 -4
- package/dist/esm/wm-modal-footer.entry.js +3 -3
- package/dist/esm/wm-modal-header.entry.js +3 -3
- package/dist/esm/wm-modal.entry.js +7 -5
- package/dist/esm/wm-navigation-hamburger.entry.js +52 -0
- package/dist/esm/wm-navigation-item.entry.js +27 -0
- package/dist/esm/wm-navigation.entry.js +83 -0
- package/dist/esm/wm-navigator.entry.js +4 -4
- package/dist/esm/wm-network-uploader.entry.js +4 -4
- package/dist/esm/wm-option_2.entry.js +6 -6
- package/dist/esm/wm-pagination.entry.js +4 -4
- package/dist/esm/wm-search.entry.js +4 -4
- package/dist/esm/wm-snackbar.entry.js +4 -4
- package/dist/esm/wm-tab-item_3.entry.js +7 -7
- package/dist/esm/wm-tag-input.entry.js +13 -4
- package/dist/esm/wm-timepicker.entry.js +9 -6
- package/dist/esm/wm-toggletip.entry.js +4 -4
- package/dist/esm/wm-uploader.entry.js +4 -4
- package/dist/esm/wm-wrapper.entry.js +2 -2
- package/dist/esm-es5/functions-6cd52dcf.js +15 -0
- package/dist/esm-es5/global-51d6ea5f.js +1 -0
- package/dist/esm-es5/http-service-5d037e16.js +1 -0
- package/dist/esm-es5/index-cd8f9ae2.js +1 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/interfaces-61c6305b.js +1 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -0
- package/dist/esm-es5/priv-datepicker.entry.js +1 -0
- package/dist/esm-es5/priv-navigator-button.entry.js +1 -0
- package/dist/esm-es5/priv-navigator-item.entry.js +1 -0
- package/dist/esm-es5/ripple.js +1 -0
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -0
- package/dist/esm-es5/wm-button.entry.js +1 -0
- package/dist/esm-es5/wm-chart-slice.entry.js +1 -0
- package/dist/esm-es5/wm-chart.entry.js +1 -0
- package/dist/esm-es5/wm-datepicker.entry.js +1 -0
- package/dist/esm-es5/wm-input.entry.js +1 -0
- package/dist/esm-es5/wm-modal-footer.entry.js +1 -0
- package/dist/esm-es5/wm-modal-header.entry.js +1 -0
- package/dist/esm-es5/wm-modal.entry.js +1 -0
- package/dist/esm-es5/wm-navigation-hamburger.entry.js +1 -0
- package/dist/esm-es5/wm-navigation-item.entry.js +1 -0
- package/dist/esm-es5/wm-navigation.entry.js +1 -0
- package/dist/esm-es5/wm-navigator.entry.js +1 -0
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -0
- package/dist/esm-es5/wm-option_2.entry.js +1 -0
- package/dist/esm-es5/wm-pagination.entry.js +1 -0
- package/dist/esm-es5/wm-search.entry.js +1 -0
- package/dist/esm-es5/wm-snackbar.entry.js +1 -0
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -0
- package/dist/esm-es5/wm-tag-input.entry.js +1 -0
- package/dist/esm-es5/wm-timepicker.entry.js +1 -0
- package/dist/esm-es5/wm-toggletip.entry.js +1 -0
- package/dist/esm-es5/wm-uploader.entry.js +1 -0
- package/dist/esm-es5/wm-wrapper.entry.js +1 -0
- package/dist/index.js +1 -1
- package/dist/loader/index.d.ts +0 -1
- package/dist/loader/index.js +1 -1
- package/dist/ripple/p-05b44011.system.entry.js +1 -0
- package/dist/ripple/p-088e3c4c.system.entry.js +1 -0
- package/dist/ripple/p-08b7ec08.system.js +1 -0
- package/dist/ripple/p-15759528.system.entry.js +1 -0
- package/dist/ripple/p-17fef956.entry.js +1 -0
- package/dist/ripple/p-1d7049b5.system.entry.js +1 -0
- package/dist/ripple/p-20856a2d.system.js +1 -0
- package/dist/ripple/p-2206c8d0.entry.js +1 -0
- package/dist/ripple/p-244877c8.entry.js +1 -0
- package/dist/ripple/p-284a9749.system.entry.js +1 -0
- package/dist/ripple/p-2b526a98.entry.js +1 -0
- package/dist/ripple/p-2f63e022.system.entry.js +1 -0
- package/dist/ripple/p-313b6073.system.js +1 -0
- package/dist/ripple/p-323c8fbd.entry.js +1 -0
- package/dist/ripple/p-38062c39.js +1 -0
- package/dist/ripple/p-3ba3afca.entry.js +1 -0
- package/dist/ripple/p-45ee5b9d.system.entry.js +1 -0
- package/dist/ripple/p-48ab9e16.entry.js +1 -0
- package/dist/ripple/p-4999f5dc.entry.js +1 -0
- package/dist/ripple/p-4ab257fe.entry.js +1 -0
- package/dist/ripple/p-4c0de099.system.entry.js +1 -0
- package/dist/ripple/p-4c75587a.system.entry.js +1 -0
- package/dist/ripple/p-4ed98fb1.system.entry.js +1 -0
- package/dist/ripple/p-504579c2.system.entry.js +1 -0
- package/dist/ripple/p-50ea2036.system.js +1 -0
- package/dist/ripple/p-58a1e616.system.entry.js +1 -0
- package/dist/ripple/p-5fd47eac.entry.js +1 -0
- package/dist/ripple/p-664c3f62.entry.js +1 -0
- package/dist/ripple/p-6923b8f6.system.js +15 -0
- package/dist/ripple/p-6e5a35ae.system.entry.js +1 -0
- package/dist/ripple/p-741972e8.system.entry.js +1 -0
- package/dist/ripple/p-764fa608.entry.js +1 -0
- package/dist/ripple/p-77bd8d1b.entry.js +1 -0
- package/dist/ripple/p-7ff67db9.entry.js +1 -0
- package/dist/ripple/p-8139cdfe.system.js +1 -0
- package/dist/ripple/p-83028f2c.js +1 -0
- package/dist/ripple/p-864b71bf.system.entry.js +1 -0
- package/dist/ripple/p-87b8fddf.entry.js +1 -0
- package/dist/ripple/p-8a0450fd.entry.js +1 -0
- package/dist/ripple/p-9173f673.entry.js +1 -0
- package/dist/ripple/p-9a9743f5.system.entry.js +1 -0
- package/dist/ripple/p-9f442b49.system.entry.js +1 -0
- package/dist/ripple/p-a2c2f475.system.entry.js +1 -0
- package/dist/ripple/p-a3fcdd9f.entry.js +1 -0
- package/dist/ripple/p-a5177480.system.entry.js +1 -0
- package/dist/ripple/p-a588ae81.entry.js +1 -0
- package/dist/ripple/p-a8358b36.entry.js +1 -0
- package/dist/ripple/p-a88d46f9.system.entry.js +1 -0
- package/dist/ripple/p-a8dfec6d.system.entry.js +1 -0
- package/dist/ripple/p-aedd95e6.system.js +1 -0
- package/dist/ripple/p-b1d25dec.entry.js +1 -0
- package/dist/ripple/p-b542340c.system.entry.js +1 -0
- package/dist/ripple/p-c19298a5.system.entry.js +1 -0
- package/dist/ripple/p-c401898d.entry.js +1 -0
- package/dist/ripple/p-ce81ccb4.system.entry.js +1 -0
- package/dist/ripple/p-cfa8106a.system.entry.js +1 -0
- package/dist/ripple/p-dadb6c78.js +16 -0
- package/dist/ripple/p-db7f5d60.entry.js +1 -0
- package/dist/ripple/p-dff01b0a.system.entry.js +1 -0
- package/dist/ripple/p-e758db14.system.entry.js +1 -0
- package/dist/ripple/p-ecb6a2e0.entry.js +1 -0
- package/dist/ripple/p-ef344252.entry.js +1 -0
- package/dist/ripple/p-f0dfc5d7.entry.js +1 -0
- package/dist/ripple/p-f2ba1a0f.system.entry.js +1 -0
- package/dist/ripple/p-f92f2d83.entry.js +1 -0
- package/dist/ripple/p-fe0a25c1.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +130 -0
- package/dist/types/components/wm-chart/wm-chart-slice.d.ts +3 -0
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +6 -2
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +1 -0
- package/dist/types/components/wm-modal/wm-modal.d.ts +1 -1
- package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +13 -0
- package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +10 -0
- package/dist/types/components/wm-navigation/wm-navigation.d.ts +19 -0
- package/dist/types/components.d.ts +57 -0
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/package.json +1 -1
- package/dist/ripple/p-0068e871.entry.js +0 -1
- package/dist/ripple/p-00999aeb.entry.js +0 -1
- package/dist/ripple/p-08b273ba.entry.js +0 -1
- package/dist/ripple/p-0c58f50d.entry.js +0 -1
- package/dist/ripple/p-11c09317.entry.js +0 -1
- package/dist/ripple/p-196b4c55.entry.js +0 -1
- package/dist/ripple/p-1a3df227.entry.js +0 -1
- package/dist/ripple/p-3590a57f.entry.js +0 -1
- package/dist/ripple/p-3a178ac8.entry.js +0 -1
- package/dist/ripple/p-46371fad.entry.js +0 -1
- package/dist/ripple/p-5548fc7c.js +0 -1
- package/dist/ripple/p-5c73fd59.entry.js +0 -1
- package/dist/ripple/p-66513af1.entry.js +0 -1
- package/dist/ripple/p-828316d6.entry.js +0 -1
- package/dist/ripple/p-857a0bc0.js +0 -16
- package/dist/ripple/p-8b0eb05e.entry.js +0 -1
- package/dist/ripple/p-9624967f.entry.js +0 -1
- package/dist/ripple/p-99db8501.entry.js +0 -1
- package/dist/ripple/p-99e2c5f6.entry.js +0 -1
- package/dist/ripple/p-9baa3039.js +0 -1
- package/dist/ripple/p-b495e06c.entry.js +0 -1
- package/dist/ripple/p-b8aa478f.entry.js +0 -1
- package/dist/ripple/p-bc9ca97b.entry.js +0 -1
- package/dist/ripple/p-bf985c5d.entry.js +0 -1
- package/dist/ripple/p-cd6de442.entry.js +0 -1
- package/dist/ripple/p-cfdf1a79.entry.js +0 -1
- package/dist/ripple/p-d22c957d.entry.js +0 -1
- package/dist/ripple/p-e43b4eda.entry.js +0 -1
|
@@ -3880,11 +3880,17 @@ function icuUnitToEcma(unit) {
|
|
|
3880
3880
|
return unit.replace(/^(.*?)-/, '');
|
|
3881
3881
|
}
|
|
3882
3882
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
3883
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
3883
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
3884
3884
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
3885
3885
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
3886
3886
|
function parseSignificantPrecision(str) {
|
|
3887
3887
|
var result = {};
|
|
3888
|
+
if (str[str.length - 1] === 'r') {
|
|
3889
|
+
result.roundingPriority = 'morePrecision';
|
|
3890
|
+
}
|
|
3891
|
+
else if (str[str.length - 1] === 's') {
|
|
3892
|
+
result.roundingPriority = 'lessPrecision';
|
|
3893
|
+
}
|
|
3888
3894
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {
|
|
3889
3895
|
// @@@ case
|
|
3890
3896
|
if (typeof g2 !== 'string') {
|
|
@@ -4111,8 +4117,13 @@ function parseNumberSkeleton(tokens) {
|
|
|
4111
4117
|
}
|
|
4112
4118
|
return '';
|
|
4113
4119
|
});
|
|
4114
|
-
|
|
4115
|
-
|
|
4120
|
+
var opt = token.options[0];
|
|
4121
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display
|
|
4122
|
+
if (opt === 'w') {
|
|
4123
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });
|
|
4124
|
+
}
|
|
4125
|
+
else if (opt) {
|
|
4126
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
4116
4127
|
}
|
|
4117
4128
|
continue;
|
|
4118
4129
|
}
|
|
@@ -4134,8 +4145,8 @@ function parseNumberSkeleton(tokens) {
|
|
|
4134
4145
|
}
|
|
4135
4146
|
|
|
4136
4147
|
var _a;
|
|
4137
|
-
var SPACE_SEPARATOR_START_REGEX = new RegExp("^"
|
|
4138
|
-
var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source
|
|
4148
|
+
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
4149
|
+
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
4139
4150
|
function createLocation(start, end) {
|
|
4140
4151
|
return { start: start, end: end };
|
|
4141
4152
|
}
|
|
@@ -4382,7 +4393,7 @@ var Parser = /** @class */ (function () {
|
|
|
4382
4393
|
return {
|
|
4383
4394
|
val: {
|
|
4384
4395
|
type: TYPE.literal,
|
|
4385
|
-
value: "<"
|
|
4396
|
+
value: "<".concat(tagName, "/>"),
|
|
4386
4397
|
location: createLocation(startPosition, this.clonePosition()),
|
|
4387
4398
|
},
|
|
4388
4399
|
err: null,
|
|
@@ -4987,7 +4998,7 @@ var Parser = /** @class */ (function () {
|
|
|
4987
4998
|
}
|
|
4988
4999
|
var code = codePointAt(this.message, offset);
|
|
4989
5000
|
if (code === undefined) {
|
|
4990
|
-
throw Error("Offset "
|
|
5001
|
+
throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
4991
5002
|
}
|
|
4992
5003
|
return code;
|
|
4993
5004
|
};
|
|
@@ -5055,7 +5066,7 @@ var Parser = /** @class */ (function () {
|
|
|
5055
5066
|
*/
|
|
5056
5067
|
Parser.prototype.bumpTo = function (targetOffset) {
|
|
5057
5068
|
if (this.offset() > targetOffset) {
|
|
5058
|
-
throw Error("targetOffset "
|
|
5069
|
+
throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
|
|
5059
5070
|
}
|
|
5060
5071
|
targetOffset = Math.min(targetOffset, this.message.length);
|
|
5061
5072
|
while (true) {
|
|
@@ -5064,7 +5075,7 @@ var Parser = /** @class */ (function () {
|
|
|
5064
5075
|
break;
|
|
5065
5076
|
}
|
|
5066
5077
|
if (offset > targetOffset) {
|
|
5067
|
-
throw Error("targetOffset "
|
|
5078
|
+
throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
|
|
5068
5079
|
}
|
|
5069
5080
|
this.bump();
|
|
5070
5081
|
if (this.isEOF()) {
|
|
@@ -5530,28 +5541,28 @@ var FormatError = /** @class */ (function (_super) {
|
|
|
5530
5541
|
return _this;
|
|
5531
5542
|
}
|
|
5532
5543
|
FormatError.prototype.toString = function () {
|
|
5533
|
-
return "[formatjs Error: "
|
|
5544
|
+
return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
|
|
5534
5545
|
};
|
|
5535
5546
|
return FormatError;
|
|
5536
5547
|
}(Error));
|
|
5537
5548
|
var InvalidValueError = /** @class */ (function (_super) {
|
|
5538
5549
|
__extends(InvalidValueError, _super);
|
|
5539
5550
|
function InvalidValueError(variableId, value, options, originalMessage) {
|
|
5540
|
-
return _super.call(this, "Invalid values for \""
|
|
5551
|
+
return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5541
5552
|
}
|
|
5542
5553
|
return InvalidValueError;
|
|
5543
5554
|
}(FormatError));
|
|
5544
5555
|
var InvalidValueTypeError = /** @class */ (function (_super) {
|
|
5545
5556
|
__extends(InvalidValueTypeError, _super);
|
|
5546
5557
|
function InvalidValueTypeError(value, type, originalMessage) {
|
|
5547
|
-
return _super.call(this, "Value for \""
|
|
5558
|
+
return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5548
5559
|
}
|
|
5549
5560
|
return InvalidValueTypeError;
|
|
5550
5561
|
}(FormatError));
|
|
5551
5562
|
var MissingValueError = /** @class */ (function (_super) {
|
|
5552
5563
|
__extends(MissingValueError, _super);
|
|
5553
5564
|
function MissingValueError(variableId, originalMessage) {
|
|
5554
|
-
return _super.call(this, "The intl string context variable \""
|
|
5565
|
+
return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
5555
5566
|
}
|
|
5556
5567
|
return MissingValueError;
|
|
5557
5568
|
}(FormatError));
|
|
@@ -5712,7 +5723,7 @@ originalMessage) {
|
|
|
5712
5723
|
continue;
|
|
5713
5724
|
}
|
|
5714
5725
|
if (isPluralElement(el)) {
|
|
5715
|
-
var opt = el.options["="
|
|
5726
|
+
var opt = el.options["=".concat(value)];
|
|
5716
5727
|
if (!opt) {
|
|
5717
5728
|
if (!Intl.PluralRules) {
|
|
5718
5729
|
throw new FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", ErrorCode.MISSING_INTL_API, originalMessage);
|
|
@@ -5783,7 +5794,7 @@ function createDefaultFormatters(cache) {
|
|
|
5783
5794
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5784
5795
|
args[_i] = arguments[_i];
|
|
5785
5796
|
}
|
|
5786
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5797
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5787
5798
|
}, {
|
|
5788
5799
|
cache: createFastMemoizeCache$1(cache.number),
|
|
5789
5800
|
strategy: strategies.variadic,
|
|
@@ -5794,7 +5805,7 @@ function createDefaultFormatters(cache) {
|
|
|
5794
5805
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5795
5806
|
args[_i] = arguments[_i];
|
|
5796
5807
|
}
|
|
5797
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5808
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5798
5809
|
}, {
|
|
5799
5810
|
cache: createFastMemoizeCache$1(cache.dateTime),
|
|
5800
5811
|
strategy: strategies.variadic,
|
|
@@ -5805,7 +5816,7 @@ function createDefaultFormatters(cache) {
|
|
|
5805
5816
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5806
5817
|
args[_i] = arguments[_i];
|
|
5807
5818
|
}
|
|
5808
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5819
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5809
5820
|
}, {
|
|
5810
5821
|
cache: createFastMemoizeCache$1(cache.pluralRules),
|
|
5811
5822
|
strategy: strategies.variadic,
|
|
@@ -5963,7 +5974,13 @@ var IntlErrorCode;
|
|
|
5963
5974
|
var IntlError = /** @class */ (function (_super) {
|
|
5964
5975
|
__extends(IntlError, _super);
|
|
5965
5976
|
function IntlError(code, message, exception) {
|
|
5966
|
-
var _this =
|
|
5977
|
+
var _this = this;
|
|
5978
|
+
var err = exception
|
|
5979
|
+
? exception instanceof Error
|
|
5980
|
+
? exception
|
|
5981
|
+
: new Error(String(exception))
|
|
5982
|
+
: undefined;
|
|
5983
|
+
_this = _super.call(this, "[@formatjs/intl Error ".concat(code, "] ").concat(message, " \n").concat(err ? "\n".concat(err.message, "\n").concat(err.stack) : '')) || this;
|
|
5967
5984
|
_this.code = code;
|
|
5968
5985
|
// @ts-ignore just so we don't need to declare dep on @types/node
|
|
5969
5986
|
if (typeof Error.captureStackTrace === 'function') {
|
|
@@ -5995,19 +6012,26 @@ var MissingDataError = /** @class */ (function (_super) {
|
|
|
5995
6012
|
}
|
|
5996
6013
|
return MissingDataError;
|
|
5997
6014
|
}(IntlError));
|
|
6015
|
+
var IntlFormatError = /** @class */ (function (_super) {
|
|
6016
|
+
__extends(IntlFormatError, _super);
|
|
6017
|
+
function IntlFormatError(message, locale, exception) {
|
|
6018
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, " \nLocale: ").concat(locale, "\n"), exception) || this;
|
|
6019
|
+
}
|
|
6020
|
+
return IntlFormatError;
|
|
6021
|
+
}(IntlError));
|
|
5998
6022
|
var MessageFormatError = /** @class */ (function (_super) {
|
|
5999
6023
|
__extends(MessageFormatError, _super);
|
|
6000
6024
|
function MessageFormatError(message, locale, descriptor, exception) {
|
|
6001
|
-
var _this = _super.call(this,
|
|
6025
|
+
var _this = _super.call(this, "".concat(message, " \nMessageID: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, "\nDefault Message: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage, "\nDescription: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.description, " \n"), locale, exception) || this;
|
|
6002
6026
|
_this.descriptor = descriptor;
|
|
6003
6027
|
return _this;
|
|
6004
6028
|
}
|
|
6005
6029
|
return MessageFormatError;
|
|
6006
|
-
}(
|
|
6030
|
+
}(IntlFormatError));
|
|
6007
6031
|
var MissingTranslationError = /** @class */ (function (_super) {
|
|
6008
6032
|
__extends(MissingTranslationError, _super);
|
|
6009
6033
|
function MissingTranslationError(descriptor, locale) {
|
|
6010
|
-
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \""
|
|
6034
|
+
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"".concat(descriptor.id, "\" for locale \"").concat(locale, "\", using ").concat(descriptor.defaultMessage ? 'default message' : 'id', " as fallback.")) || this;
|
|
6011
6035
|
_this.descriptor = descriptor;
|
|
6012
6036
|
return _this;
|
|
6013
6037
|
}
|
|
@@ -6034,6 +6058,7 @@ var DEFAULT_INTL_CONFIG = {
|
|
|
6034
6058
|
timeZone: undefined,
|
|
6035
6059
|
defaultLocale: 'en',
|
|
6036
6060
|
defaultFormats: {},
|
|
6061
|
+
fallbackOnEmptyString: true,
|
|
6037
6062
|
onError: defaultErrorHandler,
|
|
6038
6063
|
};
|
|
6039
6064
|
function createIntlCache() {
|
|
@@ -6076,7 +6101,7 @@ function createFormatters(cache) {
|
|
|
6076
6101
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6077
6102
|
args[_i] = arguments[_i];
|
|
6078
6103
|
}
|
|
6079
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6104
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6080
6105
|
}, {
|
|
6081
6106
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
6082
6107
|
strategy: strategies.variadic,
|
|
@@ -6087,7 +6112,7 @@ function createFormatters(cache) {
|
|
|
6087
6112
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6088
6113
|
args[_i] = arguments[_i];
|
|
6089
6114
|
}
|
|
6090
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6115
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6091
6116
|
}, {
|
|
6092
6117
|
cache: createFastMemoizeCache(cache.number),
|
|
6093
6118
|
strategy: strategies.variadic,
|
|
@@ -6098,7 +6123,7 @@ function createFormatters(cache) {
|
|
|
6098
6123
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6099
6124
|
args[_i] = arguments[_i];
|
|
6100
6125
|
}
|
|
6101
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6126
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6102
6127
|
}, {
|
|
6103
6128
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
6104
6129
|
strategy: strategies.variadic,
|
|
@@ -6121,7 +6146,7 @@ function createFormatters(cache) {
|
|
|
6121
6146
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6122
6147
|
args[_i] = arguments[_i];
|
|
6123
6148
|
}
|
|
6124
|
-
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args)))();
|
|
6149
|
+
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();
|
|
6125
6150
|
}, {
|
|
6126
6151
|
cache: createFastMemoizeCache(cache.relativeTime),
|
|
6127
6152
|
strategy: strategies.variadic,
|
|
@@ -6132,7 +6157,7 @@ function createFormatters(cache) {
|
|
|
6132
6157
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6133
6158
|
args[_i] = arguments[_i];
|
|
6134
6159
|
}
|
|
6135
|
-
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args)))();
|
|
6160
|
+
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();
|
|
6136
6161
|
}, {
|
|
6137
6162
|
cache: createFastMemoizeCache(cache.list),
|
|
6138
6163
|
strategy: strategies.variadic,
|
|
@@ -6142,7 +6167,7 @@ function createFormatters(cache) {
|
|
|
6142
6167
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6143
6168
|
args[_i] = arguments[_i];
|
|
6144
6169
|
}
|
|
6145
|
-
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args)))();
|
|
6170
|
+
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();
|
|
6146
6171
|
}, {
|
|
6147
6172
|
cache: createFastMemoizeCache(cache.displayNames),
|
|
6148
6173
|
strategy: strategies.variadic,
|
|
@@ -6158,7 +6183,7 @@ function getNamedFormat(formats, type, name, onError) {
|
|
|
6158
6183
|
if (format) {
|
|
6159
6184
|
return format;
|
|
6160
6185
|
}
|
|
6161
|
-
onError(new UnsupportedFormatterError("No "
|
|
6186
|
+
onError(new UnsupportedFormatterError("No ".concat(type, " format named: ").concat(name)));
|
|
6162
6187
|
}
|
|
6163
6188
|
|
|
6164
6189
|
/**
|
|
@@ -6193,7 +6218,7 @@ function deepMergeFormatsAndSetTimeZone(f1, timeZone) {
|
|
|
6193
6218
|
return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
|
|
6194
6219
|
}
|
|
6195
6220
|
function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
6196
|
-
var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
|
|
6221
|
+
var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, fallbackOnEmptyString = _a.fallbackOnEmptyString, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
|
|
6197
6222
|
if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }
|
|
6198
6223
|
var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
|
|
6199
6224
|
// `id` is a required field of a Message Descriptor.
|
|
@@ -6223,6 +6248,9 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6223
6248
|
formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
|
|
6224
6249
|
defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
|
|
6225
6250
|
if (!message) {
|
|
6251
|
+
if (fallbackOnEmptyString === false && message === '') {
|
|
6252
|
+
return message;
|
|
6253
|
+
}
|
|
6226
6254
|
if (!defaultMessage ||
|
|
6227
6255
|
(locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {
|
|
6228
6256
|
// This prevents warnings from littering the console in development
|
|
@@ -6236,7 +6264,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6236
6264
|
return formatter.format(values);
|
|
6237
6265
|
}
|
|
6238
6266
|
catch (e) {
|
|
6239
|
-
onError(new MessageFormatError("Error formatting default message for: \""
|
|
6267
|
+
onError(new MessageFormatError("Error formatting default message for: \"".concat(id, "\", rendering default message verbatim"), locale, messageDescriptor, e));
|
|
6240
6268
|
return typeof defaultMessage === 'string' ? defaultMessage : id;
|
|
6241
6269
|
}
|
|
6242
6270
|
}
|
|
@@ -6248,7 +6276,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6248
6276
|
return formatter.format(values);
|
|
6249
6277
|
}
|
|
6250
6278
|
catch (e) {
|
|
6251
|
-
onError(new MessageFormatError("Error formatting message: \""
|
|
6279
|
+
onError(new MessageFormatError("Error formatting message: \"".concat(id, "\", using ").concat(defaultMessage ? 'default message' : 'id', " as fallback."), locale, messageDescriptor, e));
|
|
6252
6280
|
}
|
|
6253
6281
|
if (defaultMessage) {
|
|
6254
6282
|
try {
|
|
@@ -6256,7 +6284,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6256
6284
|
return formatter.format(values);
|
|
6257
6285
|
}
|
|
6258
6286
|
catch (e) {
|
|
6259
|
-
onError(new MessageFormatError("Error formatting the default message for: \""
|
|
6287
|
+
onError(new MessageFormatError("Error formatting the default message for: \"".concat(id, "\", rendering message verbatim"), locale, messageDescriptor, e));
|
|
6260
6288
|
}
|
|
6261
6289
|
}
|
|
6262
6290
|
if (typeof message === 'string') {
|
|
@@ -6294,9 +6322,7 @@ function getFormatter$2(_a, type, getDateTimeFormat, options) {
|
|
|
6294
6322
|
if (options === void 0) { options = {}; }
|
|
6295
6323
|
var format = options.format;
|
|
6296
6324
|
var defaults = __assign(__assign({}, (timeZone && { timeZone: timeZone })), (format && getNamedFormat(formats, type, format, onError)));
|
|
6297
|
-
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS,
|
|
6298
|
-
// @ts-expect-error es2020 has a lot stuff from es2021 bleed in
|
|
6299
|
-
defaults);
|
|
6325
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);
|
|
6300
6326
|
if (type === 'time' &&
|
|
6301
6327
|
!filteredOptions.hour &&
|
|
6302
6328
|
!filteredOptions.minute &&
|
|
@@ -6413,7 +6439,7 @@ var LIST_FORMAT_OPTIONS = [
|
|
|
6413
6439
|
];
|
|
6414
6440
|
var now = Date.now();
|
|
6415
6441
|
function generateToken(i) {
|
|
6416
|
-
return now
|
|
6442
|
+
return "".concat(now, "_").concat(i, "_").concat(now);
|
|
6417
6443
|
}
|
|
6418
6444
|
function formatList(opts, getListFormat, values, options) {
|
|
6419
6445
|
if (options === void 0) { options = {}; }
|
|
@@ -6480,7 +6506,7 @@ function formatPlural(_a, getPluralRules, value, options) {
|
|
|
6480
6506
|
return getPluralRules(locale, filteredOptions).select(value);
|
|
6481
6507
|
}
|
|
6482
6508
|
catch (e) {
|
|
6483
|
-
onError(new
|
|
6509
|
+
onError(new IntlFormatError('Error formatting plural.', locale, e));
|
|
6484
6510
|
}
|
|
6485
6511
|
return 'other';
|
|
6486
6512
|
}
|
|
@@ -6507,7 +6533,7 @@ function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options)
|
|
|
6507
6533
|
return getFormatter$1(config, getRelativeTimeFormat, options).format(value, unit);
|
|
6508
6534
|
}
|
|
6509
6535
|
catch (e) {
|
|
6510
|
-
config.onError(new
|
|
6536
|
+
config.onError(new IntlFormatError('Error formatting relative time.', config.locale, e));
|
|
6511
6537
|
}
|
|
6512
6538
|
return String(value);
|
|
6513
6539
|
}
|
|
@@ -6587,7 +6613,7 @@ function createIntl(config, cache) {
|
|
|
6587
6613
|
var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
|
|
6588
6614
|
if (!locale) {
|
|
6589
6615
|
if (onError) {
|
|
6590
|
-
onError(new InvalidConfigError("\"locale\" was not configured, using \""
|
|
6616
|
+
onError(new InvalidConfigError("\"locale\" was not configured, using \"".concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details")));
|
|
6591
6617
|
}
|
|
6592
6618
|
// Since there's no registered locale data for `locale`, this will
|
|
6593
6619
|
// fallback to the `defaultLocale` to make sure things can render.
|
|
@@ -6597,11 +6623,11 @@ function createIntl(config, cache) {
|
|
|
6597
6623
|
resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
|
|
6598
6624
|
}
|
|
6599
6625
|
else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
|
|
6600
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6626
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.NumberFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
6601
6627
|
}
|
|
6602
6628
|
else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
|
|
6603
6629
|
onError) {
|
|
6604
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6630
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.DateTimeFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
6605
6631
|
}
|
|
6606
6632
|
verifyConfigMessages(resolvedConfig);
|
|
6607
6633
|
return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
|
|
@@ -369,7 +369,6 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
369
369
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
370
370
|
if (memberName === 'list') {
|
|
371
371
|
isProp = false;
|
|
372
|
-
// tslint:disable-next-line: triple-equals
|
|
373
372
|
}
|
|
374
373
|
else if (oldValue == null || elm[memberName] != n) {
|
|
375
374
|
elm[memberName] = n;
|
|
@@ -909,6 +908,29 @@ const then = (promise, thenFn) => {
|
|
|
909
908
|
};
|
|
910
909
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
911
910
|
;
|
|
911
|
+
/**
|
|
912
|
+
* Parse a new property value for a given property type.
|
|
913
|
+
*
|
|
914
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
915
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
916
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
917
|
+
* 2. the type stored from `propType`.
|
|
918
|
+
*
|
|
919
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
920
|
+
*
|
|
921
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
922
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
923
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
924
|
+
* ```tsx
|
|
925
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
926
|
+
* ```
|
|
927
|
+
*
|
|
928
|
+
* HTML prop values on the other hand, will always a string
|
|
929
|
+
*
|
|
930
|
+
* @param propValue the new value to coerce to some type
|
|
931
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
932
|
+
* @returns the parsed/coerced value
|
|
933
|
+
*/
|
|
912
934
|
const parsePropertyValue = (propValue, propType) => {
|
|
913
935
|
// ensure this value is of the correct prop type
|
|
914
936
|
if (propValue != null && !isComplexType(propValue)) {
|
|
@@ -1014,14 +1036,14 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1014
1036
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1015
1037
|
plt.jmp(() => {
|
|
1016
1038
|
const propName = attrNameToPropName.get(attrName);
|
|
1017
|
-
// In a
|
|
1039
|
+
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
|
1018
1040
|
// in the case where an attribute was set inline.
|
|
1019
1041
|
// ```html
|
|
1020
1042
|
// <my-component some-attribute="some-value"></my-component>
|
|
1021
1043
|
// ```
|
|
1022
1044
|
//
|
|
1023
|
-
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
|
1024
|
-
// changes it before it has been upgraded as shown below:
|
|
1045
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
|
1046
|
+
// programmatically changes it before it has been upgraded as shown below:
|
|
1025
1047
|
//
|
|
1026
1048
|
// ```html
|
|
1027
1049
|
// <!-- this component has _not_ been upgraded yet -->
|
|
@@ -1031,13 +1053,13 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1031
1053
|
// el = document.querySelector("#test");
|
|
1032
1054
|
// el.someAttribute = "another-value";
|
|
1033
1055
|
// // upgrade component
|
|
1034
|
-
//
|
|
1056
|
+
// customElements.define('my-component', MyComponent);
|
|
1035
1057
|
// </script>
|
|
1036
1058
|
// ```
|
|
1037
1059
|
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1038
1060
|
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1039
1061
|
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1040
|
-
// the connectedCallback attempts to unshadow it will use "some-value" as the
|
|
1062
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
|
|
1041
1063
|
//
|
|
1042
1064
|
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1043
1065
|
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
@@ -1051,6 +1073,14 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1051
1073
|
newValue = this[propName];
|
|
1052
1074
|
delete this[propName];
|
|
1053
1075
|
}
|
|
1076
|
+
else if (prototype.hasOwnProperty(propName) &&
|
|
1077
|
+
typeof this[propName] === 'number' &&
|
|
1078
|
+
this[propName] == newValue) {
|
|
1079
|
+
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
|
1080
|
+
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
|
1081
|
+
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1054
1084
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1055
1085
|
});
|
|
1056
1086
|
};
|
|
@@ -1136,7 +1166,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1136
1166
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1137
1167
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1138
1168
|
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1139
|
-
// this is the
|
|
1169
|
+
// this is the initial load and this component it has an ancestor component
|
|
1140
1170
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1141
1171
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
1142
1172
|
// this will get fired off when the ancestor component
|
|
@@ -1219,71 +1249,73 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1219
1249
|
let isBootstrapping = true;
|
|
1220
1250
|
Object.assign(plt, options);
|
|
1221
1251
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1222
|
-
lazyBundles.map((lazyBundle) =>
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1252
|
+
lazyBundles.map((lazyBundle) => {
|
|
1253
|
+
lazyBundle[1].map((compactMeta) => {
|
|
1254
|
+
const cmpMeta = {
|
|
1255
|
+
$flags$: compactMeta[0],
|
|
1256
|
+
$tagName$: compactMeta[1],
|
|
1257
|
+
$members$: compactMeta[2],
|
|
1258
|
+
$listeners$: compactMeta[3],
|
|
1259
|
+
};
|
|
1260
|
+
{
|
|
1261
|
+
cmpMeta.$members$ = compactMeta[2];
|
|
1262
|
+
}
|
|
1263
|
+
{
|
|
1264
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
|
1265
|
+
}
|
|
1266
|
+
{
|
|
1267
|
+
cmpMeta.$attrsToReflect$ = [];
|
|
1268
|
+
}
|
|
1269
|
+
{
|
|
1270
|
+
cmpMeta.$watchers$ = {};
|
|
1271
|
+
}
|
|
1272
|
+
const tagName = cmpMeta.$tagName$;
|
|
1273
|
+
const HostElement = class extends HTMLElement {
|
|
1274
|
+
// StencilLazyHost
|
|
1275
|
+
constructor(self) {
|
|
1276
|
+
// @ts-ignore
|
|
1277
|
+
super(self);
|
|
1278
|
+
self = this;
|
|
1279
|
+
registerHost(self, cmpMeta);
|
|
1280
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1281
|
+
// this component is using shadow dom
|
|
1282
|
+
// and this browser supports shadow dom
|
|
1283
|
+
// add the read-only property "shadowRoot" to the host element
|
|
1284
|
+
// adding the shadow root build conditionals to minimize runtime
|
|
1255
1285
|
{
|
|
1256
|
-
|
|
1286
|
+
{
|
|
1287
|
+
self.attachShadow({ mode: 'open' });
|
|
1288
|
+
}
|
|
1257
1289
|
}
|
|
1258
1290
|
}
|
|
1259
1291
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1292
|
+
connectedCallback() {
|
|
1293
|
+
if (appLoadFallback) {
|
|
1294
|
+
clearTimeout(appLoadFallback);
|
|
1295
|
+
appLoadFallback = null;
|
|
1296
|
+
}
|
|
1297
|
+
if (isBootstrapping) {
|
|
1298
|
+
// connectedCallback will be processed once all components have been registered
|
|
1299
|
+
deferredConnectedCallbacks.push(this);
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
plt.jmp(() => connectedCallback(this));
|
|
1303
|
+
}
|
|
1265
1304
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
deferredConnectedCallbacks.push(this);
|
|
1305
|
+
disconnectedCallback() {
|
|
1306
|
+
plt.jmp(() => disconnectedCallback(this));
|
|
1269
1307
|
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1308
|
+
componentOnReady() {
|
|
1309
|
+
return getHostRef(this).$onReadyPromise$;
|
|
1272
1310
|
}
|
|
1311
|
+
};
|
|
1312
|
+
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1313
|
+
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1314
|
+
cmpTags.push(tagName);
|
|
1315
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1273
1316
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1277
|
-
componentOnReady() {
|
|
1278
|
-
return getHostRef(this).$onReadyPromise$;
|
|
1279
|
-
}
|
|
1280
|
-
};
|
|
1281
|
-
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1282
|
-
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1283
|
-
cmpTags.push(tagName);
|
|
1284
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1285
|
-
}
|
|
1286
|
-
}));
|
|
1317
|
+
});
|
|
1318
|
+
});
|
|
1287
1319
|
{
|
|
1288
1320
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1289
1321
|
visibilityStyle.setAttribute('data-styles', '');
|