@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.
Files changed (74) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +75 -75
  3. package/build/BaseConfig.d.ts +5 -1
  4. package/build/BaseConfig.d.ts.map +1 -1
  5. package/build/CanvasConfig.d.ts +7 -1
  6. package/build/CanvasConfig.d.ts.map +1 -1
  7. package/build/ComputedStyleStorage.d.ts.map +1 -1
  8. package/build/CustomElements.d.ts +20 -4
  9. package/build/CustomElements.d.ts.map +1 -1
  10. package/build/RevealBoundryStore.d.ts +4 -0
  11. package/build/RevealBoundryStore.d.ts.map +1 -1
  12. package/build/RevealStateManager.d.ts +5 -1
  13. package/build/RevealStateManager.d.ts.map +1 -1
  14. package/build/main.js +113 -82
  15. package/build/utils/types.d.ts +2 -10
  16. package/build/utils/types.d.ts.map +1 -1
  17. package/es/BaseConfig.d.ts +46 -42
  18. package/es/BaseConfig.d.ts.map +1 -1
  19. package/es/BaseConfig.js +241 -219
  20. package/es/BaseConfig.js.map +1 -1
  21. package/es/CanvasConfig.d.ts +21 -15
  22. package/es/CanvasConfig.d.ts.map +1 -1
  23. package/es/CanvasConfig.js +332 -320
  24. package/es/CanvasConfig.js.map +1 -1
  25. package/es/ComputedStyleStorage.d.ts +8 -8
  26. package/es/ComputedStyleStorage.d.ts.map +1 -1
  27. package/es/ComputedStyleStorage.js +68 -58
  28. package/es/ComputedStyleStorage.js.map +1 -1
  29. package/es/CustomElements.d.ts +75 -59
  30. package/es/CustomElements.d.ts.map +1 -1
  31. package/es/CustomElements.js +296 -233
  32. package/es/CustomElements.js.map +1 -1
  33. package/es/Profiler.d.ts +12 -12
  34. package/es/Profiler.js +31 -31
  35. package/es/RevealBoundryStore.d.ts +80 -76
  36. package/es/RevealBoundryStore.d.ts.map +1 -1
  37. package/es/RevealBoundryStore.js +269 -248
  38. package/es/RevealBoundryStore.js.map +1 -1
  39. package/es/RevealStateManager.d.ts +19 -15
  40. package/es/RevealStateManager.d.ts.map +1 -1
  41. package/es/RevealStateManager.js +99 -73
  42. package/es/RevealStateManager.js.map +1 -1
  43. package/es/SvgConfig.d.ts +16 -16
  44. package/es/SvgConfig.js +345 -345
  45. package/es/config.d.ts +4 -4
  46. package/es/config.js +21 -21
  47. package/es/index.d.ts +5 -5
  48. package/es/index.js +205 -205
  49. package/es/tsconfig.tsbuildinfo +1 -1
  50. package/es/utils/extractRGBValue.d.ts +1 -1
  51. package/es/utils/extractRGBValue.js +47 -47
  52. package/es/utils/isValidateBorderDecorationType.d.ts +2 -2
  53. package/es/utils/isValidateBorderDecorationType.js +9 -9
  54. package/es/utils/types.d.ts +94 -102
  55. package/es/utils/types.d.ts.map +1 -1
  56. package/es/utils/types.js +1 -1
  57. package/es/variables.d.ts +1 -1
  58. package/es/variables.js +1 -1
  59. package/package.json +35 -34
  60. package/src/BaseConfig.ts +332 -310
  61. package/src/CanvasConfig.ts +420 -415
  62. package/src/ComputedStyleStorage.ts +102 -89
  63. package/src/CustomElements.ts +344 -272
  64. package/src/Profiler.ts +44 -44
  65. package/src/RevealBoundryStore.ts +315 -291
  66. package/src/RevealStateManager.ts +109 -86
  67. package/src/SvgConfig.ts +422 -422
  68. package/src/config.ts +26 -26
  69. package/src/cssTypedOM.d.ts +52 -52
  70. package/src/index.ts +219 -219
  71. package/src/utils/extractRGBValue.ts +58 -58
  72. package/src/utils/isValidateBorderDecorationType.ts +8 -8
  73. package/src/utils/types.ts +97 -105
  74. 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
- onPointerMoveOnScreen: (x: number, y: number) => true | undefined;
32
- /**
33
- * Repaint all canvas while user's pointer has entered the boundary.
34
- */
35
- onPointerEnterBoundary: () => void;
36
- /**
37
- * Clear all canvas while user's pointer leave the bounary.
38
- */
39
- onPointerLeaveBoundary: () => void;
40
- /**
41
- * The painting method that draw everything on your screen.
42
- * @param frame current frame index, if this value is 0, it means all canvas
43
- * should be cleaned.
44
- * @param skipSamePointerPositionCheck Literally.
45
- */
46
- private paintAll;
47
- /**
48
- * Clear all canvas.
49
- */
50
- clearAll: (forAnimation: boolean) => void;
51
- /**
52
- * This is the effect while user pressed on the reveal highlight,
53
- * the ripple start to spread slowly.
54
- */
55
- initializeAnimation: () => void;
56
- /**
57
- * This is the effect while user released it's pointer, the spreading
58
- * ripple animation will start to accelerate.
59
- */
60
- switchAnimation: () => void;
61
- /**
62
- * Cleanup all animations.
63
- * @param skipPaint Only cleanup data or also clean up the canvas
64
- * @param forceClean Clean the canvas or not
65
- */
66
- cleanupAnimation: (skipPaint?: boolean | undefined, forceClean?: boolean | undefined) => void;
67
- /**
68
- * Clean up the config of an animation, but the canvas won't cleaned up.
69
- * @param config The config to be cleaned up.
70
- * @param skipPaint Skip painting.
71
- * @param forceClean Force clear the painting.
72
- */
73
- cleanUpAnimationUnit: (config: Config, skipPaint?: boolean | undefined, forceClean?: boolean | undefined) => void;
74
- getRevealAnimationConfig: () => Config | null;
75
- }
76
- export {};
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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