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