@hyperframes/core 0.8.30 → 0.8.32

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.
@@ -1,5 +1,7 @@
1
1
  export declare const MEDIA_VISUAL_STYLE_PROPERTIES: readonly ["width", "height", "top", "left", "right", "bottom", "inset", "object-fit", "object-position", "z-index", "opacity", "visibility", "filter", "mix-blend-mode", "backdrop-filter", "border-radius", "overflow", "clip-path", "mask", "mask-image", "mask-size", "mask-position", "mask-repeat", "transform", "transform-origin", "translate", "rotate", "scale", "box-sizing"];
2
2
  export type MediaVisualStyleProperty = (typeof MEDIA_VISUAL_STYLE_PROPERTIES)[number];
3
3
  export declare function quantizeTimeToFrame(timeSeconds: number, fps: number): number;
4
+ /** Snap decimal noise near a frame boundary without moving genuinely fractional timing. */
5
+ export declare function snapTimeToFrameBoundary(timeSeconds: number, fps: number): number;
4
6
  export declare function copyMediaVisualStyles(targetStyle: CSSStyleDeclaration, sourceStyle: CSSStyleDeclaration, properties?: readonly string[]): void;
5
7
  //# sourceMappingURL=parityContract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parityContract.d.ts","sourceRoot":"","sources":["../../src/inline-scripts/parityContract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,yXA8BhC,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtF,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAK5E;AAED,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,mBAAmB,EAChC,WAAW,EAAE,mBAAmB,EAChC,UAAU,GAAE,SAAS,MAAM,EAAkC,GAC5D,IAAI,CAON"}
1
+ {"version":3,"file":"parityContract.d.ts","sourceRoot":"","sources":["../../src/inline-scripts/parityContract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,yXA8BhC,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAItF,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAK5E;AAED,2FAA2F;AAC3F,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQhF;AAED,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,mBAAmB,EAChC,WAAW,EAAE,mBAAmB,EAChC,UAAU,GAAE,SAAS,MAAM,EAAkC,GAC5D,IAAI,CAON"}
@@ -29,12 +29,23 @@ export const MEDIA_VISUAL_STYLE_PROPERTIES = [
29
29
  "scale",
30
30
  "box-sizing",
31
31
  ];
32
+ const FRAME_BOUNDARY_EPSILON = 1e-3;
32
33
  export function quantizeTimeToFrame(timeSeconds, fps) {
33
34
  const safeFps = Number.isFinite(fps) && fps > 0 ? fps : 30;
34
35
  const safeTime = Number.isFinite(timeSeconds) && timeSeconds > 0 ? timeSeconds : 0;
35
36
  const frameIndex = Math.floor(safeTime * safeFps + 1e-9);
36
37
  return frameIndex / safeFps;
37
38
  }
39
+ /** Snap decimal noise near a frame boundary without moving genuinely fractional timing. */
40
+ export function snapTimeToFrameBoundary(timeSeconds, fps) {
41
+ const safeFps = Number.isFinite(fps) && fps > 0 ? fps : 30;
42
+ const safeTime = Number.isFinite(timeSeconds) && timeSeconds > 0 ? timeSeconds : 0;
43
+ const framePosition = safeTime * safeFps;
44
+ const nearestFrame = Math.round(framePosition);
45
+ return Math.abs(framePosition - nearestFrame) <= FRAME_BOUNDARY_EPSILON
46
+ ? nearestFrame / safeFps
47
+ : safeTime;
48
+ }
38
49
  export function copyMediaVisualStyles(targetStyle, sourceStyle, properties = MEDIA_VISUAL_STYLE_PROPERTIES) {
39
50
  for (const property of properties) {
40
51
  const value = sourceStyle.getPropertyValue(property);
@@ -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D,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;IACzC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,YAAY,CAAC,IAAI,sBAAsB;QACrE,CAAC,CAAC,YAAY,GAAG,OAAO;QACxB,CAAC,CAAC,QAAQ,CAAC;AACf,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,WAAgC,EAChC,WAAgC,EAChC,aAAgC,6BAA6B;IAE7D,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACrD,IAAI,KAAK,EAAE,CAAC;YACV,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const MEDIA_START_BASIS_ATTR = "data-hf-media-start-basis";
2
+ export type MediaStartBasis = "local" | "global";
3
+ export declare function readMediaStartBasis(value: string | null | undefined): MediaStartBasis;
4
+ /** Resolve authored media time onto the root timeline. Nested media is local
5
+ * by default; only an explicit compatibility marker preserves a legacy
6
+ * root-global value. */
7
+ export declare function resolveAbsoluteMediaStartSeconds(input: {
8
+ authoredStart: number;
9
+ hostStart: number;
10
+ basis?: string | null;
11
+ }): number;
12
+ //# sourceMappingURL=mediaTiming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaTiming.d.ts","sourceRoot":"","sources":["../src/mediaTiming.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEjD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,eAAe,CAErF;AAED;;wBAEwB;AACxB,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,GAAG,MAAM,CAIT"}
@@ -0,0 +1,13 @@
1
+ export const MEDIA_START_BASIS_ATTR = "data-hf-media-start-basis";
2
+ export function readMediaStartBasis(value) {
3
+ return value?.trim().toLowerCase() === "global" ? "global" : "local";
4
+ }
5
+ /** Resolve authored media time onto the root timeline. Nested media is local
6
+ * by default; only an explicit compatibility marker preserves a legacy
7
+ * root-global value. */
8
+ export function resolveAbsoluteMediaStartSeconds(input) {
9
+ return readMediaStartBasis(input.basis) === "global"
10
+ ? input.authoredStart
11
+ : input.hostStart + input.authoredStart;
12
+ }
13
+ //# sourceMappingURL=mediaTiming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaTiming.js","sourceRoot":"","sources":["../src/mediaTiming.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAIlE,MAAM,UAAU,mBAAmB,CAAC,KAAgC;IAClE,OAAO,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED;;wBAEwB;AACxB,MAAM,UAAU,gCAAgC,CAAC,KAIhD;IACC,OAAO,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ;QAClD,CAAC,CAAC,KAAK,CAAC,aAAa;QACrB,CAAC,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC;AAC5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.30",
3
+ "version": "0.8.32",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,6 +50,10 @@
50
50
  "import": "./dist/compositionContract.js",
51
51
  "types": "./dist/compositionContract.d.ts"
52
52
  },
53
+ "./media-timing": {
54
+ "import": "./dist/mediaTiming.js",
55
+ "types": "./dist/mediaTiming.d.ts"
56
+ },
53
57
  "./editing": {
54
58
  "import": "./dist/editing/affordances.js",
55
59
  "types": "./dist/editing/affordances.d.ts"
@@ -278,9 +282,9 @@
278
282
  "bpm-detective": "^2.0.5",
279
283
  "linkedom": "^0.18.12",
280
284
  "postcss": "^8.5.8",
281
- "@hyperframes/lint": "0.8.30",
282
- "@hyperframes/studio-server": "0.8.30",
283
- "@hyperframes/parsers": "0.8.30"
285
+ "@hyperframes/studio-server": "0.8.32",
286
+ "@hyperframes/lint": "0.8.32",
287
+ "@hyperframes/parsers": "0.8.32"
284
288
  },
285
289
  "devDependencies": {
286
290
  "@types/jsdom": "^28.0.0",