@symbiote-native/angular 0.6.0 → 0.6.1
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/babel-register-composed.cjs +11 -3
- 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/components/input-accessory-view/index.d.ts +2 -1
- package/build/angular/components/input-accessory-view/index.js +28 -39
- package/build/angular/components/input-accessory-view/index.js.map +1 -1
- package/build/angular/components/scroll-view/projection.js +70 -48
- package/build/angular/components/scroll-view/projection.js.map +1 -1
- package/build/angular/components/scroll-view/shared.js +28 -25
- package/build/angular/components/scroll-view/shared.js.map +1 -1
- package/build/angular/components/scroll-view/sticky-header.d.ts +6 -7
- package/build/angular/components/scroll-view/sticky-header.js +82 -65
- package/build/angular/components/scroll-view/sticky-header.js.map +1 -1
- package/build/angular/components/touchable/index.d.ts +2 -5
- package/build/angular/components/touchable/index.js +36 -56
- package/build/angular/components/touchable/index.js.map +1 -1
- package/build/angular/components/virtualized-list/index.d.ts +5 -20
- package/build/angular/components/virtualized-list/index.js +145 -275
- package/build/angular/components/virtualized-list/index.js.map +1 -1
- package/build/angular/components/virtualized-section-list/index.js +2 -4
- package/build/angular/components/virtualized-section-list/index.js.map +1 -1
- package/build/angular/index.d.ts +2 -1
- package/build/angular/index.js +6 -1
- package/build/angular/index.js.map +1 -1
- package/build/angular/renderer/index.d.ts +0 -1
- package/build/angular/renderer/index.js +5 -60
- package/build/angular/renderer/index.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/responder-nested-cd.test.ts +1 -1
- package/src/anchor-host-registry.ts +88 -0
- package/src/components/input-accessory-view/index.ts +30 -39
- package/src/components/scroll-view/projection.ts +76 -46
- package/src/components/scroll-view/shared.ts +27 -19
- package/src/components/scroll-view/sticky-header.ts +89 -64
- package/src/components/touchable/index.ts +52 -66
- package/src/components/virtualized-list/index.ts +157 -368
- package/src/components/virtualized-section-list/index.ts +6 -3
- package/src/index.ts +6 -1
- package/src/renderer/index.ts +5 -63
- package/src/renderer/renderer.test.ts +2 -1
- package/build/bootstrap.d.ts +0 -7
- package/build/bootstrap.js +0 -14
- package/build/components/activity-indicator/index.android.d.ts +0 -9
- package/build/components/activity-indicator/index.android.js +0 -64
- package/build/components/activity-indicator/index.d.ts +0 -1
- package/build/components/activity-indicator/index.ios.d.ts +0 -5
- package/build/components/activity-indicator/index.ios.js +0 -64
- package/build/components/activity-indicator/index.js +0 -3
- package/build/components/activity-indicator/shared.d.ts +0 -64
- package/build/components/activity-indicator/shared.js +0 -424
- package/build/components/button.d.ts +0 -60
- package/build/components/button.js +0 -456
- package/build/components/flat-list/index.d.ts +0 -119
- package/build/components/flat-list/index.js +0 -691
- package/build/components/image/index.android.d.ts +0 -7
- package/build/components/image/index.android.js +0 -88
- package/build/components/image/index.d.ts +0 -1
- package/build/components/image/index.ios.d.ts +0 -7
- package/build/components/image/index.ios.js +0 -88
- package/build/components/image/index.js +0 -2
- package/build/components/image/shared.d.ts +0 -101
- package/build/components/image/shared.js +0 -405
- package/build/components/image-background.d.ts +0 -78
- package/build/components/image-background.js +0 -583
- package/build/components/input-accessory-view/index.d.ts +0 -56
- package/build/components/input-accessory-view/index.js +0 -403
- package/build/components/keyboard-avoiding-view/index.d.ts +0 -79
- package/build/components/keyboard-avoiding-view/index.js +0 -504
- package/build/components/modal/index.d.ts +0 -89
- package/build/components/modal/index.js +0 -529
- package/build/components/pressable/index.d.ts +0 -120
- package/build/components/pressable/index.js +0 -639
- package/build/components/refresh-control/index.d.ts +0 -83
- package/build/components/refresh-control/index.js +0 -509
- package/build/components/safe-area-view/index.d.ts +0 -54
- package/build/components/safe-area-view/index.js +0 -388
- package/build/components/scroll-view/index.android.d.ts +0 -16
- package/build/components/scroll-view/index.android.js +0 -228
- package/build/components/scroll-view/index.d.ts +0 -3
- package/build/components/scroll-view/index.ios.d.ts +0 -6
- package/build/components/scroll-view/index.ios.js +0 -113
- package/build/components/scroll-view/index.js +0 -5
- package/build/components/scroll-view/projection.d.ts +0 -32
- package/build/components/scroll-view/projection.js +0 -311
- package/build/components/scroll-view/shared.d.ts +0 -225
- package/build/components/scroll-view/shared.js +0 -757
- package/build/components/scroll-view/sticky-header.d.ts +0 -38
- package/build/components/scroll-view/sticky-header.js +0 -257
- package/build/components/section-list/index.d.ts +0 -113
- package/build/components/section-list/index.js +0 -768
- package/build/components/switch/index.android.d.ts +0 -17
- package/build/components/switch/index.android.js +0 -107
- package/build/components/switch/index.d.ts +0 -1
- package/build/components/switch/index.ios.d.ts +0 -16
- package/build/components/switch/index.ios.js +0 -106
- package/build/components/switch/index.js +0 -3
- package/build/components/switch/shared.d.ts +0 -37
- package/build/components/switch/shared.js +0 -176
- package/build/components/text-input.d.ts +0 -150
- package/build/components/text-input.js +0 -821
- package/build/components/touchable/index.d.ts +0 -241
- package/build/components/touchable/index.js +0 -1672
- package/build/components/touchable-native-feedback/index.d.ts +0 -80
- package/build/components/touchable-native-feedback/index.js +0 -545
- package/build/components/virtualized-list/directives.d.ts +0 -41
- package/build/components/virtualized-list/directives.js +0 -249
- package/build/components/virtualized-list/index.d.ts +0 -265
- package/build/components/virtualized-list/index.js +0 -1343
- package/build/components/virtualized-section-list/directives.d.ts +0 -28
- package/build/components/virtualized-section-list/directives.js +0 -148
- package/build/components/virtualized-section-list/index.d.ts +0 -175
- package/build/components/virtualized-section-list/index.js +0 -854
- package/build/components.d.ts +0 -39
- package/build/components.js +0 -37
- package/build/create-portal/index.d.ts +0 -17
- package/build/create-portal/index.js +0 -128
- package/build/create-tunnel/index.d.ts +0 -29
- package/build/create-tunnel/index.js +0 -181
- package/build/descriptor-to-angular/index.d.ts +0 -19
- package/build/descriptor-to-angular/index.js +0 -186
- package/build/host-instance/index.d.ts +0 -2
- package/build/host-instance/index.js +0 -36
- package/build/index.d.ts +0 -21
- package/build/index.js +0 -40
- package/build/modules/animated/animated-leaf-binder/index.d.ts +0 -14
- package/build/modules/animated/animated-leaf-binder/index.js +0 -90
- package/build/modules/animated/animated-leaf-binder.d.ts +0 -14
- package/build/modules/animated/animated-leaf-binder.js +0 -90
- package/build/modules/animated/create-animated-component.d.ts +0 -48
- package/build/modules/animated/create-animated-component.js +0 -425
- package/build/modules/animated/index.d.ts +0 -51
- package/build/modules/animated/index.js +0 -58
- package/build/modules/app-registry/index.d.ts +0 -7
- package/build/modules/app-registry/index.js +0 -22
- package/build/modules/status-bar/index.d.ts +0 -17
- package/build/modules/status-bar/index.js +0 -121
- package/build/primitives/index.d.ts +0 -32
- package/build/primitives/index.js +0 -386
- package/build/primitives/shared.d.ts +0 -83
- package/build/primitives/shared.js +0 -230
- package/build/render/index.d.ts +0 -11
- package/build/render/index.js +0 -170
- package/build/renderer/index.d.ts +0 -38
- package/build/renderer/index.js +0 -355
- package/build/services/color-scheme.service.d.ts +0 -13
- package/build/services/color-scheme.service.js +0 -72
- package/build/services/index.d.ts +0 -2
- package/build/services/index.js +0 -2
- package/build/services/window-dimensions.service.d.ts +0 -13
- package/build/services/window-dimensions.service.js +0 -83
package/build/components.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export { ActivityIndicator } from './components/activity-indicator';
|
|
2
|
-
export type { IActivityIndicatorProps } from './components/activity-indicator';
|
|
3
|
-
export { Image, setImageSourceResolver } from './components/image';
|
|
4
|
-
export { InputAccessoryView } from './components/input-accessory-view';
|
|
5
|
-
export type { IAngularInputAccessoryViewProps } from './components/input-accessory-view';
|
|
6
|
-
export { Modal } from './components/modal';
|
|
7
|
-
export type { IAngularModalProps, IModalAnimationType, IModalOrientation, IModalOrientationChangeEvent, IModalPresentationStyle, } from './components/modal';
|
|
8
|
-
export type { IImageProps, IImageSource, IImageSourceProp, IResizeMode, IImageSize, IImageCacheStatus, } from './components/image';
|
|
9
|
-
export { Pressable } from './components/pressable';
|
|
10
|
-
export type { IAngularPressableProps } from './components/pressable';
|
|
11
|
-
export { SafeAreaView } from './components/safe-area-view';
|
|
12
|
-
export type { IAngularSafeAreaViewProps } from './components/safe-area-view';
|
|
13
|
-
export { Switch } from './components/switch';
|
|
14
|
-
export type { ISwitchProps, ISwitchTrackColor } from './components/switch';
|
|
15
|
-
export { ImageBackground } from './components/image-background';
|
|
16
|
-
export type { IAngularImageBackgroundProps } from './components/image-background';
|
|
17
|
-
export { KeyboardAvoidingView } from './components/keyboard-avoiding-view';
|
|
18
|
-
export type { IAngularKeyboardAvoidingViewProps, IKeyboardAvoidingBehavior, } from './components/keyboard-avoiding-view';
|
|
19
|
-
export { RefreshControl } from './components/refresh-control';
|
|
20
|
-
export type { IAngularRefreshControlProps } from './components/refresh-control';
|
|
21
|
-
export { TextInput } from './components/text-input';
|
|
22
|
-
export type { IAngularTextInputProps, IEnterKeyHint, IInputMode, ISubmitBehavior, ITextInputHandle, ITextInputSelection, } from './components/text-input';
|
|
23
|
-
export { TouchableNativeFeedback } from './components/touchable-native-feedback';
|
|
24
|
-
export type { IAngularTouchableNativeFeedbackProps, INativeFeedbackBackground, IRippleBackground, IThemeAttrBackground, } from './components/touchable-native-feedback';
|
|
25
|
-
export { TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, } from './components/touchable';
|
|
26
|
-
export type { IAngularTouchableHighlightProps, IAngularTouchableOpacityProps, IAngularTouchableWithoutFeedbackProps, } from './components/touchable';
|
|
27
|
-
export { ScrollView, ScrollViewStickyHeader } from './components/scroll-view';
|
|
28
|
-
export type { IAngularScrollViewProps, IScrollViewHandle, IStickyHeaderComponentType, } from './components/scroll-view';
|
|
29
|
-
export { Button } from './components/button';
|
|
30
|
-
export type { IButtonProps } from './components/button';
|
|
31
|
-
export { VirtualizedList, VListEmptyDirective, VListFooterDirective, VListHeaderDirective, VListItemDirective, VListSeparatorDirective, } from './components/virtualized-list';
|
|
32
|
-
export type { ICellLayout, ISeparatorProps, ISeparators, IViewabilityConfig, IViewabilityConfigCallbackPair, IViewableItemsChangedInfo, IViewToken, IVirtualizedListHandle, IVirtualizedListProps, IVListItemContext, IVListSeparatorContext, } from './components/virtualized-list';
|
|
33
|
-
export { FlatList } from './components/flat-list';
|
|
34
|
-
export type { IFlatListHandle, IFlatListProps } from './components/flat-list';
|
|
35
|
-
export { VirtualizedSectionList, VSectionFooterDirective, VSectionHeaderDirective, VSectionItemDirective, VSectionSeparatorDirective, } from './components/virtualized-section-list';
|
|
36
|
-
export type { ISection, IVirtualizedSectionListHandle, IVirtualizedSectionListProps, IVSectionContext, IVSectionItemContext, } from './components/virtualized-section-list';
|
|
37
|
-
export { SectionList } from './components/section-list';
|
|
38
|
-
export type { ISectionListHandle, ISectionListProps } from './components/section-list';
|
|
39
|
-
export { ViewHost, ViewHost as View, TextHost, TextHost as Text, ImageHost, ScrollViewHost, ScrollContentView, HorizontalScrollView, HorizontalScrollContentView, TextInputHost, MultilineTextInputHost, SwitchHost, ActivityIndicatorHost, SafeAreaViewHost, ModalHost, RefreshControlHost, InputAccessoryViewHost, SymbioteHostPropsDirective, anchorHostStyle, stableAnchorStyle, } from './primitives/index';
|
package/build/components.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Angular component surface over Symbiote intrinsics. Public tags (`View`, `Text`) are
|
|
2
|
-
// ergonomic aliases of the primitive hosts in `../primitives`; engine intrinsics (`symbiote-*`)
|
|
3
|
-
// are the actual Angular primitive host components. Every primitive host declares `style` as a
|
|
4
|
-
// real Angular input so RN `StyleProp` arrays/objects are flattened and forwarded through the
|
|
5
|
-
// custom renderer, instead of being misinterpreted by Angular's CSS style engine.
|
|
6
|
-
export { ActivityIndicator } from './components/activity-indicator';
|
|
7
|
-
export { Image, setImageSourceResolver } from './components/image';
|
|
8
|
-
export { InputAccessoryView } from './components/input-accessory-view';
|
|
9
|
-
export { Modal } from './components/modal';
|
|
10
|
-
export { Pressable } from './components/pressable';
|
|
11
|
-
export { SafeAreaView } from './components/safe-area-view';
|
|
12
|
-
export { Switch } from './components/switch';
|
|
13
|
-
export { ImageBackground } from './components/image-background';
|
|
14
|
-
export { KeyboardAvoidingView } from './components/keyboard-avoiding-view';
|
|
15
|
-
export { RefreshControl } from './components/refresh-control';
|
|
16
|
-
export { TextInput } from './components/text-input';
|
|
17
|
-
export { TouchableNativeFeedback } from './components/touchable-native-feedback';
|
|
18
|
-
export { TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, } from './components/touchable';
|
|
19
|
-
export { ScrollView, ScrollViewStickyHeader } from './components/scroll-view';
|
|
20
|
-
export { Button } from './components/button';
|
|
21
|
-
export { VirtualizedList, VListEmptyDirective, VListFooterDirective, VListHeaderDirective, VListItemDirective, VListSeparatorDirective, } from './components/virtualized-list';
|
|
22
|
-
export { FlatList } from './components/flat-list';
|
|
23
|
-
export { VirtualizedSectionList, VSectionFooterDirective, VSectionHeaderDirective, VSectionItemDirective, VSectionSeparatorDirective, } from './components/virtualized-section-list';
|
|
24
|
-
export { SectionList } from './components/section-list';
|
|
25
|
-
// Re-export primitive hosts so composed components can import them from the public barrel too.
|
|
26
|
-
export { ViewHost, ViewHost as View, TextHost, TextHost as Text, ImageHost, ScrollViewHost, ScrollContentView, HorizontalScrollView, HorizontalScrollContentView, TextInputHost, MultilineTextInputHost, SwitchHost, ActivityIndicatorHost, SafeAreaViewHost, ModalHost, RefreshControlHost, InputAccessoryViewHost, SymbioteHostPropsDirective,
|
|
27
|
-
// Exported so an OUT-OF-PACKAGE composed component (e.g. @symbiote-native/slider's Angular wrapper,
|
|
28
|
-
// itself listed in ANCHOR_HOST_COMPONENTS) can merge its own anchor host's class-derived style
|
|
29
|
-
// the same way every in-package composed component does — see anchorHostStyle's doc comment.
|
|
30
|
-
anchorHostStyle,
|
|
31
|
-
// Same reasoning, for a component whose merged style is reassigned unconditionally every CD
|
|
32
|
-
// tick (rather than read once inside a props-object getter) — see stableAnchorStyle's doc
|
|
33
|
-
// comment for the free-running-CD-loop it prevents.
|
|
34
|
-
stableAnchorStyle, } from './primitives/index';
|
|
35
|
-
// Public ergonomic aliases: <View> and <Text> resolve directly to the primitive hosts
|
|
36
|
-
// (no extra Angular bookkeeping anchor), while the internal symbiote-* selectors remain
|
|
37
|
-
// available for composed adapter templates.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ViewContainerRef, type OnChanges, type OnDestroy } from '@angular/core';
|
|
2
|
-
/** Marks the destination for `*portal` — place it on whichever already-mounted host should
|
|
3
|
-
* paint the portaled content (e.g. a persistent overlay-host View near the app root), then
|
|
4
|
-
* export it to a template variable and pass that variable as `*portal`'s target. */
|
|
5
|
-
export declare class PortalOutletDirective {
|
|
6
|
-
readonly viewContainerRef: ViewContainerRef;
|
|
7
|
-
}
|
|
8
|
-
/** `*portal="overlayHost"` — renders the host element into whichever `PortalOutletDirective`
|
|
9
|
-
* `overlayHost` refers to, same surface only (see the file header). Combine with `@if` for
|
|
10
|
-
* conditional visibility, exactly like `*ngIf`. */
|
|
11
|
-
export declare class PortalDirective implements OnChanges, OnDestroy {
|
|
12
|
-
portal: PortalOutletDirective;
|
|
13
|
-
private readonly templateRef;
|
|
14
|
-
private viewRef;
|
|
15
|
-
ngOnChanges(): void;
|
|
16
|
-
ngOnDestroy(): void;
|
|
17
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// createPortal for @symbiote-native/angular — the Angular twin of the React/Vue same-surface portal
|
|
2
|
-
// (create-portal.ts / Teleport in runtime-helpers.ts). Scope is identical: the target must be
|
|
3
|
-
// an already-mounted location WITHIN THE SAME SURFACE as the portal's call site — moving content
|
|
4
|
-
// across independently-mounted surfaces has no safe host-level primitive to hook into, so
|
|
5
|
-
// createTunnel (create-tunnel.ts) covers that cross-surface case instead.
|
|
6
|
-
//
|
|
7
|
-
// React/Vue implement this as a thin validating wrapper around a mechanism the FRAMEWORK
|
|
8
|
-
// ITSELF already has (react-reconciler's Fiber-level HostPortal, Vue's own <Teleport>) — all
|
|
9
|
-
// the actual node-moving is handled generically by the engine's insert/remove, which those
|
|
10
|
-
// frameworks already call. Angular has no such built-in: there is no `@angular/cdk` dependency
|
|
11
|
-
// here (core-only, see package.json), and physically moving an EmbeddedView's already-created
|
|
12
|
-
// root nodes via Renderer2 after the fact is NOT safe — Angular's own view-destroy path removes
|
|
13
|
-
// a view's nodes from wherever ITS OWN bookkeeping thinks they live (the container's insertion
|
|
14
|
-
// point), not from wherever a node was manually moved to afterwards, so a raw Renderer2 move
|
|
15
|
-
// would desync Angular's internals from the retained tree.
|
|
16
|
-
//
|
|
17
|
-
// PortalDirective is a STRUCTURAL directive (`*portal="overlayHost"`), not a component that
|
|
18
|
-
// takes a separate `<ng-template>` + `[content]` binding — that two-step reads as foreign to
|
|
19
|
-
// anyone used to `*ngIf`/`*ngFor`/`*ngTemplateOutlet`, where the directive sits directly on the
|
|
20
|
-
// content and its TemplateRef comes from injection, not a passed-in reference. `*portal="x"`
|
|
21
|
-
// desugars the same way `*ngIf` does: Angular wraps the host element in an `<ng-template>` and
|
|
22
|
-
// injects that template's own TemplateRef into the directive automatically.
|
|
23
|
-
//
|
|
24
|
-
// The safe, fully-public-API mechanism: create the embedded view DIRECTLY inside a
|
|
25
|
-
// ViewContainerRef anchored at the destination, so there is nothing to move at all. That
|
|
26
|
-
// ViewContainerRef has to come from somewhere in the destination's own template — hence
|
|
27
|
-
// `PortalOutletDirective`, a marker placed on the target host (`<View portalOutlet
|
|
28
|
-
// #overlayHost="portalOutlet">`) purely to expose its ViewContainerRef, the same
|
|
29
|
-
// export-as-template-variable idiom `#form="ngForm"` uses. This also replaces the
|
|
30
|
-
// `isSymbioteNode` runtime guard React/Vue need: there `to` is an arbitrary JS value at
|
|
31
|
-
// runtime (a wrong ref, a string, a plain object all type-check as `any`/`unknown` until
|
|
32
|
-
// validated), but here `to` is typed as `PortalOutletDirective` — the only way to construct
|
|
33
|
-
// one is Angular's own template compiler resolving a template reference variable, so
|
|
34
|
-
// `strictTemplates` rejects anything else at compile time and there is nothing left to guard
|
|
35
|
-
// against at runtime.
|
|
36
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
37
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
38
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
39
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
40
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
41
|
-
var _, done = false;
|
|
42
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
43
|
-
var context = {};
|
|
44
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
45
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
46
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
47
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
48
|
-
if (kind === "accessor") {
|
|
49
|
-
if (result === void 0) continue;
|
|
50
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
51
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
52
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
53
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
54
|
-
}
|
|
55
|
-
else if (_ = accept(result)) {
|
|
56
|
-
if (kind === "field") initializers.unshift(_);
|
|
57
|
-
else descriptor[key] = _;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
61
|
-
done = true;
|
|
62
|
-
};
|
|
63
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
64
|
-
var useValue = arguments.length > 2;
|
|
65
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
66
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
67
|
-
}
|
|
68
|
-
return useValue ? value : void 0;
|
|
69
|
-
};
|
|
70
|
-
import { Directive, inject, Input, TemplateRef, ViewContainerRef, } from '@angular/core';
|
|
71
|
-
/** Marks the destination for `*portal` — place it on whichever already-mounted host should
|
|
72
|
-
* paint the portaled content (e.g. a persistent overlay-host View near the app root), then
|
|
73
|
-
* export it to a template variable and pass that variable as `*portal`'s target. */
|
|
74
|
-
let PortalOutletDirective = (() => {
|
|
75
|
-
let _classDecorators = [Directive({ selector: '[portalOutlet]', standalone: true, exportAs: 'portalOutlet' })];
|
|
76
|
-
let _classDescriptor;
|
|
77
|
-
let _classExtraInitializers = [];
|
|
78
|
-
let _classThis;
|
|
79
|
-
var PortalOutletDirective = class {
|
|
80
|
-
static { _classThis = this; }
|
|
81
|
-
static {
|
|
82
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
83
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
84
|
-
PortalOutletDirective = _classThis = _classDescriptor.value;
|
|
85
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
86
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
87
|
-
}
|
|
88
|
-
viewContainerRef = inject(ViewContainerRef);
|
|
89
|
-
};
|
|
90
|
-
return PortalOutletDirective = _classThis;
|
|
91
|
-
})();
|
|
92
|
-
export { PortalOutletDirective };
|
|
93
|
-
/** `*portal="overlayHost"` — renders the host element into whichever `PortalOutletDirective`
|
|
94
|
-
* `overlayHost` refers to, same surface only (see the file header). Combine with `@if` for
|
|
95
|
-
* conditional visibility, exactly like `*ngIf`. */
|
|
96
|
-
let PortalDirective = (() => {
|
|
97
|
-
let _classDecorators = [Directive({ selector: '[portal]', standalone: true })];
|
|
98
|
-
let _classDescriptor;
|
|
99
|
-
let _classExtraInitializers = [];
|
|
100
|
-
let _classThis;
|
|
101
|
-
let _portal_decorators;
|
|
102
|
-
let _portal_initializers = [];
|
|
103
|
-
let _portal_extraInitializers = [];
|
|
104
|
-
var PortalDirective = class {
|
|
105
|
-
static { _classThis = this; }
|
|
106
|
-
static {
|
|
107
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
108
|
-
_portal_decorators = [Input({ required: true })];
|
|
109
|
-
__esDecorate(null, null, _portal_decorators, { kind: "field", name: "portal", static: false, private: false, access: { has: obj => "portal" in obj, get: obj => obj.portal, set: (obj, value) => { obj.portal = value; } }, metadata: _metadata }, _portal_initializers, _portal_extraInitializers);
|
|
110
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
111
|
-
PortalDirective = _classThis = _classDescriptor.value;
|
|
112
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
113
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
114
|
-
}
|
|
115
|
-
portal = __runInitializers(this, _portal_initializers, void 0);
|
|
116
|
-
templateRef = (__runInitializers(this, _portal_extraInitializers), inject(TemplateRef));
|
|
117
|
-
viewRef = null;
|
|
118
|
-
ngOnChanges() {
|
|
119
|
-
this.viewRef?.destroy();
|
|
120
|
-
this.viewRef = this.portal.viewContainerRef.createEmbeddedView(this.templateRef);
|
|
121
|
-
}
|
|
122
|
-
ngOnDestroy() {
|
|
123
|
-
this.viewRef?.destroy();
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
return PortalDirective = _classThis;
|
|
127
|
-
})();
|
|
128
|
-
export { PortalDirective };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { TemplateRef, type OnDestroy, type OnInit, type Signal } from '@angular/core';
|
|
2
|
-
export interface ITunnelStore {
|
|
3
|
-
readonly entries: Signal<ReadonlyMap<number, TemplateRef<unknown>>>;
|
|
4
|
-
register(id: number, templateRef: TemplateRef<unknown>): void;
|
|
5
|
-
unregister(id: number): void;
|
|
6
|
-
}
|
|
7
|
-
export declare function createTunnel(): ITunnelStore;
|
|
8
|
-
/** `*tunnelIn="overlayTunnel"` — registers the host element under `overlayTunnel` from
|
|
9
|
-
* wherever it's mounted, any surface. Combine with `@if` for conditional visibility, exactly
|
|
10
|
-
* like `*ngIf`. */
|
|
11
|
-
export declare class TunnelInDirective implements OnInit, OnDestroy {
|
|
12
|
-
tunnelIn: ITunnelStore;
|
|
13
|
-
private readonly templateRef;
|
|
14
|
-
private readonly id;
|
|
15
|
-
ngOnInit(): void;
|
|
16
|
-
ngOnDestroy(): void;
|
|
17
|
-
}
|
|
18
|
-
/** Renders everything currently registered on `tunnel`, in registration order. Mount this in
|
|
19
|
-
* the component that should actually paint the content — the tunnel's own `<router-outlet>`. */
|
|
20
|
-
export declare class TunnelOut implements OnInit, OnDestroy {
|
|
21
|
-
tunnel: ITunnelStore;
|
|
22
|
-
private readonly viewContainerRef;
|
|
23
|
-
private readonly injector;
|
|
24
|
-
private readonly views;
|
|
25
|
-
private stopEffect;
|
|
26
|
-
ngOnInit(): void;
|
|
27
|
-
ngOnDestroy(): void;
|
|
28
|
-
private sync;
|
|
29
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
// createTunnel for @symbiote-native/angular — the Angular twin of the React/Vue cross-surface tunnel
|
|
2
|
-
// (adapters/react/src/create-tunnel.tsx, adapters/vue/src/create-tunnel.ts — read their
|
|
3
|
-
// headers for the full "why not just extend the portal across surfaces" rationale; same prior
|
|
4
|
-
// art: pmndrs/tunnel-rat, facebook/react#17147). `TunnelOut` lives in whichever component should
|
|
5
|
-
// PAINT the content; its OWN read of the shared store drives that surface's own normal render
|
|
6
|
-
// cycle — no cross-surface reach-in, no rootTag lookup, works whether TunnelIn and TunnelOut
|
|
7
|
-
// share a surface or not.
|
|
8
|
-
//
|
|
9
|
-
// Angular cannot mirror React's/Vue's shape verbatim: both of those build a FRESH `In`/`Out`
|
|
10
|
-
// pair per `createTunnel()` call (a closure-scoped class in Vue, closure-scoped functions in
|
|
11
|
-
// React). Angular components can't be synthesized at runtime — there is no JIT compiler under
|
|
12
|
-
// Metro/Hermes (see modules/animated/create-animated-component.ts's header for the same
|
|
13
|
-
// constraint). So here `createTunnel()` returns only a plain reactive STORE (a signal);
|
|
14
|
-
// `TunnelInDirective` and `TunnelOut` are ONE static, pre-authored, AOT-compilable pair,
|
|
15
|
-
// parameterized by that store through an input — same relationship `VListOutletDirective` has
|
|
16
|
-
// to the per-cell template it stamps, generalized to an open-ended, changing SET of templates.
|
|
17
|
-
//
|
|
18
|
-
// TunnelInDirective is a STRUCTURAL directive (`*tunnelIn="overlayTunnel"`), not a component
|
|
19
|
-
// that takes a separate `<ng-template>` + `[content]` binding — matching `*portal` (see
|
|
20
|
-
// create-portal.ts's header for why that reads as native Angular and the two-step form
|
|
21
|
-
// doesn't). `TunnelOut` stays a plain component (`<tunnel-out>`) — it's a rendering SLOT, the
|
|
22
|
-
// same shape as Angular's own `<router-outlet>`, not content that needs a structural directive.
|
|
23
|
-
//
|
|
24
|
-
// App code stays fully declarative — no ViewContainerRef/imperative rendering — by putting
|
|
25
|
-
// `*tunnelIn` directly on the portable content, the same way `*ngIf` sits directly on an
|
|
26
|
-
// element instead of wrapping it in a named `<ng-template>`:
|
|
27
|
-
// @if (toastVisible) {
|
|
28
|
-
// <View *tunnelIn="overlayTunnel"><Text>…</Text></View>
|
|
29
|
-
// }
|
|
30
|
-
// …
|
|
31
|
-
// <tunnel-out [tunnel]="overlayTunnel" />
|
|
32
|
-
// No `context` param: unlike a `*ngFor` cell template, tunneled content needs no per-registration
|
|
33
|
-
// data — it already closes over whatever signals/fields its OWN declaring component exposes, and
|
|
34
|
-
// Angular's own change detection keeps that live once the embedded view exists, the same way any
|
|
35
|
-
// other template does.
|
|
36
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
37
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
38
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
39
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
40
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
41
|
-
var _, done = false;
|
|
42
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
43
|
-
var context = {};
|
|
44
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
45
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
46
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
47
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
48
|
-
if (kind === "accessor") {
|
|
49
|
-
if (result === void 0) continue;
|
|
50
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
51
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
52
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
53
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
54
|
-
}
|
|
55
|
-
else if (_ = accept(result)) {
|
|
56
|
-
if (kind === "field") initializers.unshift(_);
|
|
57
|
-
else descriptor[key] = _;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
61
|
-
done = true;
|
|
62
|
-
};
|
|
63
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
64
|
-
var useValue = arguments.length > 2;
|
|
65
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
66
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
67
|
-
}
|
|
68
|
-
return useValue ? value : void 0;
|
|
69
|
-
};
|
|
70
|
-
import { Component, Directive, effect, inject, Injector, Input, signal, TemplateRef, ViewContainerRef, } from '@angular/core';
|
|
71
|
-
export function createTunnel() {
|
|
72
|
-
const store = signal(new Map());
|
|
73
|
-
return {
|
|
74
|
-
entries: store.asReadonly(),
|
|
75
|
-
register(id, templateRef) {
|
|
76
|
-
store.update(map => new Map(map).set(id, templateRef));
|
|
77
|
-
},
|
|
78
|
-
unregister(id) {
|
|
79
|
-
store.update(map => {
|
|
80
|
-
if (!map.has(id))
|
|
81
|
-
return map;
|
|
82
|
-
const next = new Map(map);
|
|
83
|
-
next.delete(id);
|
|
84
|
-
return next;
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
let nextTunnelEntryId = 0;
|
|
90
|
-
/** `*tunnelIn="overlayTunnel"` — registers the host element under `overlayTunnel` from
|
|
91
|
-
* wherever it's mounted, any surface. Combine with `@if` for conditional visibility, exactly
|
|
92
|
-
* like `*ngIf`. */
|
|
93
|
-
let TunnelInDirective = (() => {
|
|
94
|
-
let _classDecorators = [Directive({ selector: '[tunnelIn]', standalone: true })];
|
|
95
|
-
let _classDescriptor;
|
|
96
|
-
let _classExtraInitializers = [];
|
|
97
|
-
let _classThis;
|
|
98
|
-
let _tunnelIn_decorators;
|
|
99
|
-
let _tunnelIn_initializers = [];
|
|
100
|
-
let _tunnelIn_extraInitializers = [];
|
|
101
|
-
var TunnelInDirective = class {
|
|
102
|
-
static { _classThis = this; }
|
|
103
|
-
static {
|
|
104
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
105
|
-
_tunnelIn_decorators = [Input({ required: true })];
|
|
106
|
-
__esDecorate(null, null, _tunnelIn_decorators, { kind: "field", name: "tunnelIn", static: false, private: false, access: { has: obj => "tunnelIn" in obj, get: obj => obj.tunnelIn, set: (obj, value) => { obj.tunnelIn = value; } }, metadata: _metadata }, _tunnelIn_initializers, _tunnelIn_extraInitializers);
|
|
107
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
108
|
-
TunnelInDirective = _classThis = _classDescriptor.value;
|
|
109
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
110
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
111
|
-
}
|
|
112
|
-
tunnelIn = __runInitializers(this, _tunnelIn_initializers, void 0);
|
|
113
|
-
templateRef = (__runInitializers(this, _tunnelIn_extraInitializers), inject(TemplateRef));
|
|
114
|
-
id = nextTunnelEntryId++;
|
|
115
|
-
ngOnInit() {
|
|
116
|
-
this.tunnelIn.register(this.id, this.templateRef);
|
|
117
|
-
}
|
|
118
|
-
ngOnDestroy() {
|
|
119
|
-
this.tunnelIn.unregister(this.id);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
return TunnelInDirective = _classThis;
|
|
123
|
-
})();
|
|
124
|
-
export { TunnelInDirective };
|
|
125
|
-
/** Renders everything currently registered on `tunnel`, in registration order. Mount this in
|
|
126
|
-
* the component that should actually paint the content — the tunnel's own `<router-outlet>`. */
|
|
127
|
-
let TunnelOut = (() => {
|
|
128
|
-
let _classDecorators = [Component({
|
|
129
|
-
selector: 'tunnel-out',
|
|
130
|
-
standalone: true,
|
|
131
|
-
template: '',
|
|
132
|
-
})];
|
|
133
|
-
let _classDescriptor;
|
|
134
|
-
let _classExtraInitializers = [];
|
|
135
|
-
let _classThis;
|
|
136
|
-
let _tunnel_decorators;
|
|
137
|
-
let _tunnel_initializers = [];
|
|
138
|
-
let _tunnel_extraInitializers = [];
|
|
139
|
-
var TunnelOut = class {
|
|
140
|
-
static { _classThis = this; }
|
|
141
|
-
static {
|
|
142
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
143
|
-
_tunnel_decorators = [Input({ required: true })];
|
|
144
|
-
__esDecorate(null, null, _tunnel_decorators, { kind: "field", name: "tunnel", static: false, private: false, access: { has: obj => "tunnel" in obj, get: obj => obj.tunnel, set: (obj, value) => { obj.tunnel = value; } }, metadata: _metadata }, _tunnel_initializers, _tunnel_extraInitializers);
|
|
145
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
146
|
-
TunnelOut = _classThis = _classDescriptor.value;
|
|
147
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
148
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
149
|
-
}
|
|
150
|
-
tunnel = __runInitializers(this, _tunnel_initializers, void 0);
|
|
151
|
-
viewContainerRef = (__runInitializers(this, _tunnel_extraInitializers), inject(ViewContainerRef));
|
|
152
|
-
injector = inject(Injector);
|
|
153
|
-
views = new Map();
|
|
154
|
-
stopEffect;
|
|
155
|
-
ngOnInit() {
|
|
156
|
-
const ref = effect(() => this.sync(this.tunnel.entries()), { injector: this.injector });
|
|
157
|
-
this.stopEffect = () => ref.destroy();
|
|
158
|
-
}
|
|
159
|
-
ngOnDestroy() {
|
|
160
|
-
this.stopEffect?.();
|
|
161
|
-
for (const view of this.views.values())
|
|
162
|
-
view.destroy();
|
|
163
|
-
this.views.clear();
|
|
164
|
-
}
|
|
165
|
-
sync(entries) {
|
|
166
|
-
for (const [id, view] of this.views) {
|
|
167
|
-
if (entries.has(id))
|
|
168
|
-
continue;
|
|
169
|
-
view.destroy();
|
|
170
|
-
this.views.delete(id);
|
|
171
|
-
}
|
|
172
|
-
for (const [id, templateRef] of entries) {
|
|
173
|
-
if (this.views.has(id))
|
|
174
|
-
continue;
|
|
175
|
-
this.views.set(id, this.viewContainerRef.createEmbeddedView(templateRef));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
return TunnelOut = _classThis;
|
|
180
|
-
})();
|
|
181
|
-
export { TunnelOut };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type OnChanges, type OnDestroy, type SimpleChanges } from '@angular/core';
|
|
2
|
-
import type { IDescriptor } from '@symbiote-native/components';
|
|
3
|
-
export declare class DescriptorOutlet implements OnChanges, OnDestroy {
|
|
4
|
-
node: IDescriptor;
|
|
5
|
-
private readonly renderer;
|
|
6
|
-
private readonly hostNode;
|
|
7
|
-
private rendered;
|
|
8
|
-
ngOnChanges(changes: SimpleChanges): void;
|
|
9
|
-
ngOnDestroy(): void;
|
|
10
|
-
private patchRoot;
|
|
11
|
-
private createChild;
|
|
12
|
-
private createText;
|
|
13
|
-
private createElement;
|
|
14
|
-
private patchChild;
|
|
15
|
-
private patchElement;
|
|
16
|
-
private patchProps;
|
|
17
|
-
private patchChildren;
|
|
18
|
-
private replaceChild;
|
|
19
|
-
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
// Angular descriptor outlet. The React/Vue bridges can return framework elements directly
|
|
2
|
-
// (`descriptorToReact` / `descriptorToVue`); Angular needs a tiny standalone component that
|
|
3
|
-
// consumes a Descriptor tree and drives Renderer2 imperatively, patching same type/key nodes
|
|
4
|
-
// instead of clearing and recreating the subtree so it keeps retained-node identity and Fabric
|
|
5
|
-
// stays on the clone-on-write path.
|
|
6
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
7
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
8
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
9
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
10
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
11
|
-
var _, done = false;
|
|
12
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
13
|
-
var context = {};
|
|
14
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
15
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
16
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
17
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
18
|
-
if (kind === "accessor") {
|
|
19
|
-
if (result === void 0) continue;
|
|
20
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
21
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
22
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
23
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
24
|
-
}
|
|
25
|
-
else if (_ = accept(result)) {
|
|
26
|
-
if (kind === "field") initializers.unshift(_);
|
|
27
|
-
else descriptor[key] = _;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
31
|
-
done = true;
|
|
32
|
-
};
|
|
33
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
34
|
-
var useValue = arguments.length > 2;
|
|
35
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
36
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
37
|
-
}
|
|
38
|
-
return useValue ? value : void 0;
|
|
39
|
-
};
|
|
40
|
-
import { ChangeDetectionStrategy, Component, ElementRef, inject, Input, Renderer2, } from '@angular/core';
|
|
41
|
-
let DescriptorOutlet = (() => {
|
|
42
|
-
let _classDecorators = [Component({
|
|
43
|
-
selector: 'symbiote-descriptor-outlet',
|
|
44
|
-
standalone: true,
|
|
45
|
-
template: '',
|
|
46
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
47
|
-
})];
|
|
48
|
-
let _classDescriptor;
|
|
49
|
-
let _classExtraInitializers = [];
|
|
50
|
-
let _classThis;
|
|
51
|
-
let _node_decorators;
|
|
52
|
-
let _node_initializers = [];
|
|
53
|
-
let _node_extraInitializers = [];
|
|
54
|
-
var DescriptorOutlet = class {
|
|
55
|
-
static { _classThis = this; }
|
|
56
|
-
static {
|
|
57
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
58
|
-
_node_decorators = [Input({ required: true })];
|
|
59
|
-
__esDecorate(null, null, _node_decorators, { kind: "field", name: "node", static: false, private: false, access: { has: obj => "node" in obj, get: obj => obj.node, set: (obj, value) => { obj.node = value; } }, metadata: _metadata }, _node_initializers, _node_extraInitializers);
|
|
60
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
61
|
-
DescriptorOutlet = _classThis = _classDescriptor.value;
|
|
62
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
63
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
64
|
-
}
|
|
65
|
-
node = __runInitializers(this, _node_initializers, void 0);
|
|
66
|
-
renderer = (__runInitializers(this, _node_extraInitializers), inject(Renderer2));
|
|
67
|
-
hostNode = inject(ElementRef).nativeElement;
|
|
68
|
-
rendered;
|
|
69
|
-
ngOnChanges(changes) {
|
|
70
|
-
if (!('node' in changes) || this.node === undefined)
|
|
71
|
-
return;
|
|
72
|
-
this.rendered = this.patchRoot(this.rendered, this.node);
|
|
73
|
-
}
|
|
74
|
-
ngOnDestroy() {
|
|
75
|
-
if (this.rendered === undefined)
|
|
76
|
-
return;
|
|
77
|
-
this.renderer.removeChild(this.hostNode, this.rendered.node);
|
|
78
|
-
this.rendered = undefined;
|
|
79
|
-
}
|
|
80
|
-
patchRoot(rendered, next) {
|
|
81
|
-
if (rendered === undefined) {
|
|
82
|
-
const created = this.createElement(next);
|
|
83
|
-
this.renderer.appendChild(this.hostNode, created.node);
|
|
84
|
-
return created;
|
|
85
|
-
}
|
|
86
|
-
return this.patchElement(this.hostNode, rendered, next);
|
|
87
|
-
}
|
|
88
|
-
createChild(child) {
|
|
89
|
-
return typeof child === 'string' ? this.createText(child) : this.createElement(child);
|
|
90
|
-
}
|
|
91
|
-
createText(value) {
|
|
92
|
-
return { kind: 'text', node: this.renderer.createText(value), value };
|
|
93
|
-
}
|
|
94
|
-
createElement(descriptor) {
|
|
95
|
-
const node = this.renderer.createElement(descriptor.type);
|
|
96
|
-
const props = { ...descriptor.props };
|
|
97
|
-
for (const [key, value] of Object.entries(props)) {
|
|
98
|
-
this.renderer.setProperty(node, key, value);
|
|
99
|
-
}
|
|
100
|
-
const children = descriptor.children.map(child => this.createChild(child));
|
|
101
|
-
for (const child of children) {
|
|
102
|
-
this.renderer.appendChild(node, child.node);
|
|
103
|
-
}
|
|
104
|
-
return { kind: 'element', node, descriptor, props, children };
|
|
105
|
-
}
|
|
106
|
-
patchChild(parent, rendered, next) {
|
|
107
|
-
if (typeof next === 'string') {
|
|
108
|
-
if (rendered.kind === 'text') {
|
|
109
|
-
if (rendered.value !== next) {
|
|
110
|
-
this.renderer.setValue(rendered.node, next);
|
|
111
|
-
rendered.value = next;
|
|
112
|
-
}
|
|
113
|
-
return rendered;
|
|
114
|
-
}
|
|
115
|
-
const replacement = this.createText(next);
|
|
116
|
-
this.replaceChild(parent, rendered.node, replacement.node);
|
|
117
|
-
return replacement;
|
|
118
|
-
}
|
|
119
|
-
if (rendered.kind === 'element') {
|
|
120
|
-
return this.patchElement(parent, rendered, next);
|
|
121
|
-
}
|
|
122
|
-
const replacement = this.createElement(next);
|
|
123
|
-
this.replaceChild(parent, rendered.node, replacement.node);
|
|
124
|
-
return replacement;
|
|
125
|
-
}
|
|
126
|
-
patchElement(parent, rendered, next) {
|
|
127
|
-
if (!sameElement(rendered.descriptor, next)) {
|
|
128
|
-
const replacement = this.createElement(next);
|
|
129
|
-
this.replaceChild(parent, rendered.node, replacement.node);
|
|
130
|
-
return replacement;
|
|
131
|
-
}
|
|
132
|
-
this.patchProps(rendered, next.props);
|
|
133
|
-
rendered.children = this.patchChildren(rendered.node, rendered.children, next.children);
|
|
134
|
-
rendered.descriptor = next;
|
|
135
|
-
return rendered;
|
|
136
|
-
}
|
|
137
|
-
patchProps(rendered, nextProps) {
|
|
138
|
-
const prevProps = rendered.props;
|
|
139
|
-
for (const key of Object.keys(prevProps)) {
|
|
140
|
-
if (!(key in nextProps)) {
|
|
141
|
-
this.renderer.setProperty(rendered.node, key, undefined);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
for (const [key, value] of Object.entries(nextProps)) {
|
|
145
|
-
if (!Object.is(prevProps[key], value)) {
|
|
146
|
-
this.renderer.setProperty(rendered.node, key, value);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
rendered.props = { ...nextProps };
|
|
150
|
-
}
|
|
151
|
-
patchChildren(parent, renderedChildren, nextChildren) {
|
|
152
|
-
const nextRendered = [];
|
|
153
|
-
const common = Math.min(renderedChildren.length, nextChildren.length);
|
|
154
|
-
for (let i = 0; i < common; i++) {
|
|
155
|
-
const rendered = renderedChildren[i];
|
|
156
|
-
const next = nextChildren[i];
|
|
157
|
-
if (rendered !== undefined && next !== undefined) {
|
|
158
|
-
nextRendered.push(this.patchChild(parent, rendered, next));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
for (let i = common; i < nextChildren.length; i++) {
|
|
162
|
-
const next = nextChildren[i];
|
|
163
|
-
if (next === undefined)
|
|
164
|
-
continue;
|
|
165
|
-
const child = this.createChild(next);
|
|
166
|
-
this.renderer.appendChild(parent, child.node);
|
|
167
|
-
nextRendered.push(child);
|
|
168
|
-
}
|
|
169
|
-
for (let i = common; i < renderedChildren.length; i++) {
|
|
170
|
-
const rendered = renderedChildren[i];
|
|
171
|
-
if (rendered !== undefined)
|
|
172
|
-
this.renderer.removeChild(parent, rendered.node);
|
|
173
|
-
}
|
|
174
|
-
return nextRendered;
|
|
175
|
-
}
|
|
176
|
-
replaceChild(parent, oldChild, newChild) {
|
|
177
|
-
this.renderer.insertBefore(parent, newChild, oldChild);
|
|
178
|
-
this.renderer.removeChild(parent, oldChild);
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
return DescriptorOutlet = _classThis;
|
|
182
|
-
})();
|
|
183
|
-
export { DescriptorOutlet };
|
|
184
|
-
function sameElement(prev, next) {
|
|
185
|
-
return prev.type === next.type && prev.key === next.key;
|
|
186
|
-
}
|