@hyperframes/core 0.9.81 → 0.9.83

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 (38) hide show
  1. package/dist/audibleVideo.d.ts +9 -0
  2. package/dist/audibleVideo.js +31 -0
  3. package/dist/compiler/index.d.ts +1 -1
  4. package/dist/compiler/index.js +1 -1
  5. package/dist/compiler/inlineSubCompositions.js +3 -2
  6. package/dist/compiler/timingCompiler.js +39 -35
  7. package/dist/compositionSource.d.ts +2 -0
  8. package/dist/compositionSource.js +2 -0
  9. package/dist/generated/runtime-inline.js +1 -1
  10. package/dist/gsapCdn.d.ts +11 -1
  11. package/dist/gsapCdn.js +24 -1
  12. package/dist/hyperframe.runtime.iife.js +69 -69
  13. package/dist/runtime/bridge.d.ts +1 -0
  14. package/dist/runtime/bridge.js +4 -1
  15. package/dist/runtime/editing/patchTween.d.ts +1 -1
  16. package/dist/runtime/editing/patchTween.js +34 -12
  17. package/dist/runtime/editing/softReload.d.ts +0 -1
  18. package/dist/runtime/editing/softReload.js +28 -5
  19. package/dist/runtime/editing/watchGeometry.js +5 -2
  20. package/dist/runtime/editingElement.d.ts +1 -0
  21. package/dist/runtime/editingElement.js +1 -0
  22. package/dist/runtime/editingGeometry.d.ts +4 -0
  23. package/dist/runtime/editingGeometry.js +10 -9
  24. package/dist/runtime/editingGestureStart.d.ts +0 -5
  25. package/dist/runtime/editingGestureStart.js +1 -4
  26. package/dist/runtime/editingPort.d.ts +2 -3
  27. package/dist/runtime/editingPort.js +2 -3
  28. package/dist/runtime/elementTransform.d.ts +12 -55
  29. package/dist/runtime/elementTransform.js +50 -75
  30. package/dist/runtime/protocol.d.ts +1 -1
  31. package/dist/runtime/protocol.js +1 -0
  32. package/dist/runtime/sceneRest.d.ts +4 -0
  33. package/dist/runtime/sceneRest.js +15 -0
  34. package/dist/runtime/state.d.ts +1 -5
  35. package/dist/runtime/transitionLabels.js +9 -2
  36. package/dist/runtime/types.d.ts +2 -0
  37. package/dist/utils/htmlAttrSafety.js +3 -0
  38. package/package.json +4 -4
package/dist/gsapCdn.d.ts CHANGED
@@ -3,10 +3,20 @@ export declare const GSAP_BASE_URL_META = "hyperframes-gsap-base-url";
3
3
  export declare const GSAP_PLUGIN_LOAD_ATTR = "data-hf-gsap-plugin";
4
4
  export declare const NO_PATH_TWEEN_META = "hf-no-path-tween";
5
5
  export declare const namesMotionPath: (script: string) => boolean;
6
+ export declare function isGsapCoreUrl(src: string): boolean;
7
+ export declare function motionPathBesideGsap(gsapFile: string): string;
6
8
  /** An npm-style mirror root; callers choose configuration without coupling this helper to a host. */
7
9
  export declare function normalizeGsapBaseUrl(baseUrl?: string): string;
8
10
  /** A same-origin path to the host's bundled GSAP, which holds only GSAP_CDN_VERSION. */
9
11
  export declare function normalizeGsapLocalRoot(root: string): string;
10
12
  export declare function gsapCdnDist(gsapVersion?: string, baseUrl?: string): string;
11
- /** MotionPathPlugin at the composition's own gsap version; a skew registers with a GSAP warning. */
12
13
  export declare function motionPathPluginUrl(gsapVersion?: string, baseUrl?: string): string;
14
+ /** The plugin a preview may load: an absolute mirror, the document's own origin, or (`pageOwned`) the page's GSAP. */
15
+ export declare function previewMotionPathSrc(page: {
16
+ gsapFile: string | null;
17
+ mirror?: string | null;
18
+ version?: string;
19
+ documentUrl: string;
20
+ baseUrl: string;
21
+ pageOwned: boolean;
22
+ }): string | null;
package/dist/gsapCdn.js CHANGED
@@ -4,6 +4,14 @@ export const GSAP_BASE_URL_META = "hyperframes-gsap-base-url";
4
4
  export const GSAP_PLUGIN_LOAD_ATTR = "data-hf-gsap-plugin";
5
5
  export const NO_PATH_TWEEN_META = "hf-no-path-tween";
6
6
  export const namesMotionPath = (script) => /motionPath["']?\s*[:{]/.test(script);
7
+ const pathOf = (src) => URL.canParse(src, "http://localhost/") ? new URL(src, "http://localhost/").pathname : null;
8
+ export function isGsapCoreUrl(src) {
9
+ return /\/gsap(-\d+(\.\d+)*)?(\.min)?\.js$/i.test(pathOf(src) ?? "");
10
+ }
11
+ export function motionPathBesideGsap(gsapFile) {
12
+ const path = gsapFile.split(/[?#]/, 1)[0];
13
+ return `${path.slice(0, path.lastIndexOf("/") + 1)}MotionPathPlugin.min.js`;
14
+ }
7
15
  function isLoopbackHost(hostname) {
8
16
  return hostname === "localhost" || hostname === "[::1]" || /^127\.\d+\.\d+\.\d+$/.test(hostname);
9
17
  }
@@ -46,7 +54,22 @@ export function gsapCdnDist(gsapVersion, baseUrl) {
46
54
  }
47
55
  return `${normalizeGsapBaseUrl(baseUrl)}/gsap@${version}/dist/`;
48
56
  }
49
- /** MotionPathPlugin at the composition's own gsap version; a skew registers with a GSAP warning. */
50
57
  export function motionPathPluginUrl(gsapVersion, baseUrl) {
51
58
  return `${gsapCdnDist(gsapVersion, baseUrl)}MotionPathPlugin.min.js`;
52
59
  }
60
+ const originOf = (url) => (URL.canParse(url) ? new URL(url).origin : "null");
61
+ /** The plugin a preview may load: an absolute mirror, the document's own origin, or (`pageOwned`) the page's GSAP. */
62
+ export function previewMotionPathSrc(page) {
63
+ const own = originOf(page.documentUrl);
64
+ const mirror = page.mirror?.trim();
65
+ if (mirror?.startsWith("/")) {
66
+ return own === "null" ? null : new URL(motionPathPluginUrl(GSAP_CDN_VERSION, mirror), own).href;
67
+ }
68
+ const version = page.version ?? page.gsapFile?.match(/gsap@([\d.]+)/)?.[1];
69
+ if (mirror)
70
+ return motionPathPluginUrl(version, mirror);
71
+ if (!page.gsapFile || !URL.canParse(page.gsapFile, page.baseUrl))
72
+ return null;
73
+ const href = new URL(motionPathBesideGsap(page.gsapFile), page.baseUrl).href;
74
+ return page.pageOwned || (own !== "null" && originOf(href) === own) ? href : null;
75
+ }