@symbiote-native/angular 0.0.0-canary-20260724081123
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/LICENSE +21 -0
- package/README.md +157 -0
- package/babel-linker.cjs +7 -0
- package/babel-register-composed.cjs +127 -0
- package/bin/symbiote-angular-dev.cjs +93 -0
- package/build/angular/anchor-host-registry.d.ts +2 -0
- package/build/angular/anchor-host-registry.js +84 -0
- package/build/angular/anchor-host-registry.js.map +1 -0
- package/build/angular/bootstrap.d.ts +7 -0
- package/build/angular/bootstrap.js +15 -0
- package/build/angular/bootstrap.js.map +1 -0
- package/build/angular/components/activity-indicator/index.android.d.ts +12 -0
- package/build/angular/components/activity-indicator/index.android.js +21 -0
- package/build/angular/components/activity-indicator/index.android.js.map +1 -0
- package/build/angular/components/activity-indicator/index.d.ts +1 -0
- package/build/angular/components/activity-indicator/index.ios.d.ts +8 -0
- package/build/angular/components/activity-indicator/index.ios.js +21 -0
- package/build/angular/components/activity-indicator/index.ios.js.map +1 -0
- package/build/angular/components/activity-indicator/index.js +4 -0
- package/build/angular/components/activity-indicator/index.js.map +1 -0
- package/build/angular/components/activity-indicator/shared.d.ts +67 -0
- package/build/angular/components/activity-indicator/shared.js +260 -0
- package/build/angular/components/activity-indicator/shared.js.map +1 -0
- package/build/angular/components/button.d.ts +63 -0
- package/build/angular/components/button.js +332 -0
- package/build/angular/components/button.js.map +1 -0
- package/build/angular/components/flat-list/index.d.ts +122 -0
- package/build/angular/components/flat-list/index.js +688 -0
- package/build/angular/components/flat-list/index.js.map +1 -0
- package/build/angular/components/image/index.android.d.ts +10 -0
- package/build/angular/components/image/index.android.js +59 -0
- package/build/angular/components/image/index.android.js.map +1 -0
- package/build/angular/components/image/index.d.ts +1 -0
- package/build/angular/components/image/index.ios.d.ts +10 -0
- package/build/angular/components/image/index.ios.js +59 -0
- package/build/angular/components/image/index.ios.js.map +1 -0
- package/build/angular/components/image/index.js +3 -0
- package/build/angular/components/image/index.js.map +1 -0
- package/build/angular/components/image/shared.d.ts +101 -0
- package/build/angular/components/image/shared.js +406 -0
- package/build/angular/components/image/shared.js.map +1 -0
- package/build/angular/components/image-background.d.ts +81 -0
- package/build/angular/components/image-background.js +418 -0
- package/build/angular/components/image-background.js.map +1 -0
- package/build/angular/components/input-accessory-view/index.d.ts +60 -0
- package/build/angular/components/input-accessory-view/index.js +251 -0
- package/build/angular/components/input-accessory-view/index.js.map +1 -0
- package/build/angular/components/keyboard-avoiding-view/index.d.ts +82 -0
- package/build/angular/components/keyboard-avoiding-view/index.js +358 -0
- package/build/angular/components/keyboard-avoiding-view/index.js.map +1 -0
- package/build/angular/components/modal/index.d.ts +92 -0
- package/build/angular/components/modal/index.js +360 -0
- package/build/angular/components/modal/index.js.map +1 -0
- package/build/angular/components/pressable/index.d.ts +123 -0
- package/build/angular/components/pressable/index.js +420 -0
- package/build/angular/components/pressable/index.js.map +1 -0
- package/build/angular/components/refresh-control/index.d.ts +86 -0
- package/build/angular/components/refresh-control/index.js +342 -0
- package/build/angular/components/refresh-control/index.js.map +1 -0
- package/build/angular/components/safe-area-view/index.d.ts +57 -0
- package/build/angular/components/safe-area-view/index.js +248 -0
- package/build/angular/components/safe-area-view/index.js.map +1 -0
- package/build/angular/components/scroll-view/index.android.d.ts +21 -0
- package/build/angular/components/scroll-view/index.android.js +235 -0
- package/build/angular/components/scroll-view/index.android.js.map +1 -0
- package/build/angular/components/scroll-view/index.d.ts +3 -0
- package/build/angular/components/scroll-view/index.ios.d.ts +9 -0
- package/build/angular/components/scroll-view/index.ios.js +86 -0
- package/build/angular/components/scroll-view/index.ios.js.map +1 -0
- package/build/angular/components/scroll-view/index.js +6 -0
- package/build/angular/components/scroll-view/index.js.map +1 -0
- package/build/angular/components/scroll-view/projection.d.ts +32 -0
- package/build/angular/components/scroll-view/projection.js +334 -0
- package/build/angular/components/scroll-view/projection.js.map +1 -0
- package/build/angular/components/scroll-view/shared.d.ts +230 -0
- package/build/angular/components/scroll-view/shared.js +682 -0
- package/build/angular/components/scroll-view/shared.js.map +1 -0
- package/build/angular/components/scroll-view/sticky-header.d.ts +40 -0
- package/build/angular/components/scroll-view/sticky-header.js +225 -0
- package/build/angular/components/scroll-view/sticky-header.js.map +1 -0
- package/build/angular/components/section-list/index.d.ts +116 -0
- package/build/angular/components/section-list/index.js +641 -0
- package/build/angular/components/section-list/index.js.map +1 -0
- package/build/angular/components/switch/index.android.d.ts +20 -0
- package/build/angular/components/switch/index.android.js +70 -0
- package/build/angular/components/switch/index.android.js.map +1 -0
- package/build/angular/components/switch/index.d.ts +1 -0
- package/build/angular/components/switch/index.ios.d.ts +19 -0
- package/build/angular/components/switch/index.ios.js +69 -0
- package/build/angular/components/switch/index.ios.js.map +1 -0
- package/build/angular/components/switch/index.js +4 -0
- package/build/angular/components/switch/index.js.map +1 -0
- package/build/angular/components/switch/shared.d.ts +40 -0
- package/build/angular/components/switch/shared.js +127 -0
- package/build/angular/components/switch/shared.js.map +1 -0
- package/build/angular/components/text-input.d.ts +153 -0
- package/build/angular/components/text-input.js +599 -0
- package/build/angular/components/text-input.js.map +1 -0
- package/build/angular/components/touchable/index.d.ts +245 -0
- package/build/angular/components/touchable/index.js +1186 -0
- package/build/angular/components/touchable/index.js.map +1 -0
- package/build/angular/components/touchable-native-feedback/index.d.ts +83 -0
- package/build/angular/components/touchable-native-feedback/index.js +371 -0
- package/build/angular/components/touchable-native-feedback/index.js.map +1 -0
- package/build/angular/components/virtualized-list/directives.d.ts +54 -0
- package/build/angular/components/virtualized-list/directives.js +153 -0
- package/build/angular/components/virtualized-list/directives.js.map +1 -0
- package/build/angular/components/virtualized-list/index.d.ts +253 -0
- package/build/angular/components/virtualized-list/index.js +1031 -0
- package/build/angular/components/virtualized-list/index.js.map +1 -0
- package/build/angular/components/virtualized-section-list/directives.d.ts +37 -0
- package/build/angular/components/virtualized-section-list/directives.js +76 -0
- package/build/angular/components/virtualized-section-list/directives.js.map +1 -0
- package/build/angular/components/virtualized-section-list/index.d.ts +178 -0
- package/build/angular/components/virtualized-section-list/index.js +720 -0
- package/build/angular/components/virtualized-section-list/index.js.map +1 -0
- package/build/angular/components.d.ts +39 -0
- package/build/angular/components.js +38 -0
- package/build/angular/components.js.map +1 -0
- package/build/angular/create-portal/index.d.ts +22 -0
- package/build/angular/create-portal/index.js +74 -0
- package/build/angular/create-portal/index.js.map +1 -0
- package/build/angular/create-tunnel/index.d.ts +34 -0
- package/build/angular/create-tunnel/index.js +126 -0
- package/build/angular/create-tunnel/index.js.map +1 -0
- package/build/angular/descriptor-to-angular/index.d.ts +22 -0
- package/build/angular/descriptor-to-angular/index.js +142 -0
- package/build/angular/descriptor-to-angular/index.js.map +1 -0
- package/build/angular/host-instance/index.d.ts +2 -0
- package/build/angular/host-instance/index.js +37 -0
- package/build/angular/host-instance/index.js.map +1 -0
- package/build/angular/index.d.ts +22 -0
- package/build/angular/index.js +46 -0
- package/build/angular/index.js.map +1 -0
- package/build/angular/modules/animated/animated-leaf-binder/index.d.ts +14 -0
- package/build/angular/modules/animated/animated-leaf-binder/index.js +91 -0
- package/build/angular/modules/animated/animated-leaf-binder/index.js.map +1 -0
- package/build/angular/modules/animated/animated-leaf-binder.d.ts +14 -0
- package/build/angular/modules/animated/animated-leaf-binder.js +91 -0
- package/build/angular/modules/animated/animated-leaf-binder.js.map +1 -0
- package/build/angular/modules/animated/create-animated-component.d.ts +59 -0
- package/build/angular/modules/animated/create-animated-component.js +364 -0
- package/build/angular/modules/animated/create-animated-component.js.map +1 -0
- package/build/angular/modules/animated/index.d.ts +51 -0
- package/build/angular/modules/animated/index.js +59 -0
- package/build/angular/modules/animated/index.js.map +1 -0
- package/build/angular/modules/app-registry/index.d.ts +7 -0
- package/build/angular/modules/app-registry/index.js +23 -0
- package/build/angular/modules/app-registry/index.js.map +1 -0
- package/build/angular/modules/status-bar/index.d.ts +20 -0
- package/build/angular/modules/status-bar/index.js +59 -0
- package/build/angular/modules/status-bar/index.js.map +1 -0
- package/build/angular/primitives/index.d.ts +63 -0
- package/build/angular/primitives/index.js +189 -0
- package/build/angular/primitives/index.js.map +1 -0
- package/build/angular/primitives/shared.d.ts +88 -0
- package/build/angular/primitives/shared.js +171 -0
- package/build/angular/primitives/shared.js.map +1 -0
- package/build/angular/render/index.d.ts +11 -0
- package/build/angular/render/index.js +171 -0
- package/build/angular/render/index.js.map +1 -0
- package/build/angular/renderer/index.d.ts +37 -0
- package/build/angular/renderer/index.js +301 -0
- package/build/angular/renderer/index.js.map +1 -0
- package/build/angular/services/color-scheme.service.d.ts +16 -0
- package/build/angular/services/color-scheme.service.js +31 -0
- package/build/angular/services/color-scheme.service.js.map +1 -0
- package/build/angular/services/index.d.ts +2 -0
- package/build/angular/services/index.js +3 -0
- package/build/angular/services/index.js.map +1 -0
- package/build/angular/services/window-dimensions.service.d.ts +16 -0
- package/build/angular/services/window-dimensions.service.js +42 -0
- package/build/angular/services/window-dimensions.service.js.map +1 -0
- package/metro-config.cjs +48 -0
- package/metro-css-parser.cjs +13 -0
- package/package.json +80 -0
- package/src/__tests__/responder-change-detection.test.ts +102 -0
- package/src/__tests__/responder-nested-cd.test.ts +113 -0
- package/src/anchor-host-registry.ts +88 -0
- package/src/angular-gaps.test.ts +142 -0
- package/src/angular-imports.test.ts +100 -0
- package/src/bootstrap.ts +26 -0
- package/src/components/activity-indicator/activity-indicator-class-style.test.ts +44 -0
- package/src/components/activity-indicator/activity-indicator.test.ts +131 -0
- package/src/components/activity-indicator/index.android.ts +16 -0
- package/src/components/activity-indicator/index.ios.ts +17 -0
- package/src/components/activity-indicator/index.ts +4 -0
- package/src/components/activity-indicator/shared.ts +206 -0
- package/src/components/button.ts +193 -0
- package/src/components/flat-list/column-wrapper-style-class.test.ts +116 -0
- package/src/components/flat-list/flat-list-array-style.test.ts +131 -0
- package/src/components/flat-list/flat-list-class-style.test.ts +74 -0
- package/src/components/flat-list/flat-list-scroll-containment.test.ts +107 -0
- package/src/components/flat-list/flat-list.test.ts +99 -0
- package/src/components/flat-list/index.ts +574 -0
- package/src/components/image/image-class-style.test.ts +46 -0
- package/src/components/image/index.android.ts +48 -0
- package/src/components/image/index.ios.ts +48 -0
- package/src/components/image/index.ts +3 -0
- package/src/components/image/shared.ts +479 -0
- package/src/components/image-background-class-style.test.ts +48 -0
- package/src/components/image-background-style-class.test.ts +79 -0
- package/src/components/image-background.ts +270 -0
- package/src/components/input-accessory-view/index.ts +185 -0
- package/src/components/input-accessory-view/input-accessory-view.test.ts +43 -0
- package/src/components/keyboard-avoiding-view/index.ts +303 -0
- package/src/components/keyboard-avoiding-view/keyboard-avoiding-view.test.ts +54 -0
- package/src/components/modal/index.ts +299 -0
- package/src/components/modal/modal.test.ts +43 -0
- package/src/components/pressable/index.ts +373 -0
- package/src/components/pressable/pressable.test.ts +85 -0
- package/src/components/refresh-control/index.ts +284 -0
- package/src/components/refresh-control/refresh-control.test.ts +41 -0
- package/src/components/safe-area-view/index.ts +177 -0
- package/src/components/safe-area-view/safe-area-view.test.ts +43 -0
- package/src/components/scroll-view/android-scroll-view-axis-projection.test.ts +123 -0
- package/src/components/scroll-view/content-container-style-class.test.ts +75 -0
- package/src/components/scroll-view/index.android.ts +190 -0
- package/src/components/scroll-view/index.ios.ts +79 -0
- package/src/components/scroll-view/index.ts +7 -0
- package/src/components/scroll-view/projection.ts +414 -0
- package/src/components/scroll-view/scroll-view-class-style.test.ts +134 -0
- package/src/components/scroll-view/scroll-view-projection.test.ts +194 -0
- package/src/components/scroll-view/shared.ts +844 -0
- package/src/components/scroll-view/sticky-header.ts +255 -0
- package/src/components/section-list/index.ts +445 -0
- package/src/components/switch/android-switch-class.test.ts +42 -0
- package/src/components/switch/index.android.ts +61 -0
- package/src/components/switch/index.ios.ts +60 -0
- package/src/components/switch/index.ts +4 -0
- package/src/components/switch/shared.ts +197 -0
- package/src/components/switch/switch.test.ts +92 -0
- package/src/components/text-input-class-style.test.ts +54 -0
- package/src/components/text-input.ts +531 -0
- package/src/components/touchable/index.ts +629 -0
- package/src/components/touchable/touchable.test.ts +102 -0
- package/src/components/touchable-native-feedback/index.ts +254 -0
- package/src/components/touchable-native-feedback/touchable-native-feedback.test.ts +49 -0
- package/src/components/virtualized-list/directives.ts +168 -0
- package/src/components/virtualized-list/index.ts +992 -0
- package/src/components/virtualized-list/virtualized-list-class-style.test.ts +76 -0
- package/src/components/virtualized-section-list/directives.ts +90 -0
- package/src/components/virtualized-section-list/index.ts +601 -0
- package/src/components/virtualized-section-list/virtualized-section-list-class-style.test.ts +60 -0
- package/src/components.ts +149 -0
- package/src/create-portal/create-portal.test.ts +90 -0
- package/src/create-portal/index.ts +74 -0
- package/src/create-tunnel/create-tunnel.test.ts +120 -0
- package/src/create-tunnel/index.ts +136 -0
- package/src/descriptor-to-angular/descriptor-outlet.test.ts +94 -0
- package/src/descriptor-to-angular/index.ts +190 -0
- package/src/host-instance/host-instance.test.ts +49 -0
- package/src/host-instance/index.ts +36 -0
- package/src/index.ts +261 -0
- package/src/modules/animated/animated-leaf-binder/animated-leaf-binder.test.ts +116 -0
- package/src/modules/animated/animated-leaf-binder/index.ts +101 -0
- package/src/modules/animated/animated-leaf-binder.test.ts +116 -0
- package/src/modules/animated/animated-leaf-binder.ts +101 -0
- package/src/modules/animated/animated-scroll-view.test.ts +102 -0
- package/src/modules/animated/create-animated-component.ts +365 -0
- package/src/modules/animated/index.ts +105 -0
- package/src/modules/app-registry/app-registry.test.ts +106 -0
- package/src/modules/app-registry/index.ts +60 -0
- package/src/modules/status-bar/index.ts +57 -0
- package/src/modules/status-bar/status-bar.test.ts +50 -0
- package/src/primitives/index.ts +119 -0
- package/src/primitives/shared.ts +190 -0
- package/src/render/index.ts +235 -0
- package/src/render/render.test.ts +147 -0
- package/src/renderer/index.ts +347 -0
- package/src/renderer/renderer.test.ts +203 -0
- package/src/services/color-scheme.service.ts +27 -0
- package/src/services/index.ts +2 -0
- package/src/services/services.test.ts +163 -0
- package/src/services/window-dimensions.service.ts +41 -0
- package/tsconfig.angular.base.json +30 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Mount an Angular app onto a Fabric surface. The native host hands us a rootTag; we
|
|
2
|
+
// create a surface and bootstrap a standalone Angular component WITHOUT platform-browser
|
|
3
|
+
// (no DOM) — createEnvironmentInjector + createComponent over @angular/core only, with our
|
|
4
|
+
// SymbioteRendererFactory provided so Angular drives the engine, which commits into
|
|
5
|
+
// nativeFabricUIManager; RN's own renderer never in the path. Angular twin of
|
|
6
|
+
// adapters/vue/src/render.ts.
|
|
7
|
+
import { createElement as createEngineElement, createSurface, disposeRoot, dlog, toPublicInstance, } from '@symbiote-native/engine';
|
|
8
|
+
import { descriptorFor } from '@symbiote-native/components';
|
|
9
|
+
import { ApplicationRef, createComponent, createEnvironmentInjector, DOCUMENT, ErrorHandler, RendererFactory2, ɵINJECTOR_SCOPE as INJECTOR_SCOPE, ɵprovideZonelessChangeDetectionInternal as provideZonelessChangeDetectionInternal, } from '@angular/core';
|
|
10
|
+
import { SymbioteRendererFactory } from '../renderer';
|
|
11
|
+
import { ColorSchemeService, WindowDimensionsService } from '../services';
|
|
12
|
+
// The two FFI-edge casts of this adapter, both confined here to bootstrap. Angular's core
|
|
13
|
+
// types model a browser: the injector parent is a non-null EnvironmentInjector, the host is
|
|
14
|
+
// a DOM Element. Our root has neither shape — a null parent IS a root injector, and the host
|
|
15
|
+
// is a SymbioteSurface (or, for a wrapped AppRegistry root, a plain engine node) the
|
|
16
|
+
// SymbioteRenderer (not the DOM) consumes. These are the sanctioned I/O-edge casts where our
|
|
17
|
+
// objects cross into Angular's web-typed API; revisit if Angular ever exposes a cast-free
|
|
18
|
+
// host. Nothing else in the adapter casts.
|
|
19
|
+
function rootInjectorParent() {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
function asAngularHost(hostNode) {
|
|
23
|
+
// Angular's locateHostElement reads hostElement.tagName even when a concrete hostElement
|
|
24
|
+
// is supplied. The host container is given Angular the tiny DOM-shaped field it probes
|
|
25
|
+
// without changing the renderer target.
|
|
26
|
+
Object.defineProperty(hostNode, 'tagName', {
|
|
27
|
+
configurable: true,
|
|
28
|
+
value: 'symbiote-root',
|
|
29
|
+
});
|
|
30
|
+
return hostNode;
|
|
31
|
+
}
|
|
32
|
+
// A bare `symbiote-view` node, created directly through the engine (bypassing Angular's own
|
|
33
|
+
// createElement, which only resolves KNOWN symbiote primitives, never an arbitrary component's
|
|
34
|
+
// selector — see SymbioteRenderer.createElement). Used as the AppRegistry root's host when a
|
|
35
|
+
// wrapperComponentProvider is set: Angular has no hostElement-less bootstrap for our renderer
|
|
36
|
+
// (it would try `renderer.createElement(rootComponent.selector)`, which throws for anything
|
|
37
|
+
// that isn't one of our primitives), so the root needs an explicit host too, one we then hand
|
|
38
|
+
// to the wrapper as projectable content.
|
|
39
|
+
function createDetachedViewHost() {
|
|
40
|
+
const descriptor = descriptorFor('View');
|
|
41
|
+
return toPublicInstance(createEngineElement(descriptor.component, descriptor.isText));
|
|
42
|
+
}
|
|
43
|
+
function applyInputs(cmpRef, initialProps) {
|
|
44
|
+
if (initialProps === undefined)
|
|
45
|
+
return;
|
|
46
|
+
for (const [key, value] of Object.entries(initialProps)) {
|
|
47
|
+
cmpRef.setInput(key, value);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// One Angular app per surface, so a surface can be torn down (unmount) or cleanly
|
|
51
|
+
// re-mounted on the same rootTag: the bridgeless host stops and restarts a surface on Fast
|
|
52
|
+
// Refresh and on lifecycle/focus changes, reusing the rootTag.
|
|
53
|
+
const apps = new Map();
|
|
54
|
+
function teardown(rootTag) {
|
|
55
|
+
const app = apps.get(rootTag);
|
|
56
|
+
if (app === undefined)
|
|
57
|
+
return;
|
|
58
|
+
app.rootRef?.destroy();
|
|
59
|
+
app.cmpRef.destroy();
|
|
60
|
+
app.injector.destroy();
|
|
61
|
+
apps.delete(rootTag);
|
|
62
|
+
disposeRoot(rootTag);
|
|
63
|
+
}
|
|
64
|
+
export function mount(rootTag, rootComponent, options) {
|
|
65
|
+
// A re-mount on a live rootTag starts clean; otherwise the stale app double-drives the surface.
|
|
66
|
+
teardown(rootTag);
|
|
67
|
+
const surface = createSurface(rootTag);
|
|
68
|
+
const injector = createEnvironmentInjector([
|
|
69
|
+
{
|
|
70
|
+
provide: RendererFactory2,
|
|
71
|
+
useValue: new SymbioteRendererFactory(surface),
|
|
72
|
+
},
|
|
73
|
+
{ provide: DOCUMENT, useValue: { head: surface, body: surface } },
|
|
74
|
+
// createEnvironmentInjector with a null parent gives this injector scope
|
|
75
|
+
// {'environment'} only (see EnvironmentNgModuleRefAdapter), so providedIn:'root'
|
|
76
|
+
// tokens — ApplicationRef included — never resolve on their own (R3Injector.get
|
|
77
|
+
// walks up looking for an injector whose `scopes` contains 'root', and a null
|
|
78
|
+
// parent means that search always dead-ends in NullInjector). platform-browser's
|
|
79
|
+
// BROWSER_MODULE_PROVIDERS solves this the same way for real DOM apps: it hands
|
|
80
|
+
// { provide: INJECTOR_SCOPE, useValue: 'root' } to its OWN app-level providers, and
|
|
81
|
+
// R3Injector's constructor reads that provider and self-tags this.scopes with
|
|
82
|
+
// 'root'. We do the same here — no PlatformRef, no DOM, just this one provider.
|
|
83
|
+
{ provide: INJECTOR_SCOPE, useValue: 'root' },
|
|
84
|
+
// Supplies the real ChangeDetectionSchedulerImpl (microtask-batched, self-scheduling
|
|
85
|
+
// via ApplicationRef.afterTick) + NoopNgZone + ZONELESS_ENABLED: true — the exact
|
|
86
|
+
// bundle internalCreateApplication() uses. With ApplicationRef reachable (see above),
|
|
87
|
+
// there is no more reason for a hand-rolled scheduler: it replaces our old
|
|
88
|
+
// unconditional `rootView.detectChanges(); cmpView.detectChanges()` (which force-ran
|
|
89
|
+
// BOTH root views on every tick regardless of cause) with Angular's own tick(), which
|
|
90
|
+
// only enters an attached view when something actually marked it (RefreshView / Dirty
|
|
91
|
+
// consumer / HasChildViewsToRefresh). NOTE: this does NOT stop the root's own template
|
|
92
|
+
// from re-running on a plain press or `ChangeDetectorRef.markForCheck()` anywhere in
|
|
93
|
+
// the tree — `markViewDirty` (which both native (event) bindings and `markForCheck()`
|
|
94
|
+
// go through, see SymbioteHostPropsDirective) unconditionally sets RefreshView on
|
|
95
|
+
// EVERY ancestor up to the root; that is fundamental, unavoidable Angular zoneless
|
|
96
|
+
// behavior, true in every Angular app, not something this swap changes. What DOES
|
|
97
|
+
// still protect a sibling branch from an unrelated press is a genuine child
|
|
98
|
+
// `@Component` boundary — SignalView-compiled children are skip-eligible regardless of
|
|
99
|
+
// this scheduler.
|
|
100
|
+
...provideZonelessChangeDetectionInternal(),
|
|
101
|
+
// Angular's own INTERNAL_APPLICATION_ERROR_HANDLER (core.mjs) reports a tick()
|
|
102
|
+
// exception by calling `injector.get(ErrorHandler)` — a normal `bootstrapApplication`
|
|
103
|
+
// registers this token by default (platform-browser's BROWSER_MODULE_PROVIDERS), but
|
|
104
|
+
// our from-scratch environment injector never did, so that lookup itself threw
|
|
105
|
+
// NG0201 and REPLACED whatever the real error was with an unrelated "No provider
|
|
106
|
+
// found for ErrorHandler" — the real exception never got logged, and the NG0201 itself
|
|
107
|
+
// propagated out of a bare Timeout callback uncaught (nothing above it in the stack to
|
|
108
|
+
// catch it), i.e. any async tick() exception, anywhere in the app, crashed hard instead
|
|
109
|
+
// of being reported. Providing the default `ErrorHandler` (same one bootstrapApplication
|
|
110
|
+
// ships) restores the intended behavior: `console.error('ERROR', e)` and keep running.
|
|
111
|
+
{ provide: ErrorHandler, useClass: ErrorHandler },
|
|
112
|
+
ColorSchemeService,
|
|
113
|
+
WindowDimensionsService,
|
|
114
|
+
], rootInjectorParent());
|
|
115
|
+
// hostElement = the surface: the component's template content commits straight into the
|
|
116
|
+
// surface with no wrapper view, the engine wrapping surface.children in its synthetic flex
|
|
117
|
+
// root — the Angular equivalent of Vue's `app.mount(surface)`.
|
|
118
|
+
let cmpRef;
|
|
119
|
+
let rootRef;
|
|
120
|
+
if (options?.wrapperComponent === undefined) {
|
|
121
|
+
cmpRef = createComponent(rootComponent, {
|
|
122
|
+
environmentInjector: injector,
|
|
123
|
+
hostElement: asAngularHost(surface),
|
|
124
|
+
});
|
|
125
|
+
applyInputs(cmpRef, options?.initialProps);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// The root gets its own host node from the renderer (createComponent without a
|
|
129
|
+
// hostElement) but is not attached to the surface directly; it is handed to the
|
|
130
|
+
// wrapper as projectable content instead, so only the wrapper needs a real host.
|
|
131
|
+
const rootHost = asAngularHost(createDetachedViewHost());
|
|
132
|
+
rootRef = createComponent(rootComponent, {
|
|
133
|
+
environmentInjector: injector,
|
|
134
|
+
hostElement: rootHost,
|
|
135
|
+
});
|
|
136
|
+
applyInputs(rootRef, options.initialProps);
|
|
137
|
+
cmpRef = createComponent(options.wrapperComponent, {
|
|
138
|
+
environmentInjector: injector,
|
|
139
|
+
hostElement: asAngularHost(surface),
|
|
140
|
+
projectableNodes: [[rootHost]],
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// Attach both root views to ApplicationRef so its own tick() (via the real
|
|
144
|
+
// ChangeDetectionSchedulerImpl provided above) drives them from here on — no manual
|
|
145
|
+
// ChangeDetectorRef juggling needed. markForCheck anywhere in the tree now notifies
|
|
146
|
+
// the real scheduler, which batches a microtask and calls appRef.tick() itself.
|
|
147
|
+
const appRef = injector.get(ApplicationRef);
|
|
148
|
+
appRef.attachView(cmpRef.hostView);
|
|
149
|
+
if (rootRef !== undefined) {
|
|
150
|
+
appRef.attachView(rootRef.hostView);
|
|
151
|
+
}
|
|
152
|
+
dlog(`angular mount root=${rootTag}`);
|
|
153
|
+
appRef.tick(); // first paint
|
|
154
|
+
surface.requestCommit();
|
|
155
|
+
apps.set(rootTag, { cmpRef, rootRef, injector });
|
|
156
|
+
return surface;
|
|
157
|
+
}
|
|
158
|
+
// Tear down a surface by rootTag: the public pair of `mount`, and the JS half of the
|
|
159
|
+
// bridgeless `RN$stopSurface` contract (see installStopSurfaceGlobal).
|
|
160
|
+
export function unmount(rootTag) {
|
|
161
|
+
dlog(`angular unmount root=${rootTag}`);
|
|
162
|
+
teardown(rootTag);
|
|
163
|
+
}
|
|
164
|
+
function installStopSurfaceGlobal() {
|
|
165
|
+
globalThis.RN$stopSurface = (surfaceId) => {
|
|
166
|
+
unmount(surfaceId);
|
|
167
|
+
};
|
|
168
|
+
dlog('installed global.RN$stopSurface');
|
|
169
|
+
}
|
|
170
|
+
installStopSurfaceGlobal();
|
|
171
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/render/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,yFAAyF;AACzF,2FAA2F;AAC3F,oFAAoF;AACpF,8EAA8E;AAC9E,8BAA8B;AAE9B,OAAO,EACL,aAAa,IAAI,mBAAmB,EACpC,aAAa,EACb,WAAW,EACX,IAAI,EACJ,gBAAgB,GAIjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,eAAe,IAAI,cAAc,EACjC,uCAAuC,IAAI,sCAAsC,GAIlF,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE1E,0FAA0F;AAC1F,4FAA4F;AAC5F,6FAA6F;AAC7F,qFAAqF;AACrF,6FAA6F;AAC7F,0FAA0F;AAC1F,2CAA2C;AAC3C,SAAS,kBAAkB;IACzB,OAAO,IAAsC,CAAC;AAChD,CAAC;AACD,SAAS,aAAa,CAAC,QAAyC;IAC9D,yFAAyF;IACzF,uFAAuF;IACvF,wCAAwC;IACxC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE;QACzC,YAA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OAAO,CAAC;AACjB,CAAC;AAED,qFAAqF;AACrF,uEAAuE;AACvE,MAAM,UAAU,OAAO,CAAC,OAAiB;IACvC,IAAI,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACpB,CAAC;AAWD,SAAS,wBAAwB;IAC/B,UAAU,CAAC,cAAc,GAAG,CAAC,SAAiB,EAAQ,EAAE;QACtD,OAAO,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC,CAAC;IACF,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAC1C,CAAC;AAED,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SymbioteSurface, type ISymbioteNode } from '@symbiote-native/engine';
|
|
2
|
+
import type { Renderer2, RendererFactory2, RendererType2 } from '@angular/core';
|
|
3
|
+
type IHostNode = ISymbioteNode;
|
|
4
|
+
type IHostElement = ISymbioteNode | SymbioteSurface;
|
|
5
|
+
export declare class SymbioteRenderer implements Renderer2 {
|
|
6
|
+
private readonly surface;
|
|
7
|
+
readonly data: Record<string, unknown>;
|
|
8
|
+
destroyNode: ((node: ISymbioteNode) => void) | null;
|
|
9
|
+
constructor(surface: SymbioteSurface);
|
|
10
|
+
destroy(): void;
|
|
11
|
+
createElement(name: string): IHostNode;
|
|
12
|
+
createComment(): IHostNode;
|
|
13
|
+
createText(value: string): IHostNode;
|
|
14
|
+
appendChild(parent: IHostElement | null, newChild: IHostNode): void;
|
|
15
|
+
insertBefore(parent: IHostElement | null, newChild: IHostNode, refChild: IHostNode | null): void;
|
|
16
|
+
removeChild(_parent: IHostElement | null, oldChild: IHostNode): void;
|
|
17
|
+
parentNode(node: IHostNode): IHostElement | null;
|
|
18
|
+
nextSibling(node: IHostNode): IHostNode | null;
|
|
19
|
+
selectRootElement(selectorOrNode: string | IHostElement): IHostElement;
|
|
20
|
+
setAttribute(el: IHostElement, name: string, value: string): void;
|
|
21
|
+
removeAttribute(el: IHostElement, name: string): void;
|
|
22
|
+
private readonly classTokens;
|
|
23
|
+
addClass(el: IHostElement, name: string): void;
|
|
24
|
+
removeClass(el: IHostElement, name: string): void;
|
|
25
|
+
setStyle(el: IHostElement, style: string, value: unknown): void;
|
|
26
|
+
removeStyle(el: IHostElement, style: string): void;
|
|
27
|
+
setProperty(el: IHostElement, name: string, value: unknown): void;
|
|
28
|
+
setValue(node: IHostNode, value: string): void;
|
|
29
|
+
listen(target: unknown, eventName: string, callback: (event: unknown) => boolean | void): () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare class SymbioteRendererFactory implements RendererFactory2 {
|
|
32
|
+
private readonly surface;
|
|
33
|
+
private renderer;
|
|
34
|
+
constructor(surface: SymbioteSurface);
|
|
35
|
+
createRenderer(_hostElement: unknown, _type: RendererType2 | null): Renderer2;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// An Angular custom renderer over @symbiote-native/engine. Angular components never touch the
|
|
2
|
+
// DOM directly — every paint goes through Renderer2 (created per-component by
|
|
3
|
+
// RendererFactory2). We provide OUR factory, so each Renderer2 method maps onto the
|
|
4
|
+
// engine's tiny mutation API; the engine owns all Fabric clone-on-write, shared with
|
|
5
|
+
// every other adapter. This is the Angular twin of adapters/vue/src/renderer.ts — proof
|
|
6
|
+
// that the same engine mutation API drives both frameworks.
|
|
7
|
+
import { appendChild, createAnchor, createElement, createRawText, dlog, getExplicitStyle, insertBefore, isDebug, isSymbioteNode, removeChild, routeProp, setEventListener, setText, toPublicInstance, RAW_TEXT_COMPONENT, SymbioteSurface, } from '@symbiote-native/engine';
|
|
8
|
+
import { descriptorFor } from '@symbiote-native/components';
|
|
9
|
+
import { isAnchorHostComponent } from '../anchor-host-registry';
|
|
10
|
+
import { getScrollViewProjection, removeScrollViewProjectedChild, } from '../components/scroll-view/projection';
|
|
11
|
+
function isSurface(parent) {
|
|
12
|
+
return parent instanceof SymbioteSurface;
|
|
13
|
+
}
|
|
14
|
+
function isRawText(node) {
|
|
15
|
+
return node.component === RAW_TEXT_COMPONENT;
|
|
16
|
+
}
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === 'object' && value !== null;
|
|
19
|
+
}
|
|
20
|
+
// Diagnostic-only: tags each anchor with a sequential id so log lines can tell distinct
|
|
21
|
+
// anchors apart (they all otherwise print the same generic '#anchor' component name).
|
|
22
|
+
// Gated behind isDebug() so a production build pays zero cost (no WeakMap writes).
|
|
23
|
+
let anchorDebugCounter = 0;
|
|
24
|
+
const anchorDebugIds = new WeakMap();
|
|
25
|
+
function tagAnchorForDebug(node) {
|
|
26
|
+
if (isDebug()) {
|
|
27
|
+
anchorDebugCounter += 1;
|
|
28
|
+
anchorDebugIds.set(node, anchorDebugCounter);
|
|
29
|
+
}
|
|
30
|
+
return node;
|
|
31
|
+
}
|
|
32
|
+
// Diagnostic identity string for a renderer node/surface — component name, or 'surface'.
|
|
33
|
+
// Null-tolerant: a diagnostic must never throw (Angular hands insertBefore a null refChild).
|
|
34
|
+
function describeHost(node) {
|
|
35
|
+
if (node === null || node === undefined)
|
|
36
|
+
return 'null';
|
|
37
|
+
if (isSurface(node))
|
|
38
|
+
return 'surface';
|
|
39
|
+
const anchorId = anchorDebugIds.get(node);
|
|
40
|
+
return anchorId !== undefined ? `${node.component}#${anchorId}` : node.component;
|
|
41
|
+
}
|
|
42
|
+
const PRIMITIVE_SELECTOR_ALIAS = {
|
|
43
|
+
// Public ergonomic selectors map directly to the engine primitive descriptors.
|
|
44
|
+
View: 'symbiote-view',
|
|
45
|
+
Text: 'symbiote-text',
|
|
46
|
+
};
|
|
47
|
+
// The ANCHOR_HOST_COMPONENTS Set and registerComposedComponent now live in the dependency-free
|
|
48
|
+
// leaf module ../anchor-host-registry (imported above as isAnchorHostComponent) — see its header
|
|
49
|
+
// for why the registry must NOT sit in this require-cyclic renderer module.
|
|
50
|
+
// Inserting a bare raw-text node anywhere but inside a <Text> is invalid in Fabric (a
|
|
51
|
+
// stray RCTRawText would paint). Angular's ɵɵtext only ever lands text inside a <Text>,
|
|
52
|
+
// but guard anyway for parity with the Vue adapter and to fail loudly on a bad template.
|
|
53
|
+
function assertTextPlacement(child, parent) {
|
|
54
|
+
if (isRawText(child) && (isSurface(parent) || !parent.isText)) {
|
|
55
|
+
throw new Error(`Text string "${String(child.props.text)}" must be rendered inside a <Text>`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// One renderer per mounted surface. Every mutation asks the surface to (microtask-
|
|
59
|
+
// coalesced) recommit — the same seam Vue uses; a burst of Angular change-detection
|
|
60
|
+
// mutations collapses into one completeRoot.
|
|
61
|
+
export class SymbioteRenderer {
|
|
62
|
+
surface;
|
|
63
|
+
data = {};
|
|
64
|
+
// Angular calls destroyNode per-node only when this is non-null; teardown happens in
|
|
65
|
+
// render.ts (unmount), so per-node cleanup is a no-op.
|
|
66
|
+
destroyNode = null;
|
|
67
|
+
constructor(surface) {
|
|
68
|
+
this.surface = surface;
|
|
69
|
+
}
|
|
70
|
+
destroy() { }
|
|
71
|
+
createElement(name) {
|
|
72
|
+
// `name` is the component's host tag — a symbiote intrinsic (`symbiote-view`,
|
|
73
|
+
// `symbiote-text`, …), a public ergonomic alias (`View`, `Text`), or a raw Fabric view
|
|
74
|
+
// name for a native leaf. Public aliases are normalized to their engine primitive name
|
|
75
|
+
// before descriptor lookup. descriptorFor resolves it; an unknown `symbiote-*` is a typo,
|
|
76
|
+
// any other string flows through as a raw Fabric name (events/processors derived from its
|
|
77
|
+
// ViewConfig). toPublicInstance grafts the imperative API (measure / setNativeProps /
|
|
78
|
+
// focus) onto the raw node in place, returning the SAME identity the commit mirror keys on.
|
|
79
|
+
const engineName = PRIMITIVE_SELECTOR_ALIAS[name] ?? name;
|
|
80
|
+
if (isAnchorHostComponent(engineName)) {
|
|
81
|
+
const anchor = tagAnchorForDebug(createAnchor());
|
|
82
|
+
dlog(`angular createElement ${name} -> anchor host ${describeHost(anchor)}`);
|
|
83
|
+
return anchor;
|
|
84
|
+
}
|
|
85
|
+
const descriptor = descriptorFor(engineName);
|
|
86
|
+
const node = createElement(descriptor.component, descriptor.isText);
|
|
87
|
+
dlog(`angular createElement ${name} -> ${descriptor.component}`);
|
|
88
|
+
return toPublicInstance(node);
|
|
89
|
+
}
|
|
90
|
+
createComment() {
|
|
91
|
+
// Angular structural directives (*ngIf / @if / @for) need anchor nodes to track
|
|
92
|
+
// position. A real retained node the commit walk SKIPS — no native view. Twin of the
|
|
93
|
+
// Vue createComment path.
|
|
94
|
+
const anchor = tagAnchorForDebug(createAnchor());
|
|
95
|
+
dlog(`Angular renderer createComment -> ${describeHost(anchor)}`);
|
|
96
|
+
return anchor;
|
|
97
|
+
}
|
|
98
|
+
createText(value) {
|
|
99
|
+
return createRawText(value);
|
|
100
|
+
}
|
|
101
|
+
appendChild(parent, newChild) {
|
|
102
|
+
// Angular defers insertion for content awaiting its host component's own projection
|
|
103
|
+
// (see parentNode below) — mirrors Angular's own `if (parentRNode !== null)` guard in
|
|
104
|
+
// addLViewToLContainer: skip silently now, the later projection pass places it correctly.
|
|
105
|
+
if (parent === null)
|
|
106
|
+
return;
|
|
107
|
+
assertTextPlacement(newChild, parent);
|
|
108
|
+
if (isSurface(parent)) {
|
|
109
|
+
dlog(`Angular renderer appendChild parent=surface child=${describeHost(newChild)}`);
|
|
110
|
+
parent.appendChild(newChild);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const projection = getScrollViewProjection(parent);
|
|
114
|
+
dlog(`Angular renderer appendChild parent=${describeHost(parent)} child=${describeHost(newChild)} projection=${projection !== undefined}`);
|
|
115
|
+
if (projection !== undefined) {
|
|
116
|
+
projection.appendProjectedChild(parent, newChild, (target, child) => appendChild(target, child));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
appendChild(parent, newChild);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
this.surface.requestCommit();
|
|
123
|
+
}
|
|
124
|
+
insertBefore(parent, newChild, refChild) {
|
|
125
|
+
if (parent === null)
|
|
126
|
+
return; // see the appendChild guard above
|
|
127
|
+
assertTextPlacement(newChild, parent);
|
|
128
|
+
if (isSurface(parent)) {
|
|
129
|
+
dlog(`Angular renderer insertBefore parent=surface child=${describeHost(newChild)} ref=${refChild ? describeHost(refChild) : 'null'}`);
|
|
130
|
+
if (refChild)
|
|
131
|
+
parent.insertBefore(newChild, refChild);
|
|
132
|
+
else
|
|
133
|
+
parent.appendChild(newChild);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const projection = getScrollViewProjection(parent);
|
|
137
|
+
dlog(`Angular renderer insertBefore parent=${describeHost(parent)} child=${describeHost(newChild)} ref=${refChild ? describeHost(refChild) : 'null'} projection=${projection !== undefined}`);
|
|
138
|
+
if (projection !== undefined) {
|
|
139
|
+
projection.insertProjectedChild(parent, newChild, refChild, (target, child, before) => {
|
|
140
|
+
if (before === undefined)
|
|
141
|
+
appendChild(target, child);
|
|
142
|
+
else
|
|
143
|
+
insertBefore(target, child, before);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
else if (refChild) {
|
|
147
|
+
insertBefore(parent, newChild, refChild);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
appendChild(parent, newChild);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
this.surface.requestCommit();
|
|
154
|
+
}
|
|
155
|
+
removeChild(_parent, oldChild) {
|
|
156
|
+
// Detach from the child's own retained parent (a top-level node lives in
|
|
157
|
+
// surface.children with no parent). Angular's `parent` arg is ignored in favor of the
|
|
158
|
+
// authoritative link, mirroring the Vue adapter's remove.
|
|
159
|
+
const angularParent = _parent !== null ? describeHost(_parent) : 'null';
|
|
160
|
+
const retainedParent = oldChild.parent !== undefined ? describeHost(oldChild.parent) : 'none';
|
|
161
|
+
const wasProjected = removeScrollViewProjectedChild(oldChild, (parent, child) => removeChild(parent, child));
|
|
162
|
+
dlog(`Angular renderer removeChild angularParent=${angularParent} retainedParent=${retainedParent} child=${describeHost(oldChild)} viaProjection=${wasProjected}`);
|
|
163
|
+
if (!wasProjected) {
|
|
164
|
+
const parent = oldChild.parent;
|
|
165
|
+
if (parent !== undefined)
|
|
166
|
+
removeChild(parent, oldChild);
|
|
167
|
+
else
|
|
168
|
+
this.surface.removeChild(oldChild);
|
|
169
|
+
}
|
|
170
|
+
this.surface.requestCommit();
|
|
171
|
+
}
|
|
172
|
+
// FlatList/VirtualizedList cells are content projected into a component host (our
|
|
173
|
+
// ANCHOR_HOST_COMPONENTS, e.g. ScrollView) — Angular's own addLViewToLContainer
|
|
174
|
+
// (.vendors/angular node_manipulation.ts/container.ts) treats a null parent here as "defer —
|
|
175
|
+
// the child component's own <ng-content>/ɵɵprojection will place this once its structure
|
|
176
|
+
// resolves" (e.g. ScrollView's `@if(isHorizontal)` branch). Renderer2's contract types this
|
|
177
|
+
// return as nullable for exactly that reason; returning `this.surface` as a non-null fallback
|
|
178
|
+
// defeated that defer check and caused premature top-level insertion (2026-07: FlatList cells
|
|
179
|
+
// rendered outside their ScrollView).
|
|
180
|
+
//
|
|
181
|
+
// Safe only because appendChild/insertBefore above now also treat a null parent as "skip, wait
|
|
182
|
+
// for projection" — a second Angular call site (`insertAnchorNode`, hit whenever a directive
|
|
183
|
+
// does `inject(ViewContainerRef)`, e.g. VListOutletDirective) forwards this null straight into
|
|
184
|
+
// insertBefore without checking it; without that guard it crashed on-device.
|
|
185
|
+
parentNode(node) {
|
|
186
|
+
return node.parent ?? null;
|
|
187
|
+
}
|
|
188
|
+
nextSibling(node) {
|
|
189
|
+
const siblings = node.parent !== undefined ? node.parent.children : this.surface.children;
|
|
190
|
+
const index = siblings.indexOf(node);
|
|
191
|
+
return index >= 0 ? (siblings[index + 1] ?? null) : null;
|
|
192
|
+
}
|
|
193
|
+
// locateHostElement always routes createComponent's `hostElement` THROUGH here as
|
|
194
|
+
// `selectorOrNode` (Angular's own core.mjs) — it is never bypassed just because a real
|
|
195
|
+
// object (vs. a selector string) was given. A string only reaches us on the (unused here)
|
|
196
|
+
// selector-string bootstrap path, so the surface is the fallback for that case only.
|
|
197
|
+
selectRootElement(selectorOrNode) {
|
|
198
|
+
return typeof selectorOrNode === 'string' ? this.surface : selectorOrNode;
|
|
199
|
+
}
|
|
200
|
+
setAttribute(el, name, value) {
|
|
201
|
+
if (isSurface(el))
|
|
202
|
+
return;
|
|
203
|
+
routeProp(el, name, value);
|
|
204
|
+
this.surface.requestCommit();
|
|
205
|
+
}
|
|
206
|
+
removeAttribute(el, name) {
|
|
207
|
+
if (isSurface(el))
|
|
208
|
+
return;
|
|
209
|
+
routeProp(el, name, undefined);
|
|
210
|
+
this.surface.requestCommit();
|
|
211
|
+
}
|
|
212
|
+
// Ivy compiles every class= / [class.foo] / [ngClass] form down to per-token addClass/
|
|
213
|
+
// removeClass calls (never a single setAttribute('class', ...) call), so a per-node token set
|
|
214
|
+
// is accumulated here and re-joined into one string on every change, then handed to
|
|
215
|
+
// routeProp('class', ...) exactly like Vue's template `class="..."` and React's JSX
|
|
216
|
+
// `className="..."` — all three resolve through the SAME centralized class+style merge in
|
|
217
|
+
// core/engine/src/node.ts, so a class registered via the SFC/CSS-Modules style compiler
|
|
218
|
+
// resolves identically regardless of adapter.
|
|
219
|
+
classTokens = new WeakMap();
|
|
220
|
+
addClass(el, name) {
|
|
221
|
+
if (isSurface(el))
|
|
222
|
+
return;
|
|
223
|
+
const tokens = this.classTokens.get(el) ?? new Set();
|
|
224
|
+
tokens.add(name);
|
|
225
|
+
this.classTokens.set(el, tokens);
|
|
226
|
+
routeProp(el, 'class', [...tokens].join(' '));
|
|
227
|
+
this.surface.requestCommit();
|
|
228
|
+
}
|
|
229
|
+
removeClass(el, name) {
|
|
230
|
+
if (isSurface(el))
|
|
231
|
+
return;
|
|
232
|
+
const tokens = this.classTokens.get(el);
|
|
233
|
+
if (tokens === undefined)
|
|
234
|
+
return;
|
|
235
|
+
tokens.delete(name);
|
|
236
|
+
routeProp(el, 'class', tokens.size > 0 ? [...tokens].join(' ') : undefined);
|
|
237
|
+
this.surface.requestCommit();
|
|
238
|
+
}
|
|
239
|
+
// Angular decomposes a [style] binding into per-key setStyle calls (ɵɵstyleMap). RN wants
|
|
240
|
+
// the whole style object as one `style` prop, so merge each key into it — onto the explicit
|
|
241
|
+
// style half tracked by routeProp's centralized class+style merge (core/engine/src/node.ts),
|
|
242
|
+
// NOT el.props.style directly: that may now be the [classStyle, explicitStyle] array the
|
|
243
|
+
// merge writes, and spreading an array as a record would silently produce numeric-index keys.
|
|
244
|
+
setStyle(el, style, value) {
|
|
245
|
+
if (isSurface(el))
|
|
246
|
+
return;
|
|
247
|
+
const current = getExplicitStyle(el);
|
|
248
|
+
const base = isRecord(current) ? current : {};
|
|
249
|
+
routeProp(el, 'style', { ...base, [style]: value });
|
|
250
|
+
this.surface.requestCommit();
|
|
251
|
+
}
|
|
252
|
+
removeStyle(el, style) {
|
|
253
|
+
if (isSurface(el))
|
|
254
|
+
return;
|
|
255
|
+
const current = getExplicitStyle(el);
|
|
256
|
+
if (!isRecord(current))
|
|
257
|
+
return;
|
|
258
|
+
const { [style]: _removed, ...rest } = current;
|
|
259
|
+
routeProp(el, 'style', rest);
|
|
260
|
+
this.surface.requestCommit();
|
|
261
|
+
}
|
|
262
|
+
// [prop]="x" bindings. routeProp makes the prop-vs-event decision from the node's
|
|
263
|
+
// ViewConfig (identical to React/Vue), so the whole flat-bag prop layer is shared.
|
|
264
|
+
setProperty(el, name, value) {
|
|
265
|
+
if (isSurface(el))
|
|
266
|
+
return;
|
|
267
|
+
routeProp(el, name, value);
|
|
268
|
+
this.surface.requestCommit();
|
|
269
|
+
}
|
|
270
|
+
setValue(node, value) {
|
|
271
|
+
// A useful permanent seam: text mutations are low-frequency and the one place a stale
|
|
272
|
+
// `{{binding}}` (a change-detection gap) shows up as "the setValue never fired".
|
|
273
|
+
dlog(`Angular renderer setValue "${value}" on ${describeHost(node)}`);
|
|
274
|
+
setText(node, value);
|
|
275
|
+
this.surface.requestCommit();
|
|
276
|
+
}
|
|
277
|
+
// (event)="x" bindings. Angular hands the event name EXPLICITLY (no onX->x inference),
|
|
278
|
+
// so we drive the engine's structural event channel directly — the path setEventListener
|
|
279
|
+
// in core/engine/src/node.ts already names "Angular Renderer2.listen" for. Global targets
|
|
280
|
+
// (window/document/body) have no Fabric node, so they no-op.
|
|
281
|
+
listen(target, eventName, callback) {
|
|
282
|
+
if (!isSymbioteNode(target))
|
|
283
|
+
return () => { };
|
|
284
|
+
setEventListener(target, eventName, callback);
|
|
285
|
+
return () => setEventListener(target, eventName, undefined);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Provided to Angular as RendererFactory2; createRenderer returns the single
|
|
289
|
+
// surface-bound renderer for every component (begin/end commit-coalescing is unnecessary —
|
|
290
|
+
// requestCommit already microtask-coalesces).
|
|
291
|
+
export class SymbioteRendererFactory {
|
|
292
|
+
surface;
|
|
293
|
+
renderer;
|
|
294
|
+
constructor(surface) {
|
|
295
|
+
this.surface = surface;
|
|
296
|
+
}
|
|
297
|
+
createRenderer(_hostElement, _type) {
|
|
298
|
+
return (this.renderer ??= new SymbioteRenderer(this.surface));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/renderer/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,8EAA8E;AAC9E,oFAAoF;AACpF,qFAAqF;AACrF,wFAAwF;AACxF,4DAA4D;AAE5D,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,cAAc,EACd,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,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EAAE,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IAC/B,CAAC;IAED,uFAAuF;IACvF,yFAAyF;IACzF,0FAA0F;IAC1F,6DAA6D;IAC7D,MAAM,CACJ,MAAe,EACf,SAAiB,EACjB,QAA4C;QAE5C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;YAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QAC7C,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AAED,6EAA6E;AAC7E,2FAA2F;AAC3F,8CAA8C;AAC9C,MAAM,OAAO,uBAAuB;IAGL;IAFrB,QAAQ,CAA+B;IAE/C,YAA6B,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEzD,cAAc,CAAC,YAAqB,EAAE,KAA2B;QAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IColorSchemeName } from '@symbiote-native/engine';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Angular twin of React's `useColorScheme` and Vue's `useColorScheme` composable. The service
|
|
5
|
+
* holds a Signal that tracks the device color scheme; consumers read it via `inject`:
|
|
6
|
+
*
|
|
7
|
+
* readonly colorScheme = inject(ColorSchemeService).colorScheme;
|
|
8
|
+
*
|
|
9
|
+
* State and lifecycle live in DI, not in a function closure.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ColorSchemeService {
|
|
12
|
+
readonly colorScheme: import("@angular/core").WritableSignal<IColorSchemeName | null>;
|
|
13
|
+
constructor();
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorSchemeService, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ColorSchemeService>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DestroyRef, inject, Injectable, signal } from '@angular/core';
|
|
2
|
+
import { Appearance } from '@symbiote-native/engine';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Angular twin of React's `useColorScheme` and Vue's `useColorScheme` composable. The service
|
|
6
|
+
* holds a Signal that tracks the device color scheme; consumers read it via `inject`:
|
|
7
|
+
*
|
|
8
|
+
* readonly colorScheme = inject(ColorSchemeService).colorScheme;
|
|
9
|
+
*
|
|
10
|
+
* State and lifecycle live in DI, not in a function closure.
|
|
11
|
+
*/
|
|
12
|
+
export class ColorSchemeService {
|
|
13
|
+
colorScheme = signal(Appearance.getColorScheme(), /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "colorScheme" }] : /* istanbul ignore next */ []));
|
|
15
|
+
constructor() {
|
|
16
|
+
const destroyRef = inject(DestroyRef);
|
|
17
|
+
const subscription = Appearance.addChangeListener(preferences => {
|
|
18
|
+
this.colorScheme.set(preferences.colorScheme);
|
|
19
|
+
});
|
|
20
|
+
destroyRef.onDestroy(() => {
|
|
21
|
+
subscription.remove();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ColorSchemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
25
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ColorSchemeService, providedIn: 'root' });
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ColorSchemeService, decorators: [{
|
|
28
|
+
type: Injectable,
|
|
29
|
+
args: [{ providedIn: 'root' }]
|
|
30
|
+
}], ctorParameters: () => [] });
|
|
31
|
+
//# sourceMappingURL=color-scheme.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-scheme.service.js","sourceRoot":"","sources":["../../../src/services/color-scheme.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,UAAU,EAAyB,MAAM,yBAAyB,CAAC;;AAE5E;;;;;;;GAOG;AAEH,MAAM,OAAO,kBAAkB;IACpB,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC,cAAc,EAAE;oFAAC,CAAC;IAEpF;QACE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAEtC,MAAM,YAAY,GAAG,UAAU,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE;YAC9D,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE;YACxB,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;uGAbU,kBAAkB;2GAAlB,kBAAkB,cADL,MAAM;;2FACnB,kBAAkB;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IDisplayMetrics } from '@symbiote-native/engine';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Angular twin of React's `useWindowDimensions` and Vue's `useWindowDimensions` composable. The
|
|
5
|
+
* service holds a Signal that tracks window metrics; consumers read it via `inject`:
|
|
6
|
+
*
|
|
7
|
+
* readonly dimensions = inject(WindowDimensionsService).dimensions;
|
|
8
|
+
*
|
|
9
|
+
* State and lifecycle live in DI, not in a function closure.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WindowDimensionsService {
|
|
12
|
+
readonly dimensions: import("@angular/core").WritableSignal<IDisplayMetrics>;
|
|
13
|
+
constructor();
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WindowDimensionsService, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WindowDimensionsService>;
|
|
16
|
+
}
|