@pie-players/pie-players-shared 0.3.75 → 1.0.0-beta.1

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.
Files changed (63) hide show
  1. package/README.md +88 -77
  2. package/dist/components/vendor/nds/README.md +4 -5
  3. package/dist/config/profile.d.ts +1 -1
  4. package/dist/config/profile.js +1 -1
  5. package/dist/i18n/index.d.ts +1 -1
  6. package/dist/i18n/index.js +1 -1
  7. package/dist/i18n/language-tags.d.ts +9 -1
  8. package/dist/i18n/language-tags.js +11 -1
  9. package/dist/i18n/messages/en-US.d.ts +33 -5
  10. package/dist/i18n/messages/en-US.js +33 -5
  11. package/dist/i18n/messages/nl-NL.d.ts +33 -5
  12. package/dist/i18n/messages/nl-NL.js +33 -5
  13. package/dist/i18n/provider.d.ts +14 -7
  14. package/dist/i18n/provider.js +26 -29
  15. package/dist/index.js +0 -1
  16. package/dist/instrumentation/providers/BaseInstrumentationProvider.js +0 -14
  17. package/dist/loader-config.d.ts +0 -2
  18. package/dist/loader-config.js +0 -2
  19. package/dist/loaders/element-loader.js +13 -6
  20. package/dist/loaders/esm-adapter.js +48 -37
  21. package/dist/loaders/iife-adapter.d.ts +3 -3
  22. package/dist/loaders/iife-adapter.js +36 -35
  23. package/dist/media/index.d.ts +4 -6
  24. package/dist/media/index.js +6 -8
  25. package/dist/object/index.d.ts +8 -3
  26. package/dist/object/index.js +8 -6
  27. package/dist/pie/asset-handler.d.ts +0 -17
  28. package/dist/pie/asset-handler.js +1 -1
  29. package/dist/pie/authoring.js +5 -7
  30. package/dist/pie/elements-rendered.d.ts +0 -2
  31. package/dist/pie/elements-rendered.js +1 -1
  32. package/dist/pie/index.d.ts +1 -0
  33. package/dist/pie/index.js +1 -0
  34. package/dist/pie/initialization.d.ts +13 -14
  35. package/dist/pie/initialization.js +61 -75
  36. package/dist/pie/item-session-contract.js +7 -9
  37. package/dist/pie/resource-monitor.d.ts +34 -32
  38. package/dist/pie/resource-monitor.js +152 -231
  39. package/dist/pie/stages.d.ts +4 -3
  40. package/dist/pie/stages.js +4 -3
  41. package/dist/pie/updates.js +5 -4
  42. package/dist/pie/utils.d.ts +0 -2
  43. package/dist/pie/utils.js +0 -2
  44. package/dist/pie/versioned-tag.d.ts +10 -0
  45. package/dist/pie/versioned-tag.js +27 -0
  46. package/dist/security/sanitize-item-markup.d.ts +4 -4
  47. package/dist/security/sanitize-item-markup.js +4 -4
  48. package/dist/security/sanitize-svg-icon.js +2 -2
  49. package/dist/security/wrap-overwide-images.d.ts +1 -1
  50. package/dist/security/wrap-overwide-images.js +1 -1
  51. package/dist/timed-media/media-element-source.js +1 -2
  52. package/dist/types/index.d.ts +88 -52
  53. package/dist/types/index.js +2 -2
  54. package/dist/ui/attribute-coercion.d.ts +5 -0
  55. package/dist/ui/attribute-coercion.js +6 -4
  56. package/dist/ui/content-styles.d.ts +6 -10
  57. package/dist/ui/content-styles.js +8 -13
  58. package/dist/ui/first-focusable.d.ts +0 -1
  59. package/dist/ui/first-focusable.js +0 -1
  60. package/dist/ui/focus-trap.js +2 -3
  61. package/dist/ui/scope-css.d.ts +23 -26
  62. package/dist/ui/scope-css.js +23 -26
  63. package/package.json +3 -2
@@ -4,37 +4,34 @@
4
4
  * external-style-urls="...">` or `itemConfig.resources.stylesheets[*].url`
5
5
  * styles that player's subtree instead of the whole host document.
6
6
  *
7
- * This replaces a single-regex implementation that prefixed every
8
- * selector-like fragment. That is correct for flat selector rules and wrong for
9
- * everything else: `@media screen { ... }` became
10
- * `.scope @media screen { ... }`, an invalid selector, so the browser dropped
11
- * the whole block and every rule inside it; `@font-face` and `@keyframes` were
12
- * corrupted the same way; and `:root` became `.scope :root`, which can never
13
- * match, because `:root` is `<html>` and is not a descendant of the player.
14
- * At-rules and `:root` custom properties therefore never applied at all.
7
+ * Walks the stylesheet brace-by-brace. Block at-rules that hold rules
8
+ * (`@media`, `@supports`, `@container`, `@layer`, `@scope`) keep their prelude
9
+ * and have their inner rules scoped, every other at-rule passes through, and a
10
+ * leading `:root`, `html` or `body` is replaced by the scope, since
11
+ * `.scope :root` can never match: `:root` is `<html>`, which is no descendant
12
+ * of the player. A regex prefixer fails on exactly these cases: it turned
13
+ * `@media screen { … }` into the invalid `.scope @media screen { … }`, which the
14
+ * browser drops with every rule inside, and corrupted `@font-face`,
15
+ * `@keyframes` and `:root` the same way.
15
16
  *
16
- * The QTI player's `scopeCssRules` (`pie-qti` -
17
- * `packages/item-player/src/components/utils/stylesheetRender.ts`) is not a
18
- * drop-in either. Its `:root` handling is the behaviour we want and is adopted
19
- * here, but it excludes `@` from its selector pattern rather than understanding
20
- * at-rules, so `@media` and `@supports` lose their condition and their inner
21
- * rules are hoisted and applied unconditionally — a mobile-only rule then
22
- * applies at every viewport width, which is a subtler failure than dropping it.
17
+ * The `:root` handling follows the QTI player's `scopeCssRules` (`pie-qti` -
18
+ * `packages/item-player/src/components/utils/stylesheetRender.ts`), which is no
19
+ * drop-in: it excludes `@` from its selector pattern without understanding
20
+ * at-rules, so `@media` and `@supports` lose their condition and their rules
21
+ * apply at every viewport width.
23
22
  *
24
- * So this walks the stylesheet brace-by-brace instead of pattern-matching it.
25
- * A real CSS parser would be the textbook answer and is deliberately not used:
26
- * `@pie-players/pie-item-player` ships with two workspace dependencies, this
27
- * runs in the delivery path, and scoping needs to know about rule boundaries
28
- * only — not about property grammar.
23
+ * No CSS parser: `@pie-players/pie-item-player` ships with two workspace
24
+ * dependencies, this runs in the delivery path, and scoping needs rule
25
+ * boundaries only.
29
26
  *
30
- * Known limits, all preserving existing behaviour rather than adding policy:
27
+ * Known limits:
31
28
  *
32
- * - `@import` is passed through untouched, exactly as the old regex left it. It
33
- * pulls in an unscoped stylesheet, so it defeats scoping, but blocking it is
34
- * a security policy decision and not this function's job. Callers gate
35
- * stylesheet URLs with `validateExternalStyleUrl` before fetching.
29
+ * - `@import` is passed through untouched. It pulls in an unscoped stylesheet,
30
+ * so it defeats scoping, but blocking it is a security policy decision and
31
+ * not this function's job. Callers gate stylesheet URLs with
32
+ * `validateExternalStyleUrl` before fetching.
36
33
  * - Declaration blocks are emitted verbatim, so `url(...)` references are left
37
- * as authored and resolve against the stylesheet's own URL as before.
34
+ * as authored and resolve against the stylesheet's own URL.
38
35
  * - A style rule's block is never rewritten, which is also what native CSS
39
36
  * nesting needs: nested selectors are relative to a parent that has already
40
37
  * been scoped.
@@ -4,37 +4,34 @@
4
4
  * external-style-urls="...">` or `itemConfig.resources.stylesheets[*].url`
5
5
  * styles that player's subtree instead of the whole host document.
6
6
  *
7
- * This replaces a single-regex implementation that prefixed every
8
- * selector-like fragment. That is correct for flat selector rules and wrong for
9
- * everything else: `@media screen { ... }` became
10
- * `.scope @media screen { ... }`, an invalid selector, so the browser dropped
11
- * the whole block and every rule inside it; `@font-face` and `@keyframes` were
12
- * corrupted the same way; and `:root` became `.scope :root`, which can never
13
- * match, because `:root` is `<html>` and is not a descendant of the player.
14
- * At-rules and `:root` custom properties therefore never applied at all.
7
+ * Walks the stylesheet brace-by-brace. Block at-rules that hold rules
8
+ * (`@media`, `@supports`, `@container`, `@layer`, `@scope`) keep their prelude
9
+ * and have their inner rules scoped, every other at-rule passes through, and a
10
+ * leading `:root`, `html` or `body` is replaced by the scope, since
11
+ * `.scope :root` can never match: `:root` is `<html>`, which is no descendant
12
+ * of the player. A regex prefixer fails on exactly these cases: it turned
13
+ * `@media screen { … }` into the invalid `.scope @media screen { … }`, which the
14
+ * browser drops with every rule inside, and corrupted `@font-face`,
15
+ * `@keyframes` and `:root` the same way.
15
16
  *
16
- * The QTI player's `scopeCssRules` (`pie-qti` -
17
- * `packages/item-player/src/components/utils/stylesheetRender.ts`) is not a
18
- * drop-in either. Its `:root` handling is the behaviour we want and is adopted
19
- * here, but it excludes `@` from its selector pattern rather than understanding
20
- * at-rules, so `@media` and `@supports` lose their condition and their inner
21
- * rules are hoisted and applied unconditionally — a mobile-only rule then
22
- * applies at every viewport width, which is a subtler failure than dropping it.
17
+ * The `:root` handling follows the QTI player's `scopeCssRules` (`pie-qti` -
18
+ * `packages/item-player/src/components/utils/stylesheetRender.ts`), which is no
19
+ * drop-in: it excludes `@` from its selector pattern without understanding
20
+ * at-rules, so `@media` and `@supports` lose their condition and their rules
21
+ * apply at every viewport width.
23
22
  *
24
- * So this walks the stylesheet brace-by-brace instead of pattern-matching it.
25
- * A real CSS parser would be the textbook answer and is deliberately not used:
26
- * `@pie-players/pie-item-player` ships with two workspace dependencies, this
27
- * runs in the delivery path, and scoping needs to know about rule boundaries
28
- * only — not about property grammar.
23
+ * No CSS parser: `@pie-players/pie-item-player` ships with two workspace
24
+ * dependencies, this runs in the delivery path, and scoping needs rule
25
+ * boundaries only.
29
26
  *
30
- * Known limits, all preserving existing behaviour rather than adding policy:
27
+ * Known limits:
31
28
  *
32
- * - `@import` is passed through untouched, exactly as the old regex left it. It
33
- * pulls in an unscoped stylesheet, so it defeats scoping, but blocking it is
34
- * a security policy decision and not this function's job. Callers gate
35
- * stylesheet URLs with `validateExternalStyleUrl` before fetching.
29
+ * - `@import` is passed through untouched. It pulls in an unscoped stylesheet,
30
+ * so it defeats scoping, but blocking it is a security policy decision and
31
+ * not this function's job. Callers gate stylesheet URLs with
32
+ * `validateExternalStyleUrl` before fetching.
36
33
  * - Declaration blocks are emitted verbatim, so `url(...)` references are left
37
- * as authored and resolve against the stylesheet's own URL as before.
34
+ * as authored and resolve against the stylesheet's own URL.
38
35
  * - A style rule's block is never rewritten, which is also what native CSS
39
36
  * nesting needs: nested selectors are relative to a parent that has already
40
37
  * been scoped.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-players/pie-players-shared",
3
- "version": "0.3.75",
3
+ "version": "1.0.0-beta.1",
4
4
  "type": "module",
5
5
  "description": "Shared runtime + UI utilities for PIE players",
6
6
  "license": "MIT",
@@ -112,7 +112,7 @@
112
112
  "dev": "tsc -p tsconfig.json --watch",
113
113
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.tests.json",
114
114
  "lint": "biome lint .",
115
- "check": "tsc -p tsconfig.json --noEmit",
115
+ "check": "svelte-check --tsconfig ./tsconfig.svelte-check.json",
116
116
  "test": "bun test",
117
117
  "check-i18n": "bun run src/i18n/scripts/check-coverage.ts",
118
118
  "scan-hardcoded": "bun run src/i18n/scripts/scan-hardcoded.ts"
@@ -127,6 +127,7 @@
127
127
  "esbuild": "^0.28.2",
128
128
  "glob": "^13.0.0",
129
129
  "svelte": "^5.57.1",
130
+ "svelte-check": "^4.7.6",
130
131
  "typescript": "^5.9.3"
131
132
  },
132
133
  "homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/players-shared#readme",