@ume-group/contracts 0.2.1

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 (57) hide show
  1. package/README.md +37 -0
  2. package/dist/adserving.d.ts +150 -0
  3. package/dist/adserving.d.ts.map +1 -0
  4. package/dist/adserving.js +8 -0
  5. package/dist/campaigns.d.ts +37 -0
  6. package/dist/campaigns.d.ts.map +1 -0
  7. package/dist/campaigns.js +8 -0
  8. package/dist/gausst.d.ts +236 -0
  9. package/dist/gausst.d.ts.map +1 -0
  10. package/dist/gausst.js +307 -0
  11. package/dist/gausst.test.d.ts +2 -0
  12. package/dist/gausst.test.d.ts.map +1 -0
  13. package/dist/gausst.test.js +71 -0
  14. package/dist/index.d.ts +1531 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +1112 -0
  17. package/dist/layer2/index.d.ts +9 -0
  18. package/dist/layer2/index.d.ts.map +1 -0
  19. package/dist/layer2/index.js +10 -0
  20. package/dist/layer2/shaders.d.ts +185 -0
  21. package/dist/layer2/shaders.d.ts.map +1 -0
  22. package/dist/layer2/shaders.js +604 -0
  23. package/dist/layer2/webcam-utils.d.ts +113 -0
  24. package/dist/layer2/webcam-utils.d.ts.map +1 -0
  25. package/dist/layer2/webcam-utils.js +147 -0
  26. package/dist/layer2/webcam-utils.test.d.ts +2 -0
  27. package/dist/layer2/webcam-utils.test.d.ts.map +1 -0
  28. package/dist/layer2/webcam-utils.test.js +18 -0
  29. package/dist/layer2.d.ts +558 -0
  30. package/dist/layer2.d.ts.map +1 -0
  31. package/dist/layer2.js +376 -0
  32. package/dist/layer2.test.d.ts +2 -0
  33. package/dist/layer2.test.d.ts.map +1 -0
  34. package/dist/layer2.test.js +65 -0
  35. package/dist/perspective.d.ts +28 -0
  36. package/dist/perspective.d.ts.map +1 -0
  37. package/dist/perspective.js +157 -0
  38. package/dist/segmentation/MediaPipeSegmenter.d.ts +201 -0
  39. package/dist/segmentation/MediaPipeSegmenter.d.ts.map +1 -0
  40. package/dist/segmentation/MediaPipeSegmenter.js +434 -0
  41. package/dist/segmentation/index.d.ts +5 -0
  42. package/dist/segmentation/index.d.ts.map +1 -0
  43. package/dist/segmentation/index.js +4 -0
  44. package/dist/webcam/GarbageMatteDragManager.d.ts +63 -0
  45. package/dist/webcam/GarbageMatteDragManager.d.ts.map +1 -0
  46. package/dist/webcam/GarbageMatteDragManager.js +183 -0
  47. package/dist/webcam/WebcamStreamManager.d.ts +103 -0
  48. package/dist/webcam/WebcamStreamManager.d.ts.map +1 -0
  49. package/dist/webcam/WebcamStreamManager.js +356 -0
  50. package/dist/webcam/index.d.ts +5 -0
  51. package/dist/webcam/index.d.ts.map +1 -0
  52. package/dist/webcam/index.js +2 -0
  53. package/openapi/admetise.yaml +632 -0
  54. package/openapi/includu.yaml +621 -0
  55. package/openapi/integration.yaml +372 -0
  56. package/openapi/shared/schemas.yaml +227 -0
  57. package/package.json +53 -0
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Shared webcam utility functions for Layer 2 rendering
3
+ *
4
+ * These utilities are used by both editor and player for consistent
5
+ * webcam plane positioning and geometry calculations.
6
+ *
7
+ * ArchiMate: Application Component (Shared Webcam Utilities)
8
+ */
9
+ /**
10
+ * Base height for webcam plane in meters
11
+ * At scale 1.0, the plane is 1 meter tall
12
+ */
13
+ export declare const WEBCAM_BASE_HEIGHT_METERS = 1;
14
+ /**
15
+ * Silhouette occupies 85% of plane height
16
+ * This leaves margin at top and bottom for natural framing
17
+ */
18
+ export declare const SILHOUETTE_HEIGHT_RATIO = 0.85;
19
+ /**
20
+ * Calculate webcam plane base dimensions in meters
21
+ *
22
+ * @param aspectRatio - Webcam aspect ratio (width/height)
23
+ * @returns Object with width and height in meters
24
+ */
25
+ export declare function getWebcamBaseDimensions(aspectRatio: number): {
26
+ width: number;
27
+ height: number;
28
+ };
29
+ /**
30
+ * Calculate Y offset for webcam mesh positioning
31
+ * This ensures the webcam plane's bottom aligns with the Y position
32
+ *
33
+ * @param baseDimensionsHeight - Base height in meters (usually 1.0)
34
+ * @param scale - Scale factor from participation template
35
+ * @returns Y offset in meters
36
+ */
37
+ export declare function getWebcamMeshYOffset(baseDimensionsHeight: number, scale: number): number;
38
+ /**
39
+ * Convert rotation from degrees to radians for Three.js Euler
40
+ *
41
+ * @param rotation - Rotation in degrees [x, y, z]
42
+ * @returns Object with x, y, z in radians
43
+ */
44
+ export declare function getObjectEuler(rotation: [number, number, number]): {
45
+ x: number;
46
+ y: number;
47
+ z: number;
48
+ };
49
+ /**
50
+ * Convert Gausst camera rotation to Three.js Euler angles
51
+ * Uses YXZ rotation order for proper camera orientation
52
+ *
53
+ * @param rotation - Camera rotation in degrees [tilt, pan, roll]
54
+ * @returns Object with x, y, z in radians and rotation order
55
+ */
56
+ export declare function getCameraEuler(rotation: [number, number, number]): {
57
+ x: number;
58
+ y: number;
59
+ z: number;
60
+ order: string;
61
+ };
62
+ /**
63
+ * GAM pixels to meters conversion factor
64
+ * 384 pixels = 1 meter (based on standard ad dimensions)
65
+ */
66
+ export declare const GAM_PIXELS_TO_METERS: number;
67
+ /**
68
+ * Standard 3D ad template dimensions
69
+ */
70
+ export declare const AD_TEMPLATE_DIMENSIONS: Record<string, {
71
+ w: number;
72
+ h: number;
73
+ }>;
74
+ /**
75
+ * Get 3D ad dimensions in meters
76
+ *
77
+ * @param templateId - Ad template identifier
78
+ * @returns Object with width and height in meters
79
+ */
80
+ export declare function getAdDimensions(templateId: string): {
81
+ width: number;
82
+ height: number;
83
+ };
84
+ /**
85
+ * Chroma key color presets
86
+ */
87
+ export declare const CHROMA_KEY_COLORS: {
88
+ readonly green: 65280;
89
+ readonly blue: 255;
90
+ };
91
+ /**
92
+ * Get chroma key color as hex number
93
+ *
94
+ * @param colorPreset - Color preset ('green' | 'blue' | 'custom')
95
+ * @param customHex - Custom hex string when preset is 'custom'
96
+ * @returns Hex color number
97
+ */
98
+ export declare function getChromaKeyColorHex(colorPreset: 'green' | 'blue' | 'custom', customHex: string): number;
99
+ /**
100
+ * Convert feather value from UI range (0-10) to UV units (0-0.15)
101
+ *
102
+ * @param featherValue - Feather value in UI range (0-10)
103
+ * @returns Feather value in UV units
104
+ */
105
+ export declare function featherToUV(featherValue: number): number;
106
+ /**
107
+ * Convert per-edge feather values from UI range to UV units
108
+ *
109
+ * @param featherEdges - Per-edge feather values [top, right, bottom, left]
110
+ * @returns Per-edge values in UV units
111
+ */
112
+ export declare function featherEdgesToUV(featherEdges: [number, number, number, number]): [number, number, number, number];
113
+ //# sourceMappingURL=webcam-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webcam-utils.d.ts","sourceRoot":"","sources":["../../src/layer2/webcam-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;GAGG;AACH,eAAO,MAAM,yBAAyB,IAAM,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAI9F;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,oBAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAExF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG;IACnE,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV,CAMA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG;IACnE,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACd,CAQA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAU,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAK3E,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAMrF;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,EACxC,SAAS,EAAE,MAAM,GACf,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAC5C,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAOlC"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Shared webcam utility functions for Layer 2 rendering
3
+ *
4
+ * These utilities are used by both editor and player for consistent
5
+ * webcam plane positioning and geometry calculations.
6
+ *
7
+ * ArchiMate: Application Component (Shared Webcam Utilities)
8
+ */
9
+ import { GAUSST } from '../index';
10
+ /**
11
+ * Base height for webcam plane in meters
12
+ * At scale 1.0, the plane is 1 meter tall
13
+ */
14
+ export const WEBCAM_BASE_HEIGHT_METERS = 1.0;
15
+ /**
16
+ * Silhouette occupies 85% of plane height
17
+ * This leaves margin at top and bottom for natural framing
18
+ */
19
+ export const SILHOUETTE_HEIGHT_RATIO = 0.85;
20
+ /**
21
+ * Calculate webcam plane base dimensions in meters
22
+ *
23
+ * @param aspectRatio - Webcam aspect ratio (width/height)
24
+ * @returns Object with width and height in meters
25
+ */
26
+ export function getWebcamBaseDimensions(aspectRatio) {
27
+ const height = WEBCAM_BASE_HEIGHT_METERS;
28
+ const width = height * aspectRatio;
29
+ return { width, height };
30
+ }
31
+ /**
32
+ * Calculate Y offset for webcam mesh positioning
33
+ * This ensures the webcam plane's bottom aligns with the Y position
34
+ *
35
+ * @param baseDimensionsHeight - Base height in meters (usually 1.0)
36
+ * @param scale - Scale factor from participation template
37
+ * @returns Y offset in meters
38
+ */
39
+ export function getWebcamMeshYOffset(baseDimensionsHeight, scale) {
40
+ return (baseDimensionsHeight / 2) * scale;
41
+ }
42
+ /**
43
+ * Convert rotation from degrees to radians for Three.js Euler
44
+ *
45
+ * @param rotation - Rotation in degrees [x, y, z]
46
+ * @returns Object with x, y, z in radians
47
+ */
48
+ export function getObjectEuler(rotation) {
49
+ return {
50
+ x: rotation[0] * GAUSST.DEG_TO_RAD,
51
+ y: rotation[1] * GAUSST.DEG_TO_RAD,
52
+ z: rotation[2] * GAUSST.DEG_TO_RAD
53
+ };
54
+ }
55
+ /**
56
+ * Convert Gausst camera rotation to Three.js Euler angles
57
+ * Uses YXZ rotation order for proper camera orientation
58
+ *
59
+ * @param rotation - Camera rotation in degrees [tilt, pan, roll]
60
+ * @returns Object with x, y, z in radians and rotation order
61
+ */
62
+ export function getCameraEuler(rotation) {
63
+ const [tilt, pan, roll] = rotation;
64
+ return {
65
+ x: tilt * GAUSST.DEG_TO_RAD,
66
+ y: -pan * GAUSST.DEG_TO_RAD,
67
+ z: -roll * GAUSST.DEG_TO_RAD,
68
+ order: 'YXZ'
69
+ };
70
+ }
71
+ /**
72
+ * GAM pixels to meters conversion factor
73
+ * 384 pixels = 1 meter (based on standard ad dimensions)
74
+ */
75
+ export const GAM_PIXELS_TO_METERS = 1 / 384;
76
+ /**
77
+ * Standard 3D ad template dimensions
78
+ */
79
+ export const AD_TEMPLATE_DIMENSIONS = {
80
+ 'overlay-medium-rectangle': { w: 300, h: 250 },
81
+ 'overlay-leaderboard': { w: 728, h: 90 },
82
+ 'overlay-skyscraper': { w: 160, h: 600 },
83
+ 'overlay-banner': { w: 468, h: 60 }
84
+ };
85
+ /**
86
+ * Get 3D ad dimensions in meters
87
+ *
88
+ * @param templateId - Ad template identifier
89
+ * @returns Object with width and height in meters
90
+ */
91
+ export function getAdDimensions(templateId) {
92
+ const dims = AD_TEMPLATE_DIMENSIONS[templateId] ?? { w: 300, h: 250 };
93
+ return {
94
+ width: dims.w * GAM_PIXELS_TO_METERS,
95
+ height: dims.h * GAM_PIXELS_TO_METERS
96
+ };
97
+ }
98
+ /**
99
+ * Chroma key color presets
100
+ */
101
+ export const CHROMA_KEY_COLORS = {
102
+ green: 0x00ff00,
103
+ blue: 0x0000ff
104
+ };
105
+ /**
106
+ * Get chroma key color as hex number
107
+ *
108
+ * @param colorPreset - Color preset ('green' | 'blue' | 'custom')
109
+ * @param customHex - Custom hex string when preset is 'custom'
110
+ * @returns Hex color number
111
+ */
112
+ export function getChromaKeyColorHex(colorPreset, customHex) {
113
+ switch (colorPreset) {
114
+ case 'green':
115
+ return CHROMA_KEY_COLORS.green;
116
+ case 'blue':
117
+ return CHROMA_KEY_COLORS.blue;
118
+ case 'custom':
119
+ // Parse hex string (e.g., '#00B140' -> 0x00B140)
120
+ return parseInt(customHex.replace('#', ''), 16);
121
+ default:
122
+ return CHROMA_KEY_COLORS.green;
123
+ }
124
+ }
125
+ /**
126
+ * Convert feather value from UI range (0-10) to UV units (0-0.15)
127
+ *
128
+ * @param featherValue - Feather value in UI range (0-10)
129
+ * @returns Feather value in UV units
130
+ */
131
+ export function featherToUV(featherValue) {
132
+ return featherValue * 0.015;
133
+ }
134
+ /**
135
+ * Convert per-edge feather values from UI range to UV units
136
+ *
137
+ * @param featherEdges - Per-edge feather values [top, right, bottom, left]
138
+ * @returns Per-edge values in UV units
139
+ */
140
+ export function featherEdgesToUV(featherEdges) {
141
+ return [
142
+ featherEdges[0] * 0.015,
143
+ featherEdges[1] * 0.015,
144
+ featherEdges[2] * 0.015,
145
+ featherEdges[3] * 0.015
146
+ ];
147
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=webcam-utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webcam-utils.test.d.ts","sourceRoot":"","sources":["../../src/layer2/webcam-utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { featherToUV, getChromaKeyColorHex } from './webcam-utils';
3
+ describe('featherToUV', () => {
4
+ it('converts 10 to 0.15', () => {
5
+ expect(featherToUV(10)).toBe(0.15);
6
+ });
7
+ it('converts 0 to 0', () => {
8
+ expect(featherToUV(0)).toBe(0);
9
+ });
10
+ });
11
+ describe('getChromaKeyColorHex', () => {
12
+ it('returns green preset', () => {
13
+ expect(getChromaKeyColorHex('green', '')).toBe(0x00ff00);
14
+ });
15
+ it('parses custom hex color', () => {
16
+ expect(getChromaKeyColorHex('custom', '#00B140')).toBe(0x00b140);
17
+ });
18
+ });