@gravionlabs/helix-desktop 22.5.1 → 22.7.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.
package/README.md CHANGED
@@ -24,3 +24,5 @@ The Helix desktop frame for Angular: activity bar, views, status bar and the pla
24
24
  ```
25
25
 
26
26
  The styles read only `--h-*` tokens, so light and dark follow `HxTheme`.
27
+
28
+ In a Tauri app the content security policy must leave `style-src` alone (`"dangerousDisableAssetCspModification": ["style-src"]`), or the release build renders without its component and grid styles. See [Tauri content security policy](https://github.com/GravionLabs/helix/blob/main/docs/HELIX-DESKTOP.md#tauri-content-security-policy).
@@ -27,9 +27,21 @@ function tauriUpdateBackend() {
27
27
  date: update.date ?? null
28
28
  };
29
29
  },
30
- async install() {
30
+ async install(onProgress) {
31
31
  if (!pending) throw new Error("No update to install");
32
- await pending.downloadAndInstall();
32
+ let total = 0;
33
+ let done = 0;
34
+ await pending.downloadAndInstall((e) => {
35
+ if (!onProgress) return;
36
+ if (e.event === "Started") {
37
+ total = e.data?.contentLength ?? 0;
38
+ done = 0;
39
+ onProgress(total > 0 ? 0 : null);
40
+ } else if (e.event === "Progress") {
41
+ done += e.data?.chunkLength ?? 0;
42
+ onProgress(total > 0 ? Math.min(100, Math.round(done / total * 100)) : null);
43
+ } else onProgress(total > 0 ? 100 : null);
44
+ });
33
45
  },
34
46
  async relaunch() {
35
47
  const { relaunch } = await import("@tauri-apps/plugin-process");
@@ -83,7 +95,7 @@ var HxStatusAppVersion = class HxStatusAppVersion {
83
95
  info = inject(HX_APP_INFO);
84
96
  static ɵfac = i0.ɵɵngDeclareFactory({
85
97
  minVersion: "12.0.0",
86
- version: "22.2.4",
98
+ version: "22.2.6",
87
99
  ngImport: i0,
88
100
  type: HxStatusAppVersion,
89
101
  deps: [],
@@ -91,13 +103,12 @@ var HxStatusAppVersion = class HxStatusAppVersion {
91
103
  });
92
104
  static ɵcmp = i0.ɵɵngDeclareComponent({
93
105
  minVersion: "14.0.0",
94
- version: "22.2.4",
106
+ version: "22.2.6",
95
107
  type: HxStatusAppVersion,
96
108
  isStandalone: true,
97
109
  selector: "hx-status-app-version",
98
110
  ngImport: i0,
99
- template: `<hx-status-version [version]="info.version" [channel]="info.channel === 'rc' ? 'RC' : null" />`,
100
- isInline: true,
111
+ template: "<hx-status-version [version]=\"info.version\" [channel]=\"info.channel === 'rc' ? 'RC' : null\" />\n",
101
112
  dependencies: [{
102
113
  kind: "component",
103
114
  type: HxStatusVersion,
@@ -109,7 +120,7 @@ var HxStatusAppVersion = class HxStatusAppVersion {
109
120
  };
110
121
  i0.ɵɵngDeclareClassMetadata({
111
122
  minVersion: "12.0.0",
112
- version: "22.2.4",
123
+ version: "22.2.6",
113
124
  ngImport: i0,
114
125
  type: HxStatusAppVersion,
115
126
  decorators: [{
@@ -118,16 +129,23 @@ i0.ɵɵngDeclareClassMetadata({
118
129
  selector: "hx-status-app-version",
119
130
  imports: [HxStatusVersion],
120
131
  changeDetection: ChangeDetectionStrategy.OnPush,
121
- template: `<hx-status-version [version]="info.version" [channel]="info.channel === 'rc' ? 'RC' : null" />`
132
+ template: "<hx-status-version [version]=\"info.version\" [channel]=\"info.channel === 'rc' ? 'RC' : null\" />\n"
122
133
  }]
123
134
  }]
124
135
  });
125
136
  const HX_UPDATE_BACKEND = new InjectionToken("HX_UPDATE_BACKEND", { factory: () => defaultUpdateBackend() });
137
+ const HX_UPDATE_BEFORE_INSTALL = new InjectionToken("HX_UPDATE_BEFORE_INSTALL", { factory: () => null });
138
+ const HX_UPDATE_CURRENT_MS = 3e3;
126
139
  var HxUpdateService = class HxUpdateService {
127
140
  backend = inject(HX_UPDATE_BACKEND);
141
+ beforeInstall = inject(HX_UPDATE_BEFORE_INSTALL);
128
142
  info = inject(HX_APP_INFO);
143
+ _currentShown = signal(false, ...ngDevMode ? [{ debugName: "_currentShown" }] : /* istanbul ignore next */ []);
144
+ retryUpdate = null;
145
+ currentTimer;
129
146
  _state = signal({ status: "idle" }, ...ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []);
130
147
  state = this._state.asReadonly();
148
+ currentShown = this._currentShown.asReadonly();
131
149
  version = this.info.version;
132
150
  channel = this.info.channel;
133
151
  update = computed(() => {
@@ -137,9 +155,12 @@ var HxUpdateService = class HxUpdateService {
137
155
  start() {
138
156
  return this.channel === "rc" ? Promise.resolve() : this.check();
139
157
  }
140
- async check() {
158
+ async check(options = {}) {
141
159
  const s = this._state().status;
142
160
  if (s === "checking" || s === "installing") return;
161
+ clearTimeout(this.currentTimer);
162
+ this._currentShown.set(false);
163
+ this.retryUpdate = null;
143
164
  this._state.set({ status: "checking" });
144
165
  try {
145
166
  const update = await this.backend.check();
@@ -147,19 +168,36 @@ var HxUpdateService = class HxUpdateService {
147
168
  status: "available",
148
169
  update
149
170
  } : { status: "current" });
171
+ if (!update && options.manual) {
172
+ this._currentShown.set(true);
173
+ this.currentTimer = setTimeout(() => {
174
+ this._currentShown.set(false);
175
+ if (this._state().status === "current") this._state.set({ status: "idle" });
176
+ }, HX_UPDATE_CURRENT_MS);
177
+ }
150
178
  } catch (e) {
151
179
  this.fail("check", e);
152
180
  }
153
181
  }
154
182
  async installAndRestart() {
155
- const update = this.update();
156
- if (this._state().status !== "available" || !update) return;
183
+ const state = this._state();
184
+ const update = state.status === "available" ? state.update : state.status === "error" && state.step === "install" ? this.retryUpdate : null;
185
+ if (!update) return;
186
+ this.retryUpdate = update;
157
187
  this._state.set({
158
188
  status: "installing",
159
- update
189
+ update,
190
+ percent: null
160
191
  });
161
192
  try {
162
- await this.backend.install();
193
+ await this.beforeInstall?.(update);
194
+ await this.backend.install((percent) => {
195
+ if (this._state().status === "installing") this._state.set({
196
+ status: "installing",
197
+ update,
198
+ percent
199
+ });
200
+ });
163
201
  } catch (e) {
164
202
  this.fail("install", e);
165
203
  return;
@@ -179,7 +217,7 @@ var HxUpdateService = class HxUpdateService {
179
217
  }
180
218
  static ɵfac = i0.ɵɵngDeclareFactory({
181
219
  minVersion: "12.0.0",
182
- version: "22.2.4",
220
+ version: "22.2.6",
183
221
  ngImport: i0,
184
222
  type: HxUpdateService,
185
223
  deps: [],
@@ -187,7 +225,7 @@ var HxUpdateService = class HxUpdateService {
187
225
  });
188
226
  static ɵprov = i0.ɵɵngDeclareInjectable({
189
227
  minVersion: "12.0.0",
190
- version: "22.2.4",
228
+ version: "22.2.6",
191
229
  ngImport: i0,
192
230
  type: HxUpdateService,
193
231
  providedIn: "root"
@@ -195,7 +233,7 @@ var HxUpdateService = class HxUpdateService {
195
233
  };
196
234
  i0.ɵɵngDeclareClassMetadata({
197
235
  minVersion: "12.0.0",
198
- version: "22.2.4",
236
+ version: "22.2.6",
199
237
  ngImport: i0,
200
238
  type: HxUpdateService,
201
239
  decorators: [{
@@ -212,20 +250,38 @@ var HxStatusUpdate = class HxStatusUpdate {
212
250
  errorLabel = input("Update failed", ...ngDevMode ? [{ debugName: "errorLabel" }] : /* istanbul ignore next */ []);
213
251
  installLabel = input("Install and restart", ...ngDevMode ? [{ debugName: "installLabel" }] : /* istanbul ignore next */ []);
214
252
  retryLabel = input("Try again", ...ngDevMode ? [{ debugName: "retryLabel" }] : /* istanbul ignore next */ []);
253
+ checkLabel = input("Check for updates", ...ngDevMode ? [{ debugName: "checkLabel" }] : /* istanbul ignore next */ []);
254
+ upToDateLabel = input("Up to date", ...ngDevMode ? [{ debugName: "upToDateLabel" }] : /* istanbul ignore next */ []);
255
+ alwaysVisible = input(false, ...ngDevMode ? [{ debugName: "alwaysVisible" }] : /* istanbul ignore next */ []);
215
256
  open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
216
257
  state = this.service.state;
217
- visible = computed(() => getHxPlatformKind(getHxPlatform(this.root)) !== "mobile" && [
218
- "checking",
219
- "available",
220
- "installing",
221
- "error"
222
- ].includes(this.state().status), ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
258
+ visible = computed(() => {
259
+ if (getHxPlatformKind(getHxPlatform(this.root)) === "mobile") return false;
260
+ const status = this.state().status;
261
+ if ([
262
+ "checking",
263
+ "available",
264
+ "installing",
265
+ "error"
266
+ ].includes(status)) return true;
267
+ return this.alwaysVisible() || status === "current" && this.service.currentShown();
268
+ }, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
269
+ checkOnly = computed(() => ["idle", "current"].includes(this.state().status), ...ngDevMode ? [{ debugName: "checkOnly" }] : /* istanbul ignore next */ []);
270
+ checkNow() {
271
+ this.service.check({ manual: true });
272
+ }
273
+ retry() {
274
+ const s = this.state();
275
+ s.status === "error" && s.step === "install" ? this.service.installAndRestart() : this.service.check();
276
+ }
223
277
  label = computed(() => {
224
278
  const s = this.state();
225
279
  switch (s.status) {
226
280
  case "checking": return this.checkingLabel();
227
281
  case "available": return `${this.availableLabel()} ${s.update.version}`;
228
- case "installing": return this.installingLabel();
282
+ case "installing": return s.percent === null ? this.installingLabel() : `${this.installingLabel()} ${s.percent}%`;
283
+ case "current": return this.service.currentShown() ? this.upToDateLabel() : this.checkLabel();
284
+ case "idle": return this.checkLabel();
229
285
  case "error": return this.errorLabel();
230
286
  default: return "";
231
287
  }
@@ -240,7 +296,7 @@ var HxStatusUpdate = class HxStatusUpdate {
240
296
  }, ...ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []);
241
297
  static ɵfac = i0.ɵɵngDeclareFactory({
242
298
  minVersion: "12.0.0",
243
- version: "22.2.4",
299
+ version: "22.2.6",
244
300
  ngImport: i0,
245
301
  type: HxStatusUpdate,
246
302
  deps: [],
@@ -248,7 +304,7 @@ var HxStatusUpdate = class HxStatusUpdate {
248
304
  });
249
305
  static ɵcmp = i0.ɵɵngDeclareComponent({
250
306
  minVersion: "17.0.0",
251
- version: "22.2.4",
307
+ version: "22.2.6",
252
308
  type: HxStatusUpdate,
253
309
  isStandalone: true,
254
310
  selector: "hx-status-update",
@@ -294,50 +350,31 @@ var HxStatusUpdate = class HxStatusUpdate {
294
350
  isSignal: true,
295
351
  isRequired: false,
296
352
  transformFunction: null
353
+ },
354
+ checkLabel: {
355
+ classPropertyName: "checkLabel",
356
+ publicName: "checkLabel",
357
+ isSignal: true,
358
+ isRequired: false,
359
+ transformFunction: null
360
+ },
361
+ upToDateLabel: {
362
+ classPropertyName: "upToDateLabel",
363
+ publicName: "upToDateLabel",
364
+ isSignal: true,
365
+ isRequired: false,
366
+ transformFunction: null
367
+ },
368
+ alwaysVisible: {
369
+ classPropertyName: "alwaysVisible",
370
+ publicName: "alwaysVisible",
371
+ isSignal: true,
372
+ isRequired: false,
373
+ transformFunction: null
297
374
  }
298
375
  },
299
376
  ngImport: i0,
300
- template: `
301
- @if (visible()) {
302
- <hx-status-item
303
- kind="button"
304
- [announce]="true"
305
- [tone]="tone()"
306
- [title]="label()"
307
- [ariaLabel]="label()"
308
- [(popoverOpen)]="open"
309
- >
310
- <span class="hx-update-label">{{ label() }}</span>
311
- <div hxStatusPopover class="hx-update-details">
312
- @switch (state().status) {
313
- @case ('error') {
314
- <p class="hx-update-message">{{ errorText() }}</p>
315
- <button type="button" class="hx-update-action" (click)="service.check()">
316
- {{ retryLabel() }}
317
- </button>
318
- }
319
- @default {
320
- @if (service.update(); as update) {
321
- <p class="hx-update-version">{{ update.version }}</p>
322
- @if (update.notes) {
323
- <p class="hx-update-notes">{{ update.notes }}</p>
324
- }
325
- <button
326
- type="button"
327
- class="hx-update-action"
328
- [disabled]="state().status === 'installing'"
329
- (click)="service.installAndRestart()"
330
- >
331
- {{ installLabel() }}
332
- </button>
333
- }
334
- }
335
- }
336
- </div>
337
- </hx-status-item>
338
- }
339
- `,
340
- isInline: true,
377
+ template: "@if (visible() && checkOnly()) {\n <hx-status-item\n kind=\"button\"\n [announce]=\"true\"\n [title]=\"label()\"\n [ariaLabel]=\"label()\"\n (pressed)=\"checkNow()\"\n >\n <span class=\"hx-update-label\">{{ label() }}</span>\n </hx-status-item>\n} @else if (visible()) {\n <hx-status-item\n kind=\"button\"\n [announce]=\"true\"\n [tone]=\"tone()\"\n [title]=\"label()\"\n [ariaLabel]=\"label()\"\n [(popoverOpen)]=\"open\"\n >\n <span class=\"hx-update-label\">{{ label() }}</span>\n <div hxStatusPopover class=\"hx-update-details\">\n @switch (state().status) {\n @case ('error') {\n <p class=\"hx-update-message\">{{ errorText() }}</p>\n <button type=\"button\" class=\"hx-update-action\" (click)=\"retry()\">\n {{ retryLabel() }}\n </button>\n }\n @default {\n @if (service.update(); as update) {\n <p class=\"hx-update-version\">{{ update.version }}</p>\n @if (update.notes) {\n <p class=\"hx-update-notes\">{{ update.notes }}</p>\n }\n <button\n type=\"button\"\n class=\"hx-update-action\"\n [disabled]=\"state().status === 'installing'\"\n (click)=\"service.installAndRestart()\"\n >\n {{ installLabel() }}\n </button>\n }\n }\n }\n </div>\n </hx-status-item>\n}\n",
341
378
  dependencies: [{
342
379
  kind: "component",
343
380
  type: HxStatusItem,
@@ -351,7 +388,7 @@ var HxStatusUpdate = class HxStatusUpdate {
351
388
  "announce",
352
389
  "popoverOpen"
353
390
  ],
354
- outputs: ["popoverOpenChange"]
391
+ outputs: ["popoverOpenChange", "pressed"]
355
392
  }, {
356
393
  kind: "directive",
357
394
  type: HxStatusPopover,
@@ -362,7 +399,7 @@ var HxStatusUpdate = class HxStatusUpdate {
362
399
  };
363
400
  i0.ɵɵngDeclareClassMetadata({
364
401
  minVersion: "12.0.0",
365
- version: "22.2.4",
402
+ version: "22.2.6",
366
403
  ngImport: i0,
367
404
  type: HxStatusUpdate,
368
405
  decorators: [{
@@ -371,46 +408,7 @@ i0.ɵɵngDeclareClassMetadata({
371
408
  selector: "hx-status-update",
372
409
  imports: [HxStatusItem, HxStatusPopover],
373
410
  changeDetection: ChangeDetectionStrategy.OnPush,
374
- template: `
375
- @if (visible()) {
376
- <hx-status-item
377
- kind="button"
378
- [announce]="true"
379
- [tone]="tone()"
380
- [title]="label()"
381
- [ariaLabel]="label()"
382
- [(popoverOpen)]="open"
383
- >
384
- <span class="hx-update-label">{{ label() }}</span>
385
- <div hxStatusPopover class="hx-update-details">
386
- @switch (state().status) {
387
- @case ('error') {
388
- <p class="hx-update-message">{{ errorText() }}</p>
389
- <button type="button" class="hx-update-action" (click)="service.check()">
390
- {{ retryLabel() }}
391
- </button>
392
- }
393
- @default {
394
- @if (service.update(); as update) {
395
- <p class="hx-update-version">{{ update.version }}</p>
396
- @if (update.notes) {
397
- <p class="hx-update-notes">{{ update.notes }}</p>
398
- }
399
- <button
400
- type="button"
401
- class="hx-update-action"
402
- [disabled]="state().status === 'installing'"
403
- (click)="service.installAndRestart()"
404
- >
405
- {{ installLabel() }}
406
- </button>
407
- }
408
- }
409
- }
410
- </div>
411
- </hx-status-item>
412
- }
413
- `
411
+ template: "@if (visible() && checkOnly()) {\n <hx-status-item\n kind=\"button\"\n [announce]=\"true\"\n [title]=\"label()\"\n [ariaLabel]=\"label()\"\n (pressed)=\"checkNow()\"\n >\n <span class=\"hx-update-label\">{{ label() }}</span>\n </hx-status-item>\n} @else if (visible()) {\n <hx-status-item\n kind=\"button\"\n [announce]=\"true\"\n [tone]=\"tone()\"\n [title]=\"label()\"\n [ariaLabel]=\"label()\"\n [(popoverOpen)]=\"open\"\n >\n <span class=\"hx-update-label\">{{ label() }}</span>\n <div hxStatusPopover class=\"hx-update-details\">\n @switch (state().status) {\n @case ('error') {\n <p class=\"hx-update-message\">{{ errorText() }}</p>\n <button type=\"button\" class=\"hx-update-action\" (click)=\"retry()\">\n {{ retryLabel() }}\n </button>\n }\n @default {\n @if (service.update(); as update) {\n <p class=\"hx-update-version\">{{ update.version }}</p>\n @if (update.notes) {\n <p class=\"hx-update-notes\">{{ update.notes }}</p>\n }\n <button\n type=\"button\"\n class=\"hx-update-action\"\n [disabled]=\"state().status === 'installing'\"\n (click)=\"service.installAndRestart()\"\n >\n {{ installLabel() }}\n </button>\n }\n }\n }\n </div>\n </hx-status-item>\n}\n"
414
412
  }]
415
413
  }],
416
414
  propDecorators: {
@@ -461,10 +459,34 @@ i0.ɵɵngDeclareClassMetadata({
461
459
  alias: "retryLabel",
462
460
  required: false
463
461
  }]
462
+ }],
463
+ checkLabel: [{
464
+ type: i0.Input,
465
+ args: [{
466
+ isSignal: true,
467
+ alias: "checkLabel",
468
+ required: false
469
+ }]
470
+ }],
471
+ upToDateLabel: [{
472
+ type: i0.Input,
473
+ args: [{
474
+ isSignal: true,
475
+ alias: "upToDateLabel",
476
+ required: false
477
+ }]
478
+ }],
479
+ alwaysVisible: [{
480
+ type: i0.Input,
481
+ args: [{
482
+ isSignal: true,
483
+ alias: "alwaysVisible",
484
+ required: false
485
+ }]
464
486
  }]
465
487
  }
466
488
  });
467
489
  const HELIX_DESKTOP_TAURI = true;
468
- export { HELIX_DESKTOP_TAURI, HX_APP_INFO, HX_UPDATE_BACKEND, HxStatusAppVersion, HxStatusUpdate, HxUpdateService, channelOfVersion, defaultUpdateBackend, detectHxOs, isTauri, noopUpdateBackend, provideHxAppInfo, providePlatform, readTauriVersion, tauriUpdateBackend };
490
+ export { HELIX_DESKTOP_TAURI, HX_APP_INFO, HX_UPDATE_BACKEND, HX_UPDATE_BEFORE_INSTALL, HX_UPDATE_CURRENT_MS, HxStatusAppVersion, HxStatusUpdate, HxUpdateService, channelOfVersion, defaultUpdateBackend, detectHxOs, isTauri, noopUpdateBackend, provideHxAppInfo, providePlatform, readTauriVersion, tauriUpdateBackend };
469
491
 
470
492
  //# sourceMappingURL=gravionlabs-helix-desktop-tauri.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"gravionlabs-helix-desktop-tauri.mjs","names":[],"sources":["../../../projects/desktop/tauri/update-backend.ts","../../../projects/desktop/tauri/app-info.ts","../../../projects/desktop/tauri/platform.ts","../../../projects/desktop/tauri/status-app-version.ts","../../../projects/desktop/tauri/update.service.ts","../../../projects/desktop/tauri/status-update.ts","../../../projects/desktop/tauri/public_api.ts"],"sourcesContent":["/** What the updater found: a newer version. */\nexport interface HxUpdateInfo {\n readonly version: string;\n readonly notes: string | null;\n readonly date: string | null;\n}\n\n/**\n * The plugin calls behind an interface, so tests and web builds need no Tauri. The Tauri implementation\n * is `tauriUpdateBackend()`; outside Tauri the service uses `noopUpdateBackend`.\n */\nexport interface HxUpdateBackend {\n /** `null` when the app is current. */\n check(): Promise<HxUpdateInfo | null>;\n /** Download and install the update found by the last `check()`. */\n install(): Promise<void>;\n /** Restart into the new version. */\n relaunch(): Promise<void>;\n}\n\n/** The backend of a web build: never finds an update, never throws. */\nexport const noopUpdateBackend: HxUpdateBackend = {\n check: () => Promise.resolve(null),\n install: () => Promise.resolve(),\n relaunch: () => Promise.resolve(),\n};\n\n/** True inside a Tauri webview. */\nexport function isTauri(): boolean {\n return typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window;\n}\n\n/** The backend on `@tauri-apps/plugin-updater` and `plugin-process`, loaded on first use. */\nexport function tauriUpdateBackend(): HxUpdateBackend {\n let pending: { downloadAndInstall(): Promise<void> } | null = null;\n return {\n async check() {\n const { check } = await import('@tauri-apps/plugin-updater');\n const update = await check();\n if (!update) {\n pending = null;\n return null;\n }\n pending = update;\n return { version: update.version, notes: update.body ?? null, date: update.date ?? null };\n },\n async install() {\n if (!pending) throw new Error('No update to install');\n await pending.downloadAndInstall();\n },\n async relaunch() {\n const { relaunch } = await import('@tauri-apps/plugin-process');\n await relaunch();\n },\n };\n}\n\n/** The backend for the current environment. */\nexport function defaultUpdateBackend(): HxUpdateBackend {\n return isTauri() ? tauriUpdateBackend() : noopUpdateBackend;\n}\n","import { InjectionToken, type Provider } from '@angular/core';\nimport { isTauri } from './update-backend';\n\n/** `stable`, or `rc` for a release candidate. */\nexport type HxChannel = 'stable' | 'rc';\n\nexport interface HxAppInfo {\n readonly version: string;\n readonly channel: HxChannel;\n}\n\n/** The app version and channel. Without `provideHxAppInfo()` it is an empty stable version. */\nexport const HX_APP_INFO = new InjectionToken<HxAppInfo>('HX_APP_INFO', {\n factory: () => ({ version: '', channel: 'stable' }),\n});\n\n/** `1.4.0-rc.1` is `rc`; everything else is `stable`. */\nexport function channelOfVersion(version: string): HxChannel {\n return /-rc(\\.|\\d|$)/i.test(version) ? 'rc' : 'stable';\n}\n\n/** Provide the version and, when not given, the channel derived from it. */\nexport function provideHxAppInfo(info: { version: string; channel?: HxChannel }): Provider {\n return {\n provide: HX_APP_INFO,\n useValue: { version: info.version, channel: info.channel ?? channelOfVersion(info.version) },\n };\n}\n\n/** Read the version from Tauri (`getVersion`); outside Tauri it resolves to `fallback`. */\nexport async function readTauriVersion(fallback = ''): Promise<string> {\n if (!isTauri()) return fallback;\n try {\n const { getVersion } = await import('@tauri-apps/api/app');\n return await getVersion();\n } catch {\n return fallback;\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { type EnvironmentProviders, inject, provideEnvironmentInitializer } from '@angular/core';\nimport { type HxOs, setHxPlatform } from '@gravionlabs/helix-desktop';\nimport { isTauri } from './update-backend';\n\n/** Detect the operating system from the user agent; `web` outside Tauri. */\nexport function detectHxOs(\n ua: string = typeof navigator === 'undefined' ? '' : navigator.userAgent,\n tauri: boolean = isTauri(),\n): HxOs {\n if (!tauri) return 'web';\n if (/android/i.test(ua)) return 'android';\n if (/iphone|ipad|ipod/i.test(ua)) return 'ios';\n if (/windows/i.test(ua)) return 'windows';\n if (/mac/i.test(ua)) return 'macos';\n if (/linux|x11/i.test(ua)) return 'linux';\n return 'web';\n}\n\n/** Set `data-platform` on the root element at startup: macos, windows, linux, ios, android or web. */\nexport function providePlatform(os?: HxOs): EnvironmentProviders {\n return provideEnvironmentInitializer(() => {\n setHxPlatform(os ?? detectHxOs(), inject(DOCUMENT).documentElement);\n });\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { HxStatusVersion } from '@gravionlabs/helix-desktop';\nimport { HX_APP_INFO } from './app-info';\n\n/** The app version with the `RC` badge on a release candidate; reads `provideHxAppInfo()`. */\n@Component({\n selector: 'hx-status-app-version',\n imports: [HxStatusVersion],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `<hx-status-version [version]=\"info.version\" [channel]=\"info.channel === 'rc' ? 'RC' : null\" />`,\n})\nexport class HxStatusAppVersion {\n protected readonly info = inject(HX_APP_INFO);\n}\n","import { computed, Injectable, InjectionToken, inject, signal } from '@angular/core';\nimport { HX_APP_INFO } from './app-info';\nimport { defaultUpdateBackend, type HxUpdateBackend, type HxUpdateInfo } from './update-backend';\n\n/** The step that failed. */\nexport type HxUpdateStep = 'check' | 'install' | 'relaunch';\n\nexport type HxUpdateState =\n | { readonly status: 'idle' }\n | { readonly status: 'checking' }\n | { readonly status: 'current' }\n | { readonly status: 'available'; readonly update: HxUpdateInfo }\n | { readonly status: 'installing'; readonly update: HxUpdateInfo }\n | { readonly status: 'error'; readonly step: HxUpdateStep; readonly message: string };\n\n/** The backend of the update service; override it in tests. */\nexport const HX_UPDATE_BACKEND = new InjectionToken<HxUpdateBackend>('HX_UPDATE_BACKEND', {\n factory: () => defaultUpdateBackend(),\n});\n\n/**\n * The update state machine: idle, checking, current, available, installing, error (with the failed step).\n * An RC build never checks by itself: `start()` does nothing there, `check()` still works on request.\n */\n@Injectable({ providedIn: 'root' })\nexport class HxUpdateService {\n private readonly backend = inject(HX_UPDATE_BACKEND);\n private readonly info = inject(HX_APP_INFO);\n private readonly _state = signal<HxUpdateState>({ status: 'idle' });\n\n readonly state = this._state.asReadonly();\n readonly version = this.info.version;\n readonly channel = this.info.channel;\n /** The found update, while available or installing. */\n readonly update = computed(() => {\n const s = this._state();\n return s.status === 'available' || s.status === 'installing' ? s.update : null;\n });\n\n /** The automatic check at startup; skipped for an RC build. */\n start(): Promise<void> {\n return this.channel === 'rc' ? Promise.resolve() : this.check();\n }\n\n async check(): Promise<void> {\n const s = this._state().status;\n if (s === 'checking' || s === 'installing') return;\n this._state.set({ status: 'checking' });\n try {\n const update = await this.backend.check();\n this._state.set(update ? { status: 'available', update } : { status: 'current' });\n } catch (e) {\n this.fail('check', e);\n }\n }\n\n /** Download, install and restart. */\n async installAndRestart(): Promise<void> {\n const update = this.update();\n if (this._state().status !== 'available' || !update) return;\n this._state.set({ status: 'installing', update });\n try {\n await this.backend.install();\n } catch (e) {\n this.fail('install', e);\n return;\n }\n try {\n await this.backend.relaunch();\n } catch (e) {\n this.fail('relaunch', e);\n }\n }\n\n private fail(step: HxUpdateStep, e: unknown): void {\n this._state.set({ status: 'error', step, message: e instanceof Error ? e.message : String(e) });\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport {\n getHxPlatform,\n getHxPlatformKind,\n HxStatusItem,\n HxStatusPopover,\n type HxStatusTone,\n} from '@gravionlabs/helix-desktop';\nimport { HxUpdateService } from './update.service';\n\n/**\n * The update state as a status item; the version, the notes and \"Install and restart\" are in its popover.\n * Not rendered on mobile and while there is nothing to show (idle, current).\n */\n@Component({\n selector: 'hx-status-update',\n imports: [HxStatusItem, HxStatusPopover],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (visible()) {\n <hx-status-item\n kind=\"button\"\n [announce]=\"true\"\n [tone]=\"tone()\"\n [title]=\"label()\"\n [ariaLabel]=\"label()\"\n [(popoverOpen)]=\"open\"\n >\n <span class=\"hx-update-label\">{{ label() }}</span>\n <div hxStatusPopover class=\"hx-update-details\">\n @switch (state().status) {\n @case ('error') {\n <p class=\"hx-update-message\">{{ errorText() }}</p>\n <button type=\"button\" class=\"hx-update-action\" (click)=\"service.check()\">\n {{ retryLabel() }}\n </button>\n }\n @default {\n @if (service.update(); as update) {\n <p class=\"hx-update-version\">{{ update.version }}</p>\n @if (update.notes) {\n <p class=\"hx-update-notes\">{{ update.notes }}</p>\n }\n <button\n type=\"button\"\n class=\"hx-update-action\"\n [disabled]=\"state().status === 'installing'\"\n (click)=\"service.installAndRestart()\"\n >\n {{ installLabel() }}\n </button>\n }\n }\n }\n </div>\n </hx-status-item>\n }\n `,\n})\nexport class HxStatusUpdate {\n protected readonly service = inject(HxUpdateService);\n private readonly root = inject(DOCUMENT).documentElement;\n\n readonly checkingLabel = input('Checking for updates');\n readonly availableLabel = input('Update');\n readonly installingLabel = input('Installing update');\n readonly errorLabel = input('Update failed');\n readonly installLabel = input('Install and restart');\n readonly retryLabel = input('Try again');\n\n protected readonly open = signal(false);\n protected readonly state = this.service.state;\n\n protected readonly visible = computed(\n () =>\n getHxPlatformKind(getHxPlatform(this.root)) !== 'mobile' &&\n ['checking', 'available', 'installing', 'error'].includes(this.state().status),\n );\n\n protected readonly label = computed(() => {\n const s = this.state();\n switch (s.status) {\n case 'checking':\n return this.checkingLabel();\n case 'available':\n return `${this.availableLabel()} ${s.update.version}`;\n case 'installing':\n return this.installingLabel();\n case 'error':\n return this.errorLabel();\n default:\n return '';\n }\n });\n\n protected readonly tone = computed<HxStatusTone>(() => {\n const s = this.state().status;\n return s === 'error' ? 'error' : s === 'available' ? 'accent' : 'neutral';\n });\n\n protected readonly errorText = computed(() => {\n const s = this.state();\n return s.status === 'error' ? `${s.step}: ${s.message}` : '';\n });\n}\n","/*\n * Public API Surface of @gravionlabs/helix-desktop/tauri\n *\n * The only entry that may import `@tauri-apps/*` (`pnpm lint:no-tauri`). Those packages are optional peer\n * dependencies, so a consumer of the main entry installs none of them. Outside Tauri every service\n * resolves to a no-op.\n */\n\nexport const HELIX_DESKTOP_TAURI = true;\n\nexport * from './app-info';\nexport * from './platform';\nexport * from './status-app-version';\nexport * from './status-update';\nexport * from './update.service';\nexport * from './update-backend';\n"],"mappings":";;;;AAqBA,MAAa,oBAAqC;CAChD,aAAa,QAAQ,QAAQ,IAAI;CACjC,eAAe,QAAQ,QAAO;CAC9B,gBAAgB,QAAQ,QAAO;AAChC;AAGD,SAAgB,UAAO;CACrB,OAAO,OAAO,WAAW,eAAe,yBAAyB;AACnE;AAGA,SAAgB,qBAAkB;CAChC,IAAI,UAA0D;CAC9D,OAAO;EACL,MAAM,QAAK;GACT,MAAM,EAAE,UAAU,MAAM,OAAO;GAC/B,MAAM,SAAS,MAAM,MAAK;GAC1B,IAAI,CAAC,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mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,UAAA;EAAA,UAzCf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCT,UAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MAzCS;GAAY,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,mBAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAe,UAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AA2C5B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EA7C1B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,SAAS,CAAC,cAAc,eAAe;GACvC,iBAAiB,wBAAwB;GACzC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnDD,MAAa,sBAAsB"}
1
+ {"version":3,"file":"gravionlabs-helix-desktop-tauri.mjs","names":[],"sources":["../../../projects/desktop/tauri/update-backend.ts","../../../projects/desktop/tauri/app-info.ts","../../../projects/desktop/tauri/platform.ts","../../../projects/desktop/tauri/status-app-version.ts","../../../projects/desktop/tauri/status-app-version.html","../../../projects/desktop/tauri/update.service.ts","../../../projects/desktop/tauri/status-update.ts","../../../projects/desktop/tauri/status-update.html","../../../projects/desktop/tauri/public_api.ts"],"sourcesContent":["/** What the updater found: a newer version. */\nexport interface HxUpdateInfo {\n readonly version: string;\n readonly notes: string | null;\n readonly date: string | null;\n}\n\n/**\n * The plugin calls behind an interface, so tests and web builds need no Tauri. The Tauri implementation\n * is `tauriUpdateBackend()`; outside Tauri the service uses `noopUpdateBackend`.\n */\nexport interface HxUpdateBackend {\n /** `null` when the app is current. */\n check(): Promise<HxUpdateInfo | null>;\n /**\n * Download and install the update found by the last `check()`. `onProgress` gets the percent (0 to 100)\n * while it downloads, or `null` when the size is unknown.\n */\n install(onProgress?: (percent: number | null) => void): Promise<void>;\n /** Restart into the new version. */\n relaunch(): Promise<void>;\n}\n\n/** The backend of a web build: never finds an update, never throws. */\nexport const noopUpdateBackend: HxUpdateBackend = {\n check: () => Promise.resolve(null),\n install: () => Promise.resolve(),\n relaunch: () => Promise.resolve(),\n};\n\n/** True inside a Tauri webview. */\nexport function isTauri(): boolean {\n return typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window;\n}\n\n/** The backend on `@tauri-apps/plugin-updater` and `plugin-process`, loaded on first use. */\nexport function tauriUpdateBackend(): HxUpdateBackend {\n let pending: {\n downloadAndInstall(\n onEvent?: (e: {\n event: 'Started' | 'Progress' | 'Finished';\n data?: { contentLength?: number; chunkLength?: number };\n }) => void,\n ): Promise<void>;\n } | null = null;\n return {\n async check() {\n const { check } = await import('@tauri-apps/plugin-updater');\n const update = await check();\n if (!update) {\n pending = null;\n return null;\n }\n pending = update;\n return { version: update.version, notes: update.body ?? null, date: update.date ?? null };\n },\n async install(onProgress) {\n if (!pending) throw new Error('No update to install');\n let total = 0;\n let done = 0;\n await pending.downloadAndInstall((e) => {\n if (!onProgress) return;\n if (e.event === 'Started') {\n total = e.data?.contentLength ?? 0;\n done = 0;\n onProgress(total > 0 ? 0 : null);\n } else if (e.event === 'Progress') {\n done += e.data?.chunkLength ?? 0;\n onProgress(total > 0 ? Math.min(100, Math.round((done / total) * 100)) : null);\n } else {\n onProgress(total > 0 ? 100 : null);\n }\n });\n },\n async relaunch() {\n const { relaunch } = await import('@tauri-apps/plugin-process');\n await relaunch();\n },\n };\n}\n\n/** The backend for the current environment. */\nexport function defaultUpdateBackend(): HxUpdateBackend {\n return isTauri() ? tauriUpdateBackend() : noopUpdateBackend;\n}\n","import { InjectionToken, type Provider } from '@angular/core';\nimport { isTauri } from './update-backend';\n\n/** `stable`, or `rc` for a release candidate. */\nexport type HxChannel = 'stable' | 'rc';\n\nexport interface HxAppInfo {\n readonly version: string;\n readonly channel: HxChannel;\n}\n\n/** The app version and channel. Without `provideHxAppInfo()` it is an empty stable version. */\nexport const HX_APP_INFO = new InjectionToken<HxAppInfo>('HX_APP_INFO', {\n factory: () => ({ version: '', channel: 'stable' }),\n});\n\n/** `1.4.0-rc.1` is `rc`; everything else is `stable`. */\nexport function channelOfVersion(version: string): HxChannel {\n return /-rc(\\.|\\d|$)/i.test(version) ? 'rc' : 'stable';\n}\n\n/** Provide the version and, when not given, the channel derived from it. */\nexport function provideHxAppInfo(info: { version: string; channel?: HxChannel }): Provider {\n return {\n provide: HX_APP_INFO,\n useValue: { version: info.version, channel: info.channel ?? channelOfVersion(info.version) },\n };\n}\n\n/** Read the version from Tauri (`getVersion`); outside Tauri it resolves to `fallback`. */\nexport async function readTauriVersion(fallback = ''): Promise<string> {\n if (!isTauri()) return fallback;\n try {\n const { getVersion } = await import('@tauri-apps/api/app');\n return await getVersion();\n } catch {\n return fallback;\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { type EnvironmentProviders, inject, provideEnvironmentInitializer } from '@angular/core';\nimport { type HxOs, setHxPlatform } from '@gravionlabs/helix-desktop';\nimport { isTauri } from './update-backend';\n\n/** Detect the operating system from the user agent; `web` outside Tauri. */\nexport function detectHxOs(\n ua: string = typeof navigator === 'undefined' ? '' : navigator.userAgent,\n tauri: boolean = isTauri(),\n): HxOs {\n if (!tauri) return 'web';\n if (/android/i.test(ua)) return 'android';\n if (/iphone|ipad|ipod/i.test(ua)) return 'ios';\n if (/windows/i.test(ua)) return 'windows';\n if (/mac/i.test(ua)) return 'macos';\n if (/linux|x11/i.test(ua)) return 'linux';\n return 'web';\n}\n\n/** Set `data-platform` on the root element at startup: macos, windows, linux, ios, android or web. */\nexport function providePlatform(os?: HxOs): EnvironmentProviders {\n return provideEnvironmentInitializer(() => {\n setHxPlatform(os ?? detectHxOs(), inject(DOCUMENT).documentElement);\n });\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { HxStatusVersion } from '@gravionlabs/helix-desktop';\nimport { HX_APP_INFO } from './app-info';\n\n/** The app version with the `RC` badge on a release candidate; reads `provideHxAppInfo()`. */\n@Component({\n selector: 'hx-status-app-version',\n imports: [HxStatusVersion],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './status-app-version.html',\n})\nexport class HxStatusAppVersion {\n protected readonly info = inject(HX_APP_INFO);\n}\n","<hx-status-version [version]=\"info.version\" [channel]=\"info.channel === 'rc' ? 'RC' : null\" />\n","import { computed, Injectable, InjectionToken, inject, signal } from '@angular/core';\nimport { HX_APP_INFO } from './app-info';\nimport { defaultUpdateBackend, type HxUpdateBackend, type HxUpdateInfo } from './update-backend';\n\n/** The step that failed. */\nexport type HxUpdateStep = 'check' | 'install' | 'relaunch';\n\nexport type HxUpdateState =\n | { readonly status: 'idle' }\n | { readonly status: 'checking' }\n | { readonly status: 'current' }\n | { readonly status: 'available'; readonly update: HxUpdateInfo }\n | {\n readonly status: 'installing';\n readonly update: HxUpdateInfo;\n /** The download progress, 0 to 100; `null` while the size is unknown. */\n readonly percent: number | null;\n }\n | { readonly status: 'error'; readonly step: HxUpdateStep; readonly message: string };\n\n/** The backend of the update service; override it in tests. */\nexport const HX_UPDATE_BACKEND = new InjectionToken<HxUpdateBackend>('HX_UPDATE_BACKEND', {\n factory: () => defaultUpdateBackend(),\n});\n\n/**\n * A hook that runs after the state is `installing` and before the install, for example to save the open\n * document. When it throws, the state is `error` (step `install`) and the update stays available for a retry.\n */\nexport type HxUpdateBeforeInstall = (update: HxUpdateInfo) => void | Promise<void>;\n\n/** The hook before the install; `null` (the default) means none. */\nexport const HX_UPDATE_BEFORE_INSTALL = new InjectionToken<HxUpdateBeforeInstall | null>(\n 'HX_UPDATE_BEFORE_INSTALL',\n { factory: () => null },\n);\n\n/** How long a manual check shows \"Up to date\", in milliseconds. */\nexport const HX_UPDATE_CURRENT_MS = 3000;\n\n/**\n * The update state machine: idle, checking, current, available, installing, error (with the failed step).\n * An RC build never checks by itself: `start()` does nothing there, `check()` still works on request.\n */\n@Injectable({ providedIn: 'root' })\nexport class HxUpdateService {\n private readonly backend = inject(HX_UPDATE_BACKEND);\n private readonly beforeInstall = inject(HX_UPDATE_BEFORE_INSTALL);\n private readonly info = inject(HX_APP_INFO);\n private readonly _currentShown = signal(false);\n private retryUpdate: HxUpdateInfo | null = null;\n private currentTimer: ReturnType<typeof setTimeout> | undefined;\n private readonly _state = signal<HxUpdateState>({ status: 'idle' });\n\n readonly state = this._state.asReadonly();\n /** True while a manual check shows its \"up to date\" result. */\n readonly currentShown = this._currentShown.asReadonly();\n readonly version = this.info.version;\n readonly channel = this.info.channel;\n /** The found update, while available or installing. */\n readonly update = computed(() => {\n const s = this._state();\n return s.status === 'available' || s.status === 'installing' ? s.update : null;\n });\n\n /** The automatic check at startup; skipped for an RC build. */\n start(): Promise<void> {\n return this.channel === 'rc' ? Promise.resolve() : this.check();\n }\n\n /**\n * Check for an update. With `manual: true` a result of \"current\" stays visible for a moment\n * (`HX_UPDATE_CURRENT_MS`), then the state goes back to `idle`.\n */\n async check(options: { readonly manual?: boolean } = {}): Promise<void> {\n const s = this._state().status;\n if (s === 'checking' || s === 'installing') return;\n clearTimeout(this.currentTimer);\n this._currentShown.set(false);\n this.retryUpdate = null;\n this._state.set({ status: 'checking' });\n try {\n const update = await this.backend.check();\n this._state.set(update ? { status: 'available', update } : { status: 'current' });\n if (!update && options.manual) {\n this._currentShown.set(true);\n this.currentTimer = setTimeout(() => {\n this._currentShown.set(false);\n if (this._state().status === 'current') this._state.set({ status: 'idle' });\n }, HX_UPDATE_CURRENT_MS);\n }\n } catch (e) {\n this.fail('check', e);\n }\n }\n\n /**\n * Download, install and restart. Also the retry after a failed install step: the update stays available.\n */\n async installAndRestart(): Promise<void> {\n const state = this._state();\n const update =\n state.status === 'available'\n ? state.update\n : state.status === 'error' && state.step === 'install'\n ? this.retryUpdate\n : null;\n if (!update) return;\n this.retryUpdate = update;\n this._state.set({ status: 'installing', update, percent: null });\n try {\n await this.beforeInstall?.(update);\n await this.backend.install((percent) => {\n if (this._state().status === 'installing')\n this._state.set({ status: 'installing', update, percent });\n });\n } catch (e) {\n this.fail('install', e);\n return;\n }\n try {\n await this.backend.relaunch();\n } catch (e) {\n this.fail('relaunch', e);\n }\n }\n\n private fail(step: HxUpdateStep, e: unknown): void {\n this._state.set({ status: 'error', step, message: e instanceof Error ? e.message : String(e) });\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport {\n getHxPlatform,\n getHxPlatformKind,\n HxStatusItem,\n HxStatusPopover,\n type HxStatusTone,\n} from '@gravionlabs/helix-desktop';\nimport { HxUpdateService } from './update.service';\n\n/**\n * The update state as a status item; the version, the notes and \"Install and restart\" are in its popover.\n * Not rendered on mobile and while there is nothing to show (idle, current), unless `alwaysVisible` is set:\n * then it shows \"Check for updates\" and a click runs a manual check, whose result \"Up to date\" stays visible\n * for a moment. While installing it shows the download percent.\n */\n@Component({\n selector: 'hx-status-update',\n imports: [HxStatusItem, HxStatusPopover],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './status-update.html',\n})\nexport class HxStatusUpdate {\n protected readonly service = inject(HxUpdateService);\n private readonly root = inject(DOCUMENT).documentElement;\n\n readonly checkingLabel = input('Checking for updates');\n readonly availableLabel = input('Update');\n readonly installingLabel = input('Installing update');\n readonly errorLabel = input('Update failed');\n readonly installLabel = input('Install and restart');\n readonly retryLabel = input('Try again');\n readonly checkLabel = input('Check for updates');\n readonly upToDateLabel = input('Up to date');\n /** Show the item in `idle` and `current` too, as \"Check for updates\"; a click runs a manual check. */\n readonly alwaysVisible = input(false);\n\n protected readonly open = signal(false);\n protected readonly state = this.service.state;\n\n protected readonly visible = computed(() => {\n if (getHxPlatformKind(getHxPlatform(this.root)) === 'mobile') return false;\n const status = this.state().status;\n if (['checking', 'available', 'installing', 'error'].includes(status)) return true;\n return this.alwaysVisible() || (status === 'current' && this.service.currentShown());\n });\n\n /** An item that only starts a check (idle, current): no popover. */\n protected readonly checkOnly = computed(() => ['idle', 'current'].includes(this.state().status));\n\n protected checkNow(): void {\n void this.service.check({ manual: true });\n }\n\n /** A failed install step retries the install, any other error the check. */\n protected retry(): void {\n const s = this.state();\n void (s.status === 'error' && s.step === 'install'\n ? this.service.installAndRestart()\n : this.service.check());\n }\n\n protected readonly label = computed(() => {\n const s = this.state();\n switch (s.status) {\n case 'checking':\n return this.checkingLabel();\n case 'available':\n return `${this.availableLabel()} ${s.update.version}`;\n case 'installing':\n return s.percent === null\n ? this.installingLabel()\n : `${this.installingLabel()} ${s.percent}%`;\n case 'current':\n return this.service.currentShown() ? this.upToDateLabel() : this.checkLabel();\n case 'idle':\n return this.checkLabel();\n case 'error':\n return this.errorLabel();\n default:\n return '';\n }\n });\n\n protected readonly tone = computed<HxStatusTone>(() => {\n const s = this.state().status;\n return s === 'error' ? 'error' : s === 'available' ? 'accent' : 'neutral';\n });\n\n protected readonly errorText = computed(() => {\n const s = this.state();\n return s.status === 'error' ? `${s.step}: ${s.message}` : '';\n });\n}\n","@if (visible() && checkOnly()) {\n <hx-status-item\n kind=\"button\"\n [announce]=\"true\"\n [title]=\"label()\"\n [ariaLabel]=\"label()\"\n (pressed)=\"checkNow()\"\n >\n <span class=\"hx-update-label\">{{ label() }}</span>\n </hx-status-item>\n} @else if (visible()) {\n <hx-status-item\n kind=\"button\"\n [announce]=\"true\"\n [tone]=\"tone()\"\n [title]=\"label()\"\n [ariaLabel]=\"label()\"\n [(popoverOpen)]=\"open\"\n >\n <span class=\"hx-update-label\">{{ label() }}</span>\n <div hxStatusPopover class=\"hx-update-details\">\n @switch (state().status) {\n @case ('error') {\n <p class=\"hx-update-message\">{{ errorText() }}</p>\n <button type=\"button\" class=\"hx-update-action\" (click)=\"retry()\">\n {{ retryLabel() }}\n </button>\n }\n @default {\n @if (service.update(); as update) {\n <p class=\"hx-update-version\">{{ update.version }}</p>\n @if (update.notes) {\n <p class=\"hx-update-notes\">{{ update.notes }}</p>\n }\n <button\n type=\"button\"\n class=\"hx-update-action\"\n [disabled]=\"state().status === 'installing'\"\n (click)=\"service.installAndRestart()\"\n >\n {{ installLabel() }}\n </button>\n }\n }\n }\n </div>\n </hx-status-item>\n}\n","/*\n * Public API Surface of @gravionlabs/helix-desktop/tauri\n *\n * The only entry that may import `@tauri-apps/*` (`pnpm lint:no-tauri`). Those packages are optional peer\n * dependencies, so a consumer of the main entry installs none of them. Outside Tauri every service\n * resolves to a no-op.\n */\n\nexport const HELIX_DESKTOP_TAURI = true;\n\nexport * from './app-info';\nexport * from './platform';\nexport * from './status-app-version';\nexport * from './status-update';\nexport * from './update.service';\nexport * from './update-backend';\n"],"mappings":";;;;AAwBA,MAAa,oBAAqC;CAChD,aAAa,QAAQ,QAAQ,IAAI;CACjC,eAAe,QAAQ,QAAO;CAC9B,gBAAgB,QAAQ,QAAO;AAChC;AAGD,SAAgB,UAAO;CACrB,OAAO,OAAO,WAAW,eAAe,yBAAyB;AACnE;AAGA,SAAgB,qBAAkB;CAChC,IAAI,UAOO;CACX,OAAO;EACL,MAAM,QAAK;GACT,MAAM,EAAE,UAAU,MAAM,OAAO;GAC/B,MAAM,SAAS,MAAM,MAAK;GAC1B,IAAI,CAAC,QAAQ;IACX,UAAU;IACV,OAAO;GACT;GACA,UAAU;GACV,OAAO;IAAE,SAAS,OAAO;IAAS,OAAO,OAAO,QAAQ;IAAM,MAAM,OAAO,QAAQ;GAAI;EACzF;EACA,MAAM,QAAQ,YAAU;GACtB,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,sBAAsB;GACpD,IAAI,QAAQ;GACZ,IAAI,OAAO;GACX,MAAM,QAAQ,oBAAoB,MAAK;IACrC,IAAI,CAAC,YAAY;IACjB,IAAI,EAAE,UA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