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/chrome.js
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { t as ensureNativeScript } from "./native-runtime-C85Nuc4F.js";
|
|
2
|
-
import { n as macOSApplication, t as createMacOSToolbar } from "./native-macos-D6p2SmUj.js";
|
|
3
|
-
import { useEffect, useLayoutEffect } from "react";
|
|
4
|
-
|
|
5
|
-
//#region src/chrome.tsx
|
|
6
|
-
const toolbarStyleValues = {
|
|
7
|
-
automatic: 0,
|
|
8
|
-
expanded: 1,
|
|
9
|
-
preference: 2,
|
|
10
|
-
unified: 3,
|
|
11
|
-
unifiedCompact: 4
|
|
12
|
-
};
|
|
13
|
-
const titleVisibilityValues = {
|
|
14
|
-
visible: 0,
|
|
15
|
-
hidden: 1
|
|
16
|
-
};
|
|
17
|
-
const userInterfaceStyleValues = {
|
|
18
|
-
automatic: 0,
|
|
19
|
-
light: 1,
|
|
20
|
-
dark: 2
|
|
21
|
-
};
|
|
22
|
-
function nativeRecord(value) {
|
|
23
|
-
if (!value || typeof value !== "object") return;
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
function macOSScene(value) {
|
|
27
|
-
return nativeRecord(value);
|
|
28
|
-
}
|
|
29
|
-
function macOSWindow(value) {
|
|
30
|
-
return nativeRecord(value);
|
|
31
|
-
}
|
|
32
|
-
function selectorTarget(value) {
|
|
33
|
-
return nativeRecord(value);
|
|
34
|
-
}
|
|
35
|
-
function setNativeValue(value, key, nextValue) {
|
|
36
|
-
const record = nativeRecord(value);
|
|
37
|
-
if (!record) return false;
|
|
38
|
-
record[key] = nextValue;
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
function colorFromHex(hex) {
|
|
42
|
-
const value = hex.trim().replace(/^#/, "");
|
|
43
|
-
const normalized = value.length === 3 ? value.split("").map((part) => `${part}${part}`).join("") : value;
|
|
44
|
-
if (!/^[\da-f]{6}$/i.test(normalized)) throw new Error(`Invalid color: ${hex}`);
|
|
45
|
-
const number = Number.parseInt(normalized, 16);
|
|
46
|
-
const red = (number >> 16 & 255) / 255;
|
|
47
|
-
const green = (number >> 8 & 255) / 255;
|
|
48
|
-
const blue = (number & 255) / 255;
|
|
49
|
-
return UIColor.colorWithRedGreenBlueAlpha(red, green, blue, 1);
|
|
50
|
-
}
|
|
51
|
-
function forEachNativeObject(collection, callback) {
|
|
52
|
-
const values = collection?.allObjects ?? collection;
|
|
53
|
-
if (Array.isArray(values)) {
|
|
54
|
-
values.forEach(callback);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const iterableValues = values;
|
|
58
|
-
const count = Number(iterableValues?.count ?? 0);
|
|
59
|
-
for (let index = 0; index < count; index += 1) callback(iterableValues?.objectAtIndex?.(index));
|
|
60
|
-
}
|
|
61
|
-
function runOnUIWithRetry(apply) {
|
|
62
|
-
const run = () => ensureNativeScript().runOnUI(apply).catch(() => {});
|
|
63
|
-
run();
|
|
64
|
-
const timeout = setTimeout(() => {
|
|
65
|
-
run();
|
|
66
|
-
}, 250);
|
|
67
|
-
return () => {
|
|
68
|
-
clearTimeout(timeout);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function applyWindowTitle(title) {
|
|
72
|
-
const application = UIApplication.sharedApplication;
|
|
73
|
-
forEachNativeObject(application?.connectedScenes, (scene) => {
|
|
74
|
-
setNativeValue(scene, "title", title);
|
|
75
|
-
});
|
|
76
|
-
const appKitApplication = macOSApplication();
|
|
77
|
-
const appKitWindow = appKitApplication?.keyWindow ?? appKitApplication?.mainWindow;
|
|
78
|
-
if (appKitWindow) setNativeValue(appKitWindow, "title", title);
|
|
79
|
-
}
|
|
80
|
-
function clearRootView(window) {
|
|
81
|
-
const rootView = (macOSWindow(window)?.rootViewController)?.view;
|
|
82
|
-
if (!rootView) return;
|
|
83
|
-
setNativeValue(rootView, "backgroundColor", UIColor.clearColor);
|
|
84
|
-
setNativeValue(rootView, "opaque", false);
|
|
85
|
-
}
|
|
86
|
-
function forEachApplicationWindow(callback) {
|
|
87
|
-
const application = UIApplication.sharedApplication;
|
|
88
|
-
callback(application.keyWindow);
|
|
89
|
-
forEachNativeObject(application?.windows, callback);
|
|
90
|
-
forEachNativeObject(application?.connectedScenes, (scene) => {
|
|
91
|
-
callback(macOSScene(scene)?.keyWindow);
|
|
92
|
-
forEachNativeObject(macOSScene(scene)?.windows, callback);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function applyWindowTint(tint) {
|
|
96
|
-
const tintColor = colorFromHex(tint);
|
|
97
|
-
function applyTint(window) {
|
|
98
|
-
if (!window) return;
|
|
99
|
-
setNativeValue(window, "tintColor", tintColor);
|
|
100
|
-
clearRootView(window);
|
|
101
|
-
const rootView = (macOSWindow(window)?.rootViewController)?.view;
|
|
102
|
-
if (rootView) setNativeValue(rootView, "tintColor", tintColor);
|
|
103
|
-
}
|
|
104
|
-
forEachApplicationWindow(applyTint);
|
|
105
|
-
}
|
|
106
|
-
function applyWindowBackgroundColor(backgroundColor) {
|
|
107
|
-
const color = colorFromHex(backgroundColor);
|
|
108
|
-
forEachApplicationWindow((window) => {
|
|
109
|
-
if (!window) return;
|
|
110
|
-
setNativeValue(window, "backgroundColor", color);
|
|
111
|
-
clearRootView(window);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function applyWindowUserInterfaceStyle(userInterfaceStyle) {
|
|
115
|
-
const value = userInterfaceStyleValues[userInterfaceStyle];
|
|
116
|
-
forEachApplicationWindow((window) => {
|
|
117
|
-
if (!window) return;
|
|
118
|
-
setNativeValue(window, "overrideUserInterfaceStyle", value);
|
|
119
|
-
const rootViewController = macOSWindow(window)?.rootViewController;
|
|
120
|
-
if (rootViewController) setNativeValue(rootViewController, "overrideUserInterfaceStyle", value);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function applyWindowRootTransparency() {
|
|
124
|
-
forEachApplicationWindow((window) => {
|
|
125
|
-
if (window) clearRootView(window);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function invokeNativeValue(target, selector, ...values) {
|
|
129
|
-
const invoke = selectorTarget(target)?.invoke;
|
|
130
|
-
if (typeof invoke !== "function") return;
|
|
131
|
-
return invoke.call(target, selector, ...values);
|
|
132
|
-
}
|
|
133
|
-
function titlebarForScene(scene) {
|
|
134
|
-
try {
|
|
135
|
-
const titlebar = invokeNativeValue(scene, "titlebar");
|
|
136
|
-
if (titlebar) return titlebar;
|
|
137
|
-
} catch {}
|
|
138
|
-
try {
|
|
139
|
-
const target = selectorTarget(scene);
|
|
140
|
-
if (target?.valueForKey) {
|
|
141
|
-
const titlebar = target.valueForKey("titlebar");
|
|
142
|
-
if (titlebar) return titlebar;
|
|
143
|
-
}
|
|
144
|
-
} catch {}
|
|
145
|
-
return macOSScene(scene)?.titlebar;
|
|
146
|
-
}
|
|
147
|
-
function setNativeNumber(target, key, value) {
|
|
148
|
-
const selector = `set${key[0]?.toUpperCase()}${key.slice(1)}:`;
|
|
149
|
-
try {
|
|
150
|
-
if (invokeNativeValue(target, selector, value) !== void 0) return;
|
|
151
|
-
} catch {}
|
|
152
|
-
try {
|
|
153
|
-
if (setNativeValue(target, key, value)) return;
|
|
154
|
-
} catch {}
|
|
155
|
-
try {
|
|
156
|
-
const selector$1 = selectorTarget(target);
|
|
157
|
-
if (selector$1?.setValueForKey) {
|
|
158
|
-
selector$1.setValueForKey(NSNumber.numberWithInteger(value), key);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
} catch {}
|
|
162
|
-
}
|
|
163
|
-
function applyTitleVisibility(titleVisibility) {
|
|
164
|
-
if (!macOSApplication()) return;
|
|
165
|
-
const value = titleVisibilityValues[titleVisibility];
|
|
166
|
-
const application = UIApplication.sharedApplication;
|
|
167
|
-
forEachNativeObject(application?.connectedScenes, (scene) => {
|
|
168
|
-
const titlebar = titlebarForScene(scene);
|
|
169
|
-
if (!titlebar) return;
|
|
170
|
-
setNativeNumber(titlebar, "titleVisibility", value);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
function toolbarForTitlebar(titlebar) {
|
|
174
|
-
let toolbar;
|
|
175
|
-
try {
|
|
176
|
-
toolbar = invokeNativeValue(titlebar, "toolbar");
|
|
177
|
-
} catch {}
|
|
178
|
-
try {
|
|
179
|
-
toolbar ??= titlebar.toolbar;
|
|
180
|
-
} catch {}
|
|
181
|
-
try {
|
|
182
|
-
if (!toolbar && titlebar.valueForKey) toolbar = titlebar.valueForKey("toolbar");
|
|
183
|
-
} catch {}
|
|
184
|
-
if (toolbar) return toolbar;
|
|
185
|
-
toolbar = createMacOSToolbar("BleamToolbar");
|
|
186
|
-
if (!toolbar) return;
|
|
187
|
-
try {
|
|
188
|
-
if (invokeNativeValue(titlebar, "setToolbar:", toolbar) !== void 0) return toolbar;
|
|
189
|
-
} catch {}
|
|
190
|
-
try {
|
|
191
|
-
if (setNativeValue(titlebar, "toolbar", toolbar)) return toolbar;
|
|
192
|
-
} catch {}
|
|
193
|
-
try {
|
|
194
|
-
if (titlebar.setValueForKey) {
|
|
195
|
-
titlebar.setValueForKey(toolbar, "toolbar");
|
|
196
|
-
return toolbar;
|
|
197
|
-
}
|
|
198
|
-
} catch {}
|
|
199
|
-
}
|
|
200
|
-
function applyToolbarStyle(toolbarStyle) {
|
|
201
|
-
if (!macOSApplication()) return;
|
|
202
|
-
const value = toolbarStyleValues[toolbarStyle];
|
|
203
|
-
const application = UIApplication.sharedApplication;
|
|
204
|
-
forEachNativeObject(application?.connectedScenes, (scene) => {
|
|
205
|
-
const titlebar = titlebarForScene(scene);
|
|
206
|
-
if (!titlebar) return;
|
|
207
|
-
toolbarForTitlebar(titlebar);
|
|
208
|
-
setNativeNumber(titlebar, "toolbarStyle", value);
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
function Window(props) {
|
|
212
|
-
const { title, tint, backgroundColor, userInterfaceStyle, titleVisibility } = props;
|
|
213
|
-
useLayoutEffect(() => {
|
|
214
|
-
return runOnUIWithRetry(() => {
|
|
215
|
-
applyWindowRootTransparency();
|
|
216
|
-
});
|
|
217
|
-
}, []);
|
|
218
|
-
useEffect(() => {
|
|
219
|
-
if (title === void 0) return;
|
|
220
|
-
ensureNativeScript().runOnUI(() => {
|
|
221
|
-
applyWindowTitle(title);
|
|
222
|
-
}).catch(() => {});
|
|
223
|
-
}, [title]);
|
|
224
|
-
useLayoutEffect(() => {
|
|
225
|
-
if (tint === void 0) return;
|
|
226
|
-
return runOnUIWithRetry(() => {
|
|
227
|
-
applyWindowTint(tint);
|
|
228
|
-
});
|
|
229
|
-
}, [tint]);
|
|
230
|
-
useLayoutEffect(() => {
|
|
231
|
-
if (backgroundColor === void 0) return;
|
|
232
|
-
return runOnUIWithRetry(() => {
|
|
233
|
-
applyWindowBackgroundColor(backgroundColor);
|
|
234
|
-
});
|
|
235
|
-
}, [backgroundColor]);
|
|
236
|
-
useLayoutEffect(() => {
|
|
237
|
-
if (userInterfaceStyle === void 0) return;
|
|
238
|
-
return runOnUIWithRetry(() => {
|
|
239
|
-
applyWindowUserInterfaceStyle(userInterfaceStyle);
|
|
240
|
-
});
|
|
241
|
-
}, [userInterfaceStyle]);
|
|
242
|
-
useEffect(() => {
|
|
243
|
-
if (titleVisibility === void 0) return;
|
|
244
|
-
ensureNativeScript().runOnUI(() => {
|
|
245
|
-
applyTitleVisibility(titleVisibility);
|
|
246
|
-
}).catch(() => {});
|
|
247
|
-
}, [titleVisibility]);
|
|
248
|
-
return null;
|
|
249
|
-
}
|
|
250
|
-
function Toolbar(props) {
|
|
251
|
-
const { toolbarStyle } = props;
|
|
252
|
-
useEffect(() => {
|
|
253
|
-
if (toolbarStyle === void 0) return;
|
|
254
|
-
ensureNativeScript().runOnUI(() => {
|
|
255
|
-
applyToolbarStyle(toolbarStyle);
|
|
256
|
-
}).catch(() => {});
|
|
257
|
-
}, [toolbarStyle]);
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
//#endregion
|
|
262
|
-
export { Toolbar, Window };
|
package/dist/fs.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/fs.ts
|
|
3
|
-
const fs = {
|
|
4
|
-
readText() {
|
|
5
|
-
throw new Error("bleam/fs is not available in this runtime yet");
|
|
6
|
-
},
|
|
7
|
-
writeText() {
|
|
8
|
-
throw new Error("bleam/fs is not available in this runtime yet");
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
exports.fs = fs;
|
package/dist/fs.d.cts
DELETED
package/dist/fs.d.ts
DELETED
package/dist/fs.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { t as ensureNativeScript } from "./native-runtime-C85Nuc4F.js";
|
|
2
|
-
|
|
3
|
-
//#region src/native-macos.ts
|
|
4
|
-
function macOSApplication() {
|
|
5
|
-
return ensureNativeScript().getClass("NSApplication")?.sharedApplication;
|
|
6
|
-
}
|
|
7
|
-
function createMacOSToolbar(identifier) {
|
|
8
|
-
const toolbarClass = ensureNativeScript().getClass("NSToolbar");
|
|
9
|
-
if (!toolbarClass) return;
|
|
10
|
-
try {
|
|
11
|
-
const toolbar = toolbarClass.alloc?.().initWithIdentifier?.(identifier);
|
|
12
|
-
if (toolbar) return toolbar;
|
|
13
|
-
} catch {}
|
|
14
|
-
try {
|
|
15
|
-
return toolbarClass.new?.();
|
|
16
|
-
} catch {}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { macOSApplication as n, createMacOSToolbar as t };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const require_native_runtime = require('./native-runtime-CsXnXkQn.cjs');
|
|
2
|
-
|
|
3
|
-
//#region src/native-macos.ts
|
|
4
|
-
function macOSApplication() {
|
|
5
|
-
return require_native_runtime.ensureNativeScript().getClass("NSApplication")?.sharedApplication;
|
|
6
|
-
}
|
|
7
|
-
function createMacOSToolbar(identifier) {
|
|
8
|
-
const toolbarClass = require_native_runtime.ensureNativeScript().getClass("NSToolbar");
|
|
9
|
-
if (!toolbarClass) return;
|
|
10
|
-
try {
|
|
11
|
-
const toolbar = toolbarClass.alloc?.().initWithIdentifier?.(identifier);
|
|
12
|
-
if (toolbar) return toolbar;
|
|
13
|
-
} catch {}
|
|
14
|
-
try {
|
|
15
|
-
return toolbarClass.new?.();
|
|
16
|
-
} catch {}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
Object.defineProperty(exports, 'createMacOSToolbar', {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return createMacOSToolbar;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(exports, 'macOSApplication', {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return macOSApplication;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as _nativescript_react_native2 from "@nativescript/react-native";
|
|
2
|
-
|
|
3
|
-
//#region src/native-runtime.d.ts
|
|
4
|
-
declare function ensureNativeScript(): {
|
|
5
|
-
init: typeof _nativescript_react_native2.init;
|
|
6
|
-
install: typeof _nativescript_react_native2.install;
|
|
7
|
-
installGlobals: typeof _nativescript_react_native2.installGlobals;
|
|
8
|
-
isInstalled: typeof _nativescript_react_native2.isInstalled;
|
|
9
|
-
defaultMetadataPath: typeof _nativescript_react_native2.defaultMetadataPath;
|
|
10
|
-
defineUIKitContainer: typeof _nativescript_react_native2.defineUIKitContainer;
|
|
11
|
-
defineUIKitView: typeof _nativescript_react_native2.defineUIKitView;
|
|
12
|
-
defineUIViewController: typeof _nativescript_react_native2.defineUIViewController;
|
|
13
|
-
getRuntimeBackend: typeof _nativescript_react_native2.getRuntimeBackend;
|
|
14
|
-
assertUIKitThread: typeof _nativescript_react_native2.assertUIKitThread;
|
|
15
|
-
createDelegate: typeof _nativescript_react_native2.createDelegate;
|
|
16
|
-
createEventBridge: typeof _nativescript_react_native2.createEventBridge;
|
|
17
|
-
createRetainer: typeof _nativescript_react_native2.createRetainer;
|
|
18
|
-
eventBridge: typeof _nativescript_react_native2.eventBridge;
|
|
19
|
-
getClass: typeof _nativescript_react_native2.getClass;
|
|
20
|
-
getProtocol: typeof _nativescript_react_native2.getProtocol;
|
|
21
|
-
isClassAvailable: typeof _nativescript_react_native2.isClassAvailable;
|
|
22
|
-
isFrameworkLoaded: typeof _nativescript_react_native2.isFrameworkLoaded;
|
|
23
|
-
isMainThread: typeof _nativescript_react_native2.isMainThread;
|
|
24
|
-
jsInvoker: typeof _nativescript_react_native2.jsInvoker;
|
|
25
|
-
loadFramework: typeof _nativescript_react_native2.loadFramework;
|
|
26
|
-
release: typeof _nativescript_react_native2.release;
|
|
27
|
-
retain: typeof _nativescript_react_native2.retain;
|
|
28
|
-
runOnUI: typeof _nativescript_react_native2.runOnUI;
|
|
29
|
-
uiInvoker: typeof _nativescript_react_native2.uiInvoker;
|
|
30
|
-
warnIfNotUIKitThread: typeof _nativescript_react_native2.warnIfNotUIKitThread;
|
|
31
|
-
};
|
|
32
|
-
//#endregion
|
|
33
|
-
export { ensureNativeScript as t };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as _nativescript_react_native2 from "@nativescript/react-native";
|
|
2
|
-
|
|
3
|
-
//#region src/native-runtime.d.ts
|
|
4
|
-
declare function ensureNativeScript(): {
|
|
5
|
-
init: typeof _nativescript_react_native2.init;
|
|
6
|
-
install: typeof _nativescript_react_native2.install;
|
|
7
|
-
installGlobals: typeof _nativescript_react_native2.installGlobals;
|
|
8
|
-
isInstalled: typeof _nativescript_react_native2.isInstalled;
|
|
9
|
-
defaultMetadataPath: typeof _nativescript_react_native2.defaultMetadataPath;
|
|
10
|
-
defineUIKitContainer: typeof _nativescript_react_native2.defineUIKitContainer;
|
|
11
|
-
defineUIKitView: typeof _nativescript_react_native2.defineUIKitView;
|
|
12
|
-
defineUIViewController: typeof _nativescript_react_native2.defineUIViewController;
|
|
13
|
-
getRuntimeBackend: typeof _nativescript_react_native2.getRuntimeBackend;
|
|
14
|
-
assertUIKitThread: typeof _nativescript_react_native2.assertUIKitThread;
|
|
15
|
-
createDelegate: typeof _nativescript_react_native2.createDelegate;
|
|
16
|
-
createEventBridge: typeof _nativescript_react_native2.createEventBridge;
|
|
17
|
-
createRetainer: typeof _nativescript_react_native2.createRetainer;
|
|
18
|
-
eventBridge: typeof _nativescript_react_native2.eventBridge;
|
|
19
|
-
getClass: typeof _nativescript_react_native2.getClass;
|
|
20
|
-
getProtocol: typeof _nativescript_react_native2.getProtocol;
|
|
21
|
-
isClassAvailable: typeof _nativescript_react_native2.isClassAvailable;
|
|
22
|
-
isFrameworkLoaded: typeof _nativescript_react_native2.isFrameworkLoaded;
|
|
23
|
-
isMainThread: typeof _nativescript_react_native2.isMainThread;
|
|
24
|
-
jsInvoker: typeof _nativescript_react_native2.jsInvoker;
|
|
25
|
-
loadFramework: typeof _nativescript_react_native2.loadFramework;
|
|
26
|
-
release: typeof _nativescript_react_native2.release;
|
|
27
|
-
retain: typeof _nativescript_react_native2.retain;
|
|
28
|
-
runOnUI: typeof _nativescript_react_native2.runOnUI;
|
|
29
|
-
uiInvoker: typeof _nativescript_react_native2.uiInvoker;
|
|
30
|
-
warnIfNotUIKitThread: typeof _nativescript_react_native2.warnIfNotUIKitThread;
|
|
31
|
-
};
|
|
32
|
-
//#endregion
|
|
33
|
-
export { ensureNativeScript as t };
|
package/dist/native.cjs
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
const require_native_runtime = require('./native-runtime-CsXnXkQn.cjs');
|
|
2
|
-
const require_native_macos = require('./native-macos-DLwo_ii9.cjs');
|
|
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 require_native_runtime.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 = require_native_macos.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 = require_native_runtime.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: require_native_runtime.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
|
-
exports.native = native;
|
package/dist/native.d.cts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { t as ensureNativeScript } from "./native-runtime-CbPzrs8j.cjs";
|
|
2
|
-
import * as _nativescript_react_native1 from "@nativescript/react-native";
|
|
3
|
-
|
|
4
|
-
//#region src/native.d.ts
|
|
5
|
-
declare function runOnUI<T>(callback: () => T): Promise<void>;
|
|
6
|
-
declare function setTintColor(hex: string): Promise<void>;
|
|
7
|
-
declare function setWindowTitle(title: string): Promise<void>;
|
|
8
|
-
declare function writeDocumentText(name: string, text: string): Promise<void>;
|
|
9
|
-
declare function readDocumentText(name: string): Promise<string>;
|
|
10
|
-
declare function documentExists(name: string): Promise<boolean>;
|
|
11
|
-
declare function listDocuments(): Promise<string[]>;
|
|
12
|
-
type NativeLabelProps = {
|
|
13
|
-
text: string;
|
|
14
|
-
color?: string;
|
|
15
|
-
};
|
|
16
|
-
declare const native: {
|
|
17
|
-
init: typeof ensureNativeScript;
|
|
18
|
-
NativeLabel: _nativescript_react_native1.UIKitViewComponent<NativeLabelProps, UILabel>;
|
|
19
|
-
runOnUI: typeof runOnUI;
|
|
20
|
-
ui: {
|
|
21
|
-
setTintColor: typeof setTintColor;
|
|
22
|
-
};
|
|
23
|
-
files: {
|
|
24
|
-
exists: typeof documentExists;
|
|
25
|
-
listDocuments: typeof listDocuments;
|
|
26
|
-
readText: typeof readDocumentText;
|
|
27
|
-
writeText: typeof writeDocumentText;
|
|
28
|
-
};
|
|
29
|
-
window: {
|
|
30
|
-
setTitle: typeof setWindowTitle;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
//#endregion
|
|
34
|
-
export { native };
|
package/dist/native.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { t as ensureNativeScript } from "./native-runtime-DxHSrsTX.js";
|
|
2
|
-
import * as _nativescript_react_native0 from "@nativescript/react-native";
|
|
3
|
-
|
|
4
|
-
//#region src/native.d.ts
|
|
5
|
-
declare function runOnUI<T>(callback: () => T): Promise<void>;
|
|
6
|
-
declare function setTintColor(hex: string): Promise<void>;
|
|
7
|
-
declare function setWindowTitle(title: string): Promise<void>;
|
|
8
|
-
declare function writeDocumentText(name: string, text: string): Promise<void>;
|
|
9
|
-
declare function readDocumentText(name: string): Promise<string>;
|
|
10
|
-
declare function documentExists(name: string): Promise<boolean>;
|
|
11
|
-
declare function listDocuments(): Promise<string[]>;
|
|
12
|
-
type NativeLabelProps = {
|
|
13
|
-
text: string;
|
|
14
|
-
color?: string;
|
|
15
|
-
};
|
|
16
|
-
declare const native: {
|
|
17
|
-
init: typeof ensureNativeScript;
|
|
18
|
-
NativeLabel: _nativescript_react_native0.UIKitViewComponent<NativeLabelProps, UILabel>;
|
|
19
|
-
runOnUI: typeof runOnUI;
|
|
20
|
-
ui: {
|
|
21
|
-
setTintColor: typeof setTintColor;
|
|
22
|
-
};
|
|
23
|
-
files: {
|
|
24
|
-
exists: typeof documentExists;
|
|
25
|
-
listDocuments: typeof listDocuments;
|
|
26
|
-
readText: typeof readDocumentText;
|
|
27
|
-
writeText: typeof writeDocumentText;
|
|
28
|
-
};
|
|
29
|
-
window: {
|
|
30
|
-
setTitle: typeof setWindowTitle;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
//#endregion
|
|
34
|
-
export { native };
|