@schalkneethling/css-media-pseudo-polyfill 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,6 +25,28 @@ The polyfill runs in four stages:
25
25
 
26
26
  The `"./fn"` entry point is useful when you need to run the polyfill earlier (e.g., from a synchronous `<script>` in `<head>`) to minimize the flash of unstyled content (FOUC).
27
27
 
28
+ **Default entry point** — auto-applies on `DOMContentLoaded`:
29
+
30
+ ```js
31
+ import "@schalkneethling/css-media-pseudo-polyfill";
32
+ ```
33
+
34
+ **`"./fn"` entry point** — call `polyfill()` manually, e.g. from a synchronous `<script>` in `<head>` to minimize FOUC:
35
+
36
+ ```html
37
+ <script type="module">
38
+ import { polyfill } from "@schalkneethling/css-media-pseudo-polyfill/fn";
39
+ polyfill();
40
+ </script>
41
+ ```
42
+
43
+ Or from a module bundler:
44
+
45
+ ```js
46
+ import { polyfill } from "@schalkneethling/css-media-pseudo-polyfill/fn";
47
+ polyfill();
48
+ ```
49
+
28
50
  ## Spec references
29
51
 
30
52
  The pseudo-class definitions and their DOM conditions come from the [WHATWG HTML spec](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-muted):
package/dist/fn.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as polyfill } from "./polyfill-CiJgx85h.mjs";
1
+ import { t as polyfill } from "./polyfill-D0PMITQS.mjs";
2
2
  export { polyfill };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as polyfill } from "./polyfill-CiJgx85h.mjs";
1
+ import { t as polyfill } from "./polyfill-D0PMITQS.mjs";
2
2
  //#region src/index.ts
3
3
  if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", () => polyfill());
4
4
  else polyfill();
@@ -295,13 +295,9 @@ function rewriteLinkStylesheets(unsupported) {
295
295
  function computeStates(element, isStalledFlag) {
296
296
  const states = /* @__PURE__ */ new Set();
297
297
  if (element.paused) states.add("paused");
298
- else {
299
- states.add("playing");
300
- if (element.networkState === element.NETWORK_LOADING && element.readyState <= element.HAVE_CURRENT_DATA) {
301
- states.add("buffering");
302
- if (isStalledFlag) states.add("stalled");
303
- }
304
- }
298
+ else if (element.readyState < element.HAVE_FUTURE_DATA) if (isStalledFlag) states.add("stalled");
299
+ else states.add("buffering");
300
+ else states.add("playing");
305
301
  if (element.seeking) states.add("seeking");
306
302
  if (element.muted) states.add("muted");
307
303
  return states;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schalkneethling/css-media-pseudo-polyfill",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "A CSS polyfill for media pseudo-classes (:playing, :paused, :seeking, :buffering, :stalled, :muted)",
5
5
  "keywords": [
6
6
  "audio",