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.
- package/dist/ai.cjs +2315 -2173
- package/dist/ai.d.cts +227 -322
- package/dist/ai.d.ts +227 -322
- package/dist/ai.js +2310 -2159
- package/dist/app-storage-D8W4n8ey.cjs +39 -0
- package/dist/app-storage-Isi5Bo0R.js +34 -0
- package/dist/cli.cjs +148 -22
- package/dist/cli.d.cts +14 -1
- package/dist/cli.d.ts +13 -0
- package/dist/cli.js +148 -22
- package/dist/config.d.cts +1 -1
- package/dist/elements-CFk0QHw0.d.cts +127 -0
- package/dist/{ui-CHc4xEs_.d.ts → elements-ClGQ41Sc.d.ts} +84 -49
- package/dist/{ui.cjs → elements.cjs} +307 -168
- package/dist/elements.d.cts +2 -0
- package/dist/elements.d.ts +2 -0
- package/dist/{ui.js → elements.js} +306 -169
- package/dist/{files-Ds1wT8C2.js → files-DErLhzCB.js} +11 -12
- package/dist/{files-Bo7h9fik.cjs → files-lMk-CpL_.cjs} +16 -11
- package/dist/files.cjs +1 -1
- package/dist/files.d.cts +1 -1
- package/dist/files.js +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/schema-B7ELMpuI.js +226 -0
- package/dist/schema-B7SLUBLN.cjs +286 -0
- package/dist/schema-BWsDPc6c.d.cts +125 -0
- package/dist/schema-LxnzAfgw.d.ts +125 -0
- package/dist/schema.cjs +10 -2
- package/dist/schema.d.cts +2 -2
- package/dist/schema.d.ts +2 -2
- package/dist/schema.js +2 -2
- package/dist/secrets.cjs +146 -0
- package/dist/secrets.d.cts +14 -0
- package/dist/secrets.d.ts +14 -0
- package/dist/secrets.js +142 -0
- package/dist/state-BZYyrE2-.cjs +936 -0
- package/dist/state-DkaRFkZJ.js +843 -0
- package/dist/state.cjs +17 -12
- package/dist/state.d.cts +144 -140
- package/dist/state.d.ts +145 -140
- package/dist/state.js +4 -3
- package/dist/window.d.cts +1 -1
- package/dist/window.d.ts +3 -3
- package/package.json +13 -6
- package/templates/basic/app/index.tsx +2 -2
- package/templates/foundation-models/app/index.tsx +78 -16
- package/templates/image-generation/app/index.tsx +4 -4
- package/templates/native/ios/Bleam.xcodeproj/project.pbxproj +46 -46
- package/templates/native/ios/Podfile.lock +173 -173
- package/templates/native/modules/bleam-runtime/ios/AIModule.swift +42 -365
- package/templates/state/app/index.tsx +2 -2
- package/templates/text-generation/app/index.tsx +83 -52
- package/templates/updates/README.md +1 -1
- package/dist/schema-Bo5Jvqus.js +0 -90
- package/dist/schema-CYh6n8GS.d.ts +0 -58
- package/dist/schema-oeOrd3i1.d.cts +0 -58
- package/dist/schema-rQ13mrpD.cjs +0 -102
- package/dist/state-Bx0VlTlO.cjs +0 -852
- package/dist/state-CAwe-Vw1.js +0 -767
- package/dist/ui-1WepaMS4.d.cts +0 -92
- package/dist/ui.d.cts +0 -2
- package/dist/ui.d.ts +0 -2
- /package/dist/{config-CufOVJV3.d.cts → config-COcRnn5a.d.cts} +0 -0
- /package/dist/{files-Dt5mbzLq.d.cts → files-DwA7pzr3.d.cts} +0 -0
- /package/dist/{native-sqlite-yQLD5s9i.cjs → native-sqlite-Dw--FI9a.cjs} +0 -0
- /package/dist/{native-sqlite-xcGdamRD.js → native-sqlite-WzRNzCSh.js} +0 -0
|
@@ -2,8 +2,10 @@ const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
|
2
2
|
const require_native_runtime = require('./native-runtime-CsXnXkQn.cjs');
|
|
3
3
|
let react_native = require("react-native");
|
|
4
4
|
react_native = require_chunk.__toESM(react_native);
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
5
7
|
|
|
6
|
-
//#region src/
|
|
8
|
+
//#region src/elements/shared.ts
|
|
7
9
|
function textFromChildren(children) {
|
|
8
10
|
if (typeof children === "string" || typeof children === "number") return String(children);
|
|
9
11
|
if (Array.isArray(children)) return children.filter((child) => typeof child === "string" || typeof child === "number").join("");
|
|
@@ -42,142 +44,90 @@ function fontFromStyle(style) {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
//#endregion
|
|
45
|
-
//#region src/
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
//#region src/elements/blur-view.tsx
|
|
48
|
+
function blurStyle(intensity, colorScheme) {
|
|
49
|
+
const scheme = colorScheme ?? "auto";
|
|
50
|
+
const level = intensity ?? "regular";
|
|
51
|
+
if (scheme === "light") switch (level) {
|
|
52
|
+
case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterialLight;
|
|
53
|
+
case "thin": return UIBlurEffectStyle.SystemThinMaterialLight;
|
|
54
|
+
case "thick": return UIBlurEffectStyle.SystemThickMaterialLight;
|
|
55
|
+
case "chrome": return UIBlurEffectStyle.SystemChromeMaterialLight;
|
|
56
|
+
default: return UIBlurEffectStyle.SystemMaterialLight;
|
|
57
|
+
}
|
|
58
|
+
if (scheme === "dark") switch (level) {
|
|
59
|
+
case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterialDark;
|
|
60
|
+
case "thin": return UIBlurEffectStyle.SystemThinMaterialDark;
|
|
61
|
+
case "thick": return UIBlurEffectStyle.SystemThickMaterialDark;
|
|
62
|
+
case "chrome": return UIBlurEffectStyle.SystemChromeMaterialDark;
|
|
63
|
+
default: return UIBlurEffectStyle.SystemMaterialDark;
|
|
64
|
+
}
|
|
65
|
+
switch (level) {
|
|
66
|
+
case "ultraThin": return UIBlurEffectStyle.SystemUltraThinMaterial;
|
|
67
|
+
case "thin": return UIBlurEffectStyle.SystemThinMaterial;
|
|
68
|
+
case "thick": return UIBlurEffectStyle.SystemThickMaterial;
|
|
69
|
+
case "chrome": return UIBlurEffectStyle.SystemChromeMaterial;
|
|
70
|
+
default: return UIBlurEffectStyle.SystemMaterial;
|
|
71
|
+
}
|
|
53
72
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
function createEffectHost(effect) {
|
|
74
|
+
const rootView = UIVisualEffectView.alloc().initWithEffect(effect);
|
|
75
|
+
rootView.backgroundColor = UIColor.clearColor;
|
|
76
|
+
rootView.contentView.backgroundColor = UIColor.clearColor;
|
|
77
|
+
rootView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
|
|
78
|
+
rootView.contentView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
|
|
79
|
+
return {
|
|
80
|
+
rootView,
|
|
81
|
+
childrenView: rootView.contentView
|
|
82
|
+
};
|
|
58
83
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
defaultSize: {
|
|
64
|
-
width: 1,
|
|
65
|
-
height: 34
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
create(ctx) {
|
|
69
|
-
const button = UIButton.buttonWithType(UIButtonType.System);
|
|
70
|
-
ctx.targetAction(button, UIControlEvents.TouchUpInside, () => {
|
|
71
|
-
ctx.emit("onPress");
|
|
72
|
-
});
|
|
73
|
-
return button;
|
|
74
|
-
},
|
|
75
|
-
update(button, props, _previousProps, ctx) {
|
|
76
|
-
const style = styleFromProps(props.style);
|
|
77
|
-
const configuration = buttonConfiguration(props.variant);
|
|
78
|
-
configuration.title = buttonTitle(props);
|
|
79
|
-
configuration.buttonSize = buttonSize(props.size);
|
|
80
|
-
configuration.showsActivityIndicator = props.loading ?? false;
|
|
81
|
-
const foregroundColor = colorFromStyle(style?.color);
|
|
82
|
-
if (foregroundColor) configuration.baseForegroundColor = foregroundColor;
|
|
83
|
-
const backgroundColor = colorFromStyle(style?.backgroundColor);
|
|
84
|
-
if (backgroundColor) configuration.baseBackgroundColor = backgroundColor;
|
|
85
|
-
button.configuration = configuration;
|
|
86
|
-
button.enabled = !(props.disabled || props.loading);
|
|
87
|
-
ctx?.invalidateLayout();
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/ui/label.tsx
|
|
93
|
-
function labelText(props) {
|
|
94
|
-
return props.text ?? textFromChildren(props.children) ?? "";
|
|
84
|
+
function applyContainerStyle(view, style) {
|
|
85
|
+
const borderRadius = style?.borderRadius;
|
|
86
|
+
if (typeof borderRadius === "number") view.layer.cornerRadius = borderRadius;
|
|
87
|
+
view.clipsToBounds = style?.overflow === "hidden" || typeof borderRadius === "number";
|
|
95
88
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
if (tone === "tertiary") return UIColor.tertiaryLabelColor;
|
|
99
|
-
return UIColor.labelColor;
|
|
89
|
+
function updateBlurEffect(view, props) {
|
|
90
|
+
view.effect = UIBlurEffect.effectWithStyle(blurStyle(props.intensity, props.colorScheme));
|
|
100
91
|
}
|
|
101
|
-
const
|
|
102
|
-
name: "
|
|
92
|
+
const BlurView = require_native_runtime.ensureNativeScript().defineUIKitContainer({
|
|
93
|
+
name: "BlurView",
|
|
103
94
|
layout: {
|
|
104
|
-
sizing: "
|
|
95
|
+
sizing: "fill",
|
|
105
96
|
defaultSize: {
|
|
106
|
-
width:
|
|
107
|
-
height:
|
|
97
|
+
width: 0,
|
|
98
|
+
height: 0
|
|
108
99
|
}
|
|
109
100
|
},
|
|
110
101
|
create() {
|
|
111
|
-
|
|
112
|
-
label.adjustsFontForContentSizeCategory = true;
|
|
113
|
-
return label;
|
|
102
|
+
return createEffectHost(UIBlurEffect.effectWithStyle(UIBlurEffectStyle.SystemMaterial));
|
|
114
103
|
},
|
|
115
|
-
update(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
label.textColor = colorFromStyle(style?.color) ?? defaultLabelColor(props.tone);
|
|
119
|
-
label.font = fontFromStyle(style) ?? UIFont.preferredFontForTextStyle(UIFontTextStyleBody);
|
|
120
|
-
label.numberOfLines = props.numberOfLines ?? 0;
|
|
121
|
-
if (style?.textAlign === "center") label.textAlignment = NSTextAlignment.Center;
|
|
122
|
-
else if (style?.textAlign === "right") label.textAlignment = NSTextAlignment.Right;
|
|
123
|
-
else label.textAlignment = NSTextAlignment.Left;
|
|
104
|
+
update(view, props, _previousProps, ctx) {
|
|
105
|
+
updateBlurEffect(view.rootView, props);
|
|
106
|
+
applyContainerStyle(view.rootView, styleFromProps(props.style));
|
|
124
107
|
ctx?.invalidateLayout();
|
|
125
108
|
}
|
|
126
109
|
});
|
|
127
110
|
|
|
128
111
|
//#endregion
|
|
129
|
-
//#region src/
|
|
130
|
-
function
|
|
131
|
-
|
|
132
|
-
case "ultraLight": return UIImageSymbolWeight.UltraLight;
|
|
133
|
-
case "thin": return UIImageSymbolWeight.Thin;
|
|
134
|
-
case "light": return UIImageSymbolWeight.Light;
|
|
135
|
-
case "medium": return UIImageSymbolWeight.Medium;
|
|
136
|
-
case "semibold": return UIImageSymbolWeight.Semibold;
|
|
137
|
-
case "bold": return UIImageSymbolWeight.Bold;
|
|
138
|
-
case "heavy": return UIImageSymbolWeight.Heavy;
|
|
139
|
-
case "black": return UIImageSymbolWeight.Black;
|
|
140
|
-
default: return UIImageSymbolWeight.Regular;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function symbolScale(scale) {
|
|
144
|
-
if (scale === "small") return UIImageSymbolScale.Small;
|
|
145
|
-
if (scale === "large") return UIImageSymbolScale.Large;
|
|
146
|
-
return UIImageSymbolScale.Medium;
|
|
112
|
+
//#region src/elements/button-state.ts
|
|
113
|
+
function buttonDisabled(disabled, loading) {
|
|
114
|
+
return disabled || loading;
|
|
147
115
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
|
|
116
|
+
function buttonOpacity(options) {
|
|
117
|
+
if (buttonDisabled(options.disabled, options.loading)) return .45;
|
|
118
|
+
if (!options.pressed) return 1;
|
|
119
|
+
return Math.min(1, Math.max(0, options.activeOpacity));
|
|
151
120
|
}
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
121
|
+
function buttonAccessibilityState(state, disabled, loading) {
|
|
122
|
+
return {
|
|
123
|
+
...state,
|
|
124
|
+
disabled: buttonDisabled(disabled, loading),
|
|
125
|
+
busy: loading
|
|
126
|
+
};
|
|
155
127
|
}
|
|
156
|
-
const Symbol = require_native_runtime.ensureNativeScript().defineUIKitView({
|
|
157
|
-
name: "Symbol",
|
|
158
|
-
layout: {
|
|
159
|
-
sizing: "intrinsic",
|
|
160
|
-
defaultSize: {
|
|
161
|
-
width: 17,
|
|
162
|
-
height: 17
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
create() {
|
|
166
|
-
const imageView = UIImageView.new();
|
|
167
|
-
imageView.contentMode = UIViewContentMode.ScaleAspectFit;
|
|
168
|
-
return imageView;
|
|
169
|
-
},
|
|
170
|
-
update(imageView, props, _previousProps, ctx) {
|
|
171
|
-
const style = styleFromProps(props.style);
|
|
172
|
-
const configuration = symbolConfiguration(props, style);
|
|
173
|
-
imageView.image = symbolImage(props.symbol, configuration);
|
|
174
|
-
imageView.tintColor = colorFromStyle(props.color) ?? colorFromStyle(style?.tintColor) ?? colorFromStyle(style?.color) ?? UIColor.labelColor;
|
|
175
|
-
ctx?.invalidateLayout();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
128
|
|
|
179
129
|
//#endregion
|
|
180
|
-
//#region src/
|
|
130
|
+
//#region src/elements/glass-shared.ts
|
|
181
131
|
function glassStyleValue(style) {
|
|
182
132
|
return typeof style === "object" ? style.style : style ?? "regular";
|
|
183
133
|
}
|
|
@@ -247,7 +197,7 @@ function updateGlassContainerEffect(view, spacing) {
|
|
|
247
197
|
}
|
|
248
198
|
|
|
249
199
|
//#endregion
|
|
250
|
-
//#region src/
|
|
200
|
+
//#region src/elements/glass-view.tsx
|
|
251
201
|
const GlassView = require_native_runtime.ensureNativeScript().defineUIKitContainer({
|
|
252
202
|
name: "GlassView",
|
|
253
203
|
layout: {
|
|
@@ -268,7 +218,172 @@ const GlassView = require_native_runtime.ensureNativeScript().defineUIKitContain
|
|
|
268
218
|
});
|
|
269
219
|
|
|
270
220
|
//#endregion
|
|
271
|
-
//#region src/
|
|
221
|
+
//#region src/elements/button.tsx
|
|
222
|
+
const sizeStyles = {
|
|
223
|
+
small: {
|
|
224
|
+
minHeight: 28,
|
|
225
|
+
minWidth: 28,
|
|
226
|
+
paddingHorizontal: 10
|
|
227
|
+
},
|
|
228
|
+
regular: {
|
|
229
|
+
minHeight: 36,
|
|
230
|
+
minWidth: 36,
|
|
231
|
+
paddingHorizontal: 14
|
|
232
|
+
},
|
|
233
|
+
large: {
|
|
234
|
+
minHeight: 44,
|
|
235
|
+
minWidth: 44,
|
|
236
|
+
paddingHorizontal: 18
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const labelSizeStyles = {
|
|
240
|
+
small: { fontSize: 13 },
|
|
241
|
+
regular: { fontSize: 15 },
|
|
242
|
+
large: { fontSize: 17 }
|
|
243
|
+
};
|
|
244
|
+
const glassCornerRadius = {
|
|
245
|
+
small: 8,
|
|
246
|
+
regular: 10,
|
|
247
|
+
large: 12
|
|
248
|
+
};
|
|
249
|
+
function resolveStyle(style, state) {
|
|
250
|
+
return typeof style === "function" ? style(state) : style;
|
|
251
|
+
}
|
|
252
|
+
function ButtonContent({ icon, label, labelStyle, loading, size, variant }) {
|
|
253
|
+
const indicatorColor = variant === "primary" ? "#ffffff" : (0, react_native.PlatformColor)("systemBlue");
|
|
254
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ActivityIndicator, {
|
|
255
|
+
accessibilityElementsHidden: true,
|
|
256
|
+
color: indicatorColor,
|
|
257
|
+
size: "small"
|
|
258
|
+
}) : icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
259
|
+
accessibilityElementsHidden: true,
|
|
260
|
+
children: icon
|
|
261
|
+
}) : null, label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
262
|
+
numberOfLines: 1,
|
|
263
|
+
style: [
|
|
264
|
+
styles.label,
|
|
265
|
+
labelSizeStyles[size],
|
|
266
|
+
variant ? labelVariantStyles[variant] : styles.glassLabel,
|
|
267
|
+
labelStyle
|
|
268
|
+
],
|
|
269
|
+
children: label
|
|
270
|
+
}) : null] });
|
|
271
|
+
}
|
|
272
|
+
function Button({ accessibilityRole = "button", accessibilityState, activeOpacity = .2, disabled = false, icon, label, labelStyle, loading = false, size = "regular", style, variant = "primary",...props }) {
|
|
273
|
+
const inactive = buttonDisabled(disabled, loading);
|
|
274
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
275
|
+
...props,
|
|
276
|
+
accessibilityRole,
|
|
277
|
+
accessibilityState: buttonAccessibilityState(accessibilityState, disabled, loading),
|
|
278
|
+
disabled: inactive,
|
|
279
|
+
style: (state) => [
|
|
280
|
+
styles.button,
|
|
281
|
+
sizeStyles[size],
|
|
282
|
+
buttonVariantStyles[variant],
|
|
283
|
+
resolveStyle(style, state),
|
|
284
|
+
{ opacity: buttonOpacity({
|
|
285
|
+
...state,
|
|
286
|
+
disabled,
|
|
287
|
+
loading,
|
|
288
|
+
activeOpacity
|
|
289
|
+
}) }
|
|
290
|
+
],
|
|
291
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
292
|
+
pointerEvents: "none",
|
|
293
|
+
style: styles.content,
|
|
294
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonContent, {
|
|
295
|
+
icon,
|
|
296
|
+
label,
|
|
297
|
+
labelStyle,
|
|
298
|
+
loading,
|
|
299
|
+
size,
|
|
300
|
+
variant
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function GlassButton({ accessibilityRole = "button", accessibilityState, activeOpacity = .2, disabled = false, glassEffectStyle, glassStyle, icon, label, labelStyle, loading = false, size = "regular", style, tintColor,...props }) {
|
|
306
|
+
const inactive = buttonDisabled(disabled, loading);
|
|
307
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Pressable, {
|
|
308
|
+
...props,
|
|
309
|
+
accessibilityRole,
|
|
310
|
+
accessibilityState: buttonAccessibilityState(accessibilityState, disabled, loading),
|
|
311
|
+
disabled: inactive,
|
|
312
|
+
style: (state) => [
|
|
313
|
+
styles.button,
|
|
314
|
+
sizeStyles[size],
|
|
315
|
+
styles.glassButton,
|
|
316
|
+
resolveStyle(style, state),
|
|
317
|
+
{ opacity: buttonOpacity({
|
|
318
|
+
...state,
|
|
319
|
+
disabled,
|
|
320
|
+
loading,
|
|
321
|
+
activeOpacity
|
|
322
|
+
}) }
|
|
323
|
+
],
|
|
324
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
325
|
+
pointerEvents: "none",
|
|
326
|
+
style: styles.glassBackground,
|
|
327
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlassView, {
|
|
328
|
+
glassEffectStyle,
|
|
329
|
+
glassStyle: {
|
|
330
|
+
cornerRadius: glassCornerRadius[size],
|
|
331
|
+
...glassStyle
|
|
332
|
+
},
|
|
333
|
+
isInteractive: false,
|
|
334
|
+
style: styles.glass,
|
|
335
|
+
tintColor
|
|
336
|
+
})
|
|
337
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
338
|
+
pointerEvents: "none",
|
|
339
|
+
style: styles.content,
|
|
340
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonContent, {
|
|
341
|
+
icon,
|
|
342
|
+
label,
|
|
343
|
+
labelStyle,
|
|
344
|
+
loading,
|
|
345
|
+
size
|
|
346
|
+
})
|
|
347
|
+
})]
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
const styles = react_native.StyleSheet.create({
|
|
351
|
+
button: {
|
|
352
|
+
alignItems: "center",
|
|
353
|
+
borderRadius: 10,
|
|
354
|
+
justifyContent: "center"
|
|
355
|
+
},
|
|
356
|
+
glassButton: { backgroundColor: "transparent" },
|
|
357
|
+
glass: { flex: 1 },
|
|
358
|
+
glassBackground: {
|
|
359
|
+
bottom: 0,
|
|
360
|
+
left: 0,
|
|
361
|
+
position: "absolute",
|
|
362
|
+
right: 0,
|
|
363
|
+
top: 0
|
|
364
|
+
},
|
|
365
|
+
content: {
|
|
366
|
+
alignItems: "center",
|
|
367
|
+
flexDirection: "row",
|
|
368
|
+
gap: 7,
|
|
369
|
+
justifyContent: "center"
|
|
370
|
+
},
|
|
371
|
+
label: { fontWeight: "600" },
|
|
372
|
+
glassLabel: { color: (0, react_native.PlatformColor)("label") }
|
|
373
|
+
});
|
|
374
|
+
const buttonVariantStyles = react_native.StyleSheet.create({
|
|
375
|
+
primary: { backgroundColor: (0, react_native.PlatformColor)("systemBlue") },
|
|
376
|
+
secondary: { backgroundColor: (0, react_native.PlatformColor)("secondarySystemFill") },
|
|
377
|
+
plain: { backgroundColor: "transparent" }
|
|
378
|
+
});
|
|
379
|
+
const labelVariantStyles = react_native.StyleSheet.create({
|
|
380
|
+
primary: { color: "#ffffff" },
|
|
381
|
+
secondary: { color: (0, react_native.PlatformColor)("label") },
|
|
382
|
+
plain: { color: (0, react_native.PlatformColor)("systemBlue") }
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/elements/glass-container.tsx
|
|
272
387
|
const GlassContainer = require_native_runtime.ensureNativeScript().defineUIKitContainer({
|
|
273
388
|
name: "GlassContainer",
|
|
274
389
|
layout: {
|
|
@@ -291,66 +406,89 @@ const GlassContainer = require_native_runtime.ensureNativeScript().defineUIKitCo
|
|
|
291
406
|
});
|
|
292
407
|
|
|
293
408
|
//#endregion
|
|
294
|
-
//#region src/
|
|
295
|
-
function
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
409
|
+
//#region src/elements/label.tsx
|
|
410
|
+
function labelText(props) {
|
|
411
|
+
return props.text ?? textFromChildren(props.children) ?? "";
|
|
412
|
+
}
|
|
413
|
+
function defaultLabelColor(tone) {
|
|
414
|
+
if (tone === "secondary") return UIColor.secondaryLabelColor;
|
|
415
|
+
if (tone === "tertiary") return UIColor.tertiaryLabelColor;
|
|
416
|
+
return UIColor.labelColor;
|
|
417
|
+
}
|
|
418
|
+
const Label = require_native_runtime.ensureNativeScript().defineUIKitView({
|
|
419
|
+
name: "Label",
|
|
420
|
+
layout: {
|
|
421
|
+
sizing: "intrinsic",
|
|
422
|
+
defaultSize: {
|
|
423
|
+
width: 1,
|
|
424
|
+
height: 24
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
create() {
|
|
428
|
+
const label = UILabel.new();
|
|
429
|
+
label.adjustsFontForContentSizeCategory = true;
|
|
430
|
+
return label;
|
|
431
|
+
},
|
|
432
|
+
update(label, props, _previousProps, ctx) {
|
|
433
|
+
const style = styleFromProps(props.style);
|
|
434
|
+
label.text = labelText(props);
|
|
435
|
+
label.textColor = colorFromStyle(style?.color) ?? defaultLabelColor(props.tone);
|
|
436
|
+
label.font = fontFromStyle(style) ?? UIFont.preferredFontForTextStyle(UIFontTextStyleBody);
|
|
437
|
+
label.numberOfLines = props.numberOfLines ?? 0;
|
|
438
|
+
if (style?.textAlign === "center") label.textAlignment = NSTextAlignment.Center;
|
|
439
|
+
else if (style?.textAlign === "right") label.textAlignment = NSTextAlignment.Right;
|
|
440
|
+
else label.textAlignment = NSTextAlignment.Left;
|
|
441
|
+
ctx?.invalidateLayout();
|
|
311
442
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/elements/symbol.tsx
|
|
447
|
+
function symbolWeight(weight) {
|
|
448
|
+
switch (weight) {
|
|
449
|
+
case "ultraLight": return UIImageSymbolWeight.UltraLight;
|
|
450
|
+
case "thin": return UIImageSymbolWeight.Thin;
|
|
451
|
+
case "light": return UIImageSymbolWeight.Light;
|
|
452
|
+
case "medium": return UIImageSymbolWeight.Medium;
|
|
453
|
+
case "semibold": return UIImageSymbolWeight.Semibold;
|
|
454
|
+
case "bold": return UIImageSymbolWeight.Bold;
|
|
455
|
+
case "heavy": return UIImageSymbolWeight.Heavy;
|
|
456
|
+
case "black": return UIImageSymbolWeight.Black;
|
|
457
|
+
default: return UIImageSymbolWeight.Regular;
|
|
318
458
|
}
|
|
319
459
|
}
|
|
320
|
-
function
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
rootView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
|
|
325
|
-
rootView.contentView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
|
|
326
|
-
return {
|
|
327
|
-
rootView,
|
|
328
|
-
childrenView: rootView.contentView
|
|
329
|
-
};
|
|
460
|
+
function symbolScale(scale) {
|
|
461
|
+
if (scale === "small") return UIImageSymbolScale.Small;
|
|
462
|
+
if (scale === "large") return UIImageSymbolScale.Large;
|
|
463
|
+
return UIImageSymbolScale.Medium;
|
|
330
464
|
}
|
|
331
|
-
function
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
view.clipsToBounds = style?.overflow === "hidden" || typeof borderRadius === "number";
|
|
465
|
+
function symbolConfiguration(props, style) {
|
|
466
|
+
const size = props.size ?? style?.fontSize ?? 17;
|
|
467
|
+
return UIImageSymbolConfiguration.configurationWithPointSizeWeightScale(size, symbolWeight(props.weight), symbolScale(props.scale));
|
|
335
468
|
}
|
|
336
|
-
function
|
|
337
|
-
|
|
469
|
+
function symbolImage(name, configuration) {
|
|
470
|
+
if (configuration) return UIImage.systemImageNamedWithConfiguration(name, configuration);
|
|
471
|
+
return UIImage.systemImageNamed(name);
|
|
338
472
|
}
|
|
339
|
-
const
|
|
340
|
-
name: "
|
|
473
|
+
const SFSymbol = require_native_runtime.ensureNativeScript().defineUIKitView({
|
|
474
|
+
name: "Symbol",
|
|
341
475
|
layout: {
|
|
342
|
-
sizing: "
|
|
476
|
+
sizing: "intrinsic",
|
|
343
477
|
defaultSize: {
|
|
344
|
-
width:
|
|
345
|
-
height:
|
|
478
|
+
width: 17,
|
|
479
|
+
height: 17
|
|
346
480
|
}
|
|
347
481
|
},
|
|
348
482
|
create() {
|
|
349
|
-
|
|
483
|
+
const imageView = UIImageView.new();
|
|
484
|
+
imageView.contentMode = UIViewContentMode.ScaleAspectFit;
|
|
485
|
+
return imageView;
|
|
350
486
|
},
|
|
351
|
-
update(
|
|
352
|
-
|
|
353
|
-
|
|
487
|
+
update(imageView, props, _previousProps, ctx) {
|
|
488
|
+
const style = styleFromProps(props.style);
|
|
489
|
+
const configuration = symbolConfiguration(props, style);
|
|
490
|
+
imageView.image = symbolImage(props.symbol, configuration);
|
|
491
|
+
imageView.tintColor = colorFromStyle(props.color) ?? colorFromStyle(style?.tintColor) ?? colorFromStyle(style?.color) ?? UIColor.labelColor;
|
|
354
492
|
ctx?.invalidateLayout();
|
|
355
493
|
}
|
|
356
494
|
});
|
|
@@ -358,7 +496,8 @@ const BlurView = require_native_runtime.ensureNativeScript().defineUIKitContaine
|
|
|
358
496
|
//#endregion
|
|
359
497
|
exports.BlurView = BlurView;
|
|
360
498
|
exports.Button = Button;
|
|
499
|
+
exports.GlassButton = GlassButton;
|
|
361
500
|
exports.GlassContainer = GlassContainer;
|
|
362
501
|
exports.GlassView = GlassView;
|
|
363
502
|
exports.Label = Label;
|
|
364
|
-
exports.Symbol =
|
|
503
|
+
exports.Symbol = SFSymbol;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as BlurIntensity, S as BlurColorScheme, T as BlurViewProps, _ as GlassContainerProps, a as SymbolWeight, b as GlassViewProps, c as LabelTone, d as ButtonProps, f as ButtonSize, g as GlassView, h as GlassButtonProps, i as SymbolScale, l as GlassContainer, m as GlassButton, n as SymbolName, o as Label, p as ButtonVariant, r as SymbolProps, s as LabelProps, t as SFSymbol, u as Button, v as GlassEffectStyleConfig, w as BlurView, x as GlassVisualStyle, y as GlassStyle } from "./elements-CFk0QHw0.cjs";
|
|
2
|
+
export { BlurColorScheme, BlurIntensity, BlurView, BlurViewProps, Button, ButtonProps, ButtonSize, ButtonVariant, GlassButton, GlassButtonProps, GlassContainer, GlassContainerProps, GlassEffectStyleConfig, GlassStyle, GlassView, GlassViewProps, GlassVisualStyle, Label, LabelProps, LabelTone, SFSymbol as Symbol, SymbolName, SymbolProps, SymbolScale, SymbolWeight };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as BlurIntensity, S as BlurColorScheme, T as BlurViewProps, _ as GlassContainerProps, a as SymbolWeight, b as GlassViewProps, c as LabelTone, d as ButtonProps, f as ButtonSize, g as GlassView, h as GlassButtonProps, i as SymbolScale, l as GlassContainer, m as GlassButton, n as SymbolName, o as Label, p as ButtonVariant, r as SymbolProps, s as LabelProps, t as SFSymbol, u as Button, v as GlassEffectStyleConfig, w as BlurView, x as GlassVisualStyle, y as GlassStyle } from "./elements-ClGQ41Sc.js";
|
|
2
|
+
export { BlurColorScheme, BlurIntensity, BlurView, BlurViewProps, Button, ButtonProps, ButtonSize, ButtonVariant, GlassButton, GlassButtonProps, GlassContainer, GlassContainerProps, GlassEffectStyleConfig, GlassStyle, GlassView, GlassViewProps, GlassVisualStyle, Label, LabelProps, LabelTone, SFSymbol as Symbol, SymbolName, SymbolProps, SymbolScale, SymbolWeight };
|