@fluid-topics/ft-ripple 1.0.54 → 1.0.56
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/build/ft-ripple.css.js +24 -2
- package/build/ft-ripple.d.ts +1 -4
- package/build/ft-ripple.js +2 -27
- package/build/ft-ripple.light.js +30 -14
- package/build/ft-ripple.min.js +26 -10
- package/package.json +3 -3
package/build/ft-ripple.css.js
CHANGED
|
@@ -43,6 +43,30 @@ export const styles = css `
|
|
|
43
43
|
opacity: 0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.ft-ripple .ft-ripple--effect {
|
|
47
|
+
aspect-ratio: 1;
|
|
48
|
+
width: auto;
|
|
49
|
+
height: auto;
|
|
50
|
+
min-width: 170%;
|
|
51
|
+
min-height: 170%;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ft-ripple .ft-ripple--background{
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--effect,
|
|
60
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
61
|
+
aspect-ratio: 1;
|
|
62
|
+
width: auto;
|
|
63
|
+
height: auto;
|
|
64
|
+
max-width: unset;
|
|
65
|
+
max-height: unset;
|
|
66
|
+
min-width: 100%;
|
|
67
|
+
min-height: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
46
70
|
.ft-ripple .ft-ripple--background {
|
|
47
71
|
background-color: ${FtRippleCssVariables.backgroundColor};
|
|
48
72
|
}
|
|
@@ -70,8 +94,6 @@ export const styles = css `
|
|
|
70
94
|
.ft-ripple .ft-ripple--background {
|
|
71
95
|
top: 0;
|
|
72
96
|
left: 0;
|
|
73
|
-
height: 100%;
|
|
74
|
-
width: 100%;
|
|
75
97
|
transition: opacity 75ms linear;
|
|
76
98
|
}
|
|
77
99
|
|
package/build/ft-ripple.d.ts
CHANGED
|
@@ -13,13 +13,11 @@ export declare class FtRipple extends FtLitElement implements FtRippleProperties
|
|
|
13
13
|
private focused;
|
|
14
14
|
private pressed;
|
|
15
15
|
private rippling;
|
|
16
|
-
private rippleSize;
|
|
17
16
|
private originX;
|
|
18
17
|
private originY;
|
|
19
18
|
private ripple?;
|
|
20
19
|
private rippleEffect?;
|
|
21
20
|
private onDisconnect?;
|
|
22
|
-
private resizeObserver;
|
|
23
21
|
private target?;
|
|
24
22
|
static styles: import("lit").CSSResult;
|
|
25
23
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
@@ -27,9 +25,8 @@ export declare class FtRipple extends FtLitElement implements FtRippleProperties
|
|
|
27
25
|
private debouncer;
|
|
28
26
|
private onTransitionStart;
|
|
29
27
|
private onTransitionEnd;
|
|
30
|
-
protected
|
|
28
|
+
protected update(props: PropertyValues): void;
|
|
31
29
|
private endRipple;
|
|
32
|
-
private setRippleSize;
|
|
33
30
|
private setupDebouncer;
|
|
34
31
|
connectedCallback(): void;
|
|
35
32
|
private defaultSetup;
|
package/build/ft-ripple.js
CHANGED
|
@@ -22,10 +22,8 @@ class FtRipple extends FtLitElement {
|
|
|
22
22
|
this.focused = false;
|
|
23
23
|
this.pressed = false;
|
|
24
24
|
this.rippling = false;
|
|
25
|
-
this.rippleSize = 0;
|
|
26
25
|
this.originX = 0;
|
|
27
26
|
this.originY = 0;
|
|
28
|
-
this.resizeObserver = new ResizeObserver(() => this.setRippleSize());
|
|
29
27
|
this.debouncer = new Debouncer(1000);
|
|
30
28
|
this.onTransitionStart = (e) => {
|
|
31
29
|
if (e.propertyName === "transform") {
|
|
@@ -79,12 +77,6 @@ class FtRipple extends FtLitElement {
|
|
|
79
77
|
};
|
|
80
78
|
return html `
|
|
81
79
|
<style>
|
|
82
|
-
.ft-ripple .ft-ripple--effect,
|
|
83
|
-
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
84
|
-
width: ${this.rippleSize}px;
|
|
85
|
-
height: ${this.rippleSize}px;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
80
|
.ft-ripple .ft-ripple--effect {
|
|
89
81
|
left: ${this.originX}px;
|
|
90
82
|
top: ${this.originY}px;
|
|
@@ -98,17 +90,14 @@ class FtRipple extends FtLitElement {
|
|
|
98
90
|
}
|
|
99
91
|
contentAvailableCallback(props) {
|
|
100
92
|
super.contentAvailableCallback(props);
|
|
101
|
-
if (this.ripple) {
|
|
102
|
-
this.resizeObserver.observe(this.ripple);
|
|
103
|
-
}
|
|
104
93
|
if (this.rippleEffect && this.rippleEffect.ontransitionstart !== this.onTransitionStart) {
|
|
105
94
|
this.rippleEffect.ontransitionstart = this.onTransitionStart;
|
|
106
95
|
this.rippleEffect.ontransitionend = this.onTransitionEnd;
|
|
107
96
|
}
|
|
108
97
|
}
|
|
109
|
-
|
|
98
|
+
update(props) {
|
|
110
99
|
var _a, _b;
|
|
111
|
-
super.
|
|
100
|
+
super.update(props);
|
|
112
101
|
if (props.has("disabled")) {
|
|
113
102
|
if (this.disabled) {
|
|
114
103
|
this.endRipple();
|
|
@@ -118,9 +107,6 @@ class FtRipple extends FtLitElement {
|
|
|
118
107
|
(_b = this.target) === null || _b === void 0 ? void 0 : _b.setAttribute("data-is-ft-ripple-target", "true");
|
|
119
108
|
}
|
|
120
109
|
}
|
|
121
|
-
if (props.has("unbounded")) {
|
|
122
|
-
this.setRippleSize();
|
|
123
|
-
}
|
|
124
110
|
}
|
|
125
111
|
endRipple() {
|
|
126
112
|
this.endHover();
|
|
@@ -128,12 +114,6 @@ class FtRipple extends FtLitElement {
|
|
|
128
114
|
this.endPress();
|
|
129
115
|
this.rippling = false;
|
|
130
116
|
}
|
|
131
|
-
setRippleSize() {
|
|
132
|
-
if (this.ripple) {
|
|
133
|
-
const rect = this.ripple.getBoundingClientRect();
|
|
134
|
-
this.rippleSize = (this.unbounded ? 1 : 1.7) * Math.max(rect.width, rect.height);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
117
|
connectedCallback() {
|
|
138
118
|
super.connectedCallback();
|
|
139
119
|
this.setupDebouncer.run(() => this.defaultSetup());
|
|
@@ -144,7 +124,6 @@ class FtRipple extends FtLitElement {
|
|
|
144
124
|
if (parent) {
|
|
145
125
|
this.setupFor((_b = this.target) !== null && _b !== void 0 ? _b : parent);
|
|
146
126
|
}
|
|
147
|
-
this.setRippleSize();
|
|
148
127
|
}
|
|
149
128
|
setupFor(target) {
|
|
150
129
|
this.setupDebouncer.cancel();
|
|
@@ -236,7 +215,6 @@ class FtRipple extends FtLitElement {
|
|
|
236
215
|
disconnectedCallback() {
|
|
237
216
|
super.disconnectedCallback();
|
|
238
217
|
this.onDisconnect && this.onDisconnect();
|
|
239
|
-
this.resizeObserver.disconnect();
|
|
240
218
|
this.endRipple();
|
|
241
219
|
}
|
|
242
220
|
}
|
|
@@ -272,9 +250,6 @@ __decorate([
|
|
|
272
250
|
__decorate([
|
|
273
251
|
state()
|
|
274
252
|
], FtRipple.prototype, "rippling", void 0);
|
|
275
|
-
__decorate([
|
|
276
|
-
state()
|
|
277
|
-
], FtRipple.prototype, "rippleSize", void 0);
|
|
278
253
|
__decorate([
|
|
279
254
|
state()
|
|
280
255
|
], FtRipple.prototype, "originX", void 0);
|
package/build/ft-ripple.light.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,i,e,
|
|
1
|
+
!function(t,i,e,r,p){const s=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorContent),o={color:s,backgroundColor:i.FtCssVariableFactory.extend("--ft-ripple-background-color",s),opacityContentOnSurfacePressed:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfacePressed,"Design system"),opacityContentOnSurfaceHover:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceHover,"Design system"),opacityContentOnSurfaceFocused:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceFocused,"Design system"),opacityContentOnSurfaceSelected:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceSelected,"Design system"),borderRadius:i.FtCssVariableFactory.create("--ft-ripple-border-radius","SIZE","0px")},l=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorPrimary),n={color:l,backgroundColor:i.FtCssVariableFactory.extend("--ft-ripple-background-color",l)},f=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorSecondary),a={color:f,backgroundColor:i.FtCssVariableFactory.extend("--ft-ripple-background-color",f)},h=e.css`
|
|
2
2
|
:host {
|
|
3
3
|
display: contents;
|
|
4
4
|
}
|
|
@@ -20,6 +20,30 @@
|
|
|
20
20
|
opacity: 0;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
.ft-ripple .ft-ripple--effect {
|
|
24
|
+
aspect-ratio: 1;
|
|
25
|
+
width: auto;
|
|
26
|
+
height: auto;
|
|
27
|
+
min-width: 170%;
|
|
28
|
+
min-height: 170%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ft-ripple .ft-ripple--background{
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--effect,
|
|
37
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
38
|
+
aspect-ratio: 1;
|
|
39
|
+
width: auto;
|
|
40
|
+
height: auto;
|
|
41
|
+
max-width: unset;
|
|
42
|
+
max-height: unset;
|
|
43
|
+
min-width: 100%;
|
|
44
|
+
min-height: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
23
47
|
.ft-ripple .ft-ripple--background {
|
|
24
48
|
background-color: ${o.backgroundColor};
|
|
25
49
|
}
|
|
@@ -29,11 +53,11 @@
|
|
|
29
53
|
}
|
|
30
54
|
|
|
31
55
|
.ft-ripple.ft-ripple--secondary .ft-ripple--background {
|
|
32
|
-
background-color: ${
|
|
56
|
+
background-color: ${a.backgroundColor};
|
|
33
57
|
}
|
|
34
58
|
|
|
35
59
|
.ft-ripple.ft-ripple--secondary .ft-ripple--effect {
|
|
36
|
-
background-color: ${
|
|
60
|
+
background-color: ${a.color};
|
|
37
61
|
}
|
|
38
62
|
|
|
39
63
|
.ft-ripple.ft-ripple--primary .ft-ripple--background {
|
|
@@ -47,8 +71,6 @@
|
|
|
47
71
|
.ft-ripple .ft-ripple--background {
|
|
48
72
|
top: 0;
|
|
49
73
|
left: 0;
|
|
50
|
-
height: 100%;
|
|
51
|
-
width: 100%;
|
|
52
74
|
transition: opacity 75ms linear;
|
|
53
75
|
}
|
|
54
76
|
|
|
@@ -88,21 +110,15 @@
|
|
|
88
110
|
opacity: ${o.opacityContentOnSurfacePressed};
|
|
89
111
|
transform: translate(-50%, -50%) scale(1);
|
|
90
112
|
}
|
|
91
|
-
`;var
|
|
113
|
+
`;var d=function(t,i,e,r){for(var p,s=arguments.length,o=s<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,e):r,l=t.length-1;l>=0;l--)(p=t[l])&&(o=(s<3?p(o):s>3?p(i,e,o):p(i,e))||o);return s>3&&o&&Object.defineProperty(i,e,o),o};class u extends i.FtLitElement{constructor(){super(...arguments),this.primary=!1,this.secondary=!1,this.unbounded=!1,this.activated=!1,this.selected=!1,this.disabled=!1,this.hovered=!1,this.focused=!1,this.pressed=!1,this.rippling=!1,this.originX=0,this.originY=0,this.debouncer=new i.Debouncer(1e3),this.onTransitionStart=t=>{"transform"===t.propertyName&&(this.rippling=this.pressed,this.debouncer.run((()=>this.rippling=!1)))},this.onTransitionEnd=t=>{"transform"===t.propertyName&&(this.rippling=!1)},this.setupDebouncer=new i.Debouncer(10),this.moveRipple=t=>{var i,e;let{x:r,y:p}=this.getCoordinates(t),s=null!==(e=null===(i=this.ripple)||void 0===i?void 0:i.getBoundingClientRect())&&void 0!==e?e:{x:0,y:0,width:0,height:0};this.originX=Math.round(null!=r?r-s.x:s.width/2),this.originY=Math.round(null!=p?p-s.y:s.height/2)},this.startPress=t=>{this.moveRipple(t),this.pressed=!this.isIgnored(t)},this.endPress=()=>{this.pressed=!1},this.startHover=t=>{this.hovered=!this.isIgnored(t)},this.endHover=()=>{this.hovered=!1},this.startFocus=t=>{this.focused=this.isFocusVisible(null==t?void 0:t.target)&&!this.isIgnored(t)},this.endFocus=()=>{this.focused=!1}}render(){let t={"ft-ripple":!0,"ft-ripple--primary":this.primary,"ft-ripple--secondary":this.secondary,"ft-ripple--unbounded":this.unbounded,"ft-ripple--selected":(this.selected||this.activated)&&!this.disabled,"ft-ripple--pressed":(this.pressed||this.rippling)&&!this.disabled,"ft-ripple--hovered":this.hovered&&!this.disabled,"ft-ripple--focused":this.focused&&!this.disabled};return e.html`
|
|
92
114
|
<style>
|
|
93
|
-
.ft-ripple .ft-ripple--effect,
|
|
94
|
-
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
95
|
-
width: ${this.rippleSize}px;
|
|
96
|
-
height: ${this.rippleSize}px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
115
|
.ft-ripple .ft-ripple--effect {
|
|
100
116
|
left: ${this.originX}px;
|
|
101
117
|
top: ${this.originY}px;
|
|
102
118
|
}
|
|
103
119
|
</style>
|
|
104
|
-
<div class="${
|
|
120
|
+
<div class="${p.classMap(t)}">
|
|
105
121
|
<div class="ft-ripple--background"></div>
|
|
106
122
|
<div class="ft-ripple--effect"></div>
|
|
107
123
|
</div>
|
|
108
|
-
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.
|
|
124
|
+
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}update(t){var i,e;super.update(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(i=this.target)||void 0===i||i.removeAttribute("data-is-ft-ripple-target")):null===(e=this.target)||void 0===e||e.setAttribute("data-is-ft-ripple-target","true"))}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>this.defaultSetup()))}defaultSetup(){var t,i;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentElement;e&&this.setupFor(null!==(i=this.target)&&void 0!==i?i:e)}setupFor(t){if(this.setupDebouncer.cancel(),this.target===t)return;this.onDisconnect&&this.onDisconnect(),this.target=t,t.setAttribute("data-is-ft-ripple-target","true");const i=(...t)=>i=>{t.forEach((t=>window.addEventListener(t,this.endPress,{once:!0}))),this.startPress(i)},e=i("mouseup","contextmenu"),r=i("touchend","touchcancel"),p=t=>{["Enter"," "].includes(t.key)&&i("keyup")(t)};t.addEventListener("mouseover",this.startHover),t.addEventListener("mousemove",this.moveRipple),t.addEventListener("mouseleave",this.endHover),t.addEventListener("mousedown",e),t.addEventListener("touchstart",r),t.addEventListener("touchmove",this.moveRipple),t.addEventListener("keydown",p),t.addEventListener("focus",this.startFocus),t.addEventListener("blur",this.endFocus),t.addEventListener("focusin",this.startFocus),t.addEventListener("focusout",this.endFocus),this.onDisconnect=()=>{t.removeAttribute("data-is-ft-ripple-target"),t.removeEventListener("mouseover",this.startHover),t.removeEventListener("mousemove",this.moveRipple),t.removeEventListener("mouseleave",this.endHover),t.removeEventListener("mousedown",e),t.removeEventListener("touchstart",r),t.removeEventListener("touchmove",this.moveRipple),t.removeEventListener("keydown",p),t.removeEventListener("focus",this.startFocus),t.removeEventListener("blur",this.endFocus),t.removeEventListener("focusin",this.startFocus),t.removeEventListener("focusout",this.endFocus),this.onDisconnect=void 0,this.target=void 0}}getCoordinates(t){const i=t,e=t;let r,p;return null!=i.x?({x:r,y:p}=i):null!=e.touches&&(r=e.touches[0].clientX,p=e.touches[0].clientY),{x:r,y:p}}isFocusVisible(t){return!(t instanceof HTMLElement)||t.matches(":focus-visible")}isIgnored(t){if(this.disabled)return!0;if(null!=t)for(let i of t.composedPath()){if(i===this.target)break;if("hasAttribute"in i&&i.hasAttribute("data-is-ft-ripple-target"))return!0}return!1}disconnectedCallback(){super.disconnectedCallback(),this.onDisconnect&&this.onDisconnect(),this.endRipple()}}u.elementDefinitions={},u.styles=h,d([r.property({type:Boolean})],u.prototype,"primary",void 0),d([r.property({type:Boolean})],u.prototype,"secondary",void 0),d([r.property({type:Boolean})],u.prototype,"unbounded",void 0),d([r.property({type:Boolean})],u.prototype,"activated",void 0),d([r.property({type:Boolean})],u.prototype,"selected",void 0),d([r.property({type:Boolean})],u.prototype,"disabled",void 0),d([r.state()],u.prototype,"hovered",void 0),d([r.state()],u.prototype,"focused",void 0),d([r.state()],u.prototype,"pressed",void 0),d([r.state()],u.prototype,"rippling",void 0),d([r.state()],u.prototype,"originX",void 0),d([r.state()],u.prototype,"originY",void 0),d([r.query(".ft-ripple")],u.prototype,"ripple",void 0),d([r.query(".ft-ripple--effect")],u.prototype,"rippleEffect",void 0),i.customElement("ft-ripple")(u),t.FtRipple=u,t.FtRippleCssVariables=o,t.FtRipplePrimaryCssVariables=n,t.FtRippleSecondaryCssVariables=a,t.styles=h}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap);
|
package/build/ft-ripple.min.js
CHANGED
|
@@ -128,6 +128,30 @@ const Ct=1;class kt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,e)
|
|
|
128
128
|
opacity: 0;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
.ft-ripple .ft-ripple--effect {
|
|
132
|
+
aspect-ratio: 1;
|
|
133
|
+
width: auto;
|
|
134
|
+
height: auto;
|
|
135
|
+
min-width: 170%;
|
|
136
|
+
min-height: 170%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.ft-ripple .ft-ripple--background{
|
|
140
|
+
width: 100%;
|
|
141
|
+
height: 100%;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--effect,
|
|
145
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
146
|
+
aspect-ratio: 1;
|
|
147
|
+
width: auto;
|
|
148
|
+
height: auto;
|
|
149
|
+
max-width: unset;
|
|
150
|
+
max-height: unset;
|
|
151
|
+
min-width: 100%;
|
|
152
|
+
min-height: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
131
155
|
.ft-ripple .ft-ripple--background {
|
|
132
156
|
background-color: ${Rt.backgroundColor};
|
|
133
157
|
}
|
|
@@ -155,8 +179,6 @@ const Ct=1;class kt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,e)
|
|
|
155
179
|
.ft-ripple .ft-ripple--background {
|
|
156
180
|
top: 0;
|
|
157
181
|
left: 0;
|
|
158
|
-
height: 100%;
|
|
159
|
-
width: 100%;
|
|
160
182
|
transition: opacity 75ms linear;
|
|
161
183
|
}
|
|
162
184
|
|
|
@@ -196,14 +218,8 @@ const Ct=1;class kt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,e)
|
|
|
196
218
|
opacity: ${Rt.opacityContentOnSurfacePressed};
|
|
197
219
|
transform: translate(-50%, -50%) scale(1);
|
|
198
220
|
}
|
|
199
|
-
`;var jt,Lt=function(t,i,e,s){for(var o,r=arguments.length,n=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(i,e,n):o(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class Pt extends wt{constructor(){super(...arguments),this.primary=!1,this.secondary=!1,this.unbounded=!1,this.activated=!1,this.selected=!1,this.disabled=!1,this.hovered=!1,this.focused=!1,this.pressed=!1,this.rippling=!1,this.
|
|
221
|
+
`;var jt,Lt=function(t,i,e,s){for(var o,r=arguments.length,n=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(i,e,n):o(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class Pt extends wt{constructor(){super(...arguments),this.primary=!1,this.secondary=!1,this.unbounded=!1,this.activated=!1,this.selected=!1,this.disabled=!1,this.hovered=!1,this.focused=!1,this.pressed=!1,this.rippling=!1,this.originX=0,this.originY=0,this.debouncer=new i(1e3),this.onTransitionStart=t=>{"transform"===t.propertyName&&(this.rippling=this.pressed,this.debouncer.run((()=>this.rippling=!1)))},this.onTransitionEnd=t=>{"transform"===t.propertyName&&(this.rippling=!1)},this.setupDebouncer=new i(10),this.moveRipple=t=>{var i,e;let{x:s,y:o}=this.getCoordinates(t),r=null!==(e=null===(i=this.ripple)||void 0===i?void 0:i.getBoundingClientRect())&&void 0!==e?e:{x:0,y:0,width:0,height:0};this.originX=Math.round(null!=s?s-r.x:r.width/2),this.originY=Math.round(null!=o?o-r.y:r.height/2)},this.startPress=t=>{this.moveRipple(t),this.pressed=!this.isIgnored(t)},this.endPress=()=>{this.pressed=!1},this.startHover=t=>{this.hovered=!this.isIgnored(t)},this.endHover=()=>{this.hovered=!1},this.startFocus=t=>{this.focused=this.isFocusVisible(null==t?void 0:t.target)&&!this.isIgnored(t)},this.endFocus=()=>{this.focused=!1}}render(){let t={"ft-ripple":!0,"ft-ripple--primary":this.primary,"ft-ripple--secondary":this.secondary,"ft-ripple--unbounded":this.unbounded,"ft-ripple--selected":(this.selected||this.activated)&&!this.disabled,"ft-ripple--pressed":(this.pressed||this.rippling)&&!this.disabled,"ft-ripple--hovered":this.hovered&&!this.disabled,"ft-ripple--focused":this.focused&&!this.disabled};return V`
|
|
200
222
|
<style>
|
|
201
|
-
.ft-ripple .ft-ripple--effect,
|
|
202
|
-
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
203
|
-
width: ${this.rippleSize}px;
|
|
204
|
-
height: ${this.rippleSize}px;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
223
|
.ft-ripple .ft-ripple--effect {
|
|
208
224
|
left: ${this.originX}px;
|
|
209
225
|
top: ${this.originY}px;
|
|
@@ -213,4 +229,4 @@ const Ct=1;class kt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,e)
|
|
|
213
229
|
<div class="ft-ripple--background"></div>
|
|
214
230
|
<div class="ft-ripple--effect"></div>
|
|
215
231
|
</div>
|
|
216
|
-
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.
|
|
232
|
+
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}update(t){var i,e;super.update(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(i=this.target)||void 0===i||i.removeAttribute("data-is-ft-ripple-target")):null===(e=this.target)||void 0===e||e.setAttribute("data-is-ft-ripple-target","true"))}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>this.defaultSetup()))}defaultSetup(){var t,i;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentElement;e&&this.setupFor(null!==(i=this.target)&&void 0!==i?i:e)}setupFor(t){if(this.setupDebouncer.cancel(),this.target===t)return;this.onDisconnect&&this.onDisconnect(),this.target=t,t.setAttribute("data-is-ft-ripple-target","true");const i=(...t)=>i=>{t.forEach((t=>window.addEventListener(t,this.endPress,{once:!0}))),this.startPress(i)},e=i("mouseup","contextmenu"),s=i("touchend","touchcancel"),o=t=>{["Enter"," "].includes(t.key)&&i("keyup")(t)};t.addEventListener("mouseover",this.startHover),t.addEventListener("mousemove",this.moveRipple),t.addEventListener("mouseleave",this.endHover),t.addEventListener("mousedown",e),t.addEventListener("touchstart",s),t.addEventListener("touchmove",this.moveRipple),t.addEventListener("keydown",o),t.addEventListener("focus",this.startFocus),t.addEventListener("blur",this.endFocus),t.addEventListener("focusin",this.startFocus),t.addEventListener("focusout",this.endFocus),this.onDisconnect=()=>{t.removeAttribute("data-is-ft-ripple-target"),t.removeEventListener("mouseover",this.startHover),t.removeEventListener("mousemove",this.moveRipple),t.removeEventListener("mouseleave",this.endHover),t.removeEventListener("mousedown",e),t.removeEventListener("touchstart",s),t.removeEventListener("touchmove",this.moveRipple),t.removeEventListener("keydown",o),t.removeEventListener("focus",this.startFocus),t.removeEventListener("blur",this.endFocus),t.removeEventListener("focusin",this.startFocus),t.removeEventListener("focusout",this.endFocus),this.onDisconnect=void 0,this.target=void 0}}getCoordinates(t){const i=t,e=t;let s,o;return null!=i.x?({x:s,y:o}=i):null!=e.touches&&(s=e.touches[0].clientX,o=e.touches[0].clientY),{x:s,y:o}}isFocusVisible(t){return!(t instanceof HTMLElement)||t.matches(":focus-visible")}isIgnored(t){if(this.disabled)return!0;if(null!=t)for(let i of t.composedPath()){if(i===this.target)break;if("hasAttribute"in i&&i.hasAttribute("data-is-ft-ripple-target"))return!0}return!1}disconnectedCallback(){super.disconnectedCallback(),this.onDisconnect&&this.onDisconnect(),this.endRipple()}}Pt.elementDefinitions={},Pt.styles=At,Lt([s({type:Boolean})],Pt.prototype,"primary",void 0),Lt([s({type:Boolean})],Pt.prototype,"secondary",void 0),Lt([s({type:Boolean})],Pt.prototype,"unbounded",void 0),Lt([s({type:Boolean})],Pt.prototype,"activated",void 0),Lt([s({type:Boolean})],Pt.prototype,"selected",void 0),Lt([s({type:Boolean})],Pt.prototype,"disabled",void 0),Lt([o()],Pt.prototype,"hovered",void 0),Lt([o()],Pt.prototype,"focused",void 0),Lt([o()],Pt.prototype,"pressed",void 0),Lt([o()],Pt.prototype,"rippling",void 0),Lt([o()],Pt.prototype,"originX",void 0),Lt([o()],Pt.prototype,"originY",void 0),Lt([r(".ft-ripple")],Pt.prototype,"ripple",void 0),Lt([r(".ft-ripple--effect")],Pt.prototype,"rippleEffect",void 0),(jt="ft-ripple",t=>{window.customElements.get(jt)||window.customElements.define(jt,t)})(Pt),t.FtRipple=Pt,t.FtRippleCssVariables=Rt,t.FtRipplePrimaryCssVariables=Mt,t.FtRippleSecondaryCssVariables=Ft,t.styles=At}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-ripple",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"description": "A custom Fluid Topics ripple component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-wc-utils": "1.0.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "1.0.56",
|
|
23
23
|
"lit": "2.7.2"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "da00d6ea6bfc74fef8c6687f383355e35a26289b"
|
|
26
26
|
}
|