@microsoft/webui-framework 0.0.21 → 0.0.23
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 +104 -38
- package/dist/decorators.js +9 -2
- package/dist/element/markers.d.ts +8 -0
- package/dist/element/markers.js +95 -16
- package/dist/element.d.ts +11 -2
- package/dist/element.js +87 -2
- package/dist/lazy-hydration-contract.d.ts +22 -0
- package/dist/lazy-hydration-contract.js +28 -0
- package/dist/lazy-hydration-coordinator.d.ts +2 -0
- package/dist/lazy-hydration-coordinator.js +380 -0
- package/dist/lazy-hydration-entry.d.ts +1 -0
- package/dist/lazy-hydration-entry.js +2 -0
- package/dist/lifecycle.d.ts +1 -0
- package/dist/lifecycle.js +29 -1
- package/dist/template-element.d.ts +37 -7
- package/dist/template-element.js +444 -132
- package/dist/template-types.d.ts +9 -8
- package/dist/template.d.ts +1 -1
- package/package.json +8 -2
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { LAZY_HYDRATION_ACTIVATE, LAZY_HYDRATION_CONTENT_VISIBILITY, registerLazyHydrationCoordinator, } from './lazy-hydration-contract.js';
|
|
2
|
+
import { hydrationEnd, hydrationStart, isHydrationStartupPending, } from './lifecycle.js';
|
|
3
|
+
const pendingTargets = new WeakSet();
|
|
4
|
+
const observedTargets = new Set();
|
|
5
|
+
const boundaryStates = new WeakMap();
|
|
6
|
+
const streamedActivations = new WeakSet();
|
|
7
|
+
const initialObservationTargets = new WeakSet();
|
|
8
|
+
const activationGenerations = new WeakMap();
|
|
9
|
+
const queuedGenerations = new WeakMap();
|
|
10
|
+
const observationStartTimes = new WeakMap();
|
|
11
|
+
const nativeVisibilityTargets = new WeakSet();
|
|
12
|
+
const activationQueue = [];
|
|
13
|
+
const activationQueueGenerations = [];
|
|
14
|
+
const ancestorScratch = [];
|
|
15
|
+
const WAKE_EVENTS = [
|
|
16
|
+
'pointerover',
|
|
17
|
+
'pointerdown',
|
|
18
|
+
'focus',
|
|
19
|
+
'keydown',
|
|
20
|
+
'click',
|
|
21
|
+
];
|
|
22
|
+
const HYDRATION_BUDGET_MS = 8;
|
|
23
|
+
const CONTENT_VISIBILITY_EVENT = 'contentvisibilityautostatechange';
|
|
24
|
+
let observer;
|
|
25
|
+
let queueIndex = 0;
|
|
26
|
+
let continuationPending = false;
|
|
27
|
+
let schedulerUnavailable = false;
|
|
28
|
+
let wakeListenersInstalled = false;
|
|
29
|
+
let continuationChannel;
|
|
30
|
+
let hydrationBatchActive = false;
|
|
31
|
+
let initialObservationCount = 0;
|
|
32
|
+
let startupObservationGateActive = false;
|
|
33
|
+
let startupObservationGateSealed = false;
|
|
34
|
+
let installed = false;
|
|
35
|
+
function supportsLazyHydration() {
|
|
36
|
+
return typeof IntersectionObserver !== 'undefined';
|
|
37
|
+
}
|
|
38
|
+
function observe(target, mode) {
|
|
39
|
+
pendingTargets.add(target);
|
|
40
|
+
if (!target.isConnected || observedTargets.has(target))
|
|
41
|
+
return;
|
|
42
|
+
observedTargets.add(target);
|
|
43
|
+
advanceActivationGeneration(target);
|
|
44
|
+
observationStartTimes.set(target, performance.now());
|
|
45
|
+
trackInitialObservation(target);
|
|
46
|
+
if (mode === LAZY_HYDRATION_CONTENT_VISIBILITY &&
|
|
47
|
+
supportsContentVisibilityEvents()) {
|
|
48
|
+
nativeVisibilityTargets.add(target);
|
|
49
|
+
target.addEventListener(CONTENT_VISIBILITY_EVENT, handleContentVisibilityChange);
|
|
50
|
+
}
|
|
51
|
+
getObserver().observe(target);
|
|
52
|
+
installWakeListeners();
|
|
53
|
+
}
|
|
54
|
+
function observeStreamed(target, state, mode) {
|
|
55
|
+
boundaryStates.set(target, state);
|
|
56
|
+
observe(target, mode);
|
|
57
|
+
}
|
|
58
|
+
function disconnect(target) {
|
|
59
|
+
if (!observedTargets.delete(target))
|
|
60
|
+
return;
|
|
61
|
+
advanceActivationGeneration(target);
|
|
62
|
+
settleInitialObservation(target);
|
|
63
|
+
observer?.unobserve(target);
|
|
64
|
+
removeContentVisibilityListener(target);
|
|
65
|
+
removeWakeListenersWhenIdle();
|
|
66
|
+
}
|
|
67
|
+
function isStreamedActivation(target) {
|
|
68
|
+
return streamedActivations.has(target);
|
|
69
|
+
}
|
|
70
|
+
export function installLazyHydrationCoordinator() {
|
|
71
|
+
if (installed)
|
|
72
|
+
return;
|
|
73
|
+
installed = true;
|
|
74
|
+
registerLazyHydrationCoordinator({
|
|
75
|
+
supportsLazyHydration,
|
|
76
|
+
observe,
|
|
77
|
+
observeStreamed,
|
|
78
|
+
disconnect,
|
|
79
|
+
isStreamedActivation,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export function __resetLazyHydrationCoordinatorForTests() {
|
|
83
|
+
installed = false;
|
|
84
|
+
}
|
|
85
|
+
function getObserver() {
|
|
86
|
+
if (!observer) {
|
|
87
|
+
const supportsScrollMargin = 'scrollMargin' in IntersectionObserver.prototype;
|
|
88
|
+
const options = {
|
|
89
|
+
root: null,
|
|
90
|
+
rootMargin: supportsScrollMargin ? '0px' : '200px',
|
|
91
|
+
threshold: 0,
|
|
92
|
+
};
|
|
93
|
+
if (supportsScrollMargin)
|
|
94
|
+
options.scrollMargin = '200px';
|
|
95
|
+
observer = new IntersectionObserver(handleIntersections, options);
|
|
96
|
+
}
|
|
97
|
+
return observer;
|
|
98
|
+
}
|
|
99
|
+
function supportsContentVisibilityEvents() {
|
|
100
|
+
if ('ContentVisibilityAutoStateChangeEvent' in globalThis)
|
|
101
|
+
return true;
|
|
102
|
+
const root = document.documentElement;
|
|
103
|
+
return !!root && `on${CONTENT_VISIBILITY_EVENT}` in root;
|
|
104
|
+
}
|
|
105
|
+
function handleIntersections(entries) {
|
|
106
|
+
if (entries.length === 0)
|
|
107
|
+
return;
|
|
108
|
+
let queued = false;
|
|
109
|
+
for (let i = 0; i < entries.length; i++) {
|
|
110
|
+
const entry = entries[i];
|
|
111
|
+
if (isCurrentObservation(entry) &&
|
|
112
|
+
(entry.isIntersecting || entry.intersectionRatio > 0)) {
|
|
113
|
+
queued = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (queued)
|
|
117
|
+
beginHydrationBatch();
|
|
118
|
+
for (let i = 0; i < entries.length; i++) {
|
|
119
|
+
const entry = entries[i];
|
|
120
|
+
const target = entry.target;
|
|
121
|
+
if (!isCurrentObservation(entry))
|
|
122
|
+
continue;
|
|
123
|
+
settleInitialObservation(target);
|
|
124
|
+
if (entry.isIntersecting || entry.intersectionRatio > 0) {
|
|
125
|
+
enqueueActivationChain(target);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (!queued)
|
|
129
|
+
return;
|
|
130
|
+
if (!continuationPending)
|
|
131
|
+
drainActivationQueue();
|
|
132
|
+
}
|
|
133
|
+
function handleContentVisibilityChange(event) {
|
|
134
|
+
const target = event.currentTarget;
|
|
135
|
+
if (!target ||
|
|
136
|
+
event.target !== target ||
|
|
137
|
+
!target.isConnected ||
|
|
138
|
+
!observedTargets.has(target))
|
|
139
|
+
return;
|
|
140
|
+
const skipped = event.skipped;
|
|
141
|
+
if (skipped === true) {
|
|
142
|
+
settleInitialObservation(target);
|
|
143
|
+
observer?.unobserve(target);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (skipped !== false)
|
|
147
|
+
return;
|
|
148
|
+
beginHydrationBatch();
|
|
149
|
+
enqueueActivationChain(target);
|
|
150
|
+
if (!continuationPending)
|
|
151
|
+
drainActivationQueue();
|
|
152
|
+
}
|
|
153
|
+
function drainActivationQueue() {
|
|
154
|
+
continuationPending = false;
|
|
155
|
+
const started = performance.now();
|
|
156
|
+
while (queueIndex < activationQueue.length) {
|
|
157
|
+
const target = activationQueue[queueIndex];
|
|
158
|
+
const generation = activationQueueGenerations[queueIndex];
|
|
159
|
+
queueIndex++;
|
|
160
|
+
if (queuedGenerations.get(target) === generation) {
|
|
161
|
+
queuedGenerations.delete(target);
|
|
162
|
+
}
|
|
163
|
+
if (activationGenerations.get(target) !== generation)
|
|
164
|
+
continue;
|
|
165
|
+
try {
|
|
166
|
+
activate(target);
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
reportActivationError(error);
|
|
170
|
+
}
|
|
171
|
+
if (queueIndex < activationQueue.length &&
|
|
172
|
+
performance.now() - started >= HYDRATION_BUDGET_MS) {
|
|
173
|
+
scheduleContinuation();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
activationQueue.length = 0;
|
|
178
|
+
activationQueueGenerations.length = 0;
|
|
179
|
+
queueIndex = 0;
|
|
180
|
+
finishHydrationBatch();
|
|
181
|
+
}
|
|
182
|
+
function beginHydrationBatch() {
|
|
183
|
+
if (hydrationBatchActive)
|
|
184
|
+
return false;
|
|
185
|
+
hydrationBatchActive = true;
|
|
186
|
+
hydrationStart();
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
function finishHydrationBatch() {
|
|
190
|
+
if (!hydrationBatchActive)
|
|
191
|
+
return;
|
|
192
|
+
hydrationBatchActive = false;
|
|
193
|
+
hydrationEnd();
|
|
194
|
+
}
|
|
195
|
+
function scheduleContinuation() {
|
|
196
|
+
if (continuationPending)
|
|
197
|
+
return;
|
|
198
|
+
continuationPending = true;
|
|
199
|
+
const taskScheduler = globalThis.scheduler;
|
|
200
|
+
if (!schedulerUnavailable && taskScheduler?.postTask) {
|
|
201
|
+
void taskScheduler
|
|
202
|
+
.postTask(drainActivationQueue, { priority: 'user-visible' })
|
|
203
|
+
.catch(abortContinuation);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (!continuationChannel) {
|
|
207
|
+
continuationChannel = new MessageChannel();
|
|
208
|
+
continuationChannel.port1.onmessage = drainActivationQueue;
|
|
209
|
+
}
|
|
210
|
+
continuationChannel.port2.postMessage(0);
|
|
211
|
+
}
|
|
212
|
+
function abortContinuation(error) {
|
|
213
|
+
continuationPending = false;
|
|
214
|
+
schedulerUnavailable = true;
|
|
215
|
+
reportActivationError(error);
|
|
216
|
+
if (queueIndex < activationQueue.length) {
|
|
217
|
+
scheduleContinuation();
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
finishHydrationBatch();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function reportActivationError(error) {
|
|
224
|
+
const target = globalThis;
|
|
225
|
+
if (typeof target.reportError === 'function') {
|
|
226
|
+
target.reportError(error);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
setTimeout(() => {
|
|
230
|
+
throw error;
|
|
231
|
+
}, 0);
|
|
232
|
+
}
|
|
233
|
+
function enqueueActivationChain(target) {
|
|
234
|
+
const scratchStart = ancestorScratch.length;
|
|
235
|
+
let current = target;
|
|
236
|
+
while (current) {
|
|
237
|
+
const candidate = current;
|
|
238
|
+
if (pendingTargets.has(candidate)) {
|
|
239
|
+
ancestorScratch.push(candidate);
|
|
240
|
+
}
|
|
241
|
+
current = composedParent(current);
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
for (let i = ancestorScratch.length - 1; i >= scratchStart; i--) {
|
|
245
|
+
enqueueActivation(ancestorScratch[i]);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
finally {
|
|
249
|
+
ancestorScratch.length = scratchStart;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function enqueueActivation(target) {
|
|
253
|
+
const generation = activationGenerations.get(target);
|
|
254
|
+
if (generation === undefined ||
|
|
255
|
+
queuedGenerations.get(target) === generation)
|
|
256
|
+
return;
|
|
257
|
+
queuedGenerations.set(target, generation);
|
|
258
|
+
activationQueue.push(target);
|
|
259
|
+
activationQueueGenerations.push(generation);
|
|
260
|
+
}
|
|
261
|
+
function advanceActivationGeneration(target) {
|
|
262
|
+
activationGenerations.set(target, (activationGenerations.get(target) ?? 0) + 1);
|
|
263
|
+
}
|
|
264
|
+
function isCurrentObservation(entry) {
|
|
265
|
+
const started = observationStartTimes.get(entry.target);
|
|
266
|
+
return started !== undefined &&
|
|
267
|
+
(typeof entry.time !== 'number' || entry.time >= started);
|
|
268
|
+
}
|
|
269
|
+
function composedParent(element) {
|
|
270
|
+
if (element.assignedSlot)
|
|
271
|
+
return element.assignedSlot;
|
|
272
|
+
if (element.parentElement)
|
|
273
|
+
return element.parentElement;
|
|
274
|
+
const root = element.getRootNode();
|
|
275
|
+
return root instanceof ShadowRoot ? root.host : null;
|
|
276
|
+
}
|
|
277
|
+
function activate(target) {
|
|
278
|
+
if (!target.isConnected || !pendingTargets.delete(target))
|
|
279
|
+
return;
|
|
280
|
+
settleInitialObservation(target);
|
|
281
|
+
if (observedTargets.delete(target))
|
|
282
|
+
observer?.unobserve(target);
|
|
283
|
+
removeContentVisibilityListener(target);
|
|
284
|
+
removeWakeListenersWhenIdle();
|
|
285
|
+
const streamed = boundaryStates.has(target);
|
|
286
|
+
const state = boundaryStates.get(target);
|
|
287
|
+
boundaryStates.delete(target);
|
|
288
|
+
if (streamed)
|
|
289
|
+
streamedActivations.add(target);
|
|
290
|
+
try {
|
|
291
|
+
target[LAZY_HYDRATION_ACTIVATE](state);
|
|
292
|
+
}
|
|
293
|
+
finally {
|
|
294
|
+
if (streamed)
|
|
295
|
+
streamedActivations.delete(target);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function removeContentVisibilityListener(target) {
|
|
299
|
+
if (!nativeVisibilityTargets.delete(target))
|
|
300
|
+
return;
|
|
301
|
+
target.removeEventListener(CONTENT_VISIBILITY_EVENT, handleContentVisibilityChange);
|
|
302
|
+
}
|
|
303
|
+
function trackInitialObservation(target) {
|
|
304
|
+
if (startupObservationGateSealed ||
|
|
305
|
+
!isHydrationStartupPending())
|
|
306
|
+
return;
|
|
307
|
+
initialObservationTargets.add(target);
|
|
308
|
+
initialObservationCount++;
|
|
309
|
+
if (startupObservationGateActive)
|
|
310
|
+
return;
|
|
311
|
+
startupObservationGateActive = true;
|
|
312
|
+
hydrationStart();
|
|
313
|
+
document.addEventListener('DOMContentLoaded', sealStartupObservationGate, {
|
|
314
|
+
once: true,
|
|
315
|
+
});
|
|
316
|
+
window.addEventListener('load', sealStartupObservationGate, { once: true });
|
|
317
|
+
}
|
|
318
|
+
function settleInitialObservation(target) {
|
|
319
|
+
if (!initialObservationTargets.delete(target))
|
|
320
|
+
return;
|
|
321
|
+
initialObservationCount--;
|
|
322
|
+
finishStartupObservationGate();
|
|
323
|
+
}
|
|
324
|
+
function sealStartupObservationGate() {
|
|
325
|
+
startupObservationGateSealed = true;
|
|
326
|
+
finishStartupObservationGate();
|
|
327
|
+
}
|
|
328
|
+
function finishStartupObservationGate() {
|
|
329
|
+
if (!startupObservationGateActive ||
|
|
330
|
+
!startupObservationGateSealed ||
|
|
331
|
+
initialObservationCount !== 0)
|
|
332
|
+
return;
|
|
333
|
+
startupObservationGateActive = false;
|
|
334
|
+
hydrationEnd();
|
|
335
|
+
}
|
|
336
|
+
function handleWakeEvent(event) {
|
|
337
|
+
const path = event.composedPath();
|
|
338
|
+
let ownsBatch = false;
|
|
339
|
+
let batchStarted = false;
|
|
340
|
+
try {
|
|
341
|
+
for (let i = path.length - 1; i >= 0; i--) {
|
|
342
|
+
const current = path[i];
|
|
343
|
+
if (current instanceof HTMLElement) {
|
|
344
|
+
const target = current;
|
|
345
|
+
if (pendingTargets.has(target)) {
|
|
346
|
+
if (!batchStarted) {
|
|
347
|
+
ownsBatch = beginHydrationBatch();
|
|
348
|
+
batchStarted = true;
|
|
349
|
+
}
|
|
350
|
+
try {
|
|
351
|
+
activate(target);
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
reportActivationError(error);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
finally {
|
|
361
|
+
if (ownsBatch)
|
|
362
|
+
finishHydrationBatch();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function installWakeListeners() {
|
|
366
|
+
if (wakeListenersInstalled)
|
|
367
|
+
return;
|
|
368
|
+
wakeListenersInstalled = true;
|
|
369
|
+
for (let i = 0; i < WAKE_EVENTS.length; i++) {
|
|
370
|
+
document.addEventListener(WAKE_EVENTS[i], handleWakeEvent, true);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function removeWakeListenersWhenIdle() {
|
|
374
|
+
if (!wakeListenersInstalled || observedTargets.size !== 0)
|
|
375
|
+
return;
|
|
376
|
+
wakeListenersInstalled = false;
|
|
377
|
+
for (let i = 0; i < WAKE_EVENTS.length; i++) {
|
|
378
|
+
document.removeEventListener(WAKE_EVENTS[i], handleWakeEvent, true);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/lifecycle.d.ts
CHANGED
package/dist/lifecycle.js
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
let pendingCount = 0;
|
|
2
2
|
let started = false;
|
|
3
3
|
let completed = false;
|
|
4
|
+
const hasBrowserDocument = typeof document !== 'undefined' &&
|
|
5
|
+
typeof Document !== 'undefined' &&
|
|
6
|
+
document instanceof Document;
|
|
7
|
+
const navigationTiming = hasBrowserDocument &&
|
|
8
|
+
typeof performance.getEntriesByType === 'function'
|
|
9
|
+
? performance.getEntriesByType('navigation')[0]
|
|
10
|
+
: undefined;
|
|
11
|
+
let documentReady = !hasBrowserDocument ||
|
|
12
|
+
document.readyState === 'complete' ||
|
|
13
|
+
(navigationTiming?.domContentLoadedEventStart ?? 0) > 0;
|
|
14
|
+
if (!documentReady) {
|
|
15
|
+
const markDocumentReady = () => {
|
|
16
|
+
if (documentReady)
|
|
17
|
+
return;
|
|
18
|
+
documentReady = true;
|
|
19
|
+
tryComplete();
|
|
20
|
+
};
|
|
21
|
+
document.addEventListener('DOMContentLoaded', markDocumentReady, { once: true });
|
|
22
|
+
window.addEventListener('load', markDocumentReady, { once: true });
|
|
23
|
+
}
|
|
24
|
+
export function isHydrationStartupPending() {
|
|
25
|
+
return !documentReady;
|
|
26
|
+
}
|
|
4
27
|
let streamingGateActive = false;
|
|
5
28
|
let terminalReached = false;
|
|
6
29
|
let streamingGateAborted = false;
|
|
@@ -46,7 +69,12 @@ export function settleLateActivation() {
|
|
|
46
69
|
tryComplete();
|
|
47
70
|
}
|
|
48
71
|
function tryComplete() {
|
|
49
|
-
if (completed ||
|
|
72
|
+
if (completed ||
|
|
73
|
+
!documentReady ||
|
|
74
|
+
streamingGateAborted ||
|
|
75
|
+
pendingCount !== 0)
|
|
76
|
+
return;
|
|
77
|
+
if (!started && !streamingGateActive)
|
|
50
78
|
return;
|
|
51
79
|
if (streamingGateActive &&
|
|
52
80
|
(!terminalReached || pendingBoundaries !== 0 || pendingLateActivations !== 0))
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
import type { TemplateBlockMeta,
|
|
1
|
+
import type { TemplateMeta, TemplateBlockMeta, TemplateNodeIndex } from './template.js';
|
|
2
2
|
import { STREAMING_BOUNDARY_ACTIVATE } from './streaming-mode.js';
|
|
3
3
|
import type { ScopeFrame, TemplateInstance } from './element/types.js';
|
|
4
4
|
declare const WEBUI_SET_STATE_KEY: unique symbol;
|
|
5
5
|
declare const STREAMING_BOUNDARY_ABANDON: unique symbol;
|
|
6
6
|
export declare class TemplateElement extends HTMLElement {
|
|
7
|
+
private static readonly $ancestorReleaseQueue;
|
|
8
|
+
private static $ancestorReleaseIndex;
|
|
9
|
+
private static $ancestorReleaseActive;
|
|
7
10
|
private $root;
|
|
8
11
|
private $meta?;
|
|
9
12
|
private $ready;
|
|
10
13
|
private $hydrated;
|
|
11
|
-
private $
|
|
14
|
+
private $hasMounted;
|
|
12
15
|
private $deferredSSR;
|
|
13
16
|
private $activatingDeferredSSR;
|
|
17
|
+
private $deferredAncestor;
|
|
18
|
+
private $pendingAncestor;
|
|
19
|
+
private $deferredDescendants;
|
|
20
|
+
private $deferredByAncestor;
|
|
21
|
+
private $ancestorBoundaryState;
|
|
22
|
+
private $hasAncestorBoundaryState;
|
|
14
23
|
private $hasUnknownScopes;
|
|
15
24
|
private $templateState;
|
|
16
25
|
private $dirtyPaths;
|
|
17
26
|
private $pendingFlush;
|
|
18
27
|
private $preReadyWrites;
|
|
28
|
+
private $deferredWrites;
|
|
29
|
+
private $guardUnknownState;
|
|
19
30
|
private $resolver;
|
|
20
31
|
private $pathIndex?;
|
|
21
32
|
private $wildcardBindings?;
|
|
@@ -24,6 +35,7 @@ export declare class TemplateElement extends HTMLElement {
|
|
|
24
35
|
[STREAMING_BOUNDARY_ABANDON](): void;
|
|
25
36
|
static define(tagName: string): void;
|
|
26
37
|
connectedCallback(): void;
|
|
38
|
+
private $remount;
|
|
27
39
|
private $mount;
|
|
28
40
|
disconnectedCallback(): void;
|
|
29
41
|
$destroy(): void;
|
|
@@ -34,14 +46,29 @@ export declare class TemplateElement extends HTMLElement {
|
|
|
34
46
|
protected $observableNames(): Set<string>;
|
|
35
47
|
protected $beforeExternalStateWrite(): void;
|
|
36
48
|
protected $afterExternalStateWrite(_applied: boolean): void;
|
|
37
|
-
protected $shouldDeferSSRHydration(): boolean;
|
|
49
|
+
protected $shouldDeferSSRHydration(_meta?: TemplateMeta): boolean;
|
|
50
|
+
protected $didDeferSSRHydration(): void;
|
|
51
|
+
protected $didDeferStreamedSSRHydration(_state: Record<string, unknown> | undefined): void;
|
|
52
|
+
protected $currentTemplateMetadata(): TemplateMeta | undefined;
|
|
53
|
+
private $nearestHydrationBarrier;
|
|
54
|
+
private $registerWithHydrationBarrier;
|
|
55
|
+
private $adoptPendingDescendants;
|
|
56
|
+
private $registerDeferredDescendant;
|
|
57
|
+
private $detachDeferredAncestor;
|
|
58
|
+
private $releaseDeferredDescendants;
|
|
59
|
+
private $releaseAncestorBarrier;
|
|
60
|
+
private $abandonDeferredDescendants;
|
|
61
|
+
protected $primeSSRStateForDeferral(): void;
|
|
38
62
|
protected $shouldActivateOnBoundaryCommit(): boolean;
|
|
39
63
|
protected $activateDeferredSSR(state?: Record<string, unknown>): void;
|
|
64
|
+
protected $activateDeferredSSRFromBoundary(state?: Record<string, unknown>): void;
|
|
65
|
+
private $activateDeferredSSRWithState;
|
|
40
66
|
protected $shouldApplySSRBootstrapState(): boolean;
|
|
41
67
|
protected $shouldApplySSRState(_key: string): boolean;
|
|
42
68
|
protected $syncAuthoredAttributes(): void;
|
|
43
69
|
protected hydratedCallback(): void;
|
|
44
70
|
private $notifyHydrated;
|
|
71
|
+
private $finishHydration;
|
|
45
72
|
protected $shouldApplyTemplateStateFromSSR(_key: string): boolean;
|
|
46
73
|
protected $setTemplateState(key: string, value: unknown): boolean;
|
|
47
74
|
private $writeTemplateState;
|
|
@@ -51,12 +78,12 @@ export declare class TemplateElement extends HTMLElement {
|
|
|
51
78
|
private $setStateKey;
|
|
52
79
|
private $applySSRState;
|
|
53
80
|
$update(path?: string): void;
|
|
81
|
+
private $recordDeferredWrite;
|
|
82
|
+
private $replayDeferredWrites;
|
|
54
83
|
$flushUpdates(): void;
|
|
55
84
|
private $flush;
|
|
56
85
|
private $recordPreReadyWrite;
|
|
57
86
|
private $checkHydrationMismatch;
|
|
58
|
-
private $resolve;
|
|
59
|
-
private $resolveSSR;
|
|
60
87
|
private $parseTemplate;
|
|
61
88
|
private $createStagingRoot;
|
|
62
89
|
private $appendStagedChildren;
|
|
@@ -66,15 +93,18 @@ export declare class TemplateElement extends HTMLElement {
|
|
|
66
93
|
private $collectConditionalRange;
|
|
67
94
|
private $hasRootStructuralSlot;
|
|
68
95
|
private $hydrateCondContent;
|
|
69
|
-
private $findMarker;
|
|
70
96
|
private $findSSRText;
|
|
71
97
|
private $findSSRSlotRef;
|
|
72
98
|
private $rootTag;
|
|
73
99
|
private $wireAttrs;
|
|
74
|
-
protected $finalize(_instance: TemplateInstance, _root: Node, _meta: TemplateBlockMeta, _resolver: (root: Node,
|
|
100
|
+
protected $finalize(_instance: TemplateInstance, _root: Node, _meta: TemplateBlockMeta, _resolver: (root: Node, index: TemplateNodeIndex) => Node | null, _scope?: ScopeFrame): void;
|
|
75
101
|
private $makeAttr;
|
|
76
102
|
private $buildPathIndex;
|
|
77
103
|
private $updateBindings;
|
|
104
|
+
private $textStateIsKnown;
|
|
105
|
+
private $attrStateIsKnown;
|
|
106
|
+
private $partsAreKnown;
|
|
107
|
+
private $pathsAreKnown;
|
|
78
108
|
private $scopeIsKnown;
|
|
79
109
|
$updateInstance(instance: TemplateInstance): void;
|
|
80
110
|
private $patchText;
|