@molecule/app-angular 3.13.0 → 3.16.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/README.md +281 -15
- package/dist/dom-placement.d.ts +8 -2
- package/dist/dom-placement.d.ts.map +1 -1
- package/dist/dom-placement.js +43 -8
- package/dist/dom-placement.js.map +1 -1
- package/dist/hooks/use-router.d.ts +45 -2
- package/dist/hooks/use-router.d.ts.map +1 -1
- package/dist/hooks/use-router.js +43 -7
- package/dist/hooks/use-router.js.map +1 -1
- package/dist/hooks/use-translation.d.ts +8 -1
- package/dist/hooks/use-translation.d.ts.map +1 -1
- package/dist/hooks/use-translation.js +10 -1
- package/dist/hooks/use-translation.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lazy-slot.d.ts +100 -0
- package/dist/lazy-slot.d.ts.map +1 -0
- package/dist/lazy-slot.js +152 -0
- package/dist/lazy-slot.js.map +1 -0
- package/dist/link.d.ts +24 -4
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +34 -10
- package/dist/link.js.map +1 -1
- package/dist/node.d.ts +25 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +31 -0
- package/dist/node.js.map +1 -0
- package/dist/slot-copy.d.ts +59 -0
- package/dist/slot-copy.d.ts.map +1 -0
- package/dist/slot-copy.js +126 -0
- package/dist/slot-copy.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slot content that exists only while its place is in the page, as React mounts a slot.
|
|
3
|
+
*
|
|
4
|
+
* Angular creates projected content with the consumer's view, so `<ng-content>` content exists
|
|
5
|
+
* (its constructors, effects and fetches run) while the component that receives it shows none of
|
|
6
|
+
* it: a closed dialog's footer, a collapsed drawer's body. React mounts a slot only where and
|
|
7
|
+
* while it renders it, and mounts it again each time it shows again. {@link MolLazy} gives
|
|
8
|
+
* projected content that lifetime with no change to the component that receives it.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { afterEveryRender, Directive, ElementRef, inject, TemplateRef, ViewContainerRef, } from '@angular/core';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
/** The anchor comment of each {@link MolLazy} slot, stamped or not → the slot's template. */
|
|
15
|
+
const lazyAnchors = new WeakMap();
|
|
16
|
+
/** The root nodes of the stamped content of {@link MolLazy} slots. */
|
|
17
|
+
const lazyContent = new WeakSet();
|
|
18
|
+
/** The anchor of each stamped {@link MolLazy} slot → the root nodes of its content. */
|
|
19
|
+
const stampedRoots = new WeakMap();
|
|
20
|
+
/**
|
|
21
|
+
* Whether a node is the anchor of a {@link MolLazy} slot. A lazy slot is one child of the
|
|
22
|
+
* component it is passed to, stamped or not (React's `children` holds the element either way):
|
|
23
|
+
* a slot reader counts its anchor as content and as the child, so the wrapper that holds it is in
|
|
24
|
+
* the page, and a component that hides a child takes the anchor out of the page, which destroys
|
|
25
|
+
* the content.
|
|
26
|
+
*
|
|
27
|
+
* @param node - A node of a slot.
|
|
28
|
+
* @returns Whether it is a lazy slot's anchor.
|
|
29
|
+
*/
|
|
30
|
+
export function isLazySlotAnchor(node) {
|
|
31
|
+
return lazyAnchors.has(node);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether a slot's child is an element, as React's `isValidElement(child)` tells an element from
|
|
35
|
+
* text: an element, or a {@link MolLazy} slot, which stands for the element it stamps whether or
|
|
36
|
+
* not it is stamped yet. Use it to pick a slot's elements out of `SlotReader.nodes`; a component
|
|
37
|
+
* that then moves the child (`placeElement`) moves the lazy slot, which stamps its content in the
|
|
38
|
+
* new place.
|
|
39
|
+
*
|
|
40
|
+
* @param node - A child of a slot (`SlotReader.nodes`).
|
|
41
|
+
* @returns Whether it is an element child.
|
|
42
|
+
*/
|
|
43
|
+
export function isElementChild(node) {
|
|
44
|
+
return node.nodeType === 1 || lazyAnchors.has(node);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The element a slot's child is, for a component that works the child itself (React's
|
|
48
|
+
* `cloneElement(child, …)`: a trigger that gets the listeners and `aria-*`, an anchor a popup is
|
|
49
|
+
* positioned against): the child when it is an element, the element a {@link MolLazy} child stamped
|
|
50
|
+
* once it is stamped, else `null`. A lazy child is stamped after the placement that put it in the
|
|
51
|
+
* page, and stamping it runs that placement again, which then finds the element; decide the
|
|
52
|
+
* layout from {@link isElementChild} meanwhile, so the child is not given a wrapper it then leaves.
|
|
53
|
+
*
|
|
54
|
+
* @param node - A child of a slot (`SlotReader.nodes`).
|
|
55
|
+
* @returns The element, or `null`.
|
|
56
|
+
*/
|
|
57
|
+
export function slotElement(node) {
|
|
58
|
+
if (node.nodeType === 1)
|
|
59
|
+
return node;
|
|
60
|
+
const roots = stampedRoots.get(node);
|
|
61
|
+
return roots?.length === 1 && roots[0]?.nodeType === 1 ? roots[0] : null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The template of a {@link MolLazy} slot, which a component that renders a slot's children in more
|
|
65
|
+
* than one place stamps in each of them (`MolSlotCopy` does this): each copy is then a live
|
|
66
|
+
* instance, as each of React's is. Plain projected content exists once in Angular; a copy of it
|
|
67
|
+
* (`cloneNode`) has no listeners or components.
|
|
68
|
+
*
|
|
69
|
+
* @param node - A child of a slot (`SlotReader.nodes`).
|
|
70
|
+
* @returns The lazy slot's template, or `undefined` when the node is not a lazy slot's anchor.
|
|
71
|
+
*/
|
|
72
|
+
export function lazySlotTemplate(node) {
|
|
73
|
+
return lazyAnchors.get(node);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Whether a node is a root node of a {@link MolLazy} slot's stamped content: part of the child
|
|
77
|
+
* its anchor stands for ({@link isLazySlotAnchor}), not a child of its own.
|
|
78
|
+
*
|
|
79
|
+
* @param node - A node of a slot.
|
|
80
|
+
* @returns Whether it is stamped lazy content.
|
|
81
|
+
*/
|
|
82
|
+
export function isLazySlotContent(node) {
|
|
83
|
+
return lazyContent.has(node);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Stamps projected content in its own place, and keeps it exactly while that place is in the
|
|
87
|
+
* page: created when the component that received it shows it, destroyed when the component
|
|
88
|
+
* hides it, created again when it shows it again, as React mounts a slot. A place that moves to
|
|
89
|
+
* another parent (a sidebar rendered on the other side) is a new place: React never moves a
|
|
90
|
+
* mounted node to another parent, so the content is created again there. Write it as `*molLazy`
|
|
91
|
+
* on the slot's element, or as `molLazy` on an `<ng-template>` (with `ngProjectAs` for a named
|
|
92
|
+
* slot):
|
|
93
|
+
*
|
|
94
|
+
* ```html
|
|
95
|
+
* <mol-modal [open]="open" (close)="open = false">
|
|
96
|
+
* <form *molLazy>…</form>
|
|
97
|
+
* <div slot="footer" *molLazy><button molButton>Save</button></div>
|
|
98
|
+
* <ng-template molLazy ngProjectAs="[slot=footer]">…</ng-template>
|
|
99
|
+
* </mol-modal>
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* Plain projected content is created with the consumer's view and kept for its whole life,
|
|
103
|
+
* which is right for static content (a closed dialog's footer buttons). Use `*molLazy` for
|
|
104
|
+
* content with state, effects or a fetch, which must not run while hidden and must start fresh
|
|
105
|
+
* each time it shows. It works on every component that hides a slot by taking its place out of
|
|
106
|
+
* the page, through `@if` or the `@molecule/app-angular` DOM placement, and on content that a
|
|
107
|
+
* wrapper component projects on.
|
|
108
|
+
*
|
|
109
|
+
* The decision runs after every render, once every component has placed its slots: a component
|
|
110
|
+
* that attaches or detaches a region does it in a render's `write` phase or earlier, and this
|
|
111
|
+
* directive reads the result in the `mixedReadWrite` phase of the same render. It does not run on
|
|
112
|
+
* the server, where a lazy slot renders nothing.
|
|
113
|
+
*/
|
|
114
|
+
export class MolLazy {
|
|
115
|
+
constructor() {
|
|
116
|
+
const template = inject(TemplateRef, { optional: true });
|
|
117
|
+
if (template === null) {
|
|
118
|
+
throw new Error('molLazy goes on an <ng-template>, or as *molLazy on an element.');
|
|
119
|
+
}
|
|
120
|
+
const views = inject(ViewContainerRef);
|
|
121
|
+
const anchor = inject(ElementRef).nativeElement;
|
|
122
|
+
lazyAnchors.set(anchor, template);
|
|
123
|
+
/** The parent the content was stamped in. */
|
|
124
|
+
let stampedIn = null;
|
|
125
|
+
afterEveryRender({
|
|
126
|
+
// After every component's placement (`write`), so a closed dialog's footer is already out
|
|
127
|
+
// of the page; outside change detection, so no view is edited while Angular walks it.
|
|
128
|
+
mixedReadWrite: () => {
|
|
129
|
+
const shown = anchor.isConnected;
|
|
130
|
+
if (views.length > 0 && (!shown || anchor.parentNode !== stampedIn)) {
|
|
131
|
+
stampedRoots.delete(anchor);
|
|
132
|
+
views.clear();
|
|
133
|
+
}
|
|
134
|
+
if (shown && views.length === 0) {
|
|
135
|
+
stampedIn = anchor.parentNode;
|
|
136
|
+
const view = views.createEmbeddedView(template);
|
|
137
|
+
for (const node of view.rootNodes)
|
|
138
|
+
lazyContent.add(node);
|
|
139
|
+
stampedRoots.set(anchor, view.rootNodes);
|
|
140
|
+
view.detectChanges();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
static { this.ɵfac = function MolLazy_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MolLazy)(); }; }
|
|
146
|
+
static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MolLazy, selectors: [["", "molLazy", ""]] }); }
|
|
147
|
+
}
|
|
148
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MolLazy, [{
|
|
149
|
+
type: Directive,
|
|
150
|
+
args: [{ selector: '[molLazy]', standalone: true }]
|
|
151
|
+
}], () => [], null); })();
|
|
152
|
+
//# sourceMappingURL=lazy-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-slot.js","sourceRoot":"","sources":["../src/lazy-slot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A;oBAClD,IAAI,CAAC,aAAa,EAAE,CAAA;gBACtB,CAAC;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;wGA7BU,OAAO;oEAAP,OAAO;;iFAAP,OAAO;cADnB,SAAS;eAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE"}
|
package/dist/link.d.ts
CHANGED
|
@@ -28,6 +28,13 @@ export interface LinkProps {
|
|
|
28
28
|
* other than `_self`, a click the template's own `(click)` handler prevented,
|
|
29
29
|
* and a URL on another origin are left to the browser.
|
|
30
30
|
*
|
|
31
|
+
* A link to a URL outside the app (another origin, `mailto:`, `//host`) needs
|
|
32
|
+
* no router: the browser, or on a device the URL handler, opens it. It renders
|
|
33
|
+
* with no router registered, the URL as its `href`, and a click is left to the
|
|
34
|
+
* browser (the template's own `(click)` handler still runs). A link to an app
|
|
35
|
+
* path needs a router, and fails without one with the error `useRouterInstance`
|
|
36
|
+
* throws.
|
|
37
|
+
*
|
|
31
38
|
* Inputs: `molLink` (the destination: an app path or a URL), `replace` (replace
|
|
32
39
|
* the current history entry; when unset, a link to the location already shown
|
|
33
40
|
* replaces it and any other link pushes, as with react-router's `<Link>`), and
|
|
@@ -49,6 +56,7 @@ export interface LinkProps {
|
|
|
49
56
|
* template: `
|
|
50
57
|
* <a molLink="/projects" class="nav-link">Projects</a>
|
|
51
58
|
* <a molLink="/login" [replace]="true" [state]="{ from: '/projects' }">Log in</a>
|
|
59
|
+
* <a molLink="https://molecule.dev">Molecule</a>
|
|
52
60
|
* `,
|
|
53
61
|
* })
|
|
54
62
|
* export class NavComponent {}
|
|
@@ -57,15 +65,26 @@ export interface LinkProps {
|
|
|
57
65
|
export declare class Link implements OnInit, LinkProps {
|
|
58
66
|
/**
|
|
59
67
|
* The destination: an app path (`/settings?tab=billing#plan`) or a URL. An app path's `href` is
|
|
60
|
-
* the one the router writes for it (`routerLinkHref`), base path included
|
|
68
|
+
* the one the router writes for it (`routerLinkHref`), base path included; a URL's is the URL as
|
|
69
|
+
* written.
|
|
61
70
|
*/
|
|
62
71
|
molLink: string;
|
|
63
72
|
/** Replace the current history entry instead of pushing one. */
|
|
64
73
|
replace?: boolean;
|
|
65
74
|
/** State stored with the new history entry. */
|
|
66
75
|
state?: unknown;
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Reads the registered router once, here in the field initializer's injection context, and
|
|
78
|
+
* answers for each destination this link shows: an app path fails with the no-router error
|
|
79
|
+
* when none is registered. It takes the hook's function form because `molLink` is not set
|
|
80
|
+
* when a field initializer runs.
|
|
81
|
+
*/
|
|
82
|
+
private readonly linkRouter;
|
|
83
|
+
/**
|
|
84
|
+
* The anchor's `href`: the URL as written for a URL outside the app with no router registered,
|
|
85
|
+
* else the one the router writes for an app path, base path included. An app path with no
|
|
86
|
+
* router fails here with the no-router error.
|
|
87
|
+
*/
|
|
69
88
|
get href(): string;
|
|
70
89
|
private readonly element;
|
|
71
90
|
private readonly renderer;
|
|
@@ -73,7 +92,8 @@ export declare class Link implements OnInit, LinkProps {
|
|
|
73
92
|
/**
|
|
74
93
|
* Starts handling clicks. The listener is added here, after the template
|
|
75
94
|
* created this anchor's own `(click)` listeners, so those run first and can
|
|
76
|
-
* prevent the navigation (react-router calls `onClick` first too).
|
|
95
|
+
* prevent the navigation (react-router calls `onClick` first too). With no
|
|
96
|
+
* router (a URL outside the app) the browser follows the anchor instead.
|
|
77
97
|
*/
|
|
78
98
|
ngOnInit(): void;
|
|
79
99
|
static ɵfac: i0.ɵɵFactoryDeclaration<Link, never>;
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA6C,KAAK,MAAM,EAAa,MAAM,eAAe,CAAA;;AAMjG;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA6C,KAAK,MAAM,EAAa,MAAM,eAAe,CAAA;;AAMjG;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAMa,IAAK,YAAW,MAAM,EAAE,SAAS;IAC5C;;;;OAIG;IACH,OAAO,SAAK;IACZ,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;IAE7C;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAGjB;IACD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoD;IAC5E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAEhD;;;;;OAKG;IACH,QAAQ,IAAI,IAAI;yCAvCL,IAAI;2CAAJ,IAAI;CAmDhB"}
|
package/dist/link.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { DestroyRef, Directive, ElementRef, inject, Renderer2 } from '@angular/core';
|
|
8
8
|
import { followRouterLink, routerLinkHref } from '@molecule/app-routing';
|
|
9
|
-
import {
|
|
9
|
+
import { useLinkRouter } from './hooks/use-router.js';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
11
|
/**
|
|
12
12
|
* `<a molLink="/settings">`: sets the anchor's `href` and navigates in-app
|
|
@@ -16,6 +16,13 @@ import * as i0 from "@angular/core";
|
|
|
16
16
|
* other than `_self`, a click the template's own `(click)` handler prevented,
|
|
17
17
|
* and a URL on another origin are left to the browser.
|
|
18
18
|
*
|
|
19
|
+
* A link to a URL outside the app (another origin, `mailto:`, `//host`) needs
|
|
20
|
+
* no router: the browser, or on a device the URL handler, opens it. It renders
|
|
21
|
+
* with no router registered, the URL as its `href`, and a click is left to the
|
|
22
|
+
* browser (the template's own `(click)` handler still runs). A link to an app
|
|
23
|
+
* path needs a router, and fails without one with the error `useRouterInstance`
|
|
24
|
+
* throws.
|
|
25
|
+
*
|
|
19
26
|
* Inputs: `molLink` (the destination: an app path or a URL), `replace` (replace
|
|
20
27
|
* the current history entry; when unset, a link to the location already shown
|
|
21
28
|
* replaces it and any other link pushes, as with react-router's `<Link>`), and
|
|
@@ -37,6 +44,7 @@ import * as i0 from "@angular/core";
|
|
|
37
44
|
* template: `
|
|
38
45
|
* <a molLink="/projects" class="nav-link">Projects</a>
|
|
39
46
|
* <a molLink="/login" [replace]="true" [state]="{ from: '/projects' }">Log in</a>
|
|
47
|
+
* <a molLink="https://molecule.dev">Molecule</a>
|
|
40
48
|
* `,
|
|
41
49
|
* })
|
|
42
50
|
* export class NavComponent {}
|
|
@@ -46,29 +54,45 @@ export class Link {
|
|
|
46
54
|
constructor() {
|
|
47
55
|
/**
|
|
48
56
|
* The destination: an app path (`/settings?tab=billing#plan`) or a URL. An app path's `href` is
|
|
49
|
-
* the one the router writes for it (`routerLinkHref`), base path included
|
|
57
|
+
* the one the router writes for it (`routerLinkHref`), base path included; a URL's is the URL as
|
|
58
|
+
* written.
|
|
50
59
|
*/
|
|
51
60
|
this.molLink = '';
|
|
52
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Reads the registered router once, here in the field initializer's injection context, and
|
|
63
|
+
* answers for each destination this link shows: an app path fails with the no-router error
|
|
64
|
+
* when none is registered. It takes the hook's function form because `molLink` is not set
|
|
65
|
+
* when a field initializer runs.
|
|
66
|
+
*/
|
|
67
|
+
this.linkRouter = useLinkRouter();
|
|
53
68
|
this.element = inject(ElementRef);
|
|
54
69
|
this.renderer = inject(Renderer2);
|
|
55
70
|
this.destroyRef = inject(DestroyRef);
|
|
56
71
|
}
|
|
57
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* The anchor's `href`: the URL as written for a URL outside the app with no router registered,
|
|
74
|
+
* else the one the router writes for an app path, base path included. An app path with no
|
|
75
|
+
* router fails here with the no-router error.
|
|
76
|
+
*/
|
|
58
77
|
get href() {
|
|
59
|
-
|
|
78
|
+
const router = this.linkRouter(this.molLink);
|
|
79
|
+
return router === null ? this.molLink : routerLinkHref(this.molLink, router);
|
|
60
80
|
}
|
|
61
81
|
/**
|
|
62
82
|
* Starts handling clicks. The listener is added here, after the template
|
|
63
83
|
* created this anchor's own `(click)` listeners, so those run first and can
|
|
64
|
-
* prevent the navigation (react-router calls `onClick` first too).
|
|
84
|
+
* prevent the navigation (react-router calls `onClick` first too). With no
|
|
85
|
+
* router (a URL outside the app) the browser follows the anchor instead.
|
|
65
86
|
*/
|
|
66
87
|
ngOnInit() {
|
|
67
88
|
const stop = this.renderer.listen(this.element.nativeElement, 'click', (event) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
const router = this.linkRouter(this.molLink);
|
|
90
|
+
if (router !== null) {
|
|
91
|
+
followRouterLink(event, this.molLink, router, {
|
|
92
|
+
replace: this.replace,
|
|
93
|
+
state: this.state,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
72
96
|
});
|
|
73
97
|
this.destroyRef.onDestroy(stop);
|
|
74
98
|
}
|
package/dist/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"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AAI,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC,KAAiB,EAAE,EAAE;YAC3F,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC5C,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBACpB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE;oBAC5C,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;qGAlDU,IAAI;oEAAJ,IAAI;;;;iFAAJ,IAAI;cANhB,SAAS;eAAC;gBACT,QAAQ,EAAE,YAAY;gBACtB,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;gBACvC,IAAI,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE;aAChC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a node input renders anything, by React's `slot(node)` rule.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether a node input renders anything: not `null`, `undefined`, a boolean or `''`, and not
|
|
8
|
+
* a list holding only those. React's `slot(node)` from `@molecule/app-react/render` decides the
|
|
9
|
+
* same way, so a component that renders a wrapper, a default or an `aria-*` reference only
|
|
10
|
+
* while a node prop has something to show reads the same in both: `title=""` renders no heading,
|
|
11
|
+
* like an omitted `title`. Projected content is read with the `SlotReader` of
|
|
12
|
+
* {@link usePlacement} instead, which already counts only what renders.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* showUnit(): boolean {
|
|
17
|
+
* return rendersNode(this.unit) || this.unitProjected()
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param node - The input's value.
|
|
22
|
+
* @returns True when it renders something.
|
|
23
|
+
*/
|
|
24
|
+
export declare function rendersNode(node: unknown): boolean;
|
|
25
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAIlD"}
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a node input renders anything, by React's `slot(node)` rule.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether a node input renders anything: not `null`, `undefined`, a boolean or `''`, and not
|
|
8
|
+
* a list holding only those. React's `slot(node)` from `@molecule/app-react/render` decides the
|
|
9
|
+
* same way, so a component that renders a wrapper, a default or an `aria-*` reference only
|
|
10
|
+
* while a node prop has something to show reads the same in both: `title=""` renders no heading,
|
|
11
|
+
* like an omitted `title`. Projected content is read with the `SlotReader` of
|
|
12
|
+
* {@link usePlacement} instead, which already counts only what renders.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* showUnit(): boolean {
|
|
17
|
+
* return rendersNode(this.unit) || this.unitProjected()
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param node - The input's value.
|
|
22
|
+
* @returns True when it renders something.
|
|
23
|
+
*/
|
|
24
|
+
export function rendersNode(node) {
|
|
25
|
+
if (node === null || node === undefined || typeof node === 'boolean' || node === '')
|
|
26
|
+
return false;
|
|
27
|
+
if (Array.isArray(node))
|
|
28
|
+
return node.some(rendersNode);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,WAAW,CAAC,IAAa;IACvC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA;IACjG,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A slot's children rendered again in another place, as React renders `{children}` in more than
|
|
3
|
+
* one place.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { type OnDestroy } from '@angular/core';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* Renders a slot's children here, as React renders `{children}` inside each row, node or gap:
|
|
11
|
+
* every place shows its own copy. Give it the slot's children (`SlotReader.nodes` of
|
|
12
|
+
* `usePlacement`) and keep the slot itself out of the page (`setElementPresent(capture,
|
|
13
|
+
* false)`), so the slot shows no copy of its own.
|
|
14
|
+
*
|
|
15
|
+
* A `*molLazy` child is stamped here from its template: a live instance per place, created with
|
|
16
|
+
* this copy and destroyed with it or when the child leaves the slot, as each of React's is. Any
|
|
17
|
+
* other child is copied as DOM (`cloneNode`), which has no listeners and no components, so
|
|
18
|
+
* content with either is written with `*molLazy` (`MolLazy`). A child that stays in the
|
|
19
|
+
* slot keeps its copy here when other children come and go.
|
|
20
|
+
*
|
|
21
|
+
* ```html
|
|
22
|
+
* @for (node of nodes(); track node.id) {
|
|
23
|
+
* <div><ng-container [molSlotCopy]="children()" /></div>
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class MolSlotCopy implements OnDestroy {
|
|
28
|
+
/** The slot's children to render here, in order. */
|
|
29
|
+
molSlotCopy: readonly Node[];
|
|
30
|
+
/** Where the stamped instances go. */
|
|
31
|
+
private readonly views;
|
|
32
|
+
/** The directive's own place: the copies sit right before it. */
|
|
33
|
+
private readonly anchor;
|
|
34
|
+
/** The copies, in render order. */
|
|
35
|
+
private copies;
|
|
36
|
+
/** The children the copies were last rendered from. */
|
|
37
|
+
private rendered;
|
|
38
|
+
constructor();
|
|
39
|
+
/** Destroys every instance it stamped. */
|
|
40
|
+
ngOnDestroy(): void;
|
|
41
|
+
/** Renders the children it is given, keeping the copy of each child it already shows. */
|
|
42
|
+
private render;
|
|
43
|
+
/**
|
|
44
|
+
* Renders one child here.
|
|
45
|
+
*
|
|
46
|
+
* @param source - The slot's child.
|
|
47
|
+
* @returns Its copy.
|
|
48
|
+
*/
|
|
49
|
+
private create;
|
|
50
|
+
/**
|
|
51
|
+
* Takes one copy out of the page, destroying its instance.
|
|
52
|
+
*
|
|
53
|
+
* @param copy - The copy.
|
|
54
|
+
*/
|
|
55
|
+
private destroy;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MolSlotCopy, never>;
|
|
57
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MolSlotCopy, "[molSlotCopy]", never, { "molSlotCopy": { "alias": "molSlotCopy"; "required": true; }; }, {}, never, never, true, never>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=slot-copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-copy.d.ts","sourceRoot":"","sources":["../src/slot-copy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,eAAe,CAAA;;AAuBtB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,WAAY,YAAW,SAAS;IAC3C,oDAAoD;IACzB,WAAW,EAAE,SAAS,IAAI,EAAE,CAAK;IAE5D,sCAAsC;IACtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2B;IACjD,iEAAiE;IACjE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8C;IACrE,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAa;IAC3B,uDAAuD;IACvD,OAAO,CAAC,QAAQ,CAAsB;;IAQtC,0CAA0C;IAC1C,WAAW,IAAI,IAAI;IAKnB,yFAAyF;IACzF,OAAO,CAAC,MAAM;IA2Bd;;;;;OAKG;IACH,OAAO,CAAC,MAAM;IAQd;;;;OAIG;IACH,OAAO,CAAC,OAAO;yCAxEJ,WAAW;2CAAX,WAAW;CA4EvB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A slot's children rendered again in another place, as React renders `{children}` in more than
|
|
3
|
+
* one place.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { afterEveryRender, Directive, ElementRef, inject, Input, ViewContainerRef, } from '@angular/core';
|
|
8
|
+
import { lazySlotTemplate } from './lazy-slot.js';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
/**
|
|
11
|
+
* The nodes a copy puts in the page.
|
|
12
|
+
*
|
|
13
|
+
* @param copy - The copy.
|
|
14
|
+
* @returns Its nodes, in order.
|
|
15
|
+
*/
|
|
16
|
+
const nodesOf = (copy) => copy.view === null ? [copy.node] : copy.view.rootNodes;
|
|
17
|
+
/**
|
|
18
|
+
* Renders a slot's children here, as React renders `{children}` inside each row, node or gap:
|
|
19
|
+
* every place shows its own copy. Give it the slot's children (`SlotReader.nodes` of
|
|
20
|
+
* `usePlacement`) and keep the slot itself out of the page (`setElementPresent(capture,
|
|
21
|
+
* false)`), so the slot shows no copy of its own.
|
|
22
|
+
*
|
|
23
|
+
* A `*molLazy` child is stamped here from its template: a live instance per place, created with
|
|
24
|
+
* this copy and destroyed with it or when the child leaves the slot, as each of React's is. Any
|
|
25
|
+
* other child is copied as DOM (`cloneNode`), which has no listeners and no components, so
|
|
26
|
+
* content with either is written with `*molLazy` (`MolLazy`). A child that stays in the
|
|
27
|
+
* slot keeps its copy here when other children come and go.
|
|
28
|
+
*
|
|
29
|
+
* ```html
|
|
30
|
+
* @for (node of nodes(); track node.id) {
|
|
31
|
+
* <div><ng-container [molSlotCopy]="children()" /></div>
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export class MolSlotCopy {
|
|
36
|
+
constructor() {
|
|
37
|
+
/** The slot's children to render here, in order. */
|
|
38
|
+
this.molSlotCopy = [];
|
|
39
|
+
/** Where the stamped instances go. */
|
|
40
|
+
this.views = inject(ViewContainerRef);
|
|
41
|
+
/** The directive's own place: the copies sit right before it. */
|
|
42
|
+
this.anchor = inject(ElementRef).nativeElement;
|
|
43
|
+
/** The copies, in render order. */
|
|
44
|
+
this.copies = [];
|
|
45
|
+
/** The children the copies were last rendered from. */
|
|
46
|
+
this.rendered = [];
|
|
47
|
+
// In the same phase as `MolLazy`, after it: a slot's own lazy children are stamped first,
|
|
48
|
+
// in the order React mounts them (the original before its copies).
|
|
49
|
+
afterEveryRender({ mixedReadWrite: () => this.render() });
|
|
50
|
+
}
|
|
51
|
+
/** Destroys every instance it stamped. */
|
|
52
|
+
ngOnDestroy() {
|
|
53
|
+
for (const copy of this.copies)
|
|
54
|
+
this.destroy(copy);
|
|
55
|
+
this.copies = [];
|
|
56
|
+
}
|
|
57
|
+
/** Renders the children it is given, keeping the copy of each child it already shows. */
|
|
58
|
+
render() {
|
|
59
|
+
// `SlotReader.nodes` returns the same array while the children are the same.
|
|
60
|
+
if (this.molSlotCopy === this.rendered)
|
|
61
|
+
return;
|
|
62
|
+
this.rendered = this.molSlotCopy;
|
|
63
|
+
const kept = new Map(this.copies.map((copy) => [copy.source, copy]));
|
|
64
|
+
const next = this.molSlotCopy.map((source) => {
|
|
65
|
+
const copy = kept.get(source);
|
|
66
|
+
if (copy === undefined)
|
|
67
|
+
return this.create(source);
|
|
68
|
+
kept.delete(source);
|
|
69
|
+
return copy;
|
|
70
|
+
});
|
|
71
|
+
for (const gone of kept.values())
|
|
72
|
+
this.destroy(gone);
|
|
73
|
+
// The stamped instances in their order, so Angular inserts each next to the right neighbour.
|
|
74
|
+
let index = 0;
|
|
75
|
+
for (const copy of next)
|
|
76
|
+
if (copy.view !== null)
|
|
77
|
+
this.views.move(copy.view, index++);
|
|
78
|
+
// Then every copy, back to front, right before the one that follows it.
|
|
79
|
+
let ref = this.anchor;
|
|
80
|
+
for (const copy of [...next].reverse()) {
|
|
81
|
+
const nodes = nodesOf(copy);
|
|
82
|
+
const first = nodes[0];
|
|
83
|
+
if (first === undefined)
|
|
84
|
+
continue;
|
|
85
|
+
if (nodes[nodes.length - 1]?.nextSibling !== ref)
|
|
86
|
+
ref.before(...nodes);
|
|
87
|
+
ref = first;
|
|
88
|
+
}
|
|
89
|
+
this.copies = next;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Renders one child here.
|
|
93
|
+
*
|
|
94
|
+
* @param source - The slot's child.
|
|
95
|
+
* @returns Its copy.
|
|
96
|
+
*/
|
|
97
|
+
create(source) {
|
|
98
|
+
const template = lazySlotTemplate(source);
|
|
99
|
+
if (template === undefined)
|
|
100
|
+
return { source, view: null, node: source.cloneNode(true) };
|
|
101
|
+
const view = this.views.createEmbeddedView(template);
|
|
102
|
+
view.detectChanges();
|
|
103
|
+
return { source, view, node: null };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Takes one copy out of the page, destroying its instance.
|
|
107
|
+
*
|
|
108
|
+
* @param copy - The copy.
|
|
109
|
+
*/
|
|
110
|
+
destroy(copy) {
|
|
111
|
+
if (copy.view !== null)
|
|
112
|
+
copy.view.destroy();
|
|
113
|
+
else
|
|
114
|
+
copy.node.remove();
|
|
115
|
+
}
|
|
116
|
+
static { this.ɵfac = function MolSlotCopy_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MolSlotCopy)(); }; }
|
|
117
|
+
static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MolSlotCopy, selectors: [["", "molSlotCopy", ""]], inputs: { molSlotCopy: "molSlotCopy" } }); }
|
|
118
|
+
}
|
|
119
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MolSlotCopy, [{
|
|
120
|
+
type: Directive,
|
|
121
|
+
args: [{ selector: '[molSlotCopy]', standalone: true }]
|
|
122
|
+
}], () => [], { molSlotCopy: [{
|
|
123
|
+
type: Input,
|
|
124
|
+
args: [{ required: true }]
|
|
125
|
+
}] }); })();
|
|
126
|
+
//# sourceMappingURL=slot-copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-copy.js","sourceRoot":"","sources":["../src/slot-copy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,UAAU,EAEV,MAAM,EACN,KAAK,EAEL,gBAAgB,GACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;;AAYjD;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,IAAU,EAAU,EAAE,CACrC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAY,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,IAAI,CAAC,SAAoB,CAAA;AAE5E;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,OAAO,WAAW;IAatB;QAZA,oDAAoD;QACzB,gBAAW,GAAoB,EAAE,CAAA;QAE5D,sCAAsC;QACrB,UAAK,GAAG,MAAM,CAAC,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;IACrC,CAAC;IAED;;;;OAIG;IACK,OAAO,CAAC,IAAU;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAA;;YACrC,IAAI,CAAC,IAAkB,CAAC,MAAM,EAAE,CAAA;IACxC,CAAC;4GA3EU,WAAW;oEAAX,WAAW;;iFAAX,WAAW;cADvB,SAAS;eAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE;;kBAGvD,KAAK;mBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-angular",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"description": "Angular framework bindings for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@molecule/app-device": "^1.0.1",
|
|
41
41
|
"@molecule/app-forms": "^2.4.0",
|
|
42
42
|
"@molecule/app-http": "^1.0.1",
|
|
43
|
-
"@molecule/app-i18n": "^1.0
|
|
44
|
-
"@molecule/app-ide": "^1.0
|
|
43
|
+
"@molecule/app-i18n": "^1.3.0",
|
|
44
|
+
"@molecule/app-ide": "^1.1.0",
|
|
45
45
|
"@molecule/app-live-preview": "^1.0.1",
|
|
46
46
|
"@molecule/app-logger": "^1.0.1",
|
|
47
47
|
"@molecule/app-platform": "^1.0.1",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@molecule/app-routing-angular-router": ">=1.4.0",
|
|
51
51
|
"@molecule/app-state": "^1.2.0",
|
|
52
52
|
"@molecule/app-storage": "^1.1.1",
|
|
53
|
-
"@molecule/app-theme": "^1.0.
|
|
53
|
+
"@molecule/app-theme": "^1.0.2",
|
|
54
54
|
"@molecule/app-ui": "^1.0.1",
|
|
55
55
|
"@molecule/app-utilities": "^1.0.1",
|
|
56
56
|
"@molecule/app-version": "^1.0.1",
|