tinkiet 0.11.2 → 0.11.4

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.
@@ -14,8 +14,8 @@ export declare class TkSwitch extends LitElement {
14
14
  connectedCallback(): void;
15
15
  disconnectedCallback(): void;
16
16
  firstUpdated(): void;
17
- protected onKeyDown(e: KeyboardEvent): void;
18
- protected handleClick(): void;
17
+ protected onKeyDown: (e: KeyboardEvent) => void;
18
+ protected handleClick: () => void;
19
19
  }
20
20
  declare global {
21
21
  interface HTMLElementTagNameMap {
package/topbar/index.js CHANGED
@@ -163,6 +163,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
163
163
  * Activate ripple
164
164
  */
165
165
  this.ripple = false;
166
+ this.showRipple = (event) => {
167
+ const x = event.clientX;
168
+ const y = event.clientY;
169
+ const { offsetWidth, offsetHeight } = this;
170
+ const container = document.createElement("span");
171
+ container.classList.add("ripple", "open");
172
+ const element = document.createElement("span");
173
+ container.appendChild(element);
174
+ this.shadowRoot.appendChild(container);
175
+ const rect = this.getBoundingClientRect();
176
+ const diameter = Math.max(offsetWidth, offsetWidth) * 2;
177
+ element.style.width = element.style.height = diameter + "px";
178
+ element.style.left = x - rect.left - diameter / 2 + "px";
179
+ element.style.top = y - rect.top - diameter / 2 + "px";
180
+ const inAnimation = element.animate({
181
+ transform: [`scale(0)`, `scale(1)`]
182
+ }, {
183
+ easing: "ease-out",
184
+ fill: "both",
185
+ duration: 500
186
+ });
187
+ inAnimation.onfinish = () => {
188
+ container.classList.remove("open");
189
+ const outAnimation = element.animate({
190
+ opacity: ["0.5", "0"]
191
+ }, {
192
+ easing: "ease-in",
193
+ fill: "both",
194
+ duration: 300
195
+ });
196
+ outAnimation.onfinish = () => {
197
+ requestAnimationFrame(() => {
198
+ container.remove();
199
+ });
200
+ };
201
+ };
202
+ };
203
+ this.hideRipple = (event) => {
204
+ var _a;
205
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
206
+ const element = container.querySelector("span");
207
+ const outAnimation = element.animate({
208
+ opacity: ["0.5", "0"]
209
+ }, {
210
+ easing: "ease-out",
211
+ fill: "both",
212
+ duration: 300
213
+ });
214
+ outAnimation.onfinish = () => {
215
+ requestAnimationFrame(() => {
216
+ container.remove();
217
+ });
218
+ };
219
+ });
220
+ };
166
221
  }
167
222
  static get styles() {
168
223
  return [
@@ -178,14 +233,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
178
233
  }
179
234
  connectedCallback() {
180
235
  if (this.ripple) {
181
- this.addEventListener("mousedown", this.showRipple.bind(this), { passive: true });
182
- this.addEventListener("mouseup", this.hideRipple.bind(this), { passive: true });
236
+ this.addEventListener("mousedown", this.showRipple, { passive: true });
237
+ this.addEventListener("mouseup", this.hideRipple, { passive: true });
183
238
  }
184
239
  super.connectedCallback();
185
240
  }
186
241
  disconnectedCallback() {
187
242
  this.removeEventListener("mousedown", this.showRipple);
188
- this.addEventListener("mouseup", this.hideRipple);
243
+ this.removeEventListener("mouseup", this.hideRipple);
189
244
  super.disconnectedCallback();
190
245
  }
191
246
  updated(props) {
@@ -195,61 +250,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
195
250
  // this.style.setProperty("color", this.color.toString());
196
251
  super.updated(props);
197
252
  }
198
- showRipple(event) {
199
- const x = event.clientX;
200
- const y = event.clientY;
201
- const { offsetWidth, offsetHeight } = this;
202
- const container = document.createElement("span");
203
- container.classList.add("ripple", "open");
204
- const element = document.createElement("span");
205
- container.appendChild(element);
206
- this.shadowRoot.appendChild(container);
207
- const rect = this.getBoundingClientRect();
208
- const diameter = Math.max(offsetWidth, offsetWidth) * 2;
209
- element.style.width = element.style.height = diameter + "px";
210
- element.style.left = x - rect.left - diameter / 2 + "px";
211
- element.style.top = y - rect.top - diameter / 2 + "px";
212
- const inAnimation = element.animate({
213
- transform: [`scale(0)`, `scale(1)`]
214
- }, {
215
- easing: "ease-out",
216
- fill: "both",
217
- duration: 500
218
- });
219
- inAnimation.onfinish = () => {
220
- container.classList.remove("open");
221
- const outAnimation = element.animate({
222
- opacity: ["0.5", "0"]
223
- }, {
224
- easing: "ease-in",
225
- fill: "both",
226
- duration: 300
227
- });
228
- outAnimation.onfinish = () => {
229
- requestAnimationFrame(() => {
230
- container.remove();
231
- });
232
- };
233
- };
234
- }
235
- hideRipple(event) {
236
- var _a;
237
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
238
- const element = container.querySelector("span");
239
- const outAnimation = element.animate({
240
- opacity: ["0.5", "0"]
241
- }, {
242
- easing: "ease-out",
243
- fill: "both",
244
- duration: 300
245
- });
246
- outAnimation.onfinish = () => {
247
- requestAnimationFrame(() => {
248
- container.remove();
249
- });
250
- };
251
- });
252
- }
253
253
  };
254
254
  __decorate([
255
255
  (0,decorators_js_.property)({ type: Boolean })