@ax-design/reveal-highlight 0.3.0-alpha.7 → 0.4.1

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 (92) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +76 -235
  3. package/build/BaseConfig.d.ts +43 -0
  4. package/build/BaseConfig.d.ts.map +1 -0
  5. package/build/CanvasConfig.d.ts +7 -92
  6. package/build/CanvasConfig.d.ts.map +1 -1
  7. package/build/CustomElements.d.ts +20 -4
  8. package/build/CustomElements.d.ts.map +1 -1
  9. package/build/RevealBoundryStore.d.ts +50 -10
  10. package/build/RevealBoundryStore.d.ts.map +1 -1
  11. package/build/RevealStateManager.d.ts +3 -0
  12. package/build/RevealStateManager.d.ts.map +1 -1
  13. package/build/SvgConfig.d.ts +17 -0
  14. package/build/SvgConfig.d.ts.map +1 -0
  15. package/build/index.d.ts.map +1 -1
  16. package/build/main.js +169 -17
  17. package/build/utils/extractRGBValue.d.ts +2 -0
  18. package/build/utils/extractRGBValue.d.ts.map +1 -0
  19. package/build/utils/isValidateBorderDecorationType.d.ts +3 -0
  20. package/build/utils/isValidateBorderDecorationType.d.ts.map +1 -0
  21. package/build/utils/types.d.ts +103 -0
  22. package/build/utils/types.d.ts.map +1 -0
  23. package/es/BaseConfig.d.ts +43 -0
  24. package/es/BaseConfig.d.ts.map +1 -0
  25. package/es/BaseConfig.js +220 -0
  26. package/es/BaseConfig.js.map +1 -0
  27. package/es/CanvasConfig.d.ts +7 -92
  28. package/es/CanvasConfig.d.ts.map +1 -1
  29. package/es/CanvasConfig.js +35 -233
  30. package/es/CanvasConfig.js.map +1 -1
  31. package/es/CustomElements.d.ts +20 -4
  32. package/es/CustomElements.d.ts.map +1 -1
  33. package/es/CustomElements.js +130 -33
  34. package/es/CustomElements.js.map +1 -1
  35. package/es/RevealBoundryStore.d.ts +50 -10
  36. package/es/RevealBoundryStore.d.ts.map +1 -1
  37. package/es/RevealBoundryStore.js +129 -35
  38. package/es/RevealBoundryStore.js.map +1 -1
  39. package/es/RevealStateManager.d.ts +3 -0
  40. package/es/RevealStateManager.d.ts.map +1 -1
  41. package/es/RevealStateManager.js +35 -8
  42. package/es/RevealStateManager.js.map +1 -1
  43. package/es/SvgConfig.d.ts +17 -0
  44. package/es/SvgConfig.d.ts.map +1 -0
  45. package/es/SvgConfig.js +346 -0
  46. package/es/SvgConfig.js.map +1 -0
  47. package/es/index.d.ts.map +1 -1
  48. package/es/index.js +12 -18
  49. package/es/index.js.map +1 -1
  50. package/es/tsconfig.tsbuildinfo +1 -0
  51. package/es/utils/extractRGBValue.d.ts +2 -0
  52. package/es/utils/extractRGBValue.d.ts.map +1 -0
  53. package/es/utils/extractRGBValue.js +48 -0
  54. package/es/utils/extractRGBValue.js.map +1 -0
  55. package/es/utils/isValidateBorderDecorationType.d.ts +3 -0
  56. package/es/utils/isValidateBorderDecorationType.d.ts.map +1 -0
  57. package/es/utils/isValidateBorderDecorationType.js +10 -0
  58. package/es/utils/isValidateBorderDecorationType.js.map +1 -0
  59. package/es/utils/types.d.ts +103 -0
  60. package/es/utils/types.d.ts.map +1 -0
  61. package/es/utils/types.js +2 -0
  62. package/es/utils/types.js.map +1 -0
  63. package/package.json +34 -30
  64. package/src/BaseConfig.ts +311 -0
  65. package/src/CanvasConfig.ts +415 -729
  66. package/src/ComputedStyleStorage.ts +89 -89
  67. package/src/CustomElements.ts +272 -164
  68. package/src/Profiler.ts +44 -44
  69. package/src/RevealBoundryStore.ts +291 -192
  70. package/src/RevealStateManager.ts +78 -48
  71. package/src/SvgConfig.ts +422 -0
  72. package/src/config.ts +26 -26
  73. package/src/cssTypedOM.d.ts +52 -52
  74. package/src/index.ts +219 -225
  75. package/src/utils/extractRGBValue.ts +58 -0
  76. package/src/utils/isValidateBorderDecorationType.ts +8 -0
  77. package/src/utils/types.ts +106 -0
  78. package/src/variables.ts +1 -1
  79. package/.prettierrc +0 -6
  80. package/.travis.yml +0 -26
  81. package/.yarnrc.yml +0 -1
  82. package/docs/demo/debug.html +0 -75
  83. package/docs/demo/index.html +0 -1065
  84. package/docs/demo/performance-inspector.html +0 -60
  85. package/docs/demo/shapes-demo.html +0 -93
  86. package/docs/demo/single-unit.html +0 -40
  87. package/docs/logo.png +0 -0
  88. package/docs/logo.svg +0 -1
  89. package/docs/screen-record.gif +0 -0
  90. package/docs/src/logo.afdesign +0 -0
  91. package/rollup.config.js +0 -14
  92. package/tsconfig.json +0 -18
@@ -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,225 +1,219 @@
1
- import { AxRevealProvider, AxRevealBoundary, AxReveal } 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
- }
10
-
11
- export interface AxRevealHighlightRegisterOptions {
12
- compat: boolean;
13
- borderDetectionMode: 'strictEdge' | 'experimentalAutoFit';
14
- }
15
-
16
- let registered = false;
17
-
18
- export function register({
19
- compat = false,
20
- borderDetectionMode = 'strictEdge',
21
- }: AxRevealHighlightRegisterOptions) {
22
- if (registered) {
23
- console.warn('You have already registered Ax RevealHighlight, please do not call this function repeatedly.');
24
- return;
25
- }
26
-
27
- config.borderDetectionMode = borderDetectionMode;
28
- config.compat = compat;
29
- registered = true;
30
-
31
- if (window.CSS && window.CSS.registerProperty) {
32
- window.CSS.registerProperty({
33
- name: '--reveal-color',
34
- syntax: '<color>',
35
- initialValue: 'rgb(0, 0, 0)',
36
- inherits: true,
37
- });
38
- window.CSS.registerProperty({
39
- name: '--reveal-opacity',
40
- syntax: '<number>',
41
- initialValue: '0.26',
42
- inherits: true,
43
- });
44
- window.CSS.registerProperty({
45
- name: '--reveal-border-style',
46
- syntax: '<custom-ident>',
47
- initialValue: 'full',
48
- inherits: true,
49
- });
50
- window.CSS.registerProperty({
51
- name: '--reveal-border-color',
52
- syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
53
- initialValue: MAGIC_DEFAULT_COLOR,
54
- inherits: true,
55
- });
56
- window.CSS.registerProperty({
57
- name: '--reveal-border-width',
58
- syntax: '<length>',
59
- initialValue: '1px',
60
- inherits: true,
61
- });
62
- window.CSS.registerProperty({
63
- name: '--reveal-border-fill-radius',
64
- syntax: '<number>',
65
- initialValue: '1.5',
66
- inherits: true,
67
- });
68
- window.CSS.registerProperty({
69
- name: '--reveal-border-decoration-type',
70
- syntax: '<custom-ident>',
71
- initialValue: 'miter',
72
- inherits: true,
73
- });
74
- window.CSS.registerProperty({
75
- name: '--reveal-border-decoration-radius',
76
- syntax: '<length>',
77
- initialValue: '4px',
78
- inherits: true,
79
- });
80
- window.CSS.registerProperty({
81
- name: '--reveal-border-decoration-top-left-radius',
82
- syntax: '<length>',
83
- initialValue: '-1px',
84
- inherits: true,
85
- });
86
- window.CSS.registerProperty({
87
- name: '--reveal-border-decoration-top-right-radius',
88
- syntax: '<length>',
89
- initialValue: '-1px',
90
- inherits: true,
91
- });
92
- window.CSS.registerProperty({
93
- name: '--reveal-border-decoration-bottom-left-radius',
94
- syntax: '<length>',
95
- initialValue: '-1px',
96
- inherits: true,
97
- });
98
- window.CSS.registerProperty({
99
- name: '--reveal-border-decoration-bottom-right-radius',
100
- syntax: '<length>',
101
- initialValue: '-1px',
102
- inherits: true,
103
- });
104
- window.CSS.registerProperty({
105
- name: '--reveal-border-left',
106
- syntax: '<custom-ident>',
107
- initialValue: 'line',
108
- inherits: true,
109
- });
110
- window.CSS.registerProperty({
111
- name: '--reveal-border-right',
112
- syntax: '<custom-ident>',
113
- initialValue: 'line',
114
- inherits: true,
115
- });
116
- window.CSS.registerProperty({
117
- name: '--reveal-border-top',
118
- syntax: '<custom-ident>',
119
- initialValue: 'line',
120
- inherits: true,
121
- });
122
- window.CSS.registerProperty({
123
- name: '--reveal-border-bottom',
124
- syntax: '<custom-ident>',
125
- initialValue: 'line',
126
- inherits: true,
127
- });
128
- window.CSS.registerProperty({
129
- name: '--reveal-hover-light',
130
- syntax: '<custom-ident>',
131
- initialValue: 'true',
132
- inherits: true,
133
- });
134
- window.CSS.registerProperty({
135
- name: '--reveal-hover-light-color',
136
- syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
137
- initialValue: MAGIC_DEFAULT_COLOR,
138
- inherits: true,
139
- });
140
- window.CSS.registerProperty({
141
- name: '--reveal-hover-light-fill-radius',
142
- syntax: '<number>',
143
- initialValue: '1.5',
144
- inherits: true,
145
- });
146
- window.CSS.registerProperty({
147
- name: '--reveal-hover-light-fill-radius-mode',
148
- syntax: '<custom-ident>',
149
- initialValue: 'relative',
150
- inherits: true,
151
- });
152
- window.CSS.registerProperty({
153
- name: '--reveal-diffuse',
154
- syntax: '<custom-ident>',
155
- initialValue: 'true',
156
- inherits: true,
157
- });
158
- window.CSS.registerProperty({
159
- name: '--reveal-press-animation',
160
- syntax: '<custom-ident>',
161
- initialValue: 'true',
162
- inherits: true,
163
- });
164
- window.CSS.registerProperty({
165
- name: '--reveal-press-animation-color',
166
- syntax: `<color>|${MAGIC_DEFAULT_COLOR}`,
167
- initialValue: MAGIC_DEFAULT_COLOR,
168
- inherits: true,
169
- });
170
- window.CSS.registerProperty({
171
- name: '--reveal-press-animation-radius-mode',
172
- syntax: '<custom-ident>',
173
- initialValue: 'cover',
174
- inherits: true,
175
- });
176
- window.CSS.registerProperty({
177
- name: '--reveal-press-animation-speed',
178
- syntax: '<number>',
179
- initialValue: '2000',
180
- inherits: true,
181
- });
182
- window.CSS.registerProperty({
183
- name: '--reveal-release-animation-accelerate-rate',
184
- syntax: '<number>',
185
- initialValue: '6',
186
- inherits: true,
187
- });
188
-
189
- registerCustomElements();
190
- } else if (compat) {
191
- const root = document.documentElement;
192
-
193
- root.style.setProperty('--reveal-color', 'rgb(0, 0, 0)');
194
- root.style.setProperty('--reveal-opacity', '0.26');
195
- root.style.setProperty('--reveal-border-style', 'full');
196
- root.style.setProperty('--reveal-border-color', MAGIC_DEFAULT_COLOR);
197
- root.style.setProperty('--reveal-border-width', '1px');
198
- root.style.setProperty('--reveal-border-fill-radius', '1.5');
199
- root.style.setProperty('--reveal-border-decoration-type', 'miter');
200
- root.style.setProperty('--reveal-border-decoration-radius', '4');
201
- root.style.setProperty('--reveal-border-decoration-top-left-radius', '-1');
202
- root.style.setProperty('--reveal-border-decoration-top-right-radius', '-1');
203
- root.style.setProperty('--reveal-border-decoration-bottom-left-radius', '-1');
204
- root.style.setProperty('--reveal-border-decoration-bottom-right-radius', '-1');
205
- root.style.setProperty('--reveal-border-left', 'line');
206
- root.style.setProperty('--reveal-border-right', 'line');
207
- root.style.setProperty('--reveal-border-top', 'line');
208
- root.style.setProperty('--reveal-border-bottom', 'line');
209
- root.style.setProperty('--reveal-hover-light', 'true');
210
- root.style.setProperty('--reveal-hover-light-color', MAGIC_DEFAULT_COLOR);
211
- root.style.setProperty('--reveal-hover-light-fill-radius', '1.5');
212
- root.style.setProperty('--reveal-hover-light-fill-radius-mode', 'relative');
213
- root.style.setProperty('--reveal-diffuse', 'true');
214
- root.style.setProperty('--reveal-press-animation', 'true');
215
- root.style.setProperty('--reveal-press-animation-radius-mode', 'cover');
216
- root.style.setProperty('--reveal-press-animation-color', MAGIC_DEFAULT_COLOR);
217
- root.style.setProperty('--reveal-press-animation-speed', '2000');
218
- root.style.setProperty('--reveal-release-animation-accelerate-rate', '6');
219
-
220
- registerCustomElements();
221
- } else {
222
- console.warn('Your browser do NOT support `CSS.registerProperty` method, registration failed!');
223
- console.warn('If you are the developer, try using `register(true)` to support old browsers.');
224
- }
225
- }
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
+ }
@@ -0,0 +1,58 @@
1
+ export const extractRGBValue = (x: string) => {
2
+ if (x === '') {
3
+ return '';
4
+ }
5
+
6
+ if (x[0] === '#') {
7
+ // Thanks bro:
8
+ // https://stackoverflow.com/a/11508164/3931936
9
+ const hexVal = parseInt(x.substring(1), 16);
10
+
11
+ var r = (hexVal >> 16) & 255;
12
+ var g = (hexVal >> 8) & 255;
13
+ var b = hexVal & 255;
14
+
15
+ return r + ',' + g + ',' + b;
16
+ } else {
17
+ let result = '';
18
+ let beginSearch = false;
19
+ let numberPointer = 0;
20
+
21
+ for (let i = 0; i < x.length; i++) {
22
+ const char = x[i];
23
+ const charCode = char.charCodeAt(0) - 48;
24
+ const charIsNumber = charCode >= 0 && charCode < 10;
25
+
26
+ if (char === ' ') {
27
+ continue;
28
+ }
29
+
30
+ if (beginSearch && !charIsNumber && char !== ',' && char !== ')') {
31
+ throw new SyntaxError(`${x} is not a validate color value!`);
32
+ }
33
+
34
+ if (!beginSearch && char === '(') {
35
+ beginSearch = true;
36
+ continue;
37
+ }
38
+
39
+ if (numberPointer < 2 && char === ')') {
40
+ throw new SyntaxError(`${x} should have at least three color channel`);
41
+ }
42
+
43
+ if (char === ',') {
44
+ numberPointer++;
45
+ }
46
+
47
+ if (char === ')') {
48
+ return result;
49
+ }
50
+
51
+ if (beginSearch) {
52
+ result += char;
53
+ }
54
+ }
55
+
56
+ return result;
57
+ }
58
+ };
@@ -0,0 +1,8 @@
1
+ import type { BorderDecoration } from './types.js';
2
+
3
+ export const isValidateBorderDecorationType = (x: string): x is BorderDecoration => {
4
+ if (x === 'round') return true;
5
+ if (x === 'bevel') return true;
6
+ if (x === 'miter') return true;
7
+ return false;
8
+ };