tinkiet 0.11.2 → 0.11.8
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/accordion/index.js +72 -62
- package/box/index.js +58 -58
- package/button/button.d.ts +10 -3
- package/button/index.js +127 -92
- package/checkbox/checkbox.d.ts +2 -4
- package/checkbox/index.js +99 -86
- package/chip/chip.d.ts +1 -1
- package/chip/index.js +30 -8
- package/dialog/dialog.d.ts +6 -2
- package/dialog/index.js +29 -9
- package/drawer/drawer.d.ts +11 -6
- package/drawer/index.js +79 -49
- package/icon/icon.d.ts +2 -1
- package/icon/index.js +90 -76
- package/index.js +431 -296
- package/list-item/index.js +94 -88
- package/list-item/list-item.d.ts +4 -4
- package/loading/index.js +58 -58
- package/notie/index.js +58 -58
- package/package.json +1 -1
- package/radio/index.js +79 -79
- package/radio/radio.d.ts +2 -2
- package/router/index.d.ts +6 -0
- package/router/index.js +52 -40
- package/select/index.js +58 -58
- package/switch/index.js +75 -75
- package/switch/switch.d.ts +2 -2
- package/theme/index.js +23 -26
- package/theme/theme.d.ts +2 -1
- package/topbar/index.js +58 -58
- package/umd/tinkiet.min.js +87 -53
package/icon/index.js
CHANGED
|
@@ -146,6 +146,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
146
146
|
* Activate ripple
|
|
147
147
|
*/
|
|
148
148
|
this.ripple = false;
|
|
149
|
+
this.showRipple = (event) => {
|
|
150
|
+
const x = event.clientX;
|
|
151
|
+
const y = event.clientY;
|
|
152
|
+
const { offsetWidth, offsetHeight } = this;
|
|
153
|
+
const container = document.createElement("span");
|
|
154
|
+
container.classList.add("ripple", "open");
|
|
155
|
+
const element = document.createElement("span");
|
|
156
|
+
container.appendChild(element);
|
|
157
|
+
this.shadowRoot.appendChild(container);
|
|
158
|
+
const rect = this.getBoundingClientRect();
|
|
159
|
+
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
160
|
+
element.style.width = element.style.height = diameter + "px";
|
|
161
|
+
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
162
|
+
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
163
|
+
const inAnimation = element.animate({
|
|
164
|
+
transform: [`scale(0)`, `scale(1)`]
|
|
165
|
+
}, {
|
|
166
|
+
easing: "ease-out",
|
|
167
|
+
fill: "both",
|
|
168
|
+
duration: 500
|
|
169
|
+
});
|
|
170
|
+
inAnimation.onfinish = () => {
|
|
171
|
+
container.classList.remove("open");
|
|
172
|
+
const outAnimation = element.animate({
|
|
173
|
+
opacity: ["0.5", "0"]
|
|
174
|
+
}, {
|
|
175
|
+
easing: "ease-in",
|
|
176
|
+
fill: "both",
|
|
177
|
+
duration: 300
|
|
178
|
+
});
|
|
179
|
+
outAnimation.onfinish = () => {
|
|
180
|
+
requestAnimationFrame(() => {
|
|
181
|
+
container.remove();
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
this.hideRipple = (event) => {
|
|
187
|
+
var _a;
|
|
188
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
189
|
+
const element = container.querySelector("span");
|
|
190
|
+
const outAnimation = element.animate({
|
|
191
|
+
opacity: ["0.5", "0"]
|
|
192
|
+
}, {
|
|
193
|
+
easing: "ease-out",
|
|
194
|
+
fill: "both",
|
|
195
|
+
duration: 300
|
|
196
|
+
});
|
|
197
|
+
outAnimation.onfinish = () => {
|
|
198
|
+
requestAnimationFrame(() => {
|
|
199
|
+
container.remove();
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
};
|
|
149
204
|
}
|
|
150
205
|
static get styles() {
|
|
151
206
|
return [
|
|
@@ -161,14 +216,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
161
216
|
}
|
|
162
217
|
connectedCallback() {
|
|
163
218
|
if (this.ripple) {
|
|
164
|
-
this.addEventListener("mousedown", this.showRipple
|
|
165
|
-
this.addEventListener("mouseup", this.hideRipple
|
|
219
|
+
this.addEventListener("mousedown", this.showRipple, { passive: true });
|
|
220
|
+
this.addEventListener("mouseup", this.hideRipple, { passive: true });
|
|
166
221
|
}
|
|
167
222
|
super.connectedCallback();
|
|
168
223
|
}
|
|
169
224
|
disconnectedCallback() {
|
|
170
225
|
this.removeEventListener("mousedown", this.showRipple);
|
|
171
|
-
this.
|
|
226
|
+
this.removeEventListener("mouseup", this.hideRipple);
|
|
172
227
|
super.disconnectedCallback();
|
|
173
228
|
}
|
|
174
229
|
updated(props) {
|
|
@@ -178,61 +233,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
178
233
|
// this.style.setProperty("color", this.color.toString());
|
|
179
234
|
super.updated(props);
|
|
180
235
|
}
|
|
181
|
-
showRipple(event) {
|
|
182
|
-
const x = event.clientX;
|
|
183
|
-
const y = event.clientY;
|
|
184
|
-
const { offsetWidth, offsetHeight } = this;
|
|
185
|
-
const container = document.createElement("span");
|
|
186
|
-
container.classList.add("ripple", "open");
|
|
187
|
-
const element = document.createElement("span");
|
|
188
|
-
container.appendChild(element);
|
|
189
|
-
this.shadowRoot.appendChild(container);
|
|
190
|
-
const rect = this.getBoundingClientRect();
|
|
191
|
-
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
192
|
-
element.style.width = element.style.height = diameter + "px";
|
|
193
|
-
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
194
|
-
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
195
|
-
const inAnimation = element.animate({
|
|
196
|
-
transform: [`scale(0)`, `scale(1)`]
|
|
197
|
-
}, {
|
|
198
|
-
easing: "ease-out",
|
|
199
|
-
fill: "both",
|
|
200
|
-
duration: 500
|
|
201
|
-
});
|
|
202
|
-
inAnimation.onfinish = () => {
|
|
203
|
-
container.classList.remove("open");
|
|
204
|
-
const outAnimation = element.animate({
|
|
205
|
-
opacity: ["0.5", "0"]
|
|
206
|
-
}, {
|
|
207
|
-
easing: "ease-in",
|
|
208
|
-
fill: "both",
|
|
209
|
-
duration: 300
|
|
210
|
-
});
|
|
211
|
-
outAnimation.onfinish = () => {
|
|
212
|
-
requestAnimationFrame(() => {
|
|
213
|
-
container.remove();
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
hideRipple(event) {
|
|
219
|
-
var _a;
|
|
220
|
-
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
221
|
-
const element = container.querySelector("span");
|
|
222
|
-
const outAnimation = element.animate({
|
|
223
|
-
opacity: ["0.5", "0"]
|
|
224
|
-
}, {
|
|
225
|
-
easing: "ease-out",
|
|
226
|
-
fill: "both",
|
|
227
|
-
duration: 300
|
|
228
|
-
});
|
|
229
|
-
outAnimation.onfinish = () => {
|
|
230
|
-
requestAnimationFrame(() => {
|
|
231
|
-
container.remove();
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
236
|
};
|
|
237
237
|
__decorate([
|
|
238
238
|
(0,decorators_js_.property)({ type: Boolean })
|
|
@@ -339,29 +339,43 @@ let TkIcon = class TkIcon extends box/* TkBox */.P {
|
|
|
339
339
|
`;
|
|
340
340
|
}
|
|
341
341
|
updated(props) {
|
|
342
|
-
if (props.has("name") && this.name)
|
|
342
|
+
if ((props.has("name") || props.has("library")) && this.name && !this.path)
|
|
343
343
|
this.loadIcon();
|
|
344
344
|
}
|
|
345
345
|
loadIcon() {
|
|
346
346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
+
if (!this.name || this.path) {
|
|
348
|
+
this.svg = "";
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const name = this.name;
|
|
352
|
+
const library = this.library;
|
|
347
353
|
const resolver = this.library
|
|
348
354
|
? document.querySelector(`tk-icons[library=${this.library}]`)
|
|
349
355
|
: document.querySelector("tk-icons");
|
|
350
|
-
if (resolver) {
|
|
351
|
-
this.svg =
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
return
|
|
364
|
-
}
|
|
356
|
+
if (!resolver) {
|
|
357
|
+
this.svg = "";
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
try {
|
|
361
|
+
const response = yield fetch(resolver.resolve(name));
|
|
362
|
+
if (!response.ok) {
|
|
363
|
+
this.svg = "";
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const contentType = response.headers.get("Content-Type") || "";
|
|
367
|
+
if (!/svg/i.test(contentType)) {
|
|
368
|
+
this.svg = "";
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const svg = yield response.text();
|
|
372
|
+
// Ensure the props are still current to avoid race conditions
|
|
373
|
+
if (name === this.name && library === this.library && !this.path) {
|
|
374
|
+
this.svg = svg;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
catch (_e) {
|
|
378
|
+
this.svg = "";
|
|
365
379
|
}
|
|
366
380
|
});
|
|
367
381
|
}
|
|
@@ -376,7 +390,7 @@ __decorate([
|
|
|
376
390
|
(0,decorators_js_.property)()
|
|
377
391
|
], TkIcon.prototype, "path", void 0);
|
|
378
392
|
__decorate([
|
|
379
|
-
(0,decorators_js_.
|
|
393
|
+
(0,decorators_js_.state)()
|
|
380
394
|
], TkIcon.prototype, "svg", void 0);
|
|
381
395
|
TkIcon = __decorate([
|
|
382
396
|
(0,decorators_js_.customElement)("tk-icon")
|
|
@@ -393,7 +407,7 @@ var x = (y) => {
|
|
|
393
407
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
394
408
|
}
|
|
395
409
|
var y = (x) => (() => (x))
|
|
396
|
-
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property) });
|
|
410
|
+
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property), ["state"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.state) });
|
|
397
411
|
|
|
398
412
|
/***/ })
|
|
399
413
|
|