bleam 0.0.12 → 0.0.14

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 (57) hide show
  1. package/dist/ai.cjs +5 -4
  2. package/dist/ai.js +4 -3
  3. package/dist/app-storage-D8W4n8ey.cjs +39 -0
  4. package/dist/app-storage-Isi5Bo0R.js +34 -0
  5. package/dist/cli.cjs +149 -23
  6. package/dist/cli.d.cts +13 -0
  7. package/dist/cli.d.ts +13 -0
  8. package/dist/cli.js +149 -23
  9. package/dist/elements-DX_YUveu.d.ts +341 -0
  10. package/dist/elements-gEI8YGl1.d.cts +341 -0
  11. package/dist/elements.cjs +1031 -0
  12. package/dist/elements.d.cts +2 -0
  13. package/dist/elements.d.ts +2 -0
  14. package/dist/elements.js +999 -0
  15. package/dist/{files-BXVkPrPN.js → files-DErLhzCB.js} +5 -11
  16. package/dist/{files-DxaQ-Nv0.cjs → files-lMk-CpL_.cjs} +5 -11
  17. package/dist/files.cjs +1 -1
  18. package/dist/files.js +1 -1
  19. package/dist/schema.cjs +1 -1
  20. package/dist/schema.d.cts +1 -1
  21. package/dist/schema.d.ts +1 -1
  22. package/dist/schema.js +1 -1
  23. package/dist/secrets.cjs +146 -0
  24. package/dist/secrets.d.cts +14 -0
  25. package/dist/secrets.d.ts +14 -0
  26. package/dist/secrets.js +142 -0
  27. package/dist/{state-LssDgpff.cjs → state-Bm9GiRnU.cjs} +61 -47
  28. package/dist/{state-Dh3HLixb.js → state-D8Firo9w.js} +60 -41
  29. package/dist/state.cjs +3 -2
  30. package/dist/state.d.cts +1 -1
  31. package/dist/state.d.ts +1 -1
  32. package/dist/state.js +3 -2
  33. package/dist/window.d.cts +1 -1
  34. package/dist/window.d.ts +1 -1
  35. package/package.json +14 -11
  36. package/templates/basic/app/index.tsx +7 -129
  37. package/templates/foundation-models/app/index.tsx +100 -41
  38. package/templates/image-generation/app/index.tsx +2 -2
  39. package/templates/native/ios/Podfile.lock +6 -0
  40. package/templates/native/modules/bleam-runtime/ios/AIModule.swift +7 -8
  41. package/templates/native/package.json +6 -1
  42. package/templates/native/yarn.lock +5392 -3749
  43. package/templates/state/app/index.tsx +2 -2
  44. package/templates/text-generation/app/index.tsx +4 -4
  45. package/templates/updates/README.md +1 -1
  46. package/dist/native-sqlite-xcGdamRD.js +0 -64
  47. package/dist/native-sqlite-yQLD5s9i.cjs +0 -66
  48. package/dist/ui-1WepaMS4.d.cts +0 -92
  49. package/dist/ui-D7bRLYee.d.ts +0 -92
  50. package/dist/ui.cjs +0 -364
  51. package/dist/ui.d.cts +0 -2
  52. package/dist/ui.d.ts +0 -2
  53. package/dist/ui.js +0 -357
  54. /package/dist/{schema-B5BfdswF.js → schema-B7ELMpuI.js} +0 -0
  55. /package/dist/{schema-BnVZOXfu.cjs → schema-B7SLUBLN.cjs} +0 -0
  56. /package/dist/{schema-D5eImHxu.d.cts → schema-BWsDPc6c.d.cts} +0 -0
  57. /package/dist/{schema-SSjokbtw.d.ts → schema-DsXZBnvc.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
+ import { Button } from 'bleam/elements'
1
2
  import { atom, useAtom } from 'bleam/state'
2
3
  import { sx } from 'bleam/styles'
3
- import { Button } from 'bleam/ui'
4
4
  import { Window } from 'bleam/window'
5
5
  import { Text, View } from 'react-native'
6
6
 
@@ -20,7 +20,7 @@ export default function App() {
20
20
  </Text>
21
21
  ))}
22
22
  <Button
23
- title="Add task"
23
+ label="Add task"
24
24
  onPress={() =>
25
25
  setItems((current) => [...current, `Task ${current.length + 1}`])
26
26
  }
@@ -1,6 +1,6 @@
1
1
  import { bonsai, chat, prepareTextModel, useChat, useChatList } from 'bleam/ai'
2
+ import { Button } from 'bleam/elements'
2
3
  import { sx } from 'bleam/styles'
3
- import { Button } from 'bleam/ui'
4
4
  import { Window } from 'bleam/window'
5
5
  import { useEffect, useRef, useState } from 'react'
6
6
  import { Text, TextInput, View } from 'react-native'
@@ -94,20 +94,20 @@ function Conversation({ id, path }: { id: string; path: string }) {
94
94
  />
95
95
  <View style={sx('flex-row', 'gap-3')}>
96
96
  <Button
97
- title="Send"
97
+ label="Send"
98
98
  loading={conversation.isGenerating}
99
99
  disabled={!conversation.canSend}
100
100
  onPress={() => void conversation.send(prompt)}
101
101
  />
102
102
  <Button
103
- title="Cancel"
103
+ label="Cancel"
104
104
  variant="secondary"
105
105
  disabled={!conversation.canCancel}
106
106
  onPress={() => void conversation.cancel()}
107
107
  />
108
108
  {retryable ? (
109
109
  <Button
110
- title="Retry"
110
+ label="Retry"
111
111
  variant="secondary"
112
112
  onPress={() => void conversation.retry(retryable.id)}
113
113
  />
@@ -80,7 +80,7 @@ requires.
80
80
  "channel": "stable",
81
81
  "releaseId": "ota_release_01",
82
82
  "bundleVersion": "1.2.0+4",
83
- "runtimeVersion": "0.0.12",
83
+ "runtimeVersion": "0.0.13",
84
84
  "artifact": {
85
85
  "format": "bleam-ota-zip-v1",
86
86
  "downloadId": "ota_release_01",
@@ -1,64 +0,0 @@
1
- import "./native-runtime-C85Nuc4F.js";
2
- import { openOrCreate } from "@nativescript-community/sqlite";
3
-
4
- //#region src/native-sqlite.ts
5
- const databases = /* @__PURE__ */ new Map();
6
- function documentsDirectory() {
7
- const path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.Document, NSSearchPathDomainMask.UserDomain, true).objectAtIndex(0);
8
- if (!path) throw new Error("Could not resolve documents directory");
9
- return String(path);
10
- }
11
- function ensureDirectory(path) {
12
- const fileManager = NSFileManager.defaultManager;
13
- if (fileManager.fileExistsAtPath(path)) return;
14
- fileManager.createDirectoryAtPathWithIntermediateDirectoriesAttributesError(path, true, null, null);
15
- }
16
- function databasePath(name) {
17
- const directory = `${documentsDirectory()}/bleam`;
18
- ensureDirectory(directory);
19
- return `${directory}/${name}`;
20
- }
21
- function toPluginParameters(parameters) {
22
- return parameters;
23
- }
24
- function toSQLiteValue(value) {
25
- if (typeof value === "string" || typeof value === "number" || value === null) return value;
26
- throw new Error("SQLite blobs are not supported by Bleam state yet");
27
- }
28
- function toSQLiteRow(row) {
29
- const output = {};
30
- for (const [key, value] of Object.entries(row)) output[key] = toSQLiteValue(value);
31
- return output;
32
- }
33
- var NativeSQLiteDatabase = class {
34
- constructor(database) {
35
- this.database = database;
36
- }
37
- execute(query, parameters) {
38
- return this.database.execute(query, toPluginParameters(parameters));
39
- }
40
- async select(query, parameters) {
41
- return (await this.database.select(query, toPluginParameters(parameters))).map(toSQLiteRow);
42
- }
43
- async get(query, parameters) {
44
- const row = await this.database.get(query, toPluginParameters(parameters));
45
- return row ? toSQLiteRow(row) : void 0;
46
- }
47
- transaction(action) {
48
- return this.database.transaction(action);
49
- }
50
- close() {
51
- this.database.close();
52
- }
53
- };
54
- function openNativeSQLiteDatabase(name = "bleam.sqlite3") {
55
- const path = databasePath(name);
56
- const existing = databases.get(path);
57
- if (existing) return new NativeSQLiteDatabase(existing);
58
- const database = openOrCreate(path);
59
- databases.set(path, database);
60
- return new NativeSQLiteDatabase(database);
61
- }
62
-
63
- //#endregion
64
- export { NativeSQLiteDatabase, openNativeSQLiteDatabase };
@@ -1,66 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- require('./native-runtime-CsXnXkQn.cjs');
3
- let __nativescript_community_sqlite = require("@nativescript-community/sqlite");
4
- __nativescript_community_sqlite = require_chunk.__toESM(__nativescript_community_sqlite);
5
-
6
- //#region src/native-sqlite.ts
7
- const databases = /* @__PURE__ */ new Map();
8
- function documentsDirectory() {
9
- const path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.Document, NSSearchPathDomainMask.UserDomain, true).objectAtIndex(0);
10
- if (!path) throw new Error("Could not resolve documents directory");
11
- return String(path);
12
- }
13
- function ensureDirectory(path) {
14
- const fileManager = NSFileManager.defaultManager;
15
- if (fileManager.fileExistsAtPath(path)) return;
16
- fileManager.createDirectoryAtPathWithIntermediateDirectoriesAttributesError(path, true, null, null);
17
- }
18
- function databasePath(name) {
19
- const directory = `${documentsDirectory()}/bleam`;
20
- ensureDirectory(directory);
21
- return `${directory}/${name}`;
22
- }
23
- function toPluginParameters(parameters) {
24
- return parameters;
25
- }
26
- function toSQLiteValue(value) {
27
- if (typeof value === "string" || typeof value === "number" || value === null) return value;
28
- throw new Error("SQLite blobs are not supported by Bleam state yet");
29
- }
30
- function toSQLiteRow(row) {
31
- const output = {};
32
- for (const [key, value] of Object.entries(row)) output[key] = toSQLiteValue(value);
33
- return output;
34
- }
35
- var NativeSQLiteDatabase = class {
36
- constructor(database) {
37
- this.database = database;
38
- }
39
- execute(query, parameters) {
40
- return this.database.execute(query, toPluginParameters(parameters));
41
- }
42
- async select(query, parameters) {
43
- return (await this.database.select(query, toPluginParameters(parameters))).map(toSQLiteRow);
44
- }
45
- async get(query, parameters) {
46
- const row = await this.database.get(query, toPluginParameters(parameters));
47
- return row ? toSQLiteRow(row) : void 0;
48
- }
49
- transaction(action) {
50
- return this.database.transaction(action);
51
- }
52
- close() {
53
- this.database.close();
54
- }
55
- };
56
- function openNativeSQLiteDatabase(name = "bleam.sqlite3") {
57
- const path = databasePath(name);
58
- const existing = databases.get(path);
59
- if (existing) return new NativeSQLiteDatabase(existing);
60
- const database = (0, __nativescript_community_sqlite.openOrCreate)(path);
61
- databases.set(path, database);
62
- return new NativeSQLiteDatabase(database);
63
- }
64
-
65
- //#endregion
66
- exports.openNativeSQLiteDatabase = openNativeSQLiteDatabase;
@@ -1,92 +0,0 @@
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 };
@@ -1,92 +0,0 @@
1
- import * as _nativescript_react_native30 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_native30.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_native30.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_native30.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_native30.UIKitViewComponent<GlassViewProps, _nativescript_react_native30.UIKitContainerResult<UIVisualEffectView, UIView>>;
77
- //#endregion
78
- //#region src/ui/glass-container.d.ts
79
- declare const GlassContainer: _nativescript_react_native30.UIKitViewComponent<GlassContainerProps, _nativescript_react_native30.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_native30.UIKitViewComponent<BlurViewProps, _nativescript_react_native30.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 };