tinkiet 0.11.0 → 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.
@@ -61,6 +61,25 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
61
61
  super();
62
62
  this.href = "";
63
63
  this.target = "";
64
+ this.onKeyDown = (e) => {
65
+ if (e.code === "Space" || e.code === "Enter") {
66
+ e.preventDefault();
67
+ e.stopPropagation();
68
+ this.click();
69
+ }
70
+ };
71
+ this.handleClick = (e) => {
72
+ const target = e.target;
73
+ // In case click cames from a slotted element with href attribute we stop propagation
74
+ if (target.tagName == "BUTTON" || target.tagName == "TK-BUTTON" || target.tagName == "TK-SWITCH" || target.tagName == "TK-CHECKBOX") {
75
+ return;
76
+ }
77
+ if (this.href && e.isTrusted) {
78
+ e.stopPropagation();
79
+ e.preventDefault();
80
+ this.$ahref.click();
81
+ }
82
+ };
64
83
  }
65
84
  firstUpdated() {
66
85
  if (!this.ariaLabel && this.innerText)
@@ -68,33 +87,14 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
68
87
  }
69
88
  connectedCallback() {
70
89
  super.connectedCallback();
71
- this.addEventListener("keydown", this.onKeyDown.bind(this));
72
- this.addEventListener("click", this.handleClick.bind(this));
90
+ this.addEventListener("keydown", this.onKeyDown);
91
+ this.addEventListener("click", this.handleClick);
73
92
  }
74
93
  disconnectedCallback() {
75
94
  super.disconnectedCallback();
76
95
  this.removeEventListener("click", this.handleClick);
77
96
  this.removeEventListener("keydown", this.onKeyDown);
78
97
  }
79
- onKeyDown(e) {
80
- if (e.code === "Space" || e.code === "Enter") {
81
- e.preventDefault();
82
- e.stopPropagation();
83
- this.click();
84
- }
85
- }
86
- handleClick(e) {
87
- const target = e.target;
88
- // In case click cames from a slotted element with href attribute we stop propagation
89
- if (target.tagName == "BUTTON" || target.tagName == "TK-BUTTON" || target.tagName == "TK-SWITCH" || target.tagName == "TK-CHECKBOX") {
90
- return;
91
- }
92
- if (this.href && e.isTrusted) {
93
- e.stopPropagation();
94
- e.preventDefault();
95
- this.$ahref.click();
96
- }
97
- }
98
98
  };
99
99
  __decorate([
100
100
  (0,decorators_js_.property)({ attribute: true })
@@ -220,6 +220,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
220
220
  * Activate ripple
221
221
  */
222
222
  this.ripple = false;
223
+ this.showRipple = (event) => {
224
+ const x = event.clientX;
225
+ const y = event.clientY;
226
+ const { offsetWidth, offsetHeight } = this;
227
+ const container = document.createElement("span");
228
+ container.classList.add("ripple", "open");
229
+ const element = document.createElement("span");
230
+ container.appendChild(element);
231
+ this.shadowRoot.appendChild(container);
232
+ const rect = this.getBoundingClientRect();
233
+ const diameter = Math.max(offsetWidth, offsetWidth) * 2;
234
+ element.style.width = element.style.height = diameter + "px";
235
+ element.style.left = x - rect.left - diameter / 2 + "px";
236
+ element.style.top = y - rect.top - diameter / 2 + "px";
237
+ const inAnimation = element.animate({
238
+ transform: [`scale(0)`, `scale(1)`]
239
+ }, {
240
+ easing: "ease-out",
241
+ fill: "both",
242
+ duration: 500
243
+ });
244
+ inAnimation.onfinish = () => {
245
+ container.classList.remove("open");
246
+ const outAnimation = element.animate({
247
+ opacity: ["0.5", "0"]
248
+ }, {
249
+ easing: "ease-in",
250
+ fill: "both",
251
+ duration: 300
252
+ });
253
+ outAnimation.onfinish = () => {
254
+ requestAnimationFrame(() => {
255
+ container.remove();
256
+ });
257
+ };
258
+ };
259
+ };
260
+ this.hideRipple = (event) => {
261
+ var _a;
262
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
263
+ const element = container.querySelector("span");
264
+ const outAnimation = element.animate({
265
+ opacity: ["0.5", "0"]
266
+ }, {
267
+ easing: "ease-out",
268
+ fill: "both",
269
+ duration: 300
270
+ });
271
+ outAnimation.onfinish = () => {
272
+ requestAnimationFrame(() => {
273
+ container.remove();
274
+ });
275
+ };
276
+ });
277
+ };
223
278
  }
224
279
  static get styles() {
225
280
  return [
@@ -235,14 +290,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
235
290
  }
236
291
  connectedCallback() {
237
292
  if (this.ripple) {
238
- this.addEventListener("mousedown", this.showRipple.bind(this), { passive: true });
239
- this.addEventListener("mouseup", this.hideRipple.bind(this), { passive: true });
293
+ this.addEventListener("mousedown", this.showRipple, { passive: true });
294
+ this.addEventListener("mouseup", this.hideRipple, { passive: true });
240
295
  }
241
296
  super.connectedCallback();
242
297
  }
243
298
  disconnectedCallback() {
244
299
  this.removeEventListener("mousedown", this.showRipple);
245
- this.addEventListener("mouseup", this.hideRipple);
300
+ this.removeEventListener("mouseup", this.hideRipple);
246
301
  super.disconnectedCallback();
247
302
  }
248
303
  updated(props) {
@@ -252,61 +307,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
252
307
  // this.style.setProperty("color", this.color.toString());
253
308
  super.updated(props);
254
309
  }
255
- showRipple(event) {
256
- const x = event.clientX;
257
- const y = event.clientY;
258
- const { offsetWidth, offsetHeight } = this;
259
- const container = document.createElement("span");
260
- container.classList.add("ripple", "open");
261
- const element = document.createElement("span");
262
- container.appendChild(element);
263
- this.shadowRoot.appendChild(container);
264
- const rect = this.getBoundingClientRect();
265
- const diameter = Math.max(offsetWidth, offsetWidth) * 2;
266
- element.style.width = element.style.height = diameter + "px";
267
- element.style.left = x - rect.left - diameter / 2 + "px";
268
- element.style.top = y - rect.top - diameter / 2 + "px";
269
- const inAnimation = element.animate({
270
- transform: [`scale(0)`, `scale(1)`]
271
- }, {
272
- easing: "ease-out",
273
- fill: "both",
274
- duration: 500
275
- });
276
- inAnimation.onfinish = () => {
277
- container.classList.remove("open");
278
- const outAnimation = element.animate({
279
- opacity: ["0.5", "0"]
280
- }, {
281
- easing: "ease-in",
282
- fill: "both",
283
- duration: 300
284
- });
285
- outAnimation.onfinish = () => {
286
- requestAnimationFrame(() => {
287
- container.remove();
288
- });
289
- };
290
- };
291
- }
292
- hideRipple(event) {
293
- var _a;
294
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
295
- const element = container.querySelector("span");
296
- const outAnimation = element.animate({
297
- opacity: ["0.5", "0"]
298
- }, {
299
- easing: "ease-out",
300
- fill: "both",
301
- duration: 300
302
- });
303
- outAnimation.onfinish = () => {
304
- requestAnimationFrame(() => {
305
- container.remove();
306
- });
307
- };
308
- });
309
- }
310
310
  };
311
311
  __decorate([
312
312
  (0,decorators_js_.property)({ type: Boolean })
@@ -10,8 +10,8 @@ export declare class TkListItem extends TkBox {
10
10
  firstUpdated(): void;
11
11
  connectedCallback(): void;
12
12
  disconnectedCallback(): void;
13
- protected onKeyDown(e: KeyboardEvent): void;
14
- protected handleClick(e: Event): void;
13
+ protected onKeyDown: (e: KeyboardEvent) => void;
14
+ protected handleClick: (e: Event) => void;
15
15
  }
16
16
  declare global {
17
17
  interface HTMLElementTagNameMap {
package/loading/index.js CHANGED
@@ -108,6 +108,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
108
108
  * Activate ripple
109
109
  */
110
110
  this.ripple = false;
111
+ this.showRipple = (event) => {
112
+ const x = event.clientX;
113
+ const y = event.clientY;
114
+ const { offsetWidth, offsetHeight } = this;
115
+ const container = document.createElement("span");
116
+ container.classList.add("ripple", "open");
117
+ const element = document.createElement("span");
118
+ container.appendChild(element);
119
+ this.shadowRoot.appendChild(container);
120
+ const rect = this.getBoundingClientRect();
121
+ const diameter = Math.max(offsetWidth, offsetWidth) * 2;
122
+ element.style.width = element.style.height = diameter + "px";
123
+ element.style.left = x - rect.left - diameter / 2 + "px";
124
+ element.style.top = y - rect.top - diameter / 2 + "px";
125
+ const inAnimation = element.animate({
126
+ transform: [`scale(0)`, `scale(1)`]
127
+ }, {
128
+ easing: "ease-out",
129
+ fill: "both",
130
+ duration: 500
131
+ });
132
+ inAnimation.onfinish = () => {
133
+ container.classList.remove("open");
134
+ const outAnimation = element.animate({
135
+ opacity: ["0.5", "0"]
136
+ }, {
137
+ easing: "ease-in",
138
+ fill: "both",
139
+ duration: 300
140
+ });
141
+ outAnimation.onfinish = () => {
142
+ requestAnimationFrame(() => {
143
+ container.remove();
144
+ });
145
+ };
146
+ };
147
+ };
148
+ this.hideRipple = (event) => {
149
+ var _a;
150
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
151
+ const element = container.querySelector("span");
152
+ const outAnimation = element.animate({
153
+ opacity: ["0.5", "0"]
154
+ }, {
155
+ easing: "ease-out",
156
+ fill: "both",
157
+ duration: 300
158
+ });
159
+ outAnimation.onfinish = () => {
160
+ requestAnimationFrame(() => {
161
+ container.remove();
162
+ });
163
+ };
164
+ });
165
+ };
111
166
  }
112
167
  static get styles() {
113
168
  return [
@@ -123,14 +178,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
123
178
  }
124
179
  connectedCallback() {
125
180
  if (this.ripple) {
126
- this.addEventListener("mousedown", this.showRipple.bind(this), { passive: true });
127
- this.addEventListener("mouseup", this.hideRipple.bind(this), { passive: true });
181
+ this.addEventListener("mousedown", this.showRipple, { passive: true });
182
+ this.addEventListener("mouseup", this.hideRipple, { passive: true });
128
183
  }
129
184
  super.connectedCallback();
130
185
  }
131
186
  disconnectedCallback() {
132
187
  this.removeEventListener("mousedown", this.showRipple);
133
- this.addEventListener("mouseup", this.hideRipple);
188
+ this.removeEventListener("mouseup", this.hideRipple);
134
189
  super.disconnectedCallback();
135
190
  }
136
191
  updated(props) {
@@ -140,61 +195,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
140
195
  // this.style.setProperty("color", this.color.toString());
141
196
  super.updated(props);
142
197
  }
143
- showRipple(event) {
144
- const x = event.clientX;
145
- const y = event.clientY;
146
- const { offsetWidth, offsetHeight } = this;
147
- const container = document.createElement("span");
148
- container.classList.add("ripple", "open");
149
- const element = document.createElement("span");
150
- container.appendChild(element);
151
- this.shadowRoot.appendChild(container);
152
- const rect = this.getBoundingClientRect();
153
- const diameter = Math.max(offsetWidth, offsetWidth) * 2;
154
- element.style.width = element.style.height = diameter + "px";
155
- element.style.left = x - rect.left - diameter / 2 + "px";
156
- element.style.top = y - rect.top - diameter / 2 + "px";
157
- const inAnimation = element.animate({
158
- transform: [`scale(0)`, `scale(1)`]
159
- }, {
160
- easing: "ease-out",
161
- fill: "both",
162
- duration: 500
163
- });
164
- inAnimation.onfinish = () => {
165
- container.classList.remove("open");
166
- const outAnimation = element.animate({
167
- opacity: ["0.5", "0"]
168
- }, {
169
- easing: "ease-in",
170
- fill: "both",
171
- duration: 300
172
- });
173
- outAnimation.onfinish = () => {
174
- requestAnimationFrame(() => {
175
- container.remove();
176
- });
177
- };
178
- };
179
- }
180
- hideRipple(event) {
181
- var _a;
182
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
183
- const element = container.querySelector("span");
184
- const outAnimation = element.animate({
185
- opacity: ["0.5", "0"]
186
- }, {
187
- easing: "ease-out",
188
- fill: "both",
189
- duration: 300
190
- });
191
- outAnimation.onfinish = () => {
192
- requestAnimationFrame(() => {
193
- container.remove();
194
- });
195
- };
196
- });
197
- }
198
198
  };
199
199
  __decorate([
200
200
  (0,decorators_js_.property)({ type: Boolean })
package/notie/index.js CHANGED
@@ -275,6 +275,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
275
275
  * Activate ripple
276
276
  */
277
277
  this.ripple = false;
278
+ this.showRipple = (event) => {
279
+ const x = event.clientX;
280
+ const y = event.clientY;
281
+ const { offsetWidth, offsetHeight } = this;
282
+ const container = document.createElement("span");
283
+ container.classList.add("ripple", "open");
284
+ const element = document.createElement("span");
285
+ container.appendChild(element);
286
+ this.shadowRoot.appendChild(container);
287
+ const rect = this.getBoundingClientRect();
288
+ const diameter = Math.max(offsetWidth, offsetWidth) * 2;
289
+ element.style.width = element.style.height = diameter + "px";
290
+ element.style.left = x - rect.left - diameter / 2 + "px";
291
+ element.style.top = y - rect.top - diameter / 2 + "px";
292
+ const inAnimation = element.animate({
293
+ transform: [`scale(0)`, `scale(1)`]
294
+ }, {
295
+ easing: "ease-out",
296
+ fill: "both",
297
+ duration: 500
298
+ });
299
+ inAnimation.onfinish = () => {
300
+ container.classList.remove("open");
301
+ const outAnimation = element.animate({
302
+ opacity: ["0.5", "0"]
303
+ }, {
304
+ easing: "ease-in",
305
+ fill: "both",
306
+ duration: 300
307
+ });
308
+ outAnimation.onfinish = () => {
309
+ requestAnimationFrame(() => {
310
+ container.remove();
311
+ });
312
+ };
313
+ };
314
+ };
315
+ this.hideRipple = (event) => {
316
+ var _a;
317
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
318
+ const element = container.querySelector("span");
319
+ const outAnimation = element.animate({
320
+ opacity: ["0.5", "0"]
321
+ }, {
322
+ easing: "ease-out",
323
+ fill: "both",
324
+ duration: 300
325
+ });
326
+ outAnimation.onfinish = () => {
327
+ requestAnimationFrame(() => {
328
+ container.remove();
329
+ });
330
+ };
331
+ });
332
+ };
278
333
  }
279
334
  static get styles() {
280
335
  return [
@@ -290,14 +345,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
290
345
  }
291
346
  connectedCallback() {
292
347
  if (this.ripple) {
293
- this.addEventListener("mousedown", this.showRipple.bind(this), { passive: true });
294
- this.addEventListener("mouseup", this.hideRipple.bind(this), { passive: true });
348
+ this.addEventListener("mousedown", this.showRipple, { passive: true });
349
+ this.addEventListener("mouseup", this.hideRipple, { passive: true });
295
350
  }
296
351
  super.connectedCallback();
297
352
  }
298
353
  disconnectedCallback() {
299
354
  this.removeEventListener("mousedown", this.showRipple);
300
- this.addEventListener("mouseup", this.hideRipple);
355
+ this.removeEventListener("mouseup", this.hideRipple);
301
356
  super.disconnectedCallback();
302
357
  }
303
358
  updated(props) {
@@ -307,61 +362,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
307
362
  // this.style.setProperty("color", this.color.toString());
308
363
  super.updated(props);
309
364
  }
310
- showRipple(event) {
311
- const x = event.clientX;
312
- const y = event.clientY;
313
- const { offsetWidth, offsetHeight } = this;
314
- const container = document.createElement("span");
315
- container.classList.add("ripple", "open");
316
- const element = document.createElement("span");
317
- container.appendChild(element);
318
- this.shadowRoot.appendChild(container);
319
- const rect = this.getBoundingClientRect();
320
- const diameter = Math.max(offsetWidth, offsetWidth) * 2;
321
- element.style.width = element.style.height = diameter + "px";
322
- element.style.left = x - rect.left - diameter / 2 + "px";
323
- element.style.top = y - rect.top - diameter / 2 + "px";
324
- const inAnimation = element.animate({
325
- transform: [`scale(0)`, `scale(1)`]
326
- }, {
327
- easing: "ease-out",
328
- fill: "both",
329
- duration: 500
330
- });
331
- inAnimation.onfinish = () => {
332
- container.classList.remove("open");
333
- const outAnimation = element.animate({
334
- opacity: ["0.5", "0"]
335
- }, {
336
- easing: "ease-in",
337
- fill: "both",
338
- duration: 300
339
- });
340
- outAnimation.onfinish = () => {
341
- requestAnimationFrame(() => {
342
- container.remove();
343
- });
344
- };
345
- };
346
- }
347
- hideRipple(event) {
348
- var _a;
349
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
350
- const element = container.querySelector("span");
351
- const outAnimation = element.animate({
352
- opacity: ["0.5", "0"]
353
- }, {
354
- easing: "ease-out",
355
- fill: "both",
356
- duration: 300
357
- });
358
- outAnimation.onfinish = () => {
359
- requestAnimationFrame(() => {
360
- container.remove();
361
- });
362
- };
363
- });
364
- }
365
365
  };
366
366
  __decorate([
367
367
  (0,decorators_js_.property)({ type: Boolean })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinkiet",
3
- "version": "0.11.0",
3
+ "version": "0.11.4",
4
4
  "description": "Pragmatic UI Web Components",
5
5
  "type": "module",
6
6
  "main": "index.js",