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

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 (143) 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/compat.json +64 -0
  7. package/controls.css +108 -0
  8. package/determinism.js +175 -0
  9. package/devtools.d.ts +13 -0
  10. package/devtools.js +73 -0
  11. package/dialogs.js +59 -0
  12. package/direct-style.js +105 -0
  13. package/direct-table.js +261 -0
  14. package/dist/bake.mjs +2211 -0
  15. package/dist/build-CMsvCcZ0.mjs +1 -0
  16. package/dist/build-CkLSZw06.mjs +5514 -0
  17. package/dist/build-tools-Dxyl6XAf.mjs +80 -0
  18. package/dist/client-Cm7o6dQd.mjs +17544 -0
  19. package/dist/compiler.mjs +4 -0
  20. package/dist/config-B1W8gfZY.mjs +12 -0
  21. package/dist/dev-Cskd8Hl4.mjs +986 -0
  22. package/dist/direct-report-Bdda-k_Y.mjs +153 -0
  23. package/dist/direct-report-Du44nNWl.mjs +1 -0
  24. package/dist/index.d.mts +176 -0
  25. package/dist/index.mjs +1 -0
  26. package/dist/intl-ROnAp2qO.mjs +75 -0
  27. package/dist/jiti-stub-CKcaShwE.mjs +5 -0
  28. package/dist/native-views-BuzB9x5H.mjs +7849 -0
  29. package/dist/octane/package.json +5 -0
  30. package/dist/package-KkUSMoji.mjs +2784 -0
  31. package/dist/react/package.json +13 -0
  32. package/dist/rolldown-runtime-D3KUYPsf.mjs +12 -0
  33. package/dist/run-D2aPm54a.mjs +6632 -0
  34. package/dist/scope-8W2aIuQ9.mjs +262 -0
  35. package/dist/screens/BakeNativeScreen.native.ts +9 -0
  36. package/dist/screens/package.json +5 -0
  37. package/dom-exception.js +31 -0
  38. package/element-api.js +158 -0
  39. package/first-screen.js +30 -0
  40. package/fonts/Geist-Italic-Variable.ttf +0 -0
  41. package/fonts/Geist-Variable.ttf +0 -0
  42. package/fonts/GeistMono-Italic-Variable.ttf +0 -0
  43. package/fonts/GeistMono-Variable.ttf +0 -0
  44. package/fonts/OFL.txt +93 -0
  45. package/fonts/README.md +27 -0
  46. package/fonts/geist-italic.css +8 -0
  47. package/fonts/geist-mono-italic.css +8 -0
  48. package/fonts/geist-mono.css +8 -0
  49. package/fonts/geist.css +8 -0
  50. package/header-icons.json +53 -0
  51. package/host-runtime.js +508 -0
  52. package/image-props.js +17 -0
  53. package/index.d.ts +8 -0
  54. package/index.js +7 -0
  55. package/licenses/Apache-2.0.txt +73 -0
  56. package/locale-entry.d.ts +1 -0
  57. package/locale-entry.js +1 -0
  58. package/locale.d.ts +28 -0
  59. package/locale.js +124 -0
  60. package/markup-support.js +87 -0
  61. package/media-element.js +115 -0
  62. package/native-args-entry.js +2 -0
  63. package/native-args.d.ts +7 -0
  64. package/native-args.js +155 -0
  65. package/native-entry.js +1 -0
  66. package/native-globals.d.ts +156 -0
  67. package/native-scenarios.d.ts +17 -0
  68. package/native-scenarios.js +46 -0
  69. package/native-support.json +349 -0
  70. package/native.d.ts +52 -0
  71. package/native.js +237 -0
  72. package/package.json +142 -4
  73. package/page-elements.js +123 -0
  74. package/runtime-provides.json +412 -0
  75. package/safe-area.d.ts +1 -0
  76. package/safe-area.js +44 -0
  77. package/swift-ui/modifiers.js +164 -0
  78. package/tab-icons.js +62 -0
  79. package/templates/create/tabs/AGENTS.md +22 -0
  80. package/templates/create/tabs/README.md +43 -0
  81. package/templates/create/tabs/_gitignore +13 -0
  82. package/templates/create/tabs/android/app/build.gradle.kts +79 -0
  83. package/templates/create/tabs/android/app/src/main/AndroidManifest.xml +39 -0
  84. package/templates/create/tabs/android/app/src/main/kotlin/MainActivity.kt +35 -0
  85. package/templates/create/tabs/android/app/src/main/res/values/themes.xml +8 -0
  86. package/templates/create/tabs/android/build.gradle.kts +5 -0
  87. package/templates/create/tabs/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  88. package/templates/create/tabs/android/gradle/wrapper/gradle-wrapper.properties +9 -0
  89. package/templates/create/tabs/android/gradle.properties +3 -0
  90. package/templates/create/tabs/android/gradlew +248 -0
  91. package/templates/create/tabs/android/settings.gradle.kts +47 -0
  92. package/templates/create/tabs/bake.config.ts +10 -0
  93. package/templates/create/tabs/ios/App/App.swift +30 -0
  94. package/templates/create/tabs/ios/build.sh +23 -0
  95. package/templates/create/tabs/ios/project.yml +57 -0
  96. package/templates/create/tabs/macos/Package.swift +24 -0
  97. package/templates/create/tabs/macos/Sources/__SWIFT_NAME__/App.swift +146 -0
  98. package/templates/create/tabs/macos/build.sh +4 -0
  99. package/templates/create/tabs/package.json +23 -0
  100. package/templates/create/tabs/pnpm-workspace.yaml +6 -0
  101. package/templates/create/tabs/src/App.tsrx +92 -0
  102. package/templates/create/tabs/src/App.tsx +67 -0
  103. package/templates/create/tabs/src/styles.css +32 -0
  104. package/templates/create/tabs/tsconfig.json +5 -0
  105. package/templates/create/tabs/windows/Cargo.toml +29 -0
  106. package/templates/create/tabs/windows/build.rs +9 -0
  107. package/templates/create/tabs/windows/src/main.rs +52 -0
  108. package/templates/create/tabs/windows/src/shell.rs +316 -0
  109. package/templates/module/__NAME__.kt +20 -0
  110. package/templates/module/__NAME__.native.ts +24 -0
  111. package/templates/module/__NAME__.swift +25 -0
  112. package/templates/module/__NAME__.web.ts +13 -0
  113. package/templates/module/__NAME__Test.kt +26 -0
  114. package/templates/module/__NAME__Tests.swift +25 -0
  115. package/templates/module/__SNAKE__.rs +43 -0
  116. package/text.d.ts +20 -0
  117. package/text.js +100 -0
  118. package/transform-entry.js +1 -0
  119. package/transform.d.ts +15 -0
  120. package/transform.js +98 -0
  121. package/tsconfig.native.json +16 -0
  122. package/ui/scope.js +103 -0
  123. package/ui/swift.js +106 -0
  124. package/ui/ui.css +272 -0
  125. package/view-ref-writer.js +268 -0
  126. package/view-ref.d.ts +26 -0
  127. package/view-ref.js +85 -0
  128. package/views/Video.native.ts +68 -0
  129. package/views/generated/VideoViewAndroid.h +68 -0
  130. package/views/generated/VideoViewJSI.h +94 -0
  131. package/views/generated/VideoViewSpec.kt +113 -0
  132. package/views/generated/apple/VideoViewJSI/VideoViewJSIApple.cpp +40 -0
  133. package/views/generated/apple/VideoViewJSI/include/VideoViewJSIApple.h +28 -0
  134. package/views/generated/apple/VideoViewSpec/VideoViewInterop.swift +39 -0
  135. package/views/generated/apple/VideoViewSpec/VideoViewSpec.swift +186 -0
  136. package/views/generated/video_view_spec.rs +189 -0
  137. package/views.d.ts +24 -0
  138. package/views.js +45 -0
  139. package/virtual-window.js +35 -0
  140. package/visibility.js +75 -0
  141. package/web-crypto.js +84 -0
  142. package/web-fetch.js +1071 -0
  143. package/README.md +0 -3
@@ -0,0 +1,412 @@
1
+ {
2
+ "format": 1,
3
+ "runtime": "0.1.0-rc.0",
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,164 @@
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(color)`. */
15
+ export const foregroundStyle = (color) => m('foregroundStyle', { color });
16
+ /** `.font(.system(size:weight:design:))` or a text style: `font({ textStyle: 'headline' })`. */
17
+ export const font = (args) => m('font', args);
18
+ /** `.bold()`. */
19
+ export const bold = () => m('bold');
20
+ /** `.italic()`. */
21
+ export const italic = () => m('italic');
22
+ /** `.tint(color)`. */
23
+ export const tint = (color) => m('tint', { color });
24
+ /** `.buttonStyle(...)`: 'automatic' | 'bordered' | 'borderedProminent' | 'borderless' | 'plain' | 'glass' | 'glassProminent'. */
25
+ export const buttonStyle = (style) => m('buttonStyle', { style });
26
+ /** `.controlSize(...)`: 'mini' | 'small' | 'regular' | 'large' | 'extraLarge'. */
27
+ export const controlSize = (size) => m('controlSize', { size });
28
+ /** `.glassEffect(_:in:)` (iOS 26 / macOS 26 Liquid Glass): `{ glass: { variant: 'regular' | 'clear', interactive, tint }, shape }`. */
29
+ export const glassEffect = (args) => m('glassEffect', args);
30
+ /** `.cornerRadius(r)`. */
31
+ export const cornerRadius = (radius) => m('cornerRadius', { radius });
32
+ /** `.clipShape(...)`: 'capsule' | 'circle' | 'rectangle' | { roundedRectangle: r }. */
33
+ export const clipShape = (shape) => m('clipShape', { shape });
34
+ /** `.opacity(v)`. */
35
+ export const opacity = (value) => m('opacity', { value });
36
+ /** `.shadow(color:radius:x:y:)`. */
37
+ export const shadow = (args) => m('shadow', args);
38
+ /** `.disabled(b)`. */
39
+ export const disabled = (value = true) => m('disabled', { value });
40
+ /** `.pickerStyle(...)`: 'automatic' | 'menu' | 'segmented' | 'wheel' | 'inline' | 'palette'. */
41
+ export const pickerStyle = (style) => m('pickerStyle', { style });
42
+ /** `.toggleStyle(...)`: 'automatic' | 'switch' | 'button' | 'checkbox' (macOS). */
43
+ export const toggleStyle = (style) => m('toggleStyle', { style });
44
+ /** `.labelsHidden()`. */
45
+ export const labelsHidden = () => m('labelsHidden');
46
+ /** `.accessibilityLabel(value)`: the accessible name of an unlabeled view. */
47
+ export const accessibilityLabel = (value) => m('accessibilityLabel', { value });
48
+ /** `.multilineTextAlignment(...)`: 'leading' | 'center' | 'trailing'. */
49
+ export const multilineTextAlignment = (alignment) => m('multilineTextAlignment', { alignment });
50
+ /** `.lineLimit(n)`. */
51
+ export const lineLimit = (value) => m('lineLimit', { value });
52
+ /** `.tag(value)`: identifies a Picker option or a TabView tab. */
53
+ export const tag = (value) => m('tag', { value });
54
+ /** `.presentationDetents([...])` inside a BottomSheet: 'medium' | 'large' | { fraction } | { height }. */
55
+ export const presentationDetents = (detents) => m('presentationDetents', { detents });
56
+ /** `.presentationDragIndicator(...)`: 'automatic' | 'visible' | 'hidden'. */
57
+ export const presentationDragIndicator = (visibility) => m('presentationDragIndicator', { visibility });
58
+ /** `.presentationBackgroundInteraction(...)`: 'automatic' | 'enabled' | 'disabled' | { upThrough: detent }. */
59
+ export const presentationBackgroundInteraction = (value) => m('presentationBackgroundInteraction', { value });
60
+ /** `.interactiveDismissDisabled(b)`. */
61
+ export const interactiveDismissDisabled = (value = true) => m('interactiveDismissDisabled', { value });
62
+ /** `.navigationTitle(title)` inside a NavigationStack. */
63
+ export const navigationTitle = (title) => m('navigationTitle', { title });
64
+ /** `.navigationBarTitleDisplayMode(...)` (iOS): 'automatic' | 'inline' | 'large'. */
65
+ export const navigationBarTitleDisplayMode = (mode) => m('navigationBarTitleDisplayMode', { mode });
66
+ /**
67
+ * `.toolbarBackground(...)` of a bar ('navigationBar' (default) | 'tabBar' | 'bottomBar' | 'automatic'):
68
+ * 'hidden' (a transparent header), 'visible', 'automatic', or a color.
69
+ */
70
+ export const toolbarBackground = (value, bar = 'navigationBar') => m('toolbarBackground', { value, bar });
71
+ /** `.toolbarColorScheme(...)` of a bar: 'light' | 'dark' (the bar's title and items). */
72
+ export const toolbarColorScheme = (scheme, bar = 'navigationBar') => m('toolbarColorScheme', { scheme, bar });
73
+ /** `.toolbar(.hidden, for:)`: 'hidden' | 'visible' | 'automatic' for a bar (hide the header entirely). */
74
+ export const toolbarVisibility = (visibility, bar = 'navigationBar') => m('toolbarVisibility', { visibility, bar });
75
+ /**
76
+ * `.environment(key, value)`: 'colorScheme' ('light' | 'dark') for the view and everything in it,
77
+ * e.g. a NavigationStack whose transparent header sits on a dark background.
78
+ */
79
+ export const environment = (key, value) => m('environment', { key, value });
80
+ /** `.ignoresSafeArea()`: content runs under the bars (e.g. a hero image under a transparent header). */
81
+ export const ignoresSafeArea = (edges = 'all') => m('ignoresSafeArea', { edges });
82
+ /** `.listStyle(...)`: 'automatic' | 'plain' | 'insetGrouped' | 'grouped' | 'inset' | 'sidebar'. */
83
+ export const listStyle = (style) => m('listStyle', { style });
84
+ /** `.scrollContentBackground(...)`: 'automatic' | 'visible' | 'hidden'. */
85
+ export const scrollContentBackground = (visibility) => m('scrollContentBackground', { visibility });
86
+
87
+ // ---------------------------------------------------------------- web
88
+
89
+ const px = (v) => (typeof v === 'number' ? v + 'px' : v);
90
+ const shapeRadius = (s) => (s === 'capsule' || s === 'circle' ? '9999px' : s?.roundedRectangle != null ? px(s.roundedRectangle) : undefined);
91
+
92
+ /** Inline style for the modifiers that have a CSS meaning (the web fallback). */
93
+ export function webStyle(mods) {
94
+ const s = {};
95
+ for (const x of mods ?? []) {
96
+ switch (x.$type) {
97
+ case 'padding':
98
+ if (x.all != null) s.padding = px(x.all);
99
+ else if (x.horizontal != null || x.vertical != null) s.padding = `${px(x.vertical ?? 0)} ${px(x.horizontal ?? 0)}`;
100
+ else if (x.top != null || x.bottom != null || x.leading != null || x.trailing != null)
101
+ Object.assign(s, { paddingTop: px(x.top ?? 0), paddingBottom: px(x.bottom ?? 0), paddingLeft: px(x.leading ?? 0), paddingRight: px(x.trailing ?? 0) });
102
+ else s.padding = '16px';
103
+ break;
104
+ case 'frame':
105
+ if (x.width != null) s.width = px(x.width);
106
+ if (x.height != null) s.height = px(x.height);
107
+ if (x.minWidth != null) s.minWidth = px(x.minWidth);
108
+ if (x.minHeight != null) s.minHeight = px(x.minHeight);
109
+ if (x.maxWidth === 'infinity') s.alignSelf = 'stretch', s.width = s.width ?? '100%';
110
+ else if (x.maxWidth != null) s.maxWidth = px(x.maxWidth);
111
+ if (x.maxHeight === 'infinity') s.flexGrow = 1;
112
+ else if (x.maxHeight != null) s.maxHeight = px(x.maxHeight);
113
+ break;
114
+ case 'background':
115
+ s.background = x.color;
116
+ if (shapeRadius(x.shape)) s.borderRadius = shapeRadius(x.shape);
117
+ break;
118
+ case 'foregroundStyle': s.color = x.color; break;
119
+ case 'tint': s.accentColor = x.color; break;
120
+ case 'font':
121
+ if (x.size != null) s.fontSize = px(x.size);
122
+ 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;
123
+ if (x.design === 'monospaced') s.fontFamily = 'ui-monospace, monospace';
124
+ if (x.design === 'rounded') s.fontFamily = 'ui-rounded, system-ui';
125
+ if (x.design === 'serif') s.fontFamily = 'ui-serif, serif';
126
+ if (x.textStyle) Object.assign(s, TEXT_STYLES[x.textStyle] ?? {});
127
+ break;
128
+ case 'bold': s.fontWeight = 700; break;
129
+ case 'italic': s.fontStyle = 'italic'; break;
130
+ case 'cornerRadius': s.borderRadius = px(x.radius); s.overflow = 'hidden'; break;
131
+ case 'clipShape': s.borderRadius = shapeRadius(x.shape) ?? '0px'; s.overflow = 'hidden'; break;
132
+ case 'opacity': s.opacity = x.value; break;
133
+ 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;
134
+ case 'multilineTextAlignment': s.textAlign = { leading: 'left', center: 'center', trailing: 'right' }[x.alignment]; break;
135
+ case 'glassEffect':
136
+ s.background = 'rgba(255,255,255,0.22)';
137
+ s.backdropFilter = 'blur(18px) saturate(1.6)';
138
+ s.border = '1px solid rgba(255,255,255,0.35)';
139
+ s.borderRadius = shapeRadius(x.shape) ?? '9999px';
140
+ break;
141
+ default: break;
142
+ }
143
+ }
144
+ return s;
145
+ }
146
+
147
+ const TEXT_STYLES = {
148
+ largeTitle: { fontSize: '34px', fontWeight: 700 },
149
+ title: { fontSize: '28px', fontWeight: 700 },
150
+ title2: { fontSize: '22px', fontWeight: 700 },
151
+ title3: { fontSize: '20px', fontWeight: 600 },
152
+ headline: { fontSize: '17px', fontWeight: 600 },
153
+ body: { fontSize: '17px' },
154
+ callout: { fontSize: '16px' },
155
+ subheadline: { fontSize: '15px' },
156
+ footnote: { fontSize: '13px' },
157
+ caption: { fontSize: '12px' },
158
+ caption2: { fontSize: '11px' },
159
+ };
160
+
161
+ /** The value of the first modifier of `type`, or undefined. */
162
+ export function find(mods, type) {
163
+ return (mods ?? []).find((x) => x.$type === type);
164
+ }