bleam 0.0.6 → 0.0.7

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 (91) hide show
  1. package/dist/ai.cjs +3984 -25
  2. package/dist/ai.d.cts +503 -20
  3. package/dist/ai.d.ts +503 -20
  4. package/dist/ai.js +3946 -26
  5. package/dist/animated.cjs +1 -1
  6. package/dist/animated.js +1 -1
  7. package/dist/app.cjs +92 -0
  8. package/dist/app.js +92 -0
  9. package/dist/cli.cjs +653 -86
  10. package/dist/cli.d.cts +89 -1
  11. package/dist/cli.d.ts +89 -1
  12. package/dist/cli.js +654 -88
  13. package/dist/{config-ClDGHNb3.d.ts → config-Cms0rvqg.d.ts} +1 -0
  14. package/dist/{config-D3gPaVMb.d.cts → config-CufOVJV3.d.cts} +1 -0
  15. package/dist/config.d.cts +1 -1
  16. package/dist/config.d.ts +1 -1
  17. package/dist/crypto.d.cts +0 -2
  18. package/dist/crypto.d.ts +1 -1
  19. package/dist/dev-protocol.d.cts +14 -1
  20. package/dist/dev-protocol.d.ts +14 -1
  21. package/dist/files-Bo7h9fik.cjs +468 -0
  22. package/dist/files-Ds1wT8C2.js +445 -0
  23. package/dist/files-DwA7pzr3.d.cts +99 -0
  24. package/dist/files-VrkQlKIT.d.ts +99 -0
  25. package/dist/files.cjs +7 -0
  26. package/dist/files.d.cts +2 -0
  27. package/dist/files.d.ts +2 -0
  28. package/dist/files.js +4 -0
  29. package/dist/index.d.cts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/native-sqlite-xcGdamRD.js +64 -0
  32. package/dist/native-sqlite-yQLD5s9i.cjs +66 -0
  33. package/dist/platform.cjs +27 -0
  34. package/dist/platform.d.cts +39 -0
  35. package/dist/platform.d.ts +39 -0
  36. package/dist/platform.js +21 -0
  37. package/dist/runtime.d.cts +1 -6
  38. package/dist/runtime.d.ts +1 -6
  39. package/dist/{schema-ipsECAso.d.ts → schema-DOOjfXvs.d.ts} +1 -1
  40. package/dist/{schema-BOuUHcqo.d.cts → schema-ENSMX_1t.d.cts} +1 -1
  41. package/dist/schema.cjs +1 -1
  42. package/dist/schema.d.cts +1 -1
  43. package/dist/schema.d.ts +1 -1
  44. package/dist/schema.js +1 -1
  45. package/dist/state-Bx0VlTlO.cjs +852 -0
  46. package/dist/state-CAwe-Vw1.js +767 -0
  47. package/dist/state.cjs +17 -763
  48. package/dist/state.d.cts +107 -77
  49. package/dist/state.d.ts +107 -77
  50. package/dist/state.js +4 -745
  51. package/dist/ui-1WepaMS4.d.cts +92 -0
  52. package/dist/ui-234Plg7Z.d.cts +92 -0
  53. package/dist/ui-BJmXhz9Q.d.ts +92 -0
  54. package/dist/ui-Dd7SXdbg.d.cts +92 -0
  55. package/dist/ui-Ds88eETu.d.ts +92 -0
  56. package/dist/ui-TaqnB5SP.d.ts +92 -0
  57. package/dist/ui-WQvnXL0W.d.ts +92 -0
  58. package/dist/ui.cjs +286 -35
  59. package/dist/ui.d.cts +2 -30
  60. package/dist/ui.d.ts +2 -30
  61. package/dist/ui.js +283 -36
  62. package/dist/window.cjs +596 -0
  63. package/dist/window.d.cts +63 -0
  64. package/dist/window.d.ts +63 -0
  65. package/dist/window.js +589 -0
  66. package/package.json +16 -14
  67. package/templates/basic/app/index.tsx +8 -5
  68. package/templates/foundation-models/app/index.tsx +32 -0
  69. package/templates/foundation-models/app.config.ts +5 -0
  70. package/templates/image-generation/app/index.tsx +39 -0
  71. package/templates/image-generation/app.config.ts +5 -0
  72. package/templates/state/app/index.tsx +30 -0
  73. package/templates/state/app.config.ts +5 -0
  74. package/dist/chrome.cjs +0 -265
  75. package/dist/chrome.d.cts +0 -19
  76. package/dist/chrome.d.ts +0 -19
  77. package/dist/chrome.js +0 -262
  78. package/dist/fs.cjs +0 -13
  79. package/dist/fs.d.cts +0 -8
  80. package/dist/fs.d.ts +0 -8
  81. package/dist/fs.js +0 -12
  82. package/dist/native-macos-D6p2SmUj.js +0 -20
  83. package/dist/native-macos-DLwo_ii9.cjs +0 -31
  84. package/dist/native-runtime-CbPzrs8j.d.cts +0 -33
  85. package/dist/native-runtime-DxHSrsTX.d.ts +0 -33
  86. package/dist/native.cjs +0 -135
  87. package/dist/native.d.cts +0 -34
  88. package/dist/native.d.ts +0 -34
  89. package/dist/native.js +0 -135
  90. /package/dist/{schema-DVmoD9JL.js → schema-Bo5Jvqus.js} +0 -0
  91. /package/dist/{schema-bxeeCyLn.cjs → schema-rQ13mrpD.cjs} +0 -0
package/dist/ui.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as ensureNativeScript } from "./native-runtime-C85Nuc4F.js";
2
- import { StyleSheet } from "react-native";
2
+ import { StyleSheet, processColor } from "react-native";
3
3
 
4
- //#region src/ui.tsx
4
+ //#region src/ui/shared.ts
5
5
  function textFromChildren(children) {
6
6
  if (typeof children === "string" || typeof children === "number") return String(children);
7
7
  if (Array.isArray(children)) return children.filter((child) => typeof child === "string" || typeof child === "number").join("");
@@ -20,19 +20,30 @@ function colorFromHex(hex) {
20
20
  return UIColor.colorWithRedGreenBlueAlpha(red, green, blue, 1);
21
21
  }
22
22
  function colorFromStyle(value) {
23
- return typeof value === "string" ? colorFromHex(value) : void 0;
23
+ if (value == null) return;
24
+ if (typeof value === "string") {
25
+ const hexColor = colorFromHex(value);
26
+ if (hexColor) return hexColor;
27
+ }
28
+ const color = processColor(value);
29
+ if (typeof color !== "number") return;
30
+ const alpha = (color >>> 24 & 255) / 255;
31
+ const red = (color >>> 16 & 255) / 255;
32
+ const green = (color >>> 8 & 255) / 255;
33
+ const blue = (color & 255) / 255;
34
+ return UIColor.colorWithRedGreenBlueAlpha(red, green, blue, alpha);
24
35
  }
25
- function labelText(props) {
26
- return props.text ?? textFromChildren(props.children) ?? "";
36
+ function fontFromStyle(style) {
37
+ if (typeof style?.fontSize !== "number") return;
38
+ if (style.fontWeight === "700" || style.fontWeight === "bold") return UIFont.boldSystemFontOfSize(style.fontSize);
39
+ return UIFont.systemFontOfSize(style.fontSize);
27
40
  }
41
+
42
+ //#endregion
43
+ //#region src/ui/button.tsx
28
44
  function buttonTitle(props) {
29
45
  return props.title ?? textFromChildren(props.children) ?? "";
30
46
  }
31
- function defaultLabelColor(tone) {
32
- if (tone === "secondary") return UIColor.secondaryLabelColor;
33
- if (tone === "tertiary") return UIColor.tertiaryLabelColor;
34
- return UIColor.labelColor;
35
- }
36
47
  function buttonConfiguration(variant) {
37
48
  if (variant === "secondary") return UIButtonConfiguration.borderedButtonConfiguration();
38
49
  if (variant === "plain") return UIButtonConfiguration.plainButtonConfiguration();
@@ -43,10 +54,47 @@ function buttonSize(size) {
43
54
  if (size === "large") return UIButtonConfigurationSize.Large;
44
55
  return UIButtonConfigurationSize.Medium;
45
56
  }
46
- function fontFromStyle(style) {
47
- if (typeof style?.fontSize !== "number") return;
48
- if (style.fontWeight === "700" || style.fontWeight === "bold") return UIFont.boldSystemFontOfSize(style.fontSize);
49
- return UIFont.systemFontOfSize(style.fontSize);
57
+ const Button = ensureNativeScript().defineUIKitView({
58
+ name: "Button",
59
+ layout: {
60
+ sizing: "intrinsic",
61
+ defaultSize: {
62
+ width: 1,
63
+ height: 34
64
+ }
65
+ },
66
+ create(ctx) {
67
+ const button = UIButton.buttonWithType(UIButtonType.System);
68
+ ctx.targetAction(button, UIControlEvents.TouchUpInside, () => {
69
+ ctx.emit("onPress");
70
+ });
71
+ return button;
72
+ },
73
+ update(button, props, _previousProps, ctx) {
74
+ const style = styleFromProps(props.style);
75
+ const configuration = buttonConfiguration(props.variant);
76
+ configuration.title = buttonTitle(props);
77
+ configuration.buttonSize = buttonSize(props.size);
78
+ configuration.showsActivityIndicator = props.loading ?? false;
79
+ const foregroundColor = colorFromStyle(style?.color);
80
+ if (foregroundColor) configuration.baseForegroundColor = foregroundColor;
81
+ const backgroundColor = colorFromStyle(style?.backgroundColor);
82
+ if (backgroundColor) configuration.baseBackgroundColor = backgroundColor;
83
+ button.configuration = configuration;
84
+ button.enabled = !(props.disabled || props.loading);
85
+ ctx?.invalidateLayout();
86
+ }
87
+ });
88
+
89
+ //#endregion
90
+ //#region src/ui/label.tsx
91
+ function labelText(props) {
92
+ return props.text ?? textFromChildren(props.children) ?? "";
93
+ }
94
+ function defaultLabelColor(tone) {
95
+ if (tone === "secondary") return UIColor.secondaryLabelColor;
96
+ if (tone === "tertiary") return UIColor.tertiaryLabelColor;
97
+ return UIColor.labelColor;
50
98
  }
51
99
  const Label = ensureNativeScript().defineUIKitView({
52
100
  name: "Label",
@@ -74,37 +122,236 @@ const Label = ensureNativeScript().defineUIKitView({
74
122
  ctx?.invalidateLayout();
75
123
  }
76
124
  });
77
- const Button = ensureNativeScript().defineUIKitView({
78
- name: "Button",
125
+
126
+ //#endregion
127
+ //#region src/ui/symbol.tsx
128
+ function symbolWeight(weight) {
129
+ switch (weight) {
130
+ case "ultraLight": return UIImageSymbolWeight.UltraLight;
131
+ case "thin": return UIImageSymbolWeight.Thin;
132
+ case "light": return UIImageSymbolWeight.Light;
133
+ case "medium": return UIImageSymbolWeight.Medium;
134
+ case "semibold": return UIImageSymbolWeight.Semibold;
135
+ case "bold": return UIImageSymbolWeight.Bold;
136
+ case "heavy": return UIImageSymbolWeight.Heavy;
137
+ case "black": return UIImageSymbolWeight.Black;
138
+ default: return UIImageSymbolWeight.Regular;
139
+ }
140
+ }
141
+ function symbolScale(scale) {
142
+ if (scale === "small") return UIImageSymbolScale.Small;
143
+ if (scale === "large") return UIImageSymbolScale.Large;
144
+ return UIImageSymbolScale.Medium;
145
+ }
146
+ function symbolConfiguration(props, style) {
147
+ const size = props.size ?? style?.fontSize ?? 17;
148
+ return UIImageSymbolConfiguration.configurationWithPointSizeWeightScale(size, symbolWeight(props.weight), symbolScale(props.scale));
149
+ }
150
+ function symbolImage(name, configuration) {
151
+ if (configuration) return UIImage.systemImageNamedWithConfiguration(name, configuration);
152
+ return UIImage.systemImageNamed(name);
153
+ }
154
+ const Symbol = ensureNativeScript().defineUIKitView({
155
+ name: "Symbol",
79
156
  layout: {
80
157
  sizing: "intrinsic",
81
158
  defaultSize: {
82
- width: 1,
83
- height: 34
159
+ width: 17,
160
+ height: 17
84
161
  }
85
162
  },
86
- create(ctx) {
87
- const button = UIButton.buttonWithType(UIButtonType.System);
88
- ctx.targetAction(button, UIControlEvents.TouchUpInside, () => {
89
- ctx.emit("onPress");
90
- });
91
- return button;
163
+ create() {
164
+ const imageView = UIImageView.new();
165
+ imageView.contentMode = UIViewContentMode.ScaleAspectFit;
166
+ return imageView;
92
167
  },
93
- update(button, props, _previousProps, ctx) {
168
+ update(imageView, props, _previousProps, ctx) {
94
169
  const style = styleFromProps(props.style);
95
- const configuration = buttonConfiguration(props.variant);
96
- configuration.title = buttonTitle(props);
97
- configuration.buttonSize = buttonSize(props.size);
98
- configuration.showsActivityIndicator = props.loading ?? false;
99
- const foregroundColor = colorFromStyle(style?.color);
100
- if (foregroundColor) configuration.baseForegroundColor = foregroundColor;
101
- const backgroundColor = colorFromStyle(style?.backgroundColor);
102
- if (backgroundColor) configuration.baseBackgroundColor = backgroundColor;
103
- button.configuration = configuration;
104
- button.enabled = !(props.disabled || props.loading);
170
+ const configuration = symbolConfiguration(props, style);
171
+ imageView.image = symbolImage(props.symbol, configuration);
172
+ imageView.tintColor = colorFromStyle(props.color) ?? colorFromStyle(style?.tintColor) ?? colorFromStyle(style?.color) ?? UIColor.labelColor;
173
+ ctx?.invalidateLayout();
174
+ }
175
+ });
176
+
177
+ //#endregion
178
+ //#region src/ui/glass-shared.ts
179
+ function glassStyleValue(style) {
180
+ return typeof style === "object" ? style.style : style ?? "regular";
181
+ }
182
+ function glassEffect(style) {
183
+ if (style === "none") return null;
184
+ return UIGlassEffect.effectWithStyle(style === "clear" ? UIGlassEffectStyle.Clear : UIGlassEffectStyle.Regular);
185
+ }
186
+ function createGlassHost(effect) {
187
+ const rootView = UIVisualEffectView.alloc().initWithEffect(effect);
188
+ const childrenView = UIView.new();
189
+ rootView.backgroundColor = UIColor.clearColor;
190
+ rootView.contentView.backgroundColor = UIColor.clearColor;
191
+ childrenView.backgroundColor = UIColor.clearColor;
192
+ rootView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
193
+ rootView.contentView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
194
+ childrenView.translatesAutoresizingMaskIntoConstraints = false;
195
+ rootView.contentView.addSubview(childrenView);
196
+ const constraints = {
197
+ top: childrenView.topAnchor.constraintEqualToAnchorConstant(rootView.contentView.topAnchor, 0),
198
+ right: rootView.contentView.rightAnchor.constraintEqualToAnchorConstant(childrenView.rightAnchor, 0),
199
+ bottom: rootView.contentView.bottomAnchor.constraintEqualToAnchorConstant(childrenView.bottomAnchor, 0),
200
+ left: childrenView.leftAnchor.constraintEqualToAnchorConstant(rootView.contentView.leftAnchor, 0)
201
+ };
202
+ NSLayoutConstraint.activateConstraints([
203
+ constraints.top,
204
+ constraints.right,
205
+ constraints.bottom,
206
+ constraints.left
207
+ ]);
208
+ return {
209
+ rootView,
210
+ childrenView
211
+ };
212
+ }
213
+ function applyGlassShape(view, style) {
214
+ const radius = typeof style?.cornerRadius === "number" ? style.cornerRadius : 0;
215
+ view.layer.cornerRadius = radius;
216
+ view.contentView.layer.cornerRadius = radius;
217
+ view.layer.cornerCurve = kCACornerCurveContinuous;
218
+ view.contentView.layer.cornerCurve = kCACornerCurveContinuous;
219
+ view.clipsToBounds = radius > 0;
220
+ view.contentView.clipsToBounds = radius > 0;
221
+ view.layer.masksToBounds = radius > 0;
222
+ view.contentView.layer.masksToBounds = radius > 0;
223
+ view.layer.borderWidth = typeof style?.borderWidth === "number" ? style.borderWidth : 0;
224
+ const borderColor = colorFromStyle(style?.borderColor);
225
+ view.layer.borderColor = borderColor?.CGColor ?? null;
226
+ }
227
+ function updateGlassEffect(view, props) {
228
+ const style = glassStyleValue(props.glassEffectStyle);
229
+ const effect = glassEffect(style);
230
+ if (style !== "none") {
231
+ const tintColor = props.tintColor ? colorFromHex(props.tintColor) : void 0;
232
+ const glass = effect;
233
+ glass.interactive = props.isInteractive ?? false;
234
+ if (tintColor) glass.tintColor = tintColor;
235
+ }
236
+ if (typeof props.glassEffectStyle === "object" && props.glassEffectStyle.animate) UIView.animateWithDurationAnimations(props.glassEffectStyle.animationDuration ?? .35, () => {
237
+ view.effect = effect;
238
+ });
239
+ else view.effect = effect;
240
+ }
241
+ function updateGlassContainerEffect(view, spacing) {
242
+ const effect = UIGlassContainerEffect.new();
243
+ effect.spacing = spacing ?? 0;
244
+ view.effect = effect;
245
+ }
246
+
247
+ //#endregion
248
+ //#region src/ui/glass-view.tsx
249
+ const GlassView = ensureNativeScript().defineUIKitContainer({
250
+ name: "GlassView",
251
+ layout: {
252
+ sizing: "fill",
253
+ defaultSize: {
254
+ width: 0,
255
+ height: 0
256
+ }
257
+ },
258
+ create() {
259
+ return createGlassHost(glassEffect("regular"));
260
+ },
261
+ update(view, props, _previousProps, ctx) {
262
+ updateGlassEffect(view.rootView, props);
263
+ applyGlassShape(view.rootView, props.glassStyle);
264
+ ctx?.invalidateLayout();
265
+ }
266
+ });
267
+
268
+ //#endregion
269
+ //#region src/ui/glass-container.tsx
270
+ const GlassContainer = ensureNativeScript().defineUIKitContainer({
271
+ name: "GlassContainer",
272
+ layout: {
273
+ sizing: "fill",
274
+ defaultSize: {
275
+ width: 0,
276
+ height: 0
277
+ }
278
+ },
279
+ create() {
280
+ const host = createGlassHost(UIGlassContainerEffect.new());
281
+ updateGlassContainerEffect(host.rootView, void 0);
282
+ return host;
283
+ },
284
+ update(view, props, _previousProps, ctx) {
285
+ updateGlassContainerEffect(view.rootView, props.spacing);
286
+ applyGlassShape(view.rootView, props.glassStyle);
287
+ ctx?.invalidateLayout();
288
+ }
289
+ });
290
+
291
+ //#endregion
292
+ //#region src/ui/blur-view.tsx
293
+ function blurStyle(intensity, colorScheme) {
294
+ const scheme = colorScheme ?? "auto";
295
+ const level = intensity ?? "regular";
296
+ if (scheme === "light") switch (level) {
297
+ case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterialLight;
298
+ case "thin": return UIBlurEffectStyle.SystemThinMaterialLight;
299
+ case "thick": return UIBlurEffectStyle.SystemThickMaterialLight;
300
+ case "chrome": return UIBlurEffectStyle.SystemChromeMaterialLight;
301
+ default: return UIBlurEffectStyle.SystemMaterialLight;
302
+ }
303
+ if (scheme === "dark") switch (level) {
304
+ case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterialDark;
305
+ case "thin": return UIBlurEffectStyle.SystemThinMaterialDark;
306
+ case "thick": return UIBlurEffectStyle.SystemThickMaterialDark;
307
+ case "chrome": return UIBlurEffectStyle.SystemChromeMaterialDark;
308
+ default: return UIBlurEffectStyle.SystemMaterialDark;
309
+ }
310
+ switch (level) {
311
+ case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterial;
312
+ case "thin": return UIBlurEffectStyle.SystemThinMaterial;
313
+ case "thick": return UIBlurEffectStyle.SystemThickMaterial;
314
+ case "chrome": return UIBlurEffectStyle.SystemChromeMaterial;
315
+ default: return UIBlurEffectStyle.SystemMaterial;
316
+ }
317
+ }
318
+ function createEffectHost(effect) {
319
+ const rootView = UIVisualEffectView.alloc().initWithEffect(effect);
320
+ rootView.backgroundColor = UIColor.clearColor;
321
+ rootView.contentView.backgroundColor = UIColor.clearColor;
322
+ rootView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
323
+ rootView.contentView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
324
+ return {
325
+ rootView,
326
+ childrenView: rootView.contentView
327
+ };
328
+ }
329
+ function applyContainerStyle(view, style) {
330
+ const borderRadius = style?.borderRadius;
331
+ if (typeof borderRadius === "number") view.layer.cornerRadius = borderRadius;
332
+ view.clipsToBounds = style?.overflow === "hidden" || typeof borderRadius === "number";
333
+ }
334
+ function updateBlurEffect(view, props) {
335
+ view.effect = UIBlurEffect.effectWithStyle(blurStyle(props.intensity, props.colorScheme));
336
+ }
337
+ const BlurView = ensureNativeScript().defineUIKitContainer({
338
+ name: "BlurView",
339
+ layout: {
340
+ sizing: "fill",
341
+ defaultSize: {
342
+ width: 0,
343
+ height: 0
344
+ }
345
+ },
346
+ create() {
347
+ return createEffectHost(UIBlurEffect.effectWithStyle(UIBlurEffectStyle.SystemMaterial));
348
+ },
349
+ update(view, props, _previousProps, ctx) {
350
+ updateBlurEffect(view.rootView, props);
351
+ applyContainerStyle(view.rootView, styleFromProps(props.style));
105
352
  ctx?.invalidateLayout();
106
353
  }
107
354
  });
108
355
 
109
356
  //#endregion
110
- export { Button, Label };
357
+ export { BlurView, Button, GlassContainer, GlassView, Label, Symbol };