@leavittsoftware/web 6.13.0 → 6.14.0

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.
@@ -0,0 +1,14 @@
1
+ import { LitElement } from 'lit';
2
+ import '@material/web/progress/circular-progress';
3
+ declare const LeavittServiceWorkerNotifier_base: import("../theme/theme-preference").Constructor<import("../theme/theme-preference").ThemePreferenceInterface> & typeof LitElement;
4
+ export declare class LeavittServiceWorkerNotifier extends LeavittServiceWorkerNotifier_base {
5
+ #private;
6
+ private accessor main;
7
+ private accessor isLoading;
8
+ connectedCallback(): Promise<void>;
9
+ static styles: import("lit").CSSResult[];
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ handleClick(): Promise<void>;
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=service-worker-notifier.d.ts.map
@@ -0,0 +1,180 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { customElement, query, state } from 'lit/decorators.js';
4
+ import { ThemePreference } from '../theme/theme-preference';
5
+ import '@material/web/progress/circular-progress';
6
+ let LeavittServiceWorkerNotifier = class LeavittServiceWorkerNotifier extends ThemePreference(LitElement) {
7
+ #main_accessor_storage;
8
+ get main() { return this.#main_accessor_storage; }
9
+ set main(value) { this.#main_accessor_storage = value; }
10
+ #isLoading_accessor_storage = false;
11
+ get isLoading() { return this.#isLoading_accessor_storage; }
12
+ set isLoading(value) { this.#isLoading_accessor_storage = value; }
13
+ #newWorker;
14
+ #refreshing = false;
15
+ async connectedCallback() {
16
+ super.connectedCallback();
17
+ if ('serviceWorker' in navigator) {
18
+ const originalSW = navigator.serviceWorker.controller;
19
+ const reg = await navigator.serviceWorker.getRegistration();
20
+ if (reg) {
21
+ reg.addEventListener('updatefound', () => {
22
+ this.#newWorker = reg.installing;
23
+ this.#newWorker?.addEventListener('statechange', () => {
24
+ if (this.#newWorker?.state === 'installed' && navigator.serviceWorker.controller) {
25
+ this.#newWorker?.postMessage({ type: 'SKIP_WAITING' });
26
+ }
27
+ });
28
+ });
29
+ if (reg.waiting && navigator.serviceWorker.controller) {
30
+ this.#newWorker = reg.waiting;
31
+ this.#newWorker?.postMessage({ type: 'SKIP_WAITING' });
32
+ }
33
+ }
34
+ navigator.serviceWorker.addEventListener('controllerchange', () => {
35
+ if (this.#refreshing) {
36
+ return;
37
+ }
38
+ if (originalSW) {
39
+ this.main.showPopover();
40
+ this.#refreshing = true;
41
+ }
42
+ else {
43
+ //This is due to a SW taking control for the first time
44
+ }
45
+ });
46
+ }
47
+ }
48
+ static { this.styles = [
49
+ css `
50
+ :host {
51
+ display: block;
52
+ container-type: inline-size;
53
+ }
54
+
55
+ main {
56
+ display: none;
57
+ position: fixed;
58
+ background-color: var(--app-background-color);
59
+ color: var(--md-sys-color-on-background);
60
+
61
+ cursor: pointer;
62
+
63
+ user-select: none;
64
+ -webkit-user-select: none;
65
+ -moz-user-select: none;
66
+ -ms-user-select: none;
67
+
68
+ grid: 'image text' / auto 1fr;
69
+ align-items: center;
70
+ gap: 16px 12px;
71
+
72
+ border: 0;
73
+ padding: 8px;
74
+
75
+ @container (max-width: 500px) {
76
+ grid:
77
+ 'image' auto
78
+ 'text' 1fr / auto;
79
+
80
+ justify-items: center;
81
+ text-align: center;
82
+ }
83
+ }
84
+
85
+ main::backdrop {
86
+ background-color: var(--app-background-color);
87
+ }
88
+
89
+ main:popover-open {
90
+ display: grid;
91
+ }
92
+
93
+ md-circular-progress,
94
+ img {
95
+ grid-area: image;
96
+ width: 48px;
97
+ height: 48px;
98
+ }
99
+
100
+ h1 {
101
+ font-family: var(--titanium-styles-h1-font-family, Metropolis, Roboto, Noto, sans-serif);
102
+ -webkit-font-smoothing: antialiased;
103
+ font-size: 32px;
104
+ line-height: 34px;
105
+ font-weight: 700;
106
+ letter-spacing: -1px;
107
+
108
+ margin: 0;
109
+ padding: 0;
110
+
111
+ @container (max-width: 500px) {
112
+ font-size: 24px;
113
+ line-height: 26px;
114
+
115
+ margin-bottom: 6px;
116
+ }
117
+ }
118
+
119
+ h3 {
120
+ font-family: var(--titanium-styles-h2-font-family, Metropolis, Roboto, Noto, sans-serif);
121
+ -webkit-font-smoothing: antialiased;
122
+ font-size: 16px;
123
+ line-height: 18px;
124
+ font-weight: 300;
125
+ letter-spacing: 0.6px;
126
+
127
+ margin: 0;
128
+ padding: 0;
129
+ margin-left: 6px;
130
+ }
131
+
132
+ click-blocker {
133
+ display: none;
134
+ position: fixed;
135
+ width: 100vw;
136
+ height: 100vh;
137
+ z-index: 9999;
138
+ left: 0;
139
+ right: 0;
140
+ background: transparent;
141
+ cursor: pointer;
142
+ pointer-events: all;
143
+ }
144
+
145
+ main:popover-open + click-blocker {
146
+ display: block;
147
+ }
148
+ `,
149
+ ]; }
150
+ render() {
151
+ return html `<main popover="manual" @click=${this.handleClick}>
152
+ ${this.isLoading
153
+ ? html `<md-circular-progress indeterminate></md-circular-progress>`
154
+ : html `<img
155
+ src=${this.themePreference === 'dark' ? 'https://cdn.leavitt.com/company-mark-57-dark.svg' : 'https://cdn.leavitt.com/company-mark-57.svg'}
156
+ />`}
157
+ <div>
158
+ <h1>This site has been updated!</h1>
159
+ <h3>Please click to reload</h3>
160
+ </div>
161
+ </main>
162
+ <click-blocker @click=${this.handleClick}></click-blocker>`;
163
+ }
164
+ async handleClick() {
165
+ this.isLoading = true;
166
+ await this.updateComplete;
167
+ window.location.reload();
168
+ }
169
+ };
170
+ __decorate([
171
+ query('main')
172
+ ], LeavittServiceWorkerNotifier.prototype, "main", null);
173
+ __decorate([
174
+ state()
175
+ ], LeavittServiceWorkerNotifier.prototype, "isLoading", null);
176
+ LeavittServiceWorkerNotifier = __decorate([
177
+ customElement('leavitt-service-worker-notifier')
178
+ ], LeavittServiceWorkerNotifier);
179
+ export { LeavittServiceWorkerNotifier };
180
+ //# sourceMappingURL=service-worker-notifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-worker-notifier.js","sourceRoot":"","sources":["service-worker-notifier.ts"],"names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,CAAC;;AArK+B;IAA/B,KAAK,CAAC,MAAM,CAAC;wDAAoC;AAExB;IAAzB,KAAK,EAAE;6DAA6C;AAH1C,4BAA4B;IADxC,aAAa,CAAC,iCAAiC,CAAC;GACpC,4BAA4B,CAuKxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavittsoftware/web",
3
- "version": "6.13.0",
3
+ "version": "6.14.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "files": [
@@ -44,5 +44,5 @@
44
44
  "url": "https://github.com/LeavittSoftware/titanium-elements/issues"
45
45
  },
46
46
  "homepage": "https://github.com/LeavittSoftware/titanium-elements/#readme",
47
- "gitHead": "f10ccca7e294b124cc028ccc2d0a8040b938901a"
47
+ "gitHead": "ee3aa42fb22d8492823831ad97a3b4d51a708a88"
48
48
  }