@virusis/angular-ui 0.1.9 → 0.1.11

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Injectable, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, PLATFORM_ID, signal, DestroyRef, afterNextRender, ViewChild, HostListener, ElementRef, InjectionToken, ChangeDetectorRef, NgModule, Inject } from '@angular/core';
2
+ import { inject, Injectable, EventEmitter, isDevMode, Output, Input, ChangeDetectionStrategy, Component, PLATFORM_ID, signal, DestroyRef, afterNextRender, ViewChild, HostListener, ElementRef, InjectionToken, ChangeDetectorRef, NgModule, Inject } from '@angular/core';
3
3
  import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
4
4
  import { buildSprite } from '@virusis/icon-set';
5
5
  import * as i1 from 'primeng/button';
@@ -252,9 +252,16 @@ function formatCountdown(totalSeconds) {
252
252
  /**
253
253
  * Ortak durum ekrani — paket 06 · G1.
254
254
  *
255
- * 13 varyant. loading disindaki her varyant **en az bir aksiyon** sunar;
255
+ * 13 varyant. loading disindaki her durum **en az bir BAGLI cikis** sunmali;
256
256
  * cikissiz ekran yasak.
257
257
  *
258
+ * 🔴 2026-09-12 — kural ayni, uygulamasi degisti (kullanici karari). Onceki hal
259
+ * her varyanta varsayilan bir dugme ciziyordu; bes konsolda 42 kullanimin 26
260
+ * eylemi cizilmis ama hicbir seye bagli degildi — tiklaninca hicbir sey olmuyordu.
261
+ * Baglanmamis dugme cikis degil, cikis gibi gorunen bir cikmaz. Artik eylem
262
+ * yalniz tuketici ona baglandiginda (`EventEmitter.observed`) ciziliyor; bagli
263
+ * cikisi olmayan durum gelistirmede hata veriyor.
264
+ *
258
265
  * Renk yalnizca token'dan gelir (--vp-*); ham palet sinifi kullanilmaz.
259
266
  * Anlam renkle degil **ikon + baslik + metin** ile tasinir (WCAG 1.4.1).
260
267
  *
@@ -313,6 +320,8 @@ class VpStateComponent {
313
320
  this.primaryAction = new EventEmitter();
314
321
  this.secondaryAction = new EventEmitter();
315
322
  this.referenceCopied = new EventEmitter();
323
+ /** Ayni tur icin hatayi bir kez soyle; her degisiklik algilamada tekrar etme. */
324
+ this.reportedWithoutExit = null;
316
325
  }
317
326
  /** Aralik disi deger sessizce kabul edilmiyor: 7. seviye baslik yok. */
318
327
  get resolvedHeadingLevel() {
@@ -321,6 +330,31 @@ class VpStateComponent {
321
330
  get variant() {
322
331
  return VP_STATE_VARIANTS[this.type];
323
332
  }
333
+ /**
334
+ * Cizilen eylemler: varyantin eylemlerinden YALNIZ tuketicinin bagladiklari.
335
+ *
336
+ * 🔴 Baglanmamis bir dugme tiklaninca hicbir sey yapmiyor; cizmek kullaniciya
337
+ * olmayan bir cikis gostermek. Sablondaki `(primaryAction)` bilesen olusurken
338
+ * abone oluyor, yani ilk `ngOnChanges`ten once `observed` dogru okunuyor.
339
+ */
340
+ get visibleActions() {
341
+ return this.variant.actions.filter((action) => action.kind === 'primary' ? this.primaryAction.observed : this.secondaryAction.observed);
342
+ }
343
+ /**
344
+ * Cikissiz ekran hala yasak — ama artik sahte dugmeyle orutulmuyor.
345
+ * Gelistirmede HATA olarak soyleniyor; uretimde sessiz (ekran yine ciziliyor).
346
+ */
347
+ ngOnChanges(changes) {
348
+ if (!('type' in changes) || this.type === 'loading')
349
+ return;
350
+ if (this.visibleActions.length > 0 || this.reportedWithoutExit === this.type)
351
+ return;
352
+ this.reportedWithoutExit = this.type;
353
+ if (!isDevMode())
354
+ return;
355
+ console.error('[vp-state] "' + this.type + '" durumunun bagli cikisi yok: primaryAction / ' +
356
+ 'secondaryAction baglanmadi, eylem dugmesi cizilmedi. Kullaniciya bir cikis baglayin.');
357
+ }
324
358
  get resolvedTitle() {
325
359
  return this.title ?? this.variant.titleKey;
326
360
  }
@@ -352,7 +386,7 @@ class VpStateComponent {
352
386
  this.referenceCopied.emit(value);
353
387
  }
354
388
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.31", ngImport: i0, type: VpStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
355
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.31", type: VpStateComponent, isStandalone: true, selector: "vp-state", inputs: { type: "type", title: "title", description: "description", primaryLabel: "primaryLabel", secondaryLabel: "secondaryLabel", reference: "reference", remainingSeconds: "remainingSeconds", loadingLabel: "loadingLabel", countdownLabel: "countdownLabel", referenceLabel: "referenceLabel", copyLabel: "copyLabel", headingLevel: "headingLevel" }, outputs: { primaryAction: "primaryAction", secondaryAction: "secondaryAction", referenceCopied: "referenceCopied" }, host: { classAttribute: "vp-state-host" }, ngImport: i0, template: `
389
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.31", type: VpStateComponent, isStandalone: true, selector: "vp-state", inputs: { type: "type", title: "title", description: "description", primaryLabel: "primaryLabel", secondaryLabel: "secondaryLabel", reference: "reference", remainingSeconds: "remainingSeconds", loadingLabel: "loadingLabel", countdownLabel: "countdownLabel", referenceLabel: "referenceLabel", copyLabel: "copyLabel", headingLevel: "headingLevel" }, outputs: { primaryAction: "primaryAction", secondaryAction: "secondaryAction", referenceCopied: "referenceCopied" }, host: { classAttribute: "vp-state-host" }, usesOnChanges: true, ngImport: i0, template: `
356
390
  <div
357
391
  class="vp-state"
358
392
  [attr.data-tone]="variant.tone"
@@ -393,7 +427,7 @@ class VpStateComponent {
393
427
  }
394
428
 
395
429
  <div class="vp-state__actions">
396
- @for (action of variant.actions; track action.label) {
430
+ @for (action of visibleActions; track action.label) {
397
431
  <button
398
432
  type="button"
399
433
  class="vp-state__action"
@@ -468,7 +502,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.31", ngImpo
468
502
  }
469
503
 
470
504
  <div class="vp-state__actions">
471
- @for (action of variant.actions; track action.label) {
505
+ @for (action of visibleActions; track action.label) {
472
506
  <button
473
507
  type="button"
474
508
  class="vp-state__action"
@@ -9681,8 +9715,39 @@ function verdictFor(backendOk, authOk) {
9681
9715
  * 🔴 Üç durum AYRI: "giriş servisi kapalı" ile "arka uç kapalı" farklı şeyler
9682
9716
  * ve kullanıcının yapacağı şey de farklı. Tek bir "bir şeyler ters gitti"
9683
9717
  * mesajı, destek çağrısında hiçbir bilgi taşımaz.
9718
+ *
9719
+ * 🔴 Dil (0.1.11): önceden yalnız Türkçeydi; iki dilli konsollarda İngilizce kullanıcı
9720
+ * kesinti ekranını Türkçe okuyordu. `language` serbest metin — konsollar onu
9721
+ * `translate.currentLang` gibi yerlerden veriyor (`en`, `en-GB`, `en-US`). `en` ile
9722
+ * başlayan her dil İngilizce; verilmeyen ya da tanınmayan dil Türkçe (mevcut davranış).
9684
9723
  */
9685
- function messageFor(verdict) {
9724
+ function messageFor(verdict, language = 'tr-TR') {
9725
+ return language.trim().toLowerCase().startsWith('en') ? englishMessageFor(verdict) : turkishMessageFor(verdict);
9726
+ }
9727
+ function englishMessageFor(verdict) {
9728
+ switch (verdict) {
9729
+ case 'auth-down':
9730
+ return {
9731
+ title: 'The sign-in service can’t be reached',
9732
+ description: 'The authentication service isn’t responding right now. You can try signing in again in a few ' +
9733
+ 'minutes; nothing is wrong with your account.',
9734
+ };
9735
+ case 'backend-down':
9736
+ return {
9737
+ title: 'The service can’t be reached',
9738
+ description: 'The application server isn’t responding right now. Even if you signed in, your data couldn’t load.',
9739
+ };
9740
+ case 'both-down':
9741
+ return {
9742
+ title: 'The system is unavailable right now',
9743
+ description: 'Neither the application server nor the authentication service can be reached. ' +
9744
+ 'This is usually a temporary outage.',
9745
+ };
9746
+ case 'healthy':
9747
+ return { title: '', description: '' };
9748
+ }
9749
+ }
9750
+ function turkishMessageFor(verdict) {
9686
9751
  switch (verdict) {
9687
9752
  case 'auth-down':
9688
9753
  return {