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
package/dist/native.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { t as ensureNativeScript } from "./native-runtime-C85Nuc4F.js";
|
|
2
|
-
import { n as macOSApplication } from "./native-macos-D6p2SmUj.js";
|
|
3
|
-
|
|
4
|
-
//#region src/native.ts
|
|
5
|
-
function objectValue(value, key) {
|
|
6
|
-
if (!value || typeof value !== "object") return;
|
|
7
|
-
return value[key];
|
|
8
|
-
}
|
|
9
|
-
function setObjectValue(value, key, nextValue) {
|
|
10
|
-
if (!value || typeof value !== "object") return false;
|
|
11
|
-
const record = value;
|
|
12
|
-
record[key] = nextValue;
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
function colorFromHex(hex) {
|
|
16
|
-
const value = hex.trim().replace(/^#/, "");
|
|
17
|
-
const normalized = value.length === 3 ? value.split("").map((part) => `${part}${part}`).join("") : value;
|
|
18
|
-
if (!/^[\da-f]{6}$/i.test(normalized)) throw new Error(`Invalid native color: ${hex}`);
|
|
19
|
-
const number = Number.parseInt(normalized, 16);
|
|
20
|
-
const red = (number >> 16 & 255) / 255;
|
|
21
|
-
const green = (number >> 8 & 255) / 255;
|
|
22
|
-
const blue = (number & 255) / 255;
|
|
23
|
-
return UIColor.colorWithRedGreenBlueAlpha(red, green, blue, 1);
|
|
24
|
-
}
|
|
25
|
-
function forEachNativeObject(collection, callback) {
|
|
26
|
-
const values = collection?.allObjects ?? collection;
|
|
27
|
-
if (Array.isArray(values)) {
|
|
28
|
-
values.forEach(callback);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const iterableValues = values;
|
|
32
|
-
const count = Number(iterableValues?.count ?? 0);
|
|
33
|
-
for (let index = 0; index < count; index += 1) callback(iterableValues?.objectAtIndex?.(index));
|
|
34
|
-
}
|
|
35
|
-
async function runOnUI(callback) {
|
|
36
|
-
return ensureNativeScript().runOnUI(callback);
|
|
37
|
-
}
|
|
38
|
-
async function setTintColor(hex) {
|
|
39
|
-
await runOnUI(() => {
|
|
40
|
-
const color = colorFromHex(hex);
|
|
41
|
-
const application = UIApplication.sharedApplication;
|
|
42
|
-
if (application.keyWindow) application.keyWindow.tintColor = color;
|
|
43
|
-
forEachNativeObject(application.connectedScenes, (scene) => {
|
|
44
|
-
forEachNativeObject(objectValue(scene, "windows"), (window) => {
|
|
45
|
-
if (window && typeof window === "object" && "tintColor" in window) window.tintColor = color;
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
async function setWindowTitle(title) {
|
|
51
|
-
await runOnUI(() => {
|
|
52
|
-
const application = UIApplication.sharedApplication;
|
|
53
|
-
forEachNativeObject(application.connectedScenes, (scene) => {
|
|
54
|
-
setObjectValue(scene, "title", title);
|
|
55
|
-
});
|
|
56
|
-
const appKitApplication = macOSApplication();
|
|
57
|
-
const appKitWindow = appKitApplication?.keyWindow ?? appKitApplication?.mainWindow;
|
|
58
|
-
if (appKitWindow) setObjectValue(appKitWindow, "title", title);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function documentsDirectoryPath() {
|
|
62
|
-
const path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.Document, NSSearchPathDomainMask.UserDomain, true)?.objectAtIndex(0);
|
|
63
|
-
if (typeof path !== "string") throw new Error("Native FileManager unavailable: Documents directory missing");
|
|
64
|
-
return path;
|
|
65
|
-
}
|
|
66
|
-
function documentPath(name) {
|
|
67
|
-
return NSString.stringWithString(documentsDirectoryPath()).stringByAppendingPathComponent(name);
|
|
68
|
-
}
|
|
69
|
-
async function writeDocumentText(name, text) {
|
|
70
|
-
await runOnUI(() => {
|
|
71
|
-
const path = documentPath(name);
|
|
72
|
-
if (!NSString.stringWithString(text).writeToFileAtomicallyEncodingError(path, true, NSUTF8StringEncoding, null)) throw new Error(`Failed to write native document at ${path}`);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
async function readDocumentText(name) {
|
|
76
|
-
let text = "";
|
|
77
|
-
await runOnUI(() => {
|
|
78
|
-
text = String(NSString.stringWithContentsOfFileEncodingError(documentPath(name), NSUTF8StringEncoding, null));
|
|
79
|
-
});
|
|
80
|
-
return text;
|
|
81
|
-
}
|
|
82
|
-
async function documentExists(name) {
|
|
83
|
-
let exists = false;
|
|
84
|
-
await runOnUI(() => {
|
|
85
|
-
const fileManager = NSFileManager.defaultManager;
|
|
86
|
-
exists = Boolean(fileManager.fileExistsAtPath(documentPath(name)));
|
|
87
|
-
});
|
|
88
|
-
return exists;
|
|
89
|
-
}
|
|
90
|
-
async function listDocuments() {
|
|
91
|
-
const names = [];
|
|
92
|
-
await runOnUI(() => {
|
|
93
|
-
forEachNativeObject(NSFileManager.defaultManager.contentsOfDirectoryAtPathError(documentsDirectoryPath(), null), (item) => {
|
|
94
|
-
names.push(String(item));
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
return names;
|
|
98
|
-
}
|
|
99
|
-
const NativeLabel = ensureNativeScript().defineUIKitView({
|
|
100
|
-
name: "NativeLabel",
|
|
101
|
-
layout: {
|
|
102
|
-
sizing: "intrinsic",
|
|
103
|
-
defaultSize: {
|
|
104
|
-
width: 1,
|
|
105
|
-
height: 28
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
create() {
|
|
109
|
-
const label = UILabel.new();
|
|
110
|
-
label.textAlignment = NSTextAlignment.Center;
|
|
111
|
-
label.font = UIFont.boldSystemFontOfSize(18);
|
|
112
|
-
return label;
|
|
113
|
-
},
|
|
114
|
-
update(label, props, _previousProps, ctx) {
|
|
115
|
-
label.text = props.text;
|
|
116
|
-
label.textColor = colorFromHex(props.color ?? "#0a84ff");
|
|
117
|
-
ctx?.invalidateLayout();
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
const native = {
|
|
121
|
-
init: ensureNativeScript,
|
|
122
|
-
NativeLabel,
|
|
123
|
-
runOnUI,
|
|
124
|
-
ui: { setTintColor },
|
|
125
|
-
files: {
|
|
126
|
-
exists: documentExists,
|
|
127
|
-
listDocuments,
|
|
128
|
-
readText: readDocumentText,
|
|
129
|
-
writeText: writeDocumentText
|
|
130
|
-
},
|
|
131
|
-
window: { setTitle: setWindowTitle }
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
//#endregion
|
|
135
|
-
export { native };
|
|
File without changes
|
|
File without changes
|