bleam 0.0.11 → 0.0.13

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 (66) hide show
  1. package/dist/ai.cjs +2315 -2173
  2. package/dist/ai.d.cts +227 -322
  3. package/dist/ai.d.ts +227 -322
  4. package/dist/ai.js +2310 -2159
  5. package/dist/app-storage-D8W4n8ey.cjs +39 -0
  6. package/dist/app-storage-Isi5Bo0R.js +34 -0
  7. package/dist/cli.cjs +148 -22
  8. package/dist/cli.d.cts +14 -1
  9. package/dist/cli.d.ts +13 -0
  10. package/dist/cli.js +148 -22
  11. package/dist/config.d.cts +1 -1
  12. package/dist/elements-CFk0QHw0.d.cts +127 -0
  13. package/dist/{ui-CHc4xEs_.d.ts → elements-ClGQ41Sc.d.ts} +84 -49
  14. package/dist/{ui.cjs → elements.cjs} +307 -168
  15. package/dist/elements.d.cts +2 -0
  16. package/dist/elements.d.ts +2 -0
  17. package/dist/{ui.js → elements.js} +306 -169
  18. package/dist/{files-Ds1wT8C2.js → files-DErLhzCB.js} +11 -12
  19. package/dist/{files-Bo7h9fik.cjs → files-lMk-CpL_.cjs} +16 -11
  20. package/dist/files.cjs +1 -1
  21. package/dist/files.d.cts +1 -1
  22. package/dist/files.js +1 -1
  23. package/dist/index.d.cts +1 -1
  24. package/dist/schema-B7ELMpuI.js +226 -0
  25. package/dist/schema-B7SLUBLN.cjs +286 -0
  26. package/dist/schema-BWsDPc6c.d.cts +125 -0
  27. package/dist/schema-LxnzAfgw.d.ts +125 -0
  28. package/dist/schema.cjs +10 -2
  29. package/dist/schema.d.cts +2 -2
  30. package/dist/schema.d.ts +2 -2
  31. package/dist/schema.js +2 -2
  32. package/dist/secrets.cjs +146 -0
  33. package/dist/secrets.d.cts +14 -0
  34. package/dist/secrets.d.ts +14 -0
  35. package/dist/secrets.js +142 -0
  36. package/dist/state-BZYyrE2-.cjs +936 -0
  37. package/dist/state-DkaRFkZJ.js +843 -0
  38. package/dist/state.cjs +17 -12
  39. package/dist/state.d.cts +144 -140
  40. package/dist/state.d.ts +145 -140
  41. package/dist/state.js +4 -3
  42. package/dist/window.d.cts +1 -1
  43. package/dist/window.d.ts +3 -3
  44. package/package.json +13 -6
  45. package/templates/basic/app/index.tsx +2 -2
  46. package/templates/foundation-models/app/index.tsx +78 -16
  47. package/templates/image-generation/app/index.tsx +4 -4
  48. package/templates/native/ios/Bleam.xcodeproj/project.pbxproj +46 -46
  49. package/templates/native/ios/Podfile.lock +173 -173
  50. package/templates/native/modules/bleam-runtime/ios/AIModule.swift +42 -365
  51. package/templates/state/app/index.tsx +2 -2
  52. package/templates/text-generation/app/index.tsx +83 -52
  53. package/templates/updates/README.md +1 -1
  54. package/dist/schema-Bo5Jvqus.js +0 -90
  55. package/dist/schema-CYh6n8GS.d.ts +0 -58
  56. package/dist/schema-oeOrd3i1.d.cts +0 -58
  57. package/dist/schema-rQ13mrpD.cjs +0 -102
  58. package/dist/state-Bx0VlTlO.cjs +0 -852
  59. package/dist/state-CAwe-Vw1.js +0 -767
  60. package/dist/ui-1WepaMS4.d.cts +0 -92
  61. package/dist/ui.d.cts +0 -2
  62. package/dist/ui.d.ts +0 -2
  63. /package/dist/{config-CufOVJV3.d.cts → config-COcRnn5a.d.cts} +0 -0
  64. /package/dist/{files-Dt5mbzLq.d.cts → files-DwA7pzr3.d.cts} +0 -0
  65. /package/dist/{native-sqlite-yQLD5s9i.cjs → native-sqlite-Dw--FI9a.cjs} +0 -0
  66. /package/dist/{native-sqlite-xcGdamRD.js → native-sqlite-WzRNzCSh.js} +0 -0
@@ -1,7 +1,8 @@
1
1
  import { t as ensureNativeScript } from "./native-runtime-C85Nuc4F.js";
2
- import { StyleSheet, processColor } from "react-native";
2
+ import { ActivityIndicator, PlatformColor, Pressable, StyleSheet, Text, View, processColor } from "react-native";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
4
 
4
- //#region src/ui/shared.ts
5
+ //#region src/elements/shared.ts
5
6
  function textFromChildren(children) {
6
7
  if (typeof children === "string" || typeof children === "number") return String(children);
7
8
  if (Array.isArray(children)) return children.filter((child) => typeof child === "string" || typeof child === "number").join("");
@@ -40,142 +41,90 @@ function fontFromStyle(style) {
40
41
  }
41
42
 
42
43
  //#endregion
43
- //#region src/ui/button.tsx
44
- function buttonTitle(props) {
45
- return props.title ?? textFromChildren(props.children) ?? "";
46
- }
47
- function buttonConfiguration(variant) {
48
- if (variant === "secondary") return UIButtonConfiguration.borderedButtonConfiguration();
49
- if (variant === "plain") return UIButtonConfiguration.plainButtonConfiguration();
50
- return UIButtonConfiguration.borderedProminentButtonConfiguration();
44
+ //#region src/elements/blur-view.tsx
45
+ function blurStyle(intensity, colorScheme) {
46
+ const scheme = colorScheme ?? "auto";
47
+ const level = intensity ?? "regular";
48
+ if (scheme === "light") switch (level) {
49
+ case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterialLight;
50
+ case "thin": return UIBlurEffectStyle.SystemThinMaterialLight;
51
+ case "thick": return UIBlurEffectStyle.SystemThickMaterialLight;
52
+ case "chrome": return UIBlurEffectStyle.SystemChromeMaterialLight;
53
+ default: return UIBlurEffectStyle.SystemMaterialLight;
54
+ }
55
+ if (scheme === "dark") switch (level) {
56
+ case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterialDark;
57
+ case "thin": return UIBlurEffectStyle.SystemThinMaterialDark;
58
+ case "thick": return UIBlurEffectStyle.SystemThickMaterialDark;
59
+ case "chrome": return UIBlurEffectStyle.SystemChromeMaterialDark;
60
+ default: return UIBlurEffectStyle.SystemMaterialDark;
61
+ }
62
+ switch (level) {
63
+ case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterial;
64
+ case "thin": return UIBlurEffectStyle.SystemThinMaterial;
65
+ case "thick": return UIBlurEffectStyle.SystemThickMaterial;
66
+ case "chrome": return UIBlurEffectStyle.SystemChromeMaterial;
67
+ default: return UIBlurEffectStyle.SystemMaterial;
68
+ }
51
69
  }
52
- function buttonSize(size) {
53
- if (size === "small") return UIButtonConfigurationSize.Small;
54
- if (size === "large") return UIButtonConfigurationSize.Large;
55
- return UIButtonConfigurationSize.Medium;
70
+ function createEffectHost(effect) {
71
+ const rootView = UIVisualEffectView.alloc().initWithEffect(effect);
72
+ rootView.backgroundColor = UIColor.clearColor;
73
+ rootView.contentView.backgroundColor = UIColor.clearColor;
74
+ rootView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
75
+ rootView.contentView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
76
+ return {
77
+ rootView,
78
+ childrenView: rootView.contentView
79
+ };
56
80
  }
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) ?? "";
81
+ function applyContainerStyle(view, style) {
82
+ const borderRadius = style?.borderRadius;
83
+ if (typeof borderRadius === "number") view.layer.cornerRadius = borderRadius;
84
+ view.clipsToBounds = style?.overflow === "hidden" || typeof borderRadius === "number";
93
85
  }
94
- function defaultLabelColor(tone) {
95
- if (tone === "secondary") return UIColor.secondaryLabelColor;
96
- if (tone === "tertiary") return UIColor.tertiaryLabelColor;
97
- return UIColor.labelColor;
86
+ function updateBlurEffect(view, props) {
87
+ view.effect = UIBlurEffect.effectWithStyle(blurStyle(props.intensity, props.colorScheme));
98
88
  }
99
- const Label = ensureNativeScript().defineUIKitView({
100
- name: "Label",
89
+ const BlurView = ensureNativeScript().defineUIKitContainer({
90
+ name: "BlurView",
101
91
  layout: {
102
- sizing: "intrinsic",
92
+ sizing: "fill",
103
93
  defaultSize: {
104
- width: 1,
105
- height: 24
94
+ width: 0,
95
+ height: 0
106
96
  }
107
97
  },
108
98
  create() {
109
- const label = UILabel.new();
110
- label.adjustsFontForContentSizeCategory = true;
111
- return label;
99
+ return createEffectHost(UIBlurEffect.effectWithStyle(UIBlurEffectStyle.SystemMaterial));
112
100
  },
113
- update(label, props, _previousProps, ctx) {
114
- const style = styleFromProps(props.style);
115
- label.text = labelText(props);
116
- label.textColor = colorFromStyle(style?.color) ?? defaultLabelColor(props.tone);
117
- label.font = fontFromStyle(style) ?? UIFont.preferredFontForTextStyle(UIFontTextStyleBody);
118
- label.numberOfLines = props.numberOfLines ?? 0;
119
- if (style?.textAlign === "center") label.textAlignment = NSTextAlignment.Center;
120
- else if (style?.textAlign === "right") label.textAlignment = NSTextAlignment.Right;
121
- else label.textAlignment = NSTextAlignment.Left;
101
+ update(view, props, _previousProps, ctx) {
102
+ updateBlurEffect(view.rootView, props);
103
+ applyContainerStyle(view.rootView, styleFromProps(props.style));
122
104
  ctx?.invalidateLayout();
123
105
  }
124
106
  });
125
107
 
126
108
  //#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;
109
+ //#region src/elements/button-state.ts
110
+ function buttonDisabled(disabled, loading) {
111
+ return disabled || loading;
145
112
  }
146
- function symbolConfiguration(props, style) {
147
- const size = props.size ?? style?.fontSize ?? 17;
148
- return UIImageSymbolConfiguration.configurationWithPointSizeWeightScale(size, symbolWeight(props.weight), symbolScale(props.scale));
113
+ function buttonOpacity(options) {
114
+ if (buttonDisabled(options.disabled, options.loading)) return .45;
115
+ if (!options.pressed) return 1;
116
+ return Math.min(1, Math.max(0, options.activeOpacity));
149
117
  }
150
- function symbolImage(name, configuration) {
151
- if (configuration) return UIImage.systemImageNamedWithConfiguration(name, configuration);
152
- return UIImage.systemImageNamed(name);
118
+ function buttonAccessibilityState(state, disabled, loading) {
119
+ return {
120
+ ...state,
121
+ disabled: buttonDisabled(disabled, loading),
122
+ busy: loading
123
+ };
153
124
  }
154
- const Symbol = ensureNativeScript().defineUIKitView({
155
- name: "Symbol",
156
- layout: {
157
- sizing: "intrinsic",
158
- defaultSize: {
159
- width: 17,
160
- height: 17
161
- }
162
- },
163
- create() {
164
- const imageView = UIImageView.new();
165
- imageView.contentMode = UIViewContentMode.ScaleAspectFit;
166
- return imageView;
167
- },
168
- update(imageView, props, _previousProps, ctx) {
169
- const style = styleFromProps(props.style);
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
125
 
177
126
  //#endregion
178
- //#region src/ui/glass-shared.ts
127
+ //#region src/elements/glass-shared.ts
179
128
  function glassStyleValue(style) {
180
129
  return typeof style === "object" ? style.style : style ?? "regular";
181
130
  }
@@ -245,7 +194,7 @@ function updateGlassContainerEffect(view, spacing) {
245
194
  }
246
195
 
247
196
  //#endregion
248
- //#region src/ui/glass-view.tsx
197
+ //#region src/elements/glass-view.tsx
249
198
  const GlassView = ensureNativeScript().defineUIKitContainer({
250
199
  name: "GlassView",
251
200
  layout: {
@@ -266,7 +215,172 @@ const GlassView = ensureNativeScript().defineUIKitContainer({
266
215
  });
267
216
 
268
217
  //#endregion
269
- //#region src/ui/glass-container.tsx
218
+ //#region src/elements/button.tsx
219
+ const sizeStyles = {
220
+ small: {
221
+ minHeight: 28,
222
+ minWidth: 28,
223
+ paddingHorizontal: 10
224
+ },
225
+ regular: {
226
+ minHeight: 36,
227
+ minWidth: 36,
228
+ paddingHorizontal: 14
229
+ },
230
+ large: {
231
+ minHeight: 44,
232
+ minWidth: 44,
233
+ paddingHorizontal: 18
234
+ }
235
+ };
236
+ const labelSizeStyles = {
237
+ small: { fontSize: 13 },
238
+ regular: { fontSize: 15 },
239
+ large: { fontSize: 17 }
240
+ };
241
+ const glassCornerRadius = {
242
+ small: 8,
243
+ regular: 10,
244
+ large: 12
245
+ };
246
+ function resolveStyle(style, state) {
247
+ return typeof style === "function" ? style(state) : style;
248
+ }
249
+ function ButtonContent({ icon, label, labelStyle, loading, size, variant }) {
250
+ const indicatorColor = variant === "primary" ? "#ffffff" : PlatformColor("systemBlue");
251
+ return /* @__PURE__ */ jsxs(Fragment, { children: [loading ? /* @__PURE__ */ jsx(ActivityIndicator, {
252
+ accessibilityElementsHidden: true,
253
+ color: indicatorColor,
254
+ size: "small"
255
+ }) : icon ? /* @__PURE__ */ jsx(View, {
256
+ accessibilityElementsHidden: true,
257
+ children: icon
258
+ }) : null, label ? /* @__PURE__ */ jsx(Text, {
259
+ numberOfLines: 1,
260
+ style: [
261
+ styles.label,
262
+ labelSizeStyles[size],
263
+ variant ? labelVariantStyles[variant] : styles.glassLabel,
264
+ labelStyle
265
+ ],
266
+ children: label
267
+ }) : null] });
268
+ }
269
+ function Button({ accessibilityRole = "button", accessibilityState, activeOpacity = .2, disabled = false, icon, label, labelStyle, loading = false, size = "regular", style, variant = "primary",...props }) {
270
+ const inactive = buttonDisabled(disabled, loading);
271
+ return /* @__PURE__ */ jsx(Pressable, {
272
+ ...props,
273
+ accessibilityRole,
274
+ accessibilityState: buttonAccessibilityState(accessibilityState, disabled, loading),
275
+ disabled: inactive,
276
+ style: (state) => [
277
+ styles.button,
278
+ sizeStyles[size],
279
+ buttonVariantStyles[variant],
280
+ resolveStyle(style, state),
281
+ { opacity: buttonOpacity({
282
+ ...state,
283
+ disabled,
284
+ loading,
285
+ activeOpacity
286
+ }) }
287
+ ],
288
+ children: /* @__PURE__ */ jsx(View, {
289
+ pointerEvents: "none",
290
+ style: styles.content,
291
+ children: /* @__PURE__ */ jsx(ButtonContent, {
292
+ icon,
293
+ label,
294
+ labelStyle,
295
+ loading,
296
+ size,
297
+ variant
298
+ })
299
+ })
300
+ });
301
+ }
302
+ function GlassButton({ accessibilityRole = "button", accessibilityState, activeOpacity = .2, disabled = false, glassEffectStyle, glassStyle, icon, label, labelStyle, loading = false, size = "regular", style, tintColor,...props }) {
303
+ const inactive = buttonDisabled(disabled, loading);
304
+ return /* @__PURE__ */ jsxs(Pressable, {
305
+ ...props,
306
+ accessibilityRole,
307
+ accessibilityState: buttonAccessibilityState(accessibilityState, disabled, loading),
308
+ disabled: inactive,
309
+ style: (state) => [
310
+ styles.button,
311
+ sizeStyles[size],
312
+ styles.glassButton,
313
+ resolveStyle(style, state),
314
+ { opacity: buttonOpacity({
315
+ ...state,
316
+ disabled,
317
+ loading,
318
+ activeOpacity
319
+ }) }
320
+ ],
321
+ children: [/* @__PURE__ */ jsx(View, {
322
+ pointerEvents: "none",
323
+ style: styles.glassBackground,
324
+ children: /* @__PURE__ */ jsx(GlassView, {
325
+ glassEffectStyle,
326
+ glassStyle: {
327
+ cornerRadius: glassCornerRadius[size],
328
+ ...glassStyle
329
+ },
330
+ isInteractive: false,
331
+ style: styles.glass,
332
+ tintColor
333
+ })
334
+ }), /* @__PURE__ */ jsx(View, {
335
+ pointerEvents: "none",
336
+ style: styles.content,
337
+ children: /* @__PURE__ */ jsx(ButtonContent, {
338
+ icon,
339
+ label,
340
+ labelStyle,
341
+ loading,
342
+ size
343
+ })
344
+ })]
345
+ });
346
+ }
347
+ const styles = StyleSheet.create({
348
+ button: {
349
+ alignItems: "center",
350
+ borderRadius: 10,
351
+ justifyContent: "center"
352
+ },
353
+ glassButton: { backgroundColor: "transparent" },
354
+ glass: { flex: 1 },
355
+ glassBackground: {
356
+ bottom: 0,
357
+ left: 0,
358
+ position: "absolute",
359
+ right: 0,
360
+ top: 0
361
+ },
362
+ content: {
363
+ alignItems: "center",
364
+ flexDirection: "row",
365
+ gap: 7,
366
+ justifyContent: "center"
367
+ },
368
+ label: { fontWeight: "600" },
369
+ glassLabel: { color: PlatformColor("label") }
370
+ });
371
+ const buttonVariantStyles = StyleSheet.create({
372
+ primary: { backgroundColor: PlatformColor("systemBlue") },
373
+ secondary: { backgroundColor: PlatformColor("secondarySystemFill") },
374
+ plain: { backgroundColor: "transparent" }
375
+ });
376
+ const labelVariantStyles = StyleSheet.create({
377
+ primary: { color: "#ffffff" },
378
+ secondary: { color: PlatformColor("label") },
379
+ plain: { color: PlatformColor("systemBlue") }
380
+ });
381
+
382
+ //#endregion
383
+ //#region src/elements/glass-container.tsx
270
384
  const GlassContainer = ensureNativeScript().defineUIKitContainer({
271
385
  name: "GlassContainer",
272
386
  layout: {
@@ -289,69 +403,92 @@ const GlassContainer = ensureNativeScript().defineUIKitContainer({
289
403
  });
290
404
 
291
405
  //#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;
406
+ //#region src/elements/label.tsx
407
+ function labelText(props) {
408
+ return props.text ?? textFromChildren(props.children) ?? "";
409
+ }
410
+ function defaultLabelColor(tone) {
411
+ if (tone === "secondary") return UIColor.secondaryLabelColor;
412
+ if (tone === "tertiary") return UIColor.tertiaryLabelColor;
413
+ return UIColor.labelColor;
414
+ }
415
+ const Label = ensureNativeScript().defineUIKitView({
416
+ name: "Label",
417
+ layout: {
418
+ sizing: "intrinsic",
419
+ defaultSize: {
420
+ width: 1,
421
+ height: 24
422
+ }
423
+ },
424
+ create() {
425
+ const label = UILabel.new();
426
+ label.adjustsFontForContentSizeCategory = true;
427
+ return label;
428
+ },
429
+ update(label, props, _previousProps, ctx) {
430
+ const style = styleFromProps(props.style);
431
+ label.text = labelText(props);
432
+ label.textColor = colorFromStyle(style?.color) ?? defaultLabelColor(props.tone);
433
+ label.font = fontFromStyle(style) ?? UIFont.preferredFontForTextStyle(UIFontTextStyleBody);
434
+ label.numberOfLines = props.numberOfLines ?? 0;
435
+ if (style?.textAlign === "center") label.textAlignment = NSTextAlignment.Center;
436
+ else if (style?.textAlign === "right") label.textAlignment = NSTextAlignment.Right;
437
+ else label.textAlignment = NSTextAlignment.Left;
438
+ ctx?.invalidateLayout();
309
439
  }
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;
440
+ });
441
+
442
+ //#endregion
443
+ //#region src/elements/symbol.tsx
444
+ function symbolWeight(weight) {
445
+ switch (weight) {
446
+ case "ultraLight": return UIImageSymbolWeight.UltraLight;
447
+ case "thin": return UIImageSymbolWeight.Thin;
448
+ case "light": return UIImageSymbolWeight.Light;
449
+ case "medium": return UIImageSymbolWeight.Medium;
450
+ case "semibold": return UIImageSymbolWeight.Semibold;
451
+ case "bold": return UIImageSymbolWeight.Bold;
452
+ case "heavy": return UIImageSymbolWeight.Heavy;
453
+ case "black": return UIImageSymbolWeight.Black;
454
+ default: return UIImageSymbolWeight.Regular;
316
455
  }
317
456
  }
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
- };
457
+ function symbolScale(scale) {
458
+ if (scale === "small") return UIImageSymbolScale.Small;
459
+ if (scale === "large") return UIImageSymbolScale.Large;
460
+ return UIImageSymbolScale.Medium;
328
461
  }
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";
462
+ function symbolConfiguration(props, style) {
463
+ const size = props.size ?? style?.fontSize ?? 17;
464
+ return UIImageSymbolConfiguration.configurationWithPointSizeWeightScale(size, symbolWeight(props.weight), symbolScale(props.scale));
333
465
  }
334
- function updateBlurEffect(view, props) {
335
- view.effect = UIBlurEffect.effectWithStyle(blurStyle(props.intensity, props.colorScheme));
466
+ function symbolImage(name, configuration) {
467
+ if (configuration) return UIImage.systemImageNamedWithConfiguration(name, configuration);
468
+ return UIImage.systemImageNamed(name);
336
469
  }
337
- const BlurView = ensureNativeScript().defineUIKitContainer({
338
- name: "BlurView",
470
+ const SFSymbol = ensureNativeScript().defineUIKitView({
471
+ name: "Symbol",
339
472
  layout: {
340
- sizing: "fill",
473
+ sizing: "intrinsic",
341
474
  defaultSize: {
342
- width: 0,
343
- height: 0
475
+ width: 17,
476
+ height: 17
344
477
  }
345
478
  },
346
479
  create() {
347
- return createEffectHost(UIBlurEffect.effectWithStyle(UIBlurEffectStyle.SystemMaterial));
480
+ const imageView = UIImageView.new();
481
+ imageView.contentMode = UIViewContentMode.ScaleAspectFit;
482
+ return imageView;
348
483
  },
349
- update(view, props, _previousProps, ctx) {
350
- updateBlurEffect(view.rootView, props);
351
- applyContainerStyle(view.rootView, styleFromProps(props.style));
484
+ update(imageView, props, _previousProps, ctx) {
485
+ const style = styleFromProps(props.style);
486
+ const configuration = symbolConfiguration(props, style);
487
+ imageView.image = symbolImage(props.symbol, configuration);
488
+ imageView.tintColor = colorFromStyle(props.color) ?? colorFromStyle(style?.tintColor) ?? colorFromStyle(style?.color) ?? UIColor.labelColor;
352
489
  ctx?.invalidateLayout();
353
490
  }
354
491
  });
355
492
 
356
493
  //#endregion
357
- export { BlurView, Button, GlassContainer, GlassView, Label, Symbol };
494
+ export { BlurView, Button, GlassButton, GlassContainer, GlassView, Label, SFSymbol as Symbol };
@@ -28,26 +28,20 @@ function ensureDirectory(path) {
28
28
  function parentDirectory(path) {
29
29
  return nsString(path).stringByDeletingLastPathComponent;
30
30
  }
31
- function appGroupIdentifier() {
32
- return String(NSBundle.mainBundle.objectForInfoDictionaryKey("AppGroupIdentifier") ?? "group.dev.bleam.app");
33
- }
34
- function containerPath() {
35
- const url = fileManager().containerURLForSecurityApplicationGroupIdentifier(appGroupIdentifier());
36
- if (!url?.path) throw new Error("Shared container is unavailable");
37
- return String(url.path);
38
- }
39
31
  function searchPath(directory) {
40
32
  const value = NSSearchPathForDirectoriesInDomains(directory, NSSearchPathDomainMask.UserDomain, true)?.objectAtIndex(0);
41
33
  if (typeof value !== "string") throw new Error("Native directory unavailable");
42
34
  return value;
43
35
  }
36
+ function bleamDirectory(directory, name) {
37
+ return nsString(searchPath(directory)).stringByAppendingPathComponent(`Bleam/${name}`);
38
+ }
44
39
  function nativeDirectories() {
45
- const shared = containerPath();
46
40
  return {
47
41
  cache: searchPath(NSSearchPathDirectory.Caches),
48
42
  documents: searchPath(NSSearchPathDirectory.Document),
49
- models: nsString(shared).stringByAppendingPathComponent("Models"),
50
- shared,
43
+ models: bleamDirectory(NSSearchPathDirectory.Caches, "Models"),
44
+ shared: bleamDirectory(NSSearchPathDirectory.ApplicationSupport, "Shared"),
51
45
  temporary: NSTemporaryDirectory()
52
46
  };
53
47
  }
@@ -84,6 +78,11 @@ async function nativeRemove(path, recursive) {
84
78
  }
85
79
  fileManager().removeItemAtPathError(path, null);
86
80
  }
81
+ async function nativeCopy(source, destination) {
82
+ ensureDirectory(parentDirectory(destination));
83
+ if (fileManager().fileExistsAtPath(destination)) fileManager().removeItemAtPathError(destination, null);
84
+ if (!fileManager().copyItemAtPathToPathError(source, destination, null)) throw new Error(`Could not copy file from ${source} to ${destination}`);
85
+ }
87
86
  async function nativeReadText(path) {
88
87
  return String(NSString.stringWithContentsOfFileEncodingError(path, NSUTF8StringEncoding, null));
89
88
  }
@@ -442,4 +441,4 @@ const files = {
442
441
  };
443
442
 
444
443
  //#endregion
445
- export { files as i, DownloadTask as n, FileRef as r, DirectoryRef as t };
444
+ export { nativeCopy as a, files as i, DownloadTask as n, FileRef as r, DirectoryRef as t };
@@ -28,26 +28,20 @@ function ensureDirectory(path) {
28
28
  function parentDirectory(path) {
29
29
  return nsString(path).stringByDeletingLastPathComponent;
30
30
  }
31
- function appGroupIdentifier() {
32
- return String(NSBundle.mainBundle.objectForInfoDictionaryKey("AppGroupIdentifier") ?? "group.dev.bleam.app");
33
- }
34
- function containerPath() {
35
- const url = fileManager().containerURLForSecurityApplicationGroupIdentifier(appGroupIdentifier());
36
- if (!url?.path) throw new Error("Shared container is unavailable");
37
- return String(url.path);
38
- }
39
31
  function searchPath(directory) {
40
32
  const value = NSSearchPathForDirectoriesInDomains(directory, NSSearchPathDomainMask.UserDomain, true)?.objectAtIndex(0);
41
33
  if (typeof value !== "string") throw new Error("Native directory unavailable");
42
34
  return value;
43
35
  }
36
+ function bleamDirectory(directory, name) {
37
+ return nsString(searchPath(directory)).stringByAppendingPathComponent(`Bleam/${name}`);
38
+ }
44
39
  function nativeDirectories() {
45
- const shared = containerPath();
46
40
  return {
47
41
  cache: searchPath(NSSearchPathDirectory.Caches),
48
42
  documents: searchPath(NSSearchPathDirectory.Document),
49
- models: nsString(shared).stringByAppendingPathComponent("Models"),
50
- shared,
43
+ models: bleamDirectory(NSSearchPathDirectory.Caches, "Models"),
44
+ shared: bleamDirectory(NSSearchPathDirectory.ApplicationSupport, "Shared"),
51
45
  temporary: NSTemporaryDirectory()
52
46
  };
53
47
  }
@@ -84,6 +78,11 @@ async function nativeRemove(path, recursive) {
84
78
  }
85
79
  fileManager().removeItemAtPathError(path, null);
86
80
  }
81
+ async function nativeCopy(source, destination) {
82
+ ensureDirectory(parentDirectory(destination));
83
+ if (fileManager().fileExistsAtPath(destination)) fileManager().removeItemAtPathError(destination, null);
84
+ if (!fileManager().copyItemAtPathToPathError(source, destination, null)) throw new Error(`Could not copy file from ${source} to ${destination}`);
85
+ }
87
86
  async function nativeReadText(path) {
88
87
  return String(NSString.stringWithContentsOfFileEncodingError(path, NSUTF8StringEncoding, null));
89
88
  }
@@ -465,4 +464,10 @@ Object.defineProperty(exports, 'files', {
465
464
  get: function () {
466
465
  return files;
467
466
  }
467
+ });
468
+ Object.defineProperty(exports, 'nativeCopy', {
469
+ enumerable: true,
470
+ get: function () {
471
+ return nativeCopy;
472
+ }
468
473
  });
package/dist/files.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  require('./native-runtime-CsXnXkQn.cjs');
2
- const require_files = require('./files-Bo7h9fik.cjs');
2
+ const require_files = require('./files-lMk-CpL_.cjs');
3
3
 
4
4
  exports.DirectoryRef = require_files.DirectoryRef;
5
5
  exports.DownloadTask = require_files.DownloadTask;
package/dist/files.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as DownloadTask, c as FileStat, d as PickOptions, f as RemoveOptions, i as DownloadProgress, l as FileType, m as files, n as DirectoryRef, o as FilePaths, p as WriteOptions, r as DownloadOptions, s as FileRef, t as CreateDirectoryOptions, u as PickFileType } from "./files-Dt5mbzLq.cjs";
1
+ import { a as DownloadTask, c as FileStat, d as PickOptions, f as RemoveOptions, i as DownloadProgress, l as FileType, m as files, n as DirectoryRef, o as FilePaths, p as WriteOptions, r as DownloadOptions, s as FileRef, t as CreateDirectoryOptions, u as PickFileType } from "./files-DwA7pzr3.cjs";
2
2
  export { CreateDirectoryOptions, DirectoryRef, DownloadOptions, DownloadProgress, DownloadTask, FilePaths, FileRef, FileStat, FileType, PickFileType, PickOptions, RemoveOptions, WriteOptions, files };
package/dist/files.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./native-runtime-C85Nuc4F.js";
2
- import { i as files, n as DownloadTask, r as FileRef, t as DirectoryRef } from "./files-Ds1wT8C2.js";
2
+ import { i as files, n as DownloadTask, r as FileRef, t as DirectoryRef } from "./files-DErLhzCB.js";
3
3
 
4
4
  export { DirectoryRef, DownloadTask, FileRef, files };
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as HexColor, c as defineConfig, i as BleamUserInterfaceStyle, n as BleamConfig, o as appConfig, r as BleamInternalExpoConfig, s as createExpoConfig, t as BleamAppearance } from "./config-CufOVJV3.cjs";
1
+ import { a as HexColor, c as defineConfig, i as BleamUserInterfaceStyle, n as BleamConfig, o as appConfig, r as BleamInternalExpoConfig, s as createExpoConfig, t as BleamAppearance } from "./config-COcRnn5a.cjs";
2
2
  export { BleamAppearance, BleamConfig, BleamInternalExpoConfig, BleamUserInterfaceStyle, HexColor, appConfig, createExpoConfig, defineConfig };