@pie-players/pie-players-shared 0.3.60 → 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 +2 -0
- package/dist/index.js +2 -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.d.ts +73 -0
- package/dist/ui/content-styles.js +204 -0
- 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 +9 -5
- 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/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
|
@@ -8,7 +8,9 @@ export * from "./object/index.js";
|
|
|
8
8
|
export * from "./pie/index.js";
|
|
9
9
|
export type { AssessmentEntity, AssessmentItemRef, AssessmentSection, AdvancedItemConfig, ConfigEntity, ConfigResource, Env, ItemConfig, ItemEntity, ItemSession, OutcomeResponse, PassageEntity, PieController, PieContent, PieDefaultModel, PieItemElement, PieModel, QuestionEntity, RubricBlock, TestPart, } from "./types/index.js";
|
|
10
10
|
export { editorPostFix } from "./types/index.js";
|
|
11
|
+
export * from "./ui/content-styles.js";
|
|
11
12
|
export * from "./ui/focus-trap.js";
|
|
12
13
|
export * from "./ui/first-focusable.js";
|
|
13
14
|
export * from "./ui/debug-panel-persistence.js";
|
|
14
15
|
export * from "./ui/safe-storage.js";
|
|
16
|
+
export * from "./ui/scope-css.js";
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,9 @@ export * from "./object/index.js";
|
|
|
8
8
|
// Barrel export for PIE runtime utilities
|
|
9
9
|
export * from "./pie/index.js";
|
|
10
10
|
export { editorPostFix } from "./types/index.js";
|
|
11
|
+
export * from "./ui/content-styles.js";
|
|
11
12
|
export * from "./ui/focus-trap.js";
|
|
12
13
|
export * from "./ui/first-focusable.js";
|
|
13
14
|
export * from "./ui/debug-panel-persistence.js";
|
|
14
15
|
export * from "./ui/safe-storage.js";
|
|
15
|
-
|
|
16
|
+
export * from "./ui/scope-css.js";
|
|
@@ -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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installs the shared PIE content stylesheet
|
|
3
|
+
* (`@pie-players/pie-theme/components.css`) into the host document.
|
|
4
|
+
*
|
|
5
|
+
* Authored assessment content depends on classes that belong to no single
|
|
6
|
+
* component: passage markup (`.numbered-paragraph`, `.p-number`,
|
|
7
|
+
* `div.passage-title`), the legacy `kds-*` families, the `@media print`
|
|
8
|
+
* `.noprint` rules, and the answer-eliminator classes. Players render into
|
|
9
|
+
* light DOM, so those rules have to exist as a document-level stylesheet —
|
|
10
|
+
* there is no shadow root to scope them to.
|
|
11
|
+
*
|
|
12
|
+
* Hosts used to be required to import that stylesheet themselves. Nothing
|
|
13
|
+
* enforced it and nothing failed loudly when they didn't: the item rendered,
|
|
14
|
+
* the passage was simply unstyled, and it surfaced as a visual bug reported by
|
|
15
|
+
* hand days later. Players install the stylesheet themselves instead, which
|
|
16
|
+
* keeps the host contract at "import the player".
|
|
17
|
+
*
|
|
18
|
+
* The CSS text is passed in rather than imported here: this package builds with
|
|
19
|
+
* plain `tsc`, so it cannot inline a stylesheet. Bundler-built player packages
|
|
20
|
+
* import it with Vite's `?inline` and hand the text over.
|
|
21
|
+
*/
|
|
22
|
+
export type ContentStylesResult = "installed" | "already-installed" | "opted-out" | "no-document";
|
|
23
|
+
/**
|
|
24
|
+
* True when the host declared `<html data-pie-content-styles="host">`, i.e. it
|
|
25
|
+
* takes ownership of loading the stylesheet.
|
|
26
|
+
*/
|
|
27
|
+
export declare function contentStylesOptedOut(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* True when `components.css` is applied to the document, by any route. Reads the
|
|
30
|
+
* sentinel custom property the stylesheet declares on `:root`.
|
|
31
|
+
*
|
|
32
|
+
* Only meaningful once the document's stylesheets have been applied — a host
|
|
33
|
+
* that loads CSS via an async `<link>` reads as missing until it lands.
|
|
34
|
+
*/
|
|
35
|
+
export declare function contentStylesPresent(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Installs `cssText` as a document-level stylesheet, once per document.
|
|
38
|
+
*
|
|
39
|
+
* The stylesheet is **prepended** to `<head>` and deliberately left out of a
|
|
40
|
+
* cascade layer. Prepending reproduces the placement hosts were told to use by
|
|
41
|
+
* hand — first in the entry, before app CSS — so an app rule and a content rule
|
|
42
|
+
* of equal specificity resolve in the host's favour, exactly as before.
|
|
43
|
+
*
|
|
44
|
+
* A cascade layer looks tempting here and is the wrong tool: unlayered author
|
|
45
|
+
* declarations beat *all* layered ones regardless of specificity, so a host
|
|
46
|
+
* reset as broad as `p { margin: 0 }` would silently outrank
|
|
47
|
+
* `.numbered-paragraph { margin-left: 36px }`. That trades a visible missing
|
|
48
|
+
* stylesheet for a subtler override bug, so ordinary specificity wins instead.
|
|
49
|
+
*
|
|
50
|
+
* @param cssText Contents of `@pie-players/pie-theme/components.css`.
|
|
51
|
+
* @param source Package installing the styles, for diagnostics.
|
|
52
|
+
*/
|
|
53
|
+
export declare function installContentStyles(cssText: string, source: string): ContentStylesResult;
|
|
54
|
+
/**
|
|
55
|
+
* Reports, once per page, the two ways content styling can go wrong. Neither is
|
|
56
|
+
* detectable synchronously — a host copy may still be in flight as an async
|
|
57
|
+
* `<link>` — so the check is deferred.
|
|
58
|
+
*
|
|
59
|
+
* - **Missing**: the host opted out and then loaded nothing, so authored content
|
|
60
|
+
* renders unstyled. This is the failure the old host-import contract produced
|
|
61
|
+
* silently.
|
|
62
|
+
* - **Duplicated**: the host still imports `components.css` itself *and* the
|
|
63
|
+
* player installed a copy. Rendering is correct while the two agree, but the
|
|
64
|
+
* host's copy loads later and therefore wins ties at equal specificity — so a
|
|
65
|
+
* host copy pinned to an older `@pie-players/pie-theme` silently overrides the
|
|
66
|
+
* player's newer rules. Harmless today, a confusing override tomorrow.
|
|
67
|
+
*/
|
|
68
|
+
export declare function auditContentStyles(source: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Test-only: clears the once-per-page warning latch and cancels any pending
|
|
71
|
+
* deferred check, so a timer scheduled by one test cannot warn during the next.
|
|
72
|
+
*/
|
|
73
|
+
export declare function resetContentStylesWarningForTesting(): void;
|