@franzenzenhofer/asanakit 0.1.0 → 0.3.0
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.
- package/README.md +84 -46
- package/dist/anatomy/muscles.d.ts +10 -7
- package/dist/anatomy/muscles.d.ts.map +1 -1
- package/dist/anatomy/muscles.js +21 -17
- package/dist/anatomy/muscles.js.map +1 -1
- package/dist/anatomy/validate.d.ts.map +1 -1
- package/dist/anatomy/validate.js +16 -10
- package/dist/anatomy/validate.js.map +1 -1
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +24 -2
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +3 -1
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/render.d.ts.map +1 -1
- package/dist/cli/commands/render.js +22 -4
- package/dist/cli/commands/render.js.map +1 -1
- package/dist/cli/commands/view.d.ts +3 -0
- package/dist/cli/commands/view.d.ts.map +1 -0
- package/dist/cli/commands/view.js +88 -0
- package/dist/cli/commands/view.js.map +1 -0
- package/dist/cli/index.js +7 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/resolve.d.ts +6 -0
- package/dist/cli/resolve.d.ts.map +1 -1
- package/dist/cli/resolve.js +40 -0
- package/dist/cli/resolve.js.map +1 -1
- package/dist/core/camera.d.ts +56 -0
- package/dist/core/camera.d.ts.map +1 -0
- package/dist/core/camera.js +20 -0
- package/dist/core/camera.js.map +1 -0
- package/dist/core/joints.d.ts +18 -0
- package/dist/core/joints.d.ts.map +1 -0
- package/dist/core/joints.js +27 -0
- package/dist/core/joints.js.map +1 -0
- package/dist/core/quat.d.ts +18 -0
- package/dist/core/quat.d.ts.map +1 -0
- package/dist/core/quat.js +25 -0
- package/dist/core/quat.js.map +1 -0
- package/dist/core/rig.d.ts +1 -6
- package/dist/core/rig.d.ts.map +1 -1
- package/dist/core/rig.js +45 -74
- package/dist/core/rig.js.map +1 -1
- package/dist/core/skeleton.d.ts +4 -13
- package/dist/core/skeleton.d.ts.map +1 -1
- package/dist/core/skeleton.js +39 -69
- package/dist/core/skeleton.js.map +1 -1
- package/dist/core/types.d.ts +62 -55
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/vec3.d.ts +13 -0
- package/dist/core/vec3.d.ts.map +1 -0
- package/dist/core/vec3.js +26 -0
- package/dist/core/vec3.js.map +1 -0
- package/dist/export3d/gltf.d.ts +11 -0
- package/dist/export3d/gltf.d.ts.map +1 -0
- package/dist/export3d/gltf.js +28 -0
- package/dist/export3d/gltf.js.map +1 -0
- package/dist/export3d/index.d.ts +3 -0
- package/dist/export3d/index.d.ts.map +1 -0
- package/dist/export3d/index.js +3 -0
- package/dist/export3d/index.js.map +1 -0
- package/dist/export3d/shims.d.ts +7 -0
- package/dist/export3d/shims.d.ts.map +1 -0
- package/dist/export3d/shims.js +27 -0
- package/dist/export3d/shims.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/library/index.js +4 -4
- package/dist/library/index.js.map +1 -1
- package/dist/model/pose.d.ts +11 -5
- package/dist/model/pose.d.ts.map +1 -1
- package/dist/model/pose.js +30 -16
- package/dist/model/pose.js.map +1 -1
- package/dist/model/schema.d.ts +69 -28
- package/dist/model/schema.d.ts.map +1 -1
- package/dist/model/schema.js +57 -17
- package/dist/model/schema.js.map +1 -1
- package/dist/physics/index.d.ts +3 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +3 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/rapier-types.d.ts +60 -0
- package/dist/physics/rapier-types.d.ts.map +1 -0
- package/dist/physics/rapier-types.js +12 -0
- package/dist/physics/rapier-types.js.map +1 -0
- package/dist/physics/settle.d.ts +3 -0
- package/dist/physics/settle.d.ts.map +1 -0
- package/dist/physics/settle.js +108 -0
- package/dist/physics/settle.js.map +1 -0
- package/dist/physics/world.d.ts +4 -0
- package/dist/physics/world.d.ts.map +1 -0
- package/dist/physics/world.js +18 -0
- package/dist/physics/world.js.map +1 -0
- package/dist/render/anatomy.js +1 -1
- package/dist/render/anatomy.js.map +1 -1
- package/dist/render/annotations.d.ts +3 -2
- package/dist/render/annotations.d.ts.map +1 -1
- package/dist/render/annotations.js.map +1 -1
- package/dist/render/camera.d.ts +43 -0
- package/dist/render/camera.d.ts.map +1 -0
- package/dist/render/camera.js +57 -0
- package/dist/render/camera.js.map +1 -0
- package/dist/render/context.d.ts +5 -3
- package/dist/render/context.d.ts.map +1 -1
- package/dist/render/figure.d.ts +4 -2
- package/dist/render/figure.d.ts.map +1 -1
- package/dist/render/figure.js +29 -43
- package/dist/render/figure.js.map +1 -1
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +1 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/props.d.ts +4 -3
- package/dist/render/props.d.ts.map +1 -1
- package/dist/render/props.js.map +1 -1
- package/dist/render/scene.d.ts +7 -1
- package/dist/render/scene.d.ts.map +1 -1
- package/dist/render/scene.js +8 -1
- package/dist/render/scene.js.map +1 -1
- package/dist/render/sheet.d.ts +3 -0
- package/dist/render/sheet.d.ts.map +1 -1
- package/dist/render/sheet.js +2 -0
- package/dist/render/sheet.js.map +1 -1
- package/dist/solve.d.ts +14 -0
- package/dist/solve.d.ts.map +1 -0
- package/dist/solve.js +17 -0
- package/dist/solve.js.map +1 -0
- package/dist/standards/keypoints.d.ts +2 -10
- package/dist/standards/keypoints.d.ts.map +1 -1
- package/dist/standards/keypoints.js +33 -14
- package/dist/standards/keypoints.js.map +1 -1
- package/dist/three/index.d.ts +2 -0
- package/dist/three/index.d.ts.map +1 -0
- package/dist/three/index.js +2 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/scene.d.ts +22 -0
- package/dist/three/scene.d.ts.map +1 -0
- package/dist/three/scene.js +90 -0
- package/dist/three/scene.js.map +1 -0
- package/dist/viewer/html.d.ts +32 -0
- package/dist/viewer/html.d.ts.map +1 -0
- package/dist/viewer/html.js +163 -0
- package/dist/viewer/html.js.map +1 -0
- package/dist/viewer/index.d.ts +2 -0
- package/dist/viewer/index.d.ts.map +1 -0
- package/dist/viewer/index.js +2 -0
- package/dist/viewer/index.js.map +1 -0
- package/dist/viewer/viewer.bundle.js +4119 -0
- package/docs/AUTHORING.md +119 -58
- package/package.json +20 -6
- package/poses/surf/bottom-turn.pose.yaml +24 -24
- package/poses/surf/cutback.pose.yaml +24 -24
- package/poses/surf/duck-dive.pose.yaml +23 -23
- package/poses/surf/noseride.pose.yaml +23 -25
- package/poses/surf/paddling.pose.yaml +24 -24
- package/poses/surf/pop-up.pose.yaml +24 -24
- package/poses/surf/takeoff.pose.yaml +24 -24
- package/poses/surf/tube-stance.pose.yaml +24 -24
- package/poses/yoga/ashtanga/adho-mukha-svanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/ardha-uttanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/baddha-konasana.pose.yaml +21 -23
- package/poses/yoga/ashtanga/balasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/chaturanga-dandasana.pose.yaml +21 -21
- package/poses/yoga/ashtanga/dandasana.pose.yaml +21 -23
- package/poses/yoga/ashtanga/halasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/janu-sirsasana-a.pose.yaml +22 -22
- package/poses/yoga/ashtanga/karnapidasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/marichyasana-a.pose.yaml +22 -22
- package/poses/yoga/ashtanga/marichyasana-c.pose.yaml +21 -23
- package/poses/yoga/ashtanga/matsyasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/navasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/padahastasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/padangusthasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/padmasana.pose.yaml +22 -24
- package/poses/yoga/ashtanga/parsvottanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/paschimottanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/prasarita-padottanasana-a.pose.yaml +26 -26
- package/poses/yoga/ashtanga/prasarita-padottanasana-c.pose.yaml +26 -26
- package/poses/yoga/ashtanga/primary.seq.yaml +2 -4
- package/poses/yoga/ashtanga/purvottanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/salamba-sarvangasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/samasthiti.pose.yaml +10 -10
- package/poses/yoga/ashtanga/savasana.pose.yaml +21 -21
- package/poses/yoga/ashtanga/setu-bandhasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/sirsasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/supta-padangusthasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/upavistha-konasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/urdhva-dhanurasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/urdhva-hastasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/urdhva-mukha-svanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/utkatasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/uttanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/utthita-parsvakonasana.pose.yaml +24 -24
- package/poses/yoga/ashtanga/utthita-trikonasana.pose.yaml +24 -24
- package/poses/yoga/ashtanga/virabhadrasana-a.pose.yaml +22 -22
- package/poses/yoga/ashtanga/virabhadrasana-b.pose.yaml +21 -23
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Export a solved skeleton as keypoints in the two standard layouts, so asanakit
|
|
3
|
+
* output can feed anything that already speaks pose-estimation data.
|
|
4
|
+
*
|
|
5
|
+
* The landmark NAMES and EDGE lists below restate the public layouts of
|
|
6
|
+
* MediaPipe BlazePose (33) and COCO (17), as published in the Apache-2.0
|
|
7
|
+
* licensed tfjs-models / mediapipe projects. Only the layout is reused; the
|
|
8
|
+
* geometry is asanakit's own - and since the rig is 3D, every keypoint carries
|
|
9
|
+
* a real z (MediaPipe convention: hip-relative, negative toward the camera).
|
|
10
|
+
*/
|
|
11
|
+
import { axisAngleDeg, rotateVec3 } from '../core/quat.js';
|
|
12
|
+
import { add3, lerp3, normalize3, scale3, sub3 } from '../core/vec3.js';
|
|
2
13
|
export const MEDIAPIPE_33 = [
|
|
3
14
|
'nose', 'left_eye_inner', 'left_eye', 'left_eye_outer', 'right_eye_inner', 'right_eye', 'right_eye_outer',
|
|
4
15
|
'left_ear', 'right_ear', 'mouth_left', 'mouth_right',
|
|
@@ -24,19 +35,21 @@ const MEDIAPIPE_EDGES = [
|
|
|
24
35
|
[24, 26], [26, 28], [28, 30], [28, 32],
|
|
25
36
|
];
|
|
26
37
|
/**
|
|
27
|
-
* The rig has no facial bones, so eyes, ears and mouth are derived from the
|
|
28
|
-
* bone's
|
|
29
|
-
* for a consumer that only needs head orientation.
|
|
38
|
+
* The rig has no facial bones, so eyes, ears and mouth are derived from the
|
|
39
|
+
* head bone's frame. They are approximations by construction - honest ones,
|
|
40
|
+
* and enough for a consumer that only needs head orientation.
|
|
30
41
|
*/
|
|
31
42
|
const facePoints = (skeleton) => {
|
|
32
43
|
const head = skeleton.bones.head;
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
44
|
+
const q = head.orientation;
|
|
45
|
+
const up = rotateVec3(q, [0, 1, 0]);
|
|
46
|
+
const forward = rotateVec3(q, [0, 0, 1]);
|
|
47
|
+
const left = rotateVec3(q, [1, 0, 0]);
|
|
48
|
+
const centre = lerp3(head.start, head.end, 0.55);
|
|
49
|
+
const size = head.length;
|
|
50
|
+
const at = (fwd, rise, side) => add3(add3(add3(centre, scale3(forward, fwd * size)), scale3(up, rise * size)), scale3(left, side * size));
|
|
38
51
|
return {
|
|
39
|
-
nose:
|
|
52
|
+
nose: at(0.42, 0, 0),
|
|
40
53
|
left_eye: at(0.3, 0.12, 0.08),
|
|
41
54
|
left_eye_inner: at(0.32, 0.12, 0.03),
|
|
42
55
|
left_eye_outer: at(0.26, 0.12, 0.14),
|
|
@@ -47,16 +60,19 @@ const facePoints = (skeleton) => {
|
|
|
47
60
|
right_ear: at(-0.1, 0.06, -0.22),
|
|
48
61
|
mouth_left: at(0.3, -0.18, 0.09),
|
|
49
62
|
mouth_right: at(0.3, -0.18, -0.09),
|
|
50
|
-
_forward: forward,
|
|
51
63
|
};
|
|
52
64
|
};
|
|
53
65
|
const heel = (skeleton, side) => {
|
|
54
66
|
const foot = skeleton.bones[side === 'L' ? 'footL' : 'footR'];
|
|
55
|
-
|
|
67
|
+
const dir = normalize3(sub3(foot.end, foot.start));
|
|
68
|
+
return add3(foot.start, scale3(dir, -foot.length * 0.35));
|
|
56
69
|
};
|
|
70
|
+
/** Pinky and thumb fan out from the wrist around the hand's own forward axis. */
|
|
57
71
|
const hand = (skeleton, side, spread) => {
|
|
58
72
|
const h = skeleton.bones[side === 'L' ? 'handL' : 'handR'];
|
|
59
|
-
|
|
73
|
+
const dir = normalize3(sub3(h.end, h.start));
|
|
74
|
+
const axis = rotateVec3(h.orientation, [0, 0, 1]);
|
|
75
|
+
return add3(h.end, scale3(rotateVec3(axisAngleDeg(axis, spread), dir), h.length * 0.3));
|
|
60
76
|
};
|
|
61
77
|
const pointFor = (name, skeleton, face) => {
|
|
62
78
|
const l = skeleton.landmarks;
|
|
@@ -99,6 +115,7 @@ export const toKeypoints = (skeleton, format, options = {}) => {
|
|
|
99
115
|
const minX = Math.min(...xs);
|
|
100
116
|
const minY = Math.min(...ys);
|
|
101
117
|
const span = Math.max(Math.max(...xs) - minX, Math.max(...ys) - minY, 1e-6);
|
|
118
|
+
const hipZ = skeleton.landmarks.hipCenter[2];
|
|
102
119
|
return {
|
|
103
120
|
format,
|
|
104
121
|
space: normalize ? 'normalized' : 'stature',
|
|
@@ -108,9 +125,11 @@ export const toKeypoints = (skeleton, format, options = {}) => {
|
|
|
108
125
|
return {
|
|
109
126
|
index,
|
|
110
127
|
name,
|
|
111
|
-
// Image space is y-down, so normalising also flips
|
|
128
|
+
// Image space is y-down, so normalising also flips that axis; z stays
|
|
129
|
+
// hip-relative and negative toward the camera, as MediaPipe reports it.
|
|
112
130
|
x: normalize ? (p[0] - minX) / span : p[0],
|
|
113
131
|
y: normalize ? 1 - (p[1] - minY) / span : p[1],
|
|
132
|
+
z: normalize ? -(p[2] - hipZ) / span : p[2],
|
|
114
133
|
};
|
|
115
134
|
}),
|
|
116
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypoints.js","sourceRoot":"","sources":["../../src/standards/keypoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keypoints.js","sourceRoot":"","sources":["../../src/standards/keypoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAa,MAAM,iBAAiB,CAAC;AAEnF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB;IACzG,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa;IACpD,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa;IAC3F,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa;IACrF,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa;IAC/E,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB;C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Ae;QACzD,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACnC,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAS,CAAC;YAC7B,OAAO;gBACL,KAAK;gBACL,IAAI;gBACJ,sEAAsE;gBACtE,wEAAwE;gBACxE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1C,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9C,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5C,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/three/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/three/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skeleton -> three.js scene graph. One shared module builds the figure for
|
|
3
|
+
* BOTH consumers: the GLB exporter running in Node and the interactive viewer
|
|
4
|
+
* running in a browser. three's scene-graph math is pure JavaScript, so no
|
|
5
|
+
* GPU or DOM is needed here.
|
|
6
|
+
*/
|
|
7
|
+
import { Group } from 'three';
|
|
8
|
+
import { type MuscleId } from '../anatomy/muscles.js';
|
|
9
|
+
import type { Skeleton } from '../core/types.js';
|
|
10
|
+
export interface FigureSceneOptions {
|
|
11
|
+
/** Bone capsule color; a light theme's ink. */
|
|
12
|
+
readonly color?: string;
|
|
13
|
+
readonly engaged?: readonly MuscleId[];
|
|
14
|
+
readonly stretched?: readonly MuscleId[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build the stick figure as a group of capsules and spheres, y-up, feet on
|
|
18
|
+
* y = 0, about one unit tall - exactly the solver's world space, so the GLB
|
|
19
|
+
* and the viewer agree with every SVG projection of the same skeleton.
|
|
20
|
+
*/
|
|
21
|
+
export declare const buildFigureScene: (skeleton: Skeleton, options?: FigureSceneOptions) => Group;
|
|
22
|
+
//# sourceMappingURL=scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../src/three/scene.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,EAMN,MAAM,OAAO,CAAC;AACf,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAU,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGzD,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC1C;AA4ED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,QAAQ,EAAE,UAAS,kBAAuB,KAAG,KA8BvF,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skeleton -> three.js scene graph. One shared module builds the figure for
|
|
3
|
+
* BOTH consumers: the GLB exporter running in Node and the interactive viewer
|
|
4
|
+
* running in a browser. three's scene-graph math is pure JavaScript, so no
|
|
5
|
+
* GPU or DOM is needed here.
|
|
6
|
+
*/
|
|
7
|
+
import { CapsuleGeometry, Group, Mesh, MeshStandardMaterial, Quaternion, SphereGeometry, Vector3, } from 'three';
|
|
8
|
+
import { MUSCLES } from '../anatomy/muscles.js';
|
|
9
|
+
import { midpoint3, sub3, len3 } from '../core/vec3.js';
|
|
10
|
+
const BONE_RADIUS = 0.016;
|
|
11
|
+
const HEAD_RADIUS = 0.055;
|
|
12
|
+
const JOINT_RADIUS = 0.02;
|
|
13
|
+
/** Fixed tessellation, so the same skeleton always exports identical bytes. */
|
|
14
|
+
const CAPSULE_SEGMENTS = { cap: 6, radial: 12 };
|
|
15
|
+
const SPHERE_SEGMENTS = { width: 24, height: 16 };
|
|
16
|
+
const DEFAULT_COLOR = '#1a1a1a';
|
|
17
|
+
const ENGAGED_COLOR = '#c0392b';
|
|
18
|
+
const STRETCHED_COLOR = '#2471a3';
|
|
19
|
+
const REST_AXIS = new Vector3(0, 1, 0);
|
|
20
|
+
/** Which rig bones a highlighted muscle paints. */
|
|
21
|
+
const muscleBones = (ids) => {
|
|
22
|
+
const bones = new Set();
|
|
23
|
+
for (const id of ids) {
|
|
24
|
+
const base = MUSCLES[id].bone;
|
|
25
|
+
if (base === 'pelvis' || base === 'spine' || base === 'neck' || base === 'head') {
|
|
26
|
+
bones.add(base);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
bones.add(`${base}L`);
|
|
30
|
+
bones.add(`${base}R`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return bones;
|
|
34
|
+
};
|
|
35
|
+
const material = (color) => new MeshStandardMaterial({ color, roughness: 0.65, metalness: 0 });
|
|
36
|
+
const alignToAxis = (mesh, axis) => {
|
|
37
|
+
mesh.quaternion.copy(new Quaternion().setFromUnitVectors(REST_AXIS, new Vector3(axis[0], axis[1], axis[2]).normalize()));
|
|
38
|
+
};
|
|
39
|
+
const boneMesh = (start, end, spec) => {
|
|
40
|
+
const axis = sub3(end, start);
|
|
41
|
+
const length = len3(axis);
|
|
42
|
+
const geometry = new CapsuleGeometry(spec.radius, Math.max(length, 1e-6), CAPSULE_SEGMENTS.cap, CAPSULE_SEGMENTS.radial);
|
|
43
|
+
const mesh = new Mesh(geometry, spec.mat);
|
|
44
|
+
mesh.name = spec.name;
|
|
45
|
+
const mid = midpoint3(start, end);
|
|
46
|
+
mesh.position.set(mid[0], mid[1], mid[2]);
|
|
47
|
+
alignToAxis(mesh, axis);
|
|
48
|
+
return mesh;
|
|
49
|
+
};
|
|
50
|
+
const headMesh = (skeleton, mat) => {
|
|
51
|
+
const head = new Mesh(new SphereGeometry(HEAD_RADIUS * skeleton.scale, SPHERE_SEGMENTS.width, SPHERE_SEGMENTS.height), mat);
|
|
52
|
+
head.name = 'bone:head';
|
|
53
|
+
const centre = skeleton.landmarks.headCenter;
|
|
54
|
+
head.position.set(centre[0], centre[1], centre[2]);
|
|
55
|
+
alignToAxis(head, sub3(skeleton.bones.head.end, skeleton.bones.head.start));
|
|
56
|
+
head.scale.set(0.82, 1.18, 0.9); // An ellipsoid skull, not a ball.
|
|
57
|
+
return head;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Build the stick figure as a group of capsules and spheres, y-up, feet on
|
|
61
|
+
* y = 0, about one unit tall - exactly the solver's world space, so the GLB
|
|
62
|
+
* and the viewer agree with every SVG projection of the same skeleton.
|
|
63
|
+
*/
|
|
64
|
+
export const buildFigureScene = (skeleton, options = {}) => {
|
|
65
|
+
const group = new Group();
|
|
66
|
+
group.name = 'asanakit-figure';
|
|
67
|
+
const base = material(options.color ?? DEFAULT_COLOR);
|
|
68
|
+
const engagedMat = material(ENGAGED_COLOR);
|
|
69
|
+
const stretchedMat = material(STRETCHED_COLOR);
|
|
70
|
+
const engaged = muscleBones(options.engaged ?? []);
|
|
71
|
+
const stretched = muscleBones(options.stretched ?? []);
|
|
72
|
+
const scale = skeleton.scale;
|
|
73
|
+
const materialFor = (id) => engaged.has(id) ? engagedMat : stretched.has(id) ? stretchedMat : base;
|
|
74
|
+
for (const bone of Object.values(skeleton.bones)) {
|
|
75
|
+
if (bone.id === 'head')
|
|
76
|
+
continue; // The head is a sphere, not a stick.
|
|
77
|
+
group.add(boneMesh(bone.start, bone.end, { radius: BONE_RADIUS * scale, mat: materialFor(bone.id), name: `bone:${bone.id}` }));
|
|
78
|
+
}
|
|
79
|
+
group.add(headMesh(skeleton, materialFor('head')));
|
|
80
|
+
for (const [id, p] of Object.entries(skeleton.landmarks)) {
|
|
81
|
+
if (id === 'headCenter' || id === 'headTop')
|
|
82
|
+
continue;
|
|
83
|
+
const joint = new Mesh(new SphereGeometry(JOINT_RADIUS * scale, 12, 8), base);
|
|
84
|
+
joint.name = `joint:${id}`;
|
|
85
|
+
joint.position.set(p[0], p[1], p[2]);
|
|
86
|
+
group.add(joint);
|
|
87
|
+
}
|
|
88
|
+
return group;
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=scene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../../src/three/scene.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,eAAe,EACf,KAAK,EACL,IAAI,EACJ,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,OAAO,GACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAiB,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAa,MAAM,iBAAiB,CAAC;AASnE,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,+EAA+E;AAC/E,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAW,CAAC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
+
import type { MuscleId } from '../anatomy/muscles.js';
|
|
2
|
+
import { type CameraAngles } from '../core/camera.js';
|
|
3
|
+
import type { Skeleton } from '../core/types.js';
|
|
4
|
+
import type { PoseSpec } from '../model/schema.js';
|
|
5
|
+
export interface ViewerOptions {
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly subtitle?: string | undefined;
|
|
8
|
+
readonly camera: CameraAngles;
|
|
9
|
+
readonly engaged?: readonly MuscleId[];
|
|
10
|
+
readonly stretched?: readonly MuscleId[];
|
|
11
|
+
}
|
|
12
|
+
/** A pose together with its solved (possibly physics-settled) skeleton. */
|
|
13
|
+
export interface ShowcaseEntry {
|
|
14
|
+
readonly pose: PoseSpec;
|
|
15
|
+
readonly skeleton: Skeleton;
|
|
16
|
+
}
|
|
17
|
+
export interface ShowcaseOptions {
|
|
18
|
+
readonly title?: string;
|
|
19
|
+
/** Starting viewpoint for the interactive viewer. */
|
|
20
|
+
readonly camera?: CameraAngles;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* ONE self-contained offline HTML file with everything asanakit can say about
|
|
24
|
+
* the given poses: an interactive 3D viewer (orbit, zoom, pan; pose picker
|
|
25
|
+
* when there is more than one) above a gallery of deterministic inline SVG
|
|
26
|
+
* renders - the orbit strip for a single pose, one card per pose otherwise.
|
|
27
|
+
* No CDN, no network, works from file://.
|
|
28
|
+
*/
|
|
29
|
+
export declare const buildShowcaseHtml: (entries: readonly ShowcaseEntry[], options?: ShowcaseOptions) => Promise<string>;
|
|
30
|
+
/** A fullscreen interactive viewer for one solved skeleton (the `asanakit view` page). */
|
|
31
|
+
export declare const buildViewerHtml: (skeleton: Skeleton, options: ViewerOptions) => Promise<string>;
|
|
32
|
+
//# sourceMappingURL=html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/viewer/html.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAiB,KAAK,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAC1F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC1C;AAED,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AA6FD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,SAAS,aAAa,EAAE,EACjC,UAAS,eAAoB,KAC5B,OAAO,CAAC,MAAM,CAiChB,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,eAAe,GAAU,UAAU,QAAQ,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,MAAM,CA8ChG,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { resolveCamera } from '../core/camera.js';
|
|
3
|
+
import { renderSvg } from '../render/scene.js';
|
|
4
|
+
/**
|
|
5
|
+
* Both the compiled module (dist/viewer/html.js) and the tsx-run source
|
|
6
|
+
* (src/viewer/html.ts) sit two levels below the package root, so one relative
|
|
7
|
+
* path finds the bundle from either world.
|
|
8
|
+
*/
|
|
9
|
+
const BUNDLE_URL = new URL('../../dist/viewer/viewer.bundle.js', import.meta.url);
|
|
10
|
+
const loadBundle = async () => {
|
|
11
|
+
try {
|
|
12
|
+
return await readFile(BUNDLE_URL, 'utf8');
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
throw new Error('Viewer bundle missing. Run "npm run build" to produce dist/viewer/viewer.bundle.js.');
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/** `</script>` inside inlined JSON or JS would end the tag; escape every `</`. */
|
|
19
|
+
const inline = (text) => text.replaceAll('</', '<\\/');
|
|
20
|
+
const escapeHtml = (text) => text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');
|
|
21
|
+
const payloadFor = (entries, camera) => JSON.stringify({
|
|
22
|
+
poses: entries.map(({ pose, skeleton }) => ({
|
|
23
|
+
id: pose.id,
|
|
24
|
+
name: pose.name,
|
|
25
|
+
...(pose.sanskrit === undefined ? {} : { sanskrit: pose.sanskrit }),
|
|
26
|
+
skeleton,
|
|
27
|
+
engaged: pose.muscles.engaged,
|
|
28
|
+
stretched: pose.muscles.stretched,
|
|
29
|
+
})),
|
|
30
|
+
camera,
|
|
31
|
+
});
|
|
32
|
+
const PAGE_STYLE = `
|
|
33
|
+
:root { color-scheme: light; }
|
|
34
|
+
html, body { margin: 0; background: #ffffff; color: #1a1a1a;
|
|
35
|
+
font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
|
|
36
|
+
header { padding: 26px 32px 10px; }
|
|
37
|
+
header h1 { margin: 0; font-size: 24px; }
|
|
38
|
+
header p { margin: 4px 0 0; color: #777; font-size: 14px; }
|
|
39
|
+
.stage { display: flex; gap: 0; border-top: 1px solid #eee; border-bottom: 1px solid #eee; }
|
|
40
|
+
nav { width: 230px; max-height: 560px; overflow-y: auto; border-right: 1px solid #eee; padding: 10px 0; }
|
|
41
|
+
nav button { display: block; width: 100%; text-align: left; border: 0; background: none;
|
|
42
|
+
padding: 7px 18px; font-size: 13px; color: #444; cursor: pointer; }
|
|
43
|
+
nav button:hover { background: #f5f5f5; }
|
|
44
|
+
nav button.active { background: #eef4fb; color: #1a5b9e; font-weight: 600; }
|
|
45
|
+
#asanakit-3d { flex: 1; height: 560px; position: relative; }
|
|
46
|
+
#asanakit-3d canvas { display: block; }
|
|
47
|
+
.hint { position: absolute; right: 16px; bottom: 10px; font-size: 11px; color: #aaa; pointer-events: none; }
|
|
48
|
+
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
|
49
|
+
gap: 18px; padding: 26px 32px 44px; }
|
|
50
|
+
figure { margin: 0; border: 1px solid #eee; border-radius: 10px; padding: 10px; cursor: pointer; }
|
|
51
|
+
figure:hover { border-color: #bcd2e8; }
|
|
52
|
+
figure svg { width: 100%; height: auto; display: block; }
|
|
53
|
+
figcaption { text-align: center; font-size: 13px; margin-top: 6px; color: #444; }
|
|
54
|
+
figcaption em { display: block; color: #999; font-size: 11px; font-style: italic; }
|
|
55
|
+
`;
|
|
56
|
+
const card = (entry, svg, label) => {
|
|
57
|
+
const { pose } = entry;
|
|
58
|
+
const caption = label ?? `${escapeHtml(pose.name)}${pose.sanskrit === undefined ? '' : `<em>${escapeHtml(pose.sanskrit)}</em>`}`;
|
|
59
|
+
return `<figure data-pose-card="${escapeHtml(pose.id)}" onclick="ASANAKIT_SELECT('${escapeHtml(pose.id)}')">${svg}<figcaption>${caption}</figcaption></figure>`;
|
|
60
|
+
};
|
|
61
|
+
/** For a single pose the gallery is the orbit: the same body through five cameras. */
|
|
62
|
+
const STRIP_CAMERAS = ['front', 'three-quarter', 'side', 'back', 'top'];
|
|
63
|
+
const galleryFor = (entries) => {
|
|
64
|
+
if (entries.length === 1) {
|
|
65
|
+
const entry = entries[0];
|
|
66
|
+
return STRIP_CAMERAS.map((preset) => card(entry, renderSvg(entry.pose, { skeleton: entry.skeleton, camera: preset, width: 300, height: 360 }), preset)).join('\n');
|
|
67
|
+
}
|
|
68
|
+
return entries
|
|
69
|
+
.map((entry) => card(entry, renderSvg(entry.pose, { skeleton: entry.skeleton, width: 300, height: 360 })))
|
|
70
|
+
.join('\n');
|
|
71
|
+
};
|
|
72
|
+
const navFor = (entries) => entries.length < 2
|
|
73
|
+
? ''
|
|
74
|
+
: `<nav>${entries
|
|
75
|
+
.map(({ pose }) => `<button data-asanakit-pose="${escapeHtml(pose.id)}" onclick="ASANAKIT_SELECT('${escapeHtml(pose.id)}')">${escapeHtml(pose.name)}</button>`)
|
|
76
|
+
.join('')}</nav>`;
|
|
77
|
+
/**
|
|
78
|
+
* ONE self-contained offline HTML file with everything asanakit can say about
|
|
79
|
+
* the given poses: an interactive 3D viewer (orbit, zoom, pan; pose picker
|
|
80
|
+
* when there is more than one) above a gallery of deterministic inline SVG
|
|
81
|
+
* renders - the orbit strip for a single pose, one card per pose otherwise.
|
|
82
|
+
* No CDN, no network, works from file://.
|
|
83
|
+
*/
|
|
84
|
+
export const buildShowcaseHtml = async (entries, options = {}) => {
|
|
85
|
+
if (entries.length === 0)
|
|
86
|
+
throw new Error('Nothing to show: no poses given');
|
|
87
|
+
const bundle = await loadBundle();
|
|
88
|
+
const first = entries[0];
|
|
89
|
+
const camera = options.camera ?? resolveCamera(entries.length === 1 ? first.pose.camera : 'three-quarter');
|
|
90
|
+
const title = options.title ?? (entries.length === 1 ? first.pose.name : 'asanakit');
|
|
91
|
+
const subtitle = entries.length === 1
|
|
92
|
+
? (first.pose.sanskrit ?? '')
|
|
93
|
+
: `${entries.length} postures - drag to orbit, click a pose to load it`;
|
|
94
|
+
return `<!DOCTYPE html>
|
|
95
|
+
<html lang="en">
|
|
96
|
+
<head>
|
|
97
|
+
<meta charset="utf-8">
|
|
98
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
99
|
+
<title>${escapeHtml(title)} - asanakit</title>
|
|
100
|
+
<style>${PAGE_STYLE}</style>
|
|
101
|
+
</head>
|
|
102
|
+
<body>
|
|
103
|
+
<header><h1>${escapeHtml(title)}</h1><p>${escapeHtml(subtitle)}</p></header>
|
|
104
|
+
<div class="stage">
|
|
105
|
+
${navFor(entries)}
|
|
106
|
+
<div id="asanakit-3d"><span class="hint">drag to orbit · scroll to zoom · right-drag to pan</span></div>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="gallery">
|
|
109
|
+
${galleryFor(entries)}
|
|
110
|
+
</div>
|
|
111
|
+
<script>window.ASANAKIT_VIEWER = ${inline(payloadFor(entries, camera))};</script>
|
|
112
|
+
<script>${inline(bundle)}</script>
|
|
113
|
+
</body>
|
|
114
|
+
</html>
|
|
115
|
+
`;
|
|
116
|
+
};
|
|
117
|
+
/** A fullscreen interactive viewer for one solved skeleton (the `asanakit view` page). */
|
|
118
|
+
export const buildViewerHtml = async (skeleton, options) => {
|
|
119
|
+
const bundle = await loadBundle();
|
|
120
|
+
const payload = JSON.stringify({
|
|
121
|
+
poses: [
|
|
122
|
+
{
|
|
123
|
+
id: 'pose',
|
|
124
|
+
name: options.title,
|
|
125
|
+
...(options.subtitle === undefined ? {} : { sanskrit: options.subtitle }),
|
|
126
|
+
skeleton,
|
|
127
|
+
engaged: options.engaged ?? [],
|
|
128
|
+
stretched: options.stretched ?? [],
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
camera: options.camera,
|
|
132
|
+
});
|
|
133
|
+
const subtitle = options.subtitle === undefined ? '' : `<em>${escapeHtml(options.subtitle)}</em>`;
|
|
134
|
+
return `<!DOCTYPE html>
|
|
135
|
+
<html lang="en">
|
|
136
|
+
<head>
|
|
137
|
+
<meta charset="utf-8">
|
|
138
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
139
|
+
<title>${escapeHtml(options.title)} - asanakit</title>
|
|
140
|
+
<style>
|
|
141
|
+
html, body { margin: 0; height: 100%; overflow: hidden; background: #ffffff; }
|
|
142
|
+
#asanakit-3d { position: fixed; inset: 0; }
|
|
143
|
+
#asanakit-3d canvas { display: block; }
|
|
144
|
+
#hud {
|
|
145
|
+
position: fixed; top: 14px; left: 18px; z-index: 1;
|
|
146
|
+
font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; color: #1a1a1a;
|
|
147
|
+
user-select: none; pointer-events: none;
|
|
148
|
+
}
|
|
149
|
+
#hud strong { font-size: 17px; }
|
|
150
|
+
#hud em { display: block; font-size: 13px; color: #777; margin-top: 2px; }
|
|
151
|
+
#hud span { display: block; font-size: 11px; color: #aaa; margin-top: 6px; }
|
|
152
|
+
</style>
|
|
153
|
+
</head>
|
|
154
|
+
<body>
|
|
155
|
+
<div id="hud"><strong>${escapeHtml(options.title)}</strong>${subtitle}<span>drag to orbit · scroll to zoom · right-drag to pan</span></div>
|
|
156
|
+
<div id="asanakit-3d"></div>
|
|
157
|
+
<script>window.ASANAKIT_VIEWER = ${inline(payload)};</script>
|
|
158
|
+
<script>${inline(bundle)}</script>
|
|
159
|
+
</body>
|
|
160
|
+
</html>
|
|
161
|
+
`;
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/viewer/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAA0C,MAAM,mBAAmB,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAsB/C;;;;GAIG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,oCAAoC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAElF,MAAM,UAAU,GAAG,KAAK,IAAqB,EAAE;IAC7C,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP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
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/viewer/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/viewer/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|