@fractal-io-technology/spec 0.0.0-stage → 2.2.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/LICENSE +202 -0
- package/README.md +165 -2
- package/conformance/1.0/action-cases.json +227 -0
- package/conformance/1.0/bind-cases.json +768 -0
- package/conformance/1.0/cases.json +25139 -0
- package/conformance/1.0/layout/01-onboarding-start.json +95 -0
- package/conformance/1.0/layout/02-home-discover.json +177 -0
- package/conformance/1.0/layout/03-filters.json +186 -0
- package/conformance/1.0/layout/README.md +145 -0
- package/conformance/1.0/layout/REPORT.md +222 -0
- package/conformance/1.0/layout/alert.json +22 -0
- package/conformance/1.0/layout/iphone-14-15-pro-107.json +272 -0
- package/conformance/1.0/layout/live_status_on_its_way_4.ios.json +100 -0
- package/conformance/1.0/layout/lucy-booking-mobile.json +261 -0
- package/conformance/1.0/layout/lucy-booking-tablet.json +817 -0
- package/conformance/1.0/layout/lucy-booking.json +185 -0
- package/conformance/1.0/layout/lucy-header.json +84 -0
- package/conformance/1.0/layout/lucy-welcome-pin-mobile.json +31 -0
- package/conformance/1.0/layout/lucy-welcome-pin.json +31 -0
- package/conformance/1.0/layout/measured/android/01-onboarding-start.json +95 -0
- package/conformance/1.0/layout/measured/android/02-home-discover.json +177 -0
- package/conformance/1.0/layout/measured/android/03-filters.json +186 -0
- package/conformance/1.0/layout/measured/android/alert.json +22 -0
- package/conformance/1.0/layout/measured/android/iphone-14-15-pro-107.json +272 -0
- package/conformance/1.0/layout/measured/android/live_status_on_its_way_4.ios.json +100 -0
- package/conformance/1.0/layout/measured/android/lucy-booking-mobile.json +261 -0
- package/conformance/1.0/layout/measured/android/lucy-booking-tablet.json +817 -0
- package/conformance/1.0/layout/measured/android/lucy-booking.json +185 -0
- package/conformance/1.0/layout/measured/android/lucy-header.json +84 -0
- package/conformance/1.0/layout/measured/android/lucy-welcome-pin-mobile.json +31 -0
- package/conformance/1.0/layout/measured/android/lucy-welcome-pin.json +31 -0
- package/conformance/1.0/layout/measured/android/navigation-bar.json +46 -0
- package/conformance/1.0/layout/measured/android/probe-alert-banner-flutter.json +37 -0
- package/conformance/1.0/layout/measured/android/probe-alert-banner-regression-flutter.json +51 -0
- package/conformance/1.0/layout/measured/android/probe-alert-banner-stack-flutter.json +29 -0
- package/conformance/1.0/layout/measured/android/probe-card.json +35 -0
- package/conformance/1.0/layout/measured/android/probe-check-box-flutter.json +20 -0
- package/conformance/1.0/layout/measured/android/probe-container-height.json +21 -0
- package/conformance/1.0/layout/measured/android/probe-divider.json +55 -0
- package/conformance/1.0/layout/measured/android/probe-dropdown-menu-flutter.json +24 -0
- package/conformance/1.0/layout/measured/android/probe-dropdown-menu-max-lines.json +11 -0
- package/conformance/1.0/layout/measured/android/probe-expanded.json +31 -0
- package/conformance/1.0/layout/measured/android/probe-failed-decode.json +11 -0
- package/conformance/1.0/layout/measured/android/probe-flex.json +43 -0
- package/conformance/1.0/layout/measured/android/probe-grid-flutter.json +78 -0
- package/conformance/1.0/layout/measured/android/probe-grid.json +29 -0
- package/conformance/1.0/layout/measured/android/probe-icon-button-flutter.json +25 -0
- package/conformance/1.0/layout/measured/android/probe-icon-flutter.json +19 -0
- package/conformance/1.0/layout/measured/android/probe-icon-sizing.json +36 -0
- package/conformance/1.0/layout/measured/android/probe-image-flutter.json +24 -0
- package/conformance/1.0/layout/measured/android/probe-list-flutter.json +79 -0
- package/conformance/1.0/layout/measured/android/probe-list-regression-flutter.json +94 -0
- package/conformance/1.0/layout/measured/android/probe-list-row-flutter.json +86 -0
- package/conformance/1.0/layout/measured/android/probe-list-styles.json +45 -0
- package/conformance/1.0/layout/measured/android/probe-pin-input-parity.json +18 -0
- package/conformance/1.0/layout/measured/android/probe-progress-track-flutter.json +41 -0
- package/conformance/1.0/layout/measured/android/probe-progress-track-regression-flutter.json +57 -0
- package/conformance/1.0/layout/measured/android/probe-row-column.json +84 -0
- package/conformance/1.0/layout/measured/android/probe-scroll.json +54 -0
- package/conformance/1.0/layout/measured/android/probe-search-flutter.json +22 -0
- package/conformance/1.0/layout/measured/android/probe-size-constraints.json +20 -0
- package/conformance/1.0/layout/measured/android/probe-spacer.json +43 -0
- package/conformance/1.0/layout/measured/android/probe-stat-progress-track.json +14 -0
- package/conformance/1.0/layout/measured/android/probe-text-button-flutter.json +27 -0
- package/conformance/1.0/layout/measured/android/probe-text-field-flutter.json +28 -0
- package/conformance/1.0/layout/measured/android/probe-text.json +30 -0
- package/conformance/1.0/layout/measured/android/wallet-home.json +127 -0
- package/conformance/1.0/layout/measured/web/01-onboarding-start.json +95 -0
- package/conformance/1.0/layout/measured/web/02-home-discover.json +177 -0
- package/conformance/1.0/layout/measured/web/03-filters.json +186 -0
- package/conformance/1.0/layout/measured/web/alert.json +22 -0
- package/conformance/1.0/layout/measured/web/iphone-14-15-pro-107.json +272 -0
- package/conformance/1.0/layout/measured/web/live_status_on_its_way_4.ios.json +100 -0
- package/conformance/1.0/layout/measured/web/lucy-booking-mobile.json +261 -0
- package/conformance/1.0/layout/measured/web/lucy-booking-tablet.json +817 -0
- package/conformance/1.0/layout/measured/web/lucy-booking.json +185 -0
- package/conformance/1.0/layout/measured/web/lucy-header.json +84 -0
- package/conformance/1.0/layout/measured/web/lucy-welcome-pin-mobile.json +31 -0
- package/conformance/1.0/layout/measured/web/lucy-welcome-pin.json +31 -0
- package/conformance/1.0/layout/measured/web/navigation-bar.json +46 -0
- package/conformance/1.0/layout/measured/web/probe-alert-banner-flutter.json +37 -0
- package/conformance/1.0/layout/measured/web/probe-alert-banner-regression-flutter.json +51 -0
- package/conformance/1.0/layout/measured/web/probe-alert-banner-stack-flutter.json +29 -0
- package/conformance/1.0/layout/measured/web/probe-card.json +35 -0
- package/conformance/1.0/layout/measured/web/probe-check-box-flutter.json +20 -0
- package/conformance/1.0/layout/measured/web/probe-container-height.json +21 -0
- package/conformance/1.0/layout/measured/web/probe-divider.json +55 -0
- package/conformance/1.0/layout/measured/web/probe-dropdown-menu-flutter.json +24 -0
- package/conformance/1.0/layout/measured/web/probe-dropdown-menu-max-lines.json +11 -0
- package/conformance/1.0/layout/measured/web/probe-expanded.json +31 -0
- package/conformance/1.0/layout/measured/web/probe-failed-decode.json +15 -0
- package/conformance/1.0/layout/measured/web/probe-flex.json +43 -0
- package/conformance/1.0/layout/measured/web/probe-grid-flutter.json +78 -0
- package/conformance/1.0/layout/measured/web/probe-grid.json +29 -0
- package/conformance/1.0/layout/measured/web/probe-icon-button-flutter.json +25 -0
- package/conformance/1.0/layout/measured/web/probe-icon-flutter.json +19 -0
- package/conformance/1.0/layout/measured/web/probe-icon-sizing.json +36 -0
- package/conformance/1.0/layout/measured/web/probe-image-flutter.json +24 -0
- package/conformance/1.0/layout/measured/web/probe-list-flutter.json +79 -0
- package/conformance/1.0/layout/measured/web/probe-list-regression-flutter.json +94 -0
- package/conformance/1.0/layout/measured/web/probe-list-row-flutter.json +86 -0
- package/conformance/1.0/layout/measured/web/probe-list-styles.json +45 -0
- package/conformance/1.0/layout/measured/web/probe-pin-input-parity.json +18 -0
- package/conformance/1.0/layout/measured/web/probe-progress-track-flutter.json +41 -0
- package/conformance/1.0/layout/measured/web/probe-progress-track-regression-flutter.json +57 -0
- package/conformance/1.0/layout/measured/web/probe-row-column.json +84 -0
- package/conformance/1.0/layout/measured/web/probe-scroll.json +54 -0
- package/conformance/1.0/layout/measured/web/probe-search-flutter.json +22 -0
- package/conformance/1.0/layout/measured/web/probe-size-constraints.json +20 -0
- package/conformance/1.0/layout/measured/web/probe-spacer.json +43 -0
- package/conformance/1.0/layout/measured/web/probe-stat-progress-track.json +14 -0
- package/conformance/1.0/layout/measured/web/probe-text-button-flutter.json +27 -0
- package/conformance/1.0/layout/measured/web/probe-text-field-flutter.json +28 -0
- package/conformance/1.0/layout/measured/web/probe-text.json +30 -0
- package/conformance/1.0/layout/measured/web/wallet-home.json +127 -0
- package/conformance/1.0/layout/navigation-bar.json +46 -0
- package/conformance/1.0/layout/probe-alert-banner-flutter.json +37 -0
- package/conformance/1.0/layout/probe-alert-banner-regression-flutter.json +51 -0
- package/conformance/1.0/layout/probe-alert-banner-stack-flutter.json +29 -0
- package/conformance/1.0/layout/probe-card.json +35 -0
- package/conformance/1.0/layout/probe-check-box-flutter.json +20 -0
- package/conformance/1.0/layout/probe-container-height.json +21 -0
- package/conformance/1.0/layout/probe-divider.json +55 -0
- package/conformance/1.0/layout/probe-dropdown-menu-flutter.json +24 -0
- package/conformance/1.0/layout/probe-dropdown-menu-max-lines.json +11 -0
- package/conformance/1.0/layout/probe-expanded.json +31 -0
- package/conformance/1.0/layout/probe-failed-decode.json +13 -0
- package/conformance/1.0/layout/probe-flex.json +43 -0
- package/conformance/1.0/layout/probe-grid-flutter.json +78 -0
- package/conformance/1.0/layout/probe-grid.json +29 -0
- package/conformance/1.0/layout/probe-icon-button-flutter.json +25 -0
- package/conformance/1.0/layout/probe-icon-flutter.json +19 -0
- package/conformance/1.0/layout/probe-icon-sizing.json +36 -0
- package/conformance/1.0/layout/probe-image-flutter.json +24 -0
- package/conformance/1.0/layout/probe-list-flutter.json +79 -0
- package/conformance/1.0/layout/probe-list-regression-flutter.json +94 -0
- package/conformance/1.0/layout/probe-list-row-flutter.json +86 -0
- package/conformance/1.0/layout/probe-list-styles.json +45 -0
- package/conformance/1.0/layout/probe-pin-input-parity.json +18 -0
- package/conformance/1.0/layout/probe-progress-track-flutter.json +41 -0
- package/conformance/1.0/layout/probe-progress-track-regression-flutter.json +57 -0
- package/conformance/1.0/layout/probe-row-column.json +84 -0
- package/conformance/1.0/layout/probe-scroll.json +54 -0
- package/conformance/1.0/layout/probe-search-flutter.json +22 -0
- package/conformance/1.0/layout/probe-size-constraints.json +20 -0
- package/conformance/1.0/layout/probe-spacer.json +43 -0
- package/conformance/1.0/layout/probe-stat-progress-track.json +14 -0
- package/conformance/1.0/layout/probe-text-button-flutter.json +27 -0
- package/conformance/1.0/layout/probe-text-field-flutter.json +28 -0
- package/conformance/1.0/layout/probe-text.json +30 -0
- package/conformance/1.0/layout/probes/probe-alert-banner-flutter.json +296 -0
- package/conformance/1.0/layout/probes/probe-alert-banner-regression-flutter.json +1 -0
- package/conformance/1.0/layout/probes/probe-alert-banner-stack-flutter.json +219 -0
- package/conformance/1.0/layout/probes/probe-card.json +252 -0
- package/conformance/1.0/layout/probes/probe-check-box-flutter.json +86 -0
- package/conformance/1.0/layout/probes/probe-container-height.json +147 -0
- package/conformance/1.0/layout/probes/probe-divider.json +469 -0
- package/conformance/1.0/layout/probes/probe-dropdown-menu-flutter.json +293 -0
- package/conformance/1.0/layout/probes/probe-dropdown-menu-max-lines.json +54 -0
- package/conformance/1.0/layout/probes/probe-expanded.json +208 -0
- package/conformance/1.0/layout/probes/probe-failed-decode.json +96 -0
- package/conformance/1.0/layout/probes/probe-flex.json +353 -0
- package/conformance/1.0/layout/probes/probe-grid-flutter.json +584 -0
- package/conformance/1.0/layout/probes/probe-grid.json +209 -0
- package/conformance/1.0/layout/probes/probe-icon-button-flutter.json +143 -0
- package/conformance/1.0/layout/probes/probe-icon-flutter.json +89 -0
- package/conformance/1.0/layout/probes/probe-icon-sizing.json +219 -0
- package/conformance/1.0/layout/probes/probe-image-flutter.json +130 -0
- package/conformance/1.0/layout/probes/probe-list-flutter.json +732 -0
- package/conformance/1.0/layout/probes/probe-list-regression-flutter.json +815 -0
- package/conformance/1.0/layout/probes/probe-list-row-flutter.json +734 -0
- package/conformance/1.0/layout/probes/probe-list-styles.json +332 -0
- package/conformance/1.0/layout/probes/probe-pin-input-parity.json +87 -0
- package/conformance/1.0/layout/probes/probe-progress-track-flutter.json +298 -0
- package/conformance/1.0/layout/probes/probe-progress-track-regression-flutter.json +525 -0
- package/conformance/1.0/layout/probes/probe-row-column.json +784 -0
- package/conformance/1.0/layout/probes/probe-scroll.json +378 -0
- package/conformance/1.0/layout/probes/probe-search-flutter.json +138 -0
- package/conformance/1.0/layout/probes/probe-size-constraints.json +157 -0
- package/conformance/1.0/layout/probes/probe-spacer.json +291 -0
- package/conformance/1.0/layout/probes/probe-stat-progress-track.json +87 -0
- package/conformance/1.0/layout/probes/probe-text-button-flutter.json +163 -0
- package/conformance/1.0/layout/probes/probe-text-field-flutter.json +170 -0
- package/conformance/1.0/layout/probes/probe-text.json +202 -0
- package/conformance/1.0/layout/report/01-onboarding-start.md +49 -0
- package/conformance/1.0/layout/report/02-home-discover.md +98 -0
- package/conformance/1.0/layout/report/03-filters.md +85 -0
- package/conformance/1.0/layout/report/alert.md +27 -0
- package/conformance/1.0/layout/report/iphone-14-15-pro-107.md +47 -0
- package/conformance/1.0/layout/report/live_status_on_its_way_4.ios.md +60 -0
- package/conformance/1.0/layout/report/lucy-booking-mobile.md +81 -0
- package/conformance/1.0/layout/report/lucy-booking-tablet.md +279 -0
- package/conformance/1.0/layout/report/lucy-booking.md +117 -0
- package/conformance/1.0/layout/report/lucy-header.md +64 -0
- package/conformance/1.0/layout/report/lucy-welcome-pin-mobile.md +15 -0
- package/conformance/1.0/layout/report/lucy-welcome-pin.md +11 -0
- package/conformance/1.0/layout/report/navigation-bar.md +23 -0
- package/conformance/1.0/layout/report/probe-alert-banner-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-alert-banner-regression-flutter.md +27 -0
- package/conformance/1.0/layout/report/probe-alert-banner-stack-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-card.md +11 -0
- package/conformance/1.0/layout/report/probe-check-box-flutter.md +17 -0
- package/conformance/1.0/layout/report/probe-divider.md +11 -0
- package/conformance/1.0/layout/report/probe-dropdown-menu-flutter.md +15 -0
- package/conformance/1.0/layout/report/probe-dropdown-menu-max-lines.md +15 -0
- package/conformance/1.0/layout/report/probe-flex.md +23 -0
- package/conformance/1.0/layout/report/probe-grid-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-icon-button-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-icon-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-image-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-list-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-list-regression-flutter.md +27 -0
- package/conformance/1.0/layout/report/probe-list-row-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-pin-input-parity.md +11 -0
- package/conformance/1.0/layout/report/probe-progress-track-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-progress-track-regression-flutter.md +20 -0
- package/conformance/1.0/layout/report/probe-row-column.md +20 -0
- package/conformance/1.0/layout/report/probe-scroll.md +11 -0
- package/conformance/1.0/layout/report/probe-search-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-spacer.md +11 -0
- package/conformance/1.0/layout/report/probe-text-button-flutter.md +22 -0
- package/conformance/1.0/layout/report/probe-text-field-flutter.md +11 -0
- package/conformance/1.0/layout/report/probe-text.md +31 -0
- package/conformance/1.0/layout/report/wallet-home.md +35 -0
- package/conformance/1.0/layout/tolerance.json +12 -0
- package/conformance/1.0/layout/wallet-home.json +127 -0
- package/conformance/1.0/response-cases.json +228 -0
- package/conformance/1.0/screen-cases.json +198 -0
- package/conformance/1.0/screens/01-onboarding-start.json +994 -0
- package/conformance/1.0/screens/02-home-discover.json +2165 -0
- package/conformance/1.0/screens/03-filters.json +2290 -0
- package/conformance/1.0/screens/alert.json +231 -0
- package/conformance/1.0/screens/iphone-14-15-pro-107.json +3149 -0
- package/conformance/1.0/screens/live_status_on_its_way_4.ios.json +1313 -0
- package/conformance/1.0/screens/lucy-booking-mobile.json +3063 -0
- package/conformance/1.0/screens/lucy-booking-tablet.json +10371 -0
- package/conformance/1.0/screens/lucy-booking.json +2130 -0
- package/conformance/1.0/screens/lucy-header.json +1201 -0
- package/conformance/1.0/screens/lucy-welcome-pin-mobile.json +417 -0
- package/conformance/1.0/screens/lucy-welcome-pin.json +409 -0
- package/conformance/1.0/screens/navigation-bar.json +542 -0
- package/conformance/1.0/screens/wallet-home.json +1585 -0
- package/dist/action.d.ts +10616 -0
- package/dist/action.d.ts.map +1 -0
- package/dist/action.js +92 -0
- package/dist/action.js.map +1 -0
- package/dist/bind.d.ts +32 -0
- package/dist/bind.d.ts.map +1 -0
- package/dist/bind.js +102 -0
- package/dist/bind.js.map +1 -0
- package/dist/block-ref.d.ts +17 -0
- package/dist/block-ref.d.ts.map +1 -0
- package/dist/block-ref.js +17 -0
- package/dist/block-ref.js.map +1 -0
- package/dist/block-types.d.ts +26 -0
- package/dist/block-types.d.ts.map +1 -0
- package/dist/block-types.js +39 -0
- package/dist/block-types.js.map +1 -0
- package/dist/block.d.ts +20908 -0
- package/dist/block.d.ts.map +1 -0
- package/dist/block.js +81 -0
- package/dist/block.js.map +1 -0
- package/dist/blocks/display.d.ts +1915 -0
- package/dist/blocks/display.d.ts.map +1 -0
- package/dist/blocks/display.js +433 -0
- package/dist/blocks/display.js.map +1 -0
- package/dist/blocks/input.d.ts +7148 -0
- package/dist/blocks/input.d.ts.map +1 -0
- package/dist/blocks/input.js +855 -0
- package/dist/blocks/input.js.map +1 -0
- package/dist/blocks/layout.d.ts +2482 -0
- package/dist/blocks/layout.d.ts.map +1 -0
- package/dist/blocks/layout.js +266 -0
- package/dist/blocks/layout.js.map +1 -0
- package/dist/blocks/list.d.ts +980 -0
- package/dist/blocks/list.d.ts.map +1 -0
- package/dist/blocks/list.js +286 -0
- package/dist/blocks/list.js.map +1 -0
- package/dist/common.d.ts +958 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +108 -0
- package/dist/common.js.map +1 -0
- package/dist/deprecated.d.ts +11 -0
- package/dist/deprecated.d.ts.map +1 -0
- package/dist/deprecated.js +26 -0
- package/dist/deprecated.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +103 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +113 -0
- package/dist/layout.js.map +1 -0
- package/dist/properties.d.ts +787 -0
- package/dist/properties.d.ts.map +1 -0
- package/dist/properties.js +447 -0
- package/dist/properties.js.map +1 -0
- package/dist/screen.d.ts +10494 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +32 -0
- package/dist/screen.js.map +1 -0
- package/package.json +57 -4
- package/schema/1.0/action.json +109 -0
- package/schema/1.0/block.json +5886 -0
- package/schema/1.0/response.json +91 -0
- package/schema/1.0/screen.json +22 -0
- package/src/README.md +135 -0
- package/src/action.ts +119 -0
- package/src/bind.ts +114 -0
- package/src/block-ref.ts +18 -0
- package/src/block-types.ts +55 -0
- package/src/block.ts +116 -0
- package/src/blocks/display.ts +543 -0
- package/src/blocks/input.ts +1031 -0
- package/src/blocks/layout.ts +322 -0
- package/src/blocks/list.ts +355 -0
- package/src/common.ts +133 -0
- package/src/deprecated.ts +40 -0
- package/src/index.ts +31 -0
- package/src/layout.ts +194 -0
- package/src/properties.ts +516 -0
- package/src/screen.ts +39 -0
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reusable property schemas shared by several blocks. Each mirrors a Swift
|
|
5
|
+
* decoder under `fractal_core_blocks-ios/Sources/Properties`, `Sources/Utils`
|
|
6
|
+
* or `Sources/EventManagement`.
|
|
7
|
+
*
|
|
8
|
+
* Conventions (see src/README.md):
|
|
9
|
+
* - JSON keys are the snake_case names from the Swift `CodingKeys`.
|
|
10
|
+
* - `decodeIfPresent` / Swift optionals become `.optional()`; `decode` becomes
|
|
11
|
+
* required.
|
|
12
|
+
* - Swift `Double` is `z.number()`, Swift `Int` is an integer number.
|
|
13
|
+
* - Objects are strict: unknown keys are rejected even though the Swift
|
|
14
|
+
* decoders would ignore them, so that typos never reach a device unnoticed.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Swift `Int`: JSON numbers with a fractional part fail to decode. */
|
|
18
|
+
export const intSchema = z.number().int();
|
|
19
|
+
|
|
20
|
+
// --- Color -----------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The only hex form of the contract: optional `#`, then exactly 6 hex digits
|
|
24
|
+
* (`#RRGGBB`). Transparency is never part of the hex: it goes in `alpha`.
|
|
25
|
+
* `#RGB`, `#RGBA` and `#RRGGBBAA` are rejected.
|
|
26
|
+
*/
|
|
27
|
+
const HEX_COLOR_PATTERN = /^#?[0-9a-fA-F]{6}$/;
|
|
28
|
+
|
|
29
|
+
/** Swift: FIOCoreColorProperty (Sources/Properties/FIOCoreColorProperty.swift). */
|
|
30
|
+
export const colorSchema = z.strictObject({
|
|
31
|
+
color: z.string().regex(HEX_COLOR_PATTERN, "Expected #RRGGBB (put transparency in alpha)"),
|
|
32
|
+
/** iOS clamps to 0...1; the schema only accepts that range. */
|
|
33
|
+
alpha: z.number().min(0).max(1).optional(),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// --- Layout ----------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The 9-value alignment of the contract: a vertical part (`top`, `center`,
|
|
40
|
+
* `bottom`) and a horizontal part (`start`, `center`, `end`), with `center`
|
|
41
|
+
* alone for the middle. `start` / `end` follow the layout direction.
|
|
42
|
+
*
|
|
43
|
+
* Swift: FIOCoreAlignment (Sources/Properties/FIOCoreAlignment.swift), which
|
|
44
|
+
* also decodes the gradient points and the background image anchor
|
|
45
|
+
* (`unitPointSchema`). Decoding fails for any other string, which drops the
|
|
46
|
+
* whole block.
|
|
47
|
+
*/
|
|
48
|
+
export const alignmentSchema = z.enum([
|
|
49
|
+
"top_start",
|
|
50
|
+
"top_center",
|
|
51
|
+
"top_end",
|
|
52
|
+
"center_start",
|
|
53
|
+
"center",
|
|
54
|
+
"center_end",
|
|
55
|
+
"bottom_start",
|
|
56
|
+
"bottom_center",
|
|
57
|
+
"bottom_end",
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Cross-axis alignment of a multi-child stack (`row`, `column`): `start`,
|
|
62
|
+
* `center` or `end` along the axis the stack does not lay out on (vertical for
|
|
63
|
+
* a row, horizontal for a column).
|
|
64
|
+
*/
|
|
65
|
+
export const crossAxisAlignmentSchema = z.enum(["start", "center", "end"]);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Flutter `CrossAxisAlignment` of a `row` / `column` (contract 2.0): the stack enum plus `stretch`
|
|
69
|
+
* (a non-flex child is forced to the maximum cross extent when it is bounded) and `baseline` (row
|
|
70
|
+
* children aligned on their `text_baseline`; in a column it acts as `start`). Row and column only:
|
|
71
|
+
* `grid` and the list family keep `crossAxisAlignmentSchema`. Absent = `center`.
|
|
72
|
+
*/
|
|
73
|
+
export const flexCrossAxisAlignmentSchema = z.enum(["start", "center", "end", "stretch", "baseline"]);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Flutter `MainAxisAlignment`: where a `row` / `column` places its children along the main axis.
|
|
77
|
+
* Negative free space counts as 0; `space_between` with fewer than 2 children is `start`;
|
|
78
|
+
* `space_around` / `space_evenly` with one child is `center`. Absent = `start`.
|
|
79
|
+
*/
|
|
80
|
+
export const mainAxisAlignmentSchema = z.enum(["start", "end", "center", "space_between", "space_around", "space_evenly"]);
|
|
81
|
+
|
|
82
|
+
/** Flutter `MainAxisSize`: `max` (the default) fills a bounded main axis and hugs an unbounded one; `min` hugs. */
|
|
83
|
+
export const mainAxisSizeSchema = z.enum(["max", "min"]);
|
|
84
|
+
|
|
85
|
+
/** Flutter `VerticalDirection`: `down` (the default) lays a column out top to bottom, `up` bottom to top. */
|
|
86
|
+
export const verticalDirectionSchema = z.enum(["down", "up"]);
|
|
87
|
+
|
|
88
|
+
/** Flutter `TextBaseline`, used by the `baseline` cross-axis alignment. Absent with `baseline` = `alphabetic`. */
|
|
89
|
+
export const textBaselineSchema = z.enum(["alphabetic", "ideographic"]);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Flutter `TextAlign` (contract 2.0): `start` (the default) / `end` follow the text direction,
|
|
93
|
+
* `left` / `right` are absolute, `justify` stretches every line but the last to the width.
|
|
94
|
+
* Shared by `text` and `text_field`. Swift: FIOCoreTextAlignment (Sources/Utils/FIOCoreTextAlignment.swift).
|
|
95
|
+
*/
|
|
96
|
+
export const textAlignmentSchema = z.enum(["start", "center", "end", "left", "right", "justify"]);
|
|
97
|
+
|
|
98
|
+
/** Swift: FIOCoreLayoutShape, declared in Sources/Blocks/List/FIOCoreListViewModelBlock.swift. */
|
|
99
|
+
export const shapeSchema = z.enum(["circle", "rect", "capsule"]);
|
|
100
|
+
|
|
101
|
+
/** Swift: FIOCoreSizeBlock (Sources/Properties/FIOCoreSizeBlock.swift). */
|
|
102
|
+
export const sizeSchema = z.strictObject({
|
|
103
|
+
height: z.number().optional(),
|
|
104
|
+
width: z.number().optional(),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Edge anchors of every padding list: `padding`, `margin`, the text button and
|
|
109
|
+
* list row paddings, and `text_field.decoration.content_padding`. `start` /
|
|
110
|
+
* `end` follow the layout direction (Flutter `EdgeInsetsDirectional`); `left` /
|
|
111
|
+
* `right` are absolute (Flutter `EdgeInsets`); `horizontal` / `vertical` set
|
|
112
|
+
* both edges of an axis (Flutter `EdgeInsets.symmetric`). Resolution is shared
|
|
113
|
+
* by every consumer (Swift: `[FIOCorePaddingBlock].constant(for:)` in
|
|
114
|
+
* Sources/Properties/FIOCorePaddingBlock.swift): for each edge, a specific
|
|
115
|
+
* anchor (`top`, `bottom`, `start`, `end`, `left`, `right`) wins over its axis
|
|
116
|
+
* (`horizontal`, `vertical`), which wins over `"all"`; when a directional and an
|
|
117
|
+
* absolute anchor name the same physical edge (`start` and `left` in a
|
|
118
|
+
* left-to-right layout), they add up, as Flutter's mixed insets do. The first
|
|
119
|
+
* entry of a repeated anchor wins. The native decoders read `anchor` as a free
|
|
120
|
+
* `String` and silently ignore any other value.
|
|
121
|
+
*/
|
|
122
|
+
export const edgeAnchorSchema = z.enum(["top", "bottom", "start", "end", "left", "right", "horizontal", "vertical", "all"]);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* One padding entry (Swift: FIOCorePaddingBlock, Sources/Properties/FIOCorePaddingBlock.swift).
|
|
126
|
+
* A present but empty array reads as no padding (`hasPadding` in
|
|
127
|
+
* Sources/Commons/FIOCoreCommonBlockViewModel.swift requires a non-empty array);
|
|
128
|
+
* an absent key means the same.
|
|
129
|
+
*/
|
|
130
|
+
export const paddingEntrySchema = z.strictObject({ anchor: edgeAnchorSchema, constant: z.number() });
|
|
131
|
+
|
|
132
|
+
/** Swift: FIOCoreLayoutSizeBlock (Sources/Utils/FIOCoreLayoutSizeBlock.swift). */
|
|
133
|
+
export const layoutSizeSchema = z.strictObject({
|
|
134
|
+
constant: z.number().optional(),
|
|
135
|
+
alignment: alignmentSchema.optional(),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
/** Swift: FIOCoreLayoutDimensionBlock (Sources/Utils/FIOCoreLayoutDimensionBlock.swift). */
|
|
139
|
+
export const layoutDimensionSchema = z.strictObject({
|
|
140
|
+
max_width: layoutSizeSchema.optional(),
|
|
141
|
+
max_height: layoutSizeSchema.optional(),
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// --- Gradient, background image, overlays ----------------------------------
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Points of a gradient (`start`, `end`) and the background image `anchor`:
|
|
148
|
+
* the same 9 values as `alignmentSchema`.
|
|
149
|
+
*/
|
|
150
|
+
export const unitPointSchema = alignmentSchema;
|
|
151
|
+
|
|
152
|
+
/** Swift: FIOCoreGradientStopProperty (Sources/Properties/FIOCoreGradientStopProperty.swift). */
|
|
153
|
+
export const gradientStopSchema = z.strictObject({
|
|
154
|
+
color: colorSchema,
|
|
155
|
+
/**
|
|
156
|
+
* Optional: a stop without a location gets `i / (n - 1)` by its index in
|
|
157
|
+
* `stops` (a single stop gets 0), so evenly spaced colors need no locations.
|
|
158
|
+
*/
|
|
159
|
+
location: z.number().optional(),
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Swift: FIOCoreGradientProperty (Sources/Properties/FIOCoreGradientProperty.swift).
|
|
164
|
+
*
|
|
165
|
+
* `stops` is the only way to list the colors. A gradient without any color
|
|
166
|
+
* renders nothing, so the schema requires at least one stop.
|
|
167
|
+
*/
|
|
168
|
+
export const gradientSchema = z.strictObject({
|
|
169
|
+
stops: z.array(gradientStopSchema).min(1, "A gradient needs at least one entry in `stops`"),
|
|
170
|
+
start: unitPointSchema.optional(),
|
|
171
|
+
end: unitPointSchema.optional(),
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
/** Swift: FIOCoreAxisPairProperty (Sources/Properties/FIOCoreAxisPairProperty.swift). */
|
|
175
|
+
export const axisPairSchema = z.strictObject({
|
|
176
|
+
x: z.number().optional(),
|
|
177
|
+
y: z.number().optional(),
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Swift: FIOCoreBackgroundImageProperty (Sources/Properties/FIOCoreBackgroundImageProperty.swift).
|
|
182
|
+
* `content_mode` is a free `String` in Swift, but only `fill` and `fit` have
|
|
183
|
+
* an effect (`fioCoreAspect` in Sources/Utils/Extensions/View+FIOCoreBackground.swift).
|
|
184
|
+
*/
|
|
185
|
+
export const backgroundImageSchema = z.strictObject({
|
|
186
|
+
image_url: z.string().optional(),
|
|
187
|
+
content_mode: z.enum(["fill", "fit"]).optional(),
|
|
188
|
+
scale: axisPairSchema.optional(),
|
|
189
|
+
offset: axisPairSchema.optional(),
|
|
190
|
+
anchor: unitPointSchema.optional(),
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Swift: FIOCoreBlendMode (Sources/Utils/FIOCoreBlendMode.swift).
|
|
195
|
+
* iOS falls back to `normal` for unknown strings; the schema does not.
|
|
196
|
+
*/
|
|
197
|
+
export const blendModeSchema = z.enum([
|
|
198
|
+
"normal",
|
|
199
|
+
"multiply",
|
|
200
|
+
"screen",
|
|
201
|
+
"overlay",
|
|
202
|
+
"darken",
|
|
203
|
+
"lighten",
|
|
204
|
+
"color_dodge",
|
|
205
|
+
"color_burn",
|
|
206
|
+
"hard_light",
|
|
207
|
+
"soft_light",
|
|
208
|
+
"difference",
|
|
209
|
+
"exclusion",
|
|
210
|
+
"hue",
|
|
211
|
+
"saturation",
|
|
212
|
+
"color",
|
|
213
|
+
"luminosity",
|
|
214
|
+
]);
|
|
215
|
+
|
|
216
|
+
// --- Images (Flutter Image / paintImage) ------------------------------------
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Flutter `BoxFit`: how a picture is inscribed into its box (`image.fit`). Absent = `scale_down`
|
|
220
|
+
* (`paintImage` in `painting/decoration_image.dart`: `fit ??= centerSlice == null ? BoxFit.scaleDown
|
|
221
|
+
* : BoxFit.fill`; the contract has no `centerSlice`).
|
|
222
|
+
*/
|
|
223
|
+
export const boxFitSchema = z.enum(["fill", "contain", "cover", "fit_width", "fit_height", "none", "scale_down"]);
|
|
224
|
+
|
|
225
|
+
/** Flutter `ImageRepeat` (`image.repeat`): `no_repeat` (the default), `repeat`, `repeat_x`, `repeat_y`. */
|
|
226
|
+
export const imageRepeatSchema = z.enum(["no_repeat", "repeat", "repeat_x", "repeat_y"]);
|
|
227
|
+
|
|
228
|
+
/** Flutter `FilterQuality` (`image.filter_quality`): `none`, `low`, `medium` (the default), `high`. */
|
|
229
|
+
export const filterQualitySchema = z.enum(["none", "low", "medium", "high"]);
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Flutter `BlendMode` of `image.color_blend_mode` (S22, image only): every value of
|
|
233
|
+
* `blendModeSchema` plus the Porter-Duff modes `src_in` (the default), `src_over`, `src_atop`,
|
|
234
|
+
* `dst_in`, `dst_over`, `src`, `dst`, `clear`, `xor`. `blendModeSchema` (container, overlays) is
|
|
235
|
+
* unchanged.
|
|
236
|
+
*/
|
|
237
|
+
export const imageBlendModeSchema = z.enum([
|
|
238
|
+
...blendModeSchema.options,
|
|
239
|
+
"src_in",
|
|
240
|
+
"src_over",
|
|
241
|
+
"src_atop",
|
|
242
|
+
"dst_in",
|
|
243
|
+
"dst_over",
|
|
244
|
+
"src",
|
|
245
|
+
"dst",
|
|
246
|
+
"clear",
|
|
247
|
+
"xor",
|
|
248
|
+
]);
|
|
249
|
+
|
|
250
|
+
/** Swift: FIOCoreOverlayProperty (Sources/Properties/FIOCoreOverlayProperty.swift). */
|
|
251
|
+
export const overlaySchema = z.strictObject({
|
|
252
|
+
color: colorSchema.optional(),
|
|
253
|
+
gradient: gradientSchema.optional(),
|
|
254
|
+
blend_mode: blendModeSchema.optional(),
|
|
255
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// --- Box model (Flutter Container) -----------------------------------------
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Flutter `BoxConstraints`: bounds of a box. `size.width` / `size.height`
|
|
262
|
+
* tighten them (an exact size, clamped into these bounds). Every value is
|
|
263
|
+
* non-negative.
|
|
264
|
+
*/
|
|
265
|
+
export const boxConstraintsSchema = z.strictObject({
|
|
266
|
+
min_width: z.number().min(0).optional(),
|
|
267
|
+
max_width: z.number().min(0).optional(),
|
|
268
|
+
min_height: z.number().min(0).optional(),
|
|
269
|
+
max_height: z.number().min(0).optional(),
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Flutter `BorderRadiusDirectional`: one radius per corner, overriding
|
|
274
|
+
* `corner_radius` for that corner. `start` / `end` follow the layout direction.
|
|
275
|
+
*/
|
|
276
|
+
export const cornerRadiiSchema = z.strictObject({
|
|
277
|
+
top_start: z.number().min(0).optional(),
|
|
278
|
+
top_end: z.number().min(0).optional(),
|
|
279
|
+
bottom_start: z.number().min(0).optional(),
|
|
280
|
+
bottom_end: z.number().min(0).optional(),
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
/** Flutter `Clip`. `none` (the default) lets the child overflow the shape. */
|
|
284
|
+
export const clipBehaviorSchema = z.enum(["none", "hard_edge", "anti_alias", "anti_alias_with_save_layer"]);
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Flutter `ScrollPhysics` of a scrollable block (`single_child_scroll`, `grid`): `never` = no user
|
|
288
|
+
* scrolling; `bouncing` / `clamping` = the platform's closest overscroll. Absent = the platform default.
|
|
289
|
+
*/
|
|
290
|
+
export const scrollPhysicsSchema = z.enum(["bouncing", "clamping", "never"]);
|
|
291
|
+
|
|
292
|
+
/** Flutter `ScrollViewKeyboardDismissBehavior` (`single_child_scroll`, `grid`): `manual` (the default) or `on_drag`. */
|
|
293
|
+
export const keyboardDismissBehaviorSchema = z.enum(["manual", "on_drag"]);
|
|
294
|
+
|
|
295
|
+
// --- Buttons (Flutter ButtonStyle) ------------------------------------------
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Flutter `MaterialTapTargetSize` of a button: `padded` (the default on Android and iOS,
|
|
299
|
+
* `ThemeData.materialTapTargetSize`) makes the layout frame at least 48 × 48
|
|
300
|
+
* (`kMinInteractiveDimension`, plus the visual density adjustment) with the visual centered and
|
|
301
|
+
* the whole frame tappable; `shrink_wrap` keeps the frame at the visual size.
|
|
302
|
+
*/
|
|
303
|
+
export const tapTargetSizeSchema = z.enum(["padded", "shrink_wrap"]);
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Flutter `VisualDensity` of a button: `standard` (0, 0; the default), `comfortable` (-1, -1) or
|
|
307
|
+
* `compact` (-2, -2). Each step is 4 points (`baseSizeAdjustment`): it is added to the minimum size,
|
|
308
|
+
* to the vertical padding and to the padded tap target; the horizontal padding never shrinks.
|
|
309
|
+
*/
|
|
310
|
+
export const visualDensitySchema = z.enum(["standard", "comfortable", "compact"]);
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Flutter `Size` of a `ButtonStyle` (`minimumSize`, `maximumSize`): a width and a height in
|
|
314
|
+
* points, each >= 0. Unlike Flutter, either axis may be left out; what a left-out axis means is
|
|
315
|
+
* set by the key that uses it.
|
|
316
|
+
*/
|
|
317
|
+
export const buttonSizeSchema = z.strictObject({
|
|
318
|
+
width: z.number().min(0).optional(),
|
|
319
|
+
height: z.number().min(0).optional(),
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* A paint-only 2D transform (a subset of Flutter's `Matrix4`), composed
|
|
324
|
+
* translate, then rotate, then scale, around the transform alignment.
|
|
325
|
+
*/
|
|
326
|
+
export const transformSchema = z.strictObject({
|
|
327
|
+
rotation_degrees: z.number().optional(),
|
|
328
|
+
scale_x: z.number().optional(),
|
|
329
|
+
scale_y: z.number().optional(),
|
|
330
|
+
translate_x: z.number().optional(),
|
|
331
|
+
translate_y: z.number().optional(),
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// --- Shadow and borders ----------------------------------------------------
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Swift: FIOCoreShadow (declared in Sources/Blocks/Card/FIOCoreCardDataBlock.swift).
|
|
338
|
+
* `x` and `y` are Swift `Int`, so fractional offsets fail to decode.
|
|
339
|
+
*/
|
|
340
|
+
export const shadowSchema = z.strictObject({
|
|
341
|
+
radius: z.number().optional(),
|
|
342
|
+
x: intSchema.optional(),
|
|
343
|
+
y: intSchema.optional(),
|
|
344
|
+
color: colorSchema.optional(),
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
/** Swift: FIOCoreBorder (declared in Sources/Blocks/Card/FIOCoreCardDataBlock.swift). */
|
|
348
|
+
export const borderSchema = z.strictObject({
|
|
349
|
+
color: colorSchema,
|
|
350
|
+
width: z.number().optional(),
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Swift: FIOCoreTextFieldBorderType (Sources/Utils/FIOCoreTextFieldBorderType.swift).
|
|
355
|
+
* iOS falls back to `none` for unknown strings; the schema does not.
|
|
356
|
+
*/
|
|
357
|
+
export const textFieldBorderTypeSchema = z.enum(["outline", "underline", "none"]);
|
|
358
|
+
|
|
359
|
+
/** Swift: FIOCoreTextFieldBorder (Sources/Utils/FIOCoreTextFieldBorder.swift). */
|
|
360
|
+
export const textFieldBorderSchema = z.strictObject({
|
|
361
|
+
type: textFieldBorderTypeSchema.optional(),
|
|
362
|
+
color: colorSchema.optional(),
|
|
363
|
+
width: z.number().optional(),
|
|
364
|
+
corner_radius: z.number().optional(),
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// --- Text styling ----------------------------------------------------------
|
|
368
|
+
|
|
369
|
+
/** Swift: FIOCoreFontWeight (Sources/Utils/FIOCoreFontWeight.swift). Every value is snake_case. */
|
|
370
|
+
export const fontWeightSchema = z.enum([
|
|
371
|
+
"ultra_light",
|
|
372
|
+
"thin",
|
|
373
|
+
"light",
|
|
374
|
+
"regular",
|
|
375
|
+
"medium",
|
|
376
|
+
"semi_bold",
|
|
377
|
+
"bold",
|
|
378
|
+
"heavy",
|
|
379
|
+
"black",
|
|
380
|
+
]);
|
|
381
|
+
|
|
382
|
+
/** Swift: FIOCoreFontDesign (Sources/Utils/FIOCoreFontDesign.swift). */
|
|
383
|
+
export const fontDesignSchema = z.enum(["default", "rounded", "monospaced", "serif"]);
|
|
384
|
+
|
|
385
|
+
/** Flutter `TextDecoration`; `overline` added in 2.0. Swift: FIOCoreTextDecoration (Sources/Utils/FIOCoreTextDecoration.swift). */
|
|
386
|
+
export const textDecorationSchema = z.enum(["none", "underline", "line_through", "overline"]);
|
|
387
|
+
|
|
388
|
+
/** Flutter `TextDecorationStyle`: how the `decoration` line is drawn. Absent = `solid`. */
|
|
389
|
+
export const textDecorationStyleSchema = z.enum(["solid", "double", "dotted", "dashed", "wavy"]);
|
|
390
|
+
|
|
391
|
+
/** Flutter `TextLeadingDistribution`: how the extra leading of `height` is split above and below the glyphs. */
|
|
392
|
+
export const textLeadingDistributionSchema = z.enum(["proportional", "even"]);
|
|
393
|
+
|
|
394
|
+
/** Swift: FIOCoreTextShadow (Sources/Utils/FIOCoreTextShadow.swift). */
|
|
395
|
+
export const textShadowSchema = z.strictObject({
|
|
396
|
+
color: colorSchema.optional(),
|
|
397
|
+
blur_radius: z.number().optional(),
|
|
398
|
+
offset_x: z.number().optional(),
|
|
399
|
+
offset_y: z.number().optional(),
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Flutter `TextStyle` (contract 2.0), shared by every block that styles text (`text`, `text_field`,
|
|
404
|
+
* `text_button`, `pin_input`, `check_box`, `search`, ...). Swift: FIOCoreTextStyleBlock
|
|
405
|
+
* (Sources/Utils/FIOCoreTextStyleBlock.swift). The text color key is `foreground_color` on the wire.
|
|
406
|
+
* Defaults (S7): `font_size` 14 (Flutter's `getParagraphStyle` default); `height` absent = the font's
|
|
407
|
+
* own metrics; `decoration_style` `solid`; `decoration_color` = the text color; `decoration_thickness`
|
|
408
|
+
* absent = the font's (it is a multiplier of it). `word_spacing` and every `shadows` entry are drawn;
|
|
409
|
+
* a shadow entry defaults to opaque black, offset 0, blur 0 (Flutter `Shadow`).
|
|
410
|
+
* `line_height` (points) is an extension, deprecated in favor of `height` and still honored when
|
|
411
|
+
* `height` is absent.
|
|
412
|
+
*/
|
|
413
|
+
export const textStyleSchema = z.strictObject({
|
|
414
|
+
foreground_color: colorSchema.optional(),
|
|
415
|
+
font_size: z.number().optional(),
|
|
416
|
+
font_weight: fontWeightSchema.optional(),
|
|
417
|
+
font_family: z.string().optional(),
|
|
418
|
+
/** Flutter `fontFamilyFallback`: families tried in order when `font_family` lacks a glyph. */
|
|
419
|
+
font_family_fallback: z.array(z.string()).optional(),
|
|
420
|
+
font_design: fontDesignSchema.optional(),
|
|
421
|
+
italic: z.boolean().optional(),
|
|
422
|
+
letter_spacing: z.number().optional(),
|
|
423
|
+
word_spacing: z.number().optional(),
|
|
424
|
+
/** Flutter `height`: the line height as a multiple of `font_size`; absent = the font's metrics. */
|
|
425
|
+
height: z.number().optional(),
|
|
426
|
+
/** Flutter `leadingDistribution`; absent = `proportional` (the `TextHeightBehavior` default). */
|
|
427
|
+
leading_distribution: textLeadingDistributionSchema.optional(),
|
|
428
|
+
line_height: z
|
|
429
|
+
.number()
|
|
430
|
+
.optional()
|
|
431
|
+
.describe("Deprecated since 2.0: the line height in points (an extension), honored only when `height` is absent. Use `height`.")
|
|
432
|
+
.meta({ deprecated: true }),
|
|
433
|
+
/** Flutter `backgroundColor`: painted behind the glyphs of each line. */
|
|
434
|
+
background_color: colorSchema.optional(),
|
|
435
|
+
decoration: textDecorationSchema.optional(),
|
|
436
|
+
decoration_color: colorSchema.optional(),
|
|
437
|
+
decoration_style: textDecorationStyleSchema.optional(),
|
|
438
|
+
/** Flutter `decorationThickness`: a multiplier of the font's decoration thickness. */
|
|
439
|
+
decoration_thickness: z.number().optional(),
|
|
440
|
+
shadows: z.array(textShadowSchema).optional(),
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Swift: FIOCoreTextOverflow (Sources/Utils/FIOCoreTextOverflow.swift).
|
|
445
|
+
* iOS falls back to `clip` for unknown strings; the schema does not.
|
|
446
|
+
*/
|
|
447
|
+
export const textOverflowSchema = z.enum(["clip", "ellipsis", "fade", "visible"]);
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Swift: FIOCoreTextDirection (Sources/Utils/FIOCoreTextDirection.swift).
|
|
451
|
+
* iOS falls back to `ltr` for unknown strings; the schema does not.
|
|
452
|
+
*/
|
|
453
|
+
export const textDirectionSchema = z.enum(["ltr", "rtl"]);
|
|
454
|
+
|
|
455
|
+
/** Flutter `TextWidthBasis`: `parent` (the default) or `longest_line` (exactly the longest wrapped line). */
|
|
456
|
+
export const textWidthBasisSchema = z.enum(["parent", "longest_line"]);
|
|
457
|
+
|
|
458
|
+
/** Flutter `TextHeightBehavior`: whether `height` applies above the first line and below the last (both default true). */
|
|
459
|
+
export const textHeightBehaviorSchema = z.strictObject({
|
|
460
|
+
apply_height_to_first_ascent: z.boolean().optional(),
|
|
461
|
+
apply_height_to_last_descent: z.boolean().optional(),
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* The `Text` widget's own parameters (contract 2.0). Swift: FIOCoreTextConfigBlock
|
|
466
|
+
* (Sources/Utils/FIOCoreTextConfigBlock.swift). Defaults (S7): `soft_wrap` true, `overflow` `clip`,
|
|
467
|
+
* `max_lines` none, `text_direction` ambient, `text_width_basis` `parent`.
|
|
468
|
+
*/
|
|
469
|
+
export const textConfigSchema = z.strictObject({
|
|
470
|
+
max_lines: intSchema.optional(),
|
|
471
|
+
overflow: textOverflowSchema.optional(),
|
|
472
|
+
soft_wrap: z.boolean().optional(),
|
|
473
|
+
text_direction: textDirectionSchema.optional(),
|
|
474
|
+
locale: z.string().optional(),
|
|
475
|
+
text_scaler: z.number().optional(),
|
|
476
|
+
semantics_label: z.string().optional(),
|
|
477
|
+
/** Flutter `semanticsIdentifier`: an identifier for the semantics node, not announced to the user. */
|
|
478
|
+
semantics_identifier: z.string().optional(),
|
|
479
|
+
text_width_basis: textWidthBasisSchema.optional(),
|
|
480
|
+
text_height_behavior: textHeightBehaviorSchema.optional(),
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// --- Events ----------------------------------------------------------------
|
|
484
|
+
|
|
485
|
+
/** Swift: FIOCoreEventType (Sources/EventManagement/FIOCoreBlockEventDefinition.swift). */
|
|
486
|
+
export const eventTypeSchema = z.enum([
|
|
487
|
+
"on_tap",
|
|
488
|
+
"on_large_tap",
|
|
489
|
+
"on_double_tap",
|
|
490
|
+
"on_change",
|
|
491
|
+
"on_complete",
|
|
492
|
+
]);
|
|
493
|
+
|
|
494
|
+
type EventDataValue = string | number | boolean | EventDataValue[] | { [key: string]: EventDataValue };
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Values iOS can decode into `event_data` (`FIOCoreAnyDecodable`): numbers,
|
|
498
|
+
* strings, booleans, arrays and objects. JSON `null` is not supported and
|
|
499
|
+
* makes iOS drop the whole `event_data`.
|
|
500
|
+
*/
|
|
501
|
+
export const eventDataValueSchema: z.ZodType<EventDataValue> = z.lazy(() =>
|
|
502
|
+
z.union([
|
|
503
|
+
z.string(),
|
|
504
|
+
z.number(),
|
|
505
|
+
z.boolean(),
|
|
506
|
+
z.array(eventDataValueSchema),
|
|
507
|
+
z.record(z.string(), eventDataValueSchema),
|
|
508
|
+
]),
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
/** Swift: FIOCoreBlockEventDefinition (Sources/EventManagement/FIOCoreBlockEventDefinition.swift). */
|
|
512
|
+
export const eventSchema = z.strictObject({
|
|
513
|
+
event_id: z.string(),
|
|
514
|
+
event_type: eventTypeSchema,
|
|
515
|
+
event_data: z.record(z.string(), eventDataValueSchema).optional(),
|
|
516
|
+
});
|
package/src/screen.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { iosBlockSchema } from "./block.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The Fractal protocol version a producer speaks, `MAJOR.MINOR`. Every screen a
|
|
6
|
+
* producer of this package builds declares it as `fractal`.
|
|
7
|
+
*/
|
|
8
|
+
export const FRACTAL_PROTOCOL_VERSION = "1.0";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A protocol version of major 1: `1.<minor>` with no leading zeros (`1.0`,
|
|
12
|
+
* `1.7`, `1.12`), never `1`, `1.0.0`, `v1`, `1.01` or a number. A higher minor
|
|
13
|
+
* is accepted.
|
|
14
|
+
*/
|
|
15
|
+
export const fractalVersionSchema = z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^1\.(0|[1-9][0-9]*)$/, 'Expected a Fractal protocol version of major 1, such as "1.0"')
|
|
18
|
+
.describe(
|
|
19
|
+
"Protocol version as MAJOR.MINOR. A receiver rejects a screen whose major version it does not support and accepts a higher minor of a supported major.",
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A screen document: the protocol version and the root block. Every other
|
|
24
|
+
* top-level key is transport data (for example `status`, `statusCode`,
|
|
25
|
+
* `message`, `meta`): producers may send it and receivers ignore it, so the
|
|
26
|
+
* object is open.
|
|
27
|
+
*/
|
|
28
|
+
export const screenSchema = z
|
|
29
|
+
.looseObject({
|
|
30
|
+
fractal: fractalVersionSchema,
|
|
31
|
+
data: iosBlockSchema.describe("The root block of the screen."),
|
|
32
|
+
})
|
|
33
|
+
.meta({
|
|
34
|
+
title: "Fractal IO screen",
|
|
35
|
+
description:
|
|
36
|
+
"A screen document of protocol version 1.x: the protocol version it speaks and its root block. Other top-level keys (for example status, statusCode, message, meta) are transport data, not protocol; producers may send them and receivers ignore them.",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export type Screen = z.infer<typeof screenSchema>;
|