@hyperframes/core 0.8.184 → 0.8.186

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.
@@ -16,10 +16,10 @@
16
16
  * fills the rest from the effect's own defaults. That keeps each entry readable
17
17
  * as an intent rather than a dump of every knob.
18
18
  *
19
- * Node ORDER is load-bearing — the chain is serial, so a limiter first and a
19
+ * Node ORDER matters — the chain is serial, so a limiter first and a
20
20
  * limiter last are different sounds. Every preset below runs
21
- * subtractive filtering → dynamics → tone → character → limiter, the order
22
- * `skills/hyperframes-audio` already teaches.
21
+ * subtractive filtering → dynamics → tone → character → limiter, as
22
+ * `skills/media-use/references/mixing.md` teaches.
23
23
  */
24
24
  import { type HfAudioFxChain, type HfAudioFxNode, type HfAudioFxParamValues } from "./audioFx.js";
25
25
  /**
@@ -16,10 +16,10 @@
16
16
  * fills the rest from the effect's own defaults. That keeps each entry readable
17
17
  * as an intent rather than a dump of every knob.
18
18
  *
19
- * Node ORDER is load-bearing — the chain is serial, so a limiter first and a
19
+ * Node ORDER matters — the chain is serial, so a limiter first and a
20
20
  * limiter last are different sounds. Every preset below runs
21
- * subtractive filtering → dynamics → tone → character → limiter, the order
22
- * `skills/hyperframes-audio` already teaches.
21
+ * subtractive filtering → dynamics → tone → character → limiter, as
22
+ * `skills/media-use/references/mixing.md` teaches.
23
23
  */
24
24
  import { HF_AUDIO_FX_CHAIN_VERSION, mintAudioFxNodeId, normalizeAudioFxParams, } from "./audioFx.js";
25
25
  const preset = (id, family, label, description, nodes) => ({ id, label, family, description, nodes });
@@ -1,3 +1,4 @@
1
+ import { acceleratedCanvasTrackerSource } from "../pageMotionBlur.js";
1
2
  import { parseHTML } from "linkedom";
2
3
  export const RUNTIME_BOOTSTRAP_ATTR = "data-hyperframes-preview-runtime";
3
4
  const RUNTIME_FILES = [
@@ -302,7 +303,7 @@ function insertBeforeDocumentTag(html, tag, markup) {
302
303
  export function insertBeforeCloseTag(html, name, markup) {
303
304
  return insertBeforeDocumentTag(html, `</${name}`, markup);
304
305
  }
305
- export function insertRuntimeTag(html, tag) {
306
+ function insertTagInHead(html, tag) {
306
307
  const withHead = insertBeforeCloseTag(html, "head", `${tag}\n`);
307
308
  if (withHead !== null)
308
309
  return withHead;
@@ -318,6 +319,15 @@ export function insertRuntimeTag(html, tag) {
318
319
  }
319
320
  return tag + html;
320
321
  }
322
+ const ACCEL_TRACKER_ATTR = "data-hf-accel-tracker";
323
+ const OPTS_INTO_MOTION_BLUR = /\sdata-motion-blur\s*=\s*["']?on[\s"'>]/i;
324
+ export function insertRuntimeTag(html, tag) {
325
+ const withRuntime = insertTagInHead(html, tag);
326
+ if (!OPTS_INTO_MOTION_BLUR.test(html) || html.includes(ACCEL_TRACKER_ATTR))
327
+ return withRuntime;
328
+ const tracker = `<script ${ACCEL_TRACKER_ATTR}>${acceleratedCanvasTrackerSource()}</script>`;
329
+ return injectTagsAtHeadStart(withRuntime, tracker);
330
+ }
321
331
  /**
322
332
  * Insert raw tag markup at the very start of `<head>`, ahead of every author
323
333
  * script (inline or external). Falls back to just before `<body>`, then to the