@excom/include-content 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/chunked-rush-logs/include-content.apply-exports.chunks.jsonl +1 -0
- package/.rush/temp/chunked-rush-logs/include-content.build_docs.chunks.jsonl +1 -0
- package/.rush/temp/chunked-rush-logs/include-content.build_package-metas.chunks.jsonl +1 -0
- package/.rush/temp/operation/apply-exports/all.log +1 -0
- package/.rush/temp/operation/apply-exports/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/apply-exports/state.json +3 -0
- package/.rush/temp/operation/build_docs/all.log +1 -0
- package/.rush/temp/operation/build_docs/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/build_docs/state.json +3 -0
- package/.rush/temp/operation/build_package-metas/all.log +1 -0
- package/.rush/temp/operation/build_package-metas/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/build_package-metas/state.json +3 -0
- package/.rush/temp/shrinkwrap-deps.json +3 -0
- package/config/rig.json +5 -0
- package/include-content.ts +176 -0
- package/index.css +5 -0
- package/index.ts +17 -0
- package/package.json +45 -0
- package/rush-logs/include-content.apply-exports.cache.log +1 -0
- package/rush-logs/include-content.apply-exports.log +1 -0
- package/rush-logs/include-content.build_docs.cache.log +1 -0
- package/rush-logs/include-content.build_docs.log +1 -0
- package/rush-logs/include-content.build_package-metas.cache.log +1 -0
- package/rush-logs/include-content.build_package-metas.log +1 -0
- package/src/include-content.css +66 -0
- package/support/custom-elements.json +277 -0
- package/support/demos/lazy.html +19 -0
- package/support/demos/persist-content.html +23 -0
- package/support/demos/portal.html +8 -0
- package/support/demos/simple.html +16 -0
- package/support/demos/template-include.html +7 -0
- package/support/demos/template-ref.html +7 -0
- package/support/dist-docs/include-content.md +265 -0
- package/support/docs/README.md +64 -0
- package/support/package-meta.json +360 -0
- package/support/tests/include-content.test.ts +764 -0
- package/support/tests/lazy.view.test.ts +22 -0
- package/support/tests/persist-content.view.test.ts +33 -0
- package/support/tests/portal.view.test.ts +21 -0
- package/support/tests/simple.view.test.ts +23 -0
- package/support/tests/template-include.view.test.ts +35 -0
- package/support/tests/template-ref.view.test.ts +21 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: cd \"$RUSH_PROJECT_FOLDER\" && node ../heft-rig/scripts/apply-exports.mjs \n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs \n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs \n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: cd "$RUSH_PROJECT_FOLDER" && node ../heft-rig/scripts/apply-exports.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: cd \"$RUSH_PROJECT_FOLDER\" && node ../heft-rig/scripts/apply-exports.mjs \n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs \n"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs \n"}
|
package/config/rig.json
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { requestIdleCb } from "@excom/kit-shims";
|
|
2
|
+
import { selectOne } from "@excom/kit-utils";
|
|
3
|
+
import { Neutron } from "@excom/neutron";
|
|
4
|
+
import { RenderableElement } from "@excom/renderable-element";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders a `<template>` / remote HTML on demand — when visible, when idle,
|
|
8
|
+
* or immediately. Common cases need no app JavaScript.
|
|
9
|
+
*
|
|
10
|
+
* @summary Declarative view rendering — lazy (un)load, idle, conditional.
|
|
11
|
+
*/
|
|
12
|
+
export const IncludeContent = Neutron.compose([
|
|
13
|
+
RenderableElement,
|
|
14
|
+
Neutron({
|
|
15
|
+
tag: "include-content",
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* @option
|
|
19
|
+
* Activate after first paint, when the browser is idle. Useful for
|
|
20
|
+
* below-the-fold / secondary views that should not compete with
|
|
21
|
+
* critical content.
|
|
22
|
+
*/
|
|
23
|
+
idleLoad: Boolean,
|
|
24
|
+
/**
|
|
25
|
+
* @option
|
|
26
|
+
* Activate when this element is on screen. Pair with
|
|
27
|
+
* `lazy-unload` for lazy load and lazy unload of views.
|
|
28
|
+
*/
|
|
29
|
+
lazyLoad: Boolean,
|
|
30
|
+
/**
|
|
31
|
+
* @option
|
|
32
|
+
* Deactivate (unrender) when no longer on screen. Use with
|
|
33
|
+
* `lazy-load` to free DOM for off-screen views.
|
|
34
|
+
*/
|
|
35
|
+
lazyUnload: Boolean,
|
|
36
|
+
/**
|
|
37
|
+
* @option
|
|
38
|
+
* Scroll container for lazy load / unload. Defaults to the
|
|
39
|
+
* viewport.
|
|
40
|
+
* @values <CSS Selector>
|
|
41
|
+
*/
|
|
42
|
+
observerRoot: String,
|
|
43
|
+
/**
|
|
44
|
+
* @option
|
|
45
|
+
* How far outside the root counts as "visible". Expand (e.g.
|
|
46
|
+
* `500px`) to lazy-load a view *before* it enters the viewport so
|
|
47
|
+
* users never see an empty slot; shrink (default `-1px`) so
|
|
48
|
+
* edge-flush elements wait until they truly enter.
|
|
49
|
+
* @default -1px -1px -1px -1px
|
|
50
|
+
* @values <length> | <percentage>
|
|
51
|
+
*/
|
|
52
|
+
observerRootMargin: {
|
|
53
|
+
type: String,
|
|
54
|
+
defaultValue: () => "-1px -1px -1px -1px",
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @option
|
|
58
|
+
* Fraction of the element that must be visible (`0`–`1`) before
|
|
59
|
+
* activating.
|
|
60
|
+
*/
|
|
61
|
+
observerThreshold: Number,
|
|
62
|
+
/**
|
|
63
|
+
* @option
|
|
64
|
+
* Minimum time visible before activating (ms). Ignored where
|
|
65
|
+
* unsupported. Useful for ensuring lazy load is not triggered
|
|
66
|
+
* when a programmatic smooth scroll zips the user right past
|
|
67
|
+
* the element.
|
|
68
|
+
* @default 0
|
|
69
|
+
*/
|
|
70
|
+
observerDelay: {
|
|
71
|
+
type: Number,
|
|
72
|
+
defaultValue: () => 0,
|
|
73
|
+
},
|
|
74
|
+
// private state
|
|
75
|
+
observer: IntersectionObserver,
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
])
|
|
79
|
+
.defineMethods({
|
|
80
|
+
determineActive: (element, entry: IntersectionObserverEntry) => {
|
|
81
|
+
const isVisible = element.checkVisibility
|
|
82
|
+
? element.checkVisibility()
|
|
83
|
+
: true;
|
|
84
|
+
if (
|
|
85
|
+
isVisible &&
|
|
86
|
+
entry.isIntersecting &&
|
|
87
|
+
!element.isActive &&
|
|
88
|
+
element.lazyLoad
|
|
89
|
+
)
|
|
90
|
+
return { isActive: true };
|
|
91
|
+
else if (
|
|
92
|
+
(!isVisible || !entry.isIntersecting) &&
|
|
93
|
+
element.isActive &&
|
|
94
|
+
element.lazyUnload
|
|
95
|
+
)
|
|
96
|
+
return { isActive: false };
|
|
97
|
+
},
|
|
98
|
+
createObserver: (element) => {
|
|
99
|
+
if (!element.observer) {
|
|
100
|
+
return {
|
|
101
|
+
observer: watchElementWithIntersectionObserver(
|
|
102
|
+
element,
|
|
103
|
+
// @ts-ignore TODO defineMethods
|
|
104
|
+
element.determineActive,
|
|
105
|
+
{
|
|
106
|
+
root: element.observerRoot
|
|
107
|
+
? selectOne(element.observerRoot, {
|
|
108
|
+
scope: element,
|
|
109
|
+
})
|
|
110
|
+
: null,
|
|
111
|
+
// Default `-1px` all around, so `top: 100vh` (etc.) isn't "visible"
|
|
112
|
+
rootMargin: element.observerRootMargin,
|
|
113
|
+
threshold: element.observerThreshold ?? undefined,
|
|
114
|
+
// IntersectionObserver spec v2; TypeScript typings lag behind
|
|
115
|
+
delay: element.observerDelay,
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
destroyObserver: ({ observer }) => {
|
|
122
|
+
if (observer) {
|
|
123
|
+
observer.disconnect();
|
|
124
|
+
return {
|
|
125
|
+
observer: null,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
})
|
|
130
|
+
.onPropSet("idleLoad", (el) => {
|
|
131
|
+
if (!el.isActive) {
|
|
132
|
+
const cb = () => {
|
|
133
|
+
// Re-check `idleLoad`; the captured value may be stale.
|
|
134
|
+
// `cancelIdleCallback` would be nicer, but Safari lacks it.
|
|
135
|
+
if (el.idleLoad) {
|
|
136
|
+
el.isActive = true;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// Fallback: wait until after the next paint (~16ms)
|
|
140
|
+
requestIdleCb(cb, 17);
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
.onPropChanged(["lazyLoad", "lazyUnload"], ({ lazyLoad, lazyUnload }) =>
|
|
144
|
+
lazyLoad || lazyUnload ? { createObserver: [] } : { destroyObserver: [] }
|
|
145
|
+
)
|
|
146
|
+
/* Drop the observer once it's no longer needed */
|
|
147
|
+
.onPropSet(
|
|
148
|
+
"isActive",
|
|
149
|
+
({ lazyUnload }) =>
|
|
150
|
+
!lazyUnload && {
|
|
151
|
+
destroyObserver: [],
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
.onPropUnset(
|
|
155
|
+
"isActive",
|
|
156
|
+
({ lazyLoad }) => !lazyLoad && { destroyObserver: [] }
|
|
157
|
+
)
|
|
158
|
+
.onDisconnected(() => ({ destroyObserver: [] }))
|
|
159
|
+
.onConnected(
|
|
160
|
+
({ lazyLoad, lazyUnload, wasMounted }) =>
|
|
161
|
+
// Rebuilt after a real remove + reconnect (dev / framework remounts)
|
|
162
|
+
wasMounted && (lazyLoad || lazyUnload) && { createObserver: [] }
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
function watchElementWithIntersectionObserver(
|
|
166
|
+
element: HTMLElement,
|
|
167
|
+
callback: (entry: IntersectionObserverEntry) => void,
|
|
168
|
+
// TODO: `IntersectionObserverInit` here causes a circular dependency?
|
|
169
|
+
options = {}
|
|
170
|
+
) {
|
|
171
|
+
const observer = new IntersectionObserver((entries) => {
|
|
172
|
+
entries.forEach(callback);
|
|
173
|
+
}, options);
|
|
174
|
+
observer.observe(element);
|
|
175
|
+
return observer;
|
|
176
|
+
}
|
package/index.css
ADDED
package/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IncludeContent } from "./include-content";
|
|
2
|
+
|
|
3
|
+
IncludeContent.define();
|
|
4
|
+
|
|
5
|
+
export { IncludeContent };
|
|
6
|
+
|
|
7
|
+
type T_HTMLIncludeContentElement = typeof IncludeContent.CustomElement;
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLIncludeContentElement extends T_HTMLIncludeContentElement {}
|
|
10
|
+
interface Window {
|
|
11
|
+
HTMLIncludeContentElement: HTMLIncludeContentElement;
|
|
12
|
+
}
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"include-content": HTMLIncludeContentElement;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export type { HTMLIncludeContentElement };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@excom/include-content",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "<include-content> custom element",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24.13.0"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@excom/kit-shims": "^0.1.0",
|
|
12
|
+
"@excom/kit-utils": "^0.1.0",
|
|
13
|
+
"@excom/neutron": "^0.1.0",
|
|
14
|
+
"@excom/renderable-element": "^0.1.0"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@excom/heft-rig": "^0.1.0"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"url": "excom-dev/nucleus",
|
|
22
|
+
"directory": "packages/include-content"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/excom-dev/nucleus/tree/main/packages/include-content/support/docs/README.md",
|
|
25
|
+
"bugs": "https://github.com/excom-dev/nucleus/issues",
|
|
26
|
+
"keywords": [
|
|
27
|
+
"include-content",
|
|
28
|
+
"neutron",
|
|
29
|
+
"custom-elements"
|
|
30
|
+
],
|
|
31
|
+
"excom": {
|
|
32
|
+
"packageType": "kit-element"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "node node_modules/@excom/heft-rig/scripts/vite-build.mjs",
|
|
36
|
+
"build:watch": "node node_modules/@excom/heft-rig/scripts/vite-build-watch.mjs",
|
|
37
|
+
"format": "node node_modules/@excom/heft-rig/scripts/format.mjs",
|
|
38
|
+
"test": "node node_modules/@excom/heft-rig/scripts/vitest.mjs",
|
|
39
|
+
"coverage": "node node_modules/@excom/heft-rig/scripts/coverage.mjs",
|
|
40
|
+
"dev": "node node_modules/@excom/heft-rig/scripts/vite-dev.mjs",
|
|
41
|
+
"preview": "node node_modules/@excom/heft-rig/scripts/vite-preview.mjs",
|
|
42
|
+
"build:package-metas": "node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs",
|
|
43
|
+
"build:docs": "node node_modules/@excom/heft-rig/scripts/build-docs.mjs"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Caching has been disabled for this project's "apply-exports" command.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: cd "$RUSH_PROJECT_FOLDER" && node ../heft-rig/scripts/apply-exports.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This project does not define the caching behavior of the "build:docs" command, so caching has been disabled.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This project does not define the caching behavior of the "build:package-metas" command, so caching has been disabled.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
@import "@excom/renderable-element/src/index.css";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Styles for `<include-content>`.
|
|
5
|
+
* @element include-content
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Aliases */
|
|
9
|
+
@custom-selector :--include-content include-content, .tag-include-content;
|
|
10
|
+
@custom-selector :--include-content--lazy-load [lazy-load], [data-lazy-load];
|
|
11
|
+
@custom-selector :--include-content--lazy-unload [lazy-unload], [data-lazy-unload];
|
|
12
|
+
@custom-selector :--include-content--did-load [did-load], [data-did-load];
|
|
13
|
+
@custom-selector :--include-content--is-active [is-active], [aria-current];
|
|
14
|
+
@custom-selector :--include-content--host-shadow [host-ref="shadow"], [data-host-ref="shadow"];
|
|
15
|
+
|
|
16
|
+
@define-mixin module-include-content {
|
|
17
|
+
:root {
|
|
18
|
+
/**
|
|
19
|
+
* Fade-in duration.
|
|
20
|
+
* @cssproperty
|
|
21
|
+
* @syntax <time>
|
|
22
|
+
* @default 0.15s
|
|
23
|
+
*/
|
|
24
|
+
--include-content-transition-duration: var(
|
|
25
|
+
--v-transition-duration-fast,
|
|
26
|
+
0.15s
|
|
27
|
+
);
|
|
28
|
+
/**
|
|
29
|
+
* Fade-in easing.
|
|
30
|
+
* @cssproperty
|
|
31
|
+
* @syntax *
|
|
32
|
+
* @default ease-in
|
|
33
|
+
*/
|
|
34
|
+
--include-content-transition-ease: var(--v-transition-ease-out, ease-in);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:--include-content {
|
|
38
|
+
display: block;
|
|
39
|
+
|
|
40
|
+
&:--include-content--lazy-load,
|
|
41
|
+
&:--include-content--lazy-unload {
|
|
42
|
+
min-height: 10px;
|
|
43
|
+
min-width: 10px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Skip the built-in fade — bring your own animation / view transition.
|
|
48
|
+
* Also opts-out if the element is portalling content elsewhere ([host-ref])
|
|
49
|
+
* @cssclass instant
|
|
50
|
+
*/
|
|
51
|
+
&:not(.instant):not([host-ref]) {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
transition: opacity var(--include-content-transition-duration)
|
|
54
|
+
var(--include-content-transition-ease);
|
|
55
|
+
|
|
56
|
+
&:--include-content--did-load:--include-content--is-active {
|
|
57
|
+
&:--include-content--host-shadow,
|
|
58
|
+
&:has(> *:not(template)) {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@mixin renderable-element;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"modules": [
|
|
4
|
+
{
|
|
5
|
+
"kind": "javascript-module",
|
|
6
|
+
"path": "include-content.ts",
|
|
7
|
+
"declarations": [
|
|
8
|
+
{
|
|
9
|
+
"kind": "class",
|
|
10
|
+
"name": "IncludeContent",
|
|
11
|
+
"customElement": true,
|
|
12
|
+
"tagName": "include-content",
|
|
13
|
+
"mixins": [
|
|
14
|
+
{
|
|
15
|
+
"name": "RenderableElement",
|
|
16
|
+
"package": "@excom/renderable-element"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"summary": "Declarative view rendering — lazy (un)load, idle, conditional.",
|
|
20
|
+
"description": "Renders a `<template>` / remote HTML on demand — when visible, when idle, or immediately. Common cases need no app JavaScript.",
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": "idle-load",
|
|
24
|
+
"type": {
|
|
25
|
+
"text": "boolean"
|
|
26
|
+
},
|
|
27
|
+
"description": "Activate after first paint, when the browser is idle. Useful for below-the-fold / secondary views that should not compete with critical content.",
|
|
28
|
+
"fieldName": "idleLoad"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "lazy-load",
|
|
32
|
+
"type": {
|
|
33
|
+
"text": "boolean"
|
|
34
|
+
},
|
|
35
|
+
"description": "Activate when this element is on screen. Pair with `lazy-unload` for lazy load and lazy unload of views.",
|
|
36
|
+
"fieldName": "lazyLoad"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "lazy-unload",
|
|
40
|
+
"type": {
|
|
41
|
+
"text": "boolean"
|
|
42
|
+
},
|
|
43
|
+
"description": "Deactivate (unrender) when no longer on screen. Use with `lazy-load` to free DOM for off-screen views.",
|
|
44
|
+
"fieldName": "lazyUnload"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "observer-root",
|
|
48
|
+
"type": {
|
|
49
|
+
"text": "string"
|
|
50
|
+
},
|
|
51
|
+
"description": "Scroll container for lazy load / unload. Defaults to the viewport.",
|
|
52
|
+
"fieldName": "observerRoot",
|
|
53
|
+
"values": [
|
|
54
|
+
"<CSS Selector>"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "observer-root-margin",
|
|
59
|
+
"type": {
|
|
60
|
+
"text": "string"
|
|
61
|
+
},
|
|
62
|
+
"description": "How far outside the root counts as \"visible\". Expand (e.g. `500px`) to lazy-load a view *before* it enters the viewport so users never see an empty slot; shrink (default `-1px`) so edge-flush elements wait until they truly enter.",
|
|
63
|
+
"fieldName": "observerRootMargin",
|
|
64
|
+
"default": "-1px -1px -1px -1px",
|
|
65
|
+
"values": [
|
|
66
|
+
"<length>",
|
|
67
|
+
"<percentage>"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "observer-threshold",
|
|
72
|
+
"type": {
|
|
73
|
+
"text": "number"
|
|
74
|
+
},
|
|
75
|
+
"description": "Fraction of the element that must be visible (`0`–`1`) before activating.",
|
|
76
|
+
"fieldName": "observerThreshold"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "observer-delay",
|
|
80
|
+
"type": {
|
|
81
|
+
"text": "number"
|
|
82
|
+
},
|
|
83
|
+
"description": "Minimum time visible before activating (ms). Ignored where unsupported. Useful for ensuring lazy load is not triggered when a programmatic smooth scroll zips the user right past the element.",
|
|
84
|
+
"fieldName": "observerDelay",
|
|
85
|
+
"default": 0
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"members": [
|
|
89
|
+
{
|
|
90
|
+
"kind": "field",
|
|
91
|
+
"name": "idleLoad",
|
|
92
|
+
"type": {
|
|
93
|
+
"text": "boolean"
|
|
94
|
+
},
|
|
95
|
+
"privacy": "public",
|
|
96
|
+
"readonly": false,
|
|
97
|
+
"description": "Activate after first paint, when the browser is idle. Useful for below-the-fold / secondary views that should not compete with critical content.",
|
|
98
|
+
"_neutron": {
|
|
99
|
+
"surface": "option"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"kind": "field",
|
|
104
|
+
"name": "lazyLoad",
|
|
105
|
+
"type": {
|
|
106
|
+
"text": "boolean"
|
|
107
|
+
},
|
|
108
|
+
"privacy": "public",
|
|
109
|
+
"readonly": false,
|
|
110
|
+
"description": "Activate when this element is on screen. Pair with `lazy-unload` for lazy load and lazy unload of views.",
|
|
111
|
+
"_neutron": {
|
|
112
|
+
"surface": "option"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"kind": "field",
|
|
117
|
+
"name": "lazyUnload",
|
|
118
|
+
"type": {
|
|
119
|
+
"text": "boolean"
|
|
120
|
+
},
|
|
121
|
+
"privacy": "public",
|
|
122
|
+
"readonly": false,
|
|
123
|
+
"description": "Deactivate (unrender) when no longer on screen. Use with `lazy-load` to free DOM for off-screen views.",
|
|
124
|
+
"_neutron": {
|
|
125
|
+
"surface": "option"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"kind": "field",
|
|
130
|
+
"name": "observerRoot",
|
|
131
|
+
"type": {
|
|
132
|
+
"text": "string"
|
|
133
|
+
},
|
|
134
|
+
"privacy": "public",
|
|
135
|
+
"readonly": false,
|
|
136
|
+
"description": "Scroll container for lazy load / unload. Defaults to the viewport.",
|
|
137
|
+
"_neutron": {
|
|
138
|
+
"surface": "option"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"kind": "field",
|
|
143
|
+
"name": "observerRootMargin",
|
|
144
|
+
"type": {
|
|
145
|
+
"text": "string"
|
|
146
|
+
},
|
|
147
|
+
"privacy": "public",
|
|
148
|
+
"readonly": false,
|
|
149
|
+
"description": "How far outside the root counts as \"visible\". Expand (e.g. `500px`) to lazy-load a view *before* it enters the viewport so users never see an empty slot; shrink (default `-1px`) so edge-flush elements wait until they truly enter.",
|
|
150
|
+
"default": "-1px -1px -1px -1px",
|
|
151
|
+
"_neutron": {
|
|
152
|
+
"surface": "option"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"kind": "field",
|
|
157
|
+
"name": "observerThreshold",
|
|
158
|
+
"type": {
|
|
159
|
+
"text": "number"
|
|
160
|
+
},
|
|
161
|
+
"privacy": "public",
|
|
162
|
+
"readonly": false,
|
|
163
|
+
"description": "Fraction of the element that must be visible (`0`–`1`) before activating.",
|
|
164
|
+
"_neutron": {
|
|
165
|
+
"surface": "option"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"kind": "field",
|
|
170
|
+
"name": "observerDelay",
|
|
171
|
+
"type": {
|
|
172
|
+
"text": "number"
|
|
173
|
+
},
|
|
174
|
+
"privacy": "public",
|
|
175
|
+
"readonly": false,
|
|
176
|
+
"description": "Minimum time visible before activating (ms). Ignored where unsupported. Useful for ensuring lazy load is not triggered when a programmatic smooth scroll zips the user right past the element.",
|
|
177
|
+
"default": 0,
|
|
178
|
+
"_neutron": {
|
|
179
|
+
"surface": "option"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"cssProperties": [
|
|
184
|
+
{
|
|
185
|
+
"name": "--include-content-transition-duration",
|
|
186
|
+
"description": "Fade-in duration.",
|
|
187
|
+
"syntax": "<time>",
|
|
188
|
+
"default": "0.15s"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "--include-content-transition-ease",
|
|
192
|
+
"description": "Fade-in easing.",
|
|
193
|
+
"syntax": "*",
|
|
194
|
+
"default": "ease-in"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"_neutron": {
|
|
198
|
+
"cssClasses": [
|
|
199
|
+
{
|
|
200
|
+
"name": "instant",
|
|
201
|
+
"description": "Skip the built-in fade — bring your own animation / view transition. Also opts-out if the element is portalling content elsewhere ([host-ref])"
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"cssAliases": [
|
|
205
|
+
{
|
|
206
|
+
"name": ":--include-content",
|
|
207
|
+
"selectors": [
|
|
208
|
+
"include-content",
|
|
209
|
+
".tag-include-content"
|
|
210
|
+
],
|
|
211
|
+
"kind": "element"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": ":--include-content--lazy-load",
|
|
215
|
+
"selectors": [
|
|
216
|
+
"[lazy-load]",
|
|
217
|
+
"[data-lazy-load]"
|
|
218
|
+
],
|
|
219
|
+
"kind": "state"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": ":--include-content--lazy-unload",
|
|
223
|
+
"selectors": [
|
|
224
|
+
"[lazy-unload]",
|
|
225
|
+
"[data-lazy-unload]"
|
|
226
|
+
],
|
|
227
|
+
"kind": "state"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": ":--include-content--did-load",
|
|
231
|
+
"selectors": [
|
|
232
|
+
"[did-load]",
|
|
233
|
+
"[data-did-load]"
|
|
234
|
+
],
|
|
235
|
+
"kind": "state"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": ":--include-content--is-active",
|
|
239
|
+
"selectors": [
|
|
240
|
+
"[is-active]",
|
|
241
|
+
"[aria-current]"
|
|
242
|
+
],
|
|
243
|
+
"kind": "state"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": ":--include-content--host-shadow",
|
|
247
|
+
"selectors": [
|
|
248
|
+
"[host-ref=\"shadow\"]",
|
|
249
|
+
"[data-host-ref=\"shadow\"]"
|
|
250
|
+
],
|
|
251
|
+
"kind": "state"
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"exports": [
|
|
258
|
+
{
|
|
259
|
+
"kind": "js",
|
|
260
|
+
"name": "IncludeContent",
|
|
261
|
+
"declaration": {
|
|
262
|
+
"name": "IncludeContent",
|
|
263
|
+
"module": "include-content.ts"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"kind": "custom-element-definition",
|
|
268
|
+
"name": "include-content",
|
|
269
|
+
"declaration": {
|
|
270
|
+
"name": "IncludeContent",
|
|
271
|
+
"module": "include-content.ts"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
}
|