@ax-design/reveal-highlight 0.3.0-alpha.8 → 0.4.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 +8 -167
- package/build/BaseConfig.d.ts +43 -0
- package/build/BaseConfig.d.ts.map +1 -0
- package/build/CanvasConfig.d.ts +7 -92
- package/build/CanvasConfig.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 +50 -10
- package/build/RevealBoundryStore.d.ts.map +1 -1
- package/build/RevealStateManager.d.ts +3 -0
- package/build/RevealStateManager.d.ts.map +1 -1
- package/build/SvgConfig.d.ts +17 -0
- package/build/SvgConfig.d.ts.map +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/main.js +169 -17
- package/build/utils/extractRGBValue.d.ts +2 -0
- package/build/utils/extractRGBValue.d.ts.map +1 -0
- package/build/utils/isValidateBorderDecorationType.d.ts +3 -0
- package/build/utils/isValidateBorderDecorationType.d.ts.map +1 -0
- package/build/utils/types.d.ts +103 -0
- package/build/utils/types.d.ts.map +1 -0
- package/es/BaseConfig.d.ts +43 -0
- package/es/BaseConfig.d.ts.map +1 -0
- package/es/BaseConfig.js +220 -0
- package/es/BaseConfig.js.map +1 -0
- package/es/CanvasConfig.d.ts +7 -92
- package/es/CanvasConfig.d.ts.map +1 -1
- package/es/CanvasConfig.js +35 -233
- package/es/CanvasConfig.js.map +1 -1
- package/es/CustomElements.d.ts +20 -4
- package/es/CustomElements.d.ts.map +1 -1
- package/es/CustomElements.js +115 -18
- package/es/CustomElements.js.map +1 -1
- package/es/RevealBoundryStore.d.ts +50 -10
- package/es/RevealBoundryStore.d.ts.map +1 -1
- package/es/RevealBoundryStore.js +129 -35
- package/es/RevealBoundryStore.js.map +1 -1
- package/es/RevealStateManager.d.ts +3 -0
- package/es/RevealStateManager.d.ts.map +1 -1
- package/es/RevealStateManager.js +43 -8
- package/es/RevealStateManager.js.map +1 -1
- package/es/SvgConfig.d.ts +17 -0
- package/es/SvgConfig.d.ts.map +1 -0
- package/es/SvgConfig.js +346 -0
- package/es/SvgConfig.js.map +1 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +10 -16
- package/es/index.js.map +1 -1
- package/es/tsconfig.tsbuildinfo +1 -0
- package/es/utils/extractRGBValue.d.ts +2 -0
- package/es/utils/extractRGBValue.d.ts.map +1 -0
- package/es/utils/extractRGBValue.js +48 -0
- package/es/utils/extractRGBValue.js.map +1 -0
- package/es/utils/isValidateBorderDecorationType.d.ts +3 -0
- package/es/utils/isValidateBorderDecorationType.d.ts.map +1 -0
- package/es/utils/isValidateBorderDecorationType.js +10 -0
- package/es/utils/isValidateBorderDecorationType.js.map +1 -0
- package/es/utils/types.d.ts +103 -0
- package/es/utils/types.d.ts.map +1 -0
- package/es/utils/types.js +2 -0
- package/es/utils/types.js.map +1 -0
- package/package.json +35 -30
- package/src/BaseConfig.ts +311 -0
- package/src/CanvasConfig.ts +66 -380
- package/src/CustomElements.ts +137 -29
- package/src/RevealBoundryStore.ts +138 -39
- package/src/RevealStateManager.ts +48 -10
- package/src/SvgConfig.ts +422 -0
- package/src/index.ts +10 -16
- package/src/utils/extractRGBValue.ts +58 -0
- package/src/utils/isValidateBorderDecorationType.ts +8 -0
- package/src/utils/types.ts +106 -0
- package/.prettierrc +0 -6
- package/.travis.yml +0 -26
- package/.yarnrc.yml +0 -1
- package/docs/demo/debug.html +0 -73
- package/docs/demo/index.html +0 -1065
- package/docs/demo/performance-inspector.html +0 -60
- package/docs/demo/shapes-demo.html +0 -93
- package/docs/demo/single-unit.html +0 -39
- package/docs/logo.png +0 -0
- package/docs/logo.svg +0 -1
- package/docs/screen-record.gif +0 -0
- package/docs/src/logo.afdesign +0 -0
- package/rollup.config.js +0 -14
- package/tsconfig.json +0 -18
package/README.md
CHANGED
|
@@ -37,7 +37,10 @@ require('@ax-design/reveal-highlight').register();
|
|
|
37
37
|
|
|
38
38
|
//ESModule
|
|
39
39
|
import { register } from '@ax-design/reveal-highlight';
|
|
40
|
-
register(
|
|
40
|
+
register({
|
|
41
|
+
compat: true,
|
|
42
|
+
borderDetectionMode: 'experimentalAutoFit',
|
|
43
|
+
});
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
## Usage
|
|
@@ -66,170 +69,8 @@ Here's an example:
|
|
|
66
69
|
|
|
67
70
|
## Style Controlling
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
* Checkout this living example for detailed usage:
|
|
73
|
+
https://ax-design.github.io/playground/?path=/story/components-fundamental-elements-reveal-highlight--basic
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
#### --reveal-color
|
|
74
|
-
|
|
75
|
-
**Type:** `<color>`
|
|
76
|
-
|
|
77
|
-
**Default:** `rgb(0, 0, 0)`
|
|
78
|
-
|
|
79
|
-
**Description:** The color of the reveal highlight, could RGB value or hex value.
|
|
80
|
-
|
|
81
|
-
#### --reveal-diffuse
|
|
82
|
-
|
|
83
|
-
**Type:** `<boolean>`
|
|
84
|
-
|
|
85
|
-
**Default:** `true`
|
|
86
|
-
|
|
87
|
-
**Description:** Control the behavior while pointer not in the reveal highlight element, if setted to `false`, nothing will be rendered; if setted to `true`, border will be rendered.
|
|
88
|
-
|
|
89
|
-
### Border
|
|
90
|
-
|
|
91
|
-
#### --reveal-border-color
|
|
92
|
-
|
|
93
|
-
**Type:** `<color>`
|
|
94
|
-
|
|
95
|
-
**Default:** `rgb(-1, -1, -1)`
|
|
96
|
-
|
|
97
|
-
**Description:** The color of the hover light.
|
|
98
|
-
|
|
99
|
-
**Magic Number:** If the value equals to `rgb(-1, -1, -1)`, the value of `--reveal-color`. It looks weired, but it is constrained by the CSS Typed OM specification.
|
|
100
|
-
|
|
101
|
-
#### --reveal-border-fill-radius
|
|
102
|
-
|
|
103
|
-
**Type:** `<number>`
|
|
104
|
-
|
|
105
|
-
**Default:** `1.5`
|
|
106
|
-
|
|
107
|
-
**Description:** Radius of the border gradient, please notice that this value is a number but not length.
|
|
108
|
-
|
|
109
|
-
#### --reveal-border-width
|
|
110
|
-
|
|
111
|
-
**Type:** `<number>`
|
|
112
|
-
|
|
113
|
-
**Default:** `1`
|
|
114
|
-
|
|
115
|
-
**Description:** Border width in `px`.
|
|
116
|
-
|
|
117
|
-
#### --reveal-border-decoration-type
|
|
118
|
-
|
|
119
|
-
**Type:** `'miter' | 'round' | bevel`
|
|
120
|
-
|
|
121
|
-
**Default:** `miter`
|
|
122
|
-
|
|
123
|
-
**Description:** The shape of border radius, the same as possible values of `lineJoin`, checkout [this document](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
|
|
124
|
-
|
|
125
|
-
#### --reveal-border-decoration-radius
|
|
126
|
-
|
|
127
|
-
**Type:** `<length>`
|
|
128
|
-
|
|
129
|
-
**Default:** `4px`
|
|
130
|
-
|
|
131
|
-
**Description:** The radius of border radius, if `--reveal-border-decoration-type` is `miter`, nothing would happen.
|
|
132
|
-
|
|
133
|
-
**Note:** To control each corner, use `--reveal-border-decoration-top-left-radius`, `--reveal-border-decoration-top-right-radius`, `--reveal-border-decoration-bottom-left-radius`, `--reveal-border-decoration-bottom-right-radius`, if the value of these values are negative, `--reveal-border-decoration-radius` would be used.
|
|
134
|
-
|
|
135
|
-
#### --reveal-border-style
|
|
136
|
-
|
|
137
|
-
**Type:** `'full' | 'half'`
|
|
138
|
-
|
|
139
|
-
**Default:** `'full'`
|
|
140
|
-
|
|
141
|
-
**Description:** If `full` provided, there'll be four sides of the element will have a light effect, if `half` provided, only the top and bottom side will have a light effect.
|
|
142
|
-
|
|
143
|
-
### Hover light
|
|
144
|
-
|
|
145
|
-
Hover light is the light effect shown up when you hover on the reveal element, it will fill the whole element.
|
|
146
|
-
|
|
147
|
-
#### --reveal-hover-light
|
|
148
|
-
|
|
149
|
-
**Type:** `<boolean>`
|
|
150
|
-
|
|
151
|
-
**Default:** `true`
|
|
152
|
-
|
|
153
|
-
**Description:** Enable the hover light or not.
|
|
154
|
-
|
|
155
|
-
#### --reveal-hover-light-color
|
|
156
|
-
|
|
157
|
-
**Type:** `<color>`
|
|
158
|
-
|
|
159
|
-
**Default:** `rgb(-1, -1, -1)`
|
|
160
|
-
|
|
161
|
-
**Description:** The color of the hover light.
|
|
162
|
-
|
|
163
|
-
**Magic Number:** If the value equals to `rgb(-1, -1, -1)`, the value of `--reveal-color`.
|
|
164
|
-
|
|
165
|
-
#### --reveal-hover-light-fill-radius
|
|
166
|
-
|
|
167
|
-
**Type:** `<number>`
|
|
168
|
-
|
|
169
|
-
**Default:** `1.5`
|
|
170
|
-
|
|
171
|
-
**Description:** Radius of the highlight gradient, please notice that this value is a number but not length.
|
|
172
|
-
|
|
173
|
-
#### --reveal-hover-light-fill-radius-mode
|
|
174
|
-
|
|
175
|
-
**Type:** `'relative' | 'absolute'`
|
|
176
|
-
|
|
177
|
-
**Default:** `relative`
|
|
178
|
-
|
|
179
|
-
**Description:** How the program calculating the radius of gradient, if `relative` provided, gradient radius will be:
|
|
180
|
-
|
|
181
|
-
- `r(border) = min(width, height) * fillRadius`
|
|
182
|
-
- `r(fill) = max(width, height) * fillRadius`
|
|
183
|
-
|
|
184
|
-
If `absolute` provided, gradient will be:
|
|
185
|
-
|
|
186
|
-
- `r(border) = fillRadius`
|
|
187
|
-
- `r(fill) = fillRadius`
|
|
188
|
-
|
|
189
|
-
the unit is pixel.
|
|
190
|
-
|
|
191
|
-
### Animation
|
|
192
|
-
|
|
193
|
-
When you pressed on the reveal highlight element, a ripple will show up.
|
|
194
|
-
|
|
195
|
-
#### --reveal-press-animation
|
|
196
|
-
|
|
197
|
-
**Type:** `<boolean>`
|
|
198
|
-
|
|
199
|
-
**Default:** `true`
|
|
200
|
-
|
|
201
|
-
**Description:** Enable the pressed animation or not.
|
|
202
|
-
|
|
203
|
-
#### --reveal-press-animation-color
|
|
204
|
-
|
|
205
|
-
**Type:** `<color>`
|
|
206
|
-
|
|
207
|
-
**Default:** `rgb(-1, -1, -1)`
|
|
208
|
-
|
|
209
|
-
**Description:** The color of the hover light, could be rgb value or hex.
|
|
210
|
-
|
|
211
|
-
**Magic Number:** If the value equals to `rgb(-1, -1, -1)`, the value of `--reveal-color`.
|
|
212
|
-
|
|
213
|
-
#### --reveal-press-animation-fill-mode
|
|
214
|
-
|
|
215
|
-
**Type:** `'cover' | 'constrained'`
|
|
216
|
-
|
|
217
|
-
**Default:** `cover`
|
|
218
|
-
|
|
219
|
-
**Description:** The filling mode of pressed animation, when using `cover`, the radius of pressed animation would be `max(width, height)`, when using `constrained`, it would be the radius of the hover light.
|
|
220
|
-
|
|
221
|
-
#### --reveal-press-animation-speed
|
|
222
|
-
|
|
223
|
-
**Type:** `<number>`
|
|
224
|
-
|
|
225
|
-
**Default:** `2000`
|
|
226
|
-
|
|
227
|
-
**Description:** The duration of the animation being played when the mouse is held down by the element.
|
|
228
|
-
|
|
229
|
-
#### --reveal-release-animation-accelerate-rate
|
|
230
|
-
|
|
231
|
-
**Type:** `<number>`
|
|
232
|
-
|
|
233
|
-
**Default:** `6`
|
|
234
|
-
|
|
235
|
-
**Description:** The acceleration rate of the animation when the mouse is released.
|
|
75
|
+
* And here're the source code:
|
|
76
|
+
https://github.com/ax-design/ax-design.github.io/blob/master/stories/templates/RevealHighlight.ts
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComputedStyleStorage } from './ComputedStyleStorage.js';
|
|
2
|
+
import { RevealBoundaryStore } from './RevealBoundryStore.js';
|
|
3
|
+
import type { CachedBoundingRect, CachedStyle } from './utils/types.js';
|
|
4
|
+
export declare class BaseConfig<T extends Element> {
|
|
5
|
+
protected _store: RevealBoundaryStore;
|
|
6
|
+
pxRatio: number;
|
|
7
|
+
readonly container: HTMLElement;
|
|
8
|
+
readonly element: T;
|
|
9
|
+
protected readonly computedStyle: ComputedStyleStorage;
|
|
10
|
+
paintedWidth: number;
|
|
11
|
+
paintedHeight: number;
|
|
12
|
+
currentFrameId: number;
|
|
13
|
+
cachedBoundingRectFrameId: number;
|
|
14
|
+
cachedBoundingRect: CachedBoundingRect;
|
|
15
|
+
cachedStyleFrameId: number;
|
|
16
|
+
cachedStyle: CachedStyle;
|
|
17
|
+
dirty: boolean;
|
|
18
|
+
shapeDirty: boolean;
|
|
19
|
+
fillDirty: boolean;
|
|
20
|
+
animationDirty: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If is cleaned up by `RevealBoundaryStore` during animation
|
|
23
|
+
* duration checkup.
|
|
24
|
+
*/
|
|
25
|
+
cleanedUpForAnimation: boolean;
|
|
26
|
+
mouseUpClientX: number | null;
|
|
27
|
+
mouseUpClientY: number | null;
|
|
28
|
+
mouseDownAnimateStartFrame: number | null;
|
|
29
|
+
mouseDownAnimateCurrentFrame: number | null;
|
|
30
|
+
mouseDownAnimateReleasedFrame: number | null;
|
|
31
|
+
mouseDownAnimateLogicFrame: number | null;
|
|
32
|
+
mousePressed: boolean;
|
|
33
|
+
mouseReleased: boolean;
|
|
34
|
+
constructor(store: RevealBoundaryStore, $canvas: T, $container: HTMLElement);
|
|
35
|
+
cacheBoundingRect: () => void;
|
|
36
|
+
getTrueFillRadius: (trueFillRadius?: [number, number], fillMode?: string) => [number, number];
|
|
37
|
+
getPropFromMultipleSource: (domPropsName: string, cssPropsName: string) => string;
|
|
38
|
+
getNumberPropFromMultipleSource: (domPropsName: string, cssPropsName: string) => number;
|
|
39
|
+
cacheCanvasPaintingStyle: () => void;
|
|
40
|
+
mouseInCanvas: () => boolean;
|
|
41
|
+
syncSizeToRevealRadius: (x: HTMLCanvasElement, factor: number) => void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=BaseConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseConfig.d.ts","sourceRoot":"","sources":["../src/BaseConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAiB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,mB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,iBAAkB,MAAM,gBAAgB,MAAM,YAK3E;IAEF,wBAAwB,aA8ItB;IAEF,aAAa,gBAOX;IAEF,sBAAsB,MAAO,iBAAiB,UAAU,MAAM,UAU5D;CACL"}
|
package/build/CanvasConfig.d.ts
CHANGED
|
@@ -1,101 +1,16 @@
|
|
|
1
1
|
import { RevealBoundaryStore } from './RevealBoundryStore.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
left: number;
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
}
|
|
9
|
-
export interface CachedStyle {
|
|
10
|
-
color: string;
|
|
11
|
-
opacity: number;
|
|
12
|
-
trueFillRadius: [number, number];
|
|
13
|
-
borderStyle: string;
|
|
14
|
-
borderColor: string;
|
|
15
|
-
borderFillRadius: number;
|
|
16
|
-
borderDecorationType: BorderDecoration;
|
|
17
|
-
borderDecorationRadius: number;
|
|
18
|
-
topLeftBorderDecorationRadius: number;
|
|
19
|
-
topRightBorderDecorationRadius: number;
|
|
20
|
-
bottomLeftBorderDecorationRadius: number;
|
|
21
|
-
bottomRightBorderDecorationRadius: number;
|
|
22
|
-
withLeftBorderFactor: number;
|
|
23
|
-
withRightBorderFactor: number;
|
|
24
|
-
withTopBorderFactor: number;
|
|
25
|
-
withBottomBorderFactor: number;
|
|
26
|
-
borderWidth: number;
|
|
27
|
-
hoverLight: boolean;
|
|
28
|
-
hoverLightColor: string;
|
|
29
|
-
hoverLightFillMode: string;
|
|
30
|
-
hoverLightFillRadius: number;
|
|
31
|
-
diffuse: boolean;
|
|
32
|
-
pressAnimation: boolean;
|
|
33
|
-
pressAnimationFillMode: string;
|
|
34
|
-
pressAnimationColor: string;
|
|
35
|
-
pressAnimationSpeed: number;
|
|
36
|
-
releaseAnimationAccelerateRate: number;
|
|
37
|
-
}
|
|
38
|
-
interface CachedReveal {
|
|
39
|
-
radius: number;
|
|
40
|
-
radiusFactor: number;
|
|
41
|
-
color: string;
|
|
42
|
-
opacity: number;
|
|
43
|
-
pattern: CanvasPattern | null;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Cached border and body pattern, for faster painting on the canvas.
|
|
47
|
-
* @interface CachedRevealBitmap
|
|
48
|
-
*/
|
|
49
|
-
export interface CachedRevealBitmap {
|
|
50
|
-
cachedReveal: {
|
|
51
|
-
borderReveal: CachedReveal;
|
|
52
|
-
fillReveal: CachedReveal;
|
|
53
|
-
};
|
|
54
|
-
cachedCanvas: {
|
|
55
|
-
borderReveal: HTMLCanvasElement;
|
|
56
|
-
fillReveal: HTMLCanvasElement;
|
|
57
|
-
};
|
|
58
|
-
cachedCtx: {
|
|
59
|
-
borderReveal: CanvasRenderingContext2D | null;
|
|
60
|
-
fillReveal: CanvasRenderingContext2D | null;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export declare class CanvasConfig {
|
|
64
|
-
protected _store: RevealBoundaryStore;
|
|
65
|
-
pxRatio: number;
|
|
66
|
-
readonly container: HTMLElement;
|
|
67
|
-
readonly canvas: HTMLCanvasElement;
|
|
2
|
+
import type { CachedRevealBitmap } from './utils/types.js';
|
|
3
|
+
import { BaseConfig } from './BaseConfig.js';
|
|
4
|
+
export declare class CanvasConfig extends BaseConfig<HTMLCanvasElement> {
|
|
68
5
|
ctx: CanvasRenderingContext2D | null;
|
|
69
|
-
private readonly computedStyle;
|
|
70
|
-
paintedWidth: number;
|
|
71
|
-
paintedHeight: number;
|
|
72
6
|
protected cachedImg: CachedRevealBitmap;
|
|
73
|
-
currentFrameId: number;
|
|
74
|
-
cachedBoundingRectFrameId: number;
|
|
75
|
-
cachedBoundingRect: CachedBoundingRect;
|
|
76
|
-
cachedStyleFrameId: number;
|
|
77
|
-
cachedStyle: CachedStyle;
|
|
78
|
-
mouseUpClientX: number | null;
|
|
79
|
-
mouseUpClientY: number | null;
|
|
80
|
-
mouseDownAnimateStartFrame: number | null;
|
|
81
|
-
mouseDownAnimateCurrentFrame: number | null;
|
|
82
|
-
mouseDownAnimateReleasedFrame: number | null;
|
|
83
|
-
mouseDownAnimateLogicFrame: number | null;
|
|
84
|
-
mousePressed: boolean;
|
|
85
|
-
mouseReleased: boolean;
|
|
86
7
|
constructor(store: RevealBoundaryStore, $canvas: HTMLCanvasElement, $container: HTMLElement);
|
|
87
|
-
cacheBoundingRect: () => void;
|
|
88
|
-
getTrueFillRadius: (trueFillRadius?: [number, number], fillMode?: string) => [number, number];
|
|
89
|
-
getPropFromMultipleSource: (domPropsName: string, cssPropsName: string) => string;
|
|
90
|
-
cacheCanvasPaintingStyle: () => void;
|
|
91
8
|
updateCachedReveal: () => void;
|
|
92
9
|
updateCachedBitmap: () => void;
|
|
93
|
-
|
|
94
|
-
syncSizeToElement: (x: HTMLCanvasElement) => void;
|
|
95
|
-
syncSizeToRevealRadius: (x: HTMLCanvasElement, factor: number) => void;
|
|
96
|
-
updateAnimateGrd: (frame: number, grd: CanvasGradient) => void;
|
|
10
|
+
private updateAnimateGrd;
|
|
97
11
|
private drawShape;
|
|
98
|
-
|
|
12
|
+
syncSizeToElement: (x: HTMLCanvasElement) => void;
|
|
13
|
+
clear: () => boolean;
|
|
14
|
+
paint: (skipSamePointerPositionCheck?: boolean | undefined) => boolean;
|
|
99
15
|
}
|
|
100
|
-
export {};
|
|
101
16
|
//# sourceMappingURL=CanvasConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasConfig.d.ts","sourceRoot":"","sources":["../src/CanvasConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CanvasConfig.d.ts","sourceRoot":"","sources":["../src/CanvasConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,qBAAa,YAAa,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,GAAG,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAErC,SAAS,CAAC,SAAS,EAAE,kBAAkB,CAAC;gBAE5B,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW;IAqC3F,kBAAkB,aA0DhB;IAEF,kBAAkB,aAGhB;IAEF,OAAO,CAAC,gBAAgB,CAgBtB;IAEF,OAAO,CAAC,SAAS,CA8Hf;IAEF,iBAAiB,MAAO,iBAAiB,UASvC;IAEF,KAAK,gBAeJ;IAED,KAAK,0DAA6C,OAAO,CA4HvD;CACL"}
|
|
@@ -20,12 +20,16 @@ export declare class AxRevealBoundary extends PatchedHTMLElement {
|
|
|
20
20
|
private set storage(value);
|
|
21
21
|
waitForStorage(f: (storage: RevealBoundaryStore) => void): void;
|
|
22
22
|
private appendStorage;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Update the position of your pointer.
|
|
25
|
+
* @param ev Pointer event from the listener.
|
|
26
|
+
*/
|
|
27
|
+
updatePointerPosition: (ev: PointerEvent) => void;
|
|
24
28
|
handlePointerEnter: () => void;
|
|
25
29
|
handlePointerLeave: () => void;
|
|
26
|
-
handlePointerMove: (ev:
|
|
27
|
-
handlePointerUp: () => void;
|
|
28
|
-
handlePointerDown: (ev:
|
|
30
|
+
handlePointerMove: (ev: PointerEvent) => void;
|
|
31
|
+
handlePointerUp: (ev: PointerEvent) => void;
|
|
32
|
+
handlePointerDown: (ev: PointerEvent) => void;
|
|
29
33
|
connectedCallback(): void;
|
|
30
34
|
disconnectedCallback(): void;
|
|
31
35
|
constructor();
|
|
@@ -36,6 +40,18 @@ export declare class AxReveal extends PatchedHTMLElement {
|
|
|
36
40
|
private canvas;
|
|
37
41
|
private boundary;
|
|
38
42
|
adoptedCallback(): void;
|
|
43
|
+
handlePointerDown: (ev: PointerEvent) => void;
|
|
44
|
+
disconnectedCallback(): void;
|
|
45
|
+
connectedCallback(): void;
|
|
46
|
+
constructor();
|
|
47
|
+
}
|
|
48
|
+
export declare class AxRevealNg extends PatchedHTMLElement {
|
|
49
|
+
static readonly ElementName = "ax-reveal-ng";
|
|
50
|
+
private root;
|
|
51
|
+
private svg;
|
|
52
|
+
private boundary;
|
|
53
|
+
adoptedCallback(): void;
|
|
54
|
+
handlePointerDown: (ev: PointerEvent) => void;
|
|
39
55
|
disconnectedCallback(): void;
|
|
40
56
|
connectedCallback(): void;
|
|
41
57
|
constructor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomElements.d.ts","sourceRoot":"","sources":["../src/CustomElements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomElements.d.ts","sourceRoot":"","sources":["../src/CustomElements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAwB9D,QAAA,MAAM,kBAAkB;;;CAC+F,CAAC;AAExH,qBAAa,gBAAiB,SAAQ,kBAAkB;IACpD,MAAM,CAAC,QAAQ,CAAC,WAAW,wBAAwB;IACnD,QAAQ,CAAC,YAAY,qBAA4B;CACpD;AAED,qBAAa,gBAAiB,SAAQ,kBAAkB;IACpD,MAAM,CAAC,QAAQ,CAAC,WAAW,qBAAqB;IAEhD,MAAM,CAAC,QAAQ,CAAC,kBAAkB,mBAAmB;IACrD,MAAM,CAAC,QAAQ,CAAC,kBAAkB,mBAAmB;IACrD,MAAM,CAAC,QAAQ,CAAC,mBAAmB,oBAAoB;IAEvD,OAAO,CAAC,IAAI,CAAuC;IAEnD,MAAM,CAAC,QAAQ,CAAC,YAAY,qBAA4B;IAExD,OAAO,CAAC,QAAQ,CAAmC;IAEnD,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,KAAK,OAAO,QAoBlB;IAEM,cAAc,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI;IAQ/D,OAAO,CAAC,aAAa;IAWrB;;;OAGG;IACH,qBAAqB,OAAQ,YAAY,UAKvC;IAEF,kBAAkB,aAA4E;IAC9F,kBAAkB,aAA4E;IAC9F,iBAAiB,OATY,YAAY,UASM;IAC/C,eAAe,OAAQ,YAAY,UAMjC;IACF,iBAAiB,OAAQ,YAAY,UAI9B;IAEP,iBAAiB;IAWjB,oBAAoB;;CAWvB;AAED,qBAAa,QAAS,SAAQ,kBAAkB;IAC5C,MAAM,CAAC,QAAQ,CAAC,WAAW,eAAe;IAC1C,OAAO,CAAC,IAAI,CAAuC;IACnD,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,QAAQ,CAAoB;IAEpC,eAAe;IAKf,iBAAiB,OAAQ,YAAY,UAEnC;IAEF,oBAAoB;IAIpB,iBAAiB;;CAmCpB;AAED,qBAAa,UAAW,SAAQ,kBAAkB;IAC9C,MAAM,CAAC,QAAQ,CAAC,WAAW,kBAAkB;IAC7C,OAAO,CAAC,IAAI,CAAuC;IACnD,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,QAAQ,CAAoB;IAEpC,eAAe;IAKf,iBAAiB,OAAQ,YAAY,UAEnC;IAEF,oBAAoB;IAIpB,iBAAiB;;CAsDpB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CanvasConfig } from './CanvasConfig.js';
|
|
2
|
+
import { SvgConfig } from './SvgConfig.js';
|
|
3
|
+
declare type Config = CanvasConfig | SvgConfig;
|
|
2
4
|
export declare class RevealBoundaryStore {
|
|
3
5
|
id: number;
|
|
4
6
|
container: HTMLElement;
|
|
@@ -7,10 +9,9 @@ export declare class RevealBoundaryStore {
|
|
|
7
9
|
paintedClientX: number;
|
|
8
10
|
paintedClientY: number;
|
|
9
11
|
mouseInBoundary: boolean;
|
|
10
|
-
canvasList:
|
|
11
|
-
animationQueue:
|
|
12
|
+
canvasList: Config[];
|
|
13
|
+
animationQueue: Config[];
|
|
12
14
|
animationFrame: number | null;
|
|
13
|
-
dirty: boolean;
|
|
14
15
|
mouseUpClientX: null;
|
|
15
16
|
mouseUpClientY: null;
|
|
16
17
|
mouseDownAnimateStartFrame: null;
|
|
@@ -20,18 +21,57 @@ export declare class RevealBoundaryStore {
|
|
|
20
21
|
mousePressed: boolean;
|
|
21
22
|
mouseReleased: boolean;
|
|
22
23
|
maxRadius: number;
|
|
24
|
+
requestedAnimationFrame: boolean;
|
|
23
25
|
constructor(id: number, $el: HTMLElement);
|
|
24
|
-
addReveal: ($
|
|
25
|
-
removeReveal: ($el: HTMLCanvasElement) => void;
|
|
26
|
+
addReveal: ($element: HTMLCanvasElement | SVGElement, $container: HTMLElement) => void;
|
|
27
|
+
removeReveal: ($el: HTMLCanvasElement | SVGElement) => void;
|
|
26
28
|
updateMaxRadius: (x: number) => void;
|
|
27
|
-
|
|
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
|
+
*/
|
|
28
35
|
onPointerEnterBoundary: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Clear all canvas while user's pointer leave the bounary.
|
|
38
|
+
*/
|
|
29
39
|
onPointerLeaveBoundary: () => void;
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
*/
|
|
32
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
|
+
*/
|
|
33
60
|
switchAnimation: () => void;
|
|
34
|
-
|
|
35
|
-
|
|
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;
|
|
36
75
|
}
|
|
76
|
+
export {};
|
|
37
77
|
//# 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;
|
|
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,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
|
7
7
|
cachedMouseY: number;
|
|
8
8
|
constructor();
|
|
9
|
+
pointerLeaveScheduled: boolean;
|
|
10
|
+
handlePointerLeave: () => void;
|
|
11
|
+
handlePointerMove: (event: PointerEvent) => void;
|
|
9
12
|
traverseBoundaries: () => void;
|
|
10
13
|
newBoundary: ($el: HTMLElement) => RevealBoundaryStore;
|
|
11
14
|
removeBoundary: (store: RevealBoundaryStore) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RevealStateManager.d.ts","sourceRoot":"","sources":["../src/RevealStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAI9D,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,QAAQ,CAA6B;IAE7C,OAAO,CAAC,2BAA2B,CAAS;IAC5C,YAAY,SAAM;IAClB,YAAY,SAAM;;
|
|
1
|
+
{"version":3,"file":"RevealStateManager.d.ts","sourceRoot":"","sources":["../src/RevealStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAI9D,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,QAAQ,CAA6B;IAE7C,OAAO,CAAC,2BAA2B,CAAS;IAC5C,YAAY,SAAM;IAClB,YAAY,SAAM;;IA8BlB,qBAAqB,UAAS;IAE9B,kBAAkB,aAYjB;IAED,iBAAiB,UAAW,YAAY,UAQtC;IAEF,kBAAkB,aAKhB;IAEF,WAAW,QAAS,WAAW,yBAO7B;IAEF,cAAc,UAAW,mBAAmB,UAE1C;CACL"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RevealBoundaryStore } from './RevealBoundryStore.js';
|
|
2
|
+
import type { CachedRevealPath } from './utils/types.js';
|
|
3
|
+
import { BaseConfig } from './BaseConfig.js';
|
|
4
|
+
export declare class SvgConfig extends BaseConfig<SVGSVGElement> {
|
|
5
|
+
protected cachedImg: CachedRevealPath;
|
|
6
|
+
constructor(store: RevealBoundaryStore, $svg: SVGSVGElement, $container: HTMLElement);
|
|
7
|
+
updateCachedBitmap: () => void;
|
|
8
|
+
updateCachedReveal: () => void;
|
|
9
|
+
private updateAnimateGrd;
|
|
10
|
+
private updateGradientPosition;
|
|
11
|
+
private drawShape;
|
|
12
|
+
syncSizeToElement: (x: SVGSVGElement) => void;
|
|
13
|
+
clear: (forAnimation: boolean) => void;
|
|
14
|
+
private internalClear;
|
|
15
|
+
paint: (skipSamePointerPositionCheck?: boolean | undefined) => boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=SvgConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgConfig.d.ts","sourceRoot":"","sources":["../src/SvgConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,qBAAa,SAAU,SAAQ,UAAU,CAAC,aAAa,CAAC;IACpD,SAAS,CAAC,SAAS,EAAE,gBAAgB,CAAC;gBAE1B,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW;IAuDpF,kBAAkB,aACjB;IAED,kBAAkB,aA2BhB;IAEF,OAAO,CAAC,gBAAgB,CA0BtB;IAEF,OAAO,CAAC,sBAAsB,CAQ7B;IAED,OAAO,CAAC,SAAS,CAgJf;IAEF,iBAAiB,MAAO,aAAa,UASnC;IAEF,KAAK,iBAAkB,OAAO,UAI7B;IAED,OAAO,CAAC,aAAa,CAWpB;IAED,KAAK,0DAA6C,OAAO,CA8GvD;CACL"}
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,gCAAgC;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB,EAAE,YAAY,GAAG,qBAAqB,CAAC;CAC7D;AAID,wBAAgB,QAAQ,CAAC,EACrB,MAAc,EACd,mBAAkC,GACrC,EAAE,gCAAgC,QAqMlC"}
|