@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.
Files changed (323) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +165 -2
  3. package/conformance/1.0/action-cases.json +227 -0
  4. package/conformance/1.0/bind-cases.json +768 -0
  5. package/conformance/1.0/cases.json +25139 -0
  6. package/conformance/1.0/layout/01-onboarding-start.json +95 -0
  7. package/conformance/1.0/layout/02-home-discover.json +177 -0
  8. package/conformance/1.0/layout/03-filters.json +186 -0
  9. package/conformance/1.0/layout/README.md +145 -0
  10. package/conformance/1.0/layout/REPORT.md +222 -0
  11. package/conformance/1.0/layout/alert.json +22 -0
  12. package/conformance/1.0/layout/iphone-14-15-pro-107.json +272 -0
  13. package/conformance/1.0/layout/live_status_on_its_way_4.ios.json +100 -0
  14. package/conformance/1.0/layout/lucy-booking-mobile.json +261 -0
  15. package/conformance/1.0/layout/lucy-booking-tablet.json +817 -0
  16. package/conformance/1.0/layout/lucy-booking.json +185 -0
  17. package/conformance/1.0/layout/lucy-header.json +84 -0
  18. package/conformance/1.0/layout/lucy-welcome-pin-mobile.json +31 -0
  19. package/conformance/1.0/layout/lucy-welcome-pin.json +31 -0
  20. package/conformance/1.0/layout/measured/android/01-onboarding-start.json +95 -0
  21. package/conformance/1.0/layout/measured/android/02-home-discover.json +177 -0
  22. package/conformance/1.0/layout/measured/android/03-filters.json +186 -0
  23. package/conformance/1.0/layout/measured/android/alert.json +22 -0
  24. package/conformance/1.0/layout/measured/android/iphone-14-15-pro-107.json +272 -0
  25. package/conformance/1.0/layout/measured/android/live_status_on_its_way_4.ios.json +100 -0
  26. package/conformance/1.0/layout/measured/android/lucy-booking-mobile.json +261 -0
  27. package/conformance/1.0/layout/measured/android/lucy-booking-tablet.json +817 -0
  28. package/conformance/1.0/layout/measured/android/lucy-booking.json +185 -0
  29. package/conformance/1.0/layout/measured/android/lucy-header.json +84 -0
  30. package/conformance/1.0/layout/measured/android/lucy-welcome-pin-mobile.json +31 -0
  31. package/conformance/1.0/layout/measured/android/lucy-welcome-pin.json +31 -0
  32. package/conformance/1.0/layout/measured/android/navigation-bar.json +46 -0
  33. package/conformance/1.0/layout/measured/android/probe-alert-banner-flutter.json +37 -0
  34. package/conformance/1.0/layout/measured/android/probe-alert-banner-regression-flutter.json +51 -0
  35. package/conformance/1.0/layout/measured/android/probe-alert-banner-stack-flutter.json +29 -0
  36. package/conformance/1.0/layout/measured/android/probe-card.json +35 -0
  37. package/conformance/1.0/layout/measured/android/probe-check-box-flutter.json +20 -0
  38. package/conformance/1.0/layout/measured/android/probe-container-height.json +21 -0
  39. package/conformance/1.0/layout/measured/android/probe-divider.json +55 -0
  40. package/conformance/1.0/layout/measured/android/probe-dropdown-menu-flutter.json +24 -0
  41. package/conformance/1.0/layout/measured/android/probe-dropdown-menu-max-lines.json +11 -0
  42. package/conformance/1.0/layout/measured/android/probe-expanded.json +31 -0
  43. package/conformance/1.0/layout/measured/android/probe-failed-decode.json +11 -0
  44. package/conformance/1.0/layout/measured/android/probe-flex.json +43 -0
  45. package/conformance/1.0/layout/measured/android/probe-grid-flutter.json +78 -0
  46. package/conformance/1.0/layout/measured/android/probe-grid.json +29 -0
  47. package/conformance/1.0/layout/measured/android/probe-icon-button-flutter.json +25 -0
  48. package/conformance/1.0/layout/measured/android/probe-icon-flutter.json +19 -0
  49. package/conformance/1.0/layout/measured/android/probe-icon-sizing.json +36 -0
  50. package/conformance/1.0/layout/measured/android/probe-image-flutter.json +24 -0
  51. package/conformance/1.0/layout/measured/android/probe-list-flutter.json +79 -0
  52. package/conformance/1.0/layout/measured/android/probe-list-regression-flutter.json +94 -0
  53. package/conformance/1.0/layout/measured/android/probe-list-row-flutter.json +86 -0
  54. package/conformance/1.0/layout/measured/android/probe-list-styles.json +45 -0
  55. package/conformance/1.0/layout/measured/android/probe-pin-input-parity.json +18 -0
  56. package/conformance/1.0/layout/measured/android/probe-progress-track-flutter.json +41 -0
  57. package/conformance/1.0/layout/measured/android/probe-progress-track-regression-flutter.json +57 -0
  58. package/conformance/1.0/layout/measured/android/probe-row-column.json +84 -0
  59. package/conformance/1.0/layout/measured/android/probe-scroll.json +54 -0
  60. package/conformance/1.0/layout/measured/android/probe-search-flutter.json +22 -0
  61. package/conformance/1.0/layout/measured/android/probe-size-constraints.json +20 -0
  62. package/conformance/1.0/layout/measured/android/probe-spacer.json +43 -0
  63. package/conformance/1.0/layout/measured/android/probe-stat-progress-track.json +14 -0
  64. package/conformance/1.0/layout/measured/android/probe-text-button-flutter.json +27 -0
  65. package/conformance/1.0/layout/measured/android/probe-text-field-flutter.json +28 -0
  66. package/conformance/1.0/layout/measured/android/probe-text.json +30 -0
  67. package/conformance/1.0/layout/measured/android/wallet-home.json +127 -0
  68. package/conformance/1.0/layout/measured/web/01-onboarding-start.json +95 -0
  69. package/conformance/1.0/layout/measured/web/02-home-discover.json +177 -0
  70. package/conformance/1.0/layout/measured/web/03-filters.json +186 -0
  71. package/conformance/1.0/layout/measured/web/alert.json +22 -0
  72. package/conformance/1.0/layout/measured/web/iphone-14-15-pro-107.json +272 -0
  73. package/conformance/1.0/layout/measured/web/live_status_on_its_way_4.ios.json +100 -0
  74. package/conformance/1.0/layout/measured/web/lucy-booking-mobile.json +261 -0
  75. package/conformance/1.0/layout/measured/web/lucy-booking-tablet.json +817 -0
  76. package/conformance/1.0/layout/measured/web/lucy-booking.json +185 -0
  77. package/conformance/1.0/layout/measured/web/lucy-header.json +84 -0
  78. package/conformance/1.0/layout/measured/web/lucy-welcome-pin-mobile.json +31 -0
  79. package/conformance/1.0/layout/measured/web/lucy-welcome-pin.json +31 -0
  80. package/conformance/1.0/layout/measured/web/navigation-bar.json +46 -0
  81. package/conformance/1.0/layout/measured/web/probe-alert-banner-flutter.json +37 -0
  82. package/conformance/1.0/layout/measured/web/probe-alert-banner-regression-flutter.json +51 -0
  83. package/conformance/1.0/layout/measured/web/probe-alert-banner-stack-flutter.json +29 -0
  84. package/conformance/1.0/layout/measured/web/probe-card.json +35 -0
  85. package/conformance/1.0/layout/measured/web/probe-check-box-flutter.json +20 -0
  86. package/conformance/1.0/layout/measured/web/probe-container-height.json +21 -0
  87. package/conformance/1.0/layout/measured/web/probe-divider.json +55 -0
  88. package/conformance/1.0/layout/measured/web/probe-dropdown-menu-flutter.json +24 -0
  89. package/conformance/1.0/layout/measured/web/probe-dropdown-menu-max-lines.json +11 -0
  90. package/conformance/1.0/layout/measured/web/probe-expanded.json +31 -0
  91. package/conformance/1.0/layout/measured/web/probe-failed-decode.json +15 -0
  92. package/conformance/1.0/layout/measured/web/probe-flex.json +43 -0
  93. package/conformance/1.0/layout/measured/web/probe-grid-flutter.json +78 -0
  94. package/conformance/1.0/layout/measured/web/probe-grid.json +29 -0
  95. package/conformance/1.0/layout/measured/web/probe-icon-button-flutter.json +25 -0
  96. package/conformance/1.0/layout/measured/web/probe-icon-flutter.json +19 -0
  97. package/conformance/1.0/layout/measured/web/probe-icon-sizing.json +36 -0
  98. package/conformance/1.0/layout/measured/web/probe-image-flutter.json +24 -0
  99. package/conformance/1.0/layout/measured/web/probe-list-flutter.json +79 -0
  100. package/conformance/1.0/layout/measured/web/probe-list-regression-flutter.json +94 -0
  101. package/conformance/1.0/layout/measured/web/probe-list-row-flutter.json +86 -0
  102. package/conformance/1.0/layout/measured/web/probe-list-styles.json +45 -0
  103. package/conformance/1.0/layout/measured/web/probe-pin-input-parity.json +18 -0
  104. package/conformance/1.0/layout/measured/web/probe-progress-track-flutter.json +41 -0
  105. package/conformance/1.0/layout/measured/web/probe-progress-track-regression-flutter.json +57 -0
  106. package/conformance/1.0/layout/measured/web/probe-row-column.json +84 -0
  107. package/conformance/1.0/layout/measured/web/probe-scroll.json +54 -0
  108. package/conformance/1.0/layout/measured/web/probe-search-flutter.json +22 -0
  109. package/conformance/1.0/layout/measured/web/probe-size-constraints.json +20 -0
  110. package/conformance/1.0/layout/measured/web/probe-spacer.json +43 -0
  111. package/conformance/1.0/layout/measured/web/probe-stat-progress-track.json +14 -0
  112. package/conformance/1.0/layout/measured/web/probe-text-button-flutter.json +27 -0
  113. package/conformance/1.0/layout/measured/web/probe-text-field-flutter.json +28 -0
  114. package/conformance/1.0/layout/measured/web/probe-text.json +30 -0
  115. package/conformance/1.0/layout/measured/web/wallet-home.json +127 -0
  116. package/conformance/1.0/layout/navigation-bar.json +46 -0
  117. package/conformance/1.0/layout/probe-alert-banner-flutter.json +37 -0
  118. package/conformance/1.0/layout/probe-alert-banner-regression-flutter.json +51 -0
  119. package/conformance/1.0/layout/probe-alert-banner-stack-flutter.json +29 -0
  120. package/conformance/1.0/layout/probe-card.json +35 -0
  121. package/conformance/1.0/layout/probe-check-box-flutter.json +20 -0
  122. package/conformance/1.0/layout/probe-container-height.json +21 -0
  123. package/conformance/1.0/layout/probe-divider.json +55 -0
  124. package/conformance/1.0/layout/probe-dropdown-menu-flutter.json +24 -0
  125. package/conformance/1.0/layout/probe-dropdown-menu-max-lines.json +11 -0
  126. package/conformance/1.0/layout/probe-expanded.json +31 -0
  127. package/conformance/1.0/layout/probe-failed-decode.json +13 -0
  128. package/conformance/1.0/layout/probe-flex.json +43 -0
  129. package/conformance/1.0/layout/probe-grid-flutter.json +78 -0
  130. package/conformance/1.0/layout/probe-grid.json +29 -0
  131. package/conformance/1.0/layout/probe-icon-button-flutter.json +25 -0
  132. package/conformance/1.0/layout/probe-icon-flutter.json +19 -0
  133. package/conformance/1.0/layout/probe-icon-sizing.json +36 -0
  134. package/conformance/1.0/layout/probe-image-flutter.json +24 -0
  135. package/conformance/1.0/layout/probe-list-flutter.json +79 -0
  136. package/conformance/1.0/layout/probe-list-regression-flutter.json +94 -0
  137. package/conformance/1.0/layout/probe-list-row-flutter.json +86 -0
  138. package/conformance/1.0/layout/probe-list-styles.json +45 -0
  139. package/conformance/1.0/layout/probe-pin-input-parity.json +18 -0
  140. package/conformance/1.0/layout/probe-progress-track-flutter.json +41 -0
  141. package/conformance/1.0/layout/probe-progress-track-regression-flutter.json +57 -0
  142. package/conformance/1.0/layout/probe-row-column.json +84 -0
  143. package/conformance/1.0/layout/probe-scroll.json +54 -0
  144. package/conformance/1.0/layout/probe-search-flutter.json +22 -0
  145. package/conformance/1.0/layout/probe-size-constraints.json +20 -0
  146. package/conformance/1.0/layout/probe-spacer.json +43 -0
  147. package/conformance/1.0/layout/probe-stat-progress-track.json +14 -0
  148. package/conformance/1.0/layout/probe-text-button-flutter.json +27 -0
  149. package/conformance/1.0/layout/probe-text-field-flutter.json +28 -0
  150. package/conformance/1.0/layout/probe-text.json +30 -0
  151. package/conformance/1.0/layout/probes/probe-alert-banner-flutter.json +296 -0
  152. package/conformance/1.0/layout/probes/probe-alert-banner-regression-flutter.json +1 -0
  153. package/conformance/1.0/layout/probes/probe-alert-banner-stack-flutter.json +219 -0
  154. package/conformance/1.0/layout/probes/probe-card.json +252 -0
  155. package/conformance/1.0/layout/probes/probe-check-box-flutter.json +86 -0
  156. package/conformance/1.0/layout/probes/probe-container-height.json +147 -0
  157. package/conformance/1.0/layout/probes/probe-divider.json +469 -0
  158. package/conformance/1.0/layout/probes/probe-dropdown-menu-flutter.json +293 -0
  159. package/conformance/1.0/layout/probes/probe-dropdown-menu-max-lines.json +54 -0
  160. package/conformance/1.0/layout/probes/probe-expanded.json +208 -0
  161. package/conformance/1.0/layout/probes/probe-failed-decode.json +96 -0
  162. package/conformance/1.0/layout/probes/probe-flex.json +353 -0
  163. package/conformance/1.0/layout/probes/probe-grid-flutter.json +584 -0
  164. package/conformance/1.0/layout/probes/probe-grid.json +209 -0
  165. package/conformance/1.0/layout/probes/probe-icon-button-flutter.json +143 -0
  166. package/conformance/1.0/layout/probes/probe-icon-flutter.json +89 -0
  167. package/conformance/1.0/layout/probes/probe-icon-sizing.json +219 -0
  168. package/conformance/1.0/layout/probes/probe-image-flutter.json +130 -0
  169. package/conformance/1.0/layout/probes/probe-list-flutter.json +732 -0
  170. package/conformance/1.0/layout/probes/probe-list-regression-flutter.json +815 -0
  171. package/conformance/1.0/layout/probes/probe-list-row-flutter.json +734 -0
  172. package/conformance/1.0/layout/probes/probe-list-styles.json +332 -0
  173. package/conformance/1.0/layout/probes/probe-pin-input-parity.json +87 -0
  174. package/conformance/1.0/layout/probes/probe-progress-track-flutter.json +298 -0
  175. package/conformance/1.0/layout/probes/probe-progress-track-regression-flutter.json +525 -0
  176. package/conformance/1.0/layout/probes/probe-row-column.json +784 -0
  177. package/conformance/1.0/layout/probes/probe-scroll.json +378 -0
  178. package/conformance/1.0/layout/probes/probe-search-flutter.json +138 -0
  179. package/conformance/1.0/layout/probes/probe-size-constraints.json +157 -0
  180. package/conformance/1.0/layout/probes/probe-spacer.json +291 -0
  181. package/conformance/1.0/layout/probes/probe-stat-progress-track.json +87 -0
  182. package/conformance/1.0/layout/probes/probe-text-button-flutter.json +163 -0
  183. package/conformance/1.0/layout/probes/probe-text-field-flutter.json +170 -0
  184. package/conformance/1.0/layout/probes/probe-text.json +202 -0
  185. package/conformance/1.0/layout/report/01-onboarding-start.md +49 -0
  186. package/conformance/1.0/layout/report/02-home-discover.md +98 -0
  187. package/conformance/1.0/layout/report/03-filters.md +85 -0
  188. package/conformance/1.0/layout/report/alert.md +27 -0
  189. package/conformance/1.0/layout/report/iphone-14-15-pro-107.md +47 -0
  190. package/conformance/1.0/layout/report/live_status_on_its_way_4.ios.md +60 -0
  191. package/conformance/1.0/layout/report/lucy-booking-mobile.md +81 -0
  192. package/conformance/1.0/layout/report/lucy-booking-tablet.md +279 -0
  193. package/conformance/1.0/layout/report/lucy-booking.md +117 -0
  194. package/conformance/1.0/layout/report/lucy-header.md +64 -0
  195. package/conformance/1.0/layout/report/lucy-welcome-pin-mobile.md +15 -0
  196. package/conformance/1.0/layout/report/lucy-welcome-pin.md +11 -0
  197. package/conformance/1.0/layout/report/navigation-bar.md +23 -0
  198. package/conformance/1.0/layout/report/probe-alert-banner-flutter.md +11 -0
  199. package/conformance/1.0/layout/report/probe-alert-banner-regression-flutter.md +27 -0
  200. package/conformance/1.0/layout/report/probe-alert-banner-stack-flutter.md +11 -0
  201. package/conformance/1.0/layout/report/probe-card.md +11 -0
  202. package/conformance/1.0/layout/report/probe-check-box-flutter.md +17 -0
  203. package/conformance/1.0/layout/report/probe-divider.md +11 -0
  204. package/conformance/1.0/layout/report/probe-dropdown-menu-flutter.md +15 -0
  205. package/conformance/1.0/layout/report/probe-dropdown-menu-max-lines.md +15 -0
  206. package/conformance/1.0/layout/report/probe-flex.md +23 -0
  207. package/conformance/1.0/layout/report/probe-grid-flutter.md +11 -0
  208. package/conformance/1.0/layout/report/probe-icon-button-flutter.md +11 -0
  209. package/conformance/1.0/layout/report/probe-icon-flutter.md +11 -0
  210. package/conformance/1.0/layout/report/probe-image-flutter.md +11 -0
  211. package/conformance/1.0/layout/report/probe-list-flutter.md +11 -0
  212. package/conformance/1.0/layout/report/probe-list-regression-flutter.md +27 -0
  213. package/conformance/1.0/layout/report/probe-list-row-flutter.md +11 -0
  214. package/conformance/1.0/layout/report/probe-pin-input-parity.md +11 -0
  215. package/conformance/1.0/layout/report/probe-progress-track-flutter.md +11 -0
  216. package/conformance/1.0/layout/report/probe-progress-track-regression-flutter.md +20 -0
  217. package/conformance/1.0/layout/report/probe-row-column.md +20 -0
  218. package/conformance/1.0/layout/report/probe-scroll.md +11 -0
  219. package/conformance/1.0/layout/report/probe-search-flutter.md +11 -0
  220. package/conformance/1.0/layout/report/probe-spacer.md +11 -0
  221. package/conformance/1.0/layout/report/probe-text-button-flutter.md +22 -0
  222. package/conformance/1.0/layout/report/probe-text-field-flutter.md +11 -0
  223. package/conformance/1.0/layout/report/probe-text.md +31 -0
  224. package/conformance/1.0/layout/report/wallet-home.md +35 -0
  225. package/conformance/1.0/layout/tolerance.json +12 -0
  226. package/conformance/1.0/layout/wallet-home.json +127 -0
  227. package/conformance/1.0/response-cases.json +228 -0
  228. package/conformance/1.0/screen-cases.json +198 -0
  229. package/conformance/1.0/screens/01-onboarding-start.json +994 -0
  230. package/conformance/1.0/screens/02-home-discover.json +2165 -0
  231. package/conformance/1.0/screens/03-filters.json +2290 -0
  232. package/conformance/1.0/screens/alert.json +231 -0
  233. package/conformance/1.0/screens/iphone-14-15-pro-107.json +3149 -0
  234. package/conformance/1.0/screens/live_status_on_its_way_4.ios.json +1313 -0
  235. package/conformance/1.0/screens/lucy-booking-mobile.json +3063 -0
  236. package/conformance/1.0/screens/lucy-booking-tablet.json +10371 -0
  237. package/conformance/1.0/screens/lucy-booking.json +2130 -0
  238. package/conformance/1.0/screens/lucy-header.json +1201 -0
  239. package/conformance/1.0/screens/lucy-welcome-pin-mobile.json +417 -0
  240. package/conformance/1.0/screens/lucy-welcome-pin.json +409 -0
  241. package/conformance/1.0/screens/navigation-bar.json +542 -0
  242. package/conformance/1.0/screens/wallet-home.json +1585 -0
  243. package/dist/action.d.ts +10616 -0
  244. package/dist/action.d.ts.map +1 -0
  245. package/dist/action.js +92 -0
  246. package/dist/action.js.map +1 -0
  247. package/dist/bind.d.ts +32 -0
  248. package/dist/bind.d.ts.map +1 -0
  249. package/dist/bind.js +102 -0
  250. package/dist/bind.js.map +1 -0
  251. package/dist/block-ref.d.ts +17 -0
  252. package/dist/block-ref.d.ts.map +1 -0
  253. package/dist/block-ref.js +17 -0
  254. package/dist/block-ref.js.map +1 -0
  255. package/dist/block-types.d.ts +26 -0
  256. package/dist/block-types.d.ts.map +1 -0
  257. package/dist/block-types.js +39 -0
  258. package/dist/block-types.js.map +1 -0
  259. package/dist/block.d.ts +20908 -0
  260. package/dist/block.d.ts.map +1 -0
  261. package/dist/block.js +81 -0
  262. package/dist/block.js.map +1 -0
  263. package/dist/blocks/display.d.ts +1915 -0
  264. package/dist/blocks/display.d.ts.map +1 -0
  265. package/dist/blocks/display.js +433 -0
  266. package/dist/blocks/display.js.map +1 -0
  267. package/dist/blocks/input.d.ts +7148 -0
  268. package/dist/blocks/input.d.ts.map +1 -0
  269. package/dist/blocks/input.js +855 -0
  270. package/dist/blocks/input.js.map +1 -0
  271. package/dist/blocks/layout.d.ts +2482 -0
  272. package/dist/blocks/layout.d.ts.map +1 -0
  273. package/dist/blocks/layout.js +266 -0
  274. package/dist/blocks/layout.js.map +1 -0
  275. package/dist/blocks/list.d.ts +980 -0
  276. package/dist/blocks/list.d.ts.map +1 -0
  277. package/dist/blocks/list.js +286 -0
  278. package/dist/blocks/list.js.map +1 -0
  279. package/dist/common.d.ts +958 -0
  280. package/dist/common.d.ts.map +1 -0
  281. package/dist/common.js +108 -0
  282. package/dist/common.js.map +1 -0
  283. package/dist/deprecated.d.ts +11 -0
  284. package/dist/deprecated.d.ts.map +1 -0
  285. package/dist/deprecated.js +26 -0
  286. package/dist/deprecated.js.map +1 -0
  287. package/dist/index.d.ts +20 -0
  288. package/dist/index.d.ts.map +1 -0
  289. package/dist/index.js +15 -0
  290. package/dist/index.js.map +1 -0
  291. package/dist/layout.d.ts +103 -0
  292. package/dist/layout.d.ts.map +1 -0
  293. package/dist/layout.js +113 -0
  294. package/dist/layout.js.map +1 -0
  295. package/dist/properties.d.ts +787 -0
  296. package/dist/properties.d.ts.map +1 -0
  297. package/dist/properties.js +447 -0
  298. package/dist/properties.js.map +1 -0
  299. package/dist/screen.d.ts +10494 -0
  300. package/dist/screen.d.ts.map +1 -0
  301. package/dist/screen.js +32 -0
  302. package/dist/screen.js.map +1 -0
  303. package/package.json +57 -4
  304. package/schema/1.0/action.json +109 -0
  305. package/schema/1.0/block.json +5886 -0
  306. package/schema/1.0/response.json +91 -0
  307. package/schema/1.0/screen.json +22 -0
  308. package/src/README.md +135 -0
  309. package/src/action.ts +119 -0
  310. package/src/bind.ts +114 -0
  311. package/src/block-ref.ts +18 -0
  312. package/src/block-types.ts +55 -0
  313. package/src/block.ts +116 -0
  314. package/src/blocks/display.ts +543 -0
  315. package/src/blocks/input.ts +1031 -0
  316. package/src/blocks/layout.ts +322 -0
  317. package/src/blocks/list.ts +355 -0
  318. package/src/common.ts +133 -0
  319. package/src/deprecated.ts +40 -0
  320. package/src/index.ts +31 -0
  321. package/src/layout.ts +194 -0
  322. package/src/properties.ts +516 -0
  323. package/src/screen.ts +39 -0
package/src/common.ts ADDED
@@ -0,0 +1,133 @@
1
+ import { z } from "zod";
2
+ import type { IosBlockNode } from "./block-types.ts";
3
+ import {
4
+ alignmentSchema,
5
+ backgroundImageSchema,
6
+ colorSchema,
7
+ crossAxisAlignmentSchema,
8
+ eventSchema,
9
+ gradientSchema,
10
+ overlaySchema,
11
+ paddingEntrySchema,
12
+ shapeSchema,
13
+ sizeSchema,
14
+ } from "./properties.ts";
15
+
16
+ /**
17
+ * Shapes shared by the block `data` schemas, as plain objects so each block can
18
+ * spread them into its own `z.strictObject({...})`.
19
+ *
20
+ * iOS builds them as a class hierarchy; the layers below match it:
21
+ *
22
+ * FIOCoreCommonBlockProperties -> commonPropertiesShape
23
+ * FIOCoreCommonDataBlock -> commonDataShape (adds id, events)
24
+ * FIOCoreCommonSingleChildBlockData -> singleChildShape (adds child)
25
+ * FIOCoreCommonMultiChildDataBlock -> multiChildShape (adds children, ...)
26
+ *
27
+ * `divider` sits outside that hierarchy and decodes only its own keys (it
28
+ * extends `FIOCoreGenericBlockData`).
29
+ */
30
+
31
+ /** Swift: FIOCoreCommonBlockProperties (Sources/Commons/FIOCoreCommonBlockProperties.swift). */
32
+ export const commonPropertiesShape = {
33
+ background_color: colorSchema.optional(),
34
+ foreground_color: colorSchema.optional(),
35
+ padding: z.array(paddingEntrySchema).optional(),
36
+ size: sizeSchema.optional(),
37
+ alignment_geometry: alignmentSchema.optional(),
38
+ margin: z.array(paddingEntrySchema).optional(),
39
+ shape: shapeSchema.optional(),
40
+ corner_radius: z.number().optional(),
41
+ gradient: gradientSchema.optional(),
42
+ fixed_size: z.boolean().optional(),
43
+ background_image: backgroundImageSchema.optional(),
44
+ background_overlays: z.array(overlaySchema).optional(),
45
+ };
46
+
47
+ /**
48
+ * Swift: FIOCoreCommonDataBlock (Sources/Blocks/Commons/FIOCoreCommonDataBlock.swift).
49
+ *
50
+ * `id` also accepts `null`: `decodeIfPresent` treats a null as absent, and the
51
+ * real sample screens (02-home-discover.json) carry `"id": null` on anonymous
52
+ * blocks. It is the only key that tolerates null; every other optional key
53
+ * must be omitted instead, so the converter never emits nulls on purpose.
54
+ */
55
+ export const commonDataShape = {
56
+ ...commonPropertiesShape,
57
+ id: z.string().nullish(),
58
+ events: z.array(eventSchema).optional(),
59
+ };
60
+
61
+ /**
62
+ * Marks a key as deprecated: `description` says what the key was and what replaces it (or that
63
+ * it is ignored), and the key carries `deprecated: true` metadata, which `npm run schema` exports
64
+ * as JSON Schema `deprecated: true` and `isDeprecatedSchema` reads. The schema itself is cloned, so
65
+ * the shared instances (`blockRef`, `colorSchema`, `paddingEntrySchema`, ...) stay unwrapped one
66
+ * level down: `deprecated(colorSchema.optional(), ...)` still unwraps to `colorSchema`.
67
+ */
68
+ export function deprecated<T extends z.ZodType>(schema: T, description: string): T {
69
+ return schema.describe(description).meta({ deprecated: true });
70
+ }
71
+
72
+ /**
73
+ * Marks every key of `shape` named in `keys` as deprecated (see `deprecated`), with the
74
+ * description `note(key)`, keeping its schema. Spread it after `shape` so each key keeps its place.
75
+ */
76
+ export function deprecateKeys<S extends Record<string, z.ZodType>, K extends keyof S & string>(
77
+ shape: S,
78
+ keys: readonly K[],
79
+ note: (key: K) => string,
80
+ ): { [P in K]: S[P] } {
81
+ const marked = {} as { [P in K]: S[P] };
82
+ for (const key of keys) marked[key] = deprecated(shape[key], note(key));
83
+ return marked;
84
+ }
85
+
86
+ /**
87
+ * "Deprecated on `<block>` since 2.0 and ignored (<spec>); `<key>` stays valid so saved 1.x <saved>
88
+ * decode." (no parenthesis when `spec` is empty).
89
+ */
90
+ export const ignoredOn = (block: string, spec: string, saved: string) => (key: string) =>
91
+ `Deprecated on \`${block}\` since 2.0 and ignored${spec === "" ? "" : ` (${spec})`}; \`${key}\` stays valid so saved 1.x ${saved} decode.`;
92
+
93
+ /** Every key of `commonPropertiesShape` (the style keys), in order. */
94
+ export const COMMON_PROPERTY_KEYS = Object.keys(commonPropertiesShape) as (keyof typeof commonPropertiesShape)[];
95
+
96
+ /**
97
+ * Swift: FIOCoreCommonSingleChildBlockData (Sources/Blocks/Commons/FIOCoreCommonSingleChildDataBlock.swift).
98
+ * `child` is optional: a container without a child is valid.
99
+ *
100
+ * The block schema is injected because block schemas are mutually recursive;
101
+ * see `block-ref.ts`.
102
+ */
103
+ export function singleChildShape(block: z.ZodType<IosBlockNode>) {
104
+ return { ...commonDataShape, child: block.optional() };
105
+ }
106
+
107
+ /**
108
+ * Swift: `distribution` is a free `String` in FIOCoreCommonMultiChildDataBlock, but
109
+ * `getDistribution()` only recognises these four values and falls back to
110
+ * `fill` (Sources/Commons/FIOCoreCommonBlockStackViewModel.swift).
111
+ */
112
+ export const distributionSchema = z.enum([
113
+ "fill_equally",
114
+ "fill",
115
+ "fill_proportionally",
116
+ "equal_centering",
117
+ ]);
118
+
119
+ /**
120
+ * Swift: FIOCoreCommonMultiChildDataBlock (Sources/Commons/FIOCoreCommonMultiChildDataBlock.swift).
121
+ * `children` is required (it may be empty); the other fields are optional.
122
+ * `alignment` is the cross-axis alignment (`start`, `center`, `end`), read by
123
+ * `row` and `column`.
124
+ */
125
+ export function multiChildShape(block: z.ZodType<IosBlockNode>) {
126
+ return {
127
+ ...commonDataShape,
128
+ children: z.array(block),
129
+ distribution: distributionSchema.optional(),
130
+ alignment: crossAxisAlignmentSchema.optional(),
131
+ spacing: z.number().optional(),
132
+ };
133
+ }
@@ -0,0 +1,40 @@
1
+ import { z } from "zod";
2
+ import { iosBlockDataSchemas } from "./block.ts";
3
+ import type { IosBlockType } from "./block-types.ts";
4
+
5
+ /**
6
+ * Deprecated keys (contract 2.1). A key that stays valid only so saved payloads decode (accepted
7
+ * and ignored, or a deprecated alias still honored) carries `deprecated: true` in its Zod metadata
8
+ * (`.meta({ deprecated: true })`); its description says what replaces it or that it is ignored.
9
+ * `npm run schema` exports the same flag as JSON Schema `deprecated: true`, next to the description.
10
+ * Editors use it to stop offering the key; validation is unchanged.
11
+ */
12
+
13
+ interface WrapperDef {
14
+ type: string;
15
+ innerType?: z.ZodType;
16
+ }
17
+
18
+ /**
19
+ * True when `schema` carries `deprecated: true` metadata, looking through the wrappers a key adds
20
+ * (`optional`, `nullable`, `default`, `readonly`), so `isDeprecatedSchema(shape.key)` works on any
21
+ * object key, nested ones included (`text_field.decoration.focus_color`, `style.line_height`).
22
+ */
23
+ export function isDeprecatedSchema(schema: z.ZodType): boolean {
24
+ let current: z.ZodType | undefined = schema;
25
+ while (current !== undefined) {
26
+ if (z.globalRegistry.get(current)?.deprecated === true) return true;
27
+ const def = current._zod.def as WrapperDef;
28
+ const wrapper = def.type === "optional" || def.type === "nullable" || def.type === "default" || def.type === "readonly";
29
+ current = wrapper ? def.innerType : undefined;
30
+ }
31
+ return false;
32
+ }
33
+
34
+ /** The top-level `data` keys of block `type` that are deprecated, in schema order (empty when none). */
35
+ export function deprecatedKeysOf(type: IosBlockType): string[] {
36
+ const shape = (iosBlockDataSchemas[type] as unknown as z.ZodObject).shape as Record<string, z.ZodType>;
37
+ return Object.entries(shape)
38
+ .filter(([, schema]) => isDeprecatedSchema(schema))
39
+ .map(([key]) => key);
40
+ }
package/src/index.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Fractal IO protocol, version 1.0: the Zod contract every implementation
3
+ * conforms to. `schema/1.0/*.json` is generated from it (`npm run schema`) and is
4
+ * the published, normative artifact for non-TypeScript implementations.
5
+ */
6
+
7
+ export { IOS_BLOCK_TYPES } from "./block-types.ts";
8
+ export type { IosBlockNode, IosBlockType } from "./block-types.ts";
9
+
10
+ export { iosBlockDataSchemas, iosBlockSchema } from "./block.ts";
11
+ export type { IosBlock, IosBlockData } from "./block.ts";
12
+ export { blockRef } from "./block-ref.ts";
13
+ export { deprecatedKeysOf, isDeprecatedSchema } from "./deprecated.ts";
14
+
15
+ export { FRACTAL_PROTOCOL_VERSION, fractalVersionSchema, screenSchema } from "./screen.ts";
16
+ export type { Screen } from "./screen.ts";
17
+
18
+ export { actionMessageSchema, responseSchema } from "./action.ts";
19
+ export type { ActionMessage, ResponseDocument } from "./action.ts";
20
+
21
+ export { BIND_ERROR_CODES, BIND_KEY, resolve, substituteBindings } from "./bind.ts";
22
+ export type { BindError, BindErrorCode, ResolveResult, SubstituteResult } from "./bind.ts";
23
+
24
+ export * from "./properties.ts";
25
+ export {
26
+ commonDataShape,
27
+ commonPropertiesShape,
28
+ distributionSchema,
29
+ multiChildShape,
30
+ singleChildShape,
31
+ } from "./common.ts";
package/src/layout.ts ADDED
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Layout conformance: the format of the golden frame files in
3
+ * `conformance/<version>/layout/` and the comparison every renderer harness runs
4
+ * against them. Zod-free, so a harness can import it without the contract.
5
+ *
6
+ * A block path names a block by the keys that lead to it from the screen's root
7
+ * block: `root` is the root itself, and every other path joins the nested-block
8
+ * keys under each block's `data` with dots, array entries by index
9
+ * (`child.children.0.start_block`). The root's own key is not part of the path.
10
+ */
11
+
12
+ /** Keys under a block's `data` that hold nested blocks (single block or array of blocks). */
13
+ export const NESTED_BLOCK_KEYS = [
14
+ "child",
15
+ "children",
16
+ "start_block",
17
+ "title_block",
18
+ "subtitle_block",
19
+ "end_block",
20
+ // alert_banner slots, in the order the renderers record them.
21
+ "leading",
22
+ "content",
23
+ "actions",
24
+ ] as const;
25
+
26
+ /** The path of the screen's root block. */
27
+ export const ROOT_BLOCK_PATH = "root";
28
+
29
+ /** A block's frame in points, relative to the top-left corner of the device canvas. */
30
+ export interface LayoutFrame {
31
+ /** The block's `type`, so a reader can tell which tolerance applies and spot a decode mismatch. */
32
+ type: string;
33
+ x: number;
34
+ y: number;
35
+ width: number;
36
+ height: number;
37
+ }
38
+
39
+ /** The device a layout file was measured on. */
40
+ export interface LayoutDevice {
41
+ width: number;
42
+ height: number;
43
+ colorScheme: "light" | "dark";
44
+ }
45
+
46
+ /**
47
+ * A golden or measured layout file: every block path the renderer laid out, with its frame.
48
+ * Goldens are measured on the reference renderer (`renderer: "ios"`); other harnesses write
49
+ * the same shape with their own `renderer`.
50
+ */
51
+ export interface LayoutDocument {
52
+ /** Protocol version of the screen. */
53
+ fractal: string;
54
+ /** File name of the screen under `conformance/<version>/screens/`. */
55
+ screen: string;
56
+ /** Which renderer measured the frames: `ios`, `android`, `web`. */
57
+ renderer: string;
58
+ device: LayoutDevice;
59
+ frames: Record<string, LayoutFrame>;
60
+ }
61
+
62
+ /** One tolerance class: how far a measured frame may be from the golden and still match. */
63
+ export interface ToleranceClass {
64
+ /** Block types in this class. The `default` class has none: it covers every other type. */
65
+ types?: string[];
66
+ /** Allowed absolute difference of `x` and `y`, in points. */
67
+ position: number;
68
+ /** Allowed absolute difference of `width` and `height`, in points. */
69
+ size: number;
70
+ /** Allowed relative difference of `width` and `height` (of the golden value); the larger of `size` and this wins. */
71
+ sizeRatio?: number;
72
+ }
73
+
74
+ /** `conformance/<version>/layout/tolerance.json`. */
75
+ export interface LayoutTolerance {
76
+ default: ToleranceClass;
77
+ text: ToleranceClass;
78
+ }
79
+
80
+ /** The kind of a difference between a golden and a measured layout. */
81
+ export type LayoutDifferenceKind =
82
+ /** The golden has the block, the renderer did not lay it out. */
83
+ | "missing"
84
+ /** The renderer laid out a block the golden does not have. */
85
+ | "extra"
86
+ /** Both have the path, with a different block type. */
87
+ | "type"
88
+ /** Both have the block, its frame is outside the tolerance. */
89
+ | "frame";
90
+
91
+ export interface LayoutDifference {
92
+ path: string;
93
+ kind: LayoutDifferenceKind;
94
+ type: string;
95
+ golden?: LayoutFrame;
96
+ measured?: LayoutFrame;
97
+ /** `measured - golden` per field, for `frame` differences. */
98
+ delta?: { x: number; y: number; width: number; height: number };
99
+ }
100
+
101
+ interface BlockLike {
102
+ type?: unknown;
103
+ data?: unknown;
104
+ }
105
+
106
+ function isBlock(value: unknown): value is { type: string; data?: Record<string, unknown> } {
107
+ return typeof value === "object" && value !== null && typeof (value as BlockLike).type === "string";
108
+ }
109
+
110
+ /** Joins a parent path and a key the way block paths are written. */
111
+ export function childPath(parent: string, key: string | number): string {
112
+ return parent === ROOT_BLOCK_PATH ? String(key) : `${parent}.${key}`;
113
+ }
114
+
115
+ /**
116
+ * Lists every block of a screen document (or of a bare root block) with its path and type,
117
+ * in depth-first document order.
118
+ */
119
+ export function blockPaths(screenOrBlock: unknown): Map<string, string> {
120
+ const root = isBlock(screenOrBlock) ? screenOrBlock : (screenOrBlock as { data?: unknown } | null)?.data;
121
+ const paths = new Map<string, string>();
122
+ const visit = (block: unknown, path: string) => {
123
+ if (!isBlock(block)) return;
124
+ paths.set(path, block.type);
125
+ const data = block.data;
126
+ if (typeof data !== "object" || data === null) return;
127
+ for (const key of NESTED_BLOCK_KEYS) {
128
+ const value = (data as Record<string, unknown>)[key];
129
+ if (Array.isArray(value)) value.forEach((entry, index) => visit(entry, childPath(childPath(path, key), index)));
130
+ else if (value !== undefined) visit(value, childPath(path, key));
131
+ }
132
+ };
133
+ visit(root, ROOT_BLOCK_PATH);
134
+ return paths;
135
+ }
136
+
137
+ /** The tolerance class that applies to a block type. */
138
+ export function toleranceFor(type: string, tolerance: LayoutTolerance): ToleranceClass {
139
+ return tolerance.text.types?.includes(type) ? tolerance.text : tolerance.default;
140
+ }
141
+
142
+ const round = (value: number) => Math.round(value * 100) / 100;
143
+
144
+ /** Whether `measured` is within the tolerance of `golden`. */
145
+ export function frameMatches(golden: LayoutFrame, measured: LayoutFrame, tolerance: ToleranceClass): boolean {
146
+ // The limit is rounded like the deltas, so 10% of 42.3 is 4.23, not 4.2299999.
147
+ const sizeLimit = (value: number) => round(Math.max(tolerance.size, (tolerance.sizeRatio ?? 0) * Math.abs(value)));
148
+ // Rounding to 0.01pt keeps a frame written at the limit (1.0 vs 1.0000001) inside it.
149
+ return (
150
+ round(Math.abs(measured.x - golden.x)) <= tolerance.position &&
151
+ round(Math.abs(measured.y - golden.y)) <= tolerance.position &&
152
+ round(Math.abs(measured.width - golden.width)) <= sizeLimit(golden.width) &&
153
+ round(Math.abs(measured.height - golden.height)) <= sizeLimit(golden.height)
154
+ );
155
+ }
156
+
157
+ /**
158
+ * Compares a measured layout with the golden, in golden path order followed by the extra
159
+ * measured paths. An empty list means the renderer matches.
160
+ */
161
+ export function compareLayout(golden: LayoutDocument, measured: LayoutDocument, tolerance: LayoutTolerance): LayoutDifference[] {
162
+ const differences: LayoutDifference[] = [];
163
+ for (const [path, frame] of Object.entries(golden.frames)) {
164
+ const other = measured.frames[path];
165
+ if (!other) {
166
+ differences.push({ path, kind: "missing", type: frame.type, golden: frame });
167
+ } else if (other.type !== frame.type) {
168
+ differences.push({ path, kind: "type", type: frame.type, golden: frame, measured: other });
169
+ } else if (!frameMatches(frame, other, toleranceFor(frame.type, tolerance))) {
170
+ differences.push({
171
+ path,
172
+ kind: "frame",
173
+ type: frame.type,
174
+ golden: frame,
175
+ measured: other,
176
+ delta: {
177
+ x: round(other.x - frame.x),
178
+ y: round(other.y - frame.y),
179
+ width: round(other.width - frame.width),
180
+ height: round(other.height - frame.height),
181
+ },
182
+ });
183
+ }
184
+ }
185
+ for (const [path, frame] of Object.entries(measured.frames)) {
186
+ if (!(path in golden.frames)) differences.push({ path, kind: "extra", type: frame.type, measured: frame });
187
+ }
188
+ return differences;
189
+ }
190
+
191
+ /** Rounds a frame to 0.01pt, the precision layout files are written with. */
192
+ export function roundFrame(frame: LayoutFrame): LayoutFrame {
193
+ return { type: frame.type, x: round(frame.x), y: round(frame.y), width: round(frame.width), height: round(frame.height) };
194
+ }