@blitzreels/contracts 0.2.2 → 0.2.3

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 (37) hide show
  1. package/dist/editor-command-contract.d.ts +340 -0
  2. package/dist/editor-command-contract.d.ts.map +1 -0
  3. package/dist/editor-command-contract.js +117 -0
  4. package/dist/editor-command-contract.js.map +1 -0
  5. package/dist/editor-document-contract.d.ts +188 -0
  6. package/dist/editor-document-contract.d.ts.map +1 -0
  7. package/dist/editor-document-contract.js +92 -0
  8. package/dist/editor-document-contract.js.map +1 -0
  9. package/dist/editor-keyframe-contract.d.ts +111 -0
  10. package/dist/editor-keyframe-contract.d.ts.map +1 -0
  11. package/dist/editor-keyframe-contract.js +74 -0
  12. package/dist/editor-keyframe-contract.js.map +1 -0
  13. package/dist/generation-catalog-contract.d.ts +24 -0
  14. package/dist/generation-catalog-contract.d.ts.map +1 -0
  15. package/dist/generation-catalog-contract.js +24 -0
  16. package/dist/generation-catalog-contract.js.map +1 -0
  17. package/dist/generation-resolution.d.ts +24 -0
  18. package/dist/generation-resolution.d.ts.map +1 -0
  19. package/dist/generation-resolution.js +67 -0
  20. package/dist/generation-resolution.js.map +1 -0
  21. package/dist/index.d.ts +10 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +8 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/media-size.d.ts +17 -0
  26. package/dist/media-size.d.ts.map +1 -0
  27. package/dist/media-size.js +45 -0
  28. package/dist/media-size.js.map +1 -0
  29. package/dist/reframe-options.d.ts +5 -0
  30. package/dist/reframe-options.d.ts.map +1 -0
  31. package/dist/reframe-options.js +19 -0
  32. package/dist/reframe-options.js.map +1 -0
  33. package/dist/source-view-layout.d.ts +32 -0
  34. package/dist/source-view-layout.d.ts.map +1 -0
  35. package/dist/source-view-layout.js +57 -0
  36. package/dist/source-view-layout.js.map +1 -0
  37. package/package.json +4 -1
@@ -0,0 +1,32 @@
1
+ type TimelineMediaViewFitMode = "contain" | "cover" | "stretch";
2
+ type TimelineMediaViewMaskShape = "none" | "rounded" | "circle";
3
+ type NormalizedRect = {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ };
9
+ type SourceViewLayout = {
10
+ mediaWidth: number;
11
+ mediaHeight: number;
12
+ mediaLeft: number;
13
+ mediaTop: number;
14
+ visibleWidth: number;
15
+ visibleHeight: number;
16
+ visibleLeft: number;
17
+ visibleTop: number;
18
+ clipPath: string | null;
19
+ borderRadius: string | null;
20
+ };
21
+ export declare function computeSourceViewLayout({ wrapperWidth, wrapperHeight, sourceWidth, sourceHeight, sourceCrop, fitMode, maskShape, maskRadius, }: {
22
+ wrapperWidth: number;
23
+ wrapperHeight: number;
24
+ sourceWidth: number;
25
+ sourceHeight: number;
26
+ sourceCrop: NormalizedRect;
27
+ fitMode: TimelineMediaViewFitMode;
28
+ maskShape: TimelineMediaViewMaskShape;
29
+ maskRadius: number;
30
+ }): SourceViewLayout;
31
+ export {};
32
+ //# sourceMappingURL=source-view-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-view-layout.d.ts","sourceRoot":"","sources":["../src/source-view-layout.ts"],"names":[],"mappings":"AAAA,KAAK,wBAAwB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAChE,KAAK,0BAA0B,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhE,KAAK,cAAc,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAeF,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,UAAU,EACV,OAAO,EACP,SAAS,EACT,UAAU,GACX,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,wBAAwB,CAAC;IAClC,SAAS,EAAE,0BAA0B,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,gBAAgB,CAyEnB"}
@@ -0,0 +1,57 @@
1
+ function clamp({ value, min, max, }) {
2
+ "worklet";
3
+ return Math.min(Math.max(value, min), max);
4
+ }
5
+ export function computeSourceViewLayout({ wrapperWidth, wrapperHeight, sourceWidth, sourceHeight, sourceCrop, fitMode, maskShape, maskRadius, }) {
6
+ "worklet";
7
+ const safeWrapperWidth = Math.max(1, wrapperWidth);
8
+ const safeWrapperHeight = Math.max(1, wrapperHeight);
9
+ const safeSourceWidth = Math.max(1, sourceWidth);
10
+ const safeSourceHeight = Math.max(1, sourceHeight);
11
+ const cropX = clamp({ value: sourceCrop.x, min: 0, max: 1 });
12
+ const cropY = clamp({ value: sourceCrop.y, min: 0, max: 1 });
13
+ const cropWidth = clamp({
14
+ value: sourceCrop.width,
15
+ min: 0.0001,
16
+ max: 1,
17
+ });
18
+ const cropHeight = clamp({
19
+ value: sourceCrop.height,
20
+ min: 0.0001,
21
+ max: 1,
22
+ });
23
+ const croppedSourceWidth = safeSourceWidth * cropWidth;
24
+ const croppedSourceHeight = safeSourceHeight * cropHeight;
25
+ const scale = fitMode === "stretch"
26
+ ? 1
27
+ : fitMode === "cover"
28
+ ? Math.max(safeWrapperWidth / croppedSourceWidth, safeWrapperHeight / croppedSourceHeight)
29
+ : Math.min(safeWrapperWidth / croppedSourceWidth, safeWrapperHeight / croppedSourceHeight);
30
+ const mediaWidth = fitMode === "stretch"
31
+ ? safeWrapperWidth / cropWidth
32
+ : safeSourceWidth * scale;
33
+ const mediaHeight = fitMode === "stretch"
34
+ ? safeWrapperHeight / cropHeight
35
+ : safeSourceHeight * scale;
36
+ const visibleCropWidth = fitMode === "stretch" ? safeWrapperWidth : croppedSourceWidth * scale;
37
+ const visibleCropHeight = fitMode === "stretch" ? safeWrapperHeight : croppedSourceHeight * scale;
38
+ const mediaLeft = (safeWrapperWidth - visibleCropWidth) / 2 - cropX * mediaWidth;
39
+ const mediaTop = (safeWrapperHeight - visibleCropHeight) / 2 - cropY * mediaHeight;
40
+ const visibleWidth = fitMode === "contain" ? visibleCropWidth : safeWrapperWidth;
41
+ const visibleHeight = fitMode === "contain" ? visibleCropHeight : safeWrapperHeight;
42
+ const visibleLeft = fitMode === "contain" ? (safeWrapperWidth - visibleCropWidth) / 2 : 0;
43
+ const visibleTop = fitMode === "contain" ? (safeWrapperHeight - visibleCropHeight) / 2 : 0;
44
+ return {
45
+ mediaWidth,
46
+ mediaHeight,
47
+ mediaLeft,
48
+ mediaTop,
49
+ visibleWidth,
50
+ visibleHeight,
51
+ visibleLeft,
52
+ visibleTop,
53
+ clipPath: maskShape === "circle" ? "circle(50% at 50% 50%)" : null,
54
+ borderRadius: maskShape === "rounded" ? `${Math.max(0, maskRadius)}px` : null,
55
+ };
56
+ }
57
+ //# sourceMappingURL=source-view-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-view-layout.js","sourceRoot":"","sources":["../src/source-view-layout.ts"],"names":[],"mappings":"AAuBA,SAAS,KAAK,CAAC,EACb,KAAK,EACL,GAAG,EACH,GAAG,GAKJ;IACC,SAAS,CAAC;IACV,OAA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,CAAC,CAAC,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,UAAU,GACd,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1E,OAAO;QACL,UAAU;QACV,WAAW;QACX,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,aAAa;QACb,WAAW;QACX,UAAU;QACV,QAAQ,EAAE,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI;QAClE,YAAY,EACV,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;KAClE,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blitzreels/contracts",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Transport-independent factual contracts for BlitzReels editing operations.",
5
5
  "homepage": "https://blitzreels.com/",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,6 +29,9 @@
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
+ "dependencies": {
33
+ "zod": "4.4.3"
34
+ },
32
35
  "engines": {
33
36
  "node": ">=20"
34
37
  },