@pie-players/pie-players-shared 0.3.75 → 1.0.0-beta.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/README.md +88 -77
- package/dist/components/vendor/nds/README.md +4 -5
- package/dist/config/profile.d.ts +1 -1
- package/dist/config/profile.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/language-tags.d.ts +9 -1
- package/dist/i18n/language-tags.js +11 -1
- package/dist/i18n/messages/en-US.d.ts +33 -5
- package/dist/i18n/messages/en-US.js +33 -5
- package/dist/i18n/messages/nl-NL.d.ts +33 -5
- package/dist/i18n/messages/nl-NL.js +33 -5
- package/dist/i18n/provider.d.ts +14 -7
- package/dist/i18n/provider.js +26 -29
- package/dist/index.js +0 -1
- package/dist/instrumentation/providers/BaseInstrumentationProvider.js +0 -14
- package/dist/loader-config.d.ts +0 -2
- package/dist/loader-config.js +0 -2
- package/dist/loaders/element-loader.js +13 -6
- package/dist/loaders/esm-adapter.js +48 -37
- package/dist/loaders/iife-adapter.d.ts +3 -3
- package/dist/loaders/iife-adapter.js +36 -35
- package/dist/media/index.d.ts +4 -6
- package/dist/media/index.js +6 -8
- package/dist/object/index.d.ts +8 -3
- package/dist/object/index.js +8 -6
- package/dist/pie/asset-handler.d.ts +0 -17
- package/dist/pie/asset-handler.js +1 -1
- package/dist/pie/authoring.js +5 -7
- package/dist/pie/elements-rendered.d.ts +0 -2
- package/dist/pie/elements-rendered.js +1 -1
- package/dist/pie/initialization.d.ts +13 -14
- package/dist/pie/initialization.js +61 -75
- package/dist/pie/item-session-contract.js +7 -9
- package/dist/pie/resource-monitor.d.ts +34 -32
- package/dist/pie/resource-monitor.js +152 -231
- package/dist/pie/stages.d.ts +4 -3
- package/dist/pie/stages.js +4 -3
- package/dist/pie/updates.js +5 -4
- package/dist/pie/utils.d.ts +0 -2
- package/dist/pie/utils.js +0 -2
- package/dist/security/sanitize-item-markup.d.ts +4 -4
- package/dist/security/sanitize-item-markup.js +4 -4
- package/dist/security/sanitize-svg-icon.js +2 -2
- package/dist/security/wrap-overwide-images.d.ts +1 -1
- package/dist/security/wrap-overwide-images.js +1 -1
- package/dist/timed-media/media-element-source.js +1 -2
- package/dist/types/index.d.ts +62 -52
- package/dist/types/index.js +2 -2
- package/dist/ui/attribute-coercion.d.ts +5 -0
- package/dist/ui/attribute-coercion.js +6 -4
- package/dist/ui/content-styles.d.ts +6 -10
- package/dist/ui/content-styles.js +8 -13
- package/dist/ui/first-focusable.d.ts +0 -1
- package/dist/ui/first-focusable.js +0 -1
- package/dist/ui/focus-trap.js +2 -3
- package/dist/ui/scope-css.d.ts +23 -26
- package/dist/ui/scope-css.js +23 -26
- package/package.json +3 -2
|
@@ -69,7 +69,9 @@ export interface MediaRetryReadyDetail extends ResourceMonitorEventDetail {
|
|
|
69
69
|
mediaTag: "audio" | "video";
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
* Tracks resource loads and
|
|
72
|
+
* Tracks the resource loads of one container and retries failed ones with
|
|
73
|
+
* exponential backoff and cache-busting URLs. The events it dispatches are
|
|
74
|
+
* listed in the event contract above.
|
|
73
75
|
*/
|
|
74
76
|
export declare class ResourceMonitor {
|
|
75
77
|
private config;
|
|
@@ -77,13 +79,20 @@ export declare class ResourceMonitor {
|
|
|
77
79
|
private observer;
|
|
78
80
|
private mutationObserver;
|
|
79
81
|
private errorHandler;
|
|
82
|
+
/** Retries scheduled so far, keyed by the URL without retry parameters. */
|
|
80
83
|
private retryAttempts;
|
|
84
|
+
/** Elements that failed to load each URL; a retry reloads the first one. */
|
|
81
85
|
private retryTargets;
|
|
82
86
|
private container;
|
|
83
|
-
private isBrowser;
|
|
87
|
+
private readonly isBrowser;
|
|
88
|
+
/** URLs referenced inside the container; timing entries for others are ignored. */
|
|
84
89
|
private containerResources;
|
|
85
90
|
private provider;
|
|
86
91
|
private started;
|
|
92
|
+
/**
|
|
93
|
+
* Bumped on every start and stop, so timers and listeners captured in an
|
|
94
|
+
* earlier lifecycle see themselves as stale.
|
|
95
|
+
*/
|
|
87
96
|
private lifecycleVersion;
|
|
88
97
|
private pendingRetryTimers;
|
|
89
98
|
private retryInFlight;
|
|
@@ -116,13 +125,10 @@ export declare class ResourceMonitor {
|
|
|
116
125
|
* Start monitoring resources in the given container
|
|
117
126
|
*/
|
|
118
127
|
start(container: HTMLElement): void;
|
|
119
|
-
/**
|
|
120
|
-
* Stop monitoring and clean up
|
|
121
|
-
*/
|
|
122
128
|
stop(): void;
|
|
123
129
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
130
|
+
* Tracks resources added to the container, or retargeted inside it, so
|
|
131
|
+
* timing entries can be attributed to this container.
|
|
126
132
|
*/
|
|
127
133
|
private setupMutationObserver;
|
|
128
134
|
/**
|
|
@@ -137,45 +143,38 @@ export declare class ResourceMonitor {
|
|
|
137
143
|
* Set up PerformanceObserver to track resource loading timing
|
|
138
144
|
*/
|
|
139
145
|
private setupPerformanceObserver;
|
|
140
|
-
/**
|
|
141
|
-
* Handle resource timing entry
|
|
142
|
-
*/
|
|
143
146
|
private handleResourceTiming;
|
|
147
|
+
private logResourceTiming;
|
|
144
148
|
private isLifecycleActive;
|
|
145
149
|
private clearRetryTracking;
|
|
146
150
|
private clearPendingMediaCheck;
|
|
147
151
|
private getRetryTargets;
|
|
148
152
|
private getPrimaryRetryTarget;
|
|
149
|
-
/**
|
|
150
|
-
* Handle successful resource load
|
|
151
|
-
*/
|
|
152
153
|
private handleSuccessfulLoad;
|
|
153
154
|
private resolveMediaTarget;
|
|
154
155
|
private resolveMediaTargetsForUrl;
|
|
155
156
|
private normalizeRetrySuccessResourceType;
|
|
156
157
|
private isMediaRetryRecovered;
|
|
157
158
|
private finalizeRetrySuccess;
|
|
159
|
+
/**
|
|
160
|
+
* A retried media fetch that succeeds does not mean the element recovered:
|
|
161
|
+
* it can still hold an error or no source. Success waits until a media
|
|
162
|
+
* target reports metadata, checked on `loadedmetadata`/`canplay` and by
|
|
163
|
+
* polling, and the reconciliation timeout bounds the wait.
|
|
164
|
+
*/
|
|
158
165
|
private reconcileMediaRetrySuccess;
|
|
166
|
+
private completeMediaRetry;
|
|
159
167
|
private handleMediaRetryReconciliationTimeout;
|
|
160
168
|
private dispatchMediaRetryReady;
|
|
161
|
-
/**
|
|
162
|
-
* Handle failed resource load
|
|
163
|
-
*/
|
|
164
169
|
private handleFailedLoad;
|
|
165
170
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
171
|
+
* Whether a timing entry belongs to this container. Timing entries carry
|
|
172
|
+
* absolute URLs, so a suffix match against a tracked URL also counts. The
|
|
173
|
+
* buffered observer also reports resources that loaded before the scan
|
|
174
|
+
* tracked them; those are looked up in the container's DOM.
|
|
169
175
|
*/
|
|
170
176
|
private isRelevantResource;
|
|
171
|
-
/**
|
|
172
|
-
* Check if a resource URL actually belongs to our container by checking DOM elements
|
|
173
|
-
* This is a fallback for resources that loaded before MutationObserver scanned
|
|
174
|
-
*/
|
|
175
177
|
private isResourceInContainer;
|
|
176
|
-
/**
|
|
177
|
-
* Set up error event handler for resource loading failures
|
|
178
|
-
*/
|
|
179
178
|
private setupErrorHandler;
|
|
180
179
|
/**
|
|
181
180
|
* Check if element is a resource element
|
|
@@ -189,18 +188,21 @@ export declare class ResourceMonitor {
|
|
|
189
188
|
* Handle permanent resource failure after all retries exhausted
|
|
190
189
|
*/
|
|
191
190
|
private handlePermanentFailure;
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
*/
|
|
191
|
+
/** Exponential backoff, capped at `maxRetryDelay`. */
|
|
192
|
+
private retryDelay;
|
|
195
193
|
private logRetrySchedule;
|
|
196
194
|
/**
|
|
197
|
-
*
|
|
195
|
+
* Reloads one element under a cache-busting URL. Media elements also need
|
|
196
|
+
* `load()`, since changing a `<source>` alone does not restart the fetch.
|
|
198
197
|
*/
|
|
199
198
|
private performRetryLoadAttempt;
|
|
200
|
-
private retryResourceLoad;
|
|
201
199
|
/**
|
|
202
|
-
*
|
|
200
|
+
* Schedules the next retry of a failed resource with exponential backoff,
|
|
201
|
+
* or fails it permanently once `maxRetries` is spent. Every failing element
|
|
202
|
+
* joins the URL's retry targets; concurrent errors for one URL share the
|
|
203
|
+
* retry already in flight.
|
|
203
204
|
*/
|
|
205
|
+
private retryResourceLoad;
|
|
204
206
|
private dispatchEvent;
|
|
205
207
|
/**
|
|
206
208
|
* Get current retry statistics
|