@ax-design/reveal-highlight 0.4.1 → 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/LICENSE +21 -21
- package/README.md +75 -75
- package/build/RevealStateManager.d.ts.map +1 -1
- package/build/main.js +1 -1
- package/es/CustomElements.js +60 -60
- package/es/RevealStateManager.d.ts.map +1 -1
- package/es/RevealStateManager.js +8 -0
- package/es/RevealStateManager.js.map +1 -1
- package/es/SvgConfig.js +70 -70
- package/es/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -8
- package/src/BaseConfig.ts +310 -310
- package/src/CanvasConfig.ts +415 -415
- package/src/ComputedStyleStorage.ts +89 -89
- package/src/CustomElements.ts +272 -272
- package/src/Profiler.ts +44 -44
- package/src/RevealBoundryStore.ts +291 -291
- package/src/RevealStateManager.ts +86 -78
- 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 +105 -105
- package/src/variables.ts +1 -1
package/src/config.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
let borderDetectionMode: 'strictEdge' | 'experimentalAutoFit' = 'strictEdge';
|
|
2
|
-
|
|
3
|
-
let borderDetectionModeInitialized = false;
|
|
4
|
-
|
|
5
|
-
class InitializedError extends Error {
|
|
6
|
-
name = 'InitializedError';
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
super('Border detection mode has already been initialized.')
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const config = {
|
|
14
|
-
compat: false,
|
|
15
|
-
|
|
16
|
-
get borderDetectionMode() {
|
|
17
|
-
return borderDetectionMode
|
|
18
|
-
},
|
|
19
|
-
set borderDetectionMode(x) {
|
|
20
|
-
if (borderDetectionModeInitialized) {
|
|
21
|
-
throw new InitializedError;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
borderDetectionMode = x;
|
|
25
|
-
borderDetectionModeInitialized = true;
|
|
26
|
-
}
|
|
1
|
+
let borderDetectionMode: 'strictEdge' | 'experimentalAutoFit' = 'strictEdge';
|
|
2
|
+
|
|
3
|
+
let borderDetectionModeInitialized = false;
|
|
4
|
+
|
|
5
|
+
class InitializedError extends Error {
|
|
6
|
+
name = 'InitializedError';
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
super('Border detection mode has already been initialized.')
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const config = {
|
|
14
|
+
compat: false,
|
|
15
|
+
|
|
16
|
+
get borderDetectionMode() {
|
|
17
|
+
return borderDetectionMode
|
|
18
|
+
},
|
|
19
|
+
set borderDetectionMode(x) {
|
|
20
|
+
if (borderDetectionModeInitialized) {
|
|
21
|
+
throw new InitializedError;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
borderDetectionMode = x;
|
|
25
|
+
borderDetectionModeInitialized = true;
|
|
26
|
+
}
|
|
27
27
|
}
|
package/src/cssTypedOM.d.ts
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { Profiler } from './Profiler';
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
CSS: CSS;
|
|
5
|
-
// This is only for debug purpose, it won't appear on production env.
|
|
6
|
-
profiler: Profiler
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface HTMLElement {
|
|
10
|
-
attributeStyleMap: StylePropertyMap;
|
|
11
|
-
computedStyleMap(): StylePropertyMap;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface StylePropertyMap {
|
|
15
|
-
readonly size: number;
|
|
16
|
-
get(stylePropertyName: string): CSSStyleValue;
|
|
17
|
-
set(stylePropertyName: string, value: CSSStyleValue | string): void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface CSS {
|
|
21
|
-
px(value: number): CSSUnitValue;
|
|
22
|
-
registerProperty(rule: CSSPropertyRule): void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface CSSPropertyRule {
|
|
26
|
-
name: string;
|
|
27
|
-
syntax: string;
|
|
28
|
-
initialValue: string | number | CSSUnitValue;
|
|
29
|
-
inherits: boolean
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface CSSStyleValue {
|
|
33
|
-
toString(): string;
|
|
34
|
-
value: unknown;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface CSSUnitValue extends CSSStyleValue {
|
|
38
|
-
unit: string;
|
|
39
|
-
value: number
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface CSSColorValue extends CSSStyleValue {
|
|
43
|
-
red: number;
|
|
44
|
-
green: number;
|
|
45
|
-
blue: number;
|
|
46
|
-
alpha: number;
|
|
47
|
-
value: string
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface CSSKeywordValue extends CSSStyleValue {
|
|
51
|
-
value: string
|
|
52
|
-
}
|
|
1
|
+
import { Profiler } from './Profiler';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
CSS: CSS;
|
|
5
|
+
// This is only for debug purpose, it won't appear on production env.
|
|
6
|
+
profiler: Profiler
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface HTMLElement {
|
|
10
|
+
attributeStyleMap: StylePropertyMap;
|
|
11
|
+
computedStyleMap(): StylePropertyMap;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface StylePropertyMap {
|
|
15
|
+
readonly size: number;
|
|
16
|
+
get(stylePropertyName: string): CSSStyleValue;
|
|
17
|
+
set(stylePropertyName: string, value: CSSStyleValue | string): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface CSS {
|
|
21
|
+
px(value: number): CSSUnitValue;
|
|
22
|
+
registerProperty(rule: CSSPropertyRule): void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface CSSPropertyRule {
|
|
26
|
+
name: string;
|
|
27
|
+
syntax: string;
|
|
28
|
+
initialValue: string | number | CSSUnitValue;
|
|
29
|
+
inherits: boolean
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface CSSStyleValue {
|
|
33
|
+
toString(): string;
|
|
34
|
+
value: unknown;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CSSUnitValue extends CSSStyleValue {
|
|
38
|
+
unit: string;
|
|
39
|
+
value: number
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface CSSColorValue extends CSSStyleValue {
|
|
43
|
+
red: number;
|
|
44
|
+
green: number;
|
|
45
|
+
blue: number;
|
|
46
|
+
alpha: number;
|
|
47
|
+
value: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface CSSKeywordValue extends CSSStyleValue {
|
|
51
|
+
value: string
|
|
52
|
+
}
|
|
53
53
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
import { AxRevealProvider, AxRevealBoundary, AxReveal, AxRevealNg } from './CustomElements.js';
|
|
2
|
-
import { config } from './config.js';
|
|
3
|
-
import { MAGIC_DEFAULT_COLOR } from './variables.js';
|
|
4
|
-
|
|
5
|
-
function registerCustomElements() {
|
|
6
|
-
customElements.define(AxRevealProvider.ElementName, AxRevealProvider);
|
|
7
|
-
customElements.define(AxRevealBoundary.ElementName, AxRevealBoundary);
|
|
8
|
-
customElements.define(AxReveal.ElementName, AxReveal);
|
|
9
|
-
customElements.define(AxRevealNg.ElementName, AxRevealNg);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface AxRevealHighlightRegisterOptions {
|
|
13
|
-
compat: boolean;
|
|
14
|
-
borderDetectionMode: 'strictEdge' | 'experimentalAutoFit';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let registered = false;
|
|
18
|
-
|
|
19
|
-
export function register({
|
|
20
|
-
compat = false,
|
|
21
|
-
borderDetectionMode = 'strictEdge',
|
|
22
|
-
}: AxRevealHighlightRegisterOptions) {
|
|
23
|
-
if (registered) {
|
|
24
|
-
console.warn('You have already registered Ax RevealHighlight, please do not call this function repeatedly.');
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
config.borderDetectionMode = borderDetectionMode;
|
|
29
|
-
config.compat = compat;
|
|
30
|
-
registered = true;
|
|
31
|
-
|
|
32
|
-
if (window.CSS && window.CSS.registerProperty) {
|
|
33
|
-
window.CSS.registerProperty({
|
|
34
|
-
name: '--reveal-color',
|
|
35
|
-
syntax: '<color>',
|
|
36
|
-
initialValue: 'rgb(0, 0, 0)',
|
|
37
|
-
inherits: true,
|
|
38
|
-
});
|
|
39
|
-
window.CSS.registerProperty({
|
|
40
|
-
name: '--reveal-opacity',
|
|
41
|
-
syntax: '<number>',
|
|
42
|
-
initialValue: '0.26',
|
|
43
|
-
inherits: true,
|
|
44
|
-
});
|
|
45
|
-
window.CSS.registerProperty({
|
|
46
|
-
name: '--reveal-border-color',
|
|
47
|
-
syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
|
|
48
|
-
initialValue: MAGIC_DEFAULT_COLOR,
|
|
49
|
-
inherits: true,
|
|
50
|
-
});
|
|
51
|
-
window.CSS.registerProperty({
|
|
52
|
-
name: '--reveal-border-width',
|
|
53
|
-
syntax: '<length>',
|
|
54
|
-
initialValue: '1px',
|
|
55
|
-
inherits: true,
|
|
56
|
-
});
|
|
57
|
-
window.CSS.registerProperty({
|
|
58
|
-
name: '--reveal-border-fill-radius',
|
|
59
|
-
syntax: '<number>',
|
|
60
|
-
initialValue: '1.5',
|
|
61
|
-
inherits: true,
|
|
62
|
-
});
|
|
63
|
-
window.CSS.registerProperty({
|
|
64
|
-
name: '--reveal-border-decoration-type',
|
|
65
|
-
syntax: '<custom-ident>',
|
|
66
|
-
initialValue: 'miter',
|
|
67
|
-
inherits: true,
|
|
68
|
-
});
|
|
69
|
-
window.CSS.registerProperty({
|
|
70
|
-
name: '--reveal-border-decoration-radius',
|
|
71
|
-
syntax: '<length>',
|
|
72
|
-
initialValue: '0',
|
|
73
|
-
inherits: true,
|
|
74
|
-
});
|
|
75
|
-
window.CSS.registerProperty({
|
|
76
|
-
name: '--reveal-border-decoration-top-left-radius',
|
|
77
|
-
syntax: '<length>',
|
|
78
|
-
initialValue: '-1px',
|
|
79
|
-
inherits: true,
|
|
80
|
-
});
|
|
81
|
-
window.CSS.registerProperty({
|
|
82
|
-
name: '--reveal-border-decoration-top-right-radius',
|
|
83
|
-
syntax: '<length>',
|
|
84
|
-
initialValue: '-1px',
|
|
85
|
-
inherits: true,
|
|
86
|
-
});
|
|
87
|
-
window.CSS.registerProperty({
|
|
88
|
-
name: '--reveal-border-decoration-bottom-left-radius',
|
|
89
|
-
syntax: '<length>',
|
|
90
|
-
initialValue: '-1px',
|
|
91
|
-
inherits: true,
|
|
92
|
-
});
|
|
93
|
-
window.CSS.registerProperty({
|
|
94
|
-
name: '--reveal-border-decoration-bottom-right-radius',
|
|
95
|
-
syntax: '<length>',
|
|
96
|
-
initialValue: '-1px',
|
|
97
|
-
inherits: true,
|
|
98
|
-
});
|
|
99
|
-
window.CSS.registerProperty({
|
|
100
|
-
name: '--reveal-border-left-type',
|
|
101
|
-
syntax: '<custom-ident>',
|
|
102
|
-
initialValue: 'line',
|
|
103
|
-
inherits: true,
|
|
104
|
-
});
|
|
105
|
-
window.CSS.registerProperty({
|
|
106
|
-
name: '--reveal-border-right-type',
|
|
107
|
-
syntax: '<custom-ident>',
|
|
108
|
-
initialValue: 'line',
|
|
109
|
-
inherits: true,
|
|
110
|
-
});
|
|
111
|
-
window.CSS.registerProperty({
|
|
112
|
-
name: '--reveal-border-top-type',
|
|
113
|
-
syntax: '<custom-ident>',
|
|
114
|
-
initialValue: 'line',
|
|
115
|
-
inherits: true,
|
|
116
|
-
});
|
|
117
|
-
window.CSS.registerProperty({
|
|
118
|
-
name: '--reveal-border-bottom-type',
|
|
119
|
-
syntax: '<custom-ident>',
|
|
120
|
-
initialValue: 'line',
|
|
121
|
-
inherits: true,
|
|
122
|
-
});
|
|
123
|
-
window.CSS.registerProperty({
|
|
124
|
-
name: '--reveal-hover-light',
|
|
125
|
-
syntax: '<custom-ident>',
|
|
126
|
-
initialValue: 'true',
|
|
127
|
-
inherits: true,
|
|
128
|
-
});
|
|
129
|
-
window.CSS.registerProperty({
|
|
130
|
-
name: '--reveal-hover-light-color',
|
|
131
|
-
syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
|
|
132
|
-
initialValue: MAGIC_DEFAULT_COLOR,
|
|
133
|
-
inherits: true,
|
|
134
|
-
});
|
|
135
|
-
window.CSS.registerProperty({
|
|
136
|
-
name: '--reveal-hover-light-fill-radius',
|
|
137
|
-
syntax: '<number>',
|
|
138
|
-
initialValue: '1.5',
|
|
139
|
-
inherits: true,
|
|
140
|
-
});
|
|
141
|
-
window.CSS.registerProperty({
|
|
142
|
-
name: '--reveal-hover-light-fill-radius-mode',
|
|
143
|
-
syntax: '<custom-ident>',
|
|
144
|
-
initialValue: 'relative',
|
|
145
|
-
inherits: true,
|
|
146
|
-
});
|
|
147
|
-
window.CSS.registerProperty({
|
|
148
|
-
name: '--reveal-diffuse',
|
|
149
|
-
syntax: '<custom-ident>',
|
|
150
|
-
initialValue: 'true',
|
|
151
|
-
inherits: true,
|
|
152
|
-
});
|
|
153
|
-
window.CSS.registerProperty({
|
|
154
|
-
name: '--reveal-press-animation',
|
|
155
|
-
syntax: '<custom-ident>',
|
|
156
|
-
initialValue: 'true',
|
|
157
|
-
inherits: true,
|
|
158
|
-
});
|
|
159
|
-
window.CSS.registerProperty({
|
|
160
|
-
name: '--reveal-press-animation-color',
|
|
161
|
-
syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
|
|
162
|
-
initialValue: MAGIC_DEFAULT_COLOR,
|
|
163
|
-
inherits: true,
|
|
164
|
-
});
|
|
165
|
-
window.CSS.registerProperty({
|
|
166
|
-
name: '--reveal-press-animation-radius-mode',
|
|
167
|
-
syntax: '<custom-ident>',
|
|
168
|
-
initialValue: 'cover',
|
|
169
|
-
inherits: true,
|
|
170
|
-
});
|
|
171
|
-
window.CSS.registerProperty({
|
|
172
|
-
name: '--reveal-press-animation-speed',
|
|
173
|
-
syntax: '<number>',
|
|
174
|
-
initialValue: '2000',
|
|
175
|
-
inherits: true,
|
|
176
|
-
});
|
|
177
|
-
window.CSS.registerProperty({
|
|
178
|
-
name: '--reveal-release-animation-accelerate-rate',
|
|
179
|
-
syntax: '<number>',
|
|
180
|
-
initialValue: '6',
|
|
181
|
-
inherits: true,
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
registerCustomElements();
|
|
185
|
-
} else if (compat) {
|
|
186
|
-
const root = document.documentElement;
|
|
187
|
-
|
|
188
|
-
root.style.setProperty('--reveal-color', 'rgb(0, 0, 0)');
|
|
189
|
-
root.style.setProperty('--reveal-opacity', '0.26');
|
|
190
|
-
root.style.setProperty('--reveal-border-color', MAGIC_DEFAULT_COLOR);
|
|
191
|
-
root.style.setProperty('--reveal-border-width', '1px');
|
|
192
|
-
root.style.setProperty('--reveal-border-fill-radius', '1.5');
|
|
193
|
-
root.style.setProperty('--reveal-border-decoration-type', 'miter');
|
|
194
|
-
root.style.setProperty('--reveal-border-decoration-radius', '0');
|
|
195
|
-
root.style.setProperty('--reveal-border-decoration-top-left-radius', '-1');
|
|
196
|
-
root.style.setProperty('--reveal-border-decoration-top-right-radius', '-1');
|
|
197
|
-
root.style.setProperty('--reveal-border-decoration-bottom-left-radius', '-1');
|
|
198
|
-
root.style.setProperty('--reveal-border-decoration-bottom-right-radius', '-1');
|
|
199
|
-
root.style.setProperty('--reveal-border-left-type', 'line');
|
|
200
|
-
root.style.setProperty('--reveal-border-right-type', 'line');
|
|
201
|
-
root.style.setProperty('--reveal-border-top-type', 'line');
|
|
202
|
-
root.style.setProperty('--reveal-border-bottom-type', 'line');
|
|
203
|
-
root.style.setProperty('--reveal-hover-light', 'true');
|
|
204
|
-
root.style.setProperty('--reveal-hover-light-color', MAGIC_DEFAULT_COLOR);
|
|
205
|
-
root.style.setProperty('--reveal-hover-light-fill-radius', '1.5');
|
|
206
|
-
root.style.setProperty('--reveal-hover-light-fill-radius-mode', 'relative');
|
|
207
|
-
root.style.setProperty('--reveal-diffuse', 'true');
|
|
208
|
-
root.style.setProperty('--reveal-press-animation', 'true');
|
|
209
|
-
root.style.setProperty('--reveal-press-animation-radius-mode', 'cover');
|
|
210
|
-
root.style.setProperty('--reveal-press-animation-color', MAGIC_DEFAULT_COLOR);
|
|
211
|
-
root.style.setProperty('--reveal-press-animation-speed', '2000');
|
|
212
|
-
root.style.setProperty('--reveal-release-animation-accelerate-rate', '6');
|
|
213
|
-
|
|
214
|
-
registerCustomElements();
|
|
215
|
-
} else {
|
|
216
|
-
console.warn('Your browser do NOT support `CSS.registerProperty` method, registration failed!');
|
|
217
|
-
console.warn('If you are the developer, try using `register(true)` to support old browsers.');
|
|
218
|
-
}
|
|
219
|
-
}
|
|
1
|
+
import { AxRevealProvider, AxRevealBoundary, AxReveal, AxRevealNg } from './CustomElements.js';
|
|
2
|
+
import { config } from './config.js';
|
|
3
|
+
import { MAGIC_DEFAULT_COLOR } from './variables.js';
|
|
4
|
+
|
|
5
|
+
function registerCustomElements() {
|
|
6
|
+
customElements.define(AxRevealProvider.ElementName, AxRevealProvider);
|
|
7
|
+
customElements.define(AxRevealBoundary.ElementName, AxRevealBoundary);
|
|
8
|
+
customElements.define(AxReveal.ElementName, AxReveal);
|
|
9
|
+
customElements.define(AxRevealNg.ElementName, AxRevealNg);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AxRevealHighlightRegisterOptions {
|
|
13
|
+
compat: boolean;
|
|
14
|
+
borderDetectionMode: 'strictEdge' | 'experimentalAutoFit';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let registered = false;
|
|
18
|
+
|
|
19
|
+
export function register({
|
|
20
|
+
compat = false,
|
|
21
|
+
borderDetectionMode = 'strictEdge',
|
|
22
|
+
}: AxRevealHighlightRegisterOptions) {
|
|
23
|
+
if (registered) {
|
|
24
|
+
console.warn('You have already registered Ax RevealHighlight, please do not call this function repeatedly.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
config.borderDetectionMode = borderDetectionMode;
|
|
29
|
+
config.compat = compat;
|
|
30
|
+
registered = true;
|
|
31
|
+
|
|
32
|
+
if (window.CSS && window.CSS.registerProperty) {
|
|
33
|
+
window.CSS.registerProperty({
|
|
34
|
+
name: '--reveal-color',
|
|
35
|
+
syntax: '<color>',
|
|
36
|
+
initialValue: 'rgb(0, 0, 0)',
|
|
37
|
+
inherits: true,
|
|
38
|
+
});
|
|
39
|
+
window.CSS.registerProperty({
|
|
40
|
+
name: '--reveal-opacity',
|
|
41
|
+
syntax: '<number>',
|
|
42
|
+
initialValue: '0.26',
|
|
43
|
+
inherits: true,
|
|
44
|
+
});
|
|
45
|
+
window.CSS.registerProperty({
|
|
46
|
+
name: '--reveal-border-color',
|
|
47
|
+
syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
|
|
48
|
+
initialValue: MAGIC_DEFAULT_COLOR,
|
|
49
|
+
inherits: true,
|
|
50
|
+
});
|
|
51
|
+
window.CSS.registerProperty({
|
|
52
|
+
name: '--reveal-border-width',
|
|
53
|
+
syntax: '<length>',
|
|
54
|
+
initialValue: '1px',
|
|
55
|
+
inherits: true,
|
|
56
|
+
});
|
|
57
|
+
window.CSS.registerProperty({
|
|
58
|
+
name: '--reveal-border-fill-radius',
|
|
59
|
+
syntax: '<number>',
|
|
60
|
+
initialValue: '1.5',
|
|
61
|
+
inherits: true,
|
|
62
|
+
});
|
|
63
|
+
window.CSS.registerProperty({
|
|
64
|
+
name: '--reveal-border-decoration-type',
|
|
65
|
+
syntax: '<custom-ident>',
|
|
66
|
+
initialValue: 'miter',
|
|
67
|
+
inherits: true,
|
|
68
|
+
});
|
|
69
|
+
window.CSS.registerProperty({
|
|
70
|
+
name: '--reveal-border-decoration-radius',
|
|
71
|
+
syntax: '<length>',
|
|
72
|
+
initialValue: '0',
|
|
73
|
+
inherits: true,
|
|
74
|
+
});
|
|
75
|
+
window.CSS.registerProperty({
|
|
76
|
+
name: '--reveal-border-decoration-top-left-radius',
|
|
77
|
+
syntax: '<length>',
|
|
78
|
+
initialValue: '-1px',
|
|
79
|
+
inherits: true,
|
|
80
|
+
});
|
|
81
|
+
window.CSS.registerProperty({
|
|
82
|
+
name: '--reveal-border-decoration-top-right-radius',
|
|
83
|
+
syntax: '<length>',
|
|
84
|
+
initialValue: '-1px',
|
|
85
|
+
inherits: true,
|
|
86
|
+
});
|
|
87
|
+
window.CSS.registerProperty({
|
|
88
|
+
name: '--reveal-border-decoration-bottom-left-radius',
|
|
89
|
+
syntax: '<length>',
|
|
90
|
+
initialValue: '-1px',
|
|
91
|
+
inherits: true,
|
|
92
|
+
});
|
|
93
|
+
window.CSS.registerProperty({
|
|
94
|
+
name: '--reveal-border-decoration-bottom-right-radius',
|
|
95
|
+
syntax: '<length>',
|
|
96
|
+
initialValue: '-1px',
|
|
97
|
+
inherits: true,
|
|
98
|
+
});
|
|
99
|
+
window.CSS.registerProperty({
|
|
100
|
+
name: '--reveal-border-left-type',
|
|
101
|
+
syntax: '<custom-ident>',
|
|
102
|
+
initialValue: 'line',
|
|
103
|
+
inherits: true,
|
|
104
|
+
});
|
|
105
|
+
window.CSS.registerProperty({
|
|
106
|
+
name: '--reveal-border-right-type',
|
|
107
|
+
syntax: '<custom-ident>',
|
|
108
|
+
initialValue: 'line',
|
|
109
|
+
inherits: true,
|
|
110
|
+
});
|
|
111
|
+
window.CSS.registerProperty({
|
|
112
|
+
name: '--reveal-border-top-type',
|
|
113
|
+
syntax: '<custom-ident>',
|
|
114
|
+
initialValue: 'line',
|
|
115
|
+
inherits: true,
|
|
116
|
+
});
|
|
117
|
+
window.CSS.registerProperty({
|
|
118
|
+
name: '--reveal-border-bottom-type',
|
|
119
|
+
syntax: '<custom-ident>',
|
|
120
|
+
initialValue: 'line',
|
|
121
|
+
inherits: true,
|
|
122
|
+
});
|
|
123
|
+
window.CSS.registerProperty({
|
|
124
|
+
name: '--reveal-hover-light',
|
|
125
|
+
syntax: '<custom-ident>',
|
|
126
|
+
initialValue: 'true',
|
|
127
|
+
inherits: true,
|
|
128
|
+
});
|
|
129
|
+
window.CSS.registerProperty({
|
|
130
|
+
name: '--reveal-hover-light-color',
|
|
131
|
+
syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
|
|
132
|
+
initialValue: MAGIC_DEFAULT_COLOR,
|
|
133
|
+
inherits: true,
|
|
134
|
+
});
|
|
135
|
+
window.CSS.registerProperty({
|
|
136
|
+
name: '--reveal-hover-light-fill-radius',
|
|
137
|
+
syntax: '<number>',
|
|
138
|
+
initialValue: '1.5',
|
|
139
|
+
inherits: true,
|
|
140
|
+
});
|
|
141
|
+
window.CSS.registerProperty({
|
|
142
|
+
name: '--reveal-hover-light-fill-radius-mode',
|
|
143
|
+
syntax: '<custom-ident>',
|
|
144
|
+
initialValue: 'relative',
|
|
145
|
+
inherits: true,
|
|
146
|
+
});
|
|
147
|
+
window.CSS.registerProperty({
|
|
148
|
+
name: '--reveal-diffuse',
|
|
149
|
+
syntax: '<custom-ident>',
|
|
150
|
+
initialValue: 'true',
|
|
151
|
+
inherits: true,
|
|
152
|
+
});
|
|
153
|
+
window.CSS.registerProperty({
|
|
154
|
+
name: '--reveal-press-animation',
|
|
155
|
+
syntax: '<custom-ident>',
|
|
156
|
+
initialValue: 'true',
|
|
157
|
+
inherits: true,
|
|
158
|
+
});
|
|
159
|
+
window.CSS.registerProperty({
|
|
160
|
+
name: '--reveal-press-animation-color',
|
|
161
|
+
syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
|
|
162
|
+
initialValue: MAGIC_DEFAULT_COLOR,
|
|
163
|
+
inherits: true,
|
|
164
|
+
});
|
|
165
|
+
window.CSS.registerProperty({
|
|
166
|
+
name: '--reveal-press-animation-radius-mode',
|
|
167
|
+
syntax: '<custom-ident>',
|
|
168
|
+
initialValue: 'cover',
|
|
169
|
+
inherits: true,
|
|
170
|
+
});
|
|
171
|
+
window.CSS.registerProperty({
|
|
172
|
+
name: '--reveal-press-animation-speed',
|
|
173
|
+
syntax: '<number>',
|
|
174
|
+
initialValue: '2000',
|
|
175
|
+
inherits: true,
|
|
176
|
+
});
|
|
177
|
+
window.CSS.registerProperty({
|
|
178
|
+
name: '--reveal-release-animation-accelerate-rate',
|
|
179
|
+
syntax: '<number>',
|
|
180
|
+
initialValue: '6',
|
|
181
|
+
inherits: true,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
registerCustomElements();
|
|
185
|
+
} else if (compat) {
|
|
186
|
+
const root = document.documentElement;
|
|
187
|
+
|
|
188
|
+
root.style.setProperty('--reveal-color', 'rgb(0, 0, 0)');
|
|
189
|
+
root.style.setProperty('--reveal-opacity', '0.26');
|
|
190
|
+
root.style.setProperty('--reveal-border-color', MAGIC_DEFAULT_COLOR);
|
|
191
|
+
root.style.setProperty('--reveal-border-width', '1px');
|
|
192
|
+
root.style.setProperty('--reveal-border-fill-radius', '1.5');
|
|
193
|
+
root.style.setProperty('--reveal-border-decoration-type', 'miter');
|
|
194
|
+
root.style.setProperty('--reveal-border-decoration-radius', '0');
|
|
195
|
+
root.style.setProperty('--reveal-border-decoration-top-left-radius', '-1');
|
|
196
|
+
root.style.setProperty('--reveal-border-decoration-top-right-radius', '-1');
|
|
197
|
+
root.style.setProperty('--reveal-border-decoration-bottom-left-radius', '-1');
|
|
198
|
+
root.style.setProperty('--reveal-border-decoration-bottom-right-radius', '-1');
|
|
199
|
+
root.style.setProperty('--reveal-border-left-type', 'line');
|
|
200
|
+
root.style.setProperty('--reveal-border-right-type', 'line');
|
|
201
|
+
root.style.setProperty('--reveal-border-top-type', 'line');
|
|
202
|
+
root.style.setProperty('--reveal-border-bottom-type', 'line');
|
|
203
|
+
root.style.setProperty('--reveal-hover-light', 'true');
|
|
204
|
+
root.style.setProperty('--reveal-hover-light-color', MAGIC_DEFAULT_COLOR);
|
|
205
|
+
root.style.setProperty('--reveal-hover-light-fill-radius', '1.5');
|
|
206
|
+
root.style.setProperty('--reveal-hover-light-fill-radius-mode', 'relative');
|
|
207
|
+
root.style.setProperty('--reveal-diffuse', 'true');
|
|
208
|
+
root.style.setProperty('--reveal-press-animation', 'true');
|
|
209
|
+
root.style.setProperty('--reveal-press-animation-radius-mode', 'cover');
|
|
210
|
+
root.style.setProperty('--reveal-press-animation-color', MAGIC_DEFAULT_COLOR);
|
|
211
|
+
root.style.setProperty('--reveal-press-animation-speed', '2000');
|
|
212
|
+
root.style.setProperty('--reveal-release-animation-accelerate-rate', '6');
|
|
213
|
+
|
|
214
|
+
registerCustomElements();
|
|
215
|
+
} else {
|
|
216
|
+
console.warn('Your browser do NOT support `CSS.registerProperty` method, registration failed!');
|
|
217
|
+
console.warn('If you are the developer, try using `register(true)` to support old browsers.');
|
|
218
|
+
}
|
|
219
|
+
}
|