@bake-native/core 0.0.0 → 0.1.0-rc.1

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/THIRD_PARTY_NOTICES.txt +548 -0
  3. package/bake-prelude.js +189 -0
  4. package/batch-contract.json +21 -0
  5. package/batch-wire.js +674 -0
  6. package/close-watcher.js +137 -0
  7. package/compat.json +64 -0
  8. package/controls.css +108 -0
  9. package/determinism.js +175 -0
  10. package/devtools.d.ts +13 -0
  11. package/devtools.js +73 -0
  12. package/dialogs.js +59 -0
  13. package/direct-style.js +105 -0
  14. package/direct-table.js +261 -0
  15. package/dist/bake.mjs +2211 -0
  16. package/dist/build-BrSFpaK1.mjs +1 -0
  17. package/dist/build-tools-Dxyl6XAf.mjs +80 -0
  18. package/dist/build-vAPG2xQv.mjs +5516 -0
  19. package/dist/client-Cm7o6dQd.mjs +17544 -0
  20. package/dist/compiler.mjs +4 -0
  21. package/dist/config-B1W8gfZY.mjs +12 -0
  22. package/dist/dev-xZblYmDc.mjs +990 -0
  23. package/dist/direct-report-Bdda-k_Y.mjs +153 -0
  24. package/dist/direct-report-Du44nNWl.mjs +1 -0
  25. package/dist/index.d.mts +176 -0
  26. package/dist/index.mjs +1 -0
  27. package/dist/intl-ROnAp2qO.mjs +75 -0
  28. package/dist/jiti-stub-CKcaShwE.mjs +5 -0
  29. package/dist/native-views-BQ8TtbQj.mjs +8046 -0
  30. package/dist/octane/package.json +5 -0
  31. package/dist/package-D2aYD6A4.mjs +2789 -0
  32. package/dist/react/package.json +13 -0
  33. package/dist/rolldown-runtime-D3KUYPsf.mjs +12 -0
  34. package/dist/run-BtyJGAQB.mjs +6632 -0
  35. package/dist/scope-8W2aIuQ9.mjs +262 -0
  36. package/dist/screens/BakeNativeScreen.native.ts +9 -0
  37. package/dist/screens/package.json +5 -0
  38. package/dom-exception.js +31 -0
  39. package/element-api.js +158 -0
  40. package/first-screen.js +30 -0
  41. package/fonts/Geist-Italic-Variable.ttf +0 -0
  42. package/fonts/Geist-Variable.ttf +0 -0
  43. package/fonts/GeistMono-Italic-Variable.ttf +0 -0
  44. package/fonts/GeistMono-Variable.ttf +0 -0
  45. package/fonts/OFL.txt +93 -0
  46. package/fonts/README.md +27 -0
  47. package/fonts/geist-italic.css +8 -0
  48. package/fonts/geist-mono-italic.css +8 -0
  49. package/fonts/geist-mono.css +8 -0
  50. package/fonts/geist.css +8 -0
  51. package/header-icons.json +53 -0
  52. package/host-runtime.js +521 -0
  53. package/image-props.js +17 -0
  54. package/index.d.ts +8 -0
  55. package/index.js +7 -0
  56. package/licenses/Apache-2.0.txt +73 -0
  57. package/locale-entry.d.ts +1 -0
  58. package/locale-entry.js +1 -0
  59. package/locale.d.ts +28 -0
  60. package/locale.js +124 -0
  61. package/markup-support.js +87 -0
  62. package/media-element.js +115 -0
  63. package/native-args-entry.js +2 -0
  64. package/native-args.d.ts +7 -0
  65. package/native-args.js +155 -0
  66. package/native-entry.js +1 -0
  67. package/native-globals.d.ts +166 -0
  68. package/native-scenarios.d.ts +17 -0
  69. package/native-scenarios.js +46 -0
  70. package/native-support.json +366 -0
  71. package/native.d.ts +52 -0
  72. package/native.js +237 -0
  73. package/package.json +143 -4
  74. package/page-elements.js +123 -0
  75. package/runtime-provides.json +412 -0
  76. package/safe-area.d.ts +1 -0
  77. package/safe-area.js +44 -0
  78. package/swift-ui/modifiers.js +176 -0
  79. package/tab-icons.js +62 -0
  80. package/templates/create/tabs/AGENTS.md +22 -0
  81. package/templates/create/tabs/README.md +43 -0
  82. package/templates/create/tabs/_gitignore +13 -0
  83. package/templates/create/tabs/android/app/build.gradle.kts +79 -0
  84. package/templates/create/tabs/android/app/src/main/AndroidManifest.xml +39 -0
  85. package/templates/create/tabs/android/app/src/main/kotlin/MainActivity.kt +35 -0
  86. package/templates/create/tabs/android/app/src/main/res/values/themes.xml +8 -0
  87. package/templates/create/tabs/android/build.gradle.kts +5 -0
  88. package/templates/create/tabs/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  89. package/templates/create/tabs/android/gradle/wrapper/gradle-wrapper.properties +9 -0
  90. package/templates/create/tabs/android/gradle.properties +3 -0
  91. package/templates/create/tabs/android/gradlew +248 -0
  92. package/templates/create/tabs/android/settings.gradle.kts +47 -0
  93. package/templates/create/tabs/bake.config.ts +10 -0
  94. package/templates/create/tabs/ios/App/App.swift +30 -0
  95. package/templates/create/tabs/ios/build.sh +23 -0
  96. package/templates/create/tabs/ios/project.yml +57 -0
  97. package/templates/create/tabs/macos/Package.swift +24 -0
  98. package/templates/create/tabs/macos/Sources/__SWIFT_NAME__/App.swift +146 -0
  99. package/templates/create/tabs/macos/build.sh +4 -0
  100. package/templates/create/tabs/package.json +23 -0
  101. package/templates/create/tabs/pnpm-workspace.yaml +6 -0
  102. package/templates/create/tabs/src/App.tsrx +92 -0
  103. package/templates/create/tabs/src/App.tsx +67 -0
  104. package/templates/create/tabs/src/styles.css +32 -0
  105. package/templates/create/tabs/tsconfig.json +5 -0
  106. package/templates/create/tabs/windows/Cargo.toml +29 -0
  107. package/templates/create/tabs/windows/build.rs +9 -0
  108. package/templates/create/tabs/windows/src/main.rs +52 -0
  109. package/templates/create/tabs/windows/src/shell.rs +316 -0
  110. package/templates/module/__NAME__.kt +20 -0
  111. package/templates/module/__NAME__.native.ts +24 -0
  112. package/templates/module/__NAME__.swift +25 -0
  113. package/templates/module/__NAME__.web.ts +13 -0
  114. package/templates/module/__NAME__Test.kt +26 -0
  115. package/templates/module/__NAME__Tests.swift +25 -0
  116. package/templates/module/__SNAKE__.rs +43 -0
  117. package/text.d.ts +20 -0
  118. package/text.js +100 -0
  119. package/transform-entry.js +1 -0
  120. package/transform.d.ts +15 -0
  121. package/transform.js +98 -0
  122. package/tsconfig.native.json +16 -0
  123. package/ui/scope.js +103 -0
  124. package/ui/swift.js +106 -0
  125. package/ui/ui.css +272 -0
  126. package/view-ref-writer.js +268 -0
  127. package/view-ref.d.ts +26 -0
  128. package/view-ref.js +85 -0
  129. package/views/Video.native.ts +68 -0
  130. package/views/generated/VideoViewAndroid.h +68 -0
  131. package/views/generated/VideoViewJSI.h +94 -0
  132. package/views/generated/VideoViewSpec.kt +113 -0
  133. package/views/generated/apple/VideoViewJSI/VideoViewJSIApple.cpp +40 -0
  134. package/views/generated/apple/VideoViewJSI/include/VideoViewJSIApple.h +28 -0
  135. package/views/generated/apple/VideoViewSpec/VideoViewInterop.swift +39 -0
  136. package/views/generated/apple/VideoViewSpec/VideoViewSpec.swift +186 -0
  137. package/views/generated/video_view_spec.rs +189 -0
  138. package/views.d.ts +24 -0
  139. package/views.js +45 -0
  140. package/virtual-window.js +35 -0
  141. package/visibility.js +75 -0
  142. package/web-crypto.js +84 -0
  143. package/web-fetch.js +1071 -0
  144. package/README.md +0 -3
@@ -0,0 +1,412 @@
1
+ {
2
+ "format": 1,
3
+ "runtime": "0.1.0-rc.1",
4
+ "hostProtocol": 4,
5
+ "minHostProtocol": 4,
6
+ "batch": {
7
+ "digest": "0xd4c77b3d54621b67",
8
+ "stream": "ed450a04d5a6a5dd",
9
+ "seed": [
10
+ "native",
11
+ "click",
12
+ "discrete",
13
+ "default",
14
+ "continuous",
15
+ "hidden",
16
+ "visible",
17
+ "value",
18
+ "class",
19
+ "className",
20
+ "style",
21
+ "id",
22
+ "type",
23
+ "role",
24
+ "title",
25
+ "label",
26
+ "disabled",
27
+ "checked",
28
+ "placeholder",
29
+ "data-expect",
30
+ "aria-label",
31
+ "aria-hidden",
32
+ "aria-pressed",
33
+ "modifiers",
34
+ "$type",
35
+ "#text",
36
+ "div",
37
+ "span",
38
+ "p",
39
+ "main",
40
+ "button",
41
+ "section",
42
+ "header",
43
+ "footer",
44
+ "img",
45
+ "input",
46
+ "svg",
47
+ "path",
48
+ "left",
49
+ "top",
50
+ "right",
51
+ "bottom",
52
+ "width",
53
+ "height",
54
+ "position",
55
+ "backgroundColor",
56
+ "color",
57
+ "opacity",
58
+ "transform",
59
+ "fill",
60
+ "stroke",
61
+ "d"
62
+ ],
63
+ "ops": {
64
+ "create": {
65
+ "tag": 1,
66
+ "shape": "ceedecf0869e4cc1"
67
+ },
68
+ "update": {
69
+ "tag": 2,
70
+ "shape": "11ab636af1186798"
71
+ },
72
+ "recreate": {
73
+ "tag": 3,
74
+ "shape": "ceedecf0869e4cc1"
75
+ },
76
+ "insert": {
77
+ "tag": 4,
78
+ "shape": "f0253cbaca3a749f"
79
+ },
80
+ "move": {
81
+ "tag": 5,
82
+ "shape": "f0253cbaca3a749f"
83
+ },
84
+ "remove": {
85
+ "tag": 6,
86
+ "shape": "9fadb466fd5eed28"
87
+ },
88
+ "destroy": {
89
+ "tag": 7,
90
+ "shape": "cdb939bab67bfe62"
91
+ },
92
+ "event": {
93
+ "tag": 8,
94
+ "shape": "dc46c1f636e25100"
95
+ },
96
+ "visibility": {
97
+ "tag": 9,
98
+ "shape": "16408ca043827922"
99
+ },
100
+ "mount-template-run": {
101
+ "tag": 10,
102
+ "shape": "9cd3171437fc3194"
103
+ },
104
+ "mount-template-range": {
105
+ "tag": 11,
106
+ "shape": "de01fc8a5e19f1a7"
107
+ },
108
+ "mount-template": {
109
+ "tag": 12,
110
+ "shape": "317f5d15f465c6fe"
111
+ },
112
+ "set-transform": {
113
+ "tag": 13,
114
+ "shape": "e2a74faf03a213d8"
115
+ }
116
+ }
117
+ },
118
+ "events": [
119
+ "animationend",
120
+ "animationiteration",
121
+ "animationstart",
122
+ "blur",
123
+ "change",
124
+ "click",
125
+ "close",
126
+ "compositionend",
127
+ "compositionstart",
128
+ "compositionupdate",
129
+ "contextmenu",
130
+ "ended",
131
+ "error",
132
+ "focus",
133
+ "focusin",
134
+ "focusout",
135
+ "gotpointercapture",
136
+ "input",
137
+ "itempress",
138
+ "keydown",
139
+ "keyup",
140
+ "layout",
141
+ "load",
142
+ "loadedmetadata",
143
+ "lostpointercapture",
144
+ "parentlayout",
145
+ "pause",
146
+ "play",
147
+ "pointercancel",
148
+ "pointerdown",
149
+ "pointerenter",
150
+ "pointerleave",
151
+ "pointermove",
152
+ "pointerout",
153
+ "pointerover",
154
+ "pointerup",
155
+ "scroll",
156
+ "submit",
157
+ "tabselect",
158
+ "timeupdate",
159
+ "toggle",
160
+ "transitioncancel",
161
+ "transitionend",
162
+ "transitionrun",
163
+ "transitionstart",
164
+ "wheel"
165
+ ],
166
+ "style": [
167
+ "-webkit-align-items",
168
+ "-webkit-align-self",
169
+ "-webkit-appearance",
170
+ "-webkit-box-orient",
171
+ "-webkit-box-sizing",
172
+ "-webkit-flex",
173
+ "-webkit-flex-basis",
174
+ "-webkit-flex-direction",
175
+ "-webkit-flex-grow",
176
+ "-webkit-flex-shrink",
177
+ "-webkit-flex-wrap",
178
+ "-webkit-font-smoothing",
179
+ "-webkit-justify-content",
180
+ "-webkit-line-clamp",
181
+ "-webkit-margin-after",
182
+ "-webkit-margin-before",
183
+ "-webkit-margin-end",
184
+ "-webkit-margin-start",
185
+ "-webkit-padding-end",
186
+ "-webkit-padding-start",
187
+ "-webkit-text-decoration",
188
+ "-webkit-text-decoration-line",
189
+ "-webkit-transform",
190
+ "-webkit-user-select",
191
+ "accent-color",
192
+ "align-content",
193
+ "align-items",
194
+ "align-self",
195
+ "anchor-name",
196
+ "animation",
197
+ "animation-delay",
198
+ "animation-direction",
199
+ "animation-duration",
200
+ "animation-fill-mode",
201
+ "animation-iteration-count",
202
+ "animation-name",
203
+ "animation-timing-function",
204
+ "appearance",
205
+ "aspect-ratio",
206
+ "background",
207
+ "background-color",
208
+ "background-image",
209
+ "background-position",
210
+ "background-repeat",
211
+ "background-size",
212
+ "block-size",
213
+ "border",
214
+ "border-block",
215
+ "border-block-end",
216
+ "border-block-end-color",
217
+ "border-block-end-style",
218
+ "border-block-end-width",
219
+ "border-block-start",
220
+ "border-block-start-color",
221
+ "border-block-start-style",
222
+ "border-block-start-width",
223
+ "border-bottom",
224
+ "border-bottom-color",
225
+ "border-bottom-left-radius",
226
+ "border-bottom-right-radius",
227
+ "border-bottom-style",
228
+ "border-bottom-width",
229
+ "border-color",
230
+ "border-end-end-radius",
231
+ "border-end-start-radius",
232
+ "border-inline",
233
+ "border-inline-end",
234
+ "border-inline-end-color",
235
+ "border-inline-end-style",
236
+ "border-inline-end-width",
237
+ "border-inline-start",
238
+ "border-inline-start-color",
239
+ "border-inline-start-style",
240
+ "border-inline-start-width",
241
+ "border-left",
242
+ "border-left-color",
243
+ "border-left-style",
244
+ "border-left-width",
245
+ "border-radius",
246
+ "border-right",
247
+ "border-right-color",
248
+ "border-right-style",
249
+ "border-right-width",
250
+ "border-start-end-radius",
251
+ "border-start-start-radius",
252
+ "border-style",
253
+ "border-top",
254
+ "border-top-color",
255
+ "border-top-left-radius",
256
+ "border-top-right-radius",
257
+ "border-top-style",
258
+ "border-top-width",
259
+ "border-width",
260
+ "bottom",
261
+ "box-shadow",
262
+ "box-sizing",
263
+ "color",
264
+ "color-scheme",
265
+ "column-gap",
266
+ "content",
267
+ "cursor",
268
+ "direction",
269
+ "display",
270
+ "fill",
271
+ "fill-opacity",
272
+ "filter",
273
+ "flex",
274
+ "flex-basis",
275
+ "flex-direction",
276
+ "flex-flow",
277
+ "flex-grow",
278
+ "flex-shrink",
279
+ "flex-wrap",
280
+ "font",
281
+ "font-family",
282
+ "font-size",
283
+ "font-style",
284
+ "font-synthesis",
285
+ "font-synthesis-style",
286
+ "font-synthesis-weight",
287
+ "font-weight",
288
+ "gap",
289
+ "grid-area",
290
+ "grid-auto-columns",
291
+ "grid-auto-flow",
292
+ "grid-auto-rows",
293
+ "grid-column",
294
+ "grid-column-end",
295
+ "grid-column-gap",
296
+ "grid-column-start",
297
+ "grid-gap",
298
+ "grid-row",
299
+ "grid-row-end",
300
+ "grid-row-gap",
301
+ "grid-row-start",
302
+ "grid-template",
303
+ "grid-template-areas",
304
+ "grid-template-columns",
305
+ "grid-template-rows",
306
+ "height",
307
+ "inline-size",
308
+ "inset",
309
+ "inset-block",
310
+ "inset-block-end",
311
+ "inset-block-start",
312
+ "inset-inline",
313
+ "inset-inline-end",
314
+ "inset-inline-start",
315
+ "isolation",
316
+ "justify-content",
317
+ "justify-items",
318
+ "justify-self",
319
+ "left",
320
+ "letter-spacing",
321
+ "line-height",
322
+ "list-style",
323
+ "list-style-type",
324
+ "margin",
325
+ "margin-block",
326
+ "margin-block-end",
327
+ "margin-block-start",
328
+ "margin-bottom",
329
+ "margin-inline",
330
+ "margin-inline-end",
331
+ "margin-inline-start",
332
+ "margin-left",
333
+ "margin-right",
334
+ "margin-top",
335
+ "max-block-size",
336
+ "max-height",
337
+ "max-inline-size",
338
+ "max-width",
339
+ "min-block-size",
340
+ "min-height",
341
+ "min-inline-size",
342
+ "min-width",
343
+ "object-fit",
344
+ "object-position",
345
+ "opacity",
346
+ "order",
347
+ "outline",
348
+ "outline-color",
349
+ "outline-offset",
350
+ "outline-style",
351
+ "outline-width",
352
+ "overflow",
353
+ "overflow-wrap",
354
+ "overflow-x",
355
+ "overflow-y",
356
+ "padding",
357
+ "padding-block",
358
+ "padding-block-end",
359
+ "padding-block-start",
360
+ "padding-bottom",
361
+ "padding-inline",
362
+ "padding-inline-end",
363
+ "padding-inline-start",
364
+ "padding-left",
365
+ "padding-right",
366
+ "padding-top",
367
+ "place-content",
368
+ "place-items",
369
+ "place-self",
370
+ "pointer-events",
371
+ "position",
372
+ "position-anchor",
373
+ "position-try-fallbacks",
374
+ "right",
375
+ "rotate",
376
+ "row-gap",
377
+ "scale",
378
+ "stroke",
379
+ "stroke-opacity",
380
+ "stroke-width",
381
+ "text-align",
382
+ "text-decoration",
383
+ "text-decoration-line",
384
+ "text-overflow",
385
+ "text-shadow",
386
+ "text-transform",
387
+ "top",
388
+ "touch-action",
389
+ "transform",
390
+ "transition",
391
+ "transition-delay",
392
+ "transition-duration",
393
+ "transition-property",
394
+ "transition-timing-function",
395
+ "translate",
396
+ "unicode-bidi",
397
+ "user-select",
398
+ "vertical-align",
399
+ "visibility",
400
+ "white-space",
401
+ "width",
402
+ "word-break",
403
+ "word-wrap",
404
+ "z-index"
405
+ ],
406
+ "globals": [
407
+ "crypto",
408
+ "dialogs",
409
+ "visibility",
410
+ "custom-properties"
411
+ ]
412
+ }
package/safe-area.d.ts ADDED
@@ -0,0 +1 @@
1
+ export type SafeAreaEdge = 'top' | 'right' | 'bottom' | 'left';
package/safe-area.js ADDED
@@ -0,0 +1,44 @@
1
+ import { NO_DIRECT } from './direct-style.js';
2
+
3
+ const sides = ['top', 'right', 'bottom', 'left'];
4
+ const padding = ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'];
5
+ const length = /^(?:0|(?:\d+(?:\.\d+)?|\.\d+)(?:[a-z]+|%))$/i;
6
+ const nonAdditive = /^(?:0|inherit|initial|unset|revert|revert-layer)$/i;
7
+
8
+ export function isSafeAreaEdge(edge) {
9
+ return sides.includes(edge);
10
+ }
11
+
12
+ export const safeAreaEdgesGuide = 'Use an edges array containing only "top", "right", "bottom", or "left", or omit it for all four edges.';
13
+
14
+ /** Compose after the adapter has normalized its View style. */
15
+ export function safeAreaStyle(style, edges = sides) {
16
+ if (!Array.isArray(edges)) throw new Error(safeAreaEdgesGuide);
17
+ for (const edge of edges) if (!isSafeAreaEdge(edge)) throw new Error(safeAreaEdgesGuide);
18
+ if (edges.length === 0) return style;
19
+ const cssText = typeof style === 'string';
20
+ const result = cssText ? null : { ...style };
21
+ const shorthand = result?.padding;
22
+ const scalar = typeof shorthand === 'number' || typeof shorthand === 'string' && length.test(shorthand.trim());
23
+ let declarations = '';
24
+ for (let i = 0; i < sides.length; i++) {
25
+ const side = sides[i];
26
+ if (!edges.includes(side)) continue;
27
+ const inset = `env(safe-area-inset-${side})`;
28
+ const hyphenated = 'padding-' + side;
29
+ if (cssText) {
30
+ declarations += `;${hyphenated}:${inset}`;
31
+ continue;
32
+ }
33
+ const key = padding[i];
34
+ const value = result[key] ?? result[hyphenated] ?? (scalar ? shorthand : undefined);
35
+ delete result[key];
36
+ delete result[hyphenated];
37
+ const amount = typeof value === 'number' && value !== 0 ? value + 'px'
38
+ : typeof value === 'string' && !nonAdditive.test(value.trim()) ? value.trim() : '';
39
+ result[key] = amount ? `calc(${inset} + ${amount})` : inset;
40
+ }
41
+ if (cssText) return style + declarations;
42
+ if (style?.[NO_DIRECT] === true) Object.defineProperty(result, NO_DIRECT, { value: true });
43
+ return result;
44
+ }
@@ -0,0 +1,176 @@
1
+ // SwiftUI view modifiers, as plain data: `modifiers={[padding({ all: 16 }), glassEffect()]}`.
2
+ // Each call returns `{ $type, ...args }`; the native host applies them in order, as SwiftUI
3
+ // does (`view.padding(16).glassEffect()`). Names and arguments mirror SwiftUI (and @expo/ui).
4
+ // On the web, the subset with a CSS meaning is applied as inline style (see webStyle).
5
+
6
+ const m = ($type, args) => ({ $type, ...(args ?? {}) });
7
+
8
+ /** `.padding()`: `{ all }`, `{ horizontal, vertical }` or edges `{ top, leading, bottom, trailing }`. No argument: the system default. */
9
+ export const padding = (args) => m('padding', args);
10
+ /** `.frame(width:height:)` or `.frame(minWidth:maxWidth:minHeight:maxHeight:alignment:)`. `maxWidth: 'infinity'` fills. */
11
+ export const frame = (args) => m('frame', args);
12
+ /** `.background(color)`, optionally clipped to `shape` ('capsule' | 'circle' | { roundedRectangle: r }). */
13
+ export const background = (color, shape) => m('background', { color, shape });
14
+ /** `.foregroundStyle(...)`: a color or the system secondary foreground style. */
15
+ export const foregroundStyle = (color) => m('foregroundStyle', { color });
16
+ /** `.listRowBackground(color)` on a Form or List row. */
17
+ export const listRowBackground = (color) => m('listRowBackground', { color });
18
+ /** `.font(.system(size:weight:design:))` or a text style: `font({ textStyle: 'headline' })`. */
19
+ export const font = (args) => m('font', args);
20
+ /** `.bold()`. */
21
+ export const bold = () => m('bold');
22
+ /** `.italic()`. */
23
+ export const italic = () => m('italic');
24
+ /** `.monospacedDigit()`: digits in the current font keep the same width. */
25
+ export const monospacedDigit = () => m('monospacedDigit');
26
+ /** `.tint(color)`. */
27
+ export const tint = (color) => m('tint', { color });
28
+ /** `.buttonStyle(...)`: 'automatic' | 'bordered' | 'borderedProminent' | 'borderless' | 'plain' | 'glass' | 'glassProminent'. */
29
+ export const buttonStyle = (style) => m('buttonStyle', { style });
30
+ /** `.buttonBorderShape(...)`: changes the bordered or glass style's shape. */
31
+ export const buttonBorderShape = (shape) => m('buttonBorderShape', { shape });
32
+ /** `.controlSize(...)`: 'mini' | 'small' | 'regular' | 'large' | 'extraLarge'. */
33
+ export const controlSize = (size) => m('controlSize', { size });
34
+ /** `.glassEffect(_:in:)` (iOS 26 / macOS 26 Liquid Glass): `{ glass: { variant: 'regular' | 'clear', interactive, tint }, shape }`. */
35
+ export const glassEffect = (args) => m('glassEffect', args);
36
+ /** `.cornerRadius(r)`. */
37
+ export const cornerRadius = (radius) => m('cornerRadius', { radius });
38
+ /** `.clipShape(...)`: 'capsule' | 'circle' | 'rectangle' | { roundedRectangle: r }. */
39
+ export const clipShape = (shape) => m('clipShape', { shape });
40
+ /** `.contentShape(.rect)`: the whole rectangle answers a press, even with transparent content. */
41
+ export const contentShape = (shape) => m('contentShape', { shape });
42
+ /** `.opacity(v)`. */
43
+ export const opacity = (value) => m('opacity', { value });
44
+ /** `.shadow(color:radius:x:y:)`. */
45
+ export const shadow = (args) => m('shadow', args);
46
+ /** `.disabled(b)`. */
47
+ export const disabled = (value = true) => m('disabled', { value });
48
+ /** `.pickerStyle(...)`: 'automatic' | 'menu' | 'segmented' | 'wheel' | 'inline' | 'palette'. */
49
+ export const pickerStyle = (style) => m('pickerStyle', { style });
50
+ /** `.toggleStyle(...)`: 'automatic' | 'switch' | 'button' | 'checkbox' (macOS). */
51
+ export const toggleStyle = (style) => m('toggleStyle', { style });
52
+ /** `.labelsHidden()`. */
53
+ export const labelsHidden = () => m('labelsHidden');
54
+ /** `.labelStyle(.iconOnly)`: show the symbol while keeping the accessible label. */
55
+ export const labelStyle = (style) => m('labelStyle', { style });
56
+ /** `.accessibilityLabel(value)`: the accessible name of an unlabeled view. */
57
+ export const accessibilityLabel = (value) => m('accessibilityLabel', { value });
58
+ /** `.multilineTextAlignment(...)`: 'leading' | 'center' | 'trailing'. */
59
+ export const multilineTextAlignment = (alignment) => m('multilineTextAlignment', { alignment });
60
+ /** `.lineLimit(n)`. */
61
+ export const lineLimit = (value) => m('lineLimit', { value });
62
+ /** `.tag(value)`: identifies a Picker option or a TabView tab. */
63
+ export const tag = (value) => m('tag', { value });
64
+ /** `.presentationDetents([...])` inside a BottomSheet: 'medium' | 'large' | { fraction } | { height }. */
65
+ export const presentationDetents = (detents) => m('presentationDetents', { detents });
66
+ /** `.presentationDragIndicator(...)`: 'automatic' | 'visible' | 'hidden'. */
67
+ export const presentationDragIndicator = (visibility) => m('presentationDragIndicator', { visibility });
68
+ /** `.presentationBackgroundInteraction(...)`: 'automatic' | 'enabled' | 'disabled' | { upThrough: detent }. */
69
+ export const presentationBackgroundInteraction = (value) => m('presentationBackgroundInteraction', { value });
70
+ /** `.interactiveDismissDisabled(b)`. */
71
+ export const interactiveDismissDisabled = (value = true) => m('interactiveDismissDisabled', { value });
72
+ /** `.navigationTitle(title)` inside a NavigationStack. */
73
+ export const navigationTitle = (title) => m('navigationTitle', { title });
74
+ /** `.navigationBarTitleDisplayMode(...)` (iOS): 'automatic' | 'inline' | 'large'. */
75
+ export const navigationBarTitleDisplayMode = (mode) => m('navigationBarTitleDisplayMode', { mode });
76
+ /**
77
+ * `.toolbarBackground(...)` of a bar ('navigationBar' (default) | 'tabBar' | 'bottomBar' | 'automatic'):
78
+ * 'hidden' (a transparent header), 'visible', 'automatic', or a color.
79
+ */
80
+ export const toolbarBackground = (value, bar = 'navigationBar') => m('toolbarBackground', { value, bar });
81
+ /** `.toolbarColorScheme(...)` of a bar: 'light' | 'dark' (the bar's title and items). */
82
+ export const toolbarColorScheme = (scheme, bar = 'navigationBar') => m('toolbarColorScheme', { scheme, bar });
83
+ /** `.toolbar(.hidden, for:)`: 'hidden' | 'visible' | 'automatic' for a bar (hide the header entirely). */
84
+ export const toolbarVisibility = (visibility, bar = 'navigationBar') => m('toolbarVisibility', { visibility, bar });
85
+ /**
86
+ * `.environment(key, value)`: 'colorScheme' ('light' | 'dark') for the view and everything in it,
87
+ * e.g. a NavigationStack whose transparent header sits on a dark background.
88
+ */
89
+ export const environment = (key, value) => m('environment', { key, value });
90
+ /** `.ignoresSafeArea()`: content runs under the bars (e.g. a hero image under a transparent header). */
91
+ export const ignoresSafeArea = (edges = 'all') => m('ignoresSafeArea', { edges });
92
+ /** `.listStyle(...)`: 'automatic' | 'plain' | 'insetGrouped' | 'grouped' | 'inset' | 'sidebar'. */
93
+ export const listStyle = (style) => m('listStyle', { style });
94
+ /** `.scrollContentBackground(...)`: 'automatic' | 'visible' | 'hidden'. */
95
+ export const scrollContentBackground = (visibility) => m('scrollContentBackground', { visibility });
96
+
97
+ // ---------------------------------------------------------------- web
98
+
99
+ const px = (v) => (typeof v === 'number' ? v + 'px' : v);
100
+ const shapeRadius = (s) => (s === 'capsule' || s === 'circle' ? '9999px' : s?.roundedRectangle != null ? px(s.roundedRectangle) : undefined);
101
+
102
+ /** Inline style for the modifiers that have a CSS meaning (the web fallback). */
103
+ export function webStyle(mods) {
104
+ const s = {};
105
+ for (const x of mods ?? []) {
106
+ switch (x.$type) {
107
+ case 'padding':
108
+ if (x.all != null) s.padding = px(x.all);
109
+ else if (x.horizontal != null || x.vertical != null) s.padding = `${px(x.vertical ?? 0)} ${px(x.horizontal ?? 0)}`;
110
+ else if (x.top != null || x.bottom != null || x.leading != null || x.trailing != null)
111
+ Object.assign(s, { paddingTop: px(x.top ?? 0), paddingBottom: px(x.bottom ?? 0), paddingLeft: px(x.leading ?? 0), paddingRight: px(x.trailing ?? 0) });
112
+ else s.padding = '16px';
113
+ break;
114
+ case 'frame':
115
+ if (x.width != null) s.width = px(x.width);
116
+ if (x.height != null) s.height = px(x.height);
117
+ if (x.minWidth != null) s.minWidth = px(x.minWidth);
118
+ if (x.minHeight != null) s.minHeight = px(x.minHeight);
119
+ if (x.maxWidth === 'infinity') s.alignSelf = 'stretch', s.width = s.width ?? '100%';
120
+ else if (x.maxWidth != null) s.maxWidth = px(x.maxWidth);
121
+ if (x.maxHeight === 'infinity') s.flexGrow = 1;
122
+ else if (x.maxHeight != null) s.maxHeight = px(x.maxHeight);
123
+ break;
124
+ case 'background':
125
+ s.background = x.color;
126
+ if (shapeRadius(x.shape)) s.borderRadius = shapeRadius(x.shape);
127
+ break;
128
+ case 'foregroundStyle': s.color = x.color === 'secondary' ? 'GrayText' : x.color; break;
129
+ case 'listRowBackground': s.backgroundColor = x.color; break;
130
+ case 'tint': s.accentColor = x.color; break;
131
+ case 'font':
132
+ if (x.size != null) s.fontSize = px(x.size);
133
+ if (x.weight) s.fontWeight = { ultraLight: 100, thin: 200, light: 300, regular: 400, medium: 500, semibold: 600, bold: 700, heavy: 800, black: 900 }[x.weight] ?? 400;
134
+ if (x.design === 'monospaced') s.fontFamily = 'ui-monospace, monospace';
135
+ if (x.design === 'rounded') s.fontFamily = 'ui-rounded, system-ui';
136
+ if (x.design === 'serif') s.fontFamily = 'ui-serif, serif';
137
+ if (x.textStyle) Object.assign(s, TEXT_STYLES[x.textStyle] ?? {});
138
+ break;
139
+ case 'bold': s.fontWeight = 700; break;
140
+ case 'italic': s.fontStyle = 'italic'; break;
141
+ case 'monospacedDigit': s.fontVariantNumeric = 'tabular-nums'; break;
142
+ case 'cornerRadius': s.borderRadius = px(x.radius); s.overflow = 'hidden'; break;
143
+ case 'clipShape': s.borderRadius = shapeRadius(x.shape) ?? '0px'; s.overflow = 'hidden'; break;
144
+ case 'opacity': s.opacity = x.value; break;
145
+ case 'shadow': s.boxShadow = `${px(x.x ?? 0)} ${px(x.y ?? 0)} ${px(x.radius ?? 0)} ${x.color ?? 'rgba(0,0,0,0.33)'}`; break;
146
+ case 'multilineTextAlignment': s.textAlign = { leading: 'left', center: 'center', trailing: 'right' }[x.alignment]; break;
147
+ case 'glassEffect':
148
+ s.background = 'rgba(255,255,255,0.22)';
149
+ s.backdropFilter = 'blur(18px) saturate(1.6)';
150
+ s.border = '1px solid rgba(255,255,255,0.35)';
151
+ s.borderRadius = shapeRadius(x.shape) ?? '9999px';
152
+ break;
153
+ default: break;
154
+ }
155
+ }
156
+ return s;
157
+ }
158
+
159
+ const TEXT_STYLES = {
160
+ largeTitle: { fontSize: '34px', fontWeight: 700 },
161
+ title: { fontSize: '28px', fontWeight: 700 },
162
+ title2: { fontSize: '22px', fontWeight: 700 },
163
+ title3: { fontSize: '20px', fontWeight: 600 },
164
+ headline: { fontSize: '17px', fontWeight: 600 },
165
+ body: { fontSize: '17px' },
166
+ callout: { fontSize: '16px' },
167
+ subheadline: { fontSize: '15px' },
168
+ footnote: { fontSize: '13px' },
169
+ caption: { fontSize: '12px' },
170
+ caption2: { fontSize: '11px' },
171
+ };
172
+
173
+ /** The value of the first modifier of `type`, or undefined. */
174
+ export function find(mods, type) {
175
+ return (mods ?? []).find((x) => x.$type === type);
176
+ }