@ax-design/reveal-highlight 0.4.2 → 0.5.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.
- package/LICENSE +21 -21
- package/README.md +75 -75
- package/build/BaseConfig.d.ts +5 -1
- package/build/BaseConfig.d.ts.map +1 -1
- package/build/CanvasConfig.d.ts +7 -1
- package/build/CanvasConfig.d.ts.map +1 -1
- package/build/ComputedStyleStorage.d.ts.map +1 -1
- package/build/CustomElements.d.ts +20 -4
- package/build/CustomElements.d.ts.map +1 -1
- package/build/RevealBoundryStore.d.ts +4 -0
- package/build/RevealBoundryStore.d.ts.map +1 -1
- package/build/RevealStateManager.d.ts +5 -1
- package/build/RevealStateManager.d.ts.map +1 -1
- package/build/main.js +113 -82
- package/build/utils/types.d.ts +2 -10
- package/build/utils/types.d.ts.map +1 -1
- package/es/BaseConfig.d.ts +46 -42
- package/es/BaseConfig.d.ts.map +1 -1
- package/es/BaseConfig.js +241 -219
- package/es/BaseConfig.js.map +1 -1
- package/es/CanvasConfig.d.ts +21 -15
- package/es/CanvasConfig.d.ts.map +1 -1
- package/es/CanvasConfig.js +332 -320
- package/es/CanvasConfig.js.map +1 -1
- package/es/ComputedStyleStorage.d.ts +8 -8
- package/es/ComputedStyleStorage.d.ts.map +1 -1
- package/es/ComputedStyleStorage.js +68 -58
- package/es/ComputedStyleStorage.js.map +1 -1
- package/es/CustomElements.d.ts +75 -59
- package/es/CustomElements.d.ts.map +1 -1
- package/es/CustomElements.js +296 -233
- package/es/CustomElements.js.map +1 -1
- package/es/Profiler.d.ts +12 -12
- package/es/Profiler.js +31 -31
- package/es/RevealBoundryStore.d.ts +80 -76
- package/es/RevealBoundryStore.d.ts.map +1 -1
- package/es/RevealBoundryStore.js +269 -248
- package/es/RevealBoundryStore.js.map +1 -1
- package/es/RevealStateManager.d.ts +19 -15
- package/es/RevealStateManager.d.ts.map +1 -1
- package/es/RevealStateManager.js +99 -73
- package/es/RevealStateManager.js.map +1 -1
- package/es/SvgConfig.d.ts +16 -16
- package/es/SvgConfig.js +345 -345
- package/es/config.d.ts +4 -4
- package/es/config.js +21 -21
- package/es/index.d.ts +5 -5
- package/es/index.js +205 -205
- package/es/tsconfig.tsbuildinfo +1 -1
- package/es/utils/extractRGBValue.d.ts +1 -1
- package/es/utils/extractRGBValue.js +47 -47
- package/es/utils/isValidateBorderDecorationType.d.ts +2 -2
- package/es/utils/isValidateBorderDecorationType.js +9 -9
- package/es/utils/types.d.ts +94 -102
- package/es/utils/types.d.ts.map +1 -1
- package/es/utils/types.js +1 -1
- package/es/variables.d.ts +1 -1
- package/es/variables.js +1 -1
- package/package.json +35 -34
- package/src/BaseConfig.ts +332 -310
- package/src/CanvasConfig.ts +420 -415
- package/src/ComputedStyleStorage.ts +102 -89
- package/src/CustomElements.ts +344 -272
- package/src/Profiler.ts +44 -44
- package/src/RevealBoundryStore.ts +315 -291
- package/src/RevealStateManager.ts +109 -86
- package/src/SvgConfig.ts +422 -422
- package/src/config.ts +26 -26
- package/src/cssTypedOM.d.ts +52 -52
- package/src/index.ts +219 -219
- package/src/utils/extractRGBValue.ts +58 -58
- package/src/utils/isValidateBorderDecorationType.ts +8 -8
- package/src/utils/types.ts +97 -105
- package/src/variables.ts +1 -1
package/es/Profiler.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const downloadText = (filename, text) => {
|
|
2
|
-
const element = document.createElement('a');
|
|
3
|
-
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
|
4
|
-
element.setAttribute('download', filename);
|
|
5
|
-
element.style.display = 'none';
|
|
6
|
-
element.click();
|
|
7
|
-
};
|
|
8
|
-
export class Profiler {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.baseline = 0;
|
|
11
|
-
this.logs = [];
|
|
12
|
-
}
|
|
13
|
-
setBaseline() {
|
|
14
|
-
this.baseline = performance.now();
|
|
15
|
-
}
|
|
16
|
-
mark(task = 'unknown') {
|
|
17
|
-
const time = performance.now() - this.baseline;
|
|
18
|
-
this.logs.push({
|
|
19
|
-
time,
|
|
20
|
-
task,
|
|
21
|
-
});
|
|
22
|
-
this.baseline = performance.now();
|
|
23
|
-
}
|
|
24
|
-
dumpAsCsv() {
|
|
25
|
-
let result = 'task,tile\n';
|
|
26
|
-
for (let i = 0; i < this.logs.length; i++) {
|
|
27
|
-
result += `${this.logs[i].task},${this.logs[i].time}\n`;
|
|
28
|
-
}
|
|
29
|
-
downloadText('axRevealHighlightProfileDetail.csv', result);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
const downloadText = (filename, text) => {
|
|
2
|
+
const element = document.createElement('a');
|
|
3
|
+
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
|
4
|
+
element.setAttribute('download', filename);
|
|
5
|
+
element.style.display = 'none';
|
|
6
|
+
element.click();
|
|
7
|
+
};
|
|
8
|
+
export class Profiler {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.baseline = 0;
|
|
11
|
+
this.logs = [];
|
|
12
|
+
}
|
|
13
|
+
setBaseline() {
|
|
14
|
+
this.baseline = performance.now();
|
|
15
|
+
}
|
|
16
|
+
mark(task = 'unknown') {
|
|
17
|
+
const time = performance.now() - this.baseline;
|
|
18
|
+
this.logs.push({
|
|
19
|
+
time,
|
|
20
|
+
task,
|
|
21
|
+
});
|
|
22
|
+
this.baseline = performance.now();
|
|
23
|
+
}
|
|
24
|
+
dumpAsCsv() {
|
|
25
|
+
let result = 'task,tile\n';
|
|
26
|
+
for (let i = 0; i < this.logs.length; i++) {
|
|
27
|
+
result += `${this.logs[i].task},${this.logs[i].time}\n`;
|
|
28
|
+
}
|
|
29
|
+
downloadText('axRevealHighlightProfileDetail.csv', result);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
32
|
//# sourceMappingURL=Profiler.js.map
|
|
@@ -1,77 +1,81 @@
|
|
|
1
|
-
import { CanvasConfig } from './CanvasConfig.js';
|
|
2
|
-
import { SvgConfig } from './SvgConfig.js';
|
|
3
|
-
declare type Config = CanvasConfig | SvgConfig;
|
|
4
|
-
export declare class RevealBoundaryStore {
|
|
5
|
-
id: number;
|
|
6
|
-
container: HTMLElement;
|
|
7
|
-
clientX: number;
|
|
8
|
-
clientY: number;
|
|
9
|
-
paintedClientX: number;
|
|
10
|
-
paintedClientY: number;
|
|
11
|
-
mouseInBoundary: boolean;
|
|
12
|
-
canvasList: Config[];
|
|
13
|
-
animationQueue: Config[];
|
|
14
|
-
animationFrame: number | null;
|
|
15
|
-
mouseUpClientX: null;
|
|
16
|
-
mouseUpClientY: null;
|
|
17
|
-
mouseDownAnimateStartFrame: null;
|
|
18
|
-
mouseDownAnimateCurrentFrame: null;
|
|
19
|
-
mouseDownAnimateReleasedFrame: null;
|
|
20
|
-
mouseDownAnimateLogicFrame: null;
|
|
21
|
-
mousePressed: boolean;
|
|
22
|
-
mouseReleased: boolean;
|
|
23
|
-
maxRadius: number;
|
|
24
|
-
requestedAnimationFrame: boolean;
|
|
25
|
-
constructor(id: number, $el: HTMLElement);
|
|
26
|
-
addReveal: ($element: HTMLCanvasElement | SVGElement, $container: HTMLElement) => void;
|
|
27
|
-
removeReveal: ($el: HTMLCanvasElement | SVGElement) => void;
|
|
28
|
-
updateMaxRadius: (x: number) => void;
|
|
29
|
-
requestPaintAll: (cleanup?: boolean | undefined) => void;
|
|
30
|
-
updatePointerPosition: (x: number, y: number) => void;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
import { CanvasConfig } from './CanvasConfig.js';
|
|
2
|
+
import { SvgConfig } from './SvgConfig.js';
|
|
3
|
+
declare type Config = CanvasConfig | SvgConfig;
|
|
4
|
+
export declare class RevealBoundaryStore {
|
|
5
|
+
id: number;
|
|
6
|
+
container: HTMLElement;
|
|
7
|
+
clientX: number;
|
|
8
|
+
clientY: number;
|
|
9
|
+
paintedClientX: number;
|
|
10
|
+
paintedClientY: number;
|
|
11
|
+
mouseInBoundary: boolean;
|
|
12
|
+
canvasList: Config[];
|
|
13
|
+
animationQueue: Config[];
|
|
14
|
+
animationFrame: number | null;
|
|
15
|
+
mouseUpClientX: null;
|
|
16
|
+
mouseUpClientY: null;
|
|
17
|
+
mouseDownAnimateStartFrame: null;
|
|
18
|
+
mouseDownAnimateCurrentFrame: null;
|
|
19
|
+
mouseDownAnimateReleasedFrame: null;
|
|
20
|
+
mouseDownAnimateLogicFrame: null;
|
|
21
|
+
mousePressed: boolean;
|
|
22
|
+
mouseReleased: boolean;
|
|
23
|
+
maxRadius: number;
|
|
24
|
+
requestedAnimationFrame: boolean;
|
|
25
|
+
constructor(id: number, $el: HTMLElement);
|
|
26
|
+
addReveal: ($element: HTMLCanvasElement | SVGElement, $container: HTMLElement) => void;
|
|
27
|
+
removeReveal: ($el: HTMLCanvasElement | SVGElement) => void;
|
|
28
|
+
updateMaxRadius: (x: number) => void;
|
|
29
|
+
requestPaintAll: (cleanup?: boolean | undefined) => void;
|
|
30
|
+
updatePointerPosition: (x: number, y: number) => void;
|
|
31
|
+
private anchorOffsetX;
|
|
32
|
+
private anchorOffsetY;
|
|
33
|
+
anchorPointer: () => void;
|
|
34
|
+
private followAnchor;
|
|
35
|
+
onPointerMoveOnScreen: (x: number, y: number) => true | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Repaint all canvas while user's pointer has entered the boundary.
|
|
38
|
+
*/
|
|
39
|
+
onPointerEnterBoundary: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Clear all canvas while user's pointer leave the bounary.
|
|
42
|
+
*/
|
|
43
|
+
onPointerLeaveBoundary: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* The painting method that draw everything on your screen.
|
|
46
|
+
* @param frame current frame index, if this value is 0, it means all canvas
|
|
47
|
+
* should be cleaned.
|
|
48
|
+
* @param skipSamePointerPositionCheck Literally.
|
|
49
|
+
*/
|
|
50
|
+
private paintAll;
|
|
51
|
+
/**
|
|
52
|
+
* Clear all canvas.
|
|
53
|
+
*/
|
|
54
|
+
clearAll: (forAnimation: boolean) => void;
|
|
55
|
+
/**
|
|
56
|
+
* This is the effect while user pressed on the reveal highlight,
|
|
57
|
+
* the ripple start to spread slowly.
|
|
58
|
+
*/
|
|
59
|
+
initializeAnimation: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* This is the effect while user released it's pointer, the spreading
|
|
62
|
+
* ripple animation will start to accelerate.
|
|
63
|
+
*/
|
|
64
|
+
switchAnimation: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Cleanup all animations.
|
|
67
|
+
* @param skipPaint Only cleanup data or also clean up the canvas
|
|
68
|
+
* @param forceClean Clean the canvas or not
|
|
69
|
+
*/
|
|
70
|
+
cleanupAnimation: (skipPaint?: boolean | undefined, forceClean?: boolean | undefined) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Clean up the config of an animation, but the canvas won't cleaned up.
|
|
73
|
+
* @param config The config to be cleaned up.
|
|
74
|
+
* @param skipPaint Skip painting.
|
|
75
|
+
* @param forceClean Force clear the painting.
|
|
76
|
+
*/
|
|
77
|
+
cleanUpAnimationUnit: (config: Config, skipPaint?: boolean | undefined, forceClean?: boolean | undefined) => void;
|
|
78
|
+
getRevealAnimationConfig: () => Config | null;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
77
81
|
//# sourceMappingURL=RevealBoundryStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RevealBoundryStore.d.ts","sourceRoot":"","sources":["../src/RevealBoundryStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,aAAK,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;AAEvC,qBAAa,mBAAmB;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,WAAW,CAAC;IAGvB,OAAO,SAAS;IAChB,OAAO,SAAS;IAGhB,cAAc,SAAS;IACvB,cAAc,SAAS;IAEvB,eAAe,UAAS;IACxB,UAAU,EAAE,MAAM,EAAE,CAAM;IAE1B,cAAc,EAAE,MAAM,EAAE,CAAM;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;IAErC,cAAc,OAAQ;IACtB,cAAc,OAAQ;IACtB,0BAA0B,OAAQ;IAClC,4BAA4B,OAAQ;IACpC,6BAA6B,OAAQ;IACrC,0BAA0B,OAAQ;IAClC,YAAY,UAAS;IACrB,aAAa,UAAS;IAEtB,SAAS,SAAM;IAEf,uBAAuB,UAAS;gBAEpB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW;IAKxC,SAAS,aAAc,iBAAiB,GAAG,UAAU,cAAc,WAAW,UAiB5E;IAEF,YAAY,QAAS,iBAAiB,GAAG,UAAU,UAIjD;IAEF,eAAe,MAAO,MAAM,UAE1B;IAEF,eAAe,0CAQb;IAEF,qBAAqB,MAAO,MAAM,KAAK,MAAM,UAc5C;
|
|
1
|
+
{"version":3,"file":"RevealBoundryStore.d.ts","sourceRoot":"","sources":["../src/RevealBound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