@pie-players/pie-players-shared 0.3.61 → 0.3.62
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/dist/config/profile.js +0 -1
- package/dist/i18n/index.js +0 -1
- package/dist/i18n/loader.js +0 -1
- package/dist/i18n/simple-i18n.js +0 -1
- package/dist/i18n/types.js +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/instrumentation/debug-panel-stream.js +0 -1
- package/dist/instrumentation/index.js +0 -1
- package/dist/instrumentation/provider-guards.js +0 -1
- package/dist/instrumentation/providers/BaseInstrumentationProvider.js +0 -1
- package/dist/instrumentation/providers/CompositeInstrumentationProvider.js +0 -1
- package/dist/instrumentation/providers/ConsoleInstrumentationProvider.js +0 -1
- package/dist/instrumentation/providers/DebugPanelInstrumentationProvider.js +0 -1
- package/dist/instrumentation/providers/NewRelicInstrumentationProvider.js +0 -1
- package/dist/instrumentation/providers/index.js +0 -1
- package/dist/instrumentation/types.js +0 -1
- package/dist/loader-config.js +0 -1
- package/dist/loaders/ElementLoader.js +0 -1
- package/dist/loaders/element-loader-types.js +0 -1
- package/dist/loaders/element-loader.js +0 -1
- package/dist/loaders/element-package-policy.js +0 -1
- package/dist/loaders/esm-adapter.js +0 -1
- package/dist/loaders/iife-adapter.js +0 -1
- package/dist/loaders/index.js +0 -1
- package/dist/object/index.js +0 -1
- package/dist/pie/asset-handler.js +0 -1
- package/dist/pie/authoring-tag.js +0 -1
- package/dist/pie/authoring.js +0 -1
- package/dist/pie/component-context.js +0 -1
- package/dist/pie/config.js +0 -1
- package/dist/pie/configure-initialization.js +0 -1
- package/dist/pie/correct-response-env.js +0 -1
- package/dist/pie/custom-element-define.js +0 -1
- package/dist/pie/index.js +0 -1
- package/dist/pie/initialization.js +0 -1
- package/dist/pie/instrumentation-event-bridge.js +0 -1
- package/dist/pie/instrumentation-event-map.js +0 -1
- package/dist/pie/instrumentation-provider-resolution.js +0 -1
- package/dist/pie/item-controller-storage.js +0 -1
- package/dist/pie/item-controller.js +0 -1
- package/dist/pie/item-session-contract.js +0 -1
- package/dist/pie/logger.js +0 -1
- package/dist/pie/math-rendering.js +0 -1
- package/dist/pie/overrides.js +0 -1
- package/dist/pie/player-initializer.js +0 -1
- package/dist/pie/registry.js +0 -1
- package/dist/pie/resource-monitor.js +0 -1
- package/dist/pie/scoring.js +0 -1
- package/dist/pie/stage-tracker.js +0 -1
- package/dist/pie/stages.js +0 -1
- package/dist/pie/tag-names.js +0 -1
- package/dist/pie/types.js +0 -1
- package/dist/pie/updates.js +0 -1
- package/dist/pie/utils.js +0 -1
- package/dist/pie/versioned-tag.js +0 -1
- package/dist/player-strategy.js +0 -1
- package/dist/security/index.js +0 -1
- package/dist/security/sanitize-item-markup.d.ts +11 -0
- package/dist/security/sanitize-item-markup.js +5 -3
- package/dist/security/sanitize-svg-icon.js +0 -1
- package/dist/security/validate-style-url.js +0 -1
- package/dist/security/wrap-model-rich-content.js +0 -1
- package/dist/security/wrap-overwide-images.js +0 -1
- package/dist/security/wrap-overwide-tables.js +0 -1
- package/dist/server/npm-registry.js +0 -1
- package/dist/types/index.js +0 -1
- package/dist/ui/content-styles.js +0 -1
- package/dist/ui/debug-panel-persistence.js +0 -1
- package/dist/ui/first-focusable.js +0 -1
- package/dist/ui/focus-trap.js +0 -1
- package/dist/ui/safe-storage.js +0 -1
- package/dist/ui/scope-css.d.ts +56 -0
- package/dist/ui/scope-css.js +310 -0
- package/dist/ui/zoom-compensation.js +0 -1
- package/package.json +4 -4
- package/dist/config/profile.js.map +0 -1
- package/dist/i18n/index.js.map +0 -1
- package/dist/i18n/loader.js.map +0 -1
- package/dist/i18n/simple-i18n.js.map +0 -1
- package/dist/i18n/types.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/instrumentation/debug-panel-stream.js.map +0 -1
- package/dist/instrumentation/index.js.map +0 -1
- package/dist/instrumentation/provider-guards.js.map +0 -1
- package/dist/instrumentation/providers/BaseInstrumentationProvider.js.map +0 -1
- package/dist/instrumentation/providers/CompositeInstrumentationProvider.js.map +0 -1
- package/dist/instrumentation/providers/ConsoleInstrumentationProvider.js.map +0 -1
- package/dist/instrumentation/providers/DebugPanelInstrumentationProvider.js.map +0 -1
- package/dist/instrumentation/providers/NewRelicInstrumentationProvider.js.map +0 -1
- package/dist/instrumentation/providers/index.js.map +0 -1
- package/dist/instrumentation/types.js.map +0 -1
- package/dist/loader-config.js.map +0 -1
- package/dist/loaders/ElementLoader.js.map +0 -1
- package/dist/loaders/element-loader-types.js.map +0 -1
- package/dist/loaders/element-loader.js.map +0 -1
- package/dist/loaders/element-package-policy.js.map +0 -1
- package/dist/loaders/esm-adapter.js.map +0 -1
- package/dist/loaders/iife-adapter.js.map +0 -1
- package/dist/loaders/index.js.map +0 -1
- package/dist/object/index.js.map +0 -1
- package/dist/pie/asset-handler.js.map +0 -1
- package/dist/pie/authoring-tag.js.map +0 -1
- package/dist/pie/authoring.js.map +0 -1
- package/dist/pie/component-context.js.map +0 -1
- package/dist/pie/config.js.map +0 -1
- package/dist/pie/configure-initialization.js.map +0 -1
- package/dist/pie/correct-response-env.js.map +0 -1
- package/dist/pie/custom-element-define.js.map +0 -1
- package/dist/pie/index.js.map +0 -1
- package/dist/pie/initialization.js.map +0 -1
- package/dist/pie/instrumentation-event-bridge.js.map +0 -1
- package/dist/pie/instrumentation-event-map.js.map +0 -1
- package/dist/pie/instrumentation-provider-resolution.js.map +0 -1
- package/dist/pie/item-controller-storage.js.map +0 -1
- package/dist/pie/item-controller.js.map +0 -1
- package/dist/pie/item-session-contract.js.map +0 -1
- package/dist/pie/logger.js.map +0 -1
- package/dist/pie/math-rendering.js.map +0 -1
- package/dist/pie/overrides.js.map +0 -1
- package/dist/pie/player-initializer.js.map +0 -1
- package/dist/pie/registry.js.map +0 -1
- package/dist/pie/resource-monitor.js.map +0 -1
- package/dist/pie/scoring.js.map +0 -1
- package/dist/pie/stage-tracker.js.map +0 -1
- package/dist/pie/stages.js.map +0 -1
- package/dist/pie/tag-names.js.map +0 -1
- package/dist/pie/types.js.map +0 -1
- package/dist/pie/updates.js.map +0 -1
- package/dist/pie/utils.js.map +0 -1
- package/dist/pie/versioned-tag.js.map +0 -1
- package/dist/player-strategy.js.map +0 -1
- package/dist/security/index.js.map +0 -1
- package/dist/security/sanitize-item-markup.js.map +0 -1
- package/dist/security/sanitize-svg-icon.js.map +0 -1
- package/dist/security/validate-style-url.js.map +0 -1
- package/dist/security/wrap-model-rich-content.js.map +0 -1
- package/dist/security/wrap-overwide-images.js.map +0 -1
- package/dist/security/wrap-overwide-tables.js.map +0 -1
- package/dist/server/npm-registry.js.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/ui/content-styles.js.map +0 -1
- package/dist/ui/debug-panel-persistence.js.map +0 -1
- package/dist/ui/first-focusable.js.map +0 -1
- package/dist/ui/focus-trap.js.map +0 -1
- package/dist/ui/safe-storage.js.map +0 -1
- package/dist/ui/zoom-compensation.js.map +0 -1
package/dist/config/profile.js
CHANGED
|
@@ -24,4 +24,3 @@ export const BUILDER_ORIGIN_URL = (typeof window !== "undefined" && window.PIE_B
|
|
|
24
24
|
export const BUILDER_BUNDLE_URL = (typeof window !== "undefined" && window.PIE_BUILDER_BUNDLE_URL) ||
|
|
25
25
|
readPublicEnv("PUBLIC_BUILDER_BUNDLE_URL") ||
|
|
26
26
|
DEFAULT_BUILDER_BUNDLE_URL;
|
|
27
|
-
//# sourceMappingURL=profile.js.map
|
package/dist/i18n/index.js
CHANGED
package/dist/i18n/loader.js
CHANGED
package/dist/i18n/simple-i18n.js
CHANGED
package/dist/i18n/types.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -33,4 +33,3 @@
|
|
|
33
33
|
export * from "./providers/index.js";
|
|
34
34
|
export { isInstrumentationProvider } from "./provider-guards.js";
|
|
35
35
|
export { clearBufferedInstrumentationDebugRecords, getBufferedInstrumentationDebugRecords, INSTRUMENTATION_DEBUG_EVENT_NAME, subscribeInstrumentationDebugRecords, } from "./debug-panel-stream.js";
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -10,4 +10,3 @@ export { CompositeInstrumentationProvider } from "./CompositeInstrumentationProv
|
|
|
10
10
|
export { ConsoleInstrumentationProvider } from "./ConsoleInstrumentationProvider.js";
|
|
11
11
|
export { DebugPanelInstrumentationProvider } from "./DebugPanelInstrumentationProvider.js";
|
|
12
12
|
export { NewRelicInstrumentationProvider } from "./NewRelicInstrumentationProvider.js";
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/dist/loader-config.js
CHANGED
package/dist/loaders/index.js
CHANGED
|
@@ -35,4 +35,3 @@ export { assertElementPackagesAllowed, ElementPackagePolicyError, } from "./elem
|
|
|
35
35
|
export { AdapterFailure, ElementAssertionError, ElementLoaderError, assertRegistered, ensureRegistered, } from "./element-loader.js";
|
|
36
36
|
export { BUILT_IN_VIEWS, createEsmBackend, mapEsmViewElements, } from "./esm-adapter.js";
|
|
37
37
|
export { createIifeBackend, DEFAULT_BUNDLE_HOST } from "./iife-adapter.js";
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
package/dist/object/index.js
CHANGED
package/dist/pie/authoring.js
CHANGED
package/dist/pie/config.js
CHANGED
package/dist/pie/index.js
CHANGED
|
@@ -44,4 +44,3 @@ export { updatePieElement, updatePieElements, updatePieElementWithRef, } from ".
|
|
|
44
44
|
export { addOrUpdateOverrideInUrl, applyElementOverrides, applyElementVersionOverridesPreserveTags, extractPackageInfo, formatElementOverrideParam, parseElementOverridesFromCurrentUrl, parseElementOverridesFromUrl, } from "./overrides.js";
|
|
45
45
|
// Utils
|
|
46
46
|
export { findOrAddSession, getPackageWithoutVersion, getPieElementBundlesUrl, parsePackageName, } from "./utils.js";
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
package/dist/pie/logger.js
CHANGED
package/dist/pie/overrides.js
CHANGED
package/dist/pie/registry.js
CHANGED
package/dist/pie/scoring.js
CHANGED
package/dist/pie/stages.js
CHANGED
package/dist/pie/tag-names.js
CHANGED
package/dist/pie/types.js
CHANGED
package/dist/pie/updates.js
CHANGED
package/dist/pie/utils.js
CHANGED
|
@@ -40,4 +40,3 @@ export function toPackageVersionedTag(tagName, packageSpec, options = {}) {
|
|
|
40
40
|
// package versions at runtime, which requires updating the cloned runtime tag.
|
|
41
41
|
return `${baseName}${VERSION_DELIMITER}${targetEncodedVersion}`;
|
|
42
42
|
}
|
|
43
|
-
//# sourceMappingURL=versioned-tag.js.map
|
package/dist/player-strategy.js
CHANGED
package/dist/security/index.js
CHANGED
|
@@ -4,4 +4,3 @@ export { resetSvgSanitizerForTesting, sanitizeSvgIcon, } from "./sanitize-svg-ic
|
|
|
4
4
|
export { wrapOverwideImages, wrapOverwideImagesInElement, } from "./wrap-overwide-images.js";
|
|
5
5
|
export { wrapModelRichContent } from "./wrap-model-rich-content.js";
|
|
6
6
|
export { wrapOverwideTables, wrapOverwideTablesInElement, } from "./wrap-overwide-tables.js";
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -15,6 +15,17 @@ export interface SanitizeItemMarkupOptions {
|
|
|
15
15
|
* tags that rewrite to `pie-*-config` or host-registered extensions.
|
|
16
16
|
*/
|
|
17
17
|
allowedCustomElements?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Whether to apply the overwide image / table scroll wrappers after
|
|
20
|
+
* sanitizing. Defaults to `true` for screen rendering.
|
|
21
|
+
*
|
|
22
|
+
* Print rendering must pass `false`: the wrappers are `overflow-x: auto`
|
|
23
|
+
* reflow affordances (WCAG 1.4.10 at 400% zoom), and `@pie-players/pie-theme`
|
|
24
|
+
* carries no `@media print` override for them. In print media `overflow`
|
|
25
|
+
* clips instead of scrolling, so a wide image or table would be silently
|
|
26
|
+
* cut off at the column edge with no way to reach the rest.
|
|
27
|
+
*/
|
|
28
|
+
wrapOverwideContent?: boolean;
|
|
18
29
|
}
|
|
19
30
|
/**
|
|
20
31
|
* Sanitize raw item/passage markup before it is injected into the DOM.
|
|
@@ -138,6 +138,9 @@ export function sanitizeItemMarkup(markup, options = {}) {
|
|
|
138
138
|
RETURN_TRUSTED_TYPE: false,
|
|
139
139
|
});
|
|
140
140
|
const sanitized = typeof result === "string" ? result : String(result ?? "");
|
|
141
|
+
// Print rendering opts out: `overflow` clips rather than scrolls on paper.
|
|
142
|
+
if (options.wrapOverwideContent === false)
|
|
143
|
+
return sanitized;
|
|
141
144
|
// PIE-94: wrap overwide authored images in a horizontal-scroll container
|
|
142
145
|
// so they don't get clipped by ancestor `overflow-x: hidden` regions in
|
|
143
146
|
// the section player (and match WCAG 1.4.10 Reflow at 400% zoom).
|
|
@@ -151,8 +154,8 @@ export function sanitizeItemMarkup(markup, options = {}) {
|
|
|
151
154
|
* can safely use reference equality when deciding whether to re-sanitize.
|
|
152
155
|
*/
|
|
153
156
|
export function createDefaultItemMarkupSanitizer(options = {}) {
|
|
154
|
-
const { allowedCustomElements } = options;
|
|
155
|
-
return (markup) => sanitizeItemMarkup(markup, { allowedCustomElements });
|
|
157
|
+
const { allowedCustomElements, wrapOverwideContent } = options;
|
|
158
|
+
return (markup) => sanitizeItemMarkup(markup, { allowedCustomElements, wrapOverwideContent });
|
|
156
159
|
}
|
|
157
160
|
/**
|
|
158
161
|
* Derive the authoring-mode allow-list (`pie-*-config`) from a set of PIE
|
|
@@ -174,4 +177,3 @@ export function buildAuthoringAllowList(elementTagNames) {
|
|
|
174
177
|
export function resetPurifierForTesting() {
|
|
175
178
|
purifierInstance = null;
|
|
176
179
|
}
|
|
177
|
-
//# sourceMappingURL=sanitize-item-markup.js.map
|
package/dist/types/index.js
CHANGED
package/dist/ui/focus-trap.js
CHANGED
package/dist/ui/safe-storage.js
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope an external stylesheet's rules to a single player instance, so a
|
|
3
|
+
* partner-authored stylesheet loaded via `<pie-item-player
|
|
4
|
+
* external-style-urls="...">` or `itemConfig.resources.stylesheets[*].url`
|
|
5
|
+
* styles that player's subtree instead of the whole host document.
|
|
6
|
+
*
|
|
7
|
+
* This replaces a single-regex implementation that prefixed every
|
|
8
|
+
* selector-like fragment. That is correct for flat selector rules and wrong for
|
|
9
|
+
* everything else: `@media screen { ... }` became
|
|
10
|
+
* `.scope @media screen { ... }`, an invalid selector, so the browser dropped
|
|
11
|
+
* the whole block and every rule inside it; `@font-face` and `@keyframes` were
|
|
12
|
+
* corrupted the same way; and `:root` became `.scope :root`, which can never
|
|
13
|
+
* match, because `:root` is `<html>` and is not a descendant of the player.
|
|
14
|
+
* At-rules and `:root` custom properties therefore never applied at all.
|
|
15
|
+
*
|
|
16
|
+
* The QTI player's `scopeCssRules` (`pie-qti` -
|
|
17
|
+
* `packages/item-player/src/components/utils/stylesheetRender.ts`) is not a
|
|
18
|
+
* drop-in either. Its `:root` handling is the behaviour we want and is adopted
|
|
19
|
+
* here, but it excludes `@` from its selector pattern rather than understanding
|
|
20
|
+
* at-rules, so `@media` and `@supports` lose their condition and their inner
|
|
21
|
+
* rules are hoisted and applied unconditionally — a mobile-only rule then
|
|
22
|
+
* applies at every viewport width, which is a subtler failure than dropping it.
|
|
23
|
+
*
|
|
24
|
+
* So this walks the stylesheet brace-by-brace instead of pattern-matching it.
|
|
25
|
+
* A real CSS parser would be the textbook answer and is deliberately not used:
|
|
26
|
+
* `@pie-players/pie-item-player` ships with two workspace dependencies, this
|
|
27
|
+
* runs in the delivery path, and scoping needs to know about rule boundaries
|
|
28
|
+
* only — not about property grammar.
|
|
29
|
+
*
|
|
30
|
+
* Known limits, all preserving existing behaviour rather than adding policy:
|
|
31
|
+
*
|
|
32
|
+
* - `@import` is passed through untouched, exactly as the old regex left it. It
|
|
33
|
+
* pulls in an unscoped stylesheet, so it defeats scoping, but blocking it is
|
|
34
|
+
* a security policy decision and not this function's job. Callers gate
|
|
35
|
+
* stylesheet URLs with `validateExternalStyleUrl` before fetching.
|
|
36
|
+
* - Declaration blocks are emitted verbatim, so `url(...)` references are left
|
|
37
|
+
* as authored and resolve against the stylesheet's own URL as before.
|
|
38
|
+
* - A style rule's block is never rewritten, which is also what native CSS
|
|
39
|
+
* nesting needs: nested selectors are relative to a parent that has already
|
|
40
|
+
* been scoped.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Rewrite `cssText` so every selector it contains is confined to
|
|
44
|
+
* `scopeSelector`.
|
|
45
|
+
*
|
|
46
|
+
* Returns `cssText` unchanged when there is no scope selector to apply, and
|
|
47
|
+
* `""` for empty or non-string input.
|
|
48
|
+
*/
|
|
49
|
+
export declare function scopeStylesheetCss(cssText: unknown, scopeSelector: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Confine a single selector to `scopeSelector`.
|
|
52
|
+
*
|
|
53
|
+
* Exported for tests and for callers that scope a selector they built
|
|
54
|
+
* themselves; `scopeStylesheetCss` is the entry point for stylesheet text.
|
|
55
|
+
*/
|
|
56
|
+
export declare function scopeSelector(selector: string, scopeSelector: string): string;
|