@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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 ax-design
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 ax-design
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,76 +1,76 @@
1
- <h1 align="center">
2
- <img src="https://raw.githubusercontent.com/ax-design/reveal-highlight/master/docs/logo.png" alt="Reveal Hightlight">
3
- </h1>
4
-
5
- <p align="center">
6
- React component that implements Reveal Highlight of Axiom Design System.
7
- </p>
8
-
9
- <p align="center">
10
- <a href="https://www.npmjs.com/package/@ax-design/reveal-highlight"><img src="https://img.shields.io/npm/v/@ax-design/reveal-highlight.svg" alt="npm version"></a>
11
- <a href="https://travis-ci.com/ax-design/reveal-highlight"><img src="https://travis-ci.com/ax-design/reveal-highlight.svg?branch=master" alt="CI status"></a>
12
- <a href="https://deepscan.io/dashboard#view=project&tid=4412&pid=6185&bid=50120"><img src="https://deepscan.io/api/teams/4412/projects/6185/branches/50120/badge/grade.svg" alt="DeepScan grade"></a>
13
- <a href="https://t.me/axiom_chat"><img src="https://img.shields.io/badge/chat-on%20Telegram-%230088cc.svg" alt="Telegram chat group" /></a>
14
- <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="MIT Licence" />
15
-
16
- </p>
17
-
18
- <p align="center">
19
- <img src="https://raw.githubusercontent.com/ax-design/reveal-highlight/master/docs/screen-record.gif" alt="Screenshot">
20
- </p>
21
-
22
- ## Installation
23
-
24
- ```bash
25
- // with npm
26
- npm install @ax-design/reveal-highlight
27
-
28
- // with yarn
29
- yarn add @ax-design/reveal-highlight
30
- ```
31
-
32
- and import it:
33
-
34
- ```javascript
35
- //CommonJS
36
- require('@ax-design/reveal-highlight').register();
37
-
38
- //ESModule
39
- import { register } from '@ax-design/reveal-highlight';
40
- register({
41
- compat: true,
42
- borderDetectionMode: 'experimentalAutoFit',
43
- });
44
- ```
45
-
46
- ## Usage
47
-
48
- To add a reveal effect on your web application, you need to wrap a `ax-reveal` component with `ax-reveal-provider` and `ax-reveal-bound`.
49
-
50
- `ax-reveal-provider` will manage the global reveal style, and cache the rendered highlight bitmap for better performance (WIP).
51
-
52
- `ax-reveal-bound` will manage the rendering behavior of `ax-reveal` components, while your mouse enters the boundary, the highlight components will get started to rendering, while your mouse leaves the boundary component, all highlight effect will disappear.
53
-
54
- Here's an example:
55
-
56
- ```html
57
- <ax-reveal-provider>
58
- <h1>Welcome to project Axiom!</h1>
59
- <ax-reveal-bound>
60
- <ax-reveal>
61
- <button class="ax-reveal-button">Button 1</button>
62
- </ax-reveal>
63
- <ax-reveal>
64
- <button class="ax-reveal-button">Button 2</button>
65
- </ax-reveal>
66
- </ax-reveal-bound>
67
- <ax-reveal-provider>
68
- ```
69
-
70
- ## Style Controlling
71
-
72
- * Checkout this living example for detailed usage:
73
- https://ax-design.github.io/playground/?path=/story/components-fundamental-elements-reveal-highlight--basic
74
-
75
- * And here're the source code:
1
+ <h1 align="center">
2
+ <img src="https://raw.githubusercontent.com/ax-design/reveal-highlight/master/docs/logo.png" alt="Reveal Hightlight">
3
+ </h1>
4
+
5
+ <p align="center">
6
+ React component that implements Reveal Highlight of Axiom Design System.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/@ax-design/reveal-highlight"><img src="https://img.shields.io/npm/v/@ax-design/reveal-highlight.svg" alt="npm version"></a>
11
+ <a href="https://travis-ci.com/ax-design/reveal-highlight"><img src="https://travis-ci.com/ax-design/reveal-highlight.svg?branch=master" alt="CI status"></a>
12
+ <a href="https://deepscan.io/dashboard#view=project&tid=4412&pid=6185&bid=50120"><img src="https://deepscan.io/api/teams/4412/projects/6185/branches/50120/badge/grade.svg" alt="DeepScan grade"></a>
13
+ <a href="https://t.me/axiom_chat"><img src="https://img.shields.io/badge/chat-on%20Telegram-%230088cc.svg" alt="Telegram chat group" /></a>
14
+ <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="MIT Licence" />
15
+
16
+ </p>
17
+
18
+ <p align="center">
19
+ <img src="https://raw.githubusercontent.com/ax-design/reveal-highlight/master/docs/screen-record.gif" alt="Screenshot">
20
+ </p>
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ // with npm
26
+ npm install @ax-design/reveal-highlight
27
+
28
+ // with yarn
29
+ yarn add @ax-design/reveal-highlight
30
+ ```
31
+
32
+ and import it:
33
+
34
+ ```javascript
35
+ //CommonJS
36
+ require('@ax-design/reveal-highlight').register();
37
+
38
+ //ESModule
39
+ import { register } from '@ax-design/reveal-highlight';
40
+ register({
41
+ compat: true,
42
+ borderDetectionMode: 'experimentalAutoFit',
43
+ });
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ To add a reveal effect on your web application, you need to wrap a `ax-reveal` component with `ax-reveal-provider` and `ax-reveal-bound`.
49
+
50
+ `ax-reveal-provider` will manage the global reveal style, and cache the rendered highlight bitmap for better performance (WIP).
51
+
52
+ `ax-reveal-bound` will manage the rendering behavior of `ax-reveal` components, while your mouse enters the boundary, the highlight components will get started to rendering, while your mouse leaves the boundary component, all highlight effect will disappear.
53
+
54
+ Here's an example:
55
+
56
+ ```html
57
+ <ax-reveal-provider>
58
+ <h1>Welcome to project Axiom!</h1>
59
+ <ax-reveal-bound>
60
+ <ax-reveal>
61
+ <button class="ax-reveal-button">Button 1</button>
62
+ </ax-reveal>
63
+ <ax-reveal>
64
+ <button class="ax-reveal-button">Button 2</button>
65
+ </ax-reveal>
66
+ </ax-reveal-bound>
67
+ <ax-reveal-provider>
68
+ ```
69
+
70
+ ## Style Controlling
71
+
72
+ * Checkout this living example for detailed usage:
73
+ https://ax-design.github.io/playground/?path=/story/components-fundamental-elements-reveal-highlight--basic
74
+
75
+ * And here're the source code:
76
76
  https://github.com/ax-design/ax-design.github.io/blob/master/stories/templates/RevealHighlight.ts
@@ -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;;IAsBlB,qBAAqB,UAAS;IAE9B,kBAAkB,aAYjB;IAED,iBAAiB,UAAW,YAAY,UAQtC;IAEF,kBAAkB,aAKhB;IAEF,WAAW,QAAS,WAAW,yBAO7B;IAEF,cAAc,UAAW,mBAAmB,UAE1C;CACL"}
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"}
package/build/main.js CHANGED
@@ -121,7 +121,7 @@ const a=e-r.mouseDownAnimateStartFrame;r.mouseDownAnimateCurrentFrame=a;const i=
121
121
  // and Logic Frame represents the progress of the animation
122
122
  // in this process.
123
123
  let n=a;r.mouseReleased&&r.mouseDownAnimateReleasedFrame&&(n+=(a-r.mouseDownAnimateReleasedFrame)*o),r.mouseDownAnimateLogicFrame=n/i,1<r.mouseDownAnimateLogicFrame&&(r.cleanedUpForAnimation=!0)}// Paint the canvas one by one
124
- for(let r=0;r<this.canvasList.length;r++){const a=this.canvasList[r];if(a.currentFrameId=e,a.cleanedUpForAnimation)this.cleanUpAnimationUnit(a,!1),a.cleanedUpForAnimation=!1;else{const e=-1===this.animationQueue.indexOf(a);this.mouseInBoundary||e?a.paint(t):a.clear(!1)}}this.paintedClientX=this.clientX,this.paintedClientY=this.clientY,this.mouseInBoundary||0!==this.animationQueue.length?this.requestPaintAll():this.animationFrame=null}},this.clearAll=e=>{this.cleanupAnimation(e,!0)},this.initializeAnimation=()=>{const e=this.canvasList.find(e=>e.mouseInCanvas());e&&(!this.animationQueue.includes(e)&&this.animationQueue.push(e),e.mouseDownAnimateStartFrame=null,e.mousePressed=!0,e.mouseReleased=!1)},this.switchAnimation=()=>{for(let e=0;e<this.animationQueue.length;e++){const t=this.animationQueue[e];t.mouseReleased||(t.mouseReleased=!0,t.mouseDownAnimateReleasedFrame=t.mouseDownAnimateCurrentFrame,t.mouseUpClientX=this.clientX,t.mouseUpClientY=this.clientY)}},this.cleanupAnimation=(e,t)=>{for(let r=0;r<this.animationQueue.length;r++){const a=this.animationQueue[r];this.cleanUpAnimationUnit(a,e,t)}},this.cleanUpAnimationUnit=(e,t,r)=>{e.mouseUpClientX=null,e.mouseUpClientY=null,e.mouseDownAnimateStartFrame=null,e.mouseDownAnimateCurrentFrame=null,e.mouseDownAnimateReleasedFrame=null,e.mouseDownAnimateLogicFrame=null,e.mousePressed=!1,e.mouseReleased=!1;const a=this.animationQueue.indexOf(e);-1<a&&this.animationQueue.splice(a,1),t||(r?e.clear(!1):this.mouseInBoundary?e.paint(!0):e.clear(!0))},this.getRevealAnimationConfig=()=>this.canvasList.find(e=>e.mouseInCanvas())||null,this.id=e,this.container=t}}class x{constructor(){if(this._currentHashId=0,this._storage=[],this.requestedTraverseBoundaries=!1,this.cachedMouseX=-1,this.cachedMouseY=-1,this.pointerLeaveScheduled=!1,this.handlePointerLeave=()=>{this.pointerLeaveScheduled||(this.pointerLeaveScheduled=!0,window.requestAnimationFrame(()=>{for(let e=0;e<this._storage.length;e++)this._storage[e].onPointerLeaveBoundary();this.pointerLeaveScheduled=!1}))},this.handlePointerMove=e=>{this.cachedMouseX=e.clientX,this.cachedMouseY=e.clientY,this.requestedTraverseBoundaries||(window.requestAnimationFrame(this.traverseBoundaries),this.requestedTraverseBoundaries=!0)},this.traverseBoundaries=()=>{this.requestedTraverseBoundaries=!1;for(let e=0;e<this._storage.length;e++)this._storage[e].onPointerMoveOnScreen(this.cachedMouseX,this.cachedMouseY)},this.newBoundary=e=>{const t=this._currentHashId++,r=new b(t,e);return this._storage.push(r),r},this.removeBoundary=e=>{this._storage=this._storage.filter(t=>t!==e)},"experimentalAutoFit"===p.borderDetectionMode){if("undefined"==typeof Window)return;window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",e=>{"mouse"!==e.pointerType&&this.handlePointerLeave()}),window.addEventListener("pointerleave",e=>{"mouse"===e.pointerType&&this.handlePointerLeave()})}}}const F="undefined"==typeof globalThis.Window?class{constructor(){this.root={innerHTML:"",querySelector:()=>null},this.attachShadow=()=>null}}:HTMLElement;class P extends F{constructor(){super(...arguments),this.stateManager=new x}}P.ElementName="ax-reveal-provider";class C extends F{constructor(){/**
124
+ for(let r=0;r<this.canvasList.length;r++){const a=this.canvasList[r];if(a.currentFrameId=e,a.cleanedUpForAnimation)this.cleanUpAnimationUnit(a,!1),a.cleanedUpForAnimation=!1;else{const e=-1===this.animationQueue.indexOf(a);this.mouseInBoundary||e?a.paint(t):a.clear(!1)}}this.paintedClientX=this.clientX,this.paintedClientY=this.clientY,this.mouseInBoundary||0!==this.animationQueue.length?this.requestPaintAll():this.animationFrame=null}},this.clearAll=e=>{this.cleanupAnimation(e,!0)},this.initializeAnimation=()=>{const e=this.canvasList.find(e=>e.mouseInCanvas());e&&(!this.animationQueue.includes(e)&&this.animationQueue.push(e),e.mouseDownAnimateStartFrame=null,e.mousePressed=!0,e.mouseReleased=!1)},this.switchAnimation=()=>{for(let e=0;e<this.animationQueue.length;e++){const t=this.animationQueue[e];t.mouseReleased||(t.mouseReleased=!0,t.mouseDownAnimateReleasedFrame=t.mouseDownAnimateCurrentFrame,t.mouseUpClientX=this.clientX,t.mouseUpClientY=this.clientY)}},this.cleanupAnimation=(e,t)=>{for(let r=0;r<this.animationQueue.length;r++){const a=this.animationQueue[r];this.cleanUpAnimationUnit(a,e,t)}},this.cleanUpAnimationUnit=(e,t,r)=>{e.mouseUpClientX=null,e.mouseUpClientY=null,e.mouseDownAnimateStartFrame=null,e.mouseDownAnimateCurrentFrame=null,e.mouseDownAnimateReleasedFrame=null,e.mouseDownAnimateLogicFrame=null,e.mousePressed=!1,e.mouseReleased=!1;const a=this.animationQueue.indexOf(e);-1<a&&this.animationQueue.splice(a,1),t||(r?e.clear(!1):this.mouseInBoundary?e.paint(!0):e.clear(!0))},this.getRevealAnimationConfig=()=>this.canvasList.find(e=>e.mouseInCanvas())||null,this.id=e,this.container=t}}class x{constructor(){if(this._currentHashId=0,this._storage=[],this.requestedTraverseBoundaries=!1,this.cachedMouseX=-1,this.cachedMouseY=-1,this.pointerLeaveScheduled=!1,this.handlePointerLeave=()=>{this.pointerLeaveScheduled||(this.pointerLeaveScheduled=!0,window.requestAnimationFrame(()=>{for(let e=0;e<this._storage.length;e++)this._storage[e].onPointerLeaveBoundary();this.pointerLeaveScheduled=!1}))},this.handlePointerMove=e=>{this.cachedMouseX=e.clientX,this.cachedMouseY=e.clientY,this.requestedTraverseBoundaries||(window.requestAnimationFrame(this.traverseBoundaries),this.requestedTraverseBoundaries=!0)},this.traverseBoundaries=()=>{this.requestedTraverseBoundaries=!1;for(let e=0;e<this._storage.length;e++)this._storage[e].onPointerMoveOnScreen(this.cachedMouseX,this.cachedMouseY)},this.newBoundary=e=>{const t=this._currentHashId++,r=new b(t,e);return this._storage.push(r),r},this.removeBoundary=e=>{this._storage=this._storage.filter(t=>t!==e)},"experimentalAutoFit"===p.borderDetectionMode){if("undefined"==typeof Window)return;window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",e=>{"mouse"!==e.pointerType&&this.handlePointerLeave()}),window.addEventListener("pointerleave",e=>{"mouse"===e.pointerType&&this.handlePointerLeave()}),window.addEventListener("pointercancel",()=>{console.log("pointer cancel"),this.handlePointerLeave()})}}}const F="undefined"==typeof globalThis.Window?class{constructor(){this.root={innerHTML:"",querySelector:()=>null},this.attachShadow=()=>null}}:HTMLElement;class P extends F{constructor(){super(...arguments),this.stateManager=new x}}P.ElementName="ax-reveal-provider";class C extends F{constructor(){/**
125
125
  * Update the position of your pointer.
126
126
  * @param ev Pointer event from the listener.
127
127
  */super(),this.root=this.attachShadow({mode:"open"}),this.updatePointerPosition=e=>{this.waitForStorage(t=>{t.clientX=e.clientX,t.clientY=e.clientY})},this.handlePointerEnter=()=>this.waitForStorage(e=>e.onPointerEnterBoundary()),this.handlePointerLeave=()=>this.waitForStorage(e=>e.onPointerLeaveBoundary()),this.handlePointerMove=this.updatePointerPosition,this.handlePointerUp=e=>{"mouse"===e.pointerType?this.waitForStorage(e=>e.switchAnimation()):this.waitForStorage(e=>e.clearAll(!1))},this.handlePointerDown=e=>this.waitForStorage(t=>{this.updatePointerPosition(e),t.initializeAnimation()}),this.root.innerHTML=`
@@ -63,9 +63,9 @@ export class AxRevealBoundary extends PatchedHTMLElement {
63
63
  this.updatePointerPosition(ev);
64
64
  storage.initializeAnimation();
65
65
  });
66
- this.root.innerHTML = `
67
- <div>
68
- <slot></slot>
66
+ this.root.innerHTML = `
67
+ <div>
68
+ <slot></slot>
69
69
  </div>`;
70
70
  }
71
71
  get storage() {
@@ -129,25 +129,25 @@ export class AxReveal extends PatchedHTMLElement {
129
129
  this.handlePointerDown = (ev) => {
130
130
  this.setPointerCapture(ev.pointerId);
131
131
  };
132
- this.root.innerHTML = `
133
- <div class="ax-reveal">
134
- <canvas></canvas>
135
- <div class="content"><slot></slot></div>
136
- </div>
137
- <style>
138
- .ax-reveal { display: content; }
139
- .ax-reveal * { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
140
- .content { position: relative; }
141
- canvas { top: 0; left: 0; pointer-events: none; width: 100%; height: 100%; position: absolute; }
142
- :host { display: inline-block; position: relative; }
143
- :host([block]) { display: block; }
144
- :host([inline-block]) { display: inline-block; }
145
- :host([flex]) { display: flex; }
146
- :host([inline-flex]) { display: inline-flex; }
147
- :host([grid]) { display: grid; }
148
- :host([inline-grid]) { display: inline-grid; }
149
- ::slotted(*) { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
150
- ::slotted(button) { outline:none; }
132
+ this.root.innerHTML = `
133
+ <div class="ax-reveal">
134
+ <canvas></canvas>
135
+ <div class="content"><slot></slot></div>
136
+ </div>
137
+ <style>
138
+ .ax-reveal { display: content; }
139
+ .ax-reveal * { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
140
+ .content { position: relative; }
141
+ canvas { top: 0; left: 0; pointer-events: none; width: 100%; height: 100%; position: absolute; }
142
+ :host { display: inline-block; position: relative; }
143
+ :host([block]) { display: block; }
144
+ :host([inline-block]) { display: inline-block; }
145
+ :host([flex]) { display: flex; }
146
+ :host([inline-flex]) { display: inline-flex; }
147
+ :host([grid]) { display: grid; }
148
+ :host([inline-grid]) { display: inline-grid; }
149
+ ::slotted(*) { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
150
+ ::slotted(button) { outline:none; }
151
151
  </style>`;
152
152
  this.canvas = this.root.querySelector('canvas');
153
153
  }
@@ -174,44 +174,44 @@ export class AxRevealNg extends PatchedHTMLElement {
174
174
  this.handlePointerDown = (ev) => {
175
175
  this.setPointerCapture(ev.pointerId);
176
176
  };
177
- this.root.innerHTML = `
178
- <div class="ax-reveal">
179
- <svg>
180
- <defs>
181
- <radialGradient id="borderGrad" gradientUnits="userSpaceOnUse" r="10">
182
- <stop id="borderCenter" offset="0%" />
183
- <stop id="borderOut" offset="100%" />
184
- </radialGradient>
185
- <radialGradient id="fillGrad" gradientUnits="userSpaceOnUse" r="10">
186
- <stop id="fillCenter" offset="0%" />
187
- <stop id="fillOut" offset="100%" />
188
- </radialGradient>
189
- <radialGradient id="rippleGrad" gradientUnits="userSpaceOnUse" r="10">
190
- <stop id="rippleCenter" offset="0%" />
191
- <stop id="rippleMiddle" offset="0%" />
192
- <stop id="rippleOut" offset="0%" />
193
- </radialGradient>
194
- </defs>
195
- <path id="borderPath" fill="url(#borderGrad)" />
196
- <path id="fillPath" fill="url(#fillGrad)" />
197
- <path id="ripplePath" fill="url(#rippleGrad)" />
198
- </svg>
199
- <div class="content"><slot></slot></div>
200
- </div>
201
- <style>
202
- .ax-reveal { display: contents; }
203
- .ax-reveal * { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
204
- .content { position: relative; }
205
- svg { top: 0; left: 0; pointer-events: none; width: 100%; height: 100%; position: absolute; }
206
- :host { display: inline-block; position: relative; }
207
- :host([block]) { display: block; }
208
- :host([inline-block]) { display: inline-block; }
209
- :host([flex]) { display: flex; }
210
- :host([inline-flex]) { display: inline-flex; }
211
- :host([grid]) { display: grid; }
212
- :host([inline-grid]) { display: inline-grid; }
213
- ::slotted(*) { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
214
- ::slotted(button) { outline:none; }
177
+ this.root.innerHTML = `
178
+ <div class="ax-reveal">
179
+ <svg>
180
+ <defs>
181
+ <radialGradient id="borderGrad" gradientUnits="userSpaceOnUse" r="10">
182
+ <stop id="borderCenter" offset="0%" />
183
+ <stop id="borderOut" offset="100%" />
184
+ </radialGradient>
185
+ <radialGradient id="fillGrad" gradientUnits="userSpaceOnUse" r="10">
186
+ <stop id="fillCenter" offset="0%" />
187
+ <stop id="fillOut" offset="100%" />
188
+ </radialGradient>
189
+ <radialGradient id="rippleGrad" gradientUnits="userSpaceOnUse" r="10">
190
+ <stop id="rippleCenter" offset="0%" />
191
+ <stop id="rippleMiddle" offset="0%" />
192
+ <stop id="rippleOut" offset="0%" />
193
+ </radialGradient>
194
+ </defs>
195
+ <path id="borderPath" fill="url(#borderGrad)" />
196
+ <path id="fillPath" fill="url(#fillGrad)" />
197
+ <path id="ripplePath" fill="url(#rippleGrad)" />
198
+ </svg>
199
+ <div class="content"><slot></slot></div>
200
+ </div>
201
+ <style>
202
+ .ax-reveal { display: contents; }
203
+ .ax-reveal * { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
204
+ .content { position: relative; }
205
+ svg { top: 0; left: 0; pointer-events: none; width: 100%; height: 100%; position: absolute; }
206
+ :host { display: inline-block; position: relative; }
207
+ :host([block]) { display: block; }
208
+ :host([inline-block]) { display: inline-block; }
209
+ :host([flex]) { display: flex; }
210
+ :host([inline-flex]) { display: inline-flex; }
211
+ :host([grid]) { display: grid; }
212
+ :host([inline-grid]) { display: inline-grid; }
213
+ ::slotted(*) { user-drag: none; -webkit-user-drag: none; touch-action: none; user-select: none; }
214
+ ::slotted(button) { outline:none; }
215
215
  </style>`;
216
216
  this.svg = this.root.querySelector('svg');
217
217
  }
@@ -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;;IAsBlB,qBAAqB,UAAS;IAE9B,kBAAkB,aAYjB;IAED,iBAAiB,UAAW,YAAY,UAQtC;IAEF,kBAAkB,aAKhB;IAEF,WAAW,QAAS,WAAW,yBAO7B;IAEF,cAAc,UAAW,mBAAmB,UAE1C;CACL"}
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"}
@@ -60,6 +60,14 @@ export class RevealStateManager {
60
60
  if (ev.pointerType === 'mouse')
61
61
  this.handlePointerLeave();
62
62
  });
63
+ // Handles boundary conditions such as the user scrolling
64
+ // the page, dragging the image, which can cause mouse events
65
+ // to fail, when Reveal should disappear to prevent the
66
+ // image from getting stuck.
67
+ window.addEventListener('pointercancel', (ev) => {
68
+ console.log('pointer cancel');
69
+ this.handlePointerLeave();
70
+ });
63
71
  }
64
72
  }
65
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RevealStateManager.js","sourceRoot":"","sources":["../src/RevealStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,kBAAkB;IAQ3B;QAPQ,mBAAc,GAAG,CAAC,CAAC;QACnB,aAAQ,GAA0B,EAAE,CAAC;QAErC,gCAA2B,GAAG,KAAK,CAAC;QAC5C,iBAAY,GAAG,CAAC,CAAC,CAAC;QAClB,iBAAY,GAAG,CAAC,CAAC,CAAC;QAsBlB,0BAAqB,GAAG,KAAK,CAAC;QAE9B,uBAAkB,GAAG,GAAG,EAAE;YACtB,IAAI,IAAI,CAAC,qBAAqB;gBAAE,OAAO;YAEvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CA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BAC9B,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC9B,CAAC,CAAC,CAAC;SACN;IACL,CAAC;CA+CJ"}
package/es/SvgConfig.js CHANGED
@@ -92,96 +92,96 @@ export class SvgConfig extends BaseConfig {
92
92
  // Step 2: Draw shape
93
93
  if (hollow) {
94
94
  // Step 2-1: This is outer path, drawing clockwise
95
- d += `
96
- h ${w - tl - tr}
97
- a ${tr}, ${tr} 0 0 1 ${tr}, ${tr}
98
- v ${h - tr - br}
99
- a ${br}, ${br} 0 0 1 ${-br}, ${br}
100
- h ${-w + bl + br}
101
- a ${bl}, ${bl} 0 0 1 ${-bl}, ${-bl}
102
- v ${-h + tr + br}
103
- a ${tl}, ${tl} 0 0 1 ${tl}, ${-tl}
104
- Z
95
+ d += `
96
+ h ${w - tl - tr}
97
+ a ${tr}, ${tr} 0 0 1 ${tr}, ${tr}
98
+ v ${h - tr - br}
99
+ a ${br}, ${br} 0 0 1 ${-br}, ${br}
100
+ h ${-w + bl + br}
101
+ a ${bl}, ${bl} 0 0 1 ${-bl}, ${-bl}
102
+ v ${-h + tr + br}
103
+ a ${tl}, ${tl} 0 0 1 ${tl}, ${-tl}
104
+ Z
105
105
  `;
106
106
  }
107
107
  // Step 2-2: This is the inner path, drawing anti-clockwise
108
- d += `
109
- M ${bw * wlf}, ${tl2 + bw}
110
- v ${h - tl2 - bl2 - bw * 2 + rwbf * bw}
111
- a ${bl2}, ${bl2} 0 0 0 ${bl2}, ${bl2}
112
- h ${w - bl2 - br2 - bw * 2 + rwlf * bw + rwrf * bw}
113
- a ${br2}, ${br2} 0 0 0 ${br2}, ${-br2}
114
- v ${-h + tr2 + br2 + bw * 2 - rwtf * bw - rwbf * bw}
115
- a ${tr2}, ${tr2} 0 0 0 ${-tr2}, ${-tr2}
116
- h ${-w + bl2 + br2 + bw * 2 - rwlf * bw - rwrf * bw}
117
- a ${tl2}, ${tl2} 0 0 0 ${-tl2}, ${tl2}
118
- L ${bw * wlf}, ${tl2 + bw}
108
+ d += `
109
+ M ${bw * wlf}, ${tl2 + bw}
110
+ v ${h - tl2 - bl2 - bw * 2 + rwbf * bw}
111
+ a ${bl2}, ${bl2} 0 0 0 ${bl2}, ${bl2}
112
+ h ${w - bl2 - br2 - bw * 2 + rwlf * bw + rwrf * bw}
113
+ a ${br2}, ${br2} 0 0 0 ${br2}, ${-br2}
114
+ v ${-h + tr2 + br2 + bw * 2 - rwtf * bw - rwbf * bw}
115
+ a ${tr2}, ${tr2} 0 0 0 ${-tr2}, ${-tr2}
116
+ h ${-w + bl2 + br2 + bw * 2 - rwlf * bw - rwrf * bw}
117
+ a ${tl2}, ${tl2} 0 0 0 ${-tl2}, ${tl2}
118
+ L ${bw * wlf}, ${tl2 + bw}
119
119
  `;
120
120
  break;
121
121
  case 'bevel':
122
122
  if (hollow) {
123
123
  // Step 2-1: This is outer path, drawing clockwise
124
- d += `
125
- h ${w - tl - tr}
126
- l ${tr} ${tr}
127
- v ${h - tr - br}
128
- l ${-br} ${br}
129
- h ${-w + tr + br}
130
- l ${-bl} ${-bl}
131
- v ${-h + tr + br}
132
- l ${tl} ${-tl}
133
- Z
124
+ d += `
125
+ h ${w - tl - tr}
126
+ l ${tr} ${tr}
127
+ v ${h - tr - br}
128
+ l ${-br} ${br}
129
+ h ${-w + tr + br}
130
+ l ${-bl} ${-bl}
131
+ v ${-h + tr + br}
132
+ l ${tl} ${-tl}
133
+ Z
134
134
  `;
135
135
  }
136
136
  // // Step 2-2: This is the inner path, drawing anti-clockwise
137
- d += `
138
- M ${bw}, ${tl2 + bw}
139
- ${rwlf ? `h ${-bw}` : ''}
140
- v ${h - tl2 - bl2 - bw * 2}
141
- ${rwlf ? `h ${bw}` : ''}
142
- ${nblc ? `l ${-bw} 0` : ''}
143
- l ${bl2} ${bl2}
144
- ${nblc ? `l ${bw} 0` : ''}
145
- ${rwbf ? `v ${bw}` : ''}
146
- h ${w - bl2 - br2 - bw * 2}
147
- ${rwbf ? `v ${-bw}` : ''}
148
- ${nbrc ? `l ${bw} 0` : ''}
149
- l ${br2} ${-br2}
150
- ${nbrc ? `l ${-bw} 0` : ''}
151
- ${rwrf ? `h ${bw}` : ''}
152
- v ${-h + tl2 + bl2 + bw * 2}
153
- ${rwrf ? `h ${-bw}` : ''}
154
- ${ntrc ? `l 0 ${-bw}` : ''}
155
- l ${-tr2} ${-tr2}
156
- ${ntrc ? `l 0 ${bw}` : ''}
157
- ${rwtf ? `v ${-bw}` : ''}
158
- h ${-w + bl2 + br2 + bw * 2}
159
- ${rwtf ? `v ${bw}` : ''}
160
- ${ntlc ? `l 0 ${-bw}` : ''}
161
- l ${-tl2} ${tl2}
162
- ${ntlc ? `l 0 ${bw}` : ''}
137
+ d += `
138
+ M ${bw}, ${tl2 + bw}
139
+ ${rwlf ? `h ${-bw}` : ''}
140
+ v ${h - tl2 - bl2 - bw * 2}
141
+ ${rwlf ? `h ${bw}` : ''}
142
+ ${nblc ? `l ${-bw} 0` : ''}
143
+ l ${bl2} ${bl2}
144
+ ${nblc ? `l ${bw} 0` : ''}
145
+ ${rwbf ? `v ${bw}` : ''}
146
+ h ${w - bl2 - br2 - bw * 2}
147
+ ${rwbf ? `v ${-bw}` : ''}
148
+ ${nbrc ? `l ${bw} 0` : ''}
149
+ l ${br2} ${-br2}
150
+ ${nbrc ? `l ${-bw} 0` : ''}
151
+ ${rwrf ? `h ${bw}` : ''}
152
+ v ${-h + tl2 + bl2 + bw * 2}
153
+ ${rwrf ? `h ${-bw}` : ''}
154
+ ${ntrc ? `l 0 ${-bw}` : ''}
155
+ l ${-tr2} ${-tr2}
156
+ ${ntrc ? `l 0 ${bw}` : ''}
157
+ ${rwtf ? `v ${-bw}` : ''}
158
+ h ${-w + bl2 + br2 + bw * 2}
159
+ ${rwtf ? `v ${bw}` : ''}
160
+ ${ntlc ? `l 0 ${-bw}` : ''}
161
+ l ${-tl2} ${tl2}
162
+ ${ntlc ? `l 0 ${bw}` : ''}
163
163
  `;
164
164
  break;
165
165
  case 'miter':
166
166
  // Step 2: Draw shape
167
167
  if (hollow) {
168
168
  // Step 2-1: This is outer path, drawing clockwise
169
- d += `
170
- M 0, 0
171
- h ${w}
172
- v ${h}
173
- h ${0 - w}
174
- v ${0 - h}
175
- Z
169
+ d += `
170
+ M 0, 0
171
+ h ${w}
172
+ v ${h}
173
+ h ${0 - w}
174
+ v ${0 - h}
175
+ Z
176
176
  `;
177
177
  }
178
178
  // Step 2-2: This is the inner path, drawing anti-clockwise
179
- d += `
180
- M ${bw * wlf}, ${bw * wtf}
181
- v ${h - wtf * bw - wbf * bw}
182
- h ${w - wlf * bw - wrf * bw}
183
- v ${-h + wtf * bw + wbf * bw}
184
- h ${-w + wlf * bw + wrf * bw}
179
+ d += `
180
+ M ${bw * wlf}, ${bw * wtf}
181
+ v ${h - wtf * bw - wbf * bw}
182
+ h ${w - wlf * bw - wrf * bw}
183
+ v ${-h + wtf * bw + wbf * bw}
184
+ h ${-w + wlf * bw + wrf * bw}
185
185
  `;
186
186
  }
187
187
  // Step 3: Close the path