@wavemaker/foundation-css 11.15.1-rc.248 → 11.15.2-rc.249
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/cjs/foundation-css.cjs +1260 -12
- package/cjs/src_tokens_mobile_components_accordion-pane_accordion-pane_json.foundation-css.cjs +14 -0
- package/cjs/src_tokens_mobile_components_accordion_accordion_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_anchor_anchor_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_barcodescanner_barcodescanner_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_bottomsheet_bottomsheet_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_button_button_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_calendar_calendar_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_camera_camera_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_cards_cards_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_carousel_carousel_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_checkboxset_checkboxset_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_chips_chips_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_container_container_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_currency_currency_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_dropdown-menu_dropdown-menu_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_form-controls_form-controls_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_form-wrapper_form-wrapper_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_label_label_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_list_list_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_login_login_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_lottie_lottie_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_message_message_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_modal-dialog_modal-dialog_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_nav_nav_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_navbar_navbar_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_navitem_navitem_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_page-left-nav_page-left-nav_json.foundation-css.cjs +14 -0
- package/cjs/src_tokens_mobile_components_panel_panel_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_partial-container_partial-container_json.foundation-css.cjs +14 -0
- package/cjs/src_tokens_mobile_components_picture_picture_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_popover_popover_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_progress-bar_progress-bar_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_radioset_radioset_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_rating_rating_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_search_search_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_select_select_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_spinner_spinner_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_switch_switch_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_tabbar_tabbar_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_tabs_tabs_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_tile_tile_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_webview_webview_json.foundation-css.cjs +1 -1
- package/cjs/src_tokens_mobile_components_wizard_wizard_json.foundation-css.cjs +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/native_mobile.index.d.ts +17 -0
- package/native_mobile.index.js +17 -5
- package/native_mobile.index.js.map +1 -1
- package/npm-shrinkwrap.json +95 -117
- package/package-lock.json +95 -117
- package/package.json +13 -4
- package/src/node/index.d.ts +1 -0
- package/src/node/index.js +2 -0
- package/src/node/index.js.map +1 -0
- package/src/styles/mobile/components/advanced/carousel.less +6 -12
- package/src/styles/mobile/components/advanced/login.less +1 -4
- package/src/styles/mobile/components/advanced/webview.less +1 -4
- package/src/styles/mobile/components/basic/anchor.less +2 -2
- package/src/styles/mobile/components/basic/bottomsheet.less +5 -12
- package/src/styles/mobile/components/basic/button.less +3 -12
- package/src/styles/mobile/components/basic/buttongroup.less +3 -12
- package/src/styles/mobile/components/basic/label.less +7 -4
- package/src/styles/mobile/components/basic/lottie.less +7 -4
- package/src/styles/mobile/components/basic/message.less +6 -10
- package/src/styles/mobile/components/basic/picture.less +4 -16
- package/src/styles/mobile/components/basic/progress-bar.less +0 -1
- package/src/styles/mobile/components/basic/search.less +5 -20
- package/src/styles/mobile/components/basic/spinner.less +1 -1
- package/src/styles/mobile/components/container/accordion/accordionpane.less +6 -0
- package/src/styles/mobile/components/container/accordion.less +35 -3
- package/src/styles/mobile/components/container/panel.less +0 -5
- package/src/styles/mobile/components/container/tabs/tab-header.less +14 -3
- package/src/styles/mobile/components/container/tile.less +1 -4
- package/src/styles/mobile/components/container/wizard.less +3 -9
- package/src/styles/mobile/components/container.less +8 -32
- package/src/styles/mobile/components/data/card.less +1 -4
- package/src/styles/mobile/components/data/form.less +143 -37
- package/src/styles/mobile/components/data/list.less +1 -4
- package/src/styles/mobile/components/device/barcodescanner.less +2 -5
- package/src/styles/mobile/components/device/camera.less +1 -4
- package/src/styles/mobile/components/dialogs/dialog.less +17 -4
- package/src/styles/mobile/components/input/calendar.less +46 -38
- package/src/styles/mobile/components/input/checkboxset.less +1 -2
- package/src/styles/mobile/components/input/chips.less +8 -19
- package/src/styles/mobile/components/input/currency.less +14 -17
- package/src/styles/mobile/components/input/radioset.less +1 -2
- package/src/styles/mobile/components/input/rating.less +1 -1
- package/src/styles/mobile/components/input/select.less +26 -64
- package/src/styles/mobile/components/input/switch.less +1 -2
- package/src/styles/mobile/components/input/toggle.less +1 -1
- package/src/styles/mobile/components/navigation/appnavbar.less +11 -15
- package/src/styles/mobile/components/navigation/menu.less +3 -11
- package/src/styles/mobile/components/navigation/popover.less +22 -15
- package/src/styles/mobile/components/page/left-panel.less +0 -1
- package/src/styles/mobile/components/page/partial-container.less +1 -0
- package/src/styles/mobile/components/page/tabbar.less +9 -8
- package/src/styles/mobile/components/tokens.dark.css +25 -9
- package/src/styles/mobile/components/tokens.light.css +198 -241
- package/src/styles/mobile/components/variables/accordion.variant.less +4 -0
- package/src/styles/mobile/components/variables/button.variant.less +19 -79
- package/src/styles/mobile/components/variables/carousel.variant.less +2 -3
- package/src/styles/mobile/components/variables/container.variant.less +6 -24
- package/src/styles/mobile/components/variables/form-controls.variant.less +9 -8
- package/src/styles/mobile/components/variables/picture.variant.less +3 -12
- package/src/styles/mobile/components/variables/tabbar.variant.less +1 -0
- package/src/styles/mobile/components/variables/tabs.variant.less +7 -0
- package/src/styles/mobile/studio/advanced/carousel.less +4 -2
- package/src/styles/mobile/studio/advanced/login.less +1 -4
- package/src/styles/mobile/studio/advanced/webview.less +1 -4
- package/src/styles/mobile/studio/basic/label.less +0 -8
- package/src/styles/mobile/studio/basic/message.less +1 -2
- package/src/styles/mobile/studio/container/accordion.less +1 -4
- package/src/styles/mobile/studio/container/container.less +2 -8
- package/src/styles/mobile/studio/container/tabs.less +10 -2
- package/src/styles/mobile/studio/data/card.less +1 -1
- package/src/styles/mobile/studio/device/barcode.less +2 -8
- package/src/styles/mobile/studio/input/calendar.less +66 -6
- package/src/styles/mobile/studio/input/checkboxset.less +21 -6
- package/src/styles/mobile/studio/input/currency.less +9 -1
- package/src/styles/mobile/studio/input/form.less +10 -40
- package/src/styles/mobile/studio/input/rating.less +1 -1
- package/src/styles/mobile/studio/input/select.less +33 -0
- package/src/styles/mobile/studio/input/toggle.less +3 -2
- package/src/styles/mobile/studio/layouts/tabbar.less +4 -5
- package/src/styles/mobile/studio/navigation/nav.less +0 -17
- package/src/styles/mobile/studio/navigation/popover.less +2 -5
- package/src/token-validation/component-token-schema.d.ts +169 -0
- package/src/token-validation/component-token-schema.js +146 -0
- package/src/token-validation/component-token-schema.js.map +1 -0
- package/src/token-validation/constants.d.ts +41 -0
- package/src/token-validation/constants.js +54 -0
- package/src/token-validation/constants.js.map +1 -0
- package/src/token-validation/global-token-schema.d.ts +37 -0
- package/src/token-validation/global-token-schema.js +41 -0
- package/src/token-validation/global-token-schema.js.map +1 -0
- package/src/token-validation/validate-token.d.ts +72 -0
- package/src/token-validation/validate-token.js +939 -0
- package/src/token-validation/validate-token.js.map +1 -0
- package/src/token-validation/validate-value.d.ts +13 -0
- package/src/token-validation/validate-value.js +57 -0
- package/src/token-validation/validate-value.js.map +1 -0
- package/src/token-validation/validator-utils/common/constants.d.ts +172 -0
- package/src/token-validation/validator-utils/common/constants.js +258 -0
- package/src/token-validation/validator-utils/common/constants.js.map +1 -0
- package/src/token-validation/validator-utils/common/primitives.d.ts +14 -0
- package/src/token-validation/validator-utils/common/primitives.js +35 -0
- package/src/token-validation/validator-utils/common/primitives.js.map +1 -0
- package/src/token-validation/validator-utils/common/utils.d.ts +152 -0
- package/src/token-validation/validator-utils/common/utils.js +316 -0
- package/src/token-validation/validator-utils/common/utils.js.map +1 -0
- package/src/token-validation/validator-utils/native_mobile.d.ts +1 -0
- package/src/token-validation/validator-utils/native_mobile.js +120 -0
- package/src/token-validation/validator-utils/native_mobile.js.map +1 -0
- package/src/token-validation/validator-utils/web.d.ts +1 -0
- package/src/token-validation/validator-utils/web.js +72 -0
- package/src/token-validation/validator-utils/web.js.map +1 -0
- package/src/tokens/mobile/components/accordion/accordion.json +172 -4
- package/src/tokens/mobile/components/accordion-pane/accordion-pane.json +65 -0
- package/src/tokens/mobile/components/anchor/anchor.json +5 -15
- package/src/tokens/mobile/components/barcodescanner/barcodescanner.json +10 -38
- package/src/tokens/mobile/components/bottomsheet/bottomsheet.json +28 -92
- package/src/tokens/mobile/components/button/button.json +24 -121
- package/src/tokens/mobile/components/calendar/calendar.json +262 -158
- package/src/tokens/mobile/components/camera/camera.json +5 -31
- package/src/tokens/mobile/components/cards/cards.json +1 -27
- package/src/tokens/mobile/components/carousel/carousel.json +25 -69
- package/src/tokens/mobile/components/checkboxset/checkboxset.json +6 -16
- package/src/tokens/mobile/components/chips/chips.json +8 -80
- package/src/tokens/mobile/components/container/container.json +22 -158
- package/src/tokens/mobile/components/currency/currency.json +89 -5
- package/src/tokens/mobile/components/dropdown-menu/dropdown-menu.json +15 -87
- package/src/tokens/mobile/components/form-controls/form-controls.json +140 -142
- package/src/tokens/mobile/components/form-wrapper/form-wrapper.json +0 -8
- package/src/tokens/mobile/components/label/label.json +0 -34
- package/src/tokens/mobile/components/list/list.json +5 -31
- package/src/tokens/mobile/components/login/login.json +5 -31
- package/src/tokens/mobile/components/lottie/lottie.json +23 -29
- package/src/tokens/mobile/components/message/message.json +37 -61
- package/src/tokens/mobile/components/modal-dialog/modal-dialog.json +54 -8
- package/src/tokens/mobile/components/nav/nav.json +1 -48
- package/src/tokens/mobile/components/navbar/navbar.json +61 -95
- package/src/tokens/mobile/components/navitem/navitem.json +4 -4
- package/src/tokens/mobile/components/{left-nav/left-nav.json → page-left-nav/page-left-nav.json} +1 -9
- package/src/tokens/mobile/components/panel/panel.json +0 -10
- package/src/tokens/mobile/components/partial-container/partial-container.json +23 -0
- package/src/tokens/mobile/components/picture/picture.json +9 -63
- package/src/tokens/mobile/components/popover/popover.json +105 -97
- package/src/tokens/mobile/components/progress-bar/progress-bar.json +0 -8
- package/src/tokens/mobile/components/radioset/radioset.json +5 -15
- package/src/tokens/mobile/components/rating/rating.json +5 -7
- package/src/tokens/mobile/components/search/search.json +25 -155
- package/src/tokens/mobile/components/select/select.json +223 -165
- package/src/tokens/mobile/components/spinner/spinner.json +5 -7
- package/src/tokens/mobile/components/switch/switch.json +5 -15
- package/src/tokens/mobile/components/tabbar/tabbar.json +48 -54
- package/src/tokens/mobile/components/tabs/tabs.json +113 -5
- package/src/tokens/mobile/components/tile/tile.json +5 -31
- package/src/tokens/mobile/components/webview/webview.json +5 -31
- package/src/tokens/mobile/components/wizard/wizard.json +8 -56
- package/cjs/src_tokens_mobile_components_left-nav_left-nav_json.foundation-css.cjs +0 -14
- package/src/styles/mobile/components/input/epoch/date.less +0 -44
- package/src/styles/mobile/components/input/epoch/datetime.less +0 -38
- package/src/styles/mobile/components/input/epoch/time.less +0 -38
- package/src/styles/mobile/components/input/number.less +0 -40
- package/src/styles/mobile/components/input/text.less +0 -69
- package/src/styles/mobile/components/input/textarea.less +0 -63
- package/src/styles/mobile/components/variables/select.variant.less +0 -3
package/cjs/foundation-css.cjs
CHANGED
|
@@ -74,6 +74,12 @@ const componentsList = {
|
|
|
74
74
|
key: "accordion",
|
|
75
75
|
columnWidth: 5,
|
|
76
76
|
},
|
|
77
|
+
"accordion-pane": {
|
|
78
|
+
widgetTag: "wm-accordionpane",
|
|
79
|
+
key: "accordion-pane",
|
|
80
|
+
columnWidth: 5,
|
|
81
|
+
displayName: "Accordion: Pane"
|
|
82
|
+
},
|
|
77
83
|
anchor: {
|
|
78
84
|
widgetTag: "wm-anchor",
|
|
79
85
|
key: "anchor",
|
|
@@ -193,6 +199,11 @@ const componentsList = {
|
|
|
193
199
|
widgetTag: "wm-login",
|
|
194
200
|
columnWidth: 6,
|
|
195
201
|
},
|
|
202
|
+
select: {
|
|
203
|
+
widgetTag: "wm-select",
|
|
204
|
+
key: "currency",
|
|
205
|
+
columnWidth: 6,
|
|
206
|
+
},
|
|
196
207
|
lottie: {
|
|
197
208
|
key: "lottie",
|
|
198
209
|
widgetTag: "wm-lottie",
|
|
@@ -208,11 +219,12 @@ const componentsList = {
|
|
|
208
219
|
widgetTag: "wm-dialog",
|
|
209
220
|
columnWidth: 6,
|
|
210
221
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
222
|
+
"page-left-nav": {
|
|
223
|
+
widgetTag: "wm-left-panel",
|
|
224
|
+
key: "left-nav",
|
|
225
|
+
columnWidth: 6,
|
|
226
|
+
displayName: "Left Nav"
|
|
227
|
+
},
|
|
216
228
|
navitem: {
|
|
217
229
|
widgetTag: "wm-nav-item",
|
|
218
230
|
key: "navitem",
|
|
@@ -659,6 +671,12 @@ const componentsList = {
|
|
|
659
671
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
660
672
|
|
|
661
673
|
var map = {
|
|
674
|
+
"./accordion-pane/accordion-pane.json": [
|
|
675
|
+
"./src/tokens/mobile/components/accordion-pane/accordion-pane.json",
|
|
676
|
+
[
|
|
677
|
+
"src_tokens_mobile_components_accordion-pane_accordion-pane_json"
|
|
678
|
+
]
|
|
679
|
+
],
|
|
662
680
|
"./accordion/accordion.json": [
|
|
663
681
|
"./src/tokens/mobile/components/accordion/accordion.json",
|
|
664
682
|
[
|
|
@@ -815,12 +833,6 @@ var map = {
|
|
|
815
833
|
"src_tokens_mobile_components_label_label_json"
|
|
816
834
|
]
|
|
817
835
|
],
|
|
818
|
-
"./left-nav/left-nav.json": [
|
|
819
|
-
"./src/tokens/mobile/components/left-nav/left-nav.json",
|
|
820
|
-
[
|
|
821
|
-
"src_tokens_mobile_components_left-nav_left-nav_json"
|
|
822
|
-
]
|
|
823
|
-
],
|
|
824
836
|
"./list/list.json": [
|
|
825
837
|
"./src/tokens/mobile/components/list/list.json",
|
|
826
838
|
[
|
|
@@ -875,6 +887,12 @@ var map = {
|
|
|
875
887
|
"src_tokens_mobile_components_page-content_page-content_json"
|
|
876
888
|
]
|
|
877
889
|
],
|
|
890
|
+
"./page-left-nav/page-left-nav.json": [
|
|
891
|
+
"./src/tokens/mobile/components/page-left-nav/page-left-nav.json",
|
|
892
|
+
[
|
|
893
|
+
"src_tokens_mobile_components_page-left-nav_page-left-nav_json"
|
|
894
|
+
]
|
|
895
|
+
],
|
|
878
896
|
"./panel-footer/panel-footer.json": [
|
|
879
897
|
"./src/tokens/mobile/components/panel-footer/panel-footer.json",
|
|
880
898
|
[
|
|
@@ -887,6 +905,12 @@ var map = {
|
|
|
887
905
|
"src_tokens_mobile_components_panel_panel_json"
|
|
888
906
|
]
|
|
889
907
|
],
|
|
908
|
+
"./partial-container/partial-container.json": [
|
|
909
|
+
"./src/tokens/mobile/components/partial-container/partial-container.json",
|
|
910
|
+
[
|
|
911
|
+
"src_tokens_mobile_components_partial-container_partial-container_json"
|
|
912
|
+
]
|
|
913
|
+
],
|
|
890
914
|
"./picture/picture.json": [
|
|
891
915
|
"./src/tokens/mobile/components/picture/picture.json",
|
|
892
916
|
[
|
|
@@ -2070,6 +2094,7 @@ const { pow, sqrt, PI, cos, sin, atan2 } = Math;
|
|
|
2070
2094
|
alpha /= l;
|
|
2071
2095
|
return new _Color_js__WEBPACK_IMPORTED_MODULE_0__["default"](xyz, mode).alpha(alpha > 0.99999 ? 1 : alpha, true);
|
|
2072
2096
|
});
|
|
2097
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
2073
2098
|
|
|
2074
2099
|
const _average_lrgb = (colors, weights) => {
|
|
2075
2100
|
const l = colors.length;
|
|
@@ -2193,6 +2218,7 @@ const bezier = function (colors) {
|
|
|
2193
2218
|
f.scale = () => (0,_scale_js__WEBPACK_IMPORTED_MODULE_2__["default"])(f);
|
|
2194
2219
|
return f;
|
|
2195
2220
|
});
|
|
2221
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
2196
2222
|
|
|
2197
2223
|
|
|
2198
2224
|
/***/ },
|
|
@@ -2282,6 +2308,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2282
2308
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2283
2309
|
/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
|
|
2284
2310
|
/* harmony export */ });
|
|
2311
|
+
Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
2285
2312
|
/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/index.js */ "./node_modules/chroma-js/src/utils/index.js");
|
|
2286
2313
|
/* harmony import */ var _chroma_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../chroma.js */ "./node_modules/chroma-js/src/chroma.js");
|
|
2287
2314
|
// cubehelix interpolation
|
|
@@ -2407,6 +2434,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2407
2434
|
col1.alpha() + f * (col2.alpha() - col1.alpha())
|
|
2408
2435
|
);
|
|
2409
2436
|
});
|
|
2437
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
2410
2438
|
|
|
2411
2439
|
|
|
2412
2440
|
/***/ },
|
|
@@ -2439,6 +2467,7 @@ const { floor, random } = Math;
|
|
|
2439
2467
|
}
|
|
2440
2468
|
return new _Color_js__WEBPACK_IMPORTED_MODULE_0__["default"](code, 'hex');
|
|
2441
2469
|
});
|
|
2470
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
2442
2471
|
|
|
2443
2472
|
|
|
2444
2473
|
/***/ },
|
|
@@ -2454,6 +2483,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2454
2483
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2455
2484
|
/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
|
|
2456
2485
|
/* harmony export */ });
|
|
2486
|
+
Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
2457
2487
|
/* harmony import */ var _chroma_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../chroma.js */ "./node_modules/chroma-js/src/chroma.js");
|
|
2458
2488
|
/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/index.js */ "./node_modules/chroma-js/src/utils/index.js");
|
|
2459
2489
|
// minimal multi-purpose interface
|
|
@@ -2929,6 +2959,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2929
2959
|
? new _Color_js__WEBPACK_IMPORTED_MODULE_0__["default"]([lbv, sat, hue], m)
|
|
2930
2960
|
: new _Color_js__WEBPACK_IMPORTED_MODULE_0__["default"]([hue, sat, lbv], m);
|
|
2931
2961
|
});
|
|
2962
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
2932
2963
|
|
|
2933
2964
|
|
|
2934
2965
|
/***/ },
|
|
@@ -6657,6 +6688,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6657
6688
|
}
|
|
6658
6689
|
return rgb;
|
|
6659
6690
|
});
|
|
6691
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
6660
6692
|
|
|
6661
6693
|
|
|
6662
6694
|
/***/ },
|
|
@@ -6686,6 +6718,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6686
6718
|
const l2 = b.luminance();
|
|
6687
6719
|
return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
|
|
6688
6720
|
});
|
|
6721
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
6689
6722
|
|
|
6690
6723
|
|
|
6691
6724
|
/***/ },
|
|
@@ -6763,6 +6796,7 @@ const B_exp = 1.414;
|
|
|
6763
6796
|
// scale to 100
|
|
6764
6797
|
return S_apc * 100;
|
|
6765
6798
|
});
|
|
6799
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
6766
6800
|
|
|
6767
6801
|
function lum(r, g, b) {
|
|
6768
6802
|
return (
|
|
@@ -6786,6 +6820,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6786
6820
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6787
6821
|
/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
|
|
6788
6822
|
/* harmony export */ });
|
|
6823
|
+
Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
6789
6824
|
/* harmony import */ var _Color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Color.js */ "./node_modules/chroma-js/src/Color.js");
|
|
6790
6825
|
|
|
6791
6826
|
const { sqrt, pow, min, max, atan2, abs, cos, sin, exp, PI } = Math;
|
|
@@ -6864,6 +6899,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6864
6899
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6865
6900
|
/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
|
|
6866
6901
|
/* harmony export */ });
|
|
6902
|
+
Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
6867
6903
|
/* harmony import */ var _Color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Color.js */ "./node_modules/chroma-js/src/Color.js");
|
|
6868
6904
|
|
|
6869
6905
|
|
|
@@ -6967,6 +7003,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6967
7003
|
if ((0,_type_js__WEBPACK_IMPORTED_MODULE_0__["default"])(args[l]) == 'string') return args[l].toLowerCase();
|
|
6968
7004
|
return null;
|
|
6969
7005
|
});
|
|
7006
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
6970
7007
|
|
|
6971
7008
|
|
|
6972
7009
|
/***/ },
|
|
@@ -6987,6 +7024,7 @@ const { min, max } = Math;
|
|
|
6987
7024
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((x, low = 0, high = 1) => {
|
|
6988
7025
|
return min(max(low, x), high);
|
|
6989
7026
|
});
|
|
7027
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
6990
7028
|
|
|
6991
7029
|
|
|
6992
7030
|
/***/ },
|
|
@@ -7086,6 +7124,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7086
7124
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7087
7125
|
/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
|
|
7088
7126
|
/* harmony export */ });
|
|
7127
|
+
Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
7089
7128
|
// ported from jQuery's $.type
|
|
7090
7129
|
const classToType = {};
|
|
7091
7130
|
for (let name of [
|
|
@@ -7137,6 +7176,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7137
7176
|
// (which we suppose is an array of args)
|
|
7138
7177
|
return args[0].slice(0);
|
|
7139
7178
|
});
|
|
7179
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
7140
7180
|
|
|
7141
7181
|
|
|
7142
7182
|
/***/ },
|
|
@@ -7164,6 +7204,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7164
7204
|
return false;
|
|
7165
7205
|
}
|
|
7166
7206
|
});
|
|
7207
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
7167
7208
|
|
|
7168
7209
|
|
|
7169
7210
|
/***/ },
|
|
@@ -7183,6 +7224,1210 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7183
7224
|
const version = '3.2.0';
|
|
7184
7225
|
|
|
7185
7226
|
|
|
7227
|
+
/***/ },
|
|
7228
|
+
|
|
7229
|
+
/***/ "./src/token-validation/constants.js"
|
|
7230
|
+
/*!*******************************************!*\
|
|
7231
|
+
!*** ./src/token-validation/constants.js ***!
|
|
7232
|
+
\*******************************************/
|
|
7233
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7234
|
+
|
|
7235
|
+
"use strict";
|
|
7236
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7237
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7238
|
+
/* harmony export */ ALLOWED_PROPERTIES_BY_CONTEXT: () => (/* binding */ ALLOWED_PROPERTIES_BY_CONTEXT),
|
|
7239
|
+
/* harmony export */ ERROR_TYPES: () => (/* binding */ ERROR_TYPES),
|
|
7240
|
+
/* harmony export */ FOLDER_TYPE: () => (/* binding */ FOLDER_TYPE),
|
|
7241
|
+
/* harmony export */ PLATFORM: () => (/* binding */ PLATFORM),
|
|
7242
|
+
/* harmony export */ TOKEN_TYPES: () => (/* binding */ TOKEN_TYPES),
|
|
7243
|
+
/* harmony export */ TOKEN_VALUE_TYPES: () => (/* binding */ TOKEN_VALUE_TYPES),
|
|
7244
|
+
/* harmony export */ VALIDATION_RULES: () => (/* binding */ VALIDATION_RULES),
|
|
7245
|
+
/* harmony export */ VALIDATION_SCOPE: () => (/* binding */ VALIDATION_SCOPE),
|
|
7246
|
+
/* harmony export */ VALUE_RELATED_KEYWORDS: () => (/* binding */ VALUE_RELATED_KEYWORDS)
|
|
7247
|
+
/* harmony export */ });
|
|
7248
|
+
const VALIDATION_RULES = {
|
|
7249
|
+
STRUCTURE: "structure", // Enforces component mapping structure via schema (e.g. mapping required)
|
|
7250
|
+
METADATA: "metadata", // Enforces token metadata via schema (type + attributes.subtype/description)
|
|
7251
|
+
REFERENCES: "references", // Enables reference validation logic (refExists keyword)
|
|
7252
|
+
OVERRIDES: "overrides" // Enables override-vs-foundation mapping validation (overrideContext keyword)
|
|
7253
|
+
};
|
|
7254
|
+
|
|
7255
|
+
const ERROR_TYPES = Object.freeze({
|
|
7256
|
+
INVALID_REFERENCE: "reference error",
|
|
7257
|
+
INVALID_FIELD: "invalid field",
|
|
7258
|
+
MISSING_FIELD: "missing field",
|
|
7259
|
+
INVALID_VALUE: "invalid value",
|
|
7260
|
+
INVALID_STRUCTURE: "invalid structure",
|
|
7261
|
+
INVALID_JSON: "invalid json",
|
|
7262
|
+
BUILD_ERROR : "build error"
|
|
7263
|
+
});
|
|
7264
|
+
|
|
7265
|
+
const TOKEN_TYPES = Object.freeze({
|
|
7266
|
+
GLOBAL: "global",
|
|
7267
|
+
COMPONENT: "component"
|
|
7268
|
+
});
|
|
7269
|
+
|
|
7270
|
+
const VALIDATION_SCOPE = Object.freeze({
|
|
7271
|
+
FOUNDATION: "foundation",
|
|
7272
|
+
PROJECT: "project"
|
|
7273
|
+
});
|
|
7274
|
+
|
|
7275
|
+
const FOLDER_TYPE = Object.freeze({
|
|
7276
|
+
WEB : "web",
|
|
7277
|
+
MOBILE: "mobile"
|
|
7278
|
+
})
|
|
7279
|
+
|
|
7280
|
+
const TOKEN_VALUE_TYPES = ["color", "radius", "font", "space"];
|
|
7281
|
+
|
|
7282
|
+
//Defines allowed properties for specific JSON paths to produce contextual error messages for invalid structure validations.
|
|
7283
|
+
const ALLOWED_PROPERTIES_BY_CONTEXT = [
|
|
7284
|
+
{
|
|
7285
|
+
match: path => path && !path.includes("."), // component root
|
|
7286
|
+
allowed: ["meta", "mapping", "appearances"]
|
|
7287
|
+
},
|
|
7288
|
+
{
|
|
7289
|
+
match: path => path.endsWith(".attributes"),
|
|
7290
|
+
allowed: ["subtype", "description"]
|
|
7291
|
+
},
|
|
7292
|
+
{
|
|
7293
|
+
match: path => path.endsWith(".appearances"),
|
|
7294
|
+
allowed: ["mapping", "states", "variantGroups"]
|
|
7295
|
+
},
|
|
7296
|
+
{
|
|
7297
|
+
match: path => path.endsWith(".states"),
|
|
7298
|
+
allowed: null // dynamic state names
|
|
7299
|
+
}
|
|
7300
|
+
];
|
|
7301
|
+
|
|
7302
|
+
const VALUE_RELATED_KEYWORDS = new Set(["type", "enum", "const", "minimum", "maximum", "minLength", "maxLength", "pattern"]);
|
|
7303
|
+
|
|
7304
|
+
const PLATFORM = {
|
|
7305
|
+
WEB : "web",
|
|
7306
|
+
MOBILE : "native_mobile",
|
|
7307
|
+
BOTH : "both"
|
|
7308
|
+
}
|
|
7309
|
+
|
|
7310
|
+
|
|
7311
|
+
/***/ },
|
|
7312
|
+
|
|
7313
|
+
/***/ "./src/token-validation/validate-value.js"
|
|
7314
|
+
/*!************************************************!*\
|
|
7315
|
+
!*** ./src/token-validation/validate-value.js ***!
|
|
7316
|
+
\************************************************/
|
|
7317
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7318
|
+
|
|
7319
|
+
"use strict";
|
|
7320
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7321
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7322
|
+
/* harmony export */ "default": () => (/* binding */ validateTokenValue),
|
|
7323
|
+
/* harmony export */ isTokenReference: () => (/* binding */ isTokenReference)
|
|
7324
|
+
/* harmony export */ });
|
|
7325
|
+
/* harmony import */ var _validator_utils_web_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validator-utils/web.js */ "./src/token-validation/validator-utils/web.js");
|
|
7326
|
+
/* harmony import */ var _validator_utils_native_mobile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validator-utils/native_mobile.js */ "./src/token-validation/validator-utils/native_mobile.js");
|
|
7327
|
+
/* harmony import */ var _validator_utils_common_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validator-utils/common/utils.js */ "./src/token-validation/validator-utils/common/utils.js");
|
|
7328
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.js */ "./src/token-validation/constants.js");
|
|
7329
|
+
|
|
7330
|
+
|
|
7331
|
+
|
|
7332
|
+
|
|
7333
|
+
|
|
7334
|
+
|
|
7335
|
+
const RULES_BY_PLATFORM = {
|
|
7336
|
+
[_constants_js__WEBPACK_IMPORTED_MODULE_3__.PLATFORM.MOBILE]: _validator_utils_native_mobile_js__WEBPACK_IMPORTED_MODULE_1__.MOBILE_RULES,
|
|
7337
|
+
[_constants_js__WEBPACK_IMPORTED_MODULE_3__.PLATFORM.WEB]: _validator_utils_web_js__WEBPACK_IMPORTED_MODULE_0__.WEB_VALIDATION_RULES,
|
|
7338
|
+
};
|
|
7339
|
+
|
|
7340
|
+
/**
|
|
7341
|
+
* Validates a value against the rule set for the given platform and subtype.
|
|
7342
|
+
*/
|
|
7343
|
+
function validateValue(value, subtype, platform) {
|
|
7344
|
+
const rules = RULES_BY_PLATFORM[platform];
|
|
7345
|
+
const rule = rules?.[subtype];
|
|
7346
|
+
|
|
7347
|
+
if (!rule?.validate) return (0,_validator_utils_common_utils_js__WEBPACK_IMPORTED_MODULE_2__.createSuccessResponse)();
|
|
7348
|
+
|
|
7349
|
+
const result = rule.validate(value, rule);
|
|
7350
|
+
if (!result.valid) {
|
|
7351
|
+
return (0,_validator_utils_common_utils_js__WEBPACK_IMPORTED_MODULE_2__.createErrorResponse)(subtype, value, (0,_validator_utils_common_utils_js__WEBPACK_IMPORTED_MODULE_2__.getRuleDescription)(rule), platform);
|
|
7352
|
+
}
|
|
7353
|
+
|
|
7354
|
+
return (0,_validator_utils_common_utils_js__WEBPACK_IMPORTED_MODULE_2__.createSuccessResponse)();
|
|
7355
|
+
}
|
|
7356
|
+
|
|
7357
|
+
/**
|
|
7358
|
+
* Validates a token value against platform and subtype rules.
|
|
7359
|
+
*
|
|
7360
|
+
* @param {string|number} value - The raw token value.
|
|
7361
|
+
* @param {string} subtype - e.g. "font-size", "color", "space".
|
|
7362
|
+
* @param {string} platform - "native_mobile" | "web"
|
|
7363
|
+
* @returns {{ valid: boolean, errorObject?: object }}
|
|
7364
|
+
*/
|
|
7365
|
+
function validateTokenValue(value, subtype, platform) {
|
|
7366
|
+
//Remove this for web
|
|
7367
|
+
if(platform !== _constants_js__WEBPACK_IMPORTED_MODULE_3__.PLATFORM.MOBILE) return { valid: true };
|
|
7368
|
+
|
|
7369
|
+
// TODO Handling empty values
|
|
7370
|
+
if (value === undefined || value === null || value === "") return { valid: true };
|
|
7371
|
+
if (isTokenReference(value)) return { valid: true };
|
|
7372
|
+
const normalised = typeof value === "string" ? value.trim() : String(value);
|
|
7373
|
+
return validateValue(normalised, subtype, platform);
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7376
|
+
const isTokenReference = (value) => {
|
|
7377
|
+
//TODO add given token exists from existing implementation
|
|
7378
|
+
if (typeof value !== "string") return false;
|
|
7379
|
+
const referencePlaceholders = value.match(/{[^}]+}/g);
|
|
7380
|
+
if (!referencePlaceholders) return false;
|
|
7381
|
+
return referencePlaceholders.every((referenceExpression) => {
|
|
7382
|
+
const rawReferencePath = referenceExpression.replace(/[{}]/g, "")?.trim();
|
|
7383
|
+
if (!rawReferencePath) return false;
|
|
7384
|
+
return rawReferencePath.endsWith(".value");
|
|
7385
|
+
});
|
|
7386
|
+
};
|
|
7387
|
+
|
|
7388
|
+
|
|
7389
|
+
/***/ },
|
|
7390
|
+
|
|
7391
|
+
/***/ "./src/token-validation/validator-utils/common/constants.js"
|
|
7392
|
+
/*!******************************************************************!*\
|
|
7393
|
+
!*** ./src/token-validation/validator-utils/common/constants.js ***!
|
|
7394
|
+
\******************************************************************/
|
|
7395
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7396
|
+
|
|
7397
|
+
"use strict";
|
|
7398
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7399
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7400
|
+
/* harmony export */ BASE_SUBTYPE_CONFIGS: () => (/* binding */ BASE_SUBTYPE_CONFIGS),
|
|
7401
|
+
/* harmony export */ getPlatformRule: () => (/* binding */ getPlatformRule),
|
|
7402
|
+
/* harmony export */ resolveRuleValidator: () => (/* binding */ resolveRuleValidator)
|
|
7403
|
+
/* harmony export */ });
|
|
7404
|
+
|
|
7405
|
+
// Base validation rule configurations shared across platforms
|
|
7406
|
+
|
|
7407
|
+
//TODO segregation of units
|
|
7408
|
+
const WEB_SIZES = [
|
|
7409
|
+
// Absolute Lengths
|
|
7410
|
+
"px", "cm", "mm", "Q", "in", "pc", "pt",
|
|
7411
|
+
|
|
7412
|
+
// Font-Relative (Local)
|
|
7413
|
+
"em", "ex", "ch", "cap", "ic", "lh",
|
|
7414
|
+
|
|
7415
|
+
// Font-Relative (Root)
|
|
7416
|
+
"rem", "rex", "rch", "rcap", "ric", "rlh",
|
|
7417
|
+
|
|
7418
|
+
// Standard Viewport
|
|
7419
|
+
"vw", "vh", "vi", "vb", "vmin", "vmax",
|
|
7420
|
+
|
|
7421
|
+
// Small Viewport (UA UI expanded)
|
|
7422
|
+
"svw", "svh", "svi", "svb", "svmin", "svmax",
|
|
7423
|
+
|
|
7424
|
+
// Large Viewport (UA UI retracted)
|
|
7425
|
+
"lvw", "lvh", "lvi", "lvb", "lvmin", "lvmax",
|
|
7426
|
+
|
|
7427
|
+
// Dynamic Viewport (UA UI changes)
|
|
7428
|
+
"dvw", "dvh", "dvi", "dvb", "dvmin", "dvmax",
|
|
7429
|
+
|
|
7430
|
+
// Container Query Units
|
|
7431
|
+
"cqw", "cqh", "cqi", "cqb", "cqmin", "cqmax",
|
|
7432
|
+
|
|
7433
|
+
// Percentage & Layout
|
|
7434
|
+
"%", "fr"
|
|
7435
|
+
];
|
|
7436
|
+
const MOBILE_SIZES = ['px', 'vh', 'vw'];
|
|
7437
|
+
|
|
7438
|
+
const BASE_SUBTYPE_CONFIGS = {
|
|
7439
|
+
"border-style": {
|
|
7440
|
+
type: "allowed-list",
|
|
7441
|
+
native_mobile: {
|
|
7442
|
+
allowed: ["solid", "dashed", "dotted"]
|
|
7443
|
+
},
|
|
7444
|
+
web: {
|
|
7445
|
+
allowed: ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
|
|
7446
|
+
}
|
|
7447
|
+
},
|
|
7448
|
+
|
|
7449
|
+
"border-width": {
|
|
7450
|
+
type: "multi-size",
|
|
7451
|
+
allowMultiValue: true,
|
|
7452
|
+
native_mobile: {
|
|
7453
|
+
allowedUnits: MOBILE_SIZES,
|
|
7454
|
+
allowUnitless: true,
|
|
7455
|
+
allowedKeywords: []
|
|
7456
|
+
},
|
|
7457
|
+
web: {
|
|
7458
|
+
allowedUnits: WEB_SIZES,
|
|
7459
|
+
allowUnitless: true,
|
|
7460
|
+
allowedKeywords: ["thin", "medium", "thick"]
|
|
7461
|
+
}
|
|
7462
|
+
},
|
|
7463
|
+
|
|
7464
|
+
// "box-shadow": {
|
|
7465
|
+
// type: "custom",
|
|
7466
|
+
// customDescription: {
|
|
7467
|
+
// native_mobile: 'px-based shadow: "<x> <y> [blur] [spread] <color>"',
|
|
7468
|
+
// web: 'CSS shadow: "[inset] <x> <y> [blur] [spread] <color>" with CSS units and colors'
|
|
7469
|
+
// }
|
|
7470
|
+
// },
|
|
7471
|
+
|
|
7472
|
+
// "elevation": {
|
|
7473
|
+
// type: "custom",
|
|
7474
|
+
// customDescription: {
|
|
7475
|
+
// native_mobile: '[inset] <offsetX> <offsetY> [blurRadius≥0] [spreadDistance] [color] — px or 0; color: #hex, rgb(), rgba(), named; comma-separate multiple shadows',
|
|
7476
|
+
// web: '[inset] <offsetX> <offsetY> [blurRadius≥0] [spreadDistance] [color] — CSS units; color: #hex, rgb(), rgba(), hsl(), hsla(), named; comma-separate multiple shadows'
|
|
7477
|
+
// }
|
|
7478
|
+
// },
|
|
7479
|
+
|
|
7480
|
+
"font-family": {
|
|
7481
|
+
type: "custom",
|
|
7482
|
+
customDescription: {
|
|
7483
|
+
native_mobile: "only one font name",
|
|
7484
|
+
web: "valid font family name or comma-separated font stack"
|
|
7485
|
+
},
|
|
7486
|
+
native_mobile: {
|
|
7487
|
+
allowMultipleFonts: false,
|
|
7488
|
+
separator: null,
|
|
7489
|
+
maxFonts: 1,
|
|
7490
|
+
allowGenericFallbacks: false
|
|
7491
|
+
},
|
|
7492
|
+
web: {
|
|
7493
|
+
allowMultipleFonts: true,
|
|
7494
|
+
separator: ",",
|
|
7495
|
+
maxFonts: null,
|
|
7496
|
+
allowGenericFallbacks: true
|
|
7497
|
+
}
|
|
7498
|
+
},
|
|
7499
|
+
|
|
7500
|
+
"font-size": {
|
|
7501
|
+
type: "size",
|
|
7502
|
+
native_mobile: {
|
|
7503
|
+
allowedUnits: MOBILE_SIZES,
|
|
7504
|
+
allowUnitless: true,
|
|
7505
|
+
allowedKeywords: []
|
|
7506
|
+
},
|
|
7507
|
+
web: {
|
|
7508
|
+
allowedUnits: WEB_SIZES,
|
|
7509
|
+
allowUnitless: true,
|
|
7510
|
+
allowedKeywords: ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "smaller", "larger"]
|
|
7511
|
+
}
|
|
7512
|
+
},
|
|
7513
|
+
|
|
7514
|
+
"font-weight": {
|
|
7515
|
+
type: "range-with-keywords",
|
|
7516
|
+
range: [100, 900],
|
|
7517
|
+
stepSize: 100,
|
|
7518
|
+
native_mobile: {
|
|
7519
|
+
keywords: ["normal", "bold"]
|
|
7520
|
+
},
|
|
7521
|
+
web: {
|
|
7522
|
+
keywords: ["normal", "bold", "bolder", "lighter"]
|
|
7523
|
+
}
|
|
7524
|
+
},
|
|
7525
|
+
|
|
7526
|
+
"icon-size": {
|
|
7527
|
+
type: "size",
|
|
7528
|
+
native_mobile: {
|
|
7529
|
+
allowedUnits: MOBILE_SIZES,
|
|
7530
|
+
allowUnitless: true
|
|
7531
|
+
},
|
|
7532
|
+
web: {
|
|
7533
|
+
allowedUnits: WEB_SIZES,
|
|
7534
|
+
allowUnitless: true
|
|
7535
|
+
}
|
|
7536
|
+
},
|
|
7537
|
+
|
|
7538
|
+
"letter-spacing": {
|
|
7539
|
+
type: "size",
|
|
7540
|
+
native_mobile: {
|
|
7541
|
+
allowedUnits: MOBILE_SIZES,
|
|
7542
|
+
allowUnitless: true
|
|
7543
|
+
},
|
|
7544
|
+
web: {
|
|
7545
|
+
allowedUnits: WEB_SIZES,
|
|
7546
|
+
allowUnitless: true,
|
|
7547
|
+
allowedKeywords: ['normal'],
|
|
7548
|
+
allowNegative: true
|
|
7549
|
+
}
|
|
7550
|
+
},
|
|
7551
|
+
|
|
7552
|
+
"line-height": {
|
|
7553
|
+
type: "size",
|
|
7554
|
+
native_mobile: {
|
|
7555
|
+
allowedUnits: MOBILE_SIZES,
|
|
7556
|
+
allowUnitless: true
|
|
7557
|
+
},
|
|
7558
|
+
web: {
|
|
7559
|
+
allowedUnits: WEB_SIZES,
|
|
7560
|
+
allowUnitless: true,
|
|
7561
|
+
allowedKeywords: ['normal']
|
|
7562
|
+
}
|
|
7563
|
+
},
|
|
7564
|
+
|
|
7565
|
+
"opacity": {
|
|
7566
|
+
type: "range",
|
|
7567
|
+
min: 0,
|
|
7568
|
+
max: 1
|
|
7569
|
+
},
|
|
7570
|
+
|
|
7571
|
+
"radius": {
|
|
7572
|
+
type: "multi-size",
|
|
7573
|
+
allowMultiValue: true,
|
|
7574
|
+
allowPercent: true,
|
|
7575
|
+
native_mobile: {
|
|
7576
|
+
allowedUnits: MOBILE_SIZES,
|
|
7577
|
+
allowUnitless: true
|
|
7578
|
+
},
|
|
7579
|
+
web: {
|
|
7580
|
+
allowedUnits: WEB_SIZES,
|
|
7581
|
+
allowUnitless: true
|
|
7582
|
+
}
|
|
7583
|
+
},
|
|
7584
|
+
|
|
7585
|
+
"space": {
|
|
7586
|
+
type: "multi-size",
|
|
7587
|
+
allowMultiValue: true,
|
|
7588
|
+
allowAuto: true,
|
|
7589
|
+
allowPercent: true,
|
|
7590
|
+
native_mobile: {
|
|
7591
|
+
allowedUnits: MOBILE_SIZES,
|
|
7592
|
+
allowUnitless: true
|
|
7593
|
+
},
|
|
7594
|
+
web: {
|
|
7595
|
+
allowedUnits: WEB_SIZES,
|
|
7596
|
+
allowUnitless: true
|
|
7597
|
+
}
|
|
7598
|
+
},
|
|
7599
|
+
|
|
7600
|
+
"margin": {
|
|
7601
|
+
type: "multi-size",
|
|
7602
|
+
allowMultiValue: true,
|
|
7603
|
+
allowAuto: true,
|
|
7604
|
+
allowNegative: true,
|
|
7605
|
+
native_mobile: {
|
|
7606
|
+
allowedUnits: MOBILE_SIZES,
|
|
7607
|
+
allowUnitless: true
|
|
7608
|
+
},
|
|
7609
|
+
web: {
|
|
7610
|
+
allowedUnits: WEB_SIZES,
|
|
7611
|
+
allowUnitless: true
|
|
7612
|
+
}
|
|
7613
|
+
},
|
|
7614
|
+
|
|
7615
|
+
"spacer": {
|
|
7616
|
+
type: "size",
|
|
7617
|
+
native_mobile: {
|
|
7618
|
+
allowedUnits: MOBILE_SIZES,
|
|
7619
|
+
allowUnitless: true
|
|
7620
|
+
},
|
|
7621
|
+
web: {
|
|
7622
|
+
allowedUnits: WEB_SIZES,
|
|
7623
|
+
allowUnitless: true
|
|
7624
|
+
}
|
|
7625
|
+
}
|
|
7626
|
+
};
|
|
7627
|
+
|
|
7628
|
+
|
|
7629
|
+
/**
|
|
7630
|
+
* Generate platform-specific rule configuration
|
|
7631
|
+
* @param {string} subtype - The subtype name
|
|
7632
|
+
* @param {string} platform - Platform ('native_mobile' or 'web')
|
|
7633
|
+
* @returns {Object} Platform-specific rule configuration
|
|
7634
|
+
*/
|
|
7635
|
+
function getPlatformRule(subtype, platform) {
|
|
7636
|
+
const baseConfig = BASE_SUBTYPE_CONFIGS[subtype];
|
|
7637
|
+
if (!baseConfig) return null;
|
|
7638
|
+
|
|
7639
|
+
// Merge base config with platform-specific overrides
|
|
7640
|
+
const platformConfig = baseConfig[platform] || {};
|
|
7641
|
+
const rule = { ...baseConfig, ...platformConfig };
|
|
7642
|
+
|
|
7643
|
+
// Handle platform-specific custom descriptions
|
|
7644
|
+
if (rule.customDescription && typeof rule.customDescription === 'object') {
|
|
7645
|
+
rule.customDescription = rule.customDescription[platform] || rule.customDescription;
|
|
7646
|
+
}
|
|
7647
|
+
|
|
7648
|
+
// Remove platform-specific sections from the final rule
|
|
7649
|
+
delete rule.native_mobile;
|
|
7650
|
+
delete rule.web;
|
|
7651
|
+
delete rule.validator;
|
|
7652
|
+
|
|
7653
|
+
return rule;
|
|
7654
|
+
}
|
|
7655
|
+
|
|
7656
|
+
/**
|
|
7657
|
+
* Resolve an executable validator function from rule type + subtype.
|
|
7658
|
+
*/
|
|
7659
|
+
function resolveRuleValidator(type, subtype, platform, validators) {
|
|
7660
|
+
const platformDefaults = {
|
|
7661
|
+
native_mobile: MOBILE_SIZES,
|
|
7662
|
+
web: WEB_SIZES
|
|
7663
|
+
};
|
|
7664
|
+
const defaultUnits = platformDefaults[platform];
|
|
7665
|
+
|
|
7666
|
+
switch (type) {
|
|
7667
|
+
case "allowed-list":
|
|
7668
|
+
return (value, rule) => validators.validateFromAllowedList(value, rule.allowed);
|
|
7669
|
+
case "size":
|
|
7670
|
+
return (value, rule) => validators.validatePlatformSizeValue(value, rule, defaultUnits);
|
|
7671
|
+
case "multi-size":
|
|
7672
|
+
return (value, rule) => validators.validatePlatformSpaceValue(value, rule, defaultUnits);
|
|
7673
|
+
case "string":
|
|
7674
|
+
return validators.validateFontFamily;
|
|
7675
|
+
case "range":
|
|
7676
|
+
return validators.validateOpacity;
|
|
7677
|
+
case "range-with-keywords":
|
|
7678
|
+
return platform === 'native_mobile'
|
|
7679
|
+
? (value, rule) => validators.validateFontWeight(value, rule, true)
|
|
7680
|
+
: validators.validateFontWeight;
|
|
7681
|
+
case "custom":
|
|
7682
|
+
if (subtype === "font-family") {
|
|
7683
|
+
return (value, rule) => validators.validateFontFamily(value, rule);
|
|
7684
|
+
}
|
|
7685
|
+
if (subtype === "box-shadow" || subtype === "elevation") {
|
|
7686
|
+
return validators.validateBoxShadow;
|
|
7687
|
+
}
|
|
7688
|
+
return null;
|
|
7689
|
+
default:
|
|
7690
|
+
return null;
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
|
|
7694
|
+
/***/ },
|
|
7695
|
+
|
|
7696
|
+
/***/ "./src/token-validation/validator-utils/common/primitives.js"
|
|
7697
|
+
/*!*******************************************************************!*\
|
|
7698
|
+
!*** ./src/token-validation/validator-utils/common/primitives.js ***!
|
|
7699
|
+
\*******************************************************************/
|
|
7700
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7701
|
+
|
|
7702
|
+
"use strict";
|
|
7703
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7704
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7705
|
+
/* harmony export */ isEm: () => (/* binding */ isEm),
|
|
7706
|
+
/* harmony export */ isHex: () => (/* binding */ isHex),
|
|
7707
|
+
/* harmony export */ isHsl: () => (/* binding */ isHsl),
|
|
7708
|
+
/* harmony export */ isHsla: () => (/* binding */ isHsla),
|
|
7709
|
+
/* harmony export */ isMobileColor: () => (/* binding */ isMobileColor),
|
|
7710
|
+
/* harmony export */ isNamedColor: () => (/* binding */ isNamedColor),
|
|
7711
|
+
/* harmony export */ isNonNegativeUnitlessNumber: () => (/* binding */ isNonNegativeUnitlessNumber),
|
|
7712
|
+
/* harmony export */ isPercent: () => (/* binding */ isPercent),
|
|
7713
|
+
/* harmony export */ isPx: () => (/* binding */ isPx),
|
|
7714
|
+
/* harmony export */ isRem: () => (/* binding */ isRem),
|
|
7715
|
+
/* harmony export */ isRgb: () => (/* binding */ isRgb),
|
|
7716
|
+
/* harmony export */ isRgba: () => (/* binding */ isRgba),
|
|
7717
|
+
/* harmony export */ isUnitlessNumber: () => (/* binding */ isUnitlessNumber),
|
|
7718
|
+
/* harmony export */ isWebColor: () => (/* binding */ isWebColor)
|
|
7719
|
+
/* harmony export */ });
|
|
7720
|
+
|
|
7721
|
+
|
|
7722
|
+
// ─── Numeric / Unit helpers ──────────────────────────────────────────────────
|
|
7723
|
+
|
|
7724
|
+
/** "12px", "-4px" */
|
|
7725
|
+
const isPx = (v) => /^-?[\d.]+px$/.test(v);
|
|
7726
|
+
|
|
7727
|
+
/** "1.5rem" */
|
|
7728
|
+
const isRem = (v) => /^-?[\d.]+rem$/.test(v);
|
|
7729
|
+
|
|
7730
|
+
/** "1em" */
|
|
7731
|
+
const isEm = (v) => /^-?[\d.]+em$/.test(v);
|
|
7732
|
+
|
|
7733
|
+
/** Plain number string with no unit: "12", "1.5", NOT "-3" for unsigned contexts */
|
|
7734
|
+
const isUnitlessNumber = (v) => /^-?[\d.]+$/.test(v) && !isNaN(Number(v));
|
|
7735
|
+
|
|
7736
|
+
/** Non-negative unitless number only */
|
|
7737
|
+
const isNonNegativeUnitlessNumber = (v) =>
|
|
7738
|
+
isUnitlessNumber(v) && Number(v) >= 0;
|
|
7739
|
+
|
|
7740
|
+
/** "50%" */
|
|
7741
|
+
const isPercent = (v) => /^[\d.]+%$/.test(v);
|
|
7742
|
+
|
|
7743
|
+
// ─── Color helpers ───────────────────────────────────────────────────────────
|
|
7744
|
+
|
|
7745
|
+
/** #RGB, #RGBA, #RRGGBB, #RRGGBBAA */
|
|
7746
|
+
const isHex = (v) =>
|
|
7747
|
+
/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(v);
|
|
7748
|
+
|
|
7749
|
+
/** rgb(...) */
|
|
7750
|
+
const isRgb = (v) =>
|
|
7751
|
+
/^rgb\(\s*[\d.]+%?\s*,\s*[\d.]+%?\s*,\s*[\d.]+%?\s*\)$/.test(v);
|
|
7752
|
+
|
|
7753
|
+
/** rgba(...) */
|
|
7754
|
+
const isRgba = (v) =>
|
|
7755
|
+
/^rgba\(\s*[\d.]+%?\s*,\s*[\d.]+%?\s*,\s*[\d.]+%?\s*,\s*[\d.]+%?\s*\)$/.test(v);
|
|
7756
|
+
|
|
7757
|
+
/** hsl(...) */
|
|
7758
|
+
const isHsl = (v) =>
|
|
7759
|
+
/^hsl\(\s*[\d.]+\s*,\s*[\d.]+%\s*,\s*[\d.]+%\s*\)$/.test(v);
|
|
7760
|
+
|
|
7761
|
+
/** hsla(...) */
|
|
7762
|
+
const isHsla = (v) =>
|
|
7763
|
+
/^hsla\(\s*[\d.]+\s*,\s*[\d.]+%\s*,\s*[\d.]+%\s*,\s*[\d.]+\s*\)$/.test(v);
|
|
7764
|
+
|
|
7765
|
+
/**
|
|
7766
|
+
* Named color regex: 3-20 alphabetic characters only
|
|
7767
|
+
* Matches: "red", "blue", "transparent" (but not "foobar123" or "red-blue")
|
|
7768
|
+
*/
|
|
7769
|
+
const NAMED_COLOR = /^[a-zA-Z]{3,20}$/;
|
|
7770
|
+
const isNamedColor = (v) => NAMED_COLOR.test(v);
|
|
7771
|
+
|
|
7772
|
+
/** Any color valid for css-to-react-native: #hex, rgb(), rgba(), named */
|
|
7773
|
+
const isMobileColor = (v) =>
|
|
7774
|
+
isHex(v) || isRgb(v) || isRgba(v) || isNamedColor(v);
|
|
7775
|
+
|
|
7776
|
+
/** Any color valid in CSS (superset of mobile) */
|
|
7777
|
+
const isWebColor = (v) =>
|
|
7778
|
+
isHex(v) || isRgb(v) || isRgba(v) || isHsl(v) || isHsla(v) || isNamedColor(v);
|
|
7779
|
+
|
|
7780
|
+
|
|
7781
|
+
/***/ },
|
|
7782
|
+
|
|
7783
|
+
/***/ "./src/token-validation/validator-utils/common/utils.js"
|
|
7784
|
+
/*!**************************************************************!*\
|
|
7785
|
+
!*** ./src/token-validation/validator-utils/common/utils.js ***!
|
|
7786
|
+
\**************************************************************/
|
|
7787
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7788
|
+
|
|
7789
|
+
"use strict";
|
|
7790
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7791
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7792
|
+
/* harmony export */ buildSizeOptions: () => (/* binding */ buildSizeOptions),
|
|
7793
|
+
/* harmony export */ createErrorResponse: () => (/* binding */ createErrorResponse),
|
|
7794
|
+
/* harmony export */ createSuccessResponse: () => (/* binding */ createSuccessResponse),
|
|
7795
|
+
/* harmony export */ generateAllowedListDescription: () => (/* binding */ generateAllowedListDescription),
|
|
7796
|
+
/* harmony export */ generateRangeDescription: () => (/* binding */ generateRangeDescription),
|
|
7797
|
+
/* harmony export */ generateUnitsDescription: () => (/* binding */ generateUnitsDescription),
|
|
7798
|
+
/* harmony export */ getRuleDescription: () => (/* binding */ getRuleDescription),
|
|
7799
|
+
/* harmony export */ validateFontFamily: () => (/* binding */ validateFontFamily),
|
|
7800
|
+
/* harmony export */ validateFontWeight: () => (/* binding */ validateFontWeight),
|
|
7801
|
+
/* harmony export */ validateFromAllowedList: () => (/* binding */ validateFromAllowedList),
|
|
7802
|
+
/* harmony export */ validateMultiValue: () => (/* binding */ validateMultiValue),
|
|
7803
|
+
/* harmony export */ validateNonEmptyString: () => (/* binding */ validateNonEmptyString),
|
|
7804
|
+
/* harmony export */ validateNumericRange: () => (/* binding */ validateNumericRange),
|
|
7805
|
+
/* harmony export */ validateOpacity: () => (/* binding */ validateOpacity),
|
|
7806
|
+
/* harmony export */ validatePlatformSizeValue: () => (/* binding */ validatePlatformSizeValue),
|
|
7807
|
+
/* harmony export */ validatePlatformSpaceValue: () => (/* binding */ validatePlatformSpaceValue),
|
|
7808
|
+
/* harmony export */ validateRangeWithKeywords: () => (/* binding */ validateRangeWithKeywords),
|
|
7809
|
+
/* harmony export */ validateSizeValue: () => (/* binding */ validateSizeValue)
|
|
7810
|
+
/* harmony export */ });
|
|
7811
|
+
/* harmony import */ var _primitives_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./primitives.js */ "./src/token-validation/validator-utils/common/primitives.js");
|
|
7812
|
+
|
|
7813
|
+
|
|
7814
|
+
function generateAllowedListDescription(allowed) {
|
|
7815
|
+
if (!allowed || allowed.length === 0) return "";
|
|
7816
|
+
if (allowed.length === 1) return `"${allowed[0]}"`;
|
|
7817
|
+
if (allowed.length === 2) return `"${allowed[0]}" or "${allowed[1]}"`;
|
|
7818
|
+
|
|
7819
|
+
const last = allowed[allowed.length - 1];
|
|
7820
|
+
const rest = allowed.slice(0, -1);
|
|
7821
|
+
return `"${rest.join('", "')}", or "${last}"`;
|
|
7822
|
+
}
|
|
7823
|
+
|
|
7824
|
+
/**
|
|
7825
|
+
* Generate description for numeric ranges
|
|
7826
|
+
* @param {number} min - Minimum value
|
|
7827
|
+
* @param {number} max - Maximum value
|
|
7828
|
+
* @param {string} [unit] - Optional unit suffix
|
|
7829
|
+
* @returns {string} Description like "number between 0 and 1"
|
|
7830
|
+
*/
|
|
7831
|
+
function generateRangeDescription(min, max, unit = "") {
|
|
7832
|
+
const unitSuffix = unit ? ` ${unit}` : "";
|
|
7833
|
+
return `number between ${min} and ${max}${unitSuffix}`;
|
|
7834
|
+
}
|
|
7835
|
+
|
|
7836
|
+
/**
|
|
7837
|
+
* Generate description for platform-specific units
|
|
7838
|
+
* @param {string[]} units - Array of supported units
|
|
7839
|
+
* @returns {string} Description of supported units
|
|
7840
|
+
*/
|
|
7841
|
+
function generateUnitsDescription(units) {
|
|
7842
|
+
if (!units || units.length === 0) return "";
|
|
7843
|
+
|
|
7844
|
+
const unitDescriptions = {
|
|
7845
|
+
px: "px value",
|
|
7846
|
+
number: "plain number",
|
|
7847
|
+
rem: "rem value",
|
|
7848
|
+
em: "em value",
|
|
7849
|
+
"%": "percentage",
|
|
7850
|
+
auto: "auto"
|
|
7851
|
+
};
|
|
7852
|
+
|
|
7853
|
+
const descriptions = units.map(unit => unitDescriptions[unit] || unit);
|
|
7854
|
+
|
|
7855
|
+
if (descriptions.length === 1) return descriptions[0];
|
|
7856
|
+
if (descriptions.length === 2) return `${descriptions[0]} or ${descriptions[1]}`;
|
|
7857
|
+
|
|
7858
|
+
const last = descriptions[descriptions.length - 1];
|
|
7859
|
+
const rest = descriptions.slice(0, -1);
|
|
7860
|
+
return `${rest.join(", ")}, or ${last}`;
|
|
7861
|
+
}
|
|
7862
|
+
|
|
7863
|
+
// ─── Shared Validation Functions ─────────────────────────────────────────────
|
|
7864
|
+
|
|
7865
|
+
/**
|
|
7866
|
+
* Validate value against an allowed list
|
|
7867
|
+
* @param {string} value - Value to validate
|
|
7868
|
+
* @param {string[]} allowed - Array of allowed values
|
|
7869
|
+
* @returns {{ valid: boolean }}
|
|
7870
|
+
*/
|
|
7871
|
+
function validateFromAllowedList(value, allowed) {
|
|
7872
|
+
const trimmed = String(value).trim();
|
|
7873
|
+
return { valid: allowed.includes(trimmed) };
|
|
7874
|
+
}
|
|
7875
|
+
|
|
7876
|
+
/**
|
|
7877
|
+
* Validate numeric value within a range
|
|
7878
|
+
* @param {string|number} value - Value to validate
|
|
7879
|
+
* @param {number} min - Minimum allowed value
|
|
7880
|
+
* @param {number} max - Maximum allowed value
|
|
7881
|
+
* @returns {{ valid: boolean }}
|
|
7882
|
+
*/
|
|
7883
|
+
function validateNumericRange(value, min, max) {
|
|
7884
|
+
const num = Number(value);
|
|
7885
|
+
if (isNaN(num)) return { valid: false };
|
|
7886
|
+
return { valid: num >= min && num <= max };
|
|
7887
|
+
}
|
|
7888
|
+
|
|
7889
|
+
/**
|
|
7890
|
+
* Validate non-empty string values
|
|
7891
|
+
* @param {string} value - Value to validate
|
|
7892
|
+
* @returns {{ valid: boolean }}
|
|
7893
|
+
*/
|
|
7894
|
+
function validateNonEmptyString(value) {
|
|
7895
|
+
const trimmed = String(value).trim();
|
|
7896
|
+
return { valid: trimmed.length > 0 };
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7899
|
+
/**
|
|
7900
|
+
* Validate numeric range with optional keyword support
|
|
7901
|
+
* @param {string|number} value - Value to validate
|
|
7902
|
+
* @param {Object} rule - Rule configuration containing range and keywords
|
|
7903
|
+
* @param {boolean} [caseInsensitive=false] - Match keywords case-insensitively
|
|
7904
|
+
* @returns {{ valid: boolean }}
|
|
7905
|
+
*/
|
|
7906
|
+
function validateRangeWithKeywords(value, rule, caseInsensitive = false) {
|
|
7907
|
+
const trimmed = String(value).trim();
|
|
7908
|
+
const normalized = caseInsensitive ? trimmed.toLowerCase() : trimmed;
|
|
7909
|
+
const keywords = rule?.keywords || [];
|
|
7910
|
+
|
|
7911
|
+
if (keywords.includes(normalized)) {
|
|
7912
|
+
return createSuccessResponse();
|
|
7913
|
+
}
|
|
7914
|
+
|
|
7915
|
+
const num = Number(trimmed);
|
|
7916
|
+
if (!isNaN(num) && rule?.range) {
|
|
7917
|
+
const [min, max] = rule.range;
|
|
7918
|
+
if (num >= min && num <= max && num % 100 === 0) {
|
|
7919
|
+
return createSuccessResponse();
|
|
7920
|
+
}
|
|
7921
|
+
}
|
|
7922
|
+
|
|
7923
|
+
return { valid: false };
|
|
7924
|
+
}
|
|
7925
|
+
|
|
7926
|
+
/**
|
|
7927
|
+
* Build size validation options from rule configuration
|
|
7928
|
+
* @param {Object} rule - Rule config
|
|
7929
|
+
* @param {Object} defaults - Default options for a platform
|
|
7930
|
+
* @returns {Object} Final validation options
|
|
7931
|
+
*/
|
|
7932
|
+
function buildSizeOptions(rule = {}, defaults = {}) {
|
|
7933
|
+
const mergedAllowedKeywords = defaults.allowedKeywords || [];
|
|
7934
|
+
return {
|
|
7935
|
+
allowedUnits: rule.allowedUnits || defaults.allowedUnits || ['px'],
|
|
7936
|
+
allowUnitless: rule.allowUnitless !== false,
|
|
7937
|
+
allowNegative: rule.allowNegative ?? defaults.allowNegative ?? false,
|
|
7938
|
+
allowPercent: rule.allowPercent ?? defaults.allowPercent ?? false,
|
|
7939
|
+
allowedKeywords: rule.allowAuto
|
|
7940
|
+
? ['auto']
|
|
7941
|
+
: (rule.allowedKeywords || mergedAllowedKeywords)
|
|
7942
|
+
};
|
|
7943
|
+
}
|
|
7944
|
+
|
|
7945
|
+
/**
|
|
7946
|
+
* Validate size values with platform-specific unit support
|
|
7947
|
+
* @param {string} value - Value to validate
|
|
7948
|
+
* @param {Object} options - Validation options
|
|
7949
|
+
* @param {boolean} [options.allowNegative=false] - Allow negative values
|
|
7950
|
+
* @param {boolean} [options.allowUnitless=true] - Allow unitless numbers
|
|
7951
|
+
* @param {boolean} [options.allowPercent=false] - Allow percentage values
|
|
7952
|
+
* @param {string[]} [options.allowedUnits=['px']] - Allowed CSS units
|
|
7953
|
+
* @param {string[]} [options.allowedKeywords=[]] - Allowed keyword values
|
|
7954
|
+
* @returns {{ valid: boolean }}
|
|
7955
|
+
*/
|
|
7956
|
+
function validateSizeValue(value, options = {}) {
|
|
7957
|
+
const {
|
|
7958
|
+
allowNegative = false,
|
|
7959
|
+
allowUnitless = true,
|
|
7960
|
+
allowPercent = false,
|
|
7961
|
+
allowedUnits = ['px'],
|
|
7962
|
+
allowedKeywords = []
|
|
7963
|
+
} = options;
|
|
7964
|
+
|
|
7965
|
+
const trimmed = String(value).trim();
|
|
7966
|
+
|
|
7967
|
+
// Check keywords first
|
|
7968
|
+
if (allowedKeywords.includes(trimmed)) {
|
|
7969
|
+
return { valid: true };
|
|
7970
|
+
}
|
|
7971
|
+
|
|
7972
|
+
// Check percentage
|
|
7973
|
+
if (allowPercent && (0,_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isPercent)(trimmed)) {
|
|
7974
|
+
return { valid: true };
|
|
7975
|
+
}
|
|
7976
|
+
|
|
7977
|
+
// Check unitless numbers
|
|
7978
|
+
if (allowUnitless) {
|
|
7979
|
+
if (allowNegative && (0,_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isUnitlessNumber)(trimmed)) {
|
|
7980
|
+
return { valid: true };
|
|
7981
|
+
}
|
|
7982
|
+
if (!allowNegative && (0,_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isNonNegativeUnitlessNumber)(trimmed)) {
|
|
7983
|
+
return { valid: true };
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
|
|
7987
|
+
// Check CSS units - generic validation for any unit
|
|
7988
|
+
for (const unit of allowedUnits) {
|
|
7989
|
+
// Escape special regex characters in unit name
|
|
7990
|
+
const escapedUnit = unit.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
7991
|
+
const unitRegex = new RegExp(`^-?[\\d.]+${escapedUnit}$`);
|
|
7992
|
+
|
|
7993
|
+
if (unitRegex.test(trimmed)) {
|
|
7994
|
+
const numericValue = parseFloat(trimmed);
|
|
7995
|
+
if (allowNegative || numericValue >= 0) {
|
|
7996
|
+
return { valid: true };
|
|
7997
|
+
}
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
8000
|
+
|
|
8001
|
+
return { valid: false };
|
|
8002
|
+
}
|
|
8003
|
+
|
|
8004
|
+
|
|
8005
|
+
/**
|
|
8006
|
+
* Validate space-separated multi-value strings
|
|
8007
|
+
* @param {string} value - Space-separated values
|
|
8008
|
+
* @param {Function} validator - Function to validate each individual value
|
|
8009
|
+
* @param {Object} [validatorOptions] - Options to pass to validator
|
|
8010
|
+
* @returns {{ valid: boolean }}
|
|
8011
|
+
*/
|
|
8012
|
+
function validateMultiValue(value, validator, validatorOptions = {}) {
|
|
8013
|
+
const trimmed = String(value).trim();
|
|
8014
|
+
const parts = trimmed.split(/\s+/).filter(Boolean);
|
|
8015
|
+
|
|
8016
|
+
if (parts.length === 0) return { valid: false };
|
|
8017
|
+
|
|
8018
|
+
return { valid: parts.every(part => validator(part, validatorOptions).valid) };
|
|
8019
|
+
}
|
|
8020
|
+
|
|
8021
|
+
/**
|
|
8022
|
+
* Create standardized error response
|
|
8023
|
+
* @param {string} subtype - Token subtype
|
|
8024
|
+
* @param {string} value - Invalid value
|
|
8025
|
+
* @param {string} expectedFormat - Expected format description
|
|
8026
|
+
* @param {string} platform - Platform identifier
|
|
8027
|
+
* @returns {{ valid: false, errorObject: Object }}
|
|
8028
|
+
*/
|
|
8029
|
+
function createErrorResponse(subtype, value, expectedFormat, platform) {
|
|
8030
|
+
// Tests expect a human-friendly platform name in some cases.
|
|
8031
|
+
// Keep other subtypes unchanged to avoid breaking existing validations.
|
|
8032
|
+
const platformForError =
|
|
8033
|
+
platform === "native_mobile" && (subtype === "border-width" || subtype === "font-family")
|
|
8034
|
+
? "mobile"
|
|
8035
|
+
: platform;
|
|
8036
|
+
return {
|
|
8037
|
+
valid: false,
|
|
8038
|
+
errorObject: {
|
|
8039
|
+
subtype,
|
|
8040
|
+
value,
|
|
8041
|
+
expectedFormat,
|
|
8042
|
+
platform: platformForError
|
|
8043
|
+
}
|
|
8044
|
+
};
|
|
8045
|
+
}
|
|
8046
|
+
|
|
8047
|
+
function createSuccessResponse() {
|
|
8048
|
+
return { valid: true };
|
|
8049
|
+
}
|
|
8050
|
+
|
|
8051
|
+
|
|
8052
|
+
function validateFontFamily(value, config = {}) {
|
|
8053
|
+
const trimmed = String(value).trim();
|
|
8054
|
+
|
|
8055
|
+
// Basic non-empty validation
|
|
8056
|
+
if (!trimmed) {
|
|
8057
|
+
return { valid: false };
|
|
8058
|
+
}
|
|
8059
|
+
|
|
8060
|
+
// If multiple fonts are not allowed, check for any comma (regardless of separator config)
|
|
8061
|
+
if (!config.allowMultipleFonts && trimmed.includes(',')) {
|
|
8062
|
+
return { valid: false };
|
|
8063
|
+
}
|
|
8064
|
+
|
|
8065
|
+
// If multiple fonts are allowed, validate each font
|
|
8066
|
+
if (config.allowMultipleFonts && config.separator) {
|
|
8067
|
+
const fonts = trimmed.split(config.separator).map(font => font.trim()).filter(Boolean);
|
|
8068
|
+
|
|
8069
|
+
// Check maximum fonts limit
|
|
8070
|
+
if (config.maxFonts && fonts.length > config.maxFonts) {
|
|
8071
|
+
return { valid: false };
|
|
8072
|
+
}
|
|
8073
|
+
|
|
8074
|
+
// Validate each font name is non-empty
|
|
8075
|
+
if (fonts.some(font => !font)) {
|
|
8076
|
+
return { valid: false };
|
|
8077
|
+
}
|
|
8078
|
+
|
|
8079
|
+
return { valid: true };
|
|
8080
|
+
}
|
|
8081
|
+
|
|
8082
|
+
// Single font validation - just check it's non-empty
|
|
8083
|
+
return { valid: true };
|
|
8084
|
+
}
|
|
8085
|
+
|
|
8086
|
+
/**
|
|
8087
|
+
* Common validator for font weight - validates range with keywords
|
|
8088
|
+
* @param {string} value - Value to validate
|
|
8089
|
+
* @param {Object} rule - Rule configuration with range and keywords
|
|
8090
|
+
* @param {boolean} [requireMultipleOf100] - Whether to require multiples of 100
|
|
8091
|
+
* @returns {{ valid: boolean }} Validation result
|
|
8092
|
+
*/
|
|
8093
|
+
function validateFontWeight(value, rule, requireMultipleOf100 = false) {
|
|
8094
|
+
return validateRangeWithKeywords(value, rule, requireMultipleOf100);
|
|
8095
|
+
}
|
|
8096
|
+
|
|
8097
|
+
/**
|
|
8098
|
+
* Common validator for opacity - validates numeric range
|
|
8099
|
+
* @param {string} value - Value to validate
|
|
8100
|
+
* @param {Object} rule - Rule configuration with min/max
|
|
8101
|
+
* @returns {{ valid: boolean }} Validation result
|
|
8102
|
+
*/
|
|
8103
|
+
function validateOpacity(value, rule) {
|
|
8104
|
+
return validateNumericRange(value, rule.min, rule.max);
|
|
8105
|
+
}
|
|
8106
|
+
|
|
8107
|
+
/**
|
|
8108
|
+
* Platform-specific size value validator
|
|
8109
|
+
* @param {string} value - Value to validate
|
|
8110
|
+
* @param {Object} rule - Rule configuration
|
|
8111
|
+
* @param {string[]} defaultUnits - Default allowed units for platform
|
|
8112
|
+
* @returns {{ valid: boolean }} Validation result
|
|
8113
|
+
*/
|
|
8114
|
+
function validatePlatformSizeValue(value, rule = {}, defaultUnits = ['px']) {
|
|
8115
|
+
const options = buildSizeOptions(rule, {
|
|
8116
|
+
allowedUnits: defaultUnits,
|
|
8117
|
+
allowPercent: false,
|
|
8118
|
+
allowNegative: false,
|
|
8119
|
+
allowedKeywords: []
|
|
8120
|
+
});
|
|
8121
|
+
return validateSizeValue(value, options);
|
|
8122
|
+
}
|
|
8123
|
+
|
|
8124
|
+
/**
|
|
8125
|
+
* Platform-specific space value validator (supports multi-value)
|
|
8126
|
+
* @param {string} value - Value to validate
|
|
8127
|
+
* @param {Object} rule - Rule configuration
|
|
8128
|
+
* @param {string[]} defaultUnits - Default allowed units for platform
|
|
8129
|
+
* @returns {{ valid: boolean }} Validation result
|
|
8130
|
+
*/
|
|
8131
|
+
function validatePlatformSpaceValue(value, rule = {}, defaultUnits = ['px']) {
|
|
8132
|
+
const { allowMultiValue } = rule;
|
|
8133
|
+
const options = buildSizeOptions(rule, {
|
|
8134
|
+
allowedUnits: defaultUnits,
|
|
8135
|
+
allowPercent: false,
|
|
8136
|
+
allowNegative: false,
|
|
8137
|
+
allowedKeywords: []
|
|
8138
|
+
});
|
|
8139
|
+
|
|
8140
|
+
if (allowMultiValue) {
|
|
8141
|
+
return validateMultiValue(value, validateSizeValue, options);
|
|
8142
|
+
}
|
|
8143
|
+
|
|
8144
|
+
return validateSizeValue(value, options);
|
|
8145
|
+
}
|
|
8146
|
+
|
|
8147
|
+
/**
|
|
8148
|
+
* Get description for a rule, using customDescription if available or generating dynamically
|
|
8149
|
+
* @param {Object} rule - Rule configuration
|
|
8150
|
+
* @returns {string} Description for the rule
|
|
8151
|
+
*/
|
|
8152
|
+
function getRuleDescription(rule) {
|
|
8153
|
+
// Use custom description if provided
|
|
8154
|
+
if (rule.customDescription) {
|
|
8155
|
+
return rule.customDescription;
|
|
8156
|
+
}
|
|
8157
|
+
|
|
8158
|
+
// Generate dynamic description based on rule type
|
|
8159
|
+
if (rule.allowed) {
|
|
8160
|
+
return generateAllowedListDescription(rule.allowed);
|
|
8161
|
+
}
|
|
8162
|
+
|
|
8163
|
+
if (rule.min !== undefined && rule.max !== undefined) {
|
|
8164
|
+
let desc = generateRangeDescription(rule.min, rule.max);
|
|
8165
|
+
if (rule.keywords && rule.keywords.length > 0) {
|
|
8166
|
+
desc += ', ' + generateAllowedListDescription(rule.keywords);
|
|
8167
|
+
}
|
|
8168
|
+
return desc;
|
|
8169
|
+
}
|
|
8170
|
+
|
|
8171
|
+
if (rule.allowedUnits) {
|
|
8172
|
+
return generateUnitsDescription(rule.allowedUnits);
|
|
8173
|
+
}
|
|
8174
|
+
|
|
8175
|
+
return "valid value";
|
|
8176
|
+
}
|
|
8177
|
+
|
|
8178
|
+
|
|
8179
|
+
/***/ },
|
|
8180
|
+
|
|
8181
|
+
/***/ "./src/token-validation/validator-utils/native_mobile.js"
|
|
8182
|
+
/*!***************************************************************!*\
|
|
8183
|
+
!*** ./src/token-validation/validator-utils/native_mobile.js ***!
|
|
8184
|
+
\***************************************************************/
|
|
8185
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
8186
|
+
|
|
8187
|
+
"use strict";
|
|
8188
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8189
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8190
|
+
/* harmony export */ MOBILE_RULES: () => (/* binding */ MOBILE_RULES)
|
|
8191
|
+
/* harmony export */ });
|
|
8192
|
+
/* harmony import */ var _common_primitives_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/primitives.js */ "./src/token-validation/validator-utils/common/primitives.js");
|
|
8193
|
+
/* harmony import */ var _common_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./common/utils.js */ "./src/token-validation/validator-utils/common/utils.js");
|
|
8194
|
+
/* harmony import */ var _common_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common/constants.js */ "./src/token-validation/validator-utils/common/constants.js");
|
|
8195
|
+
|
|
8196
|
+
|
|
8197
|
+
|
|
8198
|
+
|
|
8199
|
+
|
|
8200
|
+
|
|
8201
|
+
function generateMobileRules() {
|
|
8202
|
+
const rules = {};
|
|
8203
|
+
|
|
8204
|
+
Object.keys(_common_constants_js__WEBPACK_IMPORTED_MODULE_2__.BASE_SUBTYPE_CONFIGS).forEach(subtype => {
|
|
8205
|
+
const config = _common_constants_js__WEBPACK_IMPORTED_MODULE_2__.BASE_SUBTYPE_CONFIGS[subtype];
|
|
8206
|
+
|
|
8207
|
+
// Skip subtypes not supported on mobile
|
|
8208
|
+
if (!config.mobile && config.web && !config.type) return;
|
|
8209
|
+
|
|
8210
|
+
const rule = (0,_common_constants_js__WEBPACK_IMPORTED_MODULE_2__.getPlatformRule)(subtype, 'native_mobile');
|
|
8211
|
+
if (!rule) return;
|
|
8212
|
+
|
|
8213
|
+
rule.validate = (0,_common_constants_js__WEBPACK_IMPORTED_MODULE_2__.resolveRuleValidator)(rule.type, subtype, 'native_mobile', {
|
|
8214
|
+
validateFromAllowedList: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateFromAllowedList,
|
|
8215
|
+
validatePlatformSizeValue: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validatePlatformSizeValue,
|
|
8216
|
+
validatePlatformSpaceValue: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validatePlatformSpaceValue,
|
|
8217
|
+
validateFontFamily: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateFontFamily,
|
|
8218
|
+
validateOpacity: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateOpacity,
|
|
8219
|
+
validateFontWeight: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateFontWeight,
|
|
8220
|
+
validateBoxShadow
|
|
8221
|
+
});
|
|
8222
|
+
|
|
8223
|
+
// Set custom description if available
|
|
8224
|
+
if (rule.customDescription && rule.customDescription.mobile) {
|
|
8225
|
+
rule.customDescription = rule.customDescription.mobile;
|
|
8226
|
+
} else if (rule.customDescription && typeof rule.customDescription === 'string') {
|
|
8227
|
+
// Keep existing string descriptions
|
|
8228
|
+
}
|
|
8229
|
+
|
|
8230
|
+
rules[subtype] = rule;
|
|
8231
|
+
});
|
|
8232
|
+
|
|
8233
|
+
return rules;
|
|
8234
|
+
}
|
|
8235
|
+
|
|
8236
|
+
const MOBILE_RULES = generateMobileRules();
|
|
8237
|
+
|
|
8238
|
+
|
|
8239
|
+
function validateBoxShadow(value) {
|
|
8240
|
+
// Support comma-separated multiple shadows
|
|
8241
|
+
const shadows = splitByTopLevelComma(value);
|
|
8242
|
+
return { valid: shadows.every(validateSingleShadow) };
|
|
8243
|
+
}
|
|
8244
|
+
|
|
8245
|
+
function validateSingleShadow(raw) {
|
|
8246
|
+
let s = raw.trim();
|
|
8247
|
+
if (!s) return false;
|
|
8248
|
+
|
|
8249
|
+
// Strip optional leading/trailing `inset` keyword
|
|
8250
|
+
s = s.replace(/^inset\s+/, "").replace(/\s+inset$/, "").trim();
|
|
8251
|
+
|
|
8252
|
+
// Extract rgba/rgb color (contains spaces inside parens, must handle first)
|
|
8253
|
+
let color = null;
|
|
8254
|
+
const rgbMatch = s.match(/rgba?\([^)]+\)/);
|
|
8255
|
+
if (rgbMatch) {
|
|
8256
|
+
color = rgbMatch[0];
|
|
8257
|
+
s = s.replace(color, "").trim();
|
|
8258
|
+
} else {
|
|
8259
|
+
// Extract hex at any position
|
|
8260
|
+
const hexMatch = s.match(/(^|\s)(#[0-9a-fA-F]{3,8})(\s|$)/);
|
|
8261
|
+
if (hexMatch) {
|
|
8262
|
+
color = hexMatch[2];
|
|
8263
|
+
s = s.replace(hexMatch[2], "").trim();
|
|
8264
|
+
} else {
|
|
8265
|
+
// Named color at end only
|
|
8266
|
+
const parts = s.split(/\s+/);
|
|
8267
|
+
const last = parts[parts.length - 1];
|
|
8268
|
+
if ((0,_common_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isNamedColor)(last)) {
|
|
8269
|
+
color = last;
|
|
8270
|
+
s = parts.slice(0, -1).join(" ").trim();
|
|
8271
|
+
}
|
|
8272
|
+
// color may be absent — React Native defaults to black, that's valid
|
|
8273
|
+
}
|
|
8274
|
+
}
|
|
8275
|
+
|
|
8276
|
+
if (color !== null) {
|
|
8277
|
+
if (!(0,_common_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isMobileColor)(color)) return false;
|
|
8278
|
+
}
|
|
8279
|
+
|
|
8280
|
+
// Remaining: 2–4 length values
|
|
8281
|
+
const parts = s.split(/\s+/).filter(Boolean);
|
|
8282
|
+
if (parts.length < 2 || parts.length > 4) return false;
|
|
8283
|
+
|
|
8284
|
+
return parts.every((p, i) => {
|
|
8285
|
+
const trimmedPart = String(p).trim();
|
|
8286
|
+
|
|
8287
|
+
// Offsets/spread accept `0` without units, but non-zero values must be px.
|
|
8288
|
+
if (trimmedPart === "0") return true;
|
|
8289
|
+
|
|
8290
|
+
if (i === 2) {
|
|
8291
|
+
// blurRadius >= 0
|
|
8292
|
+
return (0,_common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateSizeValue)(trimmedPart, {
|
|
8293
|
+
allowedUnits: ["px"],
|
|
8294
|
+
allowUnitless: false,
|
|
8295
|
+
allowNegative: false
|
|
8296
|
+
}).valid;
|
|
8297
|
+
}
|
|
8298
|
+
|
|
8299
|
+
// offsetX/offsetY and optional spreadDistance
|
|
8300
|
+
return (0,_common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateSizeValue)(trimmedPart, {
|
|
8301
|
+
allowedUnits: ["px"],
|
|
8302
|
+
allowUnitless: false,
|
|
8303
|
+
allowNegative: true
|
|
8304
|
+
}).valid;
|
|
8305
|
+
});
|
|
8306
|
+
}
|
|
8307
|
+
|
|
8308
|
+
|
|
8309
|
+
/** Split "a, rgba(1,2,3), b" by commas NOT inside parens */
|
|
8310
|
+
function splitByTopLevelComma(value) {
|
|
8311
|
+
const result = [];
|
|
8312
|
+
let depth = 0, current = "";
|
|
8313
|
+
for (const ch of value) {
|
|
8314
|
+
if (ch === "(") depth++;
|
|
8315
|
+
else if (ch === ")") depth--;
|
|
8316
|
+
else if (ch === "," && depth === 0) {
|
|
8317
|
+
result.push(current.trim());
|
|
8318
|
+
current = "";
|
|
8319
|
+
continue;
|
|
8320
|
+
}
|
|
8321
|
+
current += ch;
|
|
8322
|
+
}
|
|
8323
|
+
if (current.trim()) result.push(current.trim());
|
|
8324
|
+
return result;
|
|
8325
|
+
}
|
|
8326
|
+
|
|
8327
|
+
|
|
8328
|
+
|
|
8329
|
+
|
|
8330
|
+
/***/ },
|
|
8331
|
+
|
|
8332
|
+
/***/ "./src/token-validation/validator-utils/web.js"
|
|
8333
|
+
/*!*****************************************************!*\
|
|
8334
|
+
!*** ./src/token-validation/validator-utils/web.js ***!
|
|
8335
|
+
\*****************************************************/
|
|
8336
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
8337
|
+
|
|
8338
|
+
"use strict";
|
|
8339
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8340
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8341
|
+
/* harmony export */ WEB_VALIDATION_RULES: () => (/* binding */ WEB_VALIDATION_RULES)
|
|
8342
|
+
/* harmony export */ });
|
|
8343
|
+
/* harmony import */ var _common_primitives_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/primitives.js */ "./src/token-validation/validator-utils/common/primitives.js");
|
|
8344
|
+
/* harmony import */ var _common_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./common/utils.js */ "./src/token-validation/validator-utils/common/utils.js");
|
|
8345
|
+
/* harmony import */ var _common_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common/constants.js */ "./src/token-validation/validator-utils/common/constants.js");
|
|
8346
|
+
|
|
8347
|
+
|
|
8348
|
+
|
|
8349
|
+
|
|
8350
|
+
function generateWebRules() {
|
|
8351
|
+
const rules = {};
|
|
8352
|
+
|
|
8353
|
+
Object.keys(_common_constants_js__WEBPACK_IMPORTED_MODULE_2__.BASE_SUBTYPE_CONFIGS).forEach(subtype => {
|
|
8354
|
+
const rule = (0,_common_constants_js__WEBPACK_IMPORTED_MODULE_2__.getPlatformRule)(subtype, 'web');
|
|
8355
|
+
if (!rule) return;
|
|
8356
|
+
|
|
8357
|
+
rule.validate = (0,_common_constants_js__WEBPACK_IMPORTED_MODULE_2__.resolveRuleValidator)(rule.type, subtype, 'web', {
|
|
8358
|
+
validateFromAllowedList: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateFromAllowedList,
|
|
8359
|
+
validatePlatformSizeValue: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validatePlatformSizeValue,
|
|
8360
|
+
validatePlatformSpaceValue: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validatePlatformSpaceValue,
|
|
8361
|
+
validateFontFamily: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateFontFamily,
|
|
8362
|
+
validateOpacity: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateOpacity,
|
|
8363
|
+
validateFontWeight: _common_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateFontWeight,
|
|
8364
|
+
validateBoxShadow
|
|
8365
|
+
});
|
|
8366
|
+
|
|
8367
|
+
// Set custom description if available
|
|
8368
|
+
if (rule.customDescription && rule.customDescription.web) {
|
|
8369
|
+
rule.customDescription = rule.customDescription.web;
|
|
8370
|
+
} else if (rule.customDescription && typeof rule.customDescription === 'string') {
|
|
8371
|
+
// Keep existing string descriptions
|
|
8372
|
+
}
|
|
8373
|
+
|
|
8374
|
+
rules[subtype] = rule;
|
|
8375
|
+
});
|
|
8376
|
+
|
|
8377
|
+
return rules;
|
|
8378
|
+
}
|
|
8379
|
+
|
|
8380
|
+
const WEB_VALIDATION_RULES = generateWebRules();
|
|
8381
|
+
|
|
8382
|
+
// ─── Validation Functions ────────────────────────────────────────────────────
|
|
8383
|
+
|
|
8384
|
+
function validateBoxShadow(value) {
|
|
8385
|
+
const trimmed = String(value).trim();
|
|
8386
|
+
|
|
8387
|
+
if (trimmed === "none") {
|
|
8388
|
+
return { valid: true };
|
|
8389
|
+
}
|
|
8390
|
+
|
|
8391
|
+
// Split by comma for multiple shadows
|
|
8392
|
+
const shadows = trimmed.split(',').map(s => s.trim());
|
|
8393
|
+
|
|
8394
|
+
for (const shadow of shadows) {
|
|
8395
|
+
if (!isValidSingleShadow(shadow)) {
|
|
8396
|
+
return {
|
|
8397
|
+
valid: false,
|
|
8398
|
+
error: `Invalid box-shadow format: "${shadow}". Expected format: "[inset] <x> <y> [blur] [spread] <color>"`
|
|
8399
|
+
};
|
|
8400
|
+
}
|
|
8401
|
+
}
|
|
8402
|
+
|
|
8403
|
+
return { valid: true };
|
|
8404
|
+
}
|
|
8405
|
+
|
|
8406
|
+
function isValidSingleShadow(shadow) {
|
|
8407
|
+
// Very basic validation - could be more sophisticated
|
|
8408
|
+
const parts = shadow.split(/\s+/);
|
|
8409
|
+
|
|
8410
|
+
// Need at least x, y, and color
|
|
8411
|
+
if (parts.length < 3) return false;
|
|
8412
|
+
|
|
8413
|
+
let hasInset = false;
|
|
8414
|
+
let sizeCount = 0;
|
|
8415
|
+
let hasColor = false;
|
|
8416
|
+
|
|
8417
|
+
for (const part of parts) {
|
|
8418
|
+
if (part === "inset") {
|
|
8419
|
+
hasInset = true;
|
|
8420
|
+
} else if ((0,_common_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isPx)(part) || (0,_common_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isRem)(part) || (0,_common_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isEm)(part) || (0,_common_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isUnitlessNumber)(part)) {
|
|
8421
|
+
sizeCount++;
|
|
8422
|
+
} else if ((0,_common_primitives_js__WEBPACK_IMPORTED_MODULE_0__.isWebColor)(part)) {
|
|
8423
|
+
hasColor = true;
|
|
8424
|
+
}
|
|
8425
|
+
}
|
|
8426
|
+
|
|
8427
|
+
// Need at least 2 size values (x, y) and a color
|
|
8428
|
+
return sizeCount >= 2 && hasColor;
|
|
8429
|
+
}
|
|
8430
|
+
|
|
7186
8431
|
/***/ },
|
|
7187
8432
|
|
|
7188
8433
|
/***/ "./src/utils/style-dictionary-utils.js"
|
|
@@ -8143,12 +9388,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8143
9388
|
/* harmony export */ getComponentsList: () => (/* binding */ getComponentsList),
|
|
8144
9389
|
/* harmony export */ getSelectorFromGroup: () => (/* reexport safe */ _src_utils_style_dictionary_utils_js__WEBPACK_IMPORTED_MODULE_3__.getSelectorFromGroup),
|
|
8145
9390
|
/* harmony export */ getTokens: () => (/* binding */ getTokens),
|
|
8146
|
-
/* harmony export */ loadComponentTokens: () => (/* binding */ loadComponentTokens)
|
|
9391
|
+
/* harmony export */ loadComponentTokens: () => (/* binding */ loadComponentTokens),
|
|
9392
|
+
/* harmony export */ validateTokenValue: () => (/* reexport safe */ _src_token_validation_validate_value_js__WEBPACK_IMPORTED_MODULE_4__["default"])
|
|
8147
9393
|
/* harmony export */ });
|
|
8148
9394
|
/* harmony import */ var chroma_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! chroma-js */ "./node_modules/chroma-js/index.js");
|
|
8149
9395
|
/* harmony import */ var _web_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./web.index */ "./web.index.ts");
|
|
8150
9396
|
/* harmony import */ var _native_mobile_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./native_mobile.index */ "./native_mobile.index.ts");
|
|
8151
9397
|
/* harmony import */ var _src_utils_style_dictionary_utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./src/utils/style-dictionary-utils.js */ "./src/utils/style-dictionary-utils.js");
|
|
9398
|
+
/* harmony import */ var _src_token_validation_validate_value_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./src/token-validation/validate-value.js */ "./src/token-validation/validate-value.js");
|
|
8152
9399
|
// Primitives
|
|
8153
9400
|
|
|
8154
9401
|
|
|
@@ -8195,6 +9442,7 @@ const getComponentsList = (platform) => {
|
|
|
8195
9442
|
};
|
|
8196
9443
|
|
|
8197
9444
|
|
|
9445
|
+
|
|
8198
9446
|
})();
|
|
8199
9447
|
|
|
8200
9448
|
var __webpack_export_target__ = exports;
|