@forgeroute/ui 0.4.85 → 0.4.87

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.
@@ -2533,6 +2533,7 @@ var ConnectionBannerComponent = class ConnectionBannerComponent {
2533
2533
  this.cdr = inject(ChangeDetectorRef);
2534
2534
  this.infoOffline = input(null, ...ngDevMode ? [{ debugName: "infoOffline" }] : /* istanbul ignore next */ []);
2535
2535
  this.infoNeedsConnection = input(null, ...ngDevMode ? [{ debugName: "infoNeedsConnection" }] : /* istanbul ignore next */ []);
2536
+ this.queues = input(true, ...ngDevMode ? [{ debugName: "queues" }] : /* istanbul ignore next */ []);
2536
2537
  this.viewChanges = output();
2537
2538
  this.panelId = `ui-cb-info-${++nextId}`;
2538
2539
  this.infoOpen = signal(false, ...ngDevMode ? [{ debugName: "infoOpen" }] : /* istanbul ignore next */ []);
@@ -2544,15 +2545,44 @@ var ConnectionBannerComponent = class ConnectionBannerComponent {
2544
2545
  this.seenTick = this.support.syncTick();
2545
2546
  this.flashPending = false;
2546
2547
  this.wasSyncing = false;
2547
- this.canDoItems = computed(() => this.infoOffline() ?? [this.labels.t("connection.info.canDo1"), this.labels.t("connection.info.canDo2")], ...ngDevMode ? [{ debugName: "canDoItems" }] : /* istanbul ignore next */ []);
2548
- this.needsItems = computed(() => this.infoNeedsConnection() ?? [this.labels.t("connection.info.needs1")], ...ngDevMode ? [{ debugName: "needsItems" }] : /* istanbul ignore next */ []);
2548
+ this.prevState = this.connection.state();
2549
+ this.canDoItems = computed(() => this.infoOffline() ?? (this.queues() ? [this.labels.t("connection.info.canDo1"), this.labels.t("connection.info.canDo2")] : []), ...ngDevMode ? [{ debugName: "canDoItems" }] : /* istanbul ignore next */ []);
2550
+ this.needsItems = computed(() => this.infoNeedsConnection() ?? (this.queues() ? [this.labels.t("connection.info.needs1")] : []), ...ngDevMode ? [{ debugName: "needsItems" }] : /* istanbul ignore next */ []);
2551
+ this.showCanDo = computed(() => this.queues() || this.canDoItems().length > 0, ...ngDevMode ? [{ debugName: "showCanDo" }] : /* istanbul ignore next */ []);
2552
+ this.showNeeds = computed(() => this.queues() || this.needsItems().length > 0, ...ngDevMode ? [{ debugName: "showNeeds" }] : /* istanbul ignore next */ []);
2549
2553
  this.view = computed(() => {
2550
2554
  const state = this.connection.state();
2551
2555
  const pending = this.support.pendingCount();
2552
2556
  const attention = this.support.failedCount() + this.support.conflictCount();
2553
2557
  const l = this.labels;
2558
+ const queues = this.queues();
2554
2559
  let v = null;
2555
- if (this.support.authBlocked()) v = {
2560
+ if (!queues) {
2561
+ if (state === "offline") v = {
2562
+ kind: "offline",
2563
+ title: l.t("connection.offline.title"),
2564
+ message: l.t("connection.offline.noQueue.message"),
2565
+ detail: ""
2566
+ };
2567
+ else if (state === "unreachable") v = {
2568
+ kind: "unreachable",
2569
+ title: l.t("connection.unreachable.title"),
2570
+ message: l.t("connection.unreachable.noQueue.message"),
2571
+ detail: ""
2572
+ };
2573
+ else if (state === "slow") v = {
2574
+ kind: "slow",
2575
+ title: l.t("connection.slow.title"),
2576
+ message: l.t("connection.slow.noQueue.message"),
2577
+ detail: ""
2578
+ };
2579
+ else if (this.showSynced()) v = {
2580
+ kind: "synced",
2581
+ title: l.t("connection.backOnline"),
2582
+ message: "",
2583
+ detail: ""
2584
+ };
2585
+ } else if (this.support.authBlocked()) v = {
2556
2586
  kind: "auth",
2557
2587
  title: l.t("connection.authBlocked"),
2558
2588
  message: "",
@@ -2616,15 +2646,15 @@ var ConnectionBannerComponent = class ConnectionBannerComponent {
2616
2646
  }, ...ngDevMode ? [{ debugName: "alertText" }] : /* istanbul ignore next */ []);
2617
2647
  this.infoAllowed = computed(() => {
2618
2648
  const k = this.view()?.kind;
2619
- return k === "offline" || k === "unreachable";
2649
+ return (k === "offline" || k === "unreachable") && (this.queues() || this.showCanDo() || this.showNeeds());
2620
2650
  }, ...ngDevMode ? [{ debugName: "infoAllowed" }] : /* istanbul ignore next */ []);
2621
2651
  this.showSyncNow = computed(() => {
2622
2652
  const k = this.view()?.kind;
2623
- return (k === "unreachable" || k === "slow" || k === "attention") && this.support.pendingCount() > 0 && !this.support.syncing();
2653
+ return this.queues() && (k === "unreachable" || k === "slow" || k === "attention") && this.support.pendingCount() > 0 && !this.support.syncing();
2624
2654
  }, ...ngDevMode ? [{ debugName: "showSyncNow" }] : /* istanbul ignore next */ []);
2625
2655
  this.showView = computed(() => {
2626
2656
  const k = this.view()?.kind;
2627
- if (!k || k === "synced") return false;
2657
+ if (!this.queues() || !k || k === "synced") return false;
2628
2658
  return this.rowsTotal() > 0 || k === "auth";
2629
2659
  }, ...ngDevMode ? [{ debugName: "showView" }] : /* istanbul ignore next */ []);
2630
2660
  this.rowsTotal = computed(() => this.support.pendingCount() + this.support.failedCount() + this.support.conflictCount(), ...ngDevMode ? [{ debugName: "rowsTotal" }] : /* istanbul ignore next */ []);
@@ -2634,7 +2664,7 @@ var ConnectionBannerComponent = class ConnectionBannerComponent {
2634
2664
  untracked(() => {
2635
2665
  if (tick !== this.seenTick) {
2636
2666
  this.seenTick = tick;
2637
- this.flashPending = true;
2667
+ if (this.queues()) this.flashPending = true;
2638
2668
  }
2639
2669
  if (syncing && !this.wasSyncing) this.syncTotal.set(Math.max(this.support.pendingCount(), 0));
2640
2670
  if (!syncing) this.syncTotal.set(0);
@@ -2645,6 +2675,15 @@ var ConnectionBannerComponent = class ConnectionBannerComponent {
2645
2675
  }
2646
2676
  });
2647
2677
  });
2678
+ effect(() => {
2679
+ const state = this.connection.state();
2680
+ const queues = this.queues();
2681
+ untracked(() => {
2682
+ const wasDown = this.prevState === "offline" || this.prevState === "unreachable";
2683
+ this.prevState = state;
2684
+ if (!queues && wasDown && state !== "offline" && state !== "unreachable") this.flashSynced();
2685
+ });
2686
+ });
2648
2687
  effect(() => {
2649
2688
  if (!this.infoAllowed()) this.infoOpen.set(false);
2650
2689
  });
@@ -2720,6 +2759,13 @@ var ConnectionBannerComponent = class ConnectionBannerComponent {
2720
2759
  isSignal: true,
2721
2760
  isRequired: false,
2722
2761
  transformFunction: null
2762
+ },
2763
+ queues: {
2764
+ classPropertyName: "queues",
2765
+ publicName: "queues",
2766
+ isSignal: true,
2767
+ isRequired: false,
2768
+ transformFunction: null
2723
2769
  }
2724
2770
  },
2725
2771
  outputs: { viewChanges: "viewChanges" },
@@ -2764,10 +2810,14 @@ var ConnectionBannerComponent = class ConnectionBannerComponent {
2764
2810
  }
2765
2811
  @if (infoAllowed() && infoOpen()) {
2766
2812
  <div class="cb-info" [id]="panelId" role="region" tabindex="-1" [attr.aria-label]="labels.t('connection.info.panelLabel')" data-testid="connection-banner-info-panel">
2767
- <p class="cb-info-h">{{ labels.t('connection.info.canDoTitle') }}</p>
2768
- <ul class="cb-list">@for (item of canDoItems(); track $index) { <li>{{ item }}</li> }</ul>
2769
- <p class="cb-info-h">{{ labels.t('connection.info.needsTitle') }}</p>
2770
- <ul class="cb-list">@for (item of needsItems(); track $index) { <li>{{ item }}</li> }</ul>
2813
+ @if (showCanDo()) {
2814
+ <p class="cb-info-h">{{ labels.t('connection.info.canDoTitle') }}</p>
2815
+ <ul class="cb-list">@for (item of canDoItems(); track $index) { <li>{{ item }}</li> }</ul>
2816
+ }
2817
+ @if (showNeeds()) {
2818
+ <p class="cb-info-h">{{ labels.t('connection.info.needsTitle') }}</p>
2819
+ <ul class="cb-list">@for (item of needsItems(); track $index) { <li>{{ item }}</li> }</ul>
2820
+ }
2771
2821
  <button #infoHide type="button" class="cb-btn" data-testid="connection-banner-info-hide" (click)="closeInfo(true)">{{ labels.t('connection.hide') }}</button>
2772
2822
  </div>
2773
2823
  }
@@ -2818,10 +2868,14 @@ i0.ɵɵngDeclareClassMetadata({
2818
2868
  }
2819
2869
  @if (infoAllowed() && infoOpen()) {
2820
2870
  <div class="cb-info" [id]="panelId" role="region" tabindex="-1" [attr.aria-label]="labels.t('connection.info.panelLabel')" data-testid="connection-banner-info-panel">
2821
- <p class="cb-info-h">{{ labels.t('connection.info.canDoTitle') }}</p>
2822
- <ul class="cb-list">@for (item of canDoItems(); track $index) { <li>{{ item }}</li> }</ul>
2823
- <p class="cb-info-h">{{ labels.t('connection.info.needsTitle') }}</p>
2824
- <ul class="cb-list">@for (item of needsItems(); track $index) { <li>{{ item }}</li> }</ul>
2871
+ @if (showCanDo()) {
2872
+ <p class="cb-info-h">{{ labels.t('connection.info.canDoTitle') }}</p>
2873
+ <ul class="cb-list">@for (item of canDoItems(); track $index) { <li>{{ item }}</li> }</ul>
2874
+ }
2875
+ @if (showNeeds()) {
2876
+ <p class="cb-info-h">{{ labels.t('connection.info.needsTitle') }}</p>
2877
+ <ul class="cb-list">@for (item of needsItems(); track $index) { <li>{{ item }}</li> }</ul>
2878
+ }
2825
2879
  <button #infoHide type="button" class="cb-btn" data-testid="connection-banner-info-hide" (click)="closeInfo(true)">{{ labels.t('connection.hide') }}</button>
2826
2880
  </div>
2827
2881
  }
@@ -2849,6 +2903,14 @@ i0.ɵɵngDeclareClassMetadata({
2849
2903
  required: false
2850
2904
  }]
2851
2905
  }],
2906
+ queues: [{
2907
+ type: i0.Input,
2908
+ args: [{
2909
+ isSignal: true,
2910
+ alias: "queues",
2911
+ required: false
2912
+ }]
2913
+ }],
2852
2914
  viewChanges: [{
2853
2915
  type: i0.Output,
2854
2916
  args: ["viewChanges"]
@@ -3356,8 +3418,12 @@ var StillWorkingComponent = class StillWorkingComponent {
3356
3418
  this.labels = inject(UiLabelsService);
3357
3419
  this.active = input(false, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
3358
3420
  this.delayMs = input(4e3, ...ngDevMode ? [{ debugName: "delayMs" }] : /* istanbul ignore next */ []);
3421
+ this.text = input("", ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
3359
3422
  this.elapsed = signal(false, ...ngDevMode ? [{ debugName: "elapsed" }] : /* istanbul ignore next */ []);
3360
- this.text = computed(() => this.active() && this.elapsed() ? this.labels.t("connection.stillWorking") : "", ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
3423
+ this.shown = computed(() => {
3424
+ if (!this.active() || !this.elapsed()) return "";
3425
+ return this.text().trim() ? this.text() : this.labels.t("connection.stillWorking");
3426
+ }, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
3361
3427
  effect((onCleanup) => {
3362
3428
  const active = this.active();
3363
3429
  const delay = this.delayMs();
@@ -3398,10 +3464,17 @@ var StillWorkingComponent = class StillWorkingComponent {
3398
3464
  isSignal: true,
3399
3465
  isRequired: false,
3400
3466
  transformFunction: null
3467
+ },
3468
+ text: {
3469
+ classPropertyName: "text",
3470
+ publicName: "text",
3471
+ isSignal: true,
3472
+ isRequired: false,
3473
+ transformFunction: null
3401
3474
  }
3402
3475
  },
3403
3476
  ngImport: i0,
3404
- template: `<div class="sw" role="status" aria-live="polite" aria-atomic="true" data-testid="still-working">{{ text() }}</div>`,
3477
+ template: `<div class="sw" role="status" aria-live="polite" aria-atomic="true" data-testid="still-working">{{ shown() }}</div>`,
3405
3478
  isInline: true,
3406
3479
  styles: [":host{display:block}.sw{color:#475569;font-size:.8125rem;line-height:1.4}.sw:empty{min-block-size:0;margin:0;padding:0}@media(forced-colors:active){.sw{color:CanvasText}}\n"],
3407
3480
  changeDetection: i0.ChangeDetectionStrategy.OnPush
@@ -3419,7 +3492,7 @@ i0.ɵɵngDeclareClassMetadata({
3419
3492
  selector: "ui-still-working",
3420
3493
  standalone: true,
3421
3494
  changeDetection: ChangeDetectionStrategy.OnPush,
3422
- template: `<div class="sw" role="status" aria-live="polite" aria-atomic="true" data-testid="still-working">{{ text() }}</div>`,
3495
+ template: `<div class="sw" role="status" aria-live="polite" aria-atomic="true" data-testid="still-working">{{ shown() }}</div>`,
3423
3496
  styles: [":host{display:block}.sw{color:#475569;font-size:.8125rem;line-height:1.4}.sw:empty{min-block-size:0;margin:0;padding:0}@media(forced-colors:active){.sw{color:CanvasText}}\n"]
3424
3497
  }]
3425
3498
  }],
@@ -3440,6 +3513,14 @@ i0.ɵɵngDeclareClassMetadata({
3440
3513
  alias: "delayMs",
3441
3514
  required: false
3442
3515
  }]
3516
+ }],
3517
+ text: [{
3518
+ type: i0.Input,
3519
+ args: [{
3520
+ isSignal: true,
3521
+ alias: "text",
3522
+ required: false
3523
+ }]
3443
3524
  }]
3444
3525
  }
3445
3526
  });