@pie-players/pie-players-shared 0.3.43 → 0.3.44
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.d.ts +0 -1
- package/dist/config/profile.js.map +1 -1
- package/dist/i18n/index.d.ts +0 -3
- package/dist/i18n/index.js +0 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/loader.d.ts +0 -1
- package/dist/i18n/loader.js.map +1 -1
- package/dist/i18n/simple-i18n.d.ts +0 -1
- package/dist/i18n/simple-i18n.js.map +1 -1
- package/dist/i18n/types.d.ts +0 -1
- package/dist/i18n/types.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/instrumentation/debug-panel-stream.d.ts +0 -1
- package/dist/instrumentation/debug-panel-stream.js.map +1 -1
- package/dist/instrumentation/index.d.ts +0 -1
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation/provider-guards.d.ts +0 -1
- package/dist/instrumentation/provider-guards.js.map +1 -1
- package/dist/instrumentation/providers/BaseInstrumentationProvider.d.ts +0 -1
- package/dist/instrumentation/providers/BaseInstrumentationProvider.js.map +1 -1
- package/dist/instrumentation/providers/CompositeInstrumentationProvider.d.ts +0 -1
- package/dist/instrumentation/providers/CompositeInstrumentationProvider.js.map +1 -1
- package/dist/instrumentation/providers/ConsoleInstrumentationProvider.d.ts +0 -1
- package/dist/instrumentation/providers/ConsoleInstrumentationProvider.js.map +1 -1
- package/dist/instrumentation/providers/DebugPanelInstrumentationProvider.d.ts +0 -1
- package/dist/instrumentation/providers/DebugPanelInstrumentationProvider.js.map +1 -1
- package/dist/instrumentation/providers/NewRelicInstrumentationProvider.d.ts +0 -1
- package/dist/instrumentation/providers/NewRelicInstrumentationProvider.js.map +1 -1
- package/dist/instrumentation/providers/index.d.ts +0 -1
- package/dist/instrumentation/providers/index.js.map +1 -1
- package/dist/instrumentation/types.d.ts +0 -1
- package/dist/instrumentation/types.js.map +1 -1
- package/dist/loader-config.d.ts +0 -1
- package/dist/loader-config.js.map +1 -1
- package/dist/loaders/ElementLoader.d.ts +0 -1
- package/dist/loaders/ElementLoader.js.map +1 -1
- package/dist/loaders/element-loader-types.d.ts +0 -1
- package/dist/loaders/element-loader-types.js.map +1 -1
- package/dist/loaders/element-loader.d.ts +0 -1
- package/dist/loaders/element-loader.js.map +1 -1
- package/dist/loaders/esm-adapter.d.ts +0 -1
- package/dist/loaders/esm-adapter.js.map +1 -1
- package/dist/loaders/iife-adapter.d.ts +0 -1
- package/dist/loaders/iife-adapter.js.map +1 -1
- package/dist/loaders/index.d.ts +0 -1
- package/dist/loaders/index.js.map +1 -1
- package/dist/object/index.d.ts +0 -1
- package/dist/object/index.js.map +1 -1
- package/dist/pie/asset-handler.d.ts +0 -1
- package/dist/pie/asset-handler.js.map +1 -1
- package/dist/pie/authoring.d.ts +0 -1
- package/dist/pie/authoring.js.map +1 -1
- package/dist/pie/component-context.d.ts +0 -1
- package/dist/pie/component-context.js.map +1 -1
- package/dist/pie/config.d.ts +0 -1
- package/dist/pie/config.js.map +1 -1
- package/dist/pie/configure-initialization.d.ts +0 -1
- package/dist/pie/configure-initialization.js.map +1 -1
- package/dist/pie/correct-response-env.d.ts +0 -1
- package/dist/pie/correct-response-env.js.map +1 -1
- package/dist/pie/custom-element-define.d.ts +0 -1
- package/dist/pie/custom-element-define.js.map +1 -1
- package/dist/pie/index.d.ts +4 -9
- package/dist/pie/index.js +4 -8
- package/dist/pie/index.js.map +1 -1
- package/dist/pie/initialization.d.ts +0 -1
- package/dist/pie/initialization.js.map +1 -1
- package/dist/pie/instrumentation-event-bridge.d.ts +0 -1
- package/dist/pie/instrumentation-event-bridge.js.map +1 -1
- package/dist/pie/instrumentation-event-map.d.ts +0 -1
- package/dist/pie/instrumentation-event-map.js.map +1 -1
- package/dist/pie/instrumentation-provider-resolution.d.ts +0 -1
- package/dist/pie/instrumentation-provider-resolution.js.map +1 -1
- package/dist/pie/item-controller-storage.d.ts +0 -1
- package/dist/pie/item-controller-storage.js.map +1 -1
- package/dist/pie/item-controller.d.ts +0 -1
- package/dist/pie/item-controller.js.map +1 -1
- package/dist/pie/item-session-contract.d.ts +0 -1
- package/dist/pie/item-session-contract.js.map +1 -1
- package/dist/pie/logger.d.ts +0 -1
- package/dist/pie/logger.js.map +1 -1
- package/dist/pie/math-rendering.d.ts +0 -1
- package/dist/pie/math-rendering.js.map +1 -1
- package/dist/pie/overrides.d.ts +0 -1
- package/dist/pie/overrides.js.map +1 -1
- package/dist/pie/player-initializer.d.ts +0 -1
- package/dist/pie/player-initializer.js.map +1 -1
- package/dist/pie/registry.d.ts +0 -1
- package/dist/pie/registry.js.map +1 -1
- package/dist/pie/resource-monitor.d.ts +0 -1
- package/dist/pie/resource-monitor.js.map +1 -1
- package/dist/pie/scoring.d.ts +0 -1
- package/dist/pie/scoring.js.map +1 -1
- package/dist/pie/stage-tracker.d.ts +0 -1
- package/dist/pie/stage-tracker.js.map +1 -1
- package/dist/pie/stages.d.ts +0 -1
- package/dist/pie/stages.js.map +1 -1
- package/dist/pie/tag-names.d.ts +0 -1
- package/dist/pie/tag-names.js.map +1 -1
- package/dist/pie/types.d.ts +0 -1
- package/dist/pie/types.js.map +1 -1
- package/dist/pie/updates.d.ts +0 -1
- package/dist/pie/updates.js.map +1 -1
- package/dist/pie/utils.d.ts +0 -1
- package/dist/pie/utils.js.map +1 -1
- package/dist/player-strategy.d.ts +0 -1
- package/dist/player-strategy.js.map +1 -1
- package/dist/security/index.d.ts +0 -1
- package/dist/security/index.js.map +1 -1
- package/dist/security/sanitize-item-markup.d.ts +0 -1
- package/dist/security/sanitize-item-markup.js.map +1 -1
- package/dist/security/sanitize-svg-icon.d.ts +0 -1
- package/dist/security/sanitize-svg-icon.js.map +1 -1
- package/dist/security/validate-style-url.d.ts +0 -1
- package/dist/security/validate-style-url.js.map +1 -1
- package/dist/security/wrap-overwide-images.d.ts +0 -1
- package/dist/security/wrap-overwide-images.js.map +1 -1
- package/dist/server/npm-registry.d.ts +0 -1
- package/dist/server/npm-registry.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/ui/debug-panel-persistence.d.ts +0 -1
- package/dist/ui/debug-panel-persistence.js.map +1 -1
- package/dist/ui/first-focusable.d.ts +0 -1
- package/dist/ui/first-focusable.js.map +1 -1
- package/dist/ui/focus-trap.d.ts +0 -1
- package/dist/ui/focus-trap.js.map +1 -1
- package/dist/ui/safe-storage.d.ts +0 -1
- package/dist/ui/safe-storage.js.map +1 -1
- package/package.json +6 -64
- package/dist/components/PieItemPlayer.svelte +0 -951
- package/dist/components/PiePreviewLayout.svelte +0 -154
- package/dist/components/PiePreviewToggle.svelte +0 -110
- package/dist/components/PieSpinner.svelte +0 -85
- package/dist/components/ToolSettingsButton.svelte +0 -62
- package/dist/components/ToolSettingsPanel.svelte +0 -104
- package/dist/components/index.ts +0 -6
- package/dist/config/profile.d.ts.map +0 -1
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/loader.d.ts.map +0 -1
- package/dist/i18n/simple-i18n.d.ts.map +0 -1
- package/dist/i18n/types.d.ts.map +0 -1
- package/dist/i18n/use-i18n-standalone.svelte.ts +0 -185
- package/dist/i18n/use-i18n.svelte.ts +0 -164
- package/dist/index.d.ts.map +0 -1
- package/dist/instrumentation/debug-panel-stream.d.ts.map +0 -1
- package/dist/instrumentation/index.d.ts.map +0 -1
- package/dist/instrumentation/provider-guards.d.ts.map +0 -1
- package/dist/instrumentation/providers/BaseInstrumentationProvider.d.ts.map +0 -1
- package/dist/instrumentation/providers/CompositeInstrumentationProvider.d.ts.map +0 -1
- package/dist/instrumentation/providers/ConsoleInstrumentationProvider.d.ts.map +0 -1
- package/dist/instrumentation/providers/DebugPanelInstrumentationProvider.d.ts.map +0 -1
- package/dist/instrumentation/providers/NewRelicInstrumentationProvider.d.ts.map +0 -1
- package/dist/instrumentation/providers/index.d.ts.map +0 -1
- package/dist/instrumentation/types.d.ts.map +0 -1
- package/dist/loader-config.d.ts.map +0 -1
- package/dist/loaders/ElementLoader.d.ts.map +0 -1
- package/dist/loaders/element-loader-types.d.ts.map +0 -1
- package/dist/loaders/element-loader.d.ts.map +0 -1
- package/dist/loaders/esm-adapter.d.ts.map +0 -1
- package/dist/loaders/iife-adapter.d.ts.map +0 -1
- package/dist/loaders/index.d.ts.map +0 -1
- package/dist/object/index.d.ts.map +0 -1
- package/dist/pie/asset-handler.d.ts.map +0 -1
- package/dist/pie/authoring.d.ts.map +0 -1
- package/dist/pie/component-context.d.ts.map +0 -1
- package/dist/pie/config.d.ts.map +0 -1
- package/dist/pie/configure-initialization.d.ts.map +0 -1
- package/dist/pie/correct-response-env.d.ts.map +0 -1
- package/dist/pie/custom-element-define.d.ts.map +0 -1
- package/dist/pie/index.d.ts.map +0 -1
- package/dist/pie/initialization.d.ts.map +0 -1
- package/dist/pie/instrumentation-event-bridge.d.ts.map +0 -1
- package/dist/pie/instrumentation-event-map.d.ts.map +0 -1
- package/dist/pie/instrumentation-provider-resolution.d.ts.map +0 -1
- package/dist/pie/item-controller-storage.d.ts.map +0 -1
- package/dist/pie/item-controller.d.ts.map +0 -1
- package/dist/pie/item-session-contract.d.ts.map +0 -1
- package/dist/pie/logger.d.ts.map +0 -1
- package/dist/pie/math-rendering.d.ts.map +0 -1
- package/dist/pie/overrides.d.ts.map +0 -1
- package/dist/pie/player-initializer.d.ts.map +0 -1
- package/dist/pie/registry.d.ts.map +0 -1
- package/dist/pie/resource-monitor.d.ts.map +0 -1
- package/dist/pie/scoring.d.ts.map +0 -1
- package/dist/pie/stage-tracker.d.ts.map +0 -1
- package/dist/pie/stages.d.ts.map +0 -1
- package/dist/pie/tag-names.d.ts.map +0 -1
- package/dist/pie/types.d.ts.map +0 -1
- package/dist/pie/updates.d.ts.map +0 -1
- package/dist/pie/use-resource-monitor.svelte.d.ts +0 -56
- package/dist/pie/use-resource-monitor.svelte.d.ts.map +0 -1
- package/dist/pie/use-resource-monitor.svelte.js +0 -176
- package/dist/pie/use-resource-monitor.svelte.js.map +0 -1
- package/dist/pie/utils.d.ts.map +0 -1
- package/dist/player-strategy.d.ts.map +0 -1
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/sanitize-item-markup.d.ts.map +0 -1
- package/dist/security/sanitize-svg-icon.d.ts.map +0 -1
- package/dist/security/validate-style-url.d.ts.map +0 -1
- package/dist/security/wrap-overwide-images.d.ts.map +0 -1
- package/dist/server/npm-registry.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/ui/debug-panel-persistence.d.ts.map +0 -1
- package/dist/ui/first-focusable.d.ts.map +0 -1
- package/dist/ui/focus-trap.d.ts.map +0 -1
- package/dist/ui/safe-storage.d.ts.map +0 -1
- package/dist/ui/use-promise.svelte.ts +0 -109
package/dist/pie/utils.d.ts
CHANGED
package/dist/pie/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/pie/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,MAAoB,EACpB,IAA4B,EACnB,EAAE;IACX,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,OAAO,GAAG,IAAI,CAAC,gBAAgB,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;AACtG,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,KAAa,EACqC,EAAE;IACpD,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,OAAO,GACZ,KAAK,CAAC,MAAM,C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,CAAC,CAAC,IAAI,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;KACzB,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAU,EAAE,CACpE,QAAQ;KACN,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KACpC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEb;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,IAAW,EACX,EAAU,EACV,OAAgB,EACV,EAAE;IACR,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE,CAAC;QACP,0DAA0D;QAC1D,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;QACrB,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC;IACD,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC;IAC9C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,OAAO,EAAE,CAAC;AACX,CAAC,CAAC","sourcesContent":["/**\n * PIE Utils Module\n *\n * URL building, package name parsing, and session utilities.\n */\n\nimport type { ConfigEntity } from \"../types/index.js\";\nimport type { LoadPieElementsOptions } from \"./types.js\";\n\n/**\n * Build URL for fetching PIE element bundles from build service\n */\nexport const getPieElementBundlesUrl = (\n\tconfig: ConfigEntity,\n\topts: LoadPieElementsOptions,\n): string => {\n\tconst elements = config.elements;\n\treturn `${opts.buildServiceBase}/${encodeURI(Object.values(elements).join(\"+\"))}/${opts.bundleType}`;\n};\n\n/**\n * Parse a package name string into its components\n *\n * NOTE: Duplicated because we can't have any server-side code in the client\n *\n * Examples:\n * - \"@pie-element/multiple-choice@9.9.1\" → { name: \"@pie-element/multiple-choice\", path: \"\", version: \"9.9.1\" }\n * - \"lodash/get@4.4.2\" → { name: \"lodash\", path: \"get\", version: \"4.4.2\" }\n */\nexport const parsePackageName = (\n\tinput: string,\n): { name: string; path: string; version: string } => {\n\tif (!input) {\n\t\tthrow new Error(\"Parameter is required: input\");\n\t}\n\tconst matched =\n\t\tinput.charAt(0) === \"@\"\n\t\t\t? input.match(/^(@[^/]+\\/[^/@]+)(?:\\/([^@]+))?(?:@([\\s\\S]+))?/) // scoped package name regex\n\t\t\t: input.match(/^([^/@]+)(?:\\/([^@]+))?(?:@([\\s\\S]+))?/); // normal package name\n\tif (!matched) {\n\t\tthrow new Error(`[parse-package-name] \"${input}\" is not a valid string`);\n\t}\n\treturn {\n\t\tname: matched[1],\n\t\tpath: matched[2] || \"\",\n\t\tversion: matched[3] || \"\",\n\t};\n};\n\n/**\n * Strip versions from a package string\n *\n * Example: \"@pie-element/multiple-choice@9.9.1+@pie-element/hotspot@9.1.0\"\n * → \"@pie-element/multiple-choice+@pie-element/hotspot\"\n */\nexport const getPackageWithoutVersion = (packages: string): string =>\n\tpackages\n\t\t.split(\"+\")\n\t\t.map((p) => parsePackageName(p).name)\n\t\t.join(\"+\");\n\n/**\n * Find or add a session entry for a given element\n *\n * TODO: kinda gnarly, copied from player project\n *\n * @param data - Session data array\n * @param id - Model/element ID\n * @param element - Element tag name (optional)\n * @returns The session entry\n */\nexport const findOrAddSession = (\n\tdata: any[],\n\tid: string,\n\telement?: string,\n): any => {\n\tif (!data) {\n\t\tthrow new Error(\"session data is required\");\n\t}\n\tconst s = data.find((d) => d.id === id);\n\tif (s) {\n\t\t// Update element property if provided and not already set\n\t\tif (element && !s.element) {\n\t\t\ts.element = element;\n\t\t}\n\t\treturn s;\n\t}\n\tconst ss = element ? { id, element } : { id };\n\tdata.push(ss);\n\treturn ss;\n};\n"]}
|
|
@@ -3,4 +3,3 @@ export type ItemPlayerStrategy = "iife" | "esm" | "preloaded";
|
|
|
3
3
|
export type ItemPlayerView = "delivery" | "author" | "print";
|
|
4
4
|
export declare function normalizeItemPlayerStrategy(value: string | null | undefined, fallback?: ItemPlayerStrategy): ItemPlayerStrategy;
|
|
5
5
|
export declare function resolveItemPlayerView(mode: Env["mode"] | undefined, defaultView?: ItemPlayerView): ItemPlayerView;
|
|
6
|
-
//# sourceMappingURL=player-strategy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"player-strategy.js","sourceRoot":"","sources":["../src/player-strategy.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,2BAA2B,CAC1C,KAAgC,EAChC,WAA+B,MAAM;IAErC,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,IAA6B,EAC7B,cAA8B,UAAU;IAExC,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"player-strategy.js","sourceRoot":"","sources":["../src/player-strategy.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,2BAA2B,CAC1C,KAAgC,EAChC,WAA+B,MAAM;IAErC,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,IAA6B,EAC7B,cAA8B,UAAU;IAExC,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["import type { Env } from \"./types/index.js\";\n\nexport type ItemPlayerStrategy = \"iife\" | \"esm\" | \"preloaded\";\nexport type ItemPlayerView = \"delivery\" | \"author\" | \"print\";\n\nexport function normalizeItemPlayerStrategy(\n\tvalue: string | null | undefined,\n\tfallback: ItemPlayerStrategy = \"iife\",\n): ItemPlayerStrategy {\n\tif (value === \"iife\" || value === \"esm\" || value === \"preloaded\") {\n\t\treturn value;\n\t}\n\treturn fallback;\n}\n\nexport function resolveItemPlayerView(\n\tmode: Env[\"mode\"] | undefined,\n\tdefaultView: ItemPlayerView = \"delivery\",\n): ItemPlayerView {\n\tif (mode === \"author\") {\n\t\treturn \"author\";\n\t}\n\treturn defaultView;\n}\n"]}
|
package/dist/security/index.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ export { buildAuthoringAllowList, createDefaultItemMarkupSanitizer, resetPurifie
|
|
|
2
2
|
export { parseAllowedStyleOrigins, validateExternalStyleUrl, type StyleUrlValidationError, type StyleUrlValidationOk, type StyleUrlValidationOptions, type StyleUrlValidationResult, } from "./validate-style-url.js";
|
|
3
3
|
export { resetSvgSanitizerForTesting, sanitizeSvgIcon, } from "./sanitize-svg-icon.js";
|
|
4
4
|
export { wrapOverwideImages } from "./wrap-overwide-images.js";
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,uBAAuB,EACvB,gCAAgC,EAChC,uBAAuB,EACvB,kBAAkB,GAGlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,wBAAwB,EACxB,wBAAwB,GAKxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAC3B,eAAe,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,uBAAuB,EACvB,gCAAgC,EAChC,uBAAuB,EACvB,kBAAkB,GAGlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,wBAAwB,EACxB,wBAAwB,GAKxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,2BAA2B,EAC3B,eAAe,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export {\n\tbuildAuthoringAllowList,\n\tcreateDefaultItemMarkupSanitizer,\n\tresetPurifierForTesting,\n\tsanitizeItemMarkup,\n\ttype ItemMarkupSanitizer,\n\ttype SanitizeItemMarkupOptions,\n} from \"./sanitize-item-markup.js\";\nexport {\n\tparseAllowedStyleOrigins,\n\tvalidateExternalStyleUrl,\n\ttype StyleUrlValidationError,\n\ttype StyleUrlValidationOk,\n\ttype StyleUrlValidationOptions,\n\ttype StyleUrlValidationResult,\n} from \"./validate-style-url.js\";\nexport {\n\tresetSvgSanitizerForTesting,\n\tsanitizeSvgIcon,\n} from \"./sanitize-svg-icon.js\";\nexport { wrapOverwideImages } from \"./wrap-overwide-images.js\";\n"]}
|
|
@@ -43,4 +43,3 @@ export declare function createDefaultItemMarkupSanitizer(options?: SanitizeItemM
|
|
|
43
43
|
export declare function buildAuthoringAllowList(elementTagNames: Iterable<string>): string[];
|
|
44
44
|
/** Reset the memoised DOMPurify instance. Only intended for tests. */
|
|
45
45
|
export declare function resetPurifierForTesting(): void;
|
|
46
|
-
//# sourceMappingURL=sanitize-item-markup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-item-markup.js","sourceRoot":"","sources":["../../src/security/sanitize-item-markup.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAa/D,8DAA8D;AAC9D,MAAM,kBAAkB,GAAG;IAC1B,MAAM;IACN,MAAM;IACN,UAAU;IACV,IAAI;IACJ,OAAO;IACP,OAAO;IACP,MAAM;IACN,KAAK;IACL,KAAK;IACL,OAAO;IACP,QAAQ;IACR,UAAU;IACV,MAAM;IACN,KAAK;CACL,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEvC,MAAM,cAAc,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,oEAAoE;IACpE,qEAAqE;IACrE,2CAA2C;IAC3C,eAAe;CACf,CAAC;AAEF,sEAAsE;AACtE,uEAAuE;AACvE,wDAAwD;AACxD,MAAM,eAAe,GAAG;IACvB,SAAS;IACT,QAAQ;IACR,SAAS;IACT,aAAa;IACb,YAAY;IACZ,cAAc;IACd,cAAc;IACd,SAAS;IACT,QAAQ;IACR,WAAW;IACX,SAAS;IACT,YAAY;IACZ,UAAU;IACV,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;CACZ,CAAC;AAEF,4EAA4E;AAC5E,2DAA2D;AAC3D,wEAAwE;AACxE,+CAA+C;AAC/C,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAErD,uEAAuE;AACvE,4EAA4E;AAC5E,6CAA6C;AAC7C,MAAM,yBAAyB,GAC9B,6JAA6J,CAAC;AAS/J,IAAI,gBAAgB,GAA6B,IAAI,CAAC;AAEtD,SAAS,eAAe;IACvB,IAAI,gBAAgB;QA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,CAAC,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,uBAAuB;IACtC,gBAAgB,GAAG,IAAI,CAAC;AACzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"sanitize-item-markup.js","sourceRoot":"","sources":["../../src/security/sanitize-item-markup.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAa/D,8DAA8D;AAC9D,MAAM,kBAAkB,GAAG;IAC1B,MAAM;IACN,MAAM;IACN,UAAU;IACV,IAAI;IACJ,OAAO;IACP,OAAO;IACP,MAAM;IACN,KAAK;IACL,KAAK;IACL,OAAO;IACP,QAAQ;IACR,UAAU;IACV,MAAM;IACN,KAAK;CACL,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEvC,MAAM,cAAc,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,oEAAoE;IACpE,qEAAqE;IACrE,2CAA2C;IAC3C,eAAe;CACf,CAAC;AAEF,sEAAsE;AACtE,uEAAuE;AACvE,wDAAwD;AACxD,MAAM,eAAe,GAAG;IACvB,SAAS;IACT,QAAQ;IACR,SAAS;IACT,aAAa;IACb,YAAY;IACZ,cAAc;IACd,cAAc;IACd,SAAS;IACT,QAAQ;IACR,WAAW;IACX,SAAS;IACT,YAAY;IACZ,UAAU;IACV,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;CACZ,CAAC;AAEF,4EAA4E;AAC5E,2DAA2D;AAC3D,wEAAwE;AACxE,+CAA+C;AAC/C,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAErD,uEAAuE;AACvE,4EAA4E;AAC5E,6CAA6C;AAC7C,MAAM,yBAAyB,GAC9B,6JAA6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AC,CAAC;QACf,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,uBAAuB;IACtC,gBAAgB,GAAG,IAAI,CAAC;AACzB,CAAC","sourcesContent":["/**\n * Default sanitizer for PIE item / passage markup.\n *\n * Used by `PieItemPlayer.svelte` to strip scripts, event-handler attributes,\n * and unknown tags before injecting authored markup via `{@html}`. Hosts can\n * opt out with the `trust-markup` attribute on the `<pie-*-player>` element,\n * or supply their own sanitizer function if they need a stricter / looser\n * allow-list.\n */\n\nimport DOMPurify from \"dompurify\";\n\nimport { wrapOverwideImages } from \"./wrap-overwide-images.js\";\n\nexport type ItemMarkupSanitizer = (markup: string) => string;\n\nexport interface SanitizeItemMarkupOptions {\n\t/**\n\t * Extra custom-element tag names that should survive sanitization in\n\t * addition to the default `pie-*` allow-list. Useful for authoring-mode\n\t * tags that rewrite to `pie-*-config` or host-registered extensions.\n\t */\n\tallowedCustomElements?: string[];\n}\n\n// Attributes every PIE element / wrapper is allowed to carry.\nconst BASE_ALLOWED_ATTRS = [\n\t\"slot\",\n\t\"role\",\n\t\"tabindex\",\n\t\"id\",\n\t\"class\",\n\t\"style\",\n\t\"href\",\n\t\"src\",\n\t\"alt\",\n\t\"title\",\n\t\"hidden\",\n\t\"disabled\",\n\t\"lang\",\n\t\"dir\",\n];\n\nconst BASE_URI_SAFE_ATTRS = [\"pie-id\"];\n\nconst FORBIDDEN_TAGS = [\n\t\"script\",\n\t\"iframe\",\n\t\"object\",\n\t\"embed\",\n\t\"base\",\n\t\"form\",\n\t\"meta\",\n\t\"link\",\n\t// <foreignObject> inside an <svg> is a well-known escape hatch back\n\t// into HTML context; match the SVG-icon sanitizer and forbid it here\n\t// so both sanitizers agree on the surface.\n\t\"foreignobject\",\n];\n\n// DOMPurify already strips `on*` handlers via its default block-list;\n// these entries guarantee they stay stripped even if a consumer tweaks\n// defaults, and they cover the common SVG / math sinks.\nconst FORBIDDEN_ATTRS = [\n\t\"onerror\",\n\t\"onload\",\n\t\"onclick\",\n\t\"onmouseover\",\n\t\"onmouseout\",\n\t\"onmouseenter\",\n\t\"onmouseleave\",\n\t\"onfocus\",\n\t\"onblur\",\n\t\"onkeydown\",\n\t\"onkeyup\",\n\t\"onkeypress\",\n\t\"onsubmit\",\n\t\"onchange\",\n\t\"onbeforeunload\",\n\t\"formaction\",\n\t\"xlink:href\",\n];\n\n// Any tag that looks like a custom element (contains a hyphen) is permitted\n// provided it starts with `pie-` or is explicitly named in\n// `allowedCustomElements`. This intentionally keeps third-party unknown\n// custom elements out unless the host opts in.\nconst PIE_CUSTOM_ELEMENT_REGEX = /^pie-[a-z0-9-]+$/i;\n\n// Attribute names that custom elements are allowed to declare. We stay\n// permissive for the PIE element contract (`model-*`, `session-*`, ...) and\n// the standard `data-*` / `aria-*` families.\nconst CUSTOM_ELEMENT_ATTR_REGEX =\n\t/^(id|class|style|slot|role|tabindex|hidden|disabled|lang|dir|data-[\\w-]+|aria-[\\w-]+|pie-[\\w-]+|model-[\\w-]+|session-[\\w-]+|config-[\\w-]+|context-[\\w-]+)$/i;\n\ninterface DOMPurifyInstance {\n\tsanitize: (\n\t\tsource: string,\n\t\tconfig?: Record<string, unknown>,\n\t) => string | Node | DocumentFragment;\n}\n\nlet purifierInstance: DOMPurifyInstance | null = null;\n\nfunction resolvePurifier(): DOMPurifyInstance | null {\n\tif (purifierInstance) return purifierInstance;\n\tif (typeof window === \"undefined\" || !window.document) return null;\n\t// DOMPurify's default export is both the instance and the factory.\n\t// Calling it with a window binds the instance to that document.\n\tconst factory = DOMPurify as unknown as (\n\t\twin: Window & typeof globalThis,\n\t) => DOMPurifyInstance;\n\tpurifierInstance =\n\t\ttypeof factory === \"function\"\n\t\t\t? factory(window as Window & typeof globalThis)\n\t\t\t: (DOMPurify as unknown as DOMPurifyInstance);\n\treturn purifierInstance;\n}\n\n/**\n * Sanitize raw item/passage markup before it is injected into the DOM.\n *\n * - Strips `<script>`, event-handler attributes, unknown protocols and\n * a standard set of dangerous tags (`iframe`, `object`, `embed`, `base`,\n * `form`, `meta`, `link`).\n * - Preserves PIE custom elements (`pie-*`) and any extra tags listed in\n * `allowedCustomElements`.\n * - During SSR (no `window`) returns an empty string so untrusted markup\n * never reaches the prerender output; the live renderer will re-run the\n * sanitizer on hydrate.\n */\nexport function sanitizeItemMarkup(\n\tmarkup: string,\n\toptions: SanitizeItemMarkupOptions = {},\n): string {\n\tif (!markup) return \"\";\n\tconst purifier = resolvePurifier();\n\tif (!purifier) return \"\";\n\n\tconst allowedCustomElements = (options.allowedCustomElements ?? []).map(\n\t\t(name) => name.toLowerCase(),\n\t);\n\tconst explicitCustomElementSet = new Set(allowedCustomElements);\n\n\tconst result = purifier.sanitize(markup, {\n\t\tADD_TAGS: allowedCustomElements,\n\t\tADD_ATTR: BASE_ALLOWED_ATTRS,\n\t\tADD_URI_SAFE_ATTR: BASE_URI_SAFE_ATTRS,\n\t\tFORBID_TAGS: FORBIDDEN_TAGS,\n\t\tFORBID_ATTR: FORBIDDEN_ATTRS,\n\t\tALLOW_UNKNOWN_PROTOCOLS: false,\n\t\tSANITIZE_DOM: true,\n\t\t// pie-item contract compatibility: PIE models are matched to DOM\n\t\t// elements via strict `id` equality (see `updateSinglePieElement`\n\t\t// in players-shared/src/pie/updates.ts). `SANITIZE_NAMED_PROPS`\n\t\t// would prefix every `id`/`name` with `user-content-`, which silently\n\t\t// breaks model lookup for every item. `SANITIZE_DOM: true` above\n\t\t// still provides the core DOM-clobbering defenses we rely on.\n\t\tSANITIZE_NAMED_PROPS: false,\n\t\tWHOLE_DOCUMENT: false,\n\t\tALLOW_DATA_ATTR: true,\n\t\tALLOW_ARIA_ATTR: true,\n\t\tCUSTOM_ELEMENT_HANDLING: {\n\t\t\ttagNameCheck: (tagName: string) => {\n\t\t\t\tconst lower = tagName.toLowerCase();\n\t\t\t\treturn (\n\t\t\t\t\tPIE_CUSTOM_ELEMENT_REGEX.test(lower) ||\n\t\t\t\t\texplicitCustomElementSet.has(lower)\n\t\t\t\t);\n\t\t\t},\n\t\t\tattributeNameCheck: (attrName: string) =>\n\t\t\t\tCUSTOM_ELEMENT_ATTR_REGEX.test(attrName),\n\t\t\tallowCustomizedBuiltInElements: false,\n\t\t},\n\t\tRETURN_TRUSTED_TYPE: false,\n\t});\n\n\tconst sanitized =\n\t\ttypeof result === \"string\" ? result : String(result ?? \"\");\n\t// PIE-94: wrap overwide authored images in a horizontal-scroll container\n\t// so they don't get clipped by ancestor `overflow-x: hidden` regions in\n\t// the section player (and match WCAG 1.4.10 Reflow at 400% zoom).\n\treturn wrapOverwideImages(sanitized);\n}\n\n/**\n * Build the default `ItemMarkupSanitizer` used by the players. The returned\n * function is stable for a given set of allowed custom elements so callers\n * can safely use reference equality when deciding whether to re-sanitize.\n */\nexport function createDefaultItemMarkupSanitizer(\n\toptions: SanitizeItemMarkupOptions = {},\n): ItemMarkupSanitizer {\n\tconst { allowedCustomElements } = options;\n\treturn (markup: string) =>\n\t\tsanitizeItemMarkup(markup, { allowedCustomElements });\n}\n\n/**\n * Derive the authoring-mode allow-list (`pie-*-config`) from a set of PIE\n * element tag names. Used by `transformMarkupForAuthoring` so the sanitizer\n * keeps the rewritten `-config` tags instead of stripping them.\n */\nexport function buildAuthoringAllowList(\n\telementTagNames: Iterable<string>,\n): string[] {\n\tconst out = new Set<string>();\n\tfor (const tag of elementTagNames) {\n\t\tif (!tag) continue;\n\t\tconst lower = tag.toLowerCase();\n\t\tout.add(lower);\n\t\tout.add(`${lower}-config`);\n\t}\n\treturn [...out];\n}\n\n/** Reset the memoised DOMPurify instance. Only intended for tests. */\nexport function resetPurifierForTesting() {\n\tpurifierInstance = null;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-svg-icon.js","sourceRoot":"","sources":["../../src/security/sanitize-svg-icon.ts"],"names":[],"mapp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M,CAAC;IAExC,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;QACtC,YAAY,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;QAC7C,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,eAAe;QAC5B,uBAAuB,EAAE,KAAK;QAC9B,mBAAmB,EAAE,KAAK;KAC1B,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACvE,IAAI,WAAW,CAAC,IAAI,IAAI,gBAAgB,EAAE,CAAC;QAC1C,uEAAuE;QACvE,0DAA0D;QAC1D,MAAM,IAAI,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;IACD,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,2BAA2B;IAC1C,mBAAmB,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Sanitize an SVG string intended to be rendered as an icon.\n *\n * Used by toolbars and tool-button components when their icon prop is an\n * inline SVG supplied by a tool configuration. Runs DOMPurify with the\n * SVG profile, forbids `<script>` / `<foreignObject>` and strips\n * event-handler attributes.\n *\n * Returns an empty string when `window` / `document` are unavailable (SSR)\n * or the input is not a string.\n */\n\nimport DOMPurify from \"dompurify\";\n\ninterface DOMPurifyInstance {\n\tsanitize: (\n\t\tsource: string,\n\t\tconfig?: Record<string, unknown>,\n\t) => string | Node | DocumentFragment;\n}\n\nlet svgPurifierInstance: DOMPurifyInstance | null = null;\n\nfunction resolveSvgPurifier(): DOMPurifyInstance | null {\n\tif (svgPurifierInstance) return svgPurifierInstance;\n\tif (typeof window === \"undefined\" || !window.document) return null;\n\tconst factory = DOMPurify as unknown as (\n\t\twin: Window & typeof globalThis,\n\t) => DOMPurifyInstance;\n\tsvgPurifierInstance =\n\t\ttypeof factory === \"function\"\n\t\t\t? factory(window as Window & typeof globalThis)\n\t\t\t: (DOMPurify as unknown as DOMPurifyInstance);\n\treturn svgPurifierInstance;\n}\n\nconst FORBIDDEN_TAGS = [\n\t\"script\",\n\t\"foreignobject\",\n\t\"iframe\",\n\t\"object\",\n\t\"embed\",\n\t\"base\",\n\t\"form\",\n];\n\nconst FORBIDDEN_ATTRS = [\n\t\"onerror\",\n\t\"onload\",\n\t\"onclick\",\n\t\"onmouseover\",\n\t\"onmouseout\",\n\t\"onmouseenter\",\n\t\"onmouseleave\",\n\t\"onfocus\",\n\t\"onblur\",\n\t\"onkeydown\",\n\t\"onkeyup\",\n\t\"onkeypress\",\n\t\"formaction\",\n\t\"xlink:href\",\n];\n\nconst stringCache = new Map<string, string>();\nconst STRING_CACHE_MAX = 64;\n\nexport function sanitizeSvgIcon(icon: unknown): string {\n\tif (typeof icon !== \"string\" || icon.length === 0) return \"\";\n\tconst trimmed = icon.trimStart();\n\tif (!trimmed.toLowerCase().startsWith(\"<svg\")) return \"\";\n\tconst cached = stringCache.get(icon);\n\tif (cached !== undefined) return cached;\n\n\tconst purifier = resolveSvgPurifier();\n\tif (!purifier) return \"\";\n\tconst result = purifier.sanitize(icon, {\n\t\tUSE_PROFILES: { svg: true, svgFilters: true },\n\t\tFORBID_TAGS: FORBIDDEN_TAGS,\n\t\tFORBID_ATTR: FORBIDDEN_ATTRS,\n\t\tALLOW_UNKNOWN_PROTOCOLS: false,\n\t\tRETURN_TRUSTED_TYPE: false,\n\t});\n\tconst str = typeof result === \"string\" ? result : String(result ?? \"\");\n\tif (stringCache.size >= STRING_CACHE_MAX) {\n\t\t// Naive LRU: clear oldest half when the cache fills up. Tool icons are\n\t\t// a small fixed set per assessment so this is rarely hit.\n\t\tconst keys = [...stringCache.keys()];\n\t\tfor (let i = 0; i < keys.length / 2; i += 1) {\n\t\t\tstringCache.delete(keys[i]);\n\t\t}\n\t}\n\tstringCache.set(icon, str);\n\treturn str;\n}\n\n/** Reset sanitizer state. Intended for tests. */\nexport function resetSvgSanitizerForTesting() {\n\tsvgPurifierInstance = null;\n\tstringCache.clear();\n}\n"]}
|
|
@@ -25,4 +25,3 @@ export interface StyleUrlValidationOptions {
|
|
|
25
25
|
}
|
|
26
26
|
export declare function validateExternalStyleUrl(url: unknown, options?: StyleUrlValidationOptions): StyleUrlValidationResult;
|
|
27
27
|
export declare function parseAllowedStyleOrigins(raw: unknown): string[];
|
|
28
|
-
//# sourceMappingURL=validate-style-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-style-url.js","sourceRoot":"","sources":["../../src/security/validate-style-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAsBH,MAAM,UAAU,wBAAwB,CACvC,GAAY,EACZ,UAAqC,EAAE;IAEvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjD,OAAO;YACN,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE,qDAAqD;SAC9D,CAAC;IACH,CAAC;IACD,IAAI,WAAgB,CAAC;IACrB,IAAI,CAAC;QACJ,WAAW,GAAG,OAAO,CAAC,OAAO;YAC5B,CAAC,CAAC,IAAI,GAA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,mBAAmB;YAC3B,OAAO,EAAE,8BAA8B,WAAW,CAAC,MAAM,uCAAuC;SAChG,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,GAAY;IACpD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3D,OAAO,GAAG;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/**\n * Validate that an external stylesheet URL supplied via\n * `<pie-item-player external-style-urls=\"...\">` (or the\n * `itemConfig.resources.stylesheets[*].url` path) is safe to load.\n *\n * - Only `http:` / `https:` are allowed; `javascript:`, `data:`, `file:`\n * and custom schemes are rejected.\n * - When `allowedOrigins` is non-empty, the URL's origin must match one\n * of the listed origins. This lets hosts restrict style loading to a\n * known CDN allow-list.\n */\n\nexport type StyleUrlValidationOk = {\n\tok: true;\n\tresolvedUrl: URL;\n};\n\nexport type StyleUrlValidationError = {\n\tok: false;\n\treason: \"invalid-url\" | \"disallowed-protocol\" | \"disallowed-origin\";\n\tmessage: string;\n};\n\nexport type StyleUrlValidationResult =\n\t| StyleUrlValidationOk\n\t| StyleUrlValidationError;\n\nexport interface StyleUrlValidationOptions {\n\tbaseUrl?: string;\n\tallowedOrigins?: string[];\n}\n\nexport function validateExternalStyleUrl(\n\turl: unknown,\n\toptions: StyleUrlValidationOptions = {},\n): StyleUrlValidationResult {\n\tif (typeof url !== \"string\" || url.length === 0) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: \"invalid-url\",\n\t\t\tmessage: \"External stylesheet URL must be a non-empty string.\",\n\t\t};\n\t}\n\tlet resolvedUrl: URL;\n\ttry {\n\t\tresolvedUrl = options.baseUrl\n\t\t\t? new URL(url, options.baseUrl)\n\t\t\t: new URL(url);\n\t} catch (err) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: \"invalid-url\",\n\t\t\tmessage: `External stylesheet URL could not be parsed: ${String(err)}`,\n\t\t};\n\t}\n\tif (resolvedUrl.protocol !== \"http:\" && resolvedUrl.protocol !== \"https:\") {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: \"disallowed-protocol\",\n\t\t\tmessage: `External stylesheet protocol ${resolvedUrl.protocol} is not allowed (only http/https).`,\n\t\t};\n\t}\n\tconst allowed = options.allowedOrigins ?? [];\n\tif (allowed.length > 0 && !allowed.includes(resolvedUrl.origin)) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: \"disallowed-origin\",\n\t\t\tmessage: `External stylesheet origin ${resolvedUrl.origin} is not in the configured allow-list.`,\n\t\t};\n\t}\n\treturn { ok: true, resolvedUrl };\n}\n\nexport function parseAllowedStyleOrigins(raw: unknown): string[] {\n\tif (typeof raw !== \"string\" || raw.length === 0) return [];\n\treturn raw\n\t\t.split(\",\")\n\t\t.map((entry) => entry.trim())\n\t\t.filter((entry) => entry.length > 0);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-overwide-images.js","sourceRoot":"","sources":["../../src/security/wrap-overwide-images.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,4BAA4B,GAAG,QAAQ,CAAC;AAC9C,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEhD,SAAS,wBAAwB,CAChC,KAAc,EACd,IAAa;IAEb,IAAI,QAAQ,GAAmB,KAAK,CAAC,aAAa,CAAC;IACnD,OAAO,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtC,IAAI,4BAA4B,CAAC,IAAI,CAAC,Q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izontally scrollable container so\n * images that are wider than their column surface a scrollbar instead of being\n * clipped by ancestor `overflow-x: hidden` regions (PIE-94).\n *\n * The wrapper is rendered as\n * `<span class=\"pie-image-scroll\" tabindex=\"0\" role=\"region\" aria-label=\"...\">`\n * and receives the accompanying CSS from `@pie-players/pie-theme`. The CSS uses\n * `overflow-x: auto` so small images stay visually unchanged: a scrollbar only\n * appears when the image's intrinsic width exceeds the wrapper's available\n * space (including at higher browser-zoom levels, which is the original driver\n * for this change — WCAG 1.4.10 Reflow at 400% zoom).\n *\n * This helper runs as a post-sanitization step inside `sanitizeItemMarkup`, so\n * every host that renders authored markup through the shared\n * `pie-item-player` (including the section player) benefits uniformly.\n */\n\nconst PIE_CUSTOM_ELEMENT_TAG_REGEX = /^pie-/i;\nconst SCROLL_WRAPPER_CLASS = \"pie-image-scroll\";\n\nfunction isInsidePieCustomElement(\n\timage: Element,\n\troot: Element,\n): boolean {\n\tlet ancestor: Element | null = image.parentElement;\n\twhile (ancestor && ancestor !== root) {\n\t\tif (PIE_CUSTOM_ELEMENT_TAG_REGEX.test(ancestor.tagName)) {\n\t\t\treturn true;\n\t\t}\n\t\tancestor = ancestor.parentElement;\n\t}\n\treturn false;\n}\n\nfunction buildAriaLabel(image: Element): string {\n\tconst alt = image.getAttribute(\"alt\");\n\tconst trimmed = alt ? alt.trim() : \"\";\n\treturn trimmed ? `Scrollable image: ${trimmed}` : \"Scrollable image\";\n}\n\n/**\n * Wrap `<img>` elements in `markup` with a horizontal-scroll container.\n *\n * - No-ops on empty input.\n * - No-ops during SSR (no `window` / `DOMParser`) — the markup is returned\n * unchanged; the browser re-run on hydrate will perform the wrap.\n * - Idempotent: images whose direct parent already carries the\n * `pie-image-scroll` class are left alone.\n * - Leaves images inside PIE custom elements (`<pie-*>`) alone. Those are\n * rendered by the element's own template / shadow DOM and should not be\n * restructured by the authored-markup pipeline.\n */\nexport function wrapOverwideImages(markup: string): string {\n\tif (!markup) return \"\";\n\n\t// Fast path: avoid the DOM round-trip entirely when the markup carries no\n\t// images. Keeps the sanitize pipeline cheap for the common case.\n\tif (!/<img\\b/i.test(markup)) return markup;\n\n\tif (typeof window === \"undefined\" || !window.document) return markup;\n\n\tconst ParserCtor =\n\t\ttypeof DOMParser !== \"undefined\"\n\t\t\t? DOMParser\n\t\t\t: (window as unknown as { DOMParser?: typeof DOMParser }).DOMParser;\n\tif (!ParserCtor) return markup;\n\n\tconst doc = new ParserCtor().parseFromString(\n\t\t`<!DOCTYPE html><html><body>${markup}</body></html>`,\n\t\t\"text/html\",\n\t);\n\tconst body = doc.body;\n\tif (!body) return markup;\n\n\tconst images = Array.from(body.querySelectorAll(\"img\"));\n\tif (images.length === 0) return markup;\n\n\tlet mutated = false;\n\tfor (const image of images) {\n\t\tconst parent = image.parentElement;\n\t\tif (!parent) continue;\n\n\t\t// Idempotency — already wrapped.\n\t\tif (\n\t\t\tparent.classList &&\n\t\t\tparent.classList.contains(SCROLL_WRAPPER_CLASS)\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Leave PIE custom-element internals alone.\n\t\tif (isInsidePieCustomElement(image, body)) continue;\n\n\t\tconst wrapper = doc.createElement(\"span\");\n\t\twrapper.className = SCROLL_WRAPPER_CLASS;\n\t\twrapper.setAttribute(\"tabindex\", \"0\");\n\t\twrapper.setAttribute(\"role\", \"region\");\n\t\twrapper.setAttribute(\"aria-label\", buildAriaLabel(image));\n\n\t\tparent.insertBefore(wrapper, image);\n\t\twrapper.appendChild(image);\n\t\tmutated = true;\n\t}\n\n\treturn mutated ? body.innerHTML : markup;\n}\n"]}
|
|
@@ -5,4 +5,3 @@ type NpmFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Respon
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const getNpmPackageVersions: (element: string, fetch: NpmFetch, filter?: (v: string) => boolean, limit?: number, searchTerm?: string) => Promise<string[]>;
|
|
7
7
|
export {};
|
|
8
|
-
//# sourceMappingURL=npm-registry.d.ts.map
|
|
@@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U,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAClE;aACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACd,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI;gBAAE,OAAO,CAAC,CAAC;YAC7B,IAAI,CAAC,IAAI;gBAAE,OAAO,CAAC,CAAC;YACpB,IAAI,CAAC,IAAI;gBAAE,OAAO,CAAC,CAAC,CAAC;YACrB,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEJ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YAC5C,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,CAAC;YACjB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CACX,4CAA4C,OAAO,GAAG,EACtD,KAAK,CACL,CAAC;QACF,OAAO,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;AACF,CAAC,CAAC","sourcesContent":["import semver from \"semver\";\n\nconst NPM_REGISTRY_URL = \"https://registry.npmjs.org\";\n\nif (typeof window !== \"undefined\") {\n\tthrow new Error(\n\t\t\"[npm-registry] @pie-players/pie-players-shared/server/npm-registry is server-only and cannot be imported in browser code\",\n\t);\n}\n\nconst DEFAULT_FILTER = (v: string) =>\n\tv.indexOf(\"print\") === -1 &&\n\tv.indexOf(\"ps\") === -1 &&\n\tv.indexOf(\"strikethrough\") === -1 &&\n\tv.indexOf(\"alpha\") === -1 &&\n\tv.indexOf(\"bm\") === -1;\n\ntype NpmFetch = (\n\tinput: RequestInfo | URL,\n\tinit?: RequestInit,\n) => Promise<Response>;\n\n/**\n * Server-only helper for npm package version lookups.\n * Do not import this module from browser-executed code.\n */\nexport const getNpmPackageVersions = async (\n\telement: string,\n\tfetch: NpmFetch,\n\tfilter: (v: string) => boolean = DEFAULT_FILTER,\n\tlimit?: number,\n\tsearchTerm = \"\",\n): Promise<string[]> => {\n\tif (typeof window !== \"undefined\") {\n\t\tthrow new Error(\n\t\t\t\"[npm-registry] server-only module imported in browser context\",\n\t\t);\n\t}\n\n\ttry {\n\t\tconst response = await fetch(`${NPM_REGISTRY_URL}/${element}`);\n\t\tif (!response.ok) {\n\t\t\tconsole.warn(\n\t\t\t\t`[npm-registry] npm status ${response.status} for package ${element}`,\n\t\t\t);\n\t\t\treturn searchTerm ? [] : [\"latest\"];\n\t\t}\n\n\t\tconst json = await response.json();\n\t\tconst versions = json?.versions as Record<\n\t\t\tstring,\n\t\t\t{ deprecated?: string }\n\t\t> | null;\n\t\tif (!versions || typeof versions !== \"object\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[npm-registry] response for ${element} missing 'versions' property`,\n\t\t\t);\n\t\t\treturn searchTerm ? [] : [\"latest\"];\n\t\t}\n\n\t\tlet sorted = Object.keys(versions)\n\t\t\t.filter(filter)\n\t\t\t.filter((v) => !versions[v]?.deprecated)\n\t\t\t.filter((v) => !/^11\\.0\\.\\d+-esm\\.\\d+/.test(v))\n\t\t\t.filter(\n\t\t\t\t(v) =>\n\t\t\t\t\t!searchTerm || v.toLowerCase().includes(searchTerm.toLowerCase()),\n\t\t\t)\n\t\t\t.sort((a, b) => {\n\t\t\t\tconst verA = semver.valid(semver.clean(a));\n\t\t\t\tconst verB = semver.valid(semver.clean(b));\n\t\t\t\tif (!verA && !verB) return 0;\n\t\t\t\tif (!verA) return 1;\n\t\t\t\tif (!verB) return -1;\n\t\t\t\treturn semver.rcompare(verA, verB);\n\t\t\t});\n\n\t\tif (typeof limit === \"number\" && limit > 0) {\n\t\t\tsorted = sorted.slice(0, limit);\n\t\t}\n\n\t\tif (!searchTerm) {\n\t\t\tsorted.unshift(\"latest\");\n\t\t}\n\n\t\treturn sorted;\n\t} catch (error) {\n\t\tconsole.warn(\n\t\t\t`[npm-registry] failed package lookup for ${element}:`,\n\t\t\terror,\n\t\t);\n\t\treturn searchTerm ? [] : [\"latest\"];\n\t}\n};\n"]}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AA+CA,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC3B,iCAAa,CAAA;IACb,mCAAe,CAAA;IACf,mCAAe,CAAA;IACf,iDAA6B,CAAA;AAC9B,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,0BAAa,CAAA;IACb,8BAAiB,CAAA;AAClB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAyBD,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IACnB,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,iCAAqB,CAAA;AACtB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB;AAodD,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACxC,oDAAmB,CAAA;IACnB,4DAA2B,CAAA;IAC3B,wDAAuB,CAAA;IACvB,kDAAiB,CAAA;AAClB,CAAC,EALW,6BAA6B,KA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,aAAa,CAAC,MAAc;IAC3C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClE,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CACzE,GAAG,CACH,CAAC;QACF,OAAO,GAAG,IAAI,IAAI,UAAU,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAaD,MAAM,OAAO,mBAAoB,SAAQ,WAAiC;IAI/D;IACA;IAJV,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAEhC,YACU,SAAiB,EACjB,QAAiB;QAE1B,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE;SACxB,CAAC,CAAC;QAPD,cAAS,GAAT,SAAS,CAAQ;QACjB,aAAQ,GAAR,QAAQ,CAAS;IAO3B,CAAC;;AA2FF,wFAAwF;AACxF,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACvB,+CAAQ,CAAA;IACR,qDAAW,CAAA;IACX,iDAAS,CAAA;IACT,uDAAY,CAAA;AACb,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB","sourcesContent":["/**\n * This contains copies of the data types we use in PIEOneer. These types, unlike\n * the ones in the datastore package, should not have any dependencies, and might in some\n * cases be more shallow than their originals. The main reason for these is that they should\n * be able to be used in front-end code (as well as the PIEOneer backend code).\n *\n * INCLUDING REFERENCES TO THE DATASTORE PACKAGE INSTEAD WILL MAKE PIEONEER THROW 500\n * EVERYWHERE WITHOUT ANY FURTHER EXPLANATION\n */\nexport interface BaseEntity {\n\tid?: string;\n\tcreatedAt?: Date;\n\tupdatedAt?: Date;\n}\n\nexport interface CollectionEntity extends BaseEntity {\n\tname: string;\n\torganization: string | OrganizationEntity;\n}\n\nexport interface OrganizationEntity extends BaseEntity {\n\tname: string;\n\tdefaultCollection?: string | CollectionEntity;\n}\n\nexport interface UserEntity extends BaseEntity {\n\temail: string;\n\tname?: string;\n}\n\nexport interface ClientEntity extends BaseEntity {\n\tname: string;\n\tsecret: string;\n\tuser: string | UserEntity;\n\torganization: string | OrganizationEntity;\n}\n\nexport interface AssignmentEntity extends BaseEntity {\n\torganization: string | OrganizationEntity;\n}\n\nexport interface SessionEntity extends BaseEntity {\n\titem: ItemEntity;\n\tassignment?: string | AssignmentEntity; // TODO: Remove after data is migrated\n\torganization?: string | OrganizationEntity;\n}\n\nexport enum SessionEventType {\n\tSAVE = \"save\",\n\tMODEL = \"model\",\n\tSCORE = \"score\",\n\tMANUAL_SCORE = \"manual-score\",\n}\n\nexport enum ScoreType {\n\tAUTO = \"auto\",\n\tMANUAL = \"manual\",\n}\n\nexport interface SessionScore {\n\tpoints?: number;\n\tmax?: number;\n\ttype?: ScoreType;\n\tpartialScoring?: boolean;\n\tmessage?: string;\n\terrors?: string[];\n}\n\nexport interface SessionAutoScore extends SessionScore {\n\telements?: any[];\n\textraProps?: any;\n}\n\nexport interface SessionManualScore extends SessionScore {}\n\nexport interface SessionEventEntity extends BaseEntity {\n\tsession: string | SessionEntity;\n\ttype?: SessionEventType;\n\tsaveEventId?: string;\n\tscore?: number;\n}\n\nexport enum ModeType {\n\tGATHER = \"gather\",\n\tVIEW = \"view\",\n\tEVALUATE = \"evaluate\",\n}\n\nexport interface FlatSession {\n\tid: string;\n\tassignment: AssignmentEntity;\n\titem: string;\n\tdata: any[];\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tmode: ModeType;\n\tautoScore: SessionAutoScore;\n\tmanualScore: SessionManualScore;\n\tevents: SessionEventEntity[]; // raw events;\n}\n\nexport interface SemVerPrerelease {\n\ttag: string;\n\tversion: number;\n}\n\nexport interface SemVer {\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tprerelease?: SemVerPrerelease;\n}\n\nexport interface VersionEntity extends BaseEntity {\n\tbaseId: string;\n\tsignature?: string;\n\tversion: SemVer;\n}\n\nexport interface SearchMetaData {\n\t[key: string]: any;\n}\n\nexport interface SearchMetaDataEntity extends BaseEntity {\n\tsearchMetaData?: SearchMetaData;\n}\n\nexport interface ConfigElements {\n\t[key: string]: string;\n}\n\nexport interface PieModel {\n\tid: string;\n\telement: string;\n\n\t[key: string]: any;\n}\n\nexport interface ConfigEntity {\n\tid?: string;\n\tmarkup: string;\n\telements: ConfigElements;\n\tmodels: PieModel[];\n\tconfiguration?: Record<string, any>; // NEW: Configure settings for authoring mode\n\n\t/**\n\t * QTI 3.0: Extracted accessibility catalogs from embedded SSML.\n\t * Automatically generated by SSMLExtractor when <speak> tags are found in content.\n\t */\n\textractedCatalogs?: AccessibilityCatalog[];\n\n\t[key: string]: any;\n}\n\nexport interface ConfigContainerEntity extends BaseEntity {\n\tconfig: ConfigEntity;\n}\n\nexport interface PassageEntity\n\textends VersionEntity,\n\t\tConfigContainerEntity,\n\t\tSearchMetaDataEntity {\n\tname: string;\n\tretired?: boolean;\n\tpublished?: boolean;\n\t// Search result highlights from OpenSearch (keyed by field name)\n\thighlights?: Record<string, string[]>;\n}\n\nexport interface ItemEntity\n\textends VersionEntity,\n\t\tConfigContainerEntity,\n\t\tSearchMetaDataEntity {\n\tname?: string;\n\tpassage?: string | PassageEntity;\n\tretired?: boolean;\n\tpublished?: boolean;\n\tconfiguration?: any;\n\t// Search result highlights from OpenSearch (keyed by field name)\n\thighlights?: Record<string, string[]>;\n}\n\nexport interface AssignmentSessionData {\n\tassignment: AssignmentEntity;\n\tsessions: FlatSession[];\n\titems: ItemEntity[];\n\terror?: string;\n}\n\n/**\n * Metadata specifically for interpretation by clients, typically containing\n * options that are relevant for the user interface. This is not indexed for search.\n */\nexport interface SettingsMetaData {\n\t[key: string]: any;\n}\n\n/**\n * Objects that contain metadata in the settings property, which is NOT indexed for search\n * but typically only relevant for particular client cases.\n */\nexport interface SettingsMetaDataEntity {\n\tsettings?: SettingsMetaData;\n}\n\n/**\n * A reference to an item with optionally a title, settings and metadata.\n */\nexport interface QuestionEntity\n\textends SearchMetaDataEntity,\n\t\tSettingsMetaDataEntity {\n\tid?: string;\n\ttitle?: string;\n\titemVId: string;\n\titem?: ItemEntity;\n}\n\n// ============================================================================\n// QTI-aligned assessment model (QTI 2.x compatible shape)\n// ============================================================================\n\nexport type RubricBlockView =\n\t| \"author\"\n\t| \"candidate\"\n\t| \"proctor\"\n\t| \"scorer\"\n\t| \"testConstructor\"\n\t| \"tutor\";\n\nexport interface RubricBlock {\n\tidentifier?: string;\n\t/** QTI spec: space-separated list of roles; stored as an array */\n\tview: RubricBlockView[];\n\tclass?: \"stimulus\" | \"instructions\" | \"rubric\";\n\n\t/**\n\t * Versioned ID reference to the passage (when class=\"stimulus\").\n\t */\n\tpassageVId?: string;\n\n\t/**\n\t * Embedded passage entity (PIE-native approach).\n\t * The passage is rendered using the same ItemPlayer infrastructure as items.\n\t * Contains a PIE config with markup, elements, and models.\n\t */\n\tpassage?: PassageEntity;\n\n\t/**\n\t * Simple HTML content string (for basic use cases).\n\t * Alternative to the passage entity approach.\n\t */\n\tcontent?: string;\n}\n\n/**\n * QTI-aligned assessment item reference (maps to qti-assessment-item-ref).\n * References an item within a section. The item property contains the resolved\n * ItemEntity with its PIE config.\n */\nexport interface AssessmentItemRef extends SearchMetaDataEntity {\n\tid?: string;\n\tidentifier: string;\n\ttitle?: string;\n\trequired?: boolean;\n\n\t/**\n\t * Item virtual ID - stable identifier for the item across versions\n\t */\n\titemVId?: string;\n\n\t/**\n\t * Resolved item entity with PIE config.\n\t * This is populated by the client before passing to the player.\n\t */\n\titem?: ItemEntity;\n\n\t/** Item-level settings for tool requirements and customization */\n\tsettings?: ItemSettings;\n}\n\nexport interface AssessmentSection\n\textends SearchMetaDataEntity,\n\t\tSettingsMetaDataEntity {\n\tid?: string;\n\tidentifier: string;\n\ttitle?: string;\n\tvisible?: boolean;\n\trequired?: boolean;\n\t/**\n\t * QTI 3 pagination hint (`qti-assessment-section@keep-together`).\n\t *\n\t * Indicates that the delivery system SHOULD render this section's items\n\t * together rather than splitting them across pages. This is strictly a\n\t * rendering/layout hint — it does NOT disable item-level navigation,\n\t * current-item tracking, or `item-selected` events in the section player.\n\t * Paginated and keep-together sections both support Next/Back,\n\t * `getCurrentItem()`, and `item-selected` events.\n\t */\n\tkeepTogether?: boolean;\n\n\tsections?: AssessmentSection[];\n\n\t/**\n\t * QTI 3.0: Assessment item references (items in this section).\n\t * Maps to qti-assessment-item-ref in QTI 3.0 XML.\n\t */\n\tassessmentItemRefs?: AssessmentItemRef[];\n\n\t// Shared context (passages/instructions/rubrics) for this section\n\trubricBlocks?: RubricBlock[];\n\n\tsort?: string;\n}\n\nexport interface TestPart {\n\tid?: string;\n\tidentifier: string;\n\tnavigationMode: \"linear\" | \"nonlinear\";\n\tsubmissionMode: \"individual\" | \"simultaneous\";\n\tsections: AssessmentSection[];\n}\n\n// ============================================================================\n// QTI 3.0 Types\n// ============================================================================\n\nexport interface ContextDeclaration {\n\tidentifier: string;\n\tbaseType:\n\t\t| \"boolean\"\n\t\t| \"integer\"\n\t\t| \"float\"\n\t\t| \"string\"\n\t\t| \"identifier\"\n\t\t| \"point\"\n\t\t| \"pair\"\n\t\t| \"directedPair\"\n\t\t| \"duration\"\n\t\t| \"file\"\n\t\t| \"uri\";\n\tcardinality: \"single\" | \"multiple\" | \"ordered\" | \"record\";\n\tdefaultValue?: any;\n}\n\nexport interface CatalogCard {\n\tcatalog: string; // 'spoken', 'sign-language', 'braille', etc.\n\tlanguage?: string;\n\tcontent: string;\n}\n\nexport interface AccessibilityCatalog {\n\tidentifier: string;\n\tcards: CatalogCard[];\n}\n\nexport interface PersonalNeedsProfile {\n\tsupports: string[];\n\tprohibitedSupports?: string[];\n\tactivateAtInit?: string[];\n}\n\n/**\n * QTI 3.0: Reference to a shared stimulus (passage).\n * Maps to qti-assessment-stimulus-ref element.\n *\n * NOTE: Not currently used. We embed PassageEntity directly in RubricBlock instead.\n * Kept for potential future use if we need to support external stimulus references.\n */\n/*\nexport interface StimulusRef {\n\tidentifier: string;\n\thref: string;\n}\n*/\n\n/**\n * Reference to question and sorting info within a section.\n */\nexport interface SectionQuestionRef {\n\tquestionId: string;\n\tsort?: string;\n}\n\n/**\n * Questions can optionally be grouped in sections (legacy).\n */\nexport interface LegacyAssessmentSection\n\textends SearchMetaDataEntity,\n\t\tSettingsMetaDataEntity {\n\tid?: string;\n\ttitle?: string;\n\tsort?: string;\n\tquestions: SectionQuestionRef[];\n}\n\nexport interface AssessmentEntity extends BaseEntity, SearchMetaDataEntity {\n\tname?: string;\n\ttitle?: string;\n\tidentifier?: string;\n\tdescription?: string;\n\n\t/** Enhanced structured settings for assessment configuration */\n\tsettings?: AssessmentSettings;\n\n\t/** QTI version - '3.0' for QTI 3.0 format */\n\tqtiVersion?: \"3.0\";\n\n\t/** QTI 3.0: Context declarations (global shared variables) */\n\tcontextDeclarations?: ContextDeclaration[];\n\n\t/** QTI 3.0: Integrated APIP accessibility catalogs */\n\taccessibilityCatalogs?: AccessibilityCatalog[];\n\n\t/** QTI 3.0: Personal Needs Profile (PNP 3.0) */\n\tpersonalNeedsProfile?: PersonalNeedsProfile;\n\n\t/** Legacy: Flat questions array */\n\tquestions?: QuestionEntity[];\n\n\t/** Legacy: Simple sections */\n\tsections?: LegacyAssessmentSection[];\n\n\t/**\n\t * QTI 3.0: testParts structure (authoritative for QTI format).\n\t */\n\ttestParts?: TestPart[];\n\n\t/** QTI 3.0: Stimulus material references (Phase 3 - placeholder) */\n\tstimulusRefs?: any[];\n}\n\n/**\n * Enhanced settings structure for assessment configuration.\n * Provides structured fields for district policies, test administration,\n * tool configurations, and theme settings while remaining extensible.\n */\nexport interface AssessmentSettings {\n\t/** District/organization policies */\n\tdistrictPolicy?: {\n\t\tblockedTools?: string[]; // PNP support IDs that are blocked\n\t\trequiredTools?: string[]; // PNP support IDs that are required\n\t\tpolicies?: Record<string, any>;\n\t};\n\n\t/** Test administration configuration */\n\ttestAdministration?: {\n\t\tmode?: \"practice\" | \"test\" | \"benchmark\";\n\t\ttoolOverrides?: Record<string, boolean>; // Override specific PNP supports\n\t\tstartDate?: string;\n\t\tendDate?: string;\n\t};\n\n\t/** Tool-specific provider configurations */\n\ttoolConfigs?: {\n\t\t// Calculator-specific options are owned by the calculator tool package.\n\t\tcalculator?: AssessmentCalculatorConfig;\n\t\t/**\n\t\t * Text-to-speech configuration.\n\t\t *\n\t\t * Standard parameters (voice, rate, pitch) are portable across providers\n\t\t * and follow W3C Web Speech API specifications.\n\t\t *\n\t\t * Provider-specific extensions should be placed in providerOptions.\n\t\t *\n\t\t * @see https://w3c.github.io/speech-api/\n\t\t */\n\t\ttextToSpeech?: {\n\t\t\t/**\n\t\t\t * TTS provider\n\t\t\t *\n\t\t\t * @standard \"browser\" uses W3C Web Speech API\n\t\t\t * @extension \"polly\" and \"custom\" are provider-specific\n\t\t\t */\n\t\t\tprovider?: \"browser\" | \"polly\" | \"custom\";\n\n\t\t\t/**\n\t\t\t * Voice identifier (provider-specific names)\n\t\t\t *\n\t\t\t * @standard W3C Web Speech API (concept)\n\t\t\t * @example \"Joanna\" (Polly), \"en-US-Standard-A\" (Google), browser voices\n\t\t\t */\n\t\t\tvoice?: string;\n\n\t\t\t/**\n\t\t\t * Speech rate (speed multiplier)\n\t\t\t *\n\t\t\t * @standard W3C Web Speech API\n\t\t\t * @range 0.25 to 4.0\n\t\t\t * @default 1.0\n\t\t\t */\n\t\t\trate?: number;\n\n\t\t\t/**\n\t\t\t * Pitch adjustment\n\t\t\t *\n\t\t\t * @standard W3C Web Speech API\n\t\t\t * @range 0 to 2 (as multiplier)\n\t\t\t * @default 1.0\n\t\t\t */\n\t\t\tpitch?: number;\n\n\t\t\t/**\n\t\t\t * Provider-specific options (extensions)\n\t\t\t *\n\t\t\t * @extension Not portable across providers\n\t\t\t * @example For AWS Polly: { engine: \"neural\", region: \"us-east-1\" }\n\t\t\t * @example For Google Cloud: { audioEncoding: \"MP3\", effectsProfileId: [\"headphone-class-device\"] }\n\t\t\t */\n\t\t\tproviderOptions?: Record<string, any>;\n\t\t};\n\t\t[toolId: string]: any; // Other tool configs\n\t};\n\n\t/** Theme configuration (not in PNP) */\n\tthemeConfig?: {\n\t\tcolorScheme?: \"default\" | \"high-contrast\" | \"dark\";\n\t\tfontSize?: number;\n\t\tfontFamily?: string;\n\t\tlineHeight?: number;\n\t\treducedMotion?: boolean;\n\t};\n\n\t/** Product-specific extensions */\n\t[key: string]: any;\n}\n\n/**\n * Calculator options exposed through assessment settings.\n * The engine is implicit (Desmos).\n */\nexport interface AssessmentCalculatorConfig {\n\ttype?: \"basic\" | \"scientific\" | \"graphing\";\n\t[key: string]: any;\n}\n\n/**\n * Item-level settings for tool requirements.\n * Used in AssessmentItemRef.settings to specify item-specific tool needs.\n */\nexport interface ItemSettings {\n\trequiredTools?: string[]; // PNP support IDs required for this item\n\trestrictedTools?: string[]; // PNP support IDs blocked for this item\n\ttoolParameters?: Record<string, any>; // Tool-specific config per item\n\n\t[key: string]: any; // Product extensions\n}\n\nexport interface SanctionedVersionEntity extends BaseEntity {\n\torganization?: string | OrganizationEntity; // if set, this is an organization specific matcher, otherwise, it's global\n\tmatch: string; // semver match expression, e.g. '1.*'\n\tpie: string; // e.g. @pie-element/calculator\n\tversion: string; // e.g. 2.14.24\n}\n\nexport enum SanctionedVersionChangeStatus {\n\tPENDING = \"pending\",\n\tIN_PROGRESS = \"in_progress\",\n\tCOMPLETED = \"completed\",\n\tFAILED = \"failed\",\n}\n\nexport interface SanctionedVersionChangeRequest {\n\tpie: string;\n\tmatch: string;\n\tversion: string;\n}\n\nexport interface SanctionedVersionChangeEntity extends BaseEntity {\n\torganization?: string | OrganizationEntity;\n\tcreatedBy: string | UserEntity;\n\tstatus: SanctionedVersionChangeStatus;\n\trequestedChanges: SanctionedVersionChangeRequest[];\n\tbeforeState: SanctionedVersionEntity[];\n\tsummary?: string;\n\tjobId: string;\n}\n\nexport type PlayerMode = \"gather\" | \"view\" | \"evaluate\" | \"browse\" | \"author\";\n\nexport type PlayerRole = \"student\" | \"instructor\";\n\nexport interface Env {\n\tmode: PlayerMode;\n\trole: PlayerRole;\n\tpartialScoring?: boolean;\n}\n\nexport interface OutcomeResponse {\n\tid: string;\n\telement: string;\n\tscore?: number;\n\tempty?: boolean;\n\tcompleted?: boolean;\n\n\t[key: string]: any;\n}\n\nexport interface PieController {\n\tmodel(model: PieModel, sessionData: any[], env?: any): Promise<PieModel>;\n\n\toutcome(\n\t\tmodelOrSessionData: PieModel | any[],\n\t\tsessionOrEnv?: any,\n\t\tenv?: any,\n\t): Promise<OutcomeResponse>;\n\n\tscore: (config: object, session: object, env: object) => Promise<object>;\n\tcreateCorrectResponseSession: (\n\t\tconfig: object,\n\t\tenv: object,\n\t) => Promise<object>;\n\tvalidate: (model: object, config: object) => any;\n}\n\nexport interface PieItemElement {\n\t[elementName: string]: string;\n}\n\nexport type BundleInfo = {\n\turl: string;\n\thash: string;\n};\n\ninterface PieDefaultModel {\n\t// supports 'excess' properties as may be defined in pie models\n\t// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#strict-object-literal-assignment-checking\n\t[x: string]: any;\n}\n\ninterface PieContent {\n\tid: string;\n\t/**\n\t * Set of elements to include in the pie, provided in the format `{'element-name': 'mpm-package-name'}`\n\t */\n\telements: PieItemElement;\n\n\t/** Models for each PIE included in the item */\n\tmodels: PieModel[];\n\n\tmarkup: string;\n\n\tbundle?: BundleInfo;\n\n\tdefaultExtraModels?: {\n\t\t[key: string]: PieDefaultModel;\n\t};\n}\n\ninterface AdvancedItemConfig {\n\tid: string;\n\tpie: PieContent;\n\tpassage?: PieContent;\n\tinstructorResources?: [PieContent];\n\tdefaultExtraModels?: {\n\t\t[key: string]: PieDefaultModel;\n\t};\n}\n\nexport type ItemConfig = PieContent | AdvancedItemConfig;\n\n/**\n * During the loading of elements from PIE bundles, we do a trick where we make\n * editor components available as web components by appending this to the element name.\n */\nexport const editorPostFix = \"-pie-editor--\";\n\nexport type ModelUpdatedDetail = {\n\tupdate: any;\n\treset: boolean;\n};\n\nexport class ModelUpdatedEvent extends CustomEvent<ModelUpdatedDetail> {\n\tstatic TYPE = \"model.updated\";\n\n\tconstructor(\n\t\treadonly update: any,\n\t\treadonly reset: boolean = false,\n\t) {\n\t\tsuper(ModelUpdatedEvent.TYPE, { bubbles: true, detail: { update, reset } });\n\t}\n}\n\nexport type DeleteDone = (e?: Error) => void;\n\nexport type DeleteImageDetail = {\n\tsrc: string;\n\tdone: DeleteDone;\n};\n\nexport class DeleteImageEvent extends CustomEvent<DeleteImageDetail> {\n\tstatic TYPE = \"delete.image\";\n\n\tconstructor(\n\t\treadonly src: string,\n\t\treadonly done: DeleteDone,\n\t) {\n\t\tsuper(DeleteImageEvent.TYPE, { bubbles: true, detail: { src, done } });\n\t}\n}\n\nexport interface ImageHandler {\n\tisPasted?: boolean;\n\tcancel: () => void;\n\tdone: (err?: Error, src?: string) => void;\n\tfileChosen: (file: File) => void;\n\tprogress: (percent: number, bytes: number, total: number) => void;\n}\n\nexport class InsertImageEvent extends CustomEvent<ImageHandler> {\n\tstatic TYPE = \"insert.image\";\n\n\tconstructor(readonly handler: ImageHandler) {\n\t\tsuper(InsertImageEvent.TYPE, { bubbles: true, detail: handler });\n\t}\n}\n\nexport type DeleteSoundDetail = {\n\tsrc: string;\n\tdone: DeleteDone;\n};\n\nexport class DeleteSoundEvent extends CustomEvent<DeleteSoundDetail> {\n\tstatic TYPE = \"delete.sound\";\n\n\tconstructor(\n\t\treadonly src: string,\n\t\treadonly done: DeleteDone,\n\t) {\n\t\tsuper(DeleteSoundEvent.TYPE, { bubbles: true, detail: { src, done } });\n\t}\n}\n\nexport interface SoundHandler {\n\tcancel: () => void;\n\tdone: (err?: Error, src?: string) => void;\n\tfileChosen: File;\n\tprogress: (percent: number, bytes: number, total: number) => void;\n}\n\nexport class InsertSoundEvent extends CustomEvent<SoundHandler> {\n\tstatic TYPE = \"insert.sound\";\n\n\tconstructor(readonly handler: SoundHandler) {\n\t\tsuper(InsertSoundEvent.TYPE, { bubbles: true, detail: handler });\n\t}\n}\n\nexport const isPassageEntity = (\n\tpassage: string | PassageEntity | undefined,\n): passage is PassageEntity => typeof passage === \"object\" && passage !== null;\n\nexport function isPrerelease(version: any): version is SemVer {\n\treturn (\n\t\ttypeof version === \"object\" &&\n\t\tversion !== null &&\n\t\ttypeof version.major === \"number\" &&\n\t\ttypeof version.minor === \"number\" &&\n\t\ttypeof version.patch === \"number\" &&\n\t\t!!version.prerelease && // Check if prerelease exists\n\t\ttypeof version.prerelease.tag === \"string\" &&\n\t\ttypeof version.prerelease.version === \"number\"\n\t);\n}\n\nexport function formatVersion(semVer: SemVer): string {\n\tif (!semVer) return \"\";\n\tconst base = [semVer.major, semVer.minor, semVer.patch].join(\".\");\n\tif (isPrerelease(semVer) && semVer.prerelease) {\n\t\tconst prerelease = [semVer.prerelease.tag, semVer.prerelease.version].join(\n\t\t\t\".\",\n\t\t);\n\t\treturn `${base}-${prerelease}`;\n\t}\n\treturn base;\n}\n\nexport interface PieElement extends HTMLElement {\n\tmodel: PieModel;\n\tconfiguration: any;\n\tsession: any[];\n}\n\nexport type SessionChangedDetail = {\n\tcomplete: boolean;\n\tcomponent: any;\n};\n\nexport class SessionChangedEvent extends CustomEvent<SessionChangedDetail> {\n\tstatic TYPE = \"session-changed\";\n\n\tconstructor(\n\t\treadonly component: string,\n\t\treadonly complete: boolean,\n\t) {\n\t\tsuper(SessionChangedEvent.TYPE, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t\tdetail: { complete, component },\n\t\t} as any);\n\t}\n}\n\ninterface ItemCfg extends ConfigEntity {}\n\ninterface ItemWPassageCfg {\n\tpie: ItemCfg;\n\tpassage: ConfigEntity;\n}\n\nexport interface LoadResponse {\n\tjs: {\n\t\tview: string[];\n\t};\n\titem: ItemCfg | ItemWPassageCfg;\n\tsession: {\n\t\tid: string;\n\t\tdata: any[];\n\t};\n}\n\nexport interface Tracker {\n\ttrack(message: string, ...args: any[]): void;\n\n\tstart(label: string): void;\n\n\tend(label: string, metadata?: { [key: string]: any }): void;\n}\n\n/**\n * Interface for storing tracker messages with timestamps\n */\n/**\n * Interface for storing tracker messages with timestamps\n */\nexport interface TrackerMessage {\n\ttimestamp: Date;\n\tmessage: string;\n\targs: any[];\n\tformattedMessage: string; // Added formatted message with interpolated args\n}\n\n/**\n * Enhanced tracker that stores messages with timestamps\n */\nexport interface EnhancedTracker extends Tracker {\n\t/**\n\t * Get all raw tracker messages ordered by timestamp (ascending)\n\t */\n\tgetMessages(): TrackerMessage[];\n\n\t/**\n\t * Get a formatted multi-line representation of all tracker messages\n\t */\n\tgetFormattedMessages(): string;\n}\n\nexport interface ScoreResponse {\n\tsession: FlatSession;\n\tscore: SessionScore;\n\tempty?: boolean;\n\n\t[key: string]: any;\n}\n\nexport interface VersionDiff {\n\tversion: SemVer;\n\tpreviousVersion: SemVer | null;\n\tcreatedAt: Date;\n\tchanges: {\n\t\tadded: Record<string, any>;\n\t\tremoved: Record<string, any>;\n\t\tmodified: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tprevious: any;\n\t\t\t\tcurrent: any;\n\t\t\t}\n\t\t>;\n\t};\n\tchangeCount: number;\n}\n\nexport interface RoleToOrganizationsMapping {\n\tid?: string;\n\trole: string;\n\torganizations: OrganizationEntity[] | string[];\n\tcreatedAt?: Date;\n\tupdatedAt?: Date;\n}\n\n// CMS Types (copied from @pie-api-aws/datastore to avoid importing server-only package)\nexport enum StandardType {\n\tROOT = 0,\n\tSUBJECT = 1,\n\tLEVEL = 2,\n\tSTANDARD = 3,\n}\n\nexport interface HierarchyInfo {\n\troot?: {\n\t\tid: string;\n\t\tguid: string;\n\t\ttitle: string;\n\t};\n\tsubject?: {\n\t\tid: string;\n\t\tguid: string;\n\t\ttitle: string;\n\t};\n\tlevel?: {\n\t\tid: string;\n\t\tguid: string;\n\t\ttitle: string;\n\t\tgrades: number[];\n\t};\n}\n\nexport interface CmsLearningStandardEntity extends BaseEntity {\n\tguid: string;\n\tabbr?: string;\n\ttype: StandardType;\n\tparentId?: string;\n\tparentGuid?: string;\n\tpath?: string;\n\tdepth: number;\n\tancestors: string[];\n\thierarchy?: HierarchyInfo;\n\ttitle?: string;\n\tdescription?: string;\n\tsequence?: string;\n\torderIndex?: number;\n\tsubjectArea?: string;\n\tsubjectName?: string;\n\tcategory?: string;\n\tabType?: string;\n\tabLabel?: string;\n\tsetName?: string;\n\tpublication?: string;\n\tadopted?: string;\n\tgrades: number[];\n\tgradeNames?: string[];\n\tproperties: Record<string, string>;\n\tstatus?: \"active\" | \"retired\" | \"deprecated\";\n\tlastModifiedAt?: Date;\n\treplacesGuid?: string;\n\treplacedByGuid?: string;\n\tdescriptionHtml?: string;\n\tlastSyncedAt?: Date;\n}\n\nexport interface ItemBankConfig {\n\tcollectionId: string;\n\tsubject?: string;\n\tgradeLevels?: number[];\n\torderIndex: number;\n}\n\nexport interface DOKDistribution {\n\tdok1?: number;\n\tdok2?: number;\n\tdok3?: number;\n\tdok4?: number;\n}\n\nexport interface AssessmentGoal {\n\tdokDistribution?: DOKDistribution;\n\tconstructedResponseCount?: number;\n\tpassageGoals?: string;\n\ttotalItemCount?: {\n\t\ttarget?: number;\n\t\tmin?: number;\n\t\tmax?: number;\n\t};\n}\n\nexport interface StudioImportMetadata {\n\tstudioAssessmentProgramId?: string;\n\tstudioPublicId?: string;\n\timportedAt?: Date;\n}\n\nexport interface CmsBlueprintEntity extends BaseEntity {\n\tname: string;\n\tdescription?: string;\n\tsubject?: string;\n\tstandardSet?: string;\n\tgradeLevels: number[];\n\tstates?: string[];\n\titemBankConfigs: ItemBankConfig[];\n\tassessmentGoal?: AssessmentGoal;\n\tclaimFramework?: \"SBAC\" | \"PARCC\" | \"STATE\" | \"CUSTOM\";\n\tclaimTargets?: string[];\n\tuseSBACClusterTarget?: boolean;\n\tclusters?: string[];\n\tstudioImportMetadata?: StudioImportMetadata;\n\toriginalPrompt?: string;\n}\n\nexport interface CmsBlueprintItemEntity extends BaseEntity {\n\tblueprintId: string;\n\tstandardGuid: string;\n\tcount: number;\n\tdetails?: string;\n\tassessmentId?: string;\n}\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-panel-persistence.js","sourceRoot":"","sources":["../../src/ui/debug-panel-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,MAAM,0BAA0B,GAAG,qBAAqB,CAAC;AAQzD,MAAM,UAAU,0BAA0B,CACzC,IAA8B;IAE9B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;IAClE,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,OAAO,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,OAAO,CAAC;IAChE,OAAO,GAAG,0BAA0B,IAAI,KAAK,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAI,GAAW;IACjD,MAAM,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,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M,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAI,GAAW,EAAE,KAAQ;IAC5D,IAAI,CAAC;QACJ,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACR,wCAAwC;IACzC,CAAC;AACF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC/C,IAAI,CAAC;QACJ,IAAI,OAAO,YAAY,KAAK,WAAW;YAAE,OAAO;QAChD,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACR,SAAS;IACV,CAAC;AACF,CAAC","sourcesContent":["import { safeLocalStorageGet, safeLocalStorageSet } from \"./safe-storage.js\";\n\nconst DEBUG_PANEL_STORAGE_PREFIX = \"pie:debug-panels:v1\";\n\ntype DebugPanelStorageKeyArgs = {\n\tscope: string;\n\tpanelId: string;\n\taspect?: string;\n};\n\nexport function createDebugPanelStorageKey(\n\targs: DebugPanelStorageKeyArgs,\n): string {\n\tconst scope = String(args.scope || \"default\").trim() || \"default\";\n\tconst panelId = String(args.panelId || \"panel\").trim() || \"panel\";\n\tconst aspect = String(args.aspect || \"state\").trim() || \"state\";\n\treturn `${DEBUG_PANEL_STORAGE_PREFIX}:${scope}:${panelId}:${aspect}`;\n}\n\nexport function readDebugPanelState<T>(key: string): T | null {\n\tconst raw = safeLocalStorageGet(key);\n\tif (!raw) return null;\n\ttry {\n\t\treturn JSON.parse(raw) as T;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function writeDebugPanelState<T>(key: string, value: T): void {\n\ttry {\n\t\tsafeLocalStorageSet(key, JSON.stringify(value));\n\t} catch {\n\t\t// ignore serialization/storage failures\n\t}\n}\n\nexport function clearDebugPanelState(key: string): void {\n\ttry {\n\t\tif (typeof localStorage === \"undefined\") return;\n\t\tlocalStorage.removeItem(key);\n\t} catch {\n\t\t// ignore\n\t}\n}\n\nexport type DebugPanelLayoutStateV1 = {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n\tminimized: boolean;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-focusable.js","sourceRoot":"","sources":["../../src/ui/first-focusable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,SAAS;IACT,wBAAwB;IACxB,4CAA4C;IAC5C,wBAAwB;IACxB,0BAA0B;IAC1B,kDAAkD;IAClD,iCAAiC;CACjC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,EAAe;IACxD,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC;QAAE,OAAO,KAAK,CAAC;IAClD,IAAI,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,EAAE,CAAC,YAAY,KAAK,IAAI,IAAI,EAAE,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACnE,CAAC"}
|
|
1
|
+
{"version":3,"file":"first-focusable.js","sourceRoot":"","sources":["../../src/ui/first-focusable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,SAAS;IACT,wBAAwB;IACxB,4CAA4C;IAC5C,wBAAwB;IACxB,0BAA0B;IAC1B,kDAAkD;IAClD,iCAAiC;CACjC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,EAAe;IACxD,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC;QAAE,OAAO,KAAK,CAAC;IAClD,IAAI,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,EAAE,CAAC,YAAY,KAAK,IAAI,IAAI,EAAE,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACnE,CAAC","sourcesContent":["/**\n * Selector for elements that are commonly keyboard-focusable in assessment UI.\n * Kept in sync with `focus-trap.ts` for consistent tab-order surfaces.\n */\nexport const FOCUSABLE_SELECTOR = [\n\t\"a[href]\",\n\t\"button:not([disabled])\",\n\t\"input:not([disabled]):not([type='hidden'])\",\n\t\"select:not([disabled])\",\n\t\"textarea:not([disabled])\",\n\t\"[contenteditable]:not([contenteditable='false'])\",\n\t\"[tabindex]:not([tabindex='-1'])\",\n].join(\",\");\n\n/**\n * Whether `el` is a reasonable programmatic focus target (matches selector,\n * not disabled, not inside `inert`, and has a layout box).\n */\nexport function isProgrammaticFocusTarget(el: HTMLElement): boolean {\n\tif (!el.matches(FOCUSABLE_SELECTOR)) return false;\n\tif (el.hasAttribute(\"disabled\")) return false;\n\tif (el.closest(\"[inert]\")) return false;\n\treturn el.offsetParent !== null || el.getClientRects().length > 0;\n}\n"]}
|
package/dist/ui/focus-trap.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-trap.js","sourceRoot":"","sources":["../../src/ui/focus-trap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAOrF,SAAS,o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AC,KAAK,EAAE,EAAE,CAAC;YACpB,OAAO;QACR,CAAC;QAED,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAmC,CAAC;QAC7D,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;gBACvB,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YACzC,CAAC;YACD,OAAO;QACR,CAAC;QACD,IAAI,YAAY,KAAK,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;IACF,CAAC,CAAC;IAEF,cAAc,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;IAC1E,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAEjD,OAAO,GAAG,EAAE;QACX,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACpD,IAAI,CAAC;YACJ,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACjB,CAAC;QAAC,MAAM,CAAC;YACR,SAAS;QACV,CAAC;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { FOCUSABLE_SELECTOR, isProgrammaticFocusTarget } from \"./first-focusable.js\";\n\ntype FocusTrapOptions = {\n\tinitialFocus?: HTMLElement | null;\n\tonEscape?: () => void;\n};\n\nfunction getFocusableElements(container: HTMLElement): HTMLElement[] {\n\treturn Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter((el) =>\n\t\tisProgrammaticFocusTarget(el),\n\t);\n}\n\nfunction focusInitialTarget(container: HTMLElement, initialFocus?: HTMLElement | null): void {\n\ttry {\n\t\tif (initialFocus && container.contains(initialFocus)) {\n\t\t\tinitialFocus.focus();\n\t\t\treturn;\n\t\t}\n\t\tconst focusable = getFocusableElements(container);\n\t\tif (focusable.length > 0) {\n\t\t\tfocusable[0].focus();\n\t\t\treturn;\n\t\t}\n\t\tcontainer.focus?.();\n\t} catch {\n\t\t// ignore\n\t}\n}\n\n/**\n * Focus trap helper for floating dialogs/panels.\n *\n * Keeps tab navigation contained, supports Escape callback,\n * and restores prior focus when the trap is removed.\n */\nexport function createFocusTrap(container: HTMLElement, options: FocusTrapOptions = {}): () => void {\n\tconst prev =\n\t\ttypeof document !== \"undefined\" ? (document.activeElement as HTMLElement | null) : null;\n\tconst onKeydown = (event: KeyboardEvent) => {\n\t\tif (event.key === \"Escape\") {\n\t\t\toptions.onEscape?.();\n\t\t\treturn;\n\t\t}\n\t\tif (event.key !== \"Tab\") return;\n\n\t\tconst focusable = getFocusableElements(container);\n\t\tif (!focusable.length) {\n\t\t\tevent.preventDefault();\n\t\t\tcontainer.focus?.();\n\t\t\treturn;\n\t\t}\n\n\t\tconst current = document.activeElement as HTMLElement | null;\n\t\tconst currentIndex = focusable.indexOf(current || focusable[0]);\n\t\tif (event.shiftKey) {\n\t\t\tif (currentIndex <= 0) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tfocusable[focusable.length - 1].focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (currentIndex === focusable.length - 1) {\n\t\t\tevent.preventDefault();\n\t\t\tfocusable[0].focus();\n\t\t}\n\t};\n\n\tqueueMicrotask(() => focusInitialTarget(container, options.initialFocus));\n\tcontainer.addEventListener(\"keydown\", onKeydown);\n\n\treturn () => {\n\t\tcontainer.removeEventListener(\"keydown\", onKeydown);\n\t\ttry {\n\t\t\tprev?.focus?.();\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-storage.js","sourceRoot":"","sources":["../../src/ui/safe-storage.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC9C,IAAI,CAAC;QACJ,IAAI,OAAO,YAAY,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QACrD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,KAAa;IAC7D,IAAI,CAAC;QACJ,IAAI,OAAO,YAAY,KAAK,WAAW;YAAE,OAAO;QAChD,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,SAAS;IACV,CAAC;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"safe-storage.js","sourceRoot":"","sources":["../../src/ui/safe-storage.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC9C,IAAI,CAAC;QACJ,IAAI,OAAO,YAAY,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QACrD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,KAAa;IAC7D,IAAI,CAAC;QACJ,IAAI,OAAO,YAAY,KAAK,WAAW;YAAE,OAAO;QAChD,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,SAAS;IACV,CAAC;AACF,CAAC","sourcesContent":["export function safeLocalStorageGet(key: string): string | null {\n\ttry {\n\t\tif (typeof localStorage === \"undefined\") return null;\n\t\treturn localStorage.getItem(key);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function safeLocalStorageSet(key: string, value: string): void {\n\ttry {\n\t\tif (typeof localStorage === \"undefined\") return;\n\t\tlocalStorage.setItem(key, value);\n\t} catch {\n\t\t// ignore\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-players-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.44",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared runtime + UI utilities for PIE players",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"types": "./dist/pie/index.d.ts",
|
|
42
42
|
"import": "./dist/pie/index.js"
|
|
43
43
|
},
|
|
44
|
-
"./pie
|
|
45
|
-
"types": "./dist/pie
|
|
46
|
-
"import": "./dist/pie
|
|
44
|
+
"./pie/tag-names": {
|
|
45
|
+
"types": "./dist/pie/tag-names.d.ts",
|
|
46
|
+
"import": "./dist/pie/tag-names.js"
|
|
47
47
|
},
|
|
48
48
|
"./loaders": {
|
|
49
49
|
"types": "./dist/loaders/index.d.ts",
|
|
@@ -53,59 +53,9 @@
|
|
|
53
53
|
"types": "./dist/server/npm-registry.d.ts",
|
|
54
54
|
"import": "./dist/server/npm-registry.js"
|
|
55
55
|
},
|
|
56
|
-
"./components": {
|
|
57
|
-
"types": "./dist/components/index.ts",
|
|
58
|
-
"import": "./dist/components/index.ts",
|
|
59
|
-
"svelte": "./dist/components/index.ts"
|
|
60
|
-
},
|
|
61
|
-
"./components/PieItemPlayer.svelte": {
|
|
62
|
-
"types": "./dist/components/PieItemPlayer.svelte",
|
|
63
|
-
"import": "./dist/components/PieItemPlayer.svelte",
|
|
64
|
-
"svelte": "./dist/components/PieItemPlayer.svelte"
|
|
65
|
-
},
|
|
66
|
-
"./components/PieSpinner.svelte": {
|
|
67
|
-
"types": "./dist/components/PieSpinner.svelte",
|
|
68
|
-
"import": "./dist/components/PieSpinner.svelte",
|
|
69
|
-
"svelte": "./dist/components/PieSpinner.svelte"
|
|
70
|
-
},
|
|
71
|
-
"./components/ToolSettingsButton.svelte": {
|
|
72
|
-
"types": "./dist/components/ToolSettingsButton.svelte",
|
|
73
|
-
"import": "./dist/components/ToolSettingsButton.svelte",
|
|
74
|
-
"svelte": "./dist/components/ToolSettingsButton.svelte"
|
|
75
|
-
},
|
|
76
|
-
"./components/ToolSettingsPanel.svelte": {
|
|
77
|
-
"types": "./dist/components/ToolSettingsPanel.svelte",
|
|
78
|
-
"import": "./dist/components/ToolSettingsPanel.svelte",
|
|
79
|
-
"svelte": "./dist/components/ToolSettingsPanel.svelte"
|
|
80
|
-
},
|
|
81
|
-
"./components/PiePreviewToggle.svelte": {
|
|
82
|
-
"types": "./dist/components/PiePreviewToggle.svelte",
|
|
83
|
-
"import": "./dist/components/PiePreviewToggle.svelte",
|
|
84
|
-
"svelte": "./dist/components/PiePreviewToggle.svelte"
|
|
85
|
-
},
|
|
86
|
-
"./components/PiePreviewLayout.svelte": {
|
|
87
|
-
"types": "./dist/components/PiePreviewLayout.svelte",
|
|
88
|
-
"import": "./dist/components/PiePreviewLayout.svelte",
|
|
89
|
-
"svelte": "./dist/components/PiePreviewLayout.svelte"
|
|
90
|
-
},
|
|
91
56
|
"./i18n": {
|
|
92
57
|
"types": "./dist/i18n/index.d.ts",
|
|
93
58
|
"import": "./dist/i18n/index.js"
|
|
94
|
-
},
|
|
95
|
-
"./i18n/use-i18n": {
|
|
96
|
-
"types": "./dist/i18n/use-i18n.svelte.ts",
|
|
97
|
-
"import": "./dist/i18n/use-i18n.svelte.ts",
|
|
98
|
-
"svelte": "./dist/i18n/use-i18n.svelte.ts"
|
|
99
|
-
},
|
|
100
|
-
"./i18n/use-i18n-standalone": {
|
|
101
|
-
"types": "./dist/i18n/use-i18n-standalone.svelte.ts",
|
|
102
|
-
"import": "./dist/i18n/use-i18n-standalone.svelte.ts",
|
|
103
|
-
"svelte": "./dist/i18n/use-i18n-standalone.svelte.ts"
|
|
104
|
-
},
|
|
105
|
-
"./ui/use-promise": {
|
|
106
|
-
"types": "./dist/ui/use-promise.svelte.ts",
|
|
107
|
-
"import": "./dist/ui/use-promise.svelte.ts",
|
|
108
|
-
"svelte": "./dist/ui/use-promise.svelte.ts"
|
|
109
59
|
}
|
|
110
60
|
},
|
|
111
61
|
"files": [
|
|
@@ -116,16 +66,8 @@
|
|
|
116
66
|
"dompurify": "^3.4.0",
|
|
117
67
|
"semver": "^7.7.4"
|
|
118
68
|
},
|
|
119
|
-
"peerDependencies": {
|
|
120
|
-
"svelte": "^5.54.0"
|
|
121
|
-
},
|
|
122
|
-
"peerDependenciesMeta": {
|
|
123
|
-
"svelte": {
|
|
124
|
-
"optional": true
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
69
|
"scripts": {
|
|
128
|
-
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json
|
|
70
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json",
|
|
129
71
|
"dev": "tsc -p tsconfig.json --watch",
|
|
130
72
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
131
73
|
"lint": "biome check .",
|
|
@@ -139,7 +81,7 @@
|
|
|
139
81
|
"@happy-dom/global-registrator": "^20.9.0",
|
|
140
82
|
"@types/semver": "^7.7.1",
|
|
141
83
|
"glob": "^13.0.0",
|
|
142
|
-
"svelte": "^5.
|
|
84
|
+
"svelte": "^5.55.4",
|
|
143
85
|
"typescript": "^5.9.3"
|
|
144
86
|
},
|
|
145
87
|
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/players-shared#readme",
|