@material/mwc-ripple
Advanced tools
Comparing version 0.15.0-canary.3a6e481a.0 to 0.15.0-canary.4e6be3f4.0
@@ -20,4 +20,5 @@ /** | ||
import MDCRippleFoundation from '@material/ripple/foundation.js'; | ||
import { RippleAPI } from './ripple-handlers.js'; | ||
/** @soyCompatible */ | ||
export declare class RippleBase extends BaseElement { | ||
export declare class RippleBase extends BaseElement implements RippleAPI { | ||
mdcRoot: HTMLElement; | ||
@@ -24,0 +25,0 @@ primary: boolean; |
@@ -22,3 +22,3 @@ import { __decorate } from "tslib"; | ||
import { classMap } from 'lit-html/directives/class-map.js'; | ||
import { styleMap } from 'lit-html/directives/style-map'; | ||
import { styleMap } from 'lit-html/directives/style-map.js'; | ||
/** @soyCompatible */ | ||
@@ -25,0 +25,0 @@ export class RippleBase extends BaseElement { |
{ | ||
"name": "@material/mwc-ripple", | ||
"version": "0.15.0-canary.3a6e481a.0", | ||
"version": "0.15.0-canary.4e6be3f4.0", | ||
"description": "", | ||
@@ -18,5 +18,5 @@ "main": "mwc-ripple.js", | ||
"dependencies": { | ||
"@material/dom": "=6.0.0-canary.cafe18860.0", | ||
"@material/mwc-base": "0.15.0-canary.3a6e481a.0", | ||
"@material/ripple": "=6.0.0-canary.cafe18860.0", | ||
"@material/dom": "=6.0.0-canary.35a32aaea.0", | ||
"@material/mwc-base": "0.15.0-canary.4e6be3f4.0", | ||
"@material/ripple": "=6.0.0-canary.35a32aaea.0", | ||
"lit-element": "^2.3.0", | ||
@@ -29,3 +29,3 @@ "lit-html": "^1.1.2", | ||
}, | ||
"gitHead": "0d89a3406dea7d2d2540aaeb339072cc01d18e2a" | ||
"gitHead": "1512aaf308db7992eea7201d4af81bf1e616d5d8" | ||
} |
@@ -0,1 +1,2 @@ | ||
import { RippleInterface } from '@material/mwc-base/form-element.js'; | ||
import MDCRippleFoundation from '@material/ripple/foundation.js'; | ||
@@ -12,2 +13,16 @@ import { PropertyPart } from 'lit-html'; | ||
} | ||
/** | ||
* force the ripple directive to share API names with `mwc-ripple` after Closure | ||
* Compiler. | ||
*/ | ||
declare class RippleIntermediate implements RippleInterface { | ||
private readonly foundation; | ||
constructor(foundation: MDCRippleFoundation); | ||
activate(): void; | ||
deactivate(): void; | ||
handleFocus(): void; | ||
handleBlur(): void; | ||
destroy(): void; | ||
setUnbounded(value: boolean): void; | ||
} | ||
declare global { | ||
@@ -22,3 +37,3 @@ interface Element { | ||
*/ | ||
export declare const rippleNode: (options: RippleNodeOptions) => MDCRippleFoundation; | ||
export declare const rippleNode: (options: RippleNodeOptions) => RippleIntermediate; | ||
/** | ||
@@ -30,1 +45,2 @@ * A directive that applies a Material ripple to a part node. The directive | ||
export declare const ripple: (options?: RippleOptions) => (part: PropertyPart) => void; | ||
export {}; |
@@ -24,2 +24,29 @@ /** | ||
const supportsCssVariablesWin = supportsCssVariables(window); | ||
/** | ||
* force the ripple directive to share API names with `mwc-ripple` after Closure | ||
* Compiler. | ||
*/ | ||
class RippleIntermediate { | ||
constructor(foundation) { | ||
this.foundation = foundation; | ||
} | ||
activate() { | ||
this.foundation.activate(); | ||
} | ||
deactivate() { | ||
this.foundation.deactivate(); | ||
} | ||
handleFocus() { | ||
this.foundation.handleFocus(); | ||
} | ||
handleBlur() { | ||
this.foundation.handleBlur(); | ||
} | ||
destroy() { | ||
this.foundation.destroy(); | ||
} | ||
setUnbounded(value) { | ||
this.foundation.setUnbounded(value); | ||
} | ||
} | ||
// NOTE: This is a workaround for | ||
@@ -84,3 +111,3 @@ // https://bugs.webkit.org/show_bug.cgi?id=173027. Since keyframes on | ||
rippleFoundation.init(); | ||
return rippleFoundation; | ||
return new RippleIntermediate(rippleFoundation); | ||
}; | ||
@@ -87,0 +114,0 @@ const rippleInteractionNodes = new WeakMap(); |
@@ -17,3 +17,7 @@ /** | ||
*/ | ||
import { Ripple } from './mwc-ripple.js'; | ||
import { RippleInterface } from '@material/mwc-base/utils.js'; | ||
export interface RippleAPI extends RippleInterface { | ||
handleMouseEnter: () => void; | ||
handleMouseLeave: () => void; | ||
} | ||
/** | ||
@@ -42,3 +46,3 @@ * Class that encapsulates the events handlers for `mwc-ripple` | ||
*/ | ||
export declare class RippleHandlers { | ||
export declare class RippleHandlers implements RippleAPI { | ||
activate: (ev?: Event) => void; | ||
@@ -52,3 +56,3 @@ deactivate: () => void; | ||
/** Function that returns a `mwc-ripple` */ | ||
rippleFn: () => Promise<Ripple | null>); | ||
rippleFn: () => Promise<RippleAPI | null>); | ||
} |
/** | ||
@license | ||
Copyright 2020 Google Inc. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
/** | ||
* Class that encapsulates the events handlers for `mwc-ripple` | ||
@@ -3,0 +19,0 @@ * |
@@ -22,6 +22,7 @@ /** | ||
import {classMap} from 'lit-html/directives/class-map.js'; | ||
import {styleMap} from 'lit-html/directives/style-map'; | ||
import {styleMap} from 'lit-html/directives/style-map.js'; | ||
import {RippleAPI} from './ripple-handlers.js'; | ||
/** @soyCompatible */ | ||
export class RippleBase extends BaseElement { | ||
export class RippleBase extends BaseElement implements RippleAPI { | ||
@query('.mdc-ripple-surface') mdcRoot!: HTMLElement; | ||
@@ -28,0 +29,0 @@ |
@@ -20,2 +20,3 @@ /** | ||
import {EventType, SpecificEventListener} from '@material/mwc-base/base-element.js'; | ||
import {RippleInterface} from '@material/mwc-base/form-element.js'; | ||
import {MDCRippleAdapter} from '@material/ripple/adapter.js'; | ||
@@ -41,2 +42,32 @@ import MDCRippleFoundation from '@material/ripple/foundation.js'; | ||
/** | ||
* force the ripple directive to share API names with `mwc-ripple` after Closure | ||
* Compiler. | ||
*/ | ||
class RippleIntermediate implements RippleInterface { | ||
private readonly foundation: MDCRippleFoundation; | ||
constructor(foundation: MDCRippleFoundation) { | ||
this.foundation = foundation; | ||
} | ||
activate() { | ||
this.foundation.activate(); | ||
} | ||
deactivate() { | ||
this.foundation.deactivate(); | ||
} | ||
handleFocus() { | ||
this.foundation.handleFocus(); | ||
} | ||
handleBlur() { | ||
this.foundation.handleBlur(); | ||
} | ||
destroy() { | ||
this.foundation.destroy(); | ||
} | ||
setUnbounded(value: boolean) { | ||
this.foundation.setUnbounded(value); | ||
} | ||
} | ||
declare global { | ||
@@ -123,3 +154,3 @@ interface Element { | ||
rippleFoundation.init(); | ||
return rippleFoundation; | ||
return new RippleIntermediate(rippleFoundation); | ||
}; | ||
@@ -138,4 +169,3 @@ | ||
const interactionNode = options.interactionNode || surfaceNode; | ||
let rippleFoundation = | ||
part.value as MDCRippleFoundation | typeof noChange; | ||
let rippleFoundation = part.value as RippleIntermediate | typeof noChange; | ||
// if the interaction node changes, destroy and invalidate the foundation. | ||
@@ -146,3 +176,3 @@ const existingInteractionNode = | ||
existingInteractionNode !== interactionNode) { | ||
(rippleFoundation as MDCRippleFoundation).destroy(); | ||
(rippleFoundation as RippleIntermediate).destroy(); | ||
rippleFoundation = noChange; | ||
@@ -159,7 +189,7 @@ } | ||
if (options.unbounded !== undefined) { | ||
(rippleFoundation as MDCRippleFoundation) | ||
(rippleFoundation as RippleIntermediate) | ||
.setUnbounded(options.unbounded); | ||
} | ||
if (options.disabled !== undefined) { | ||
(rippleFoundation as MDCRippleFoundation) | ||
(rippleFoundation as RippleIntermediate) | ||
.setUnbounded(options.disabled); | ||
@@ -169,6 +199,6 @@ } | ||
if (options.active === true) { | ||
(rippleFoundation as MDCRippleFoundation).activate(); | ||
(rippleFoundation as RippleIntermediate).activate(); | ||
} else if (options.active === false) { | ||
(rippleFoundation as MDCRippleFoundation).deactivate(); | ||
(rippleFoundation as RippleIntermediate).deactivate(); | ||
} | ||
}); |
@@ -17,4 +17,10 @@ /** | ||
*/ | ||
import {Ripple} from './mwc-ripple.js'; | ||
import {RippleInterface} from '@material/mwc-base/utils.js'; | ||
export interface RippleAPI extends RippleInterface { | ||
handleMouseEnter: () => void; | ||
handleMouseLeave: () => void; | ||
} | ||
/** | ||
@@ -43,3 +49,3 @@ * Class that encapsulates the events handlers for `mwc-ripple` | ||
*/ | ||
export class RippleHandlers { | ||
export class RippleHandlers implements RippleAPI { | ||
activate: (ev?: Event) => void; | ||
@@ -54,3 +60,3 @@ deactivate: () => void; | ||
/** Function that returns a `mwc-ripple` */ | ||
rippleFn: () => Promise<Ripple|null>) { | ||
rippleFn: () => Promise<RippleAPI|null>) { | ||
this.activate = (ev?: Event) => { | ||
@@ -57,0 +63,0 @@ rippleFn().then((r) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111093
1206
+ Added@material/mwc-base@0.15.0-canary.4e6be3f4.0(transitive)
- Removed@material/mwc-base@0.15.0-canary.3a6e481a.0(transitive)