@transcodes/ui-components 0.3.0 → 0.3.2
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/CHANGELOG.md +83 -0
- package/README.md +124 -79
- package/dist/controllers/animation.controller.js +32 -0
- package/dist/controllers/base.controller.js +8 -0
- package/dist/controllers/form-validation.controller.js +49 -0
- package/dist/controllers/history.controller.js +26 -0
- package/dist/controllers/index.d.ts +11 -0
- package/dist/controllers/index.js +18 -0
- package/dist/controllers/loading.controller.js +27 -0
- package/dist/controllers/match-media.controller.js +20 -0
- package/dist/controllers/message-bus.controller.js +45 -0
- package/dist/controllers/storage.controller.js +40 -0
- package/dist/index.d.ts +0 -696
- package/dist/index.js +80 -0
- package/dist/primitives/index.d.ts +21 -0
- package/dist/primitives/index.js +42 -0
- package/dist/primitives/tc-box.js +38 -0
- package/dist/primitives/tc-button.js +167 -0
- package/dist/primitives/tc-callout.js +86 -0
- package/dist/primitives/tc-card.js +76 -0
- package/dist/primitives/tc-chip.js +79 -0
- package/dist/primitives/tc-container.js +62 -0
- package/dist/primitives/tc-divider.js +76 -0
- package/dist/primitives/tc-error-message.js +74 -0
- package/dist/primitives/tc-form-header.js +120 -0
- package/dist/primitives/tc-icon.js +95 -0
- package/dist/primitives/tc-input-with-chip.js +242 -0
- package/dist/primitives/tc-input.js +262 -0
- package/dist/primitives/tc-item-button.js +168 -0
- package/dist/primitives/tc-item.js +93 -0
- package/dist/primitives/tc-otp-input.js +230 -0
- package/dist/primitives/tc-section.js +48 -0
- package/dist/primitives/tc-spinner.js +87 -0
- package/dist/primitives/tc-symbol.js +56 -0
- package/dist/primitives/tc-text.js +145 -0
- package/dist/primitives/tc-toast.js +189 -0
- package/dist/screens/index.d.ts +4 -0
- package/dist/screens/index.js +8 -0
- package/dist/screens/tc-error-screen.js +119 -0
- package/dist/screens/tc-loading-screen.js +77 -0
- package/dist/screens/tc-success-screen.js +192 -0
- package/dist/styles/shared.js +7 -0
- package/dist/widgets/index.d.ts +9 -0
- package/dist/widgets/index.js +18 -0
- package/dist/widgets/tc-authenticator-card.js +213 -0
- package/dist/widgets/tc-floating-button.js +132 -0
- package/dist/widgets/tc-iframe-modal.js +263 -0
- package/dist/widgets/tc-installation-banner.js +234 -0
- package/dist/widgets/tc-ios-installation-guide.js +240 -0
- package/dist/widgets/tc-notification-modal.js +230 -0
- package/dist/widgets/tc-offline-modal.js +202 -0
- package/dist/widgets/tc-page-decoration.js +126 -0
- package/package.json +25 -7
- package/dist/ui-components.css +0 -1
- package/dist/ui-components.js +0 -4981
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseController as a } from "./base.controller.js";
|
|
2
|
+
class i extends a {
|
|
3
|
+
constructor(t, s, o = localStorage) {
|
|
4
|
+
super(t), this._value = null, this.handleStorageChange = (e) => {
|
|
5
|
+
e.key === this.key && e.storageArea === this.storage && (this.load(), this.host.requestUpdate());
|
|
6
|
+
}, this.key = s, this.storage = o, this.load();
|
|
7
|
+
}
|
|
8
|
+
get value() {
|
|
9
|
+
return this._value;
|
|
10
|
+
}
|
|
11
|
+
set(t) {
|
|
12
|
+
this._value = t;
|
|
13
|
+
try {
|
|
14
|
+
this.storage.setItem(this.key, JSON.stringify(t));
|
|
15
|
+
} catch {
|
|
16
|
+
console.warn(`Failed to save to storage: ${this.key}`);
|
|
17
|
+
}
|
|
18
|
+
this.host.requestUpdate();
|
|
19
|
+
}
|
|
20
|
+
remove() {
|
|
21
|
+
this._value = null, this.storage.removeItem(this.key), this.host.requestUpdate();
|
|
22
|
+
}
|
|
23
|
+
load() {
|
|
24
|
+
try {
|
|
25
|
+
const t = this.storage.getItem(this.key);
|
|
26
|
+
t !== null && (this._value = JSON.parse(t));
|
|
27
|
+
} catch {
|
|
28
|
+
this._value = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
hostConnected() {
|
|
32
|
+
window.addEventListener("storage", this.handleStorageChange);
|
|
33
|
+
}
|
|
34
|
+
hostDisconnected() {
|
|
35
|
+
window.removeEventListener("storage", this.handleStorageChange);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
i as StorageController
|
|
40
|
+
};
|