nitro-ui-solid 0.0.1 → 0.1.0-preview.0

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/index.js ADDED
@@ -0,0 +1,2134 @@
1
+ import "nitro-ui-runtime";
2
+ import { Application, Application as Application$2, ImageView as ImageView$1, Label as Label$1, MaskedView as MaskedView$1, ScrollView as ScrollView$1, ScrollViewContent as ScrollViewContent$1, ViewController, ViewController as ViewController$1, Window, Window as Window$1, WindowScene } from "nitro-ui-renderer/hybrids";
3
+ import { createRenderer } from "@solidjs/universal";
4
+ import { Errored, For, Loading, Match, Repeat, Reveal, Show, Show as Show$1, Switch, createComponent, createContext, createMemo, createRenderEffect, createRoot, createSignal, flush, getOwner, merge, onCleanup, runWithOwner, untrack, useContext } from "solid-js";
5
+ import "nitro-core";
6
+ import { hasStaticKeys } from "solid-js/internal";
7
+ // \0rolldown/runtime.js
8
+ var __create = Object.create;
9
+ var __defProp = Object.defineProperty;
10
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12
+ var __getProtoOf = Object.getPrototypeOf;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
15
+ var __exportAll = (all, flags) => {
16
+ let target = Object.setPrototypeOf({}, null);
17
+ for (var name in all) __defProp(target, name, {
18
+ get: all[name],
19
+ enumerable: true
20
+ });
21
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
22
+ return flags & 2 ? target : Object.preventExtensions(target);
23
+ };
24
+ var __copyProps = (to, from, except, desc) => {
25
+ if (from && typeof from === "object" || typeof from === "function") {
26
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
27
+ desc = __getOwnPropDesc(from, key);
28
+ __defProp(to, key, {
29
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
30
+ enumerable: !desc || desc.enumerable
31
+ });
32
+ }
33
+ }
34
+ return to;
35
+ };
36
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
38
+ value: mod,
39
+ enumerable: true
40
+ }) : target, mod));
41
+ // src/hostTree.ts
42
+ function hostNode(view) {
43
+ return { view };
44
+ }
45
+ function unlink(parent, child) {
46
+ if (child.previous === void 0) parent.first = child.next;
47
+ else child.previous.next = child.next;
48
+ if (child.next === void 0) parent.last = child.previous;
49
+ else child.next.previous = child.previous;
50
+ child.parent = void 0;
51
+ child.next = void 0;
52
+ child.previous = void 0;
53
+ }
54
+ /** Keeps native siblings and Solid's logical siblings in the same order across moves. */
55
+ function createHostTree(operations) {
56
+ function insertNode(parent, child, anchor) {
57
+ if (parent.view === void 0) throw new TypeError("A marker cannot contain native views.");
58
+ if (anchor !== void 0 && anchor.parent !== parent) throw new RangeError("The insertion anchor belongs to a different parent.");
59
+ if (child === anchor || child.parent === parent && child.next === anchor) return;
60
+ if (child.view !== void 0) {
61
+ let sibling = anchor;
62
+ while (sibling !== void 0 && sibling.view === void 0) sibling = sibling.next;
63
+ if (sibling !== child) operations.insert(parent.view, child.view, sibling?.view);
64
+ }
65
+ if (child.parent !== void 0) unlink(child.parent, child);
66
+ const previous = anchor === void 0 ? parent.last : anchor.previous;
67
+ child.parent = parent;
68
+ child.previous = previous;
69
+ child.next = anchor;
70
+ if (anchor === void 0) parent.last = child;
71
+ else anchor.previous = child;
72
+ if (previous === void 0) parent.first = child;
73
+ else previous.next = child;
74
+ }
75
+ function removeNode(parent, child) {
76
+ if (parent.view === void 0 || child.parent !== parent) throw new RangeError("The node to remove must belong to the specified native parent.");
77
+ if (child.view !== void 0) operations.remove(parent.view, child.view);
78
+ unlink(parent, child);
79
+ }
80
+ return {
81
+ insertNode,
82
+ removeNode
83
+ };
84
+ }
85
+ // src/nativeRenderer.ts
86
+ const ViewControllerContext = createContext();
87
+ const LayoutContext = createContext();
88
+ function wrapView(view, requestLayout) {
89
+ return hostNode({
90
+ view,
91
+ layout: nitroLayout.NLNodeFromHandle(view.layoutNodePtr),
92
+ requestLayout
93
+ });
94
+ }
95
+ function mountView(view) {
96
+ const requestLayout = useContext(LayoutContext);
97
+ onCleanup(() => view.setGestureRecognizers(void 0));
98
+ return wrapView(view, requestLayout);
99
+ }
100
+ const tree = createHostTree({
101
+ insert(parent, child, anchor) {
102
+ if (anchor === void 0) {
103
+ parent.view.appendChild(child.view);
104
+ nitroLayout.NLAppendChild(parent.layout, child.layout);
105
+ } else {
106
+ parent.view.insertBefore(child.view, anchor.view);
107
+ nitroLayout.NLInsertBefore(parent.layout, child.layout, anchor.layout);
108
+ }
109
+ parent.requestLayout();
110
+ },
111
+ remove(parent, child) {
112
+ parent.view.removeChild(child.view);
113
+ nitroLayout.NLRemoveChild(parent.layout, child.layout);
114
+ parent.requestLayout();
115
+ }
116
+ });
117
+ function marker() {
118
+ return hostNode(void 0);
119
+ }
120
+ function setNativeProperty(node, name, value) {
121
+ const handle = node.view;
122
+ if (handle === void 0) throw new TypeError("Cannot set a property on a layout marker.");
123
+ if (name !== "isUserInteractionEnabled" || typeof value !== "boolean" && value !== void 0) throw new TypeError(`Invalid native view property ${name}.`);
124
+ handle.view.isUserInteractionEnabled = value !== false;
125
+ handle.view.afterUpdate();
126
+ }
127
+ const renderer = createRenderer({
128
+ ...tree,
129
+ getParentNode: (node) => node.parent,
130
+ getFirstChild: (node) => node.first,
131
+ getNextSibling: (node) => node.next,
132
+ createSentinel: marker,
133
+ createElement(tag, staticProps) {
134
+ if (tag !== "view") throw new TypeError(`Unknown native element <${tag}>.`);
135
+ const node = mountView(Application$2.createView());
136
+ for (const key in staticProps) setNativeProperty(node, key, staticProps[key]);
137
+ return node;
138
+ },
139
+ createTextNode(text) {
140
+ if (text.length !== 0) throw new TypeError("Wrap text in a Nitro Text component.");
141
+ return marker();
142
+ },
143
+ isTextNode: () => false,
144
+ replaceText(_node, text) {
145
+ if (text.length !== 0) throw new TypeError("Wrap text in a Nitro Text component.");
146
+ },
147
+ setProperty: setNativeProperty
148
+ });
149
+ const { createElement, createTextNode, effect, insertNode, memo, mergeProps, ref, setProp } = renderer;
150
+ const insert = renderer.insert;
151
+ const spread = renderer.spread;
152
+ function applyRef(ref, value) {
153
+ if (typeof ref === "function") ref(value);
154
+ else for (const callback of ref) callback(value);
155
+ }
156
+ function mountSurface(view, solve, content, observe) {
157
+ const layout = nitroLayout.NLNodeFromHandle(view.layoutNodePtr);
158
+ let pending = false;
159
+ let active = true;
160
+ function applyLayout() {
161
+ if (!active || !pending) return;
162
+ pending = false;
163
+ solve(layout);
164
+ nitroLayout.NLApplyLayout(layout);
165
+ }
166
+ function requestLayout() {
167
+ if (!active || pending) return;
168
+ pending = true;
169
+ queueMicrotask(applyLayout);
170
+ }
171
+ const root = wrapView(view, requestLayout);
172
+ const dispose = createRoot((disposeOwner) => {
173
+ onCleanup(() => {
174
+ active = false;
175
+ while (root.first !== void 0) tree.removeNode(root, root.first);
176
+ });
177
+ try {
178
+ const observer = observe?.(requestLayout);
179
+ if (observer !== void 0) onCleanup(() => observer.remove());
180
+ insert(root, () => LayoutContext({
181
+ value: requestLayout,
182
+ get children() {
183
+ return content();
184
+ }
185
+ }));
186
+ } catch (error) {
187
+ disposeOwner();
188
+ throw error;
189
+ }
190
+ return disposeOwner;
191
+ });
192
+ try {
193
+ flush();
194
+ applyLayout();
195
+ } catch (error) {
196
+ dispose();
197
+ throw error;
198
+ }
199
+ return {
200
+ dispose,
201
+ layout: applyLayout
202
+ };
203
+ }
204
+ /** A native-owned container measures its contents without inheriting the previous frame size. */
205
+ function mountPortal(view, content) {
206
+ return mountSurface(view, (layout) => nitroLayout.NLSolve(layout, NaN, NaN), content);
207
+ }
208
+ /** Mounts a Solid tree in a native controller. The disposer releases views and resize observation. */
209
+ function renderRoot(content, controller) {
210
+ const view = controller.view;
211
+ return mountSurface(view, (layout) => {
212
+ const frame = view.getFrame();
213
+ nitroLayout.NLSolve(layout, frame.width, frame.height);
214
+ }, () => ViewControllerContext({
215
+ value: controller,
216
+ get children() {
217
+ return content();
218
+ }
219
+ }), (requestLayout) => controller.addOnSizeChangedListener(requestLayout)).dispose;
220
+ }
221
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/globals.js
222
+ var require_globals = /* @__PURE__ */ __commonJSMin(((exports) => {
223
+ Object.defineProperty(exports, "__esModule", { value: true });
224
+ }));
225
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/AnyHybridObject.js
226
+ var require_AnyHybridObject = /* @__PURE__ */ __commonJSMin(((exports) => {
227
+ Object.defineProperty(exports, "__esModule", { value: true });
228
+ }));
229
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/AnyJSON.js
230
+ var require_AnyJSON = /* @__PURE__ */ __commonJSMin(((exports) => {
231
+ Object.defineProperty(exports, "__esModule", { value: true });
232
+ }));
233
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/BoxedHybridObject.js
234
+ var require_BoxedHybridObject = /* @__PURE__ */ __commonJSMin(((exports) => {
235
+ Object.defineProperty(exports, "__esModule", { value: true });
236
+ }));
237
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/CustomType.js
238
+ var require_CustomType = /* @__PURE__ */ __commonJSMin(((exports) => {
239
+ Object.defineProperty(exports, "__esModule", { value: true });
240
+ }));
241
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/version.js
242
+ var require_version = /* @__PURE__ */ __commonJSMin(((exports) => {
243
+ Object.defineProperty(exports, "__esModule", { value: true });
244
+ exports.version = void 0;
245
+ exports.version = "1.0.0-alpha.nightly.137.gd4793c40b8b8";
246
+ }));
247
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/NitroModules.js
248
+ var require_NitroModules = /* @__PURE__ */ __commonJSMin(((exports) => {
249
+ Object.defineProperty(exports, "__esModule", { value: true });
250
+ exports.NitroModules = void 0;
251
+ const version_js_1 = require_version();
252
+ const proxy = globalThis.NitroModulesProxy;
253
+ if (proxy == null) throw new Error("Nitro Modules must be installed before importing nitro-core.");
254
+ if (proxy.version !== version_js_1.version) console.warn(`The native Nitro Modules version is ${proxy.version}, but the JS version is ${version_js_1.version}. Keep both versions in sync.`);
255
+ exports.NitroModules = proxy;
256
+ }));
257
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/HybridObject.js
258
+ var require_HybridObject = /* @__PURE__ */ __commonJSMin(((exports) => {
259
+ Object.defineProperty(exports, "__esModule", { value: true });
260
+ exports.HybridObject = void 0;
261
+ exports.HybridObject = require_NitroModules().NitroModules.getHybridClass("HybridObject");
262
+ }));
263
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/HybridObjectDecorators.js
264
+ var require_HybridObjectDecorators = /* @__PURE__ */ __commonJSMin(((exports) => {
265
+ Object.defineProperty(exports, "__esModule", { value: true });
266
+ exports.iOS = void 0;
267
+ exports.Apple = Apple;
268
+ exports.Android = Android;
269
+ function createDecoratorCallError(name) {
270
+ return /* @__PURE__ */ new Error(`\`@${name}(...)\` is a Nitrogen annotation for \`export declare class\` HybridObject specs and must never run. If the spec uses \`class\`, change it to \`declare class\`. If a transpiler emitted decorator calls for a declared class, as swc does with decorators enabled, compile \`.nitro.ts\` specs with tsc, esbuild, oxc or Babel instead, or use the library's built output.`);
271
+ }
272
+ /**
273
+ * Selects the Apple implementation (iOS, macOS, tvOS and visionOS) of a declared HybridObject class.
274
+ * Nitrogen reads this literal configuration from the `.nitro.ts` spec.
275
+ * Use it only on an `export declare class`, which emits no JavaScript, so this never runs.
276
+ * @throws Always. A call means the spec uses `class` instead of `declare class`,
277
+ * or a transpiler emitted decorator calls for a declared class.
278
+ */
279
+ function Apple(_options) {
280
+ throw createDecoratorCallError("Apple");
281
+ }
282
+ /**
283
+ * Alias of {@linkcode Apple}. Selects the Apple implementation (iOS, macOS, tvOS and visionOS) of a declared HybridObject class.
284
+ */
285
+ exports.iOS = Apple;
286
+ /**
287
+ * Selects the Android implementation of a declared HybridObject class.
288
+ * Nitrogen reads this literal configuration from the `.nitro.ts` spec.
289
+ * Use it only on an `export declare class`, which emits no JavaScript, so this never runs.
290
+ * @throws Always. A call means the spec uses `class` instead of `declare class`,
291
+ * or a transpiler emitted decorator calls for a declared class.
292
+ */
293
+ function Android(_options) {
294
+ throw createDecoratorCallError("Android");
295
+ }
296
+ }));
297
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/NitroModulesProxy.js
298
+ var require_NitroModulesProxy = /* @__PURE__ */ __commonJSMin(((exports) => {
299
+ Object.defineProperty(exports, "__esModule", { value: true });
300
+ exports.NitroModulesProxy = void 0;
301
+ exports.NitroModulesProxy = require_NitroModules().NitroModules.getHybridClass("NitroModulesProxy");
302
+ }));
303
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/Inline.js
304
+ var require_Inline = /* @__PURE__ */ __commonJSMin(((exports) => {
305
+ Object.defineProperty(exports, "__esModule", { value: true });
306
+ }));
307
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/Int64.js
308
+ var require_Int64 = /* @__PURE__ */ __commonJSMin(((exports) => {
309
+ Object.defineProperty(exports, "__esModule", { value: true });
310
+ }));
311
+ // ../../node_modules/.bun/nitro-core@1.0.0-alpha.nightly.137.gd4793c40b8b8/node_modules/nitro-core/js/lib/commonjs/index.js
312
+ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
313
+ var __createBinding = this$1 && this$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
314
+ if (k2 === void 0) k2 = k;
315
+ var desc = Object.getOwnPropertyDescriptor(m, k);
316
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
317
+ enumerable: true,
318
+ get: function() {
319
+ return m[k];
320
+ }
321
+ };
322
+ Object.defineProperty(o, k2, desc);
323
+ }) : (function(o, m, k, k2) {
324
+ if (k2 === void 0) k2 = k;
325
+ o[k2] = m[k];
326
+ }));
327
+ var __exportStar = this$1 && this$1.__exportStar || function(m, exports) {
328
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
329
+ };
330
+ Object.defineProperty(exports, "__esModule", { value: true });
331
+ exports.Android = exports.iOS = exports.Apple = exports.HybridObject = void 0;
332
+ require_globals();
333
+ __exportStar(require_AnyHybridObject(), exports);
334
+ __exportStar(require_AnyJSON(), exports);
335
+ __exportStar(require_BoxedHybridObject(), exports);
336
+ __exportStar(require_CustomType(), exports);
337
+ var HybridObject_js_1 = require_HybridObject();
338
+ Object.defineProperty(exports, "HybridObject", {
339
+ enumerable: true,
340
+ get: function() {
341
+ return HybridObject_js_1.HybridObject;
342
+ }
343
+ });
344
+ var HybridObjectDecorators_js_1 = require_HybridObjectDecorators();
345
+ Object.defineProperty(exports, "Apple", {
346
+ enumerable: true,
347
+ get: function() {
348
+ return HybridObjectDecorators_js_1.Apple;
349
+ }
350
+ });
351
+ Object.defineProperty(exports, "iOS", {
352
+ enumerable: true,
353
+ get: function() {
354
+ return HybridObjectDecorators_js_1.iOS;
355
+ }
356
+ });
357
+ Object.defineProperty(exports, "Android", {
358
+ enumerable: true,
359
+ get: function() {
360
+ return HybridObjectDecorators_js_1.Android;
361
+ }
362
+ });
363
+ __exportStar(require_NitroModules(), exports);
364
+ __exportStar(require_NitroModulesProxy(), exports);
365
+ __exportStar(require_Inline(), exports);
366
+ __exportStar(require_Int64(), exports);
367
+ }));
368
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/Application.cjs
369
+ var require_Application = /* @__PURE__ */ __commonJSMin(((exports, module) => {
370
+ const { NitroModules } = require_commonjs();
371
+ let hybridClass;
372
+ module.exports = { get Application() {
373
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.Application");
374
+ return hybridClass;
375
+ } };
376
+ }));
377
+ // ../nitro-ui-renderer/src/specs/Application.nitro.ts
378
+ var Application_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
379
+ __reExport(Application_nitro_exports, /* @__PURE__ */ __toESM(require_Application(), 1));
380
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/Label.cjs
381
+ var require_Label = /* @__PURE__ */ __commonJSMin(((exports, module) => {
382
+ const { NitroModules } = require_commonjs();
383
+ let hybridClass;
384
+ module.exports = { get Label() {
385
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.Label");
386
+ return hybridClass;
387
+ } };
388
+ }));
389
+ // ../nitro-ui-renderer/src/specs/Label.nitro.ts
390
+ var Label_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
391
+ __reExport(Label_nitro_exports, /* @__PURE__ */ __toESM(require_Label()));
392
+ // ../nitro-ui-renderer/src/specs/MaskedView.nitro.ts
393
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
394
+ const { NitroModules } = require_commonjs();
395
+ let hybridClass;
396
+ module.exports = { get MaskedView() {
397
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.MaskedView");
398
+ return hybridClass;
399
+ } };
400
+ })))();
401
+ // ../nitro-ui-renderer/src/specs/TextInput/TextInput.nitro.ts
402
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
403
+ const { NitroModules } = require_commonjs();
404
+ let hybridClass;
405
+ module.exports = { get TextInput() {
406
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.TextInput");
407
+ return hybridClass;
408
+ } };
409
+ })))();
410
+ // ../nitro-ui-renderer/src/specs/Screen.nitro.ts
411
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
412
+ const { NitroModules } = require_commonjs();
413
+ let hybridClass;
414
+ module.exports = { get Screen() {
415
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.Screen");
416
+ return hybridClass;
417
+ } };
418
+ })))();
419
+ // ../nitro-ui-renderer/src/specs/ScrollView.nitro.ts
420
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
421
+ const { NitroModules } = require_commonjs();
422
+ let hybridClass;
423
+ module.exports = { get ScrollView() {
424
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.ScrollView");
425
+ return hybridClass;
426
+ } };
427
+ })))();
428
+ // ../nitro-ui-renderer/src/specs/ScrollViewContent.nitro.ts
429
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
430
+ const { NitroModules } = require_commonjs();
431
+ let hybridClass;
432
+ module.exports = { get ScrollViewContent() {
433
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.ScrollViewContent");
434
+ return hybridClass;
435
+ } };
436
+ })))();
437
+ // ../nitro-ui-renderer/src/specs/View.nitro.ts
438
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
439
+ const { NitroModules } = require_commonjs();
440
+ let hybridClass;
441
+ module.exports = { get View() {
442
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.View");
443
+ return hybridClass;
444
+ } };
445
+ })))();
446
+ // ../nitro-ui-renderer/src/specs/ViewController.nitro.ts
447
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
448
+ const { NitroModules } = require_commonjs();
449
+ let hybridClass;
450
+ module.exports = { get ViewController() {
451
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.ViewController");
452
+ return hybridClass;
453
+ } };
454
+ })))();
455
+ // ../nitro-ui-renderer/src/specs/Window.nitro.ts
456
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
457
+ const { NitroModules } = require_commonjs();
458
+ let hybridClass;
459
+ module.exports = { get Window() {
460
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.Window");
461
+ return hybridClass;
462
+ } };
463
+ })))();
464
+ // ../nitro-ui-renderer/src/specs/WindowScene.nitro.ts
465
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
466
+ const { NitroModules } = require_commonjs();
467
+ let hybridClass;
468
+ module.exports = { get WindowScene() {
469
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.WindowScene");
470
+ return hybridClass;
471
+ } };
472
+ })))();
473
+ // ../nitro-ui-renderer/src/specs/Fonts.nitro.ts
474
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
475
+ const { NitroModules } = require_commonjs();
476
+ let hybridClass;
477
+ module.exports = { get Fonts() {
478
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.Fonts");
479
+ return hybridClass;
480
+ } };
481
+ })))();
482
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/ImageView.cjs
483
+ var require_ImageView = /* @__PURE__ */ __commonJSMin(((exports, module) => {
484
+ const { NitroModules } = require_commonjs();
485
+ let hybridClass;
486
+ module.exports = { get ImageView() {
487
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.ImageView");
488
+ return hybridClass;
489
+ } };
490
+ }));
491
+ // ../nitro-ui-renderer/src/specs/Image/ImageView.nitro.ts
492
+ var ImageView_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
493
+ __reExport(ImageView_nitro_exports, /* @__PURE__ */ __toESM(require_ImageView(), 1));
494
+ // ../nitro-ui-renderer/src/specs/Image/ImageFactory.nitro.ts
495
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
496
+ const { NitroModules } = require_commonjs();
497
+ let hybridClass;
498
+ module.exports = { get ImageFactory() {
499
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.ImageFactory");
500
+ return hybridClass;
501
+ } };
502
+ })))();
503
+ // ../nitro-ui-renderer/src/specs/Image/ImageLoader.nitro.ts
504
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
505
+ const { NitroModules } = require_commonjs();
506
+ let hybridClass;
507
+ module.exports = { get ImageLoader() {
508
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.ImageLoader");
509
+ return hybridClass;
510
+ } };
511
+ })))();
512
+ // ../nitro-ui-renderer/src/ViewRegistry.ts
513
+ const viewRegistry = {
514
+ factories: {},
515
+ propSetters: {}
516
+ };
517
+ function registerView(type, factory, propSetters) {
518
+ viewRegistry.factories[type] = factory;
519
+ if (propSetters != null) viewRegistry.propSetters[type] = propSetters;
520
+ return type;
521
+ }
522
+ // ../nitro-ui-renderer/src/getViewLayoutNode.ts
523
+ function getViewLayoutNode(view) {
524
+ return nitroLayout.NLNodeFromHandle(view.layoutNodePtr);
525
+ }
526
+ // ../nitro-ui-renderer/src/LayoutPropSetters.ts
527
+ const directions = /* @__PURE__ */ new Map([
528
+ ["row", nitroLayout.NLRow],
529
+ ["row-reverse", nitroLayout.NLRowReverse],
530
+ ["column", nitroLayout.NLColumn],
531
+ ["column-reverse", nitroLayout.NLColumnReverse]
532
+ ]);
533
+ const wraps = /* @__PURE__ */ new Map([
534
+ ["nowrap", nitroLayout.NLNoWrap],
535
+ ["wrap", nitroLayout.NLWrap],
536
+ ["wrap-reverse", nitroLayout.NLWrapReverse]
537
+ ]);
538
+ const alignments = /* @__PURE__ */ new Map([
539
+ ["auto", nitroLayout.NLAlignAuto],
540
+ ["stretch", nitroLayout.NLAlignStretch],
541
+ ["flex-start", nitroLayout.NLAlignStart],
542
+ ["flex-end", nitroLayout.NLAlignEnd],
543
+ ["center", nitroLayout.NLAlignCenter],
544
+ ["baseline", nitroLayout.NLAlignBaseline]
545
+ ]);
546
+ const justifications = /* @__PURE__ */ new Map([
547
+ ["flex-start", nitroLayout.NLJustifyStart],
548
+ ["center", nitroLayout.NLJustifyCenter],
549
+ ["flex-end", nitroLayout.NLJustifyEnd],
550
+ ["space-between", nitroLayout.NLJustifySpaceBetween],
551
+ ["space-around", nitroLayout.NLJustifySpaceAround],
552
+ ["space-evenly", nitroLayout.NLJustifySpaceEvenly]
553
+ ]);
554
+ const positions = {
555
+ absolute: nitroLayout.NLAbsolute,
556
+ relative: nitroLayout.NLRelative,
557
+ static: nitroLayout.NLStatic
558
+ };
559
+ const overflows = {
560
+ visible: nitroLayout.NLOverflowVisible,
561
+ hidden: nitroLayout.NLOverflowHidden,
562
+ scroll: nitroLayout.NLOverflowScroll
563
+ };
564
+ const emptyLayout = {};
565
+ const fields = {
566
+ width: 1,
567
+ height: 2,
568
+ aspectRatio: -0x80000000,
569
+ minWidth: 0x8000000,
570
+ maxWidth: 268435456,
571
+ minHeight: 536870912,
572
+ maxHeight: 0x40000000,
573
+ flex: 28,
574
+ flexGrow: 4,
575
+ flexShrink: 8,
576
+ flexDirection: 32,
577
+ flexWrap: 16777216,
578
+ gap: 0x6000000,
579
+ rowGap: 33554432,
580
+ columnGap: 67108864,
581
+ justifyContent: 64,
582
+ alignItems: 128,
583
+ alignSelf: 256,
584
+ position: 512,
585
+ left: 1024,
586
+ right: 2048,
587
+ top: 4096,
588
+ bottom: 8192,
589
+ marginLeft: 16384,
590
+ marginRight: 32768,
591
+ marginTop: 65536,
592
+ marginBottom: 131072,
593
+ marginHorizontal: 49152,
594
+ marginVertical: 196608,
595
+ margin: 245760,
596
+ paddingLeft: 262144,
597
+ paddingRight: 524288,
598
+ paddingTop: 1048576,
599
+ paddingBottom: 2097152,
600
+ paddingHorizontal: 786432,
601
+ paddingVertical: 3145728,
602
+ padding: 3932160,
603
+ borderWidth: 4194304,
604
+ overflow: 8388608
605
+ };
606
+ function parsePercent(value) {
607
+ const numeric = value.slice(0, -1);
608
+ const percent = Number(numeric);
609
+ if (!value.endsWith("%") || numeric.trim() === "" || !Number.isFinite(percent)) throw new TypeError(`Invalid layout percentage: ${value}`);
610
+ return percent;
611
+ }
612
+ function setLength(node, value, setter) {
613
+ if (typeof value === "number") setter(node, value, nitroLayout.NLPoint);
614
+ else setter(node, parsePercent(value), nitroLayout.NLPercent);
615
+ }
616
+ function setEdgeLength(node, edge, value, setter) {
617
+ if (typeof value === "number") setter(node, edge, value, nitroLayout.NLPoint);
618
+ else setter(node, edge, parsePercent(value), nitroLayout.NLPercent);
619
+ }
620
+ function marginLength(value) {
621
+ return value === "auto" ? NaN : value ?? 0;
622
+ }
623
+ function gapLength(axisGap, gap) {
624
+ if (axisGap != null && !Number.isNaN(axisGap)) return axisGap;
625
+ return gap ?? 0;
626
+ }
627
+ function applyLayoutProps(view, props, previousProps) {
628
+ if (props === previousProps) return;
629
+ const next = props ?? emptyLayout;
630
+ const previous = previousProps ?? emptyLayout;
631
+ let changed = 0;
632
+ let key;
633
+ for (key in next) if (next[key] !== previous[key]) changed |= fields[key];
634
+ for (key in previous) if (!(key in next) && previous[key] !== void 0) changed |= fields[key];
635
+ if (changed === 0) return;
636
+ const node = getViewLayoutNode(view);
637
+ if (changed & 8388608) {
638
+ const overflow = next.overflow ?? "visible";
639
+ nitroLayout.NLSetOverflow(node, overflows[overflow]);
640
+ view.clipsToBounds = overflow !== "visible";
641
+ }
642
+ if (changed & 1) setLength(node, next.width ?? NaN, nitroLayout.NLSetWidth);
643
+ if (changed & 2) setLength(node, next.height ?? NaN, nitroLayout.NLSetHeight);
644
+ if (changed & -0x80000000) nitroLayout.NLSetAspectRatio(node, next.aspectRatio ?? NaN);
645
+ if (changed & 0x8000000) setLength(node, next.minWidth ?? NaN, nitroLayout.NLSetMinWidth);
646
+ if (changed & 268435456) setLength(node, next.maxWidth ?? NaN, nitroLayout.NLSetMaxWidth);
647
+ if (changed & 536870912) setLength(node, next.minHeight ?? NaN, nitroLayout.NLSetMinHeight);
648
+ if (changed & 0x40000000) setLength(node, next.maxHeight ?? NaN, nitroLayout.NLSetMaxHeight);
649
+ const flex = next.flex ?? 0;
650
+ if (changed & 4) {
651
+ const grow = next.flexGrow ?? Math.max(0, flex);
652
+ nitroLayout.NLSetFlexGrow(node, grow);
653
+ }
654
+ if (changed & 8) {
655
+ const shrink = next.flexShrink ?? Math.max(0, -flex);
656
+ nitroLayout.NLSetFlexShrink(node, shrink);
657
+ }
658
+ if (changed & 16) {
659
+ const basis = flex > 0 ? 0 : NaN;
660
+ nitroLayout.NLSetFlexBasis(node, basis);
661
+ }
662
+ if (changed & 32) {
663
+ const direction = directions.get(next.flexDirection) ?? nitroLayout.NLColumn;
664
+ nitroLayout.NLSetFlexDirection(node, direction);
665
+ }
666
+ if (changed & 16777216) {
667
+ const wrap = wraps.get(next.flexWrap) ?? nitroLayout.NLNoWrap;
668
+ nitroLayout.NLSetFlexWrap(node, wrap);
669
+ }
670
+ if (changed & 33554432) setLength(node, gapLength(next.rowGap, next.gap), nitroLayout.NLSetRowGap);
671
+ if (changed & 67108864) setLength(node, gapLength(next.columnGap, next.gap), nitroLayout.NLSetColumnGap);
672
+ if (changed & 64) {
673
+ const justify = justifications.get(next.justifyContent) ?? nitroLayout.NLJustifyStart;
674
+ nitroLayout.NLSetJustifyContent(node, justify);
675
+ }
676
+ if (changed & 128) {
677
+ const items = alignments.get(next.alignItems) ?? nitroLayout.NLAlignStretch;
678
+ nitroLayout.NLSetAlignItems(node, items);
679
+ }
680
+ if (changed & 256) {
681
+ const self = alignments.get(next.alignSelf) ?? nitroLayout.NLAlignAuto;
682
+ nitroLayout.NLSetAlignSelf(node, self);
683
+ }
684
+ if (changed & 512) {
685
+ const position = next.position ?? "relative";
686
+ nitroLayout.NLSetPositionType(node, positions[position]);
687
+ }
688
+ applyEdges(node, next, changed);
689
+ if (changed & 4194304) {
690
+ const width = next.borderWidth ?? 0;
691
+ nitroLayout.NLSetBorder(node, nitroLayout.NLLeft, width);
692
+ nitroLayout.NLSetBorder(node, nitroLayout.NLRight, width);
693
+ nitroLayout.NLSetBorder(node, nitroLayout.NLTop, width);
694
+ nitroLayout.NLSetBorder(node, nitroLayout.NLBottom, width);
695
+ view.borderWidth = next.borderWidth;
696
+ }
697
+ }
698
+ function applyEdges(node, next, changed) {
699
+ const relativeOffsets = next.position !== "static";
700
+ if (changed & 1536) {
701
+ const left = relativeOffsets ? next.left : void 0;
702
+ setEdgeLength(node, nitroLayout.NLLeft, left ?? NaN, nitroLayout.NLSetInset);
703
+ }
704
+ if (changed & 2560) {
705
+ const right = relativeOffsets ? next.right : void 0;
706
+ setEdgeLength(node, nitroLayout.NLRight, right ?? NaN, nitroLayout.NLSetInset);
707
+ }
708
+ if (changed & 4608) {
709
+ const top = relativeOffsets ? next.top : void 0;
710
+ setEdgeLength(node, nitroLayout.NLTop, top ?? NaN, nitroLayout.NLSetInset);
711
+ }
712
+ if (changed & 8704) {
713
+ const bottom = relativeOffsets ? next.bottom : void 0;
714
+ setEdgeLength(node, nitroLayout.NLBottom, bottom ?? NaN, nitroLayout.NLSetInset);
715
+ }
716
+ if (changed & 16384) {
717
+ const left = marginLength(next.marginLeft ?? next.marginHorizontal ?? next.margin);
718
+ setEdgeLength(node, nitroLayout.NLLeft, left, nitroLayout.NLSetMargin);
719
+ }
720
+ if (changed & 32768) {
721
+ const right = marginLength(next.marginRight ?? next.marginHorizontal ?? next.margin);
722
+ setEdgeLength(node, nitroLayout.NLRight, right, nitroLayout.NLSetMargin);
723
+ }
724
+ if (changed & 65536) {
725
+ const top = marginLength(next.marginTop ?? next.marginVertical ?? next.margin);
726
+ setEdgeLength(node, nitroLayout.NLTop, top, nitroLayout.NLSetMargin);
727
+ }
728
+ if (changed & 131072) {
729
+ const bottom = marginLength(next.marginBottom ?? next.marginVertical ?? next.margin);
730
+ setEdgeLength(node, nitroLayout.NLBottom, bottom, nitroLayout.NLSetMargin);
731
+ }
732
+ if (changed & 262144) {
733
+ const left = next.paddingLeft ?? next.paddingHorizontal ?? next.padding ?? 0;
734
+ setEdgeLength(node, nitroLayout.NLLeft, left, nitroLayout.NLSetPadding);
735
+ }
736
+ if (changed & 524288) {
737
+ const right = next.paddingRight ?? next.paddingHorizontal ?? next.padding ?? 0;
738
+ setEdgeLength(node, nitroLayout.NLRight, right, nitroLayout.NLSetPadding);
739
+ }
740
+ if (changed & 1048576) {
741
+ const top = next.paddingTop ?? next.paddingVertical ?? next.padding ?? 0;
742
+ setEdgeLength(node, nitroLayout.NLTop, top, nitroLayout.NLSetPadding);
743
+ }
744
+ if (changed & 2097152) {
745
+ const bottom = next.paddingBottom ?? next.paddingVertical ?? next.padding ?? 0;
746
+ setEdgeLength(node, nitroLayout.NLBottom, bottom, nitroLayout.NLSetPadding);
747
+ }
748
+ }
749
+ // ../nitro-ui-renderer/src/PropSetter.ts
750
+ /**
751
+ * Takes an array of prop names, and a setter function.
752
+ * Whenever one of the props in the group changes, the setter function will be called with all props.
753
+ */
754
+ function groupPropSetter(propNames, setter) {
755
+ return (target, props, propName, previousProps) => {
756
+ for (const groupedPropName of propNames) {
757
+ if (props[groupedPropName] === previousProps?.[groupedPropName]) continue;
758
+ if (propName === groupedPropName) setter(target, props);
759
+ return;
760
+ }
761
+ };
762
+ }
763
+ // ../nitro-ui-renderer/src/utils/arePropArraysEqual.ts
764
+ /** Benchmarked, fastest implementation for hermes to compare arrays */
765
+ function arePropArraysEqual(values, previousValues) {
766
+ if (values.length !== previousValues.length) return false;
767
+ return values.findIndex((value, index) => {
768
+ return value !== previousValues[index];
769
+ }) === -1;
770
+ }
771
+ // ../nitro-ui-renderer/src/normalizeColor.ts
772
+ /**
773
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
774
+ *
775
+ * This source code is licensed under the MIT license found in the
776
+ * LICENSE file in the root directory of this source tree.
777
+ *
778
+ * Adapted from https://github.com/facebook/react-native/blob/3aee67bcb698900efcffe9b03c775e14d8ad4e30/packages/normalize-color/index.js
779
+ */
780
+ const cachedColors = /* @__PURE__ */ new Map();
781
+ /** Converts a CSS color string or 0xRRGGBBAA number to 0xRRGGBBAA, or null if it is not a color. */
782
+ function normalizeColor(color) {
783
+ if (typeof color === "number") {
784
+ if (color >>> 0 === color && color >= 0 && color <= 0xffffffff) return color;
785
+ return null;
786
+ }
787
+ if (typeof color !== "string") return null;
788
+ const cachedColor = cachedColors.get(color);
789
+ if (cachedColor !== void 0) return cachedColor;
790
+ const normalizedColor = parseColorString(color);
791
+ if (cachedColors.size >= 1024) cachedColors.delete(cachedColors.keys().next().value);
792
+ cachedColors.set(color, normalizedColor);
793
+ return normalizedColor;
794
+ }
795
+ function parseColorString(color) {
796
+ const matchers = getMatchers();
797
+ let match;
798
+ if (match = matchers.hex6.exec(color)) return parseInt(match[1] + "ff", 16) >>> 0;
799
+ const colorFromKeyword = normalizeKeyword(color);
800
+ if (colorFromKeyword != null) return colorFromKeyword;
801
+ if (match = matchers.rgba.exec(color) || matchers.rgb.exec(color)) {
802
+ if (match[9] !== void 0) return (parse255(match[9]) << 24 | parse255(match[10]) << 16 | parse255(match[11]) << 8 | parse1(match[12])) >>> 0;
803
+ else if (match[5] !== void 0) return (parse255(match[5]) << 24 | parse255(match[6]) << 16 | parse255(match[7]) << 8 | parse1(match[8])) >>> 0;
804
+ return (parse255(match[2]) << 24 | parse255(match[3]) << 16 | parse255(match[4]) << 8 | 255) >>> 0;
805
+ }
806
+ if (match = matchers.hex3.exec(color)) return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", 16) >>> 0;
807
+ if (match = matchers.hex8.exec(color)) return parseInt(match[1], 16) >>> 0;
808
+ if (match = matchers.hex4.exec(color)) return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
809
+ if (match = matchers.hsla.exec(color) || matchers.hsl.exec(color)) {
810
+ if (match[9] !== void 0) return (hslToRgb(parse360(match[9]), parsePercentage(match[10]), parsePercentage(match[11])) | parse1(match[12])) >>> 0;
811
+ else if (match[5] !== void 0) return (hslToRgb(parse360(match[5]), parsePercentage(match[6]), parsePercentage(match[7])) | parse1(match[8])) >>> 0;
812
+ return (hslToRgb(parse360(match[2]), parsePercentage(match[3]), parsePercentage(match[4])) | 255) >>> 0;
813
+ }
814
+ if (match = matchers.hwb.exec(color)) {
815
+ if (match[5] !== void 0) return (hwbToRgb(parse360(match[5]), parsePercentage(match[6]), parsePercentage(match[7])) | parse1(match[8])) >>> 0;
816
+ return (hwbToRgb(parse360(match[2]), parsePercentage(match[3]), parsePercentage(match[4])) | 255) >>> 0;
817
+ }
818
+ return null;
819
+ }
820
+ function hue2rgb(p, q, t) {
821
+ if (t < 0) t += 1;
822
+ if (t > 1) t -= 1;
823
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
824
+ if (t < .5) return q;
825
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
826
+ return p;
827
+ }
828
+ function hslToRgb(h, s, l) {
829
+ const q = l < .5 ? l * (1 + s) : l + s - l * s;
830
+ const p = 2 * l - q;
831
+ const r = hue2rgb(p, q, h + 1 / 3);
832
+ const g = hue2rgb(p, q, h);
833
+ const b = hue2rgb(p, q, h - 1 / 3);
834
+ return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
835
+ }
836
+ function hwbToRgb(h, w, b) {
837
+ if (w + b >= 1) {
838
+ const gray = Math.round(w * 255 / (w + b));
839
+ return gray << 24 | gray << 16 | gray << 8;
840
+ }
841
+ const red = hue2rgb(0, 1, h + 1 / 3) * (1 - w - b) + w;
842
+ const green = hue2rgb(0, 1, h) * (1 - w - b) + w;
843
+ const blue = hue2rgb(0, 1, h - 1 / 3) * (1 - w - b) + w;
844
+ return Math.round(red * 255) << 24 | Math.round(green * 255) << 16 | Math.round(blue * 255) << 8;
845
+ }
846
+ const NUMBER = "[-+]?\\d*\\.?\\d+";
847
+ const PERCENTAGE = NUMBER + "%";
848
+ const ALPHA = NUMBER + "%?";
849
+ function call(...args) {
850
+ return "\\(\\s*(" + args.join(")\\s*,?\\s*(") + ")\\s*\\)";
851
+ }
852
+ function callModern(...args) {
853
+ return "\\(\\s*(" + args.join(")\\s*(") + ")\\s*\\)";
854
+ }
855
+ function callWithSlashSeparator(...args) {
856
+ return "\\(\\s*(" + args.slice(0, args.length - 1).join(")\\s*,?\\s*(") + ")\\s*/\\s*(" + args[args.length - 1] + ")\\s*\\)";
857
+ }
858
+ function commaSeparatedCall(...args) {
859
+ return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
860
+ }
861
+ let cachedMatchers;
862
+ function getMatchers() {
863
+ if (cachedMatchers === void 0) {
864
+ const rgbRegexPattern = call(NUMBER, NUMBER, NUMBER) + "|" + commaSeparatedCall(NUMBER, NUMBER, NUMBER, ALPHA) + "|" + callWithSlashSeparator(NUMBER, NUMBER, NUMBER, ALPHA);
865
+ const hslRegexPattern = call(NUMBER, PERCENTAGE, PERCENTAGE) + "|" + commaSeparatedCall(NUMBER, PERCENTAGE, PERCENTAGE, ALPHA) + "|" + callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, ALPHA);
866
+ cachedMatchers = {
867
+ rgb: new RegExp("^rgb(" + rgbRegexPattern + ")$"),
868
+ rgba: new RegExp("^rgba(" + rgbRegexPattern + ")$"),
869
+ hsl: new RegExp("^hsl(" + hslRegexPattern + ")$"),
870
+ hsla: new RegExp("^hsla(" + hslRegexPattern + ")$"),
871
+ hwb: new RegExp("^hwb(" + callModern(NUMBER, PERCENTAGE, PERCENTAGE) + "|" + callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, ALPHA) + ")$"),
872
+ hex3: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
873
+ hex4: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
874
+ hex6: /^#([0-9a-fA-F]{6})$/,
875
+ hex8: /^#([0-9a-fA-F]{8})$/
876
+ };
877
+ }
878
+ return cachedMatchers;
879
+ }
880
+ function parse255(str) {
881
+ const int = parseInt(str, 10);
882
+ if (int < 0) return 0;
883
+ if (int > 255) return 255;
884
+ return int;
885
+ }
886
+ function parse360(str) {
887
+ return (parseFloat(str) % 360 + 360) % 360 / 360;
888
+ }
889
+ function parse1(str) {
890
+ const num = str.endsWith("%") ? parseFloat(str) / 100 : parseFloat(str);
891
+ if (num < 0) return 0;
892
+ if (num > 1) return 255;
893
+ return Math.round(num * 255);
894
+ }
895
+ function parsePercentage(str) {
896
+ const int = parseFloat(str);
897
+ if (int < 0) return 0;
898
+ if (int > 100) return 1;
899
+ return int / 100;
900
+ }
901
+ function normalizeKeyword(name) {
902
+ switch (name) {
903
+ case "transparent": return 0;
904
+ case "aliceblue": return 0xf0f8ffff;
905
+ case "antiquewhite": return 0xfaebd7ff;
906
+ case "aqua": return 0xffffff;
907
+ case "aquamarine": return 0x7fffd4ff;
908
+ case "azure": return 0xf0ffffff;
909
+ case "beige": return 0xf5f5dcff;
910
+ case "bisque": return 0xffe4c4ff;
911
+ case "black": return 255;
912
+ case "blanchedalmond": return 0xffebcdff;
913
+ case "blue": return 65535;
914
+ case "blueviolet": return 0x8a2be2ff;
915
+ case "brown": return 0xa52a2aff;
916
+ case "burlywood": return 0xdeb887ff;
917
+ case "burntsienna": return 0xea7e5dff;
918
+ case "cadetblue": return 0x5f9ea0ff;
919
+ case "chartreuse": return 0x7fff00ff;
920
+ case "chocolate": return 0xd2691eff;
921
+ case "coral": return 0xff7f50ff;
922
+ case "cornflowerblue": return 0x6495edff;
923
+ case "cornsilk": return 0xfff8dcff;
924
+ case "crimson": return 0xdc143cff;
925
+ case "cyan": return 0xffffff;
926
+ case "darkblue": return 35839;
927
+ case "darkcyan": return 9145343;
928
+ case "darkgoldenrod": return 0xb8860bff;
929
+ case "darkgray": return 0xa9a9a9ff;
930
+ case "darkgreen": return 6553855;
931
+ case "darkgrey": return 0xa9a9a9ff;
932
+ case "darkkhaki": return 0xbdb76bff;
933
+ case "darkmagenta": return 0x8b008bff;
934
+ case "darkolivegreen": return 0x556b2fff;
935
+ case "darkorange": return 0xff8c00ff;
936
+ case "darkorchid": return 0x9932ccff;
937
+ case "darkred": return 0x8b0000ff;
938
+ case "darksalmon": return 0xe9967aff;
939
+ case "darkseagreen": return 0x8fbc8fff;
940
+ case "darkslateblue": return 0x483d8bff;
941
+ case "darkslategray": return 793726975;
942
+ case "darkslategrey": return 793726975;
943
+ case "darkturquoise": return 0xced1ff;
944
+ case "darkviolet": return 0x9400d3ff;
945
+ case "deeppink": return 0xff1493ff;
946
+ case "deepskyblue": return 0xbfffff;
947
+ case "dimgray": return 0x696969ff;
948
+ case "dimgrey": return 0x696969ff;
949
+ case "dodgerblue": return 512819199;
950
+ case "firebrick": return 0xb22222ff;
951
+ case "floralwhite": return 0xfffaf0ff;
952
+ case "forestgreen": return 579543807;
953
+ case "fuchsia": return 0xff00ffff;
954
+ case "gainsboro": return 0xdcdcdcff;
955
+ case "ghostwhite": return 0xf8f8ffff;
956
+ case "gold": return 0xffd700ff;
957
+ case "goldenrod": return 0xdaa520ff;
958
+ case "gray": return 0x808080ff;
959
+ case "green": return 8388863;
960
+ case "greenyellow": return 0xadff2fff;
961
+ case "grey": return 0x808080ff;
962
+ case "honeydew": return 0xf0fff0ff;
963
+ case "hotpink": return 0xff69b4ff;
964
+ case "indianred": return 0xcd5c5cff;
965
+ case "indigo": return 0x4b0082ff;
966
+ case "ivory": return 0xfffff0ff;
967
+ case "khaki": return 0xf0e68cff;
968
+ case "lavender": return 0xe6e6faff;
969
+ case "lavenderblush": return 0xfff0f5ff;
970
+ case "lawngreen": return 0x7cfc00ff;
971
+ case "lemonchiffon": return 0xfffacdff;
972
+ case "lightblue": return 0xadd8e6ff;
973
+ case "lightcoral": return 0xf08080ff;
974
+ case "lightcyan": return 0xe0ffffff;
975
+ case "lightgoldenrodyellow": return 0xfafad2ff;
976
+ case "lightgray": return 0xd3d3d3ff;
977
+ case "lightgreen": return 0x90ee90ff;
978
+ case "lightgrey": return 0xd3d3d3ff;
979
+ case "lightpink": return 0xffb6c1ff;
980
+ case "lightsalmon": return 0xffa07aff;
981
+ case "lightseagreen": return 548580095;
982
+ case "lightskyblue": return 0x87cefaff;
983
+ case "lightslategray": return 0x778899ff;
984
+ case "lightslategrey": return 0x778899ff;
985
+ case "lightsteelblue": return 0xb0c4deff;
986
+ case "lightyellow": return 0xffffe0ff;
987
+ case "lime": return 0xff00ff;
988
+ case "limegreen": return 852308735;
989
+ case "linen": return 0xfaf0e6ff;
990
+ case "magenta": return 0xff00ffff;
991
+ case "maroon": return 0x800000ff;
992
+ case "mediumaquamarine": return 0x66cdaaff;
993
+ case "mediumblue": return 52735;
994
+ case "mediumorchid": return 0xba55d3ff;
995
+ case "mediumpurple": return 0x9370dbff;
996
+ case "mediumseagreen": return 0x3cb371ff;
997
+ case "mediumslateblue": return 0x7b68eeff;
998
+ case "mediumspringgreen": return 0xfa9aff;
999
+ case "mediumturquoise": return 0x48d1ccff;
1000
+ case "mediumvioletred": return 0xc71585ff;
1001
+ case "midnightblue": return 421097727;
1002
+ case "mintcream": return 0xf5fffaff;
1003
+ case "mistyrose": return 0xffe4e1ff;
1004
+ case "moccasin": return 0xffe4b5ff;
1005
+ case "navajowhite": return 0xffdeadff;
1006
+ case "navy": return 33023;
1007
+ case "oldlace": return 0xfdf5e6ff;
1008
+ case "olive": return 0x808000ff;
1009
+ case "olivedrab": return 0x6b8e23ff;
1010
+ case "orange": return 0xffa500ff;
1011
+ case "orangered": return 0xff4500ff;
1012
+ case "orchid": return 0xda70d6ff;
1013
+ case "palegoldenrod": return 0xeee8aaff;
1014
+ case "palegreen": return 0x98fb98ff;
1015
+ case "paleturquoise": return 0xafeeeeff;
1016
+ case "palevioletred": return 0xdb7093ff;
1017
+ case "papayawhip": return 0xffefd5ff;
1018
+ case "peachpuff": return 0xffdab9ff;
1019
+ case "peru": return 0xcd853fff;
1020
+ case "pink": return 0xffc0cbff;
1021
+ case "plum": return 0xdda0ddff;
1022
+ case "powderblue": return 0xb0e0e6ff;
1023
+ case "purple": return 0x800080ff;
1024
+ case "rebeccapurple": return 0x663399ff;
1025
+ case "red": return 0xff0000ff;
1026
+ case "rosybrown": return 0xbc8f8fff;
1027
+ case "royalblue": return 0x4169e1ff;
1028
+ case "saddlebrown": return 0x8b4513ff;
1029
+ case "salmon": return 0xfa8072ff;
1030
+ case "sandybrown": return 0xf4a460ff;
1031
+ case "seagreen": return 780883967;
1032
+ case "seashell": return 0xfff5eeff;
1033
+ case "sienna": return 0xa0522dff;
1034
+ case "silver": return 0xc0c0c0ff;
1035
+ case "skyblue": return 0x87ceebff;
1036
+ case "slateblue": return 0x6a5acdff;
1037
+ case "slategray": return 0x708090ff;
1038
+ case "slategrey": return 0x708090ff;
1039
+ case "snow": return 0xfffafaff;
1040
+ case "springgreen": return 0xff7fff;
1041
+ case "steelblue": return 0x4682b4ff;
1042
+ case "tan": return 0xd2b48cff;
1043
+ case "teal": return 8421631;
1044
+ case "thistle": return 0xd8bfd8ff;
1045
+ case "tomato": return 0xff6347ff;
1046
+ case "turquoise": return 0x40e0d0ff;
1047
+ case "violet": return 0xee82eeff;
1048
+ case "wheat": return 0xf5deb3ff;
1049
+ case "white": return 0xffffffff;
1050
+ case "whitesmoke": return 0xf5f5f5ff;
1051
+ case "yellow": return 0xffff00ff;
1052
+ case "yellowgreen": return 0x9acd32ff;
1053
+ }
1054
+ return null;
1055
+ }
1056
+ // ../nitro-ui-renderer/src/ColorValue.ts
1057
+ /**
1058
+ * Converts a {@linkcode ColorValue} to the 0xRRGGBBAA number that native views take.
1059
+ * @throws If the value is not a valid color.
1060
+ */
1061
+ function processColor(color) {
1062
+ const rgba = normalizeColor(color);
1063
+ if (rgba === null) throw new Error(`Invalid color "${color}".`);
1064
+ return rgba;
1065
+ }
1066
+ // ../nitro-ui-renderer/src/StylePropSetters.ts
1067
+ const StrictMap = Map;
1068
+ const emptyStyleProps = {};
1069
+ const translationPropSetter = groupPropSetter([
1070
+ "translateX",
1071
+ "translateY",
1072
+ "translateZ"
1073
+ ], (view, props) => {
1074
+ const translateX = props.translateX ?? 0;
1075
+ const translateY = props.translateY ?? 0;
1076
+ const translateZ = props.translateZ ?? 0;
1077
+ view.setTranslation(translateX, translateY, translateZ);
1078
+ });
1079
+ const scalePropSetter = groupPropSetter([
1080
+ "scale",
1081
+ "scaleX",
1082
+ "scaleY",
1083
+ "scaleZ"
1084
+ ], (view, props) => {
1085
+ const scale = props.scale ?? 1;
1086
+ const scaleX = props.scaleX ?? scale;
1087
+ const scaleY = props.scaleY ?? scale;
1088
+ const scaleZ = props.scaleZ ?? scale;
1089
+ view.setScale(scaleX, scaleY, scaleZ);
1090
+ });
1091
+ const DEFAULTS = {
1092
+ opacity: 1,
1093
+ rotate: 0,
1094
+ cornerRadius: 0,
1095
+ cornerCurve: "circular"
1096
+ };
1097
+ const sharedStylePropSetters = new StrictMap([
1098
+ ["opacity", (view, props) => {
1099
+ view.opacity = props.opacity ?? DEFAULTS.opacity;
1100
+ }],
1101
+ ["borderColor", (view, props) => {
1102
+ view.setBorderColor(props.borderColor === void 0 ? void 0 : processColor(props.borderColor));
1103
+ }],
1104
+ ["cornerRadius", (view, props) => {
1105
+ view.cornerRadius = props.cornerRadius ?? DEFAULTS.cornerRadius;
1106
+ }],
1107
+ ["maskedCorners", (view, props) => {
1108
+ view.maskedCorners = props.maskedCorners ?? [
1109
+ "topLeft",
1110
+ "topRight",
1111
+ "bottomLeft",
1112
+ "bottomRight"
1113
+ ];
1114
+ }],
1115
+ ["cornerCurve", (view, props) => {
1116
+ view.cornerCurve = props.cornerCurve ?? DEFAULTS.cornerCurve;
1117
+ }],
1118
+ ["translateX", translationPropSetter],
1119
+ ["translateY", translationPropSetter],
1120
+ ["translateZ", translationPropSetter],
1121
+ ["scale", scalePropSetter],
1122
+ ["scaleX", scalePropSetter],
1123
+ ["scaleY", scalePropSetter],
1124
+ ["scaleZ", scalePropSetter],
1125
+ ["rotate", (view, props) => {
1126
+ view.setRotation(props.rotate ?? DEFAULTS.rotate);
1127
+ }]
1128
+ ]);
1129
+ const stylePropSetters = new Map(sharedStylePropSetters);
1130
+ stylePropSetters.set("background", (view, props) => {
1131
+ view.setBackgroundColor(props.background === void 0 ? void 0 : processColor(props.background));
1132
+ });
1133
+ const containerStylePropSetters = new Map(sharedStylePropSetters);
1134
+ containerStylePropSetters.set("background", (view, props, _, previousProps) => {
1135
+ const background = props.background;
1136
+ if (typeof background === "number" || typeof background === "string" || background === void 0) {
1137
+ view.setBackgroundColor(background === void 0 ? void 0 : processColor(background));
1138
+ return;
1139
+ }
1140
+ const previous = previousProps?.background;
1141
+ if (previous !== void 0 && typeof previous === "object") {
1142
+ if (areGradientsEqual(background, previous)) return;
1143
+ }
1144
+ view.setBackgroundGradient({
1145
+ ...background,
1146
+ colors: background.colors.map(processColor)
1147
+ });
1148
+ });
1149
+ function normalizeBoxShadow(shadow) {
1150
+ const color = processColor(shadow.color);
1151
+ return {
1152
+ offsetX: shadow.offsetX,
1153
+ offsetY: shadow.offsetY,
1154
+ blurRadius: shadow.blurRadius ?? 0,
1155
+ spreadDistance: shadow.spreadDistance ?? 0,
1156
+ color,
1157
+ inset: shadow.inset ?? false
1158
+ };
1159
+ }
1160
+ containerStylePropSetters.set("boxShadow", (view, props, _, previousProps) => {
1161
+ const shadows = props.boxShadow;
1162
+ const previous = previousProps?.boxShadow;
1163
+ if (shadows !== void 0 && previous !== void 0 && shadows.length === previous.length) {
1164
+ let index = 0;
1165
+ for (; index < shadows.length; index++) {
1166
+ const shadow = shadows[index];
1167
+ const previousShadow = previous[index];
1168
+ if (shadow === void 0 || previousShadow === void 0) break;
1169
+ if (shadow !== previousShadow && (shadow.color !== previousShadow.color || shadow.offsetX !== previousShadow.offsetX || shadow.offsetY !== previousShadow.offsetY || shadow.blurRadius !== previousShadow.blurRadius || shadow.spreadDistance !== previousShadow.spreadDistance || shadow.inset !== previousShadow.inset)) break;
1170
+ }
1171
+ if (index === shadows.length) return;
1172
+ }
1173
+ view.setBoxShadows(shadows?.map(normalizeBoxShadow) ?? []);
1174
+ });
1175
+ const imageStylePropSetters = new Map(stylePropSetters);
1176
+ imageStylePropSetters.set("filter", (view, props, _, previousProps) => {
1177
+ const filters = props.filter;
1178
+ const previous = previousProps?.filter;
1179
+ if (filters !== void 0 && previous !== void 0 && filters.length === previous.length) {
1180
+ let index = 0;
1181
+ for (; index < filters.length; index++) {
1182
+ const shadow = filters[index]?.dropShadow;
1183
+ const previousShadow = previous[index]?.dropShadow;
1184
+ if (shadow === void 0 || previousShadow === void 0) break;
1185
+ if (shadow !== previousShadow && (shadow.color !== previousShadow.color || shadow.offsetX !== previousShadow.offsetX || shadow.offsetY !== previousShadow.offsetY || shadow.standardDeviation !== previousShadow.standardDeviation)) break;
1186
+ }
1187
+ if (index === filters.length) return;
1188
+ }
1189
+ const shadows = props.filter?.map(({ dropShadow }) => {
1190
+ const color = processColor(dropShadow.color);
1191
+ return {
1192
+ offsetX: dropShadow.offsetX,
1193
+ offsetY: dropShadow.offsetY,
1194
+ standardDeviation: dropShadow.standardDeviation ?? 0,
1195
+ color
1196
+ };
1197
+ }) ?? [];
1198
+ view.setDropShadows(shadows);
1199
+ });
1200
+ imageStylePropSetters.set("tintColor", (view, props) => {
1201
+ view.setTintColor(props.tintColor === void 0 ? void 0 : processColor(props.tintColor));
1202
+ });
1203
+ function areGradientsEqual(gradient, previous) {
1204
+ if ((gradient.start?.x === previous.start?.x && gradient.start?.y === previous.start?.y && gradient.end?.x === previous.end?.x && gradient.end?.y === previous.end?.y) === false) return false;
1205
+ if ((gradient.colors === previous.colors || arePropArraysEqual(gradient.colors, previous.colors)) === false) return false;
1206
+ const locations = gradient.locations;
1207
+ const previousLocations = previous.locations;
1208
+ if (locations === previousLocations) return true;
1209
+ if (locations === void 0 || previousLocations === void 0) return false;
1210
+ return arePropArraysEqual(locations, previousLocations);
1211
+ }
1212
+ function applyStyleProps(view, props, previousProps, setters) {
1213
+ if (props === previousProps) return;
1214
+ const nextProps = props ?? emptyStyleProps;
1215
+ let key;
1216
+ for (key in nextProps) {
1217
+ const value = nextProps[key];
1218
+ const previousValue = previousProps?.[key];
1219
+ if (value === previousValue) continue;
1220
+ if (Array.isArray(value) && Array.isArray(previousValue)) {
1221
+ if (arePropArraysEqual(value, previousValue)) continue;
1222
+ }
1223
+ const setter = setters.get(key);
1224
+ if (setter === void 0) continue;
1225
+ setter(view, nextProps, key, previousProps);
1226
+ }
1227
+ if (previousProps == null) return;
1228
+ for (key in previousProps) {
1229
+ if (key in nextProps || previousProps[key] === void 0) continue;
1230
+ const setter = setters.get(key);
1231
+ if (setter === void 0) continue;
1232
+ setter(view, nextProps, key, previousProps);
1233
+ }
1234
+ }
1235
+ // ../nitro-ui-renderer/src/ViewPropSetters.ts
1236
+ const viewPropsSetters = {
1237
+ layout: applyLayoutProps,
1238
+ style: (view, style, previousStyle) => {
1239
+ applyStyleProps(view, style, previousStyle, stylePropSetters);
1240
+ },
1241
+ gestureRecognizers: (view, value) => {
1242
+ view.setGestureRecognizers(value);
1243
+ },
1244
+ isUserInteractionEnabled: (view, value) => {
1245
+ view.isUserInteractionEnabled = value ?? true;
1246
+ }
1247
+ };
1248
+ // ../nitro-ui-renderer/src/components/View.ts
1249
+ const containerSetters = {
1250
+ ...viewPropsSetters,
1251
+ style: (view, style, previousStyle) => {
1252
+ applyStyleProps(view, style, previousStyle, containerStylePropSetters);
1253
+ }
1254
+ };
1255
+ registerView("View", () => Application_nitro_exports.Application.createView(), containerSetters);
1256
+ // ../nitro-ui-renderer/src/components/Text.tsx
1257
+ const labelSetters = {
1258
+ ...viewPropsSetters,
1259
+ text: (view, newText) => {
1260
+ view.text = newText;
1261
+ },
1262
+ children: (view, childrenAsText) => {
1263
+ let text = childrenAsText;
1264
+ if (Array.isArray(text)) text = text.join("");
1265
+ view.text = text;
1266
+ },
1267
+ color(view, value) {
1268
+ view.color = value === void 0 ? 255 : processColor(value);
1269
+ },
1270
+ fontSize(view, value) {
1271
+ view.fontSize = value ?? 17;
1272
+ },
1273
+ fontWeight(view, value) {
1274
+ view.fontWeight = value ?? "regular";
1275
+ },
1276
+ font(view, value) {
1277
+ view.font = value;
1278
+ },
1279
+ textAlign(view, value) {
1280
+ view.textAlign = value;
1281
+ },
1282
+ lineHeight(view, value) {
1283
+ view.lineHeight = value;
1284
+ },
1285
+ numberOfLines(view, value) {
1286
+ view.numberOfLines = value ?? 0;
1287
+ },
1288
+ ellipsizeMode(view, value) {
1289
+ view.ellipsizeMode = value ?? "tail";
1290
+ },
1291
+ gestureRecognizers(view, propValue) {
1292
+ view.isUserInteractionEnabled = propValue !== void 0 && propValue != null;
1293
+ viewPropsSetters.gestureRecognizers?.(view, propValue);
1294
+ }
1295
+ };
1296
+ registerView("Text", () => new Label_nitro_exports.Label(), labelSetters);
1297
+ // ../nitro-ui-renderer/src/components/Image/Image.tsx
1298
+ const imageSetters = {
1299
+ ...viewPropsSetters,
1300
+ style(view, style, previousStyle) {
1301
+ applyStyleProps(view, style, previousStyle, imageStylePropSetters);
1302
+ },
1303
+ image(view, propValue) {
1304
+ view.image = propValue;
1305
+ },
1306
+ recyclingKey(view, propValue) {
1307
+ view.recyclingKey = propValue;
1308
+ },
1309
+ decodeSize(view, propValue) {
1310
+ view.decodeSize = propValue;
1311
+ },
1312
+ resizeMode(view, propValue) {
1313
+ view.resizeMode = propValue;
1314
+ }
1315
+ };
1316
+ registerView("Image", () => new ImageView_nitro_exports.ImageView(), imageSetters);
1317
+ // ../nitro-ui-renderer/src/components/ScrollViewSetters.ts
1318
+ const scrollSetters = {
1319
+ ...viewPropsSetters,
1320
+ showsVerticalScrollIndicator(view, propValue) {
1321
+ view.showsVerticalScrollIndicator = propValue ?? true;
1322
+ },
1323
+ showsHorizontalScrollIndicator(view, propValue) {
1324
+ view.showsHorizontalScrollIndicator = propValue ?? true;
1325
+ },
1326
+ contentInsetAdjustmentBehavior(view, propValue) {
1327
+ view.contentInsetAdjustmentBehavior = propValue ?? "automatic";
1328
+ },
1329
+ isNestedScrollingEnabled(view, propValue) {
1330
+ view.isNestedScrollingEnabled = propValue;
1331
+ }
1332
+ };
1333
+ // src/bindProperties.ts
1334
+ function unchanged(value, before) {
1335
+ return value === before || Array.isArray(value) && Array.isArray(before) && arePropArraysEqual(value, before);
1336
+ }
1337
+ /** Diffs only properties with native writers. Each batch commits the view once. */
1338
+ function bindProperties(view, props, setters, commit) {
1339
+ function snapshot() {
1340
+ const values = {};
1341
+ for (const key in props) if (setters[key] !== void 0) values[key] = props[key];
1342
+ return values;
1343
+ }
1344
+ function update(next, previous) {
1345
+ let changed = previous === void 0;
1346
+ for (const key in previous) if (!(key in next) && previous[key] !== void 0) {
1347
+ setters[key]?.(view, void 0, previous[key]);
1348
+ changed = true;
1349
+ }
1350
+ for (const key in next) {
1351
+ const value = next[key];
1352
+ const before = previous?.[key];
1353
+ if (unchanged(value, before)) continue;
1354
+ setters[key]?.(view, value, before);
1355
+ changed = true;
1356
+ }
1357
+ if (changed) commit();
1358
+ }
1359
+ if (hasStaticKeys(props)) {
1360
+ let dynamic = false;
1361
+ for (const key in props) if (setters[key] !== void 0 && Object.getOwnPropertyDescriptor(props, key)?.get !== void 0) {
1362
+ dynamic = true;
1363
+ break;
1364
+ }
1365
+ if (!dynamic) {
1366
+ update(snapshot());
1367
+ return;
1368
+ }
1369
+ }
1370
+ createRenderEffect(snapshot, update);
1371
+ }
1372
+ // src/nativeProps.ts
1373
+ function attachRef(view, props) {
1374
+ const cleanup = props.ref?.(view);
1375
+ if (cleanup !== void 0) onCleanup(cleanup);
1376
+ }
1377
+ function nativeCommit(view, node) {
1378
+ return () => {
1379
+ view.afterUpdate();
1380
+ node.view?.requestLayout();
1381
+ };
1382
+ }
1383
+ // src/components.ts
1384
+ function View(props) {
1385
+ const view = Application$2.createView();
1386
+ const node = mountView(view);
1387
+ bindProperties(view, props, containerSetters, nativeCommit(view, node));
1388
+ insert(node, () => props.children);
1389
+ attachRef(view, props);
1390
+ return node;
1391
+ }
1392
+ function Text(props) {
1393
+ const label = new Label$1();
1394
+ const node = mountView(label);
1395
+ bindProperties(label, props, labelSetters, nativeCommit(label, node));
1396
+ attachRef(label, props);
1397
+ return node;
1398
+ }
1399
+ function Image(props) {
1400
+ const image = new ImageView$1();
1401
+ const node = mountView(image);
1402
+ bindProperties(image, props, imageSetters, nativeCommit(image, node));
1403
+ attachRef(image, props);
1404
+ return node;
1405
+ }
1406
+ function ScrollView(props) {
1407
+ const scroll = new ScrollView$1();
1408
+ const node = mountView(scroll);
1409
+ bindProperties(scroll, merge(props, { get layout() {
1410
+ return {
1411
+ flex: 1,
1412
+ overflow: "scroll",
1413
+ ...props.layout
1414
+ };
1415
+ } }), scrollSetters, nativeCommit(scroll, node));
1416
+ insert(node, () => props.children);
1417
+ attachRef(scroll, props);
1418
+ return node;
1419
+ }
1420
+ function ScrollViewContent(props) {
1421
+ const content = new ScrollViewContent$1();
1422
+ const node = mountView(content);
1423
+ bindProperties(content, props, viewPropsSetters, nativeCommit(content, node));
1424
+ insert(node, () => props.children);
1425
+ attachRef(content, props);
1426
+ return node;
1427
+ }
1428
+ function MaskedView(props) {
1429
+ const mask = new MaskedView$1();
1430
+ const node = mountView(mask);
1431
+ bindProperties(mask, props, viewPropsSetters, nativeCommit(mask, node));
1432
+ const maskContainer = View({
1433
+ isUserInteractionEnabled: false,
1434
+ layout: {
1435
+ position: "absolute",
1436
+ top: 0,
1437
+ right: 0,
1438
+ bottom: 0,
1439
+ left: 0
1440
+ },
1441
+ get children() {
1442
+ return props.maskElement;
1443
+ }
1444
+ });
1445
+ insert(node, () => [maskContainer, props.children]);
1446
+ attachRef(mask, props);
1447
+ return node;
1448
+ }
1449
+ // src/TextInput.ts
1450
+ const inputSetters = {
1451
+ ...viewPropsSetters,
1452
+ placeholder(input, placeholder) {
1453
+ input.placeholder = placeholder;
1454
+ },
1455
+ onBeforeTextChange(input, callback) {
1456
+ input.setOnBeforeTextChange(callback);
1457
+ }
1458
+ };
1459
+ /** Mounts an editable native control. A new control is required to change multiline mode. */
1460
+ function TextInput(props) {
1461
+ const multiline = untrack(() => props.multiline === true);
1462
+ const input = Application$2.createTextInput(multiline);
1463
+ input.setText(untrack(() => props.defaultValue ?? ""));
1464
+ const node = mountView(input);
1465
+ bindProperties(input, merge(props, { get layout() {
1466
+ return {
1467
+ height: multiline ? 120 : 44,
1468
+ overflow: "hidden",
1469
+ ...props.layout
1470
+ };
1471
+ } }), inputSetters, nativeCommit(input, node));
1472
+ const layoutSubscription = input.addOnLayoutInvalidatedListener(() => node.view?.requestLayout());
1473
+ onCleanup(() => layoutSubscription.remove());
1474
+ onCleanup(() => input.setOnBeforeTextChange(void 0));
1475
+ createRenderEffect(() => props.multiline === true, (current) => {
1476
+ if (current !== multiline) throw new TypeError("Remount TextInput to change multiline mode.");
1477
+ });
1478
+ createRenderEffect(() => props.onTextChanged !== void 0, (observe) => {
1479
+ if (observe) {
1480
+ const subscription = input.addOnTextChangedListener((change) => props.onTextChanged?.(change));
1481
+ return () => subscription.remove();
1482
+ }
1483
+ });
1484
+ createRenderEffect(() => props.onSelectionChanged !== void 0, (observe) => {
1485
+ if (observe) {
1486
+ const subscription = input.addOnSelectionChangedListener((change) => props.onSelectionChanged?.(change));
1487
+ return () => subscription.remove();
1488
+ }
1489
+ });
1490
+ attachRef(input, props);
1491
+ return node;
1492
+ }
1493
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/ListView.cjs
1494
+ var require_ListView = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1495
+ const { NitroModules } = require_commonjs();
1496
+ let hybridClass;
1497
+ module.exports = { get ListView() {
1498
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.ListView");
1499
+ return hybridClass;
1500
+ } };
1501
+ }));
1502
+ // ../nitro-ui-renderer/src/specs/ListView.nitro.ts
1503
+ var ListView_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
1504
+ __reExport(ListView_nitro_exports, /* @__PURE__ */ __toESM(require_ListView(), 1));
1505
+ // ../nitro-ui-renderer/src/components/List/ListDataSource.ts
1506
+ function listItemId(type, key) {
1507
+ return JSON.stringify([type, key]);
1508
+ }
1509
+ function isValidDimension(dimension) {
1510
+ return dimension === void 0 || Number.isFinite(dimension) && dimension >= 0;
1511
+ }
1512
+ /**
1513
+ * Owns rows independently of React renders. A row's identity is its type and key;
1514
+ * changing either replaces the row. Treat item objects and their data as immutable.
1515
+ *
1516
+ * A source may feed multiple lists. Unmounting removes only that list's subscription.
1517
+ * Call {@linkcode release} to explicitly empty and invalidate a source that is still
1518
+ * referenced. Component-owned sources can otherwise be garbage collected.
1519
+ * @see {@linkcode createListDataSource}
1520
+ */
1521
+ var ListDataSource = class {
1522
+ snapshot = {
1523
+ entries: [],
1524
+ animated: false
1525
+ };
1526
+ listeners = /* @__PURE__ */ new Set();
1527
+ config;
1528
+ nextVersion = 1;
1529
+ released = false;
1530
+ constructor(config = {}) {
1531
+ this.config = config;
1532
+ }
1533
+ /** Number of rows currently owned by this source. */
1534
+ get itemCount() {
1535
+ return this.snapshot.entries.length;
1536
+ }
1537
+ /** Returns the row at an integer index; throws when the index is out of bounds. */
1538
+ getItem(index) {
1539
+ this.ensureActive();
1540
+ this.validateIndex(index, false);
1541
+ const entry = this.snapshot.entries[index];
1542
+ if (entry === void 0) throw new Error("ListDataSource item is missing at a valid index.");
1543
+ return entry.item;
1544
+ }
1545
+ /**
1546
+ * Replaces all rows, matching retained rows by type and key.
1547
+ * @param animated Whether to animate the native changes. Defaults to false.
1548
+ */
1549
+ replaceData(items, animated = false) {
1550
+ this.ensureActive();
1551
+ let previous;
1552
+ if (this.config.isContentEqualByType !== void 0 && this.snapshot.entries.length > 0) {
1553
+ previous = /* @__PURE__ */ new Map();
1554
+ for (const entry of this.snapshot.entries) previous.set(entry.id, entry);
1555
+ }
1556
+ const identities = /* @__PURE__ */ new Set();
1557
+ const entries = [];
1558
+ let nextVersion = this.nextVersion;
1559
+ for (const item of items) {
1560
+ const id = this.validateItem(item);
1561
+ if (identities.has(id)) throw new Error(`ListDataSource contains a duplicate type and key: ${id}.`);
1562
+ identities.add(id);
1563
+ const existing = previous?.get(id);
1564
+ let version;
1565
+ if (existing !== void 0 && this.isContentEqual(existing.item, item)) version = existing.version;
1566
+ else {
1567
+ version = nextVersion;
1568
+ nextVersion += 1;
1569
+ }
1570
+ entries.push({
1571
+ id,
1572
+ item,
1573
+ version
1574
+ });
1575
+ }
1576
+ this.nextVersion = nextVersion;
1577
+ this.publish(entries, animated);
1578
+ }
1579
+ /** Inserts a row before index, or appends at {@linkcode itemCount}. Animates the change. */
1580
+ insertItem(index, item) {
1581
+ this.ensureActive();
1582
+ this.validateIndex(index, true);
1583
+ const id = this.validateItem(item);
1584
+ this.validateUniqueIdentity(id);
1585
+ const entries = [...this.snapshot.entries];
1586
+ const entry = {
1587
+ id,
1588
+ item,
1589
+ version: this.nextVersion
1590
+ };
1591
+ entries.splice(index, 0, entry);
1592
+ this.nextVersion += 1;
1593
+ this.publish(entries, true);
1594
+ }
1595
+ /** Updates a row, or replaces it if its type or key changes. Animates the change. */
1596
+ updateItem(index, item) {
1597
+ this.ensureActive();
1598
+ this.validateIndex(index, false);
1599
+ const id = this.validateItem(item);
1600
+ this.validateUniqueIdentity(id, index);
1601
+ const existing = this.snapshot.entries[index];
1602
+ if (existing === void 0) throw new Error("ListDataSource item is missing at a valid index.");
1603
+ let version;
1604
+ if (existing.id === id && this.isContentEqual(existing.item, item)) version = existing.version;
1605
+ else {
1606
+ version = this.nextVersion;
1607
+ this.nextVersion += 1;
1608
+ }
1609
+ const entries = [...this.snapshot.entries];
1610
+ entries[index] = {
1611
+ id,
1612
+ item,
1613
+ version
1614
+ };
1615
+ this.publish(entries, true);
1616
+ }
1617
+ /** Removes the row at index. Animates the change. */
1618
+ removeItem(index) {
1619
+ this.ensureActive();
1620
+ this.validateIndex(index, false);
1621
+ const entries = [...this.snapshot.entries];
1622
+ entries.splice(index, 1);
1623
+ this.publish(entries, true);
1624
+ }
1625
+ /** Moves a row to its final index without changing its identity. Animates the change. */
1626
+ moveItem(fromIndex, toIndex) {
1627
+ this.ensureActive();
1628
+ this.validateIndex(fromIndex, false);
1629
+ this.validateIndex(toIndex, false);
1630
+ if (fromIndex === toIndex) return;
1631
+ const entry = this.snapshot.entries[fromIndex];
1632
+ if (entry === void 0) throw new Error("ListDataSource item is missing at a valid index.");
1633
+ const entries = [...this.snapshot.entries];
1634
+ entries.splice(fromIndex, 1);
1635
+ entries.splice(toIndex, 0, entry);
1636
+ this.publish(entries, true);
1637
+ }
1638
+ /** @internal Returns the current snapshot without allocating a copy. */
1639
+ getSnapshot() {
1640
+ return this.snapshot;
1641
+ }
1642
+ /** @internal Observes future commits; the returned function removes the subscription. */
1643
+ subscribe(listener) {
1644
+ this.ensureActive();
1645
+ this.listeners.add(listener);
1646
+ return () => {
1647
+ this.listeners.delete(listener);
1648
+ };
1649
+ }
1650
+ /**
1651
+ * Empties attached lists and releases rows and listeners. Safe to call repeatedly.
1652
+ * Further mutations and new subscriptions throw.
1653
+ */
1654
+ release() {
1655
+ if (this.released) return;
1656
+ this.released = true;
1657
+ this.config = {};
1658
+ const listeners = [...this.listeners];
1659
+ this.listeners.clear();
1660
+ this.snapshot = {
1661
+ entries: [],
1662
+ animated: false
1663
+ };
1664
+ for (const listener of listeners) listener(this.snapshot);
1665
+ }
1666
+ ensureActive() {
1667
+ if (this.released) throw new Error("ListDataSource has been released.");
1668
+ }
1669
+ validateIndex(index, insertion) {
1670
+ const maximum = insertion ? this.itemCount : this.itemCount - 1;
1671
+ if (Number.isInteger(index) === false || index < 0 || index > maximum) throw new RangeError(`ListDataSource index ${index} is outside 0...${maximum}.`);
1672
+ }
1673
+ validateItem(item) {
1674
+ if (isValidDimension(item.width) === false || isValidDimension(item.height) === false) throw new RangeError("ListDataSource item dimensions must be finite, non-negative points.");
1675
+ return listItemId(item.type, item.key);
1676
+ }
1677
+ validateUniqueIdentity(id, replacedIndex) {
1678
+ for (const [index, entry] of this.snapshot.entries.entries()) if (entry.id === id && index !== replacedIndex) throw new Error(`ListDataSource contains a duplicate type and key: ${id}.`);
1679
+ }
1680
+ isContentEqual(oldItem, newItem) {
1681
+ if (oldItem.type !== newItem.type || oldItem.width !== newItem.width || oldItem.height !== newItem.height) return false;
1682
+ const compare = this.config.isContentEqualByType?.[newItem.type];
1683
+ if (compare === void 0) return false;
1684
+ return compare(oldItem, newItem);
1685
+ }
1686
+ publish(entries, animated) {
1687
+ const snapshot = {
1688
+ entries,
1689
+ animated
1690
+ };
1691
+ this.snapshot = snapshot;
1692
+ const listeners = [...this.listeners];
1693
+ for (const listener of listeners) {
1694
+ if (this.snapshot !== snapshot) break;
1695
+ listener(snapshot);
1696
+ }
1697
+ }
1698
+ };
1699
+ /**
1700
+ * Creates an empty, JavaScript-owned {@linkcode ListDataSource}.
1701
+ * @example
1702
+ * const source = createListDataSource<{ message: { text: string } }>()
1703
+ * source.replaceData([{ key: 'first', type: 'message', data: { text: 'Hello' } }])
1704
+ * source.insertItem(1, { key: 'second', type: 'message', data: { text: 'World' } })
1705
+ */
1706
+ function createListDataSource(config = {}) {
1707
+ return new ListDataSource(config);
1708
+ }
1709
+ // ../nitro-ui-renderer/src/components/List/ListHost.ts
1710
+ const listSetters = {
1711
+ ...viewPropsSetters,
1712
+ anchorItem(list, value, previous) {
1713
+ const alignment = value?.alignment ?? 0;
1714
+ const previousAlignment = previous?.alignment ?? 0;
1715
+ if (value?.type === previous?.type && value?.key === previous?.key && alignment === previousAlignment) return;
1716
+ if (Number.isFinite(alignment) === false || alignment < 0 || alignment > 1) throw new RangeError("List anchor alignment must be finite and between 0 and 1.");
1717
+ const id = value === void 0 ? void 0 : listItemId(value.type, value.key);
1718
+ list.setAnchorItemId(id, alignment);
1719
+ },
1720
+ refreshControl(list, value, previous) {
1721
+ if (value === void 0) {
1722
+ list.clearRefreshControl();
1723
+ return;
1724
+ }
1725
+ const offset = value.progressViewOffset ?? 0;
1726
+ if (Number.isFinite(offset) === false) throw new RangeError("List refreshControl progressViewOffset must be finite.");
1727
+ if (previous?.onRefresh === value.onRefresh && previous.refreshing === value.refreshing && previous.tintColor === value.tintColor && (previous.progressViewOffset ?? 0) === offset) return;
1728
+ const tint = value.tintColor === void 0 ? void 0 : processColor(value.tintColor);
1729
+ list.setRefreshControl(value.onRefresh, value.refreshing, offset, tint);
1730
+ },
1731
+ contentPadding(list, value, previous) {
1732
+ const top = value?.top ?? 0;
1733
+ const right = value?.right ?? 0;
1734
+ const bottom = value?.bottom ?? 0;
1735
+ const left = value?.left ?? 0;
1736
+ if (top === (previous?.top ?? 0) && right === (previous?.right ?? 0) && bottom === (previous?.bottom ?? 0) && left === (previous?.left ?? 0)) return;
1737
+ const padding = {
1738
+ top,
1739
+ right,
1740
+ bottom,
1741
+ left
1742
+ };
1743
+ list.setContentPadding(padding);
1744
+ },
1745
+ showsVerticalScrollIndicator(list, value) {
1746
+ list.showsVerticalScrollIndicator = value ?? true;
1747
+ },
1748
+ showsHorizontalScrollIndicator(list, value) {
1749
+ list.showsHorizontalScrollIndicator = value ?? true;
1750
+ },
1751
+ estimatedItemSize(list, value) {
1752
+ list.setEstimatedItemSize(value);
1753
+ }
1754
+ };
1755
+ registerView("ListView", (props) => {
1756
+ const list = new ListView_nitro_exports.ListView(queueMicrotask);
1757
+ list.setHorizontal(props.horizontal);
1758
+ return list;
1759
+ }, listSetters);
1760
+ // ../nitro-ui-renderer/src/components/List/connectListSource.ts
1761
+ /** Serializes native snapshots and resolves cells against the incoming or outgoing rows. */
1762
+ function connectListSource(list, dataSource, bindCell, pruneCells) {
1763
+ const warnedTypes = __DEV__ ? /* @__PURE__ */ new Set() : void 0;
1764
+ let connected = true;
1765
+ let applying = false;
1766
+ let appliedEntries;
1767
+ let pending;
1768
+ let refreshedEntries;
1769
+ function apply(snapshot) {
1770
+ if (applying) {
1771
+ pending = snapshot;
1772
+ return;
1773
+ }
1774
+ const previous = appliedEntries;
1775
+ const incoming = snapshot.entries;
1776
+ if (previous !== void 0 && previous.length === incoming.length) {
1777
+ let equivalent = true;
1778
+ for (let index = 0; index < incoming.length; index++) {
1779
+ const entry = incoming[index];
1780
+ const oldEntry = previous[index];
1781
+ if (entry === void 0 || oldEntry === void 0 || entry.id !== oldEntry.id || entry.version !== oldEntry.version) {
1782
+ equivalent = false;
1783
+ break;
1784
+ }
1785
+ }
1786
+ if (equivalent) {
1787
+ appliedEntries = snapshot.entries;
1788
+ refreshedEntries = snapshot.entries;
1789
+ return;
1790
+ }
1791
+ }
1792
+ applying = true;
1793
+ refreshedEntries = void 0;
1794
+ const entries = /* @__PURE__ */ new Map();
1795
+ let outgoingEntries = appliedEntries;
1796
+ let outgoing;
1797
+ function findEntry(itemId, index) {
1798
+ const refreshed = refreshedEntries?.[index];
1799
+ if (refreshed !== void 0 && refreshed.id === itemId) return refreshed;
1800
+ const entry = entries.get(itemId);
1801
+ if (entry !== void 0 || outgoingEntries === void 0) return entry;
1802
+ if (outgoing === void 0) {
1803
+ outgoing = /* @__PURE__ */ new Map();
1804
+ for (const previous of outgoingEntries) outgoing.set(previous.id, previous);
1805
+ }
1806
+ return outgoing.get(itemId);
1807
+ }
1808
+ const descriptors = [];
1809
+ for (const entry of snapshot.entries) {
1810
+ entries.set(entry.id, entry);
1811
+ descriptors.push({
1812
+ id: entry.id,
1813
+ type: entry.item.type,
1814
+ version: entry.version,
1815
+ width: entry.item.width,
1816
+ height: entry.item.height
1817
+ });
1818
+ }
1819
+ list.applySnapshot(descriptors, snapshot.animated, (cellId, content, itemId, index) => {
1820
+ if (connected === false) return;
1821
+ const entry = findEntry(itemId, index);
1822
+ if (entry === void 0) throw new Error(`Native List requested an item outside its snapshot: ${itemId}`);
1823
+ const start = __DEV__ ? performance.now() : 0;
1824
+ bindCell(cellId, content, entry, index);
1825
+ if (__DEV__ && warnedTypes !== void 0) {
1826
+ const elapsed = performance.now() - start;
1827
+ const type = entry.item.type;
1828
+ if (elapsed > 1e3 / 120 && !warnedTypes.has(type)) {
1829
+ warnedTypes.add(type);
1830
+ const duration = elapsed.toFixed(1);
1831
+ console.warn(`[List] Binding row type "${type}" at index ${index} took ${duration} ms on the UI thread. A frame at 120 Hz is 8.3 ms. Profile the row render and commit in a Release build, and move repeated work out of the row render.`);
1832
+ }
1833
+ }
1834
+ }, () => {
1835
+ if (connected === false) return;
1836
+ appliedEntries = snapshot.entries;
1837
+ outgoingEntries = void 0;
1838
+ outgoing = void 0;
1839
+ pruneCells(entries);
1840
+ applying = false;
1841
+ const next = pending;
1842
+ pending = void 0;
1843
+ if (next !== void 0) apply(next);
1844
+ });
1845
+ }
1846
+ const unsubscribe = dataSource.subscribe(apply);
1847
+ function disconnect() {
1848
+ connected = false;
1849
+ unsubscribe();
1850
+ pending = void 0;
1851
+ list.clearRefreshControl();
1852
+ list.clearDataSource();
1853
+ }
1854
+ try {
1855
+ apply(dataSource.getSnapshot());
1856
+ } catch (error) {
1857
+ disconnect();
1858
+ throw error;
1859
+ }
1860
+ return disconnect;
1861
+ }
1862
+ // src/List.ts
1863
+ function renderRow(renderers, type, row) {
1864
+ return renderers[type](row);
1865
+ }
1866
+ function mountCell(container, initial, initialIndex, props) {
1867
+ const [entry, setEntry] = createSignal(initial);
1868
+ const [index, setIndex] = createSignal(initialIndex);
1869
+ const row = {
1870
+ get item() {
1871
+ return entry().item;
1872
+ },
1873
+ get index() {
1874
+ return index();
1875
+ }
1876
+ };
1877
+ const portal = mountPortal(container, () => {
1878
+ const renderers = props.renderers;
1879
+ return untrack(() => renderRow(renderers, initial.item.type, row));
1880
+ });
1881
+ return {
1882
+ id: initial.id,
1883
+ container,
1884
+ dispose: portal.dispose,
1885
+ update(next, nextIndex) {
1886
+ setEntry(next);
1887
+ setIndex(nextIndex);
1888
+ flush();
1889
+ portal.layout();
1890
+ }
1891
+ };
1892
+ }
1893
+ function mountList(identity, props) {
1894
+ const owner = getOwner();
1895
+ if (owner === null) throw new Error("List must be mounted inside a Solid root.");
1896
+ const list = new ListView_nitro_exports.ListView(queueMicrotask);
1897
+ list.setHorizontal(identity.horizontal);
1898
+ const node = mountView(list);
1899
+ bindProperties(list, merge(props, { get layout() {
1900
+ return {
1901
+ flex: 1,
1902
+ overflow: "hidden",
1903
+ ...props.layout
1904
+ };
1905
+ } }), {
1906
+ ...listSetters,
1907
+ estimatedItemSize(target, size) {
1908
+ if (size !== void 0 && (!Number.isFinite(size) || size <= 0)) throw new RangeError("List estimatedItemSize must be a positive, finite number.");
1909
+ listSetters.estimatedItemSize(target, size);
1910
+ }
1911
+ }, nativeCommit(list, node));
1912
+ const cells = /* @__PURE__ */ new Map();
1913
+ onCleanup(() => {
1914
+ for (const slot of cells.values()) slot.dispose();
1915
+ cells.clear();
1916
+ });
1917
+ createRenderEffect(() => identity.source, (source) => connectListSource(list, source, (cellId, container, entry, index) => {
1918
+ const slot = cells.get(cellId);
1919
+ if (slot?.id === entry.id && container.equals(slot.container)) {
1920
+ slot.update(entry, index);
1921
+ return;
1922
+ }
1923
+ slot?.dispose();
1924
+ const next = runWithOwner(owner, () => mountCell(container, entry, index, props));
1925
+ cells.set(cellId, next);
1926
+ }, (entries) => {
1927
+ for (const [cellId, slot] of cells) if (!entries.has(slot.id)) {
1928
+ slot.dispose();
1929
+ cells.delete(cellId);
1930
+ }
1931
+ }));
1932
+ return node;
1933
+ }
1934
+ /** The native view borrows its source. A row keeps its Solid owner until its key or cell changes. */
1935
+ function List(props) {
1936
+ const identity = createMemo(() => ({
1937
+ source: props.dataSource,
1938
+ horizontal: props.horizontal === true
1939
+ }), { equals: (a, b) => a.source === b.source && a.horizontal === b.horizontal });
1940
+ return Show$1({
1941
+ get when() {
1942
+ return identity();
1943
+ },
1944
+ keyed: true,
1945
+ children: (current) => mountList(current, props)
1946
+ });
1947
+ }
1948
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/Appearance.cjs
1949
+ var require_Appearance = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1950
+ const { NitroModules } = require_commonjs();
1951
+ let hybridClass;
1952
+ module.exports = { get Appearance() {
1953
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.Appearance");
1954
+ return hybridClass;
1955
+ } };
1956
+ }));
1957
+ // ../nitro-ui-renderer/src/specs/Appearance.nitro.ts
1958
+ var Appearance_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
1959
+ __reExport(Appearance_nitro_exports, /* @__PURE__ */ __toESM(require_Appearance(), 1));
1960
+ // ../nitro-ui-renderer/src/Appearance.ts
1961
+ const nativeAppearance = new Appearance_nitro_exports.Appearance();
1962
+ const Appearance = {
1963
+ /**
1964
+ * Returns the color scheme the app uses, following the system setting.
1965
+ * Prefer {@linkcode useColorScheme} in components.
1966
+ * @throws On iOS, before the app's first window is created.
1967
+ */
1968
+ getColorScheme() {
1969
+ return nativeAppearance.getColorScheme();
1970
+ },
1971
+ /**
1972
+ * Calls {@linkcode listener} when the color scheme changes.
1973
+ * Remove the returned subscription when observation is no longer needed.
1974
+ */
1975
+ addOnColorSchemeChangedListener(listener) {
1976
+ return nativeAppearance.addOnColorSchemeChangedListener(listener);
1977
+ },
1978
+ /**
1979
+ * Forces a light or dark interface, or follows the system setting again with `'auto'`.
1980
+ * The choice lasts until the app process ends.
1981
+ */
1982
+ setColorScheme(colorScheme) {
1983
+ taskColorScheme = void 0;
1984
+ nativeAppearance.setColorScheme(colorScheme);
1985
+ }
1986
+ };
1987
+ let taskColorScheme;
1988
+ const colorSchemeSubscribers = /* @__PURE__ */ new Set();
1989
+ let colorSchemeSubscription;
1990
+ function clearTaskColorScheme() {
1991
+ taskColorScheme = void 0;
1992
+ }
1993
+ /** Returns the color scheme, reading it from native once per JavaScript task. */
1994
+ function getTaskColorScheme() {
1995
+ if (taskColorScheme === void 0) {
1996
+ taskColorScheme = nativeAppearance.getColorScheme();
1997
+ queueMicrotask(clearTaskColorScheme);
1998
+ }
1999
+ return taskColorScheme;
2000
+ }
2001
+ /** Calls {@linkcode onChange} when the color scheme changes, sharing one native listener. */
2002
+ function subscribeToColorScheme(onChange) {
2003
+ colorSchemeSubscription ??= nativeAppearance.addOnColorSchemeChangedListener(() => {
2004
+ clearTaskColorScheme();
2005
+ for (const subscriber of [...colorSchemeSubscribers]) subscriber();
2006
+ });
2007
+ colorSchemeSubscribers.add(onChange);
2008
+ return () => {
2009
+ colorSchemeSubscribers.delete(onChange);
2010
+ if (colorSchemeSubscribers.size > 0) return;
2011
+ colorSchemeSubscription?.remove();
2012
+ colorSchemeSubscription = void 0;
2013
+ };
2014
+ }
2015
+ // src/nativeContext.ts
2016
+ function useRootContext() {
2017
+ return useContext(ViewControllerContext);
2018
+ }
2019
+ /** Reads the current safe area, preserving the snapshot identity for equal inset values. */
2020
+ function useSafeAreaInsets() {
2021
+ const controller = useRootContext();
2022
+ const [insets, setInsets] = createSignal(controller.view.safeAreaInsets, { equals: (a, b) => a.top === b.top && a.right === b.right && a.bottom === b.bottom && a.left === b.left });
2023
+ const listener = controller.addOnSafeAreaInsetsChangedListener((next) => {
2024
+ setInsets(next);
2025
+ });
2026
+ onCleanup(() => listener.remove());
2027
+ return insets;
2028
+ }
2029
+ function useKeyboardInset() {
2030
+ const controller = useRootContext();
2031
+ const [inset, setInset] = createSignal(controller.keyboardInset);
2032
+ const listener = controller.addOnKeyboardInsetChangedListener((next) => {
2033
+ setInset(next);
2034
+ });
2035
+ onCleanup(() => listener.remove());
2036
+ return inset;
2037
+ }
2038
+ function useColorScheme() {
2039
+ const [scheme, setScheme] = createSignal(getTaskColorScheme());
2040
+ const unsubscribe = subscribeToColorScheme(() => {
2041
+ setScheme(getTaskColorScheme());
2042
+ });
2043
+ onCleanup(unsubscribe);
2044
+ return scheme;
2045
+ }
2046
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/Keyboard.cjs
2047
+ var require_Keyboard = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2048
+ const { NitroModules } = require_commonjs();
2049
+ let hybridClass;
2050
+ module.exports = { get Keyboard() {
2051
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.Keyboard");
2052
+ return hybridClass;
2053
+ } };
2054
+ }));
2055
+ // ../nitro-ui-renderer/src/specs/Keyboard.nitro.ts
2056
+ var Keyboard_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
2057
+ __reExport(Keyboard_nitro_exports, /* @__PURE__ */ __toESM(require_Keyboard(), 1));
2058
+ // ../nitro-ui-renderer/src/specs/Gestures/GestureRecognizer.nitro.ts
2059
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
2060
+ const { NitroModules } = require_commonjs();
2061
+ let hybridClass;
2062
+ module.exports = { get GestureRecognizer() {
2063
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.GestureRecognizer");
2064
+ return hybridClass;
2065
+ } };
2066
+ })))();
2067
+ let GestureRecognizerState = /* @__PURE__ */ function(GestureRecognizerState) {
2068
+ GestureRecognizerState[GestureRecognizerState["Possible"] = 0] = "Possible";
2069
+ GestureRecognizerState[GestureRecognizerState["Began"] = 1] = "Began";
2070
+ GestureRecognizerState[GestureRecognizerState["Changed"] = 2] = "Changed";
2071
+ GestureRecognizerState[GestureRecognizerState["Ended"] = 3] = "Ended";
2072
+ GestureRecognizerState[GestureRecognizerState["Cancelled"] = 4] = "Cancelled";
2073
+ GestureRecognizerState[GestureRecognizerState["Failed"] = 5] = "Failed";
2074
+ return GestureRecognizerState;
2075
+ }({});
2076
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/TapGestureRecognizer.cjs
2077
+ var require_TapGestureRecognizer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2078
+ const { NitroModules } = require_commonjs();
2079
+ let hybridClass;
2080
+ module.exports = { get TapGestureRecognizer() {
2081
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.TapGestureRecognizer");
2082
+ return hybridClass;
2083
+ } };
2084
+ }));
2085
+ // ../nitro-ui-renderer/src/specs/Gestures/TapGestureRecognizer.nitro.ts
2086
+ var TapGestureRecognizer_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
2087
+ __reExport(TapGestureRecognizer_nitro_exports, /* @__PURE__ */ __toESM(require_TapGestureRecognizer(), 1));
2088
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/PanGestureRecognizer.cjs
2089
+ var require_PanGestureRecognizer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2090
+ const { NitroModules } = require_commonjs();
2091
+ let hybridClass;
2092
+ module.exports = { get PanGestureRecognizer() {
2093
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.PanGestureRecognizer");
2094
+ return hybridClass;
2095
+ } };
2096
+ }));
2097
+ // ../nitro-ui-renderer/src/specs/Gestures/PanGestureRecognizer.nitro.ts
2098
+ var PanGestureRecognizer_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
2099
+ __reExport(PanGestureRecognizer_nitro_exports, /* @__PURE__ */ __toESM(require_PanGestureRecognizer(), 1));
2100
+ // ../nitro-ui-renderer/nitrogen/generated/shared/javascript/LongPressGestureRecognizer.cjs
2101
+ var require_LongPressGestureRecognizer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2102
+ const { NitroModules } = require_commonjs();
2103
+ let hybridClass;
2104
+ module.exports = { get LongPressGestureRecognizer() {
2105
+ if (hybridClass === void 0) hybridClass = NitroModules.getHybridClass("renderer.LongPressGestureRecognizer");
2106
+ return hybridClass;
2107
+ } };
2108
+ }));
2109
+ // ../nitro-ui-renderer/src/specs/Gestures/LongPressGestureRecognizer.nitro.ts
2110
+ var LongPressGestureRecognizer_nitro_exports = /* @__PURE__ */ __exportAll({}, 2);
2111
+ __reExport(LongPressGestureRecognizer_nitro_exports, /* @__PURE__ */ __toESM(require_LongPressGestureRecognizer(), 1));
2112
+ // ../nitro-ui-renderer/src/specs/Animations/AnimationCurve.ts
2113
+ let AnimationCurve = /* @__PURE__ */ function(AnimationCurve) {
2114
+ AnimationCurve[AnimationCurve["Linear"] = 0] = "Linear";
2115
+ AnimationCurve[AnimationCurve["EaseIn"] = 1] = "EaseIn";
2116
+ AnimationCurve[AnimationCurve["EaseOut"] = 2] = "EaseOut";
2117
+ AnimationCurve[AnimationCurve["EaseInOut"] = 3] = "EaseInOut";
2118
+ return AnimationCurve;
2119
+ }({});
2120
+ // src/index.ts
2121
+ /** Registers a Solid component as the root of each native application window. */
2122
+ function registerApp(App) {
2123
+ Application$2.registerRoot((scene) => {
2124
+ const controller = new ViewController$1();
2125
+ controller.view.setBackgroundColor(0xffffffff);
2126
+ renderRoot(App, controller);
2127
+ return new Window$1(scene, controller);
2128
+ });
2129
+ }
2130
+ var Keyboard = Keyboard_nitro_exports.Keyboard;
2131
+ var LongPressGestureRecognizer = LongPressGestureRecognizer_nitro_exports.LongPressGestureRecognizer;
2132
+ var PanGestureRecognizer = PanGestureRecognizer_nitro_exports.PanGestureRecognizer;
2133
+ var TapGestureRecognizer = TapGestureRecognizer_nitro_exports.TapGestureRecognizer;
2134
+ export { AnimationCurve, Appearance, Application, Errored, For, GestureRecognizerState, Image, Keyboard, List, ListDataSource, Loading, LongPressGestureRecognizer, MaskedView, Match, PanGestureRecognizer, Repeat, Reveal, ScrollView, ScrollViewContent, Show, Switch, TapGestureRecognizer, Text, TextInput, View, ViewController, ViewControllerContext, Window, WindowScene, applyRef, createComponent, createElement, createListDataSource, createTextNode, effect, getViewLayoutNode, insert, insertNode, memo, mergeProps, mountPortal, mountView, processColor, ref, registerApp, renderRoot, setProp, spread, useColorScheme, useKeyboardInset, useRootContext, useSafeAreaInsets };