alphavalid-sdk 1.0.1 → 1.0.2
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 +133 -0
- package/bin/alphavalid.js +92 -0
- package/dist/__vite-browser-external-C7ivxuo1.mjs +18 -0
- package/dist/alphavalid.es.d.ts +126 -0
- package/dist/alphavalid.es.js +20092 -0
- package/dist/alphavalid.umd.d.ts +126 -0
- package/dist/alphavalid.umd.js +3852 -0
- package/dist/core/camera.d.ts +8 -0
- package/dist/core/camera.d.ts.map +1 -0
- package/dist/core/feedback.d.ts +112 -0
- package/dist/core/feedback.d.ts.map +1 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/setupModels-RA6BN3uf.mjs +19 -0
- package/dist/setupModels.d.ts +2 -0
- package/dist/setupModels.d.ts.map +1 -0
- package/dist/types/sdk.d.ts +451 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/ui/baseStyles.d.ts +2 -0
- package/dist/ui/baseStyles.d.ts.map +1 -0
- package/dist/ui/captureButtonCoxinha.d.ts +13 -0
- package/dist/ui/captureButtonCoxinha.d.ts.map +1 -0
- package/dist/ui/containerStyles.d.ts +1 -0
- package/dist/ui/containerStyles.d.ts.map +1 -0
- package/dist/ui/loader.d.ts +15 -0
- package/dist/ui/loader.d.ts.map +1 -0
- package/dist/ui/overlay.d.ts +221 -0
- package/dist/ui/overlay.d.ts.map +1 -0
- package/dist/ui/overlayCoxinhaMobile.d.ts +10 -0
- package/dist/ui/overlayCoxinhaMobile.d.ts.map +1 -0
- package/dist/ui/userPreviewCoxinha.d.ts +20 -0
- package/dist/ui/userPreviewCoxinha.d.ts.map +1 -0
- package/dist/utils/canvas.d.ts +27 -0
- package/dist/utils/canvas.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +3 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/vision/faceDetector.d.ts +11 -0
- package/dist/vision/faceDetector.d.ts.map +1 -0
- package/models/README.md +8 -0
- package/models/face_landmark_68_tiny_model-shard1.bin +0 -0
- package/models/face_landmark_68_tiny_model-weights_manifest.json +1 -0
- package/models/tiny_face_detector_model-shard1.bin +0 -0
- package/models/tiny_face_detector_model-weights_manifest.json +1 -0
- package/package.json +31 -7
- package/public/images/alphaloader.gif +0 -0
- package/scripts/copy-models.cjs +31 -0
- package/tsconfig.json +21 -0
- package/vite.config.ts +19 -0
- package/.gitattributes +0 -2
- package/src/index.ts +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
export interface OverlayHandle {
|
|
2
|
+
canvas: HTMLCanvasElement;
|
|
3
|
+
dispose: () => void;
|
|
4
|
+
render: (status: OverlayRenderInput) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface OverlayRenderInput {
|
|
7
|
+
message: string;
|
|
8
|
+
box?: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
valid: boolean;
|
|
15
|
+
/** Optional: current challenge direction for overlays that support it (e.g. Coxinha zoom hole). */
|
|
16
|
+
challenge?: {
|
|
17
|
+
direction?: 'left' | 'right' | 'up' | 'down' | 'zoomIn' | 'zoomOut';
|
|
18
|
+
};
|
|
19
|
+
/** Optional: structured debug info to be printed in an on-screen panel. */
|
|
20
|
+
debug?: {
|
|
21
|
+
status?: string;
|
|
22
|
+
ready?: boolean;
|
|
23
|
+
feedbackCode?: string;
|
|
24
|
+
challenge?: string;
|
|
25
|
+
faces?: number;
|
|
26
|
+
eyeL?: number;
|
|
27
|
+
eyeR?: number;
|
|
28
|
+
/** Total de piscadas detectadas desde que a câmera iniciou (start()). */
|
|
29
|
+
blinkCount?: number;
|
|
30
|
+
/** True quando ambos olhos estão abaixo do limiar de "fechado" (momento atual). */
|
|
31
|
+
blinkClosedNow?: boolean;
|
|
32
|
+
/** Limiar utilizado para considerar olho "fechado". */
|
|
33
|
+
blinkClosedThreshold?: number;
|
|
34
|
+
/** 0..1: progresso de hold do challenge atual (usado por overlays como o Coxinha). */
|
|
35
|
+
challengeHoldProgress?: number;
|
|
36
|
+
mouthAvg?: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
} | null;
|
|
40
|
+
jawMid?: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
} | null;
|
|
44
|
+
faceH?: number | null;
|
|
45
|
+
mouthVsJawMidRaw?: number | null;
|
|
46
|
+
mouthVsJawMidClamped?: number | null;
|
|
47
|
+
/** Ratio de sorriso detectado (0..1) */
|
|
48
|
+
mouthSmileRatio?: number;
|
|
49
|
+
/** Ponto base da "queijo" (smile calibration) */
|
|
50
|
+
cheeseBaseline?: number;
|
|
51
|
+
/** Ponto alvo da "queijo" (smile calibration) */
|
|
52
|
+
cheeseTarget?: number;
|
|
53
|
+
/** Optional: allow hiding some debug rows without disabling the whole panel. */
|
|
54
|
+
debugDraw?: {
|
|
55
|
+
cheese?: boolean;
|
|
56
|
+
};
|
|
57
|
+
currentStep?: string | null;
|
|
58
|
+
stepPassed?: boolean;
|
|
59
|
+
/** Distâncias boca->olho (esquerdo/direito) e diferença média (debug opcional). */
|
|
60
|
+
jawEyeDistL?: number;
|
|
61
|
+
jawEyeDistR?: number;
|
|
62
|
+
jawEyeDistDiff?: number;
|
|
63
|
+
jawEyeDiffTol?: number;
|
|
64
|
+
/** Campo extra para flags customizadas vindas do debug do SDK. */
|
|
65
|
+
extra?: any;
|
|
66
|
+
/**
|
|
67
|
+
* Objeto de debug detalhado para todos os valores de boca (mouth)
|
|
68
|
+
*/
|
|
69
|
+
mouthDebug?: {
|
|
70
|
+
mouthPoints?: any;
|
|
71
|
+
mouthLeft?: any;
|
|
72
|
+
mouthRight?: any;
|
|
73
|
+
mouthUpper?: any;
|
|
74
|
+
mouthLower?: any;
|
|
75
|
+
mouthOpenPx?: number;
|
|
76
|
+
mouthOpenNorm?: number;
|
|
77
|
+
mouthJawLeftDist?: number;
|
|
78
|
+
mouthJawRightDist?: number;
|
|
79
|
+
mouthSmileRatio?: number;
|
|
80
|
+
mouthWidthRatio?: number;
|
|
81
|
+
mouthAvg?: any;
|
|
82
|
+
mouthVsJawMidRaw?: number;
|
|
83
|
+
mouthVsJawMidClamped?: number;
|
|
84
|
+
cheeseBaseline?: number;
|
|
85
|
+
cheeseTarget?: number;
|
|
86
|
+
mouthOpenRatio?: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/** Optional: visual hint for challenges (e.g. arrow directions). */
|
|
90
|
+
hint?: {
|
|
91
|
+
type: 'arrow';
|
|
92
|
+
direction: 'left' | 'right' | 'up' | 'down';
|
|
93
|
+
intensity?: number;
|
|
94
|
+
label?: string;
|
|
95
|
+
} | {
|
|
96
|
+
type: 'pulse';
|
|
97
|
+
label?: string;
|
|
98
|
+
intensity?: number;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Optional: debug landmark points (normalized [0..1] *in video space*).
|
|
102
|
+
* IMPORTANT: when the <video> is rendered with object-fit: cover, the displayed region is cropped.
|
|
103
|
+
* The overlay must map video-space coordinates to container-space coordinates.
|
|
104
|
+
*/
|
|
105
|
+
landmarks?: {
|
|
106
|
+
leftEye?: Array<{
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
}>;
|
|
110
|
+
rightEye?: Array<{
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
}>;
|
|
114
|
+
leftEyeCenter?: {
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
};
|
|
118
|
+
rightEyeCenter?: {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
};
|
|
122
|
+
/** Optional: nose tip (normalized video space) */
|
|
123
|
+
noseTip?: {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
};
|
|
127
|
+
/** Optional: nose ridge/base points (normalized video space) */
|
|
128
|
+
nosePoints?: Array<{
|
|
129
|
+
x: number;
|
|
130
|
+
y: number;
|
|
131
|
+
}>;
|
|
132
|
+
/** Optional: outer mouth points (normalized video space) */
|
|
133
|
+
mouthPoints?: Array<{
|
|
134
|
+
x: number;
|
|
135
|
+
y: number;
|
|
136
|
+
}>;
|
|
137
|
+
/** Optional: mouth corners (normalized video space) */
|
|
138
|
+
mouthLeft?: {
|
|
139
|
+
x: number;
|
|
140
|
+
y: number;
|
|
141
|
+
};
|
|
142
|
+
mouthRight?: {
|
|
143
|
+
x: number;
|
|
144
|
+
y: number;
|
|
145
|
+
};
|
|
146
|
+
/** Optional: jawline polyline points (normalized video space) */
|
|
147
|
+
jawPoints?: Array<{
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
}>;
|
|
151
|
+
/** Optional: jaw side points (normalized video space) */
|
|
152
|
+
jawLeft?: {
|
|
153
|
+
x: number;
|
|
154
|
+
y: number;
|
|
155
|
+
};
|
|
156
|
+
jawRight?: {
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
};
|
|
160
|
+
/** Optional: jaw center (normalized video space) */
|
|
161
|
+
jawCenter?: {
|
|
162
|
+
x: number;
|
|
163
|
+
y: number;
|
|
164
|
+
};
|
|
165
|
+
/** Optional: distances (mouth corner to jaw side), normalized by eye distance */
|
|
166
|
+
mouthJawLeftDist?: number;
|
|
167
|
+
mouthJawRightDist?: number;
|
|
168
|
+
/** Pontos centrais do lábio superior (51) e inferior (57) (normalized video space). */
|
|
169
|
+
mouthUpper?: {
|
|
170
|
+
x: number;
|
|
171
|
+
y: number;
|
|
172
|
+
};
|
|
173
|
+
mouthLower?: {
|
|
174
|
+
x: number;
|
|
175
|
+
y: number;
|
|
176
|
+
};
|
|
177
|
+
/** Distância vertical absoluta (px) e normalizada por eyeDist entre lábio superior e inferior. */
|
|
178
|
+
mouthOpenPx?: number;
|
|
179
|
+
mouthOpenNorm?: number;
|
|
180
|
+
jawTopL?: {
|
|
181
|
+
x: number;
|
|
182
|
+
y: number;
|
|
183
|
+
};
|
|
184
|
+
jawTopR?: {
|
|
185
|
+
x: number;
|
|
186
|
+
y: number;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Optional: provide the underlying <video> element so the overlay can compensate object-fit cropping.
|
|
191
|
+
* If omitted, overlay assumes video fills container 1:1 (may be wrong on cover/contain).
|
|
192
|
+
*/
|
|
193
|
+
video?: HTMLVideoElement;
|
|
194
|
+
/** Optional: override objectFit; if omitted we read computedStyle(video).objectFit (fallback: 'cover'). */
|
|
195
|
+
videoObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
196
|
+
/**
|
|
197
|
+
* If true, overlay will mirror X coordinates (use when the underlying <video> preview is mirrored).
|
|
198
|
+
* Default: auto-detect from computedStyle(video).transform.
|
|
199
|
+
*/
|
|
200
|
+
mirrored?: boolean;
|
|
201
|
+
/** If provided, draw a small analog-style axis widget showing face direction. */
|
|
202
|
+
poseVector?: {
|
|
203
|
+
/** -1..1: negative=left, positive=right (already in preview semantics if you want). */
|
|
204
|
+
x: number;
|
|
205
|
+
/** -1..1: negative=up, positive=down. */
|
|
206
|
+
y: number;
|
|
207
|
+
/** Optional: label shown under the widget (e.g. 'yawProxy' / 'center'). */
|
|
208
|
+
label?: string;
|
|
209
|
+
};
|
|
210
|
+
/** Fine-grained overlay debug toggles (allows the demo/app to enable only what it needs). */
|
|
211
|
+
landmarkDraw?: {
|
|
212
|
+
eyes?: boolean;
|
|
213
|
+
mouth?: boolean;
|
|
214
|
+
nose?: boolean;
|
|
215
|
+
jaw?: boolean;
|
|
216
|
+
mouthJaw?: boolean;
|
|
217
|
+
cheese?: boolean;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export declare function createOverlay(container: HTMLElement, guideCircleRatio?: number): OverlayHandle;
|
|
221
|
+
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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B,OAAO,CAAC,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACnC,OAAO,CAAC,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACpC,CAAC;IAEF;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB,2GAA2G;IAC3G,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;IAEtE;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,iFAAiF;IACjF,UAAU,CAAC,EAAE;QACX,uFAAuF;QACvF,CAAC,EAAE,MAAM,CAAC;QACV,yCAAyC;QACzC,CAAC,EAAE,MAAM,CAAC;QACV,2EAA2E;QAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,6FAA6F;IAC7F,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,WAAW,EAAE,gBAAgB,SAAO,GAAG,aAAa,CAg4B5F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OverlayHandle } from './overlay';
|
|
2
|
+
/**
|
|
3
|
+
* Overlay "Coxinha Mobile" (inverted teardrop):
|
|
4
|
+
* - Máscara em formato de gota invertida, topo e base arredondados
|
|
5
|
+
* - Linhas guias centralizadas (vertical e horizontal)
|
|
6
|
+
* - Fundo glassmorphism
|
|
7
|
+
* - Pronto para integração com landmarks para checagem de alinhamento
|
|
8
|
+
*/
|
|
9
|
+
export declare function createOverlayCoxinhaMobile(container: HTMLElement): OverlayHandle;
|
|
10
|
+
//# sourceMappingURL=overlayCoxinhaMobile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayCoxinhaMobile.d.ts","sourceRoot":"","sources":["../../src/ui/overlayCoxinhaMobile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgD,MAAM,WAAW,CAAC;AA0BxF;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,WAAW,GAAG,aAAa,CA8oBhF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AlphaValidStartOptions } from '../types/sdk';
|
|
2
|
+
export type UserPreviewUiHandle = {
|
|
3
|
+
show: (srcUrl: string, metaText?: string) => void;
|
|
4
|
+
hide: () => void;
|
|
5
|
+
dispose: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createUserPreviewCoxinhaUi(params: {
|
|
8
|
+
container: HTMLElement;
|
|
9
|
+
labels?: {
|
|
10
|
+
ok?: string;
|
|
11
|
+
retake?: string;
|
|
12
|
+
};
|
|
13
|
+
onOk: () => void;
|
|
14
|
+
onRetake: () => void;
|
|
15
|
+
}): UserPreviewUiHandle;
|
|
16
|
+
export declare function labelsFromStartOptions(options: AlphaValidStartOptions): {
|
|
17
|
+
ok: string | undefined;
|
|
18
|
+
retake: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=userPreviewCoxinha.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userPreviewCoxinha.d.ts","sourceRoot":"","sources":["../../src/ui/userPreviewCoxinha.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAOF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,GAAG,mBAAmB,CA8GtB;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB;;YAGpB,MAAM,GAAG,SAAS;EAEnE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare function clamp(v: number, a: number, b: number): number;
|
|
2
|
+
export declare function clamp01(v: number): number;
|
|
3
|
+
export declare function resizeToContainer(canvas: HTMLCanvasElement, container: HTMLElement, ctx?: CanvasRenderingContext2D): {
|
|
4
|
+
w: number;
|
|
5
|
+
h: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function getVideoToContainerMapper(w: number, h: number, video?: HTMLVideoElement, objectFit?: string, mirrored?: boolean): {
|
|
8
|
+
mapPt: (p: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}) => {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
mapRect: (r: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}) => {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/utils/canvas.ts"],"names":[],"mappings":"AAGA,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7D;AAGD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzC;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,wBAAwB;;;EAalH;AAGD,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,CAAC,EAAE,gBAAgB,EACxB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,OAAO;eAKH;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;;;;iBACtB;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;;;;;;EAwCzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,IAAI,WAAW,CAItF;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAOvE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FaceDetectionStatus } from '../types/sdk';
|
|
2
|
+
export interface FaceDetector {
|
|
3
|
+
load: (modelsPath: string, opts?: {
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
detect: (video: HTMLVideoElement, opts?: {
|
|
7
|
+
withLandmarks?: boolean;
|
|
8
|
+
}) => Promise<FaceDetectionStatus>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createFaceDetector(): FaceDetector;
|
|
11
|
+
//# sourceMappingURL=faceDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faceDetector.d.ts","sourceRoot":"","sources":["../../src/vision/faceDetector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAsB,MAAM,cAAc,CAAC;AAE5E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,MAAM,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACvG;AA+BD,wBAAgB,kBAAkB,IAAI,YAAY,CAsOjD"}
|
package/models/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Place face-api.js model files here (TinyFaceDetector) to be shipped with the npm package.
|
|
2
|
+
|
|
3
|
+
Expected files:
|
|
4
|
+
- tiny_face_detector_model-weights_manifest.json
|
|
5
|
+
- tiny_face_detector_model-shard1
|
|
6
|
+
- tiny_face_detector_model-shard2 (if present)
|
|
7
|
+
|
|
8
|
+
These files will be included in the npm tarball and can be copied by consumer apps into their public assets directory.
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"weights":[{"name":"dense0/conv0/filters","shape":[3,3,3,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008194216092427571,"min":-0.9423348506291708}},{"name":"dense0/conv0/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006839508168837603,"min":-0.8412595047670252}},{"name":"dense0/conv1/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.009194007106855804,"min":-1.2779669878529567}},{"name":"dense0/conv1/pointwise_filter","shape":[1,1,32,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0036026100317637128,"min":-0.3170296827952067}},{"name":"dense0/conv1/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.000740380117706224,"min":-0.06367269012273527}},{"name":"dense0/conv2/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":1,"min":0}},{"name":"dense0/conv2/pointwise_filter","shape":[1,1,32,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":1,"min":0}},{"name":"dense0/conv2/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0037702228508743585,"min":-0.6220867703942692}},{"name":"dense1/conv0/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0033707996209462483,"min":-0.421349952618281}},{"name":"dense1/conv0/pointwise_filter","shape":[1,1,32,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.014611541991140328,"min":-1.8556658328748217}},{"name":"dense1/conv0/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002832523046755323,"min":-0.30307996600281956}},{"name":"dense1/conv1/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006593170586754294,"min":-0.6329443763284123}},{"name":"dense1/conv1/pointwise_filter","shape":[1,1,64,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.012215249211180444,"min":-1.6001976466646382}},{"name":"dense1/conv1/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002384825547536214,"min":-0.3028728445370992}},{"name":"dense1/conv2/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005859645441466687,"min":-0.7617539073906693}},{"name":"dense1/conv2/pointwise_filter","shape":[1,1,64,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.013121426806730382,"min":-1.7845140457153321}},{"name":"dense1/conv2/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0032247188044529336,"min":-0.46435950784122243}},{"name":"dense2/conv0/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002659512618008782,"min":-0.32977956463308894}},{"name":"dense2/conv0/pointwise_filter","shape":[1,1,64,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.015499923743453681,"min":-1.9839902391620712}},{"name":"dense2/conv0/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0032450980999890497,"min":-0.522460794098237}},{"name":"dense2/conv1/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005911862382701799,"min":-0.792189559282041}},{"name":"dense2/conv1/pointwise_filter","shape":[1,1,128,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.021025861478319356,"min":-2.2077154552235325}},{"name":"dense2/conv1/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00349616945958605,"min":-0.46149436866535865}},{"name":"dense2/conv2/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008104994250278847,"min":-1.013124281284856}},{"name":"dense2/conv2/pointwise_filter","shape":[1,1,128,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.029337059282789044,"min":-3.5791212325002633}},{"name":"dense2/conv2/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0038808938334969913,"min":-0.4230174278511721}},{"name":"fc/weights","shape":[128,136],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.014016061670639936,"min":-1.8921683255363912}},{"name":"fc/bias","shape":[136],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0029505149698724935,"min":0.088760145008564}}],"paths":["face_landmark_68_tiny_model-shard1.bin"]}]
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"weights":[{"name":"conv0/filters","shape":[3,3,3,16],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.009007044399485869,"min":-1.2069439495311063}},{"name":"conv0/bias","shape":[16],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005263455241334205,"min":-0.9211046672334858}},{"name":"conv1/depthwise_filter","shape":[3,3,16,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004001977630690033,"min":-0.5042491814669441}},{"name":"conv1/pointwise_filter","shape":[1,1,16,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.013836609615999109,"min":-1.411334180831909}},{"name":"conv1/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0015159862590771096,"min":-0.30926119685173037}},{"name":"conv2/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002666276225856706,"min":-0.317286870876948}},{"name":"conv2/pointwise_filter","shape":[1,1,32,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.015265831292844286,"min":-1.6792414422128714}},{"name":"conv2/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0020280554598453,"min":-0.37113414915168985}},{"name":"conv3/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006100742489683862,"min":-0.8907084034938438}},{"name":"conv3/pointwise_filter","shape":[1,1,64,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.016276211832083907,"min":-2.0508026908425725}},{"name":"conv3/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003394414279975143,"min":-0.7637432129944072}},{"name":"conv4/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006716050119961009,"min":-0.8059260143953211}},{"name":"conv4/pointwise_filter","shape":[1,1,128,256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.021875603993733724,"min":-2.8875797271728514}},{"name":"conv4/bias","shape":[256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0041141652009066415,"min":-0.8187188749804216}},{"name":"conv5/depthwise_filter","shape":[3,3,256,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008423839597141042,"min":-0.9013508368940915}},{"name":"conv5/pointwise_filter","shape":[1,1,256,512],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.030007277283014035,"min":-3.8709387695088107}},{"name":"conv5/bias","shape":[512],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008402082966823203,"min":-1.4871686851277068}},{"name":"conv8/filters","shape":[1,1,512,25],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.028336129469030042,"min":-4.675461362389957}},{"name":"conv8/bias","shape":[25],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002268134028303857,"min":-0.41053225912299807}}],"paths":["tiny_face_detector_model-shard1.bin"]}]
|
package/package.json
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alphavalid-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "SDK de validação facial e liveness",
|
|
5
|
+
"main": "dist/alphavalid.umd.js",
|
|
6
|
+
"module": "dist/alphavalid.es.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"alphavalid-sdk": "bin/alphavalid.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"models",
|
|
14
|
+
"scripts",
|
|
15
|
+
"public/images/alphaloader.gif",
|
|
16
|
+
"README.md",
|
|
17
|
+
"package.json",
|
|
18
|
+
"vite.config.ts",
|
|
19
|
+
"tsconfig.json"
|
|
20
|
+
],
|
|
6
21
|
"scripts": {
|
|
7
|
-
"
|
|
22
|
+
"build": "npx vite build && npm run types",
|
|
23
|
+
"types": "tsc -p tsconfig.json && cp dist/index.d.ts dist/alphavalid.umd.d.ts && cp dist/index.d.ts dist/alphavalid.es.d.ts",
|
|
24
|
+
"build:all": "rm -rf dist && npm run build && npm run types",
|
|
25
|
+
"test:local": "vite preview",
|
|
26
|
+
"copy-models": "node ./scripts/copy-models.cjs",
|
|
27
|
+
"copy-models:demo": "node ./scripts/copy-models.cjs ./demo/public/alphavalid-models",
|
|
28
|
+
"demo:install": "cd demo && npm i",
|
|
29
|
+
"demo:dev": "cd demo && npm run dev",
|
|
30
|
+
"demo:preview": "cd demo && npm run preview"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"face-api.js": "^0.22.2"
|
|
8
34
|
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
35
|
"devDependencies": {
|
|
36
|
+
"@types/node": "^25.5.0",
|
|
13
37
|
"typescript": "^6.0.2",
|
|
14
38
|
"vite": "^8.0.2"
|
|
15
39
|
}
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Copies alphavalid-sdk face-api model files from this package into a consumer app folder.
|
|
4
|
+
// Usage (from consumer app):
|
|
5
|
+
// node ./node_modules/alphavalid-sdk/scripts/copy-models.cjs ./src/assets/alphavalid-models
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
function detectProjectType() {
|
|
11
|
+
if (fs.existsSync('angular.json')) return 'angular';
|
|
12
|
+
if (fs.existsSync('vite.config.js') || fs.existsSync('vite.config.ts') || fs.existsSync('index.html') || fs.existsSync('public')) return 'vite';
|
|
13
|
+
return 'unknown';
|
|
14
|
+
}
|
|
15
|
+
function getTargetDir() {
|
|
16
|
+
const type = detectProjectType();
|
|
17
|
+
if (type === 'angular') return path.join('src', 'assets', 'alphavalid-models');
|
|
18
|
+
if (type === 'vite') return path.join('public', 'alphavalid-models');
|
|
19
|
+
return path.join('alphavalid-models');
|
|
20
|
+
}
|
|
21
|
+
const src = path.join(__dirname, '../models');
|
|
22
|
+
const dest = path.resolve(process.cwd(), getTargetDir());
|
|
23
|
+
if (!fs.existsSync(src)) {
|
|
24
|
+
console.error('[AlphaValid] Pasta de models não encontrada:', src);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
28
|
+
for (const file of fs.readdirSync(src)) {
|
|
29
|
+
fs.copyFileSync(path.join(src, file), path.join(dest, file));
|
|
30
|
+
}
|
|
31
|
+
console.log(`[AlphaValid] Models copiados para ${dest}`);
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": ["DOM", "ES2022", "ESNext"],
|
|
6
|
+
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"emitDeclarationOnly": true,
|
|
10
|
+
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"rootDir": "src",
|
|
13
|
+
|
|
14
|
+
"strict": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
|
|
17
|
+
"types": [],
|
|
18
|
+
"moduleResolution": "Bundler"
|
|
19
|
+
},
|
|
20
|
+
"include": ["src"]
|
|
21
|
+
}
|
package/vite.config.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
appType: 'custom', // 🔥 ISSO AQUI RESOLVE O BUG DO INDEX.HTML
|
|
5
|
+
|
|
6
|
+
publicDir: false,
|
|
7
|
+
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: 'src/index.ts',
|
|
11
|
+
name: 'AlphaValid',
|
|
12
|
+
formats: ['es', 'umd'],
|
|
13
|
+
fileName: (format) => `alphavalid.${format}.js`
|
|
14
|
+
},
|
|
15
|
+
rollupOptions: {
|
|
16
|
+
external: []
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
package/.gitattributes
DELETED
package/src/index.ts
DELETED
|
File without changes
|