@masmarino/gabarit 3.1.0 → 4.0.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.
Files changed (114) hide show
  1. package/README.md +31 -25
  2. package/alert/README.md +1 -1
  3. package/app-shell/README.md +11 -4
  4. package/auth-activate/README.md +1 -1
  5. package/auth-login/README.md +1 -1
  6. package/auth-register/README.md +1 -1
  7. package/auth-reset-password/README.md +1 -1
  8. package/card/README.md +11 -12
  9. package/disclosure/README.md +1 -1
  10. package/empty-state/README.md +1 -1
  11. package/fesm2022/masmarino-gabarit-accordion.mjs +4 -4
  12. package/fesm2022/masmarino-gabarit-accordion.mjs.map +1 -1
  13. package/fesm2022/masmarino-gabarit-alert.mjs +2 -2
  14. package/fesm2022/masmarino-gabarit-alert.mjs.map +1 -1
  15. package/fesm2022/masmarino-gabarit-app-shell.mjs +4 -4
  16. package/fesm2022/masmarino-gabarit-app-shell.mjs.map +1 -1
  17. package/fesm2022/masmarino-gabarit-auth-register.mjs +2 -2
  18. package/fesm2022/masmarino-gabarit-auth-register.mjs.map +1 -1
  19. package/fesm2022/masmarino-gabarit-auth.mjs +4 -4
  20. package/fesm2022/masmarino-gabarit-auth.mjs.map +1 -1
  21. package/fesm2022/masmarino-gabarit-autocomplete.mjs +2 -2
  22. package/fesm2022/masmarino-gabarit-autocomplete.mjs.map +1 -1
  23. package/fesm2022/masmarino-gabarit-avatar-group.mjs +2 -2
  24. package/fesm2022/masmarino-gabarit-avatar-group.mjs.map +1 -1
  25. package/fesm2022/masmarino-gabarit-card.mjs +4 -20
  26. package/fesm2022/masmarino-gabarit-card.mjs.map +1 -1
  27. package/fesm2022/masmarino-gabarit-chart.mjs +2 -2
  28. package/fesm2022/masmarino-gabarit-chart.mjs.map +1 -1
  29. package/fesm2022/masmarino-gabarit-command-palette.mjs +4 -4
  30. package/fesm2022/masmarino-gabarit-command-palette.mjs.map +1 -1
  31. package/fesm2022/masmarino-gabarit-copy-button.mjs +2 -2
  32. package/fesm2022/masmarino-gabarit-copy-button.mjs.map +1 -1
  33. package/fesm2022/masmarino-gabarit-date-picker.mjs +4 -4
  34. package/fesm2022/masmarino-gabarit-date-picker.mjs.map +1 -1
  35. package/fesm2022/masmarino-gabarit-disclosure.mjs +3 -3
  36. package/fesm2022/masmarino-gabarit-disclosure.mjs.map +1 -1
  37. package/fesm2022/masmarino-gabarit-docs.mjs +6 -7
  38. package/fesm2022/masmarino-gabarit-docs.mjs.map +1 -1
  39. package/fesm2022/masmarino-gabarit-drawer.mjs +2 -2
  40. package/fesm2022/masmarino-gabarit-drawer.mjs.map +1 -1
  41. package/fesm2022/masmarino-gabarit-empty-state.mjs +2 -2
  42. package/fesm2022/masmarino-gabarit-empty-state.mjs.map +1 -1
  43. package/fesm2022/masmarino-gabarit-git-field.mjs +2 -2
  44. package/fesm2022/masmarino-gabarit-git-field.mjs.map +1 -1
  45. package/fesm2022/masmarino-gabarit-job-graph.mjs +2 -2
  46. package/fesm2022/masmarino-gabarit-job-graph.mjs.map +1 -1
  47. package/fesm2022/masmarino-gabarit-list-card.mjs +2 -2
  48. package/fesm2022/masmarino-gabarit-list-card.mjs.map +1 -1
  49. package/fesm2022/masmarino-gabarit-list-row.mjs +2 -2
  50. package/fesm2022/masmarino-gabarit-list-row.mjs.map +1 -1
  51. package/fesm2022/masmarino-gabarit-menu.mjs +2 -2
  52. package/fesm2022/masmarino-gabarit-menu.mjs.map +1 -1
  53. package/fesm2022/masmarino-gabarit-mfa-enrollment.mjs +4 -5
  54. package/fesm2022/masmarino-gabarit-mfa-enrollment.mjs.map +1 -1
  55. package/fesm2022/masmarino-gabarit-mfa-settings.mjs +4 -5
  56. package/fesm2022/masmarino-gabarit-mfa-settings.mjs.map +1 -1
  57. package/fesm2022/masmarino-gabarit-modal.mjs +2 -2
  58. package/fesm2022/masmarino-gabarit-modal.mjs.map +1 -1
  59. package/fesm2022/masmarino-gabarit-nav-tabs.mjs +4 -4
  60. package/fesm2022/masmarino-gabarit-nav-tabs.mjs.map +1 -1
  61. package/fesm2022/masmarino-gabarit-page-header.mjs +2 -2
  62. package/fesm2022/masmarino-gabarit-page-header.mjs.map +1 -1
  63. package/fesm2022/masmarino-gabarit-page-layout.mjs +2 -2
  64. package/fesm2022/masmarino-gabarit-page-layout.mjs.map +1 -1
  65. package/fesm2022/masmarino-gabarit-panel.mjs +2 -2
  66. package/fesm2022/masmarino-gabarit-panel.mjs.map +1 -1
  67. package/fesm2022/masmarino-gabarit-passkey-settings.mjs +4 -6
  68. package/fesm2022/masmarino-gabarit-passkey-settings.mjs.map +1 -1
  69. package/fesm2022/masmarino-gabarit-popover.mjs +2 -2
  70. package/fesm2022/masmarino-gabarit-popover.mjs.map +1 -1
  71. package/fesm2022/masmarino-gabarit-search-bar.mjs +2 -2
  72. package/fesm2022/masmarino-gabarit-search-bar.mjs.map +1 -1
  73. package/fesm2022/masmarino-gabarit-select.mjs +2 -2
  74. package/fesm2022/masmarino-gabarit-select.mjs.map +1 -1
  75. package/fesm2022/masmarino-gabarit-skeleton-list.mjs +4 -23
  76. package/fesm2022/masmarino-gabarit-skeleton-list.mjs.map +1 -1
  77. package/fesm2022/masmarino-gabarit-sparkline.mjs +2 -2
  78. package/fesm2022/masmarino-gabarit-sparkline.mjs.map +1 -1
  79. package/fesm2022/masmarino-gabarit-stat-grid.mjs +2 -2
  80. package/fesm2022/masmarino-gabarit-stat-grid.mjs.map +1 -1
  81. package/fesm2022/masmarino-gabarit-stat-tile.mjs +2 -2
  82. package/fesm2022/masmarino-gabarit-stat-tile.mjs.map +1 -1
  83. package/fesm2022/masmarino-gabarit-tabs.mjs +2 -2
  84. package/fesm2022/masmarino-gabarit-tabs.mjs.map +1 -1
  85. package/fesm2022/masmarino-gabarit-toaster.mjs +2 -2
  86. package/fesm2022/masmarino-gabarit-toaster.mjs.map +1 -1
  87. package/fesm2022/masmarino-gabarit-tooltip.mjs +2 -2
  88. package/fesm2022/masmarino-gabarit-tooltip.mjs.map +1 -1
  89. package/fesm2022/masmarino-gabarit-tree.mjs +2 -2
  90. package/fesm2022/masmarino-gabarit-tree.mjs.map +1 -1
  91. package/fesm2022/masmarino-gabarit.mjs +1 -1
  92. package/fesm2022/masmarino-gabarit.mjs.map +1 -1
  93. package/git-field/README.md +2 -2
  94. package/list-row/README.md +3 -5
  95. package/modal/README.md +1 -1
  96. package/nav-tabs/README.md +3 -2
  97. package/package.json +1 -1
  98. package/page-header/README.md +2 -2
  99. package/page-layout/README.md +1 -1
  100. package/panel/README.md +2 -3
  101. package/skeleton-list/README.md +1 -2
  102. package/src/lib/tokens/_base.scss +5 -6
  103. package/src/lib/tokens/_depth.scss +1 -1
  104. package/src/lib/tokens/_glass.scss +87 -0
  105. package/src/lib/tokens/_grounds.scss +223 -0
  106. package/src/lib/tokens/_semantic.scss +0 -2
  107. package/src/lib/tokens/_themes.scss +77 -23
  108. package/src/lib/tokens/_utilities.scss +53 -13
  109. package/src/lib/tokens/index.scss +2 -0
  110. package/types/masmarino-gabarit-card.d.ts +1 -8
  111. package/types/masmarino-gabarit-disclosure.d.ts +1 -1
  112. package/types/masmarino-gabarit-git-field.d.ts +1 -1
  113. package/types/masmarino-gabarit-skeleton-list.d.ts +0 -6
  114. package/types/masmarino-gabarit.d.ts +3 -3
@@ -157,7 +157,7 @@ var Toaster = class Toaster {
157
157
  outputs: { dismissed: "dismissed" },
158
158
  ngImport: i0,
159
159
  template: "<div class=\"gbt-toaster\" [attr.data-position]=\"position()\">\n @for (toast of items(); track toast.id) {\n <div\n class=\"gbt-toaster__item\"\n [attr.data-variant]=\"toast.variant\"\n [attr.role]=\"roleFor(toast.variant)\"\n aria-atomic=\"true\"\n >\n <span class=\"gbt-toaster__icon\">\n <gbt-icon [name]=\"iconFor(toast.variant)\" aria-hidden=\"true\" />\n </span>\n <p class=\"gbt-toaster__message\">{{ toast.message }}</p>\n <button\n type=\"button\"\n class=\"gbt-toaster__close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close(toast.id)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n </div>\n }\n</div>\n",
160
- styles: [".gbt-toaster{position:fixed;z-index:1300;display:flex;flex-direction:column;gap:.5rem;max-width:min(90vw,360px);pointer-events:none}.gbt-toaster[data-position=top-right]{top:1rem;right:1rem;align-items:flex-end}.gbt-toaster[data-position=top-left]{top:1rem;left:1rem;align-items:flex-start}.gbt-toaster[data-position=top-center]{top:1rem;left:50%;align-items:center;transform:translate(-50%)}.gbt-toaster[data-position=bottom-right]{right:1rem;bottom:1rem;flex-direction:column-reverse;align-items:flex-end}.gbt-toaster[data-position=bottom-left]{bottom:1rem;left:1rem;flex-direction:column-reverse;align-items:flex-start}.gbt-toaster[data-position=bottom-center]{bottom:1rem;left:50%;flex-direction:column-reverse;align-items:center;transform:translate(-50%)}.gbt-toaster__item{box-sizing:border-box;display:flex;align-items:flex-start;gap:.625rem;width:100%;padding:.75rem 1rem;pointer-events:auto;background:var(--bg-inverse);border:none;border-radius:var(--site-border-radius);box-shadow:var(--site-shadow-lg);animation:gbt-toaster-in var(--site-transition-base)}.gbt-toaster__item[data-variant=success] .gbt-toaster__icon{background:var(--color-success-vivid-base)}.gbt-toaster__item[data-variant=warning] .gbt-toaster__icon{background:var(--color-warning-vivid-base)}.gbt-toaster__item[data-variant=error] .gbt-toaster__icon{background:var(--color-error-vivid-base)}.gbt-toaster__item[data-variant=info] .gbt-toaster__icon{background:var(--color-info-vivid-base)}.gbt-toaster__icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;margin-top:.0625rem;color:var(--text-on-color);border-radius:50%}.gbt-toaster__icon gbt-icon{width:1.125em;height:1.125em}.gbt-toaster__message{flex:1 1 auto;margin:.3125rem 0;color:var(--text-on-color);font-size:.875rem;line-height:1.4}.gbt-toaster__close{position:relative;display:inline-flex;flex:none;align-self:flex-start;margin-top:.3125rem;background:none;border:none;border-radius:50%;color:var(--text-on-color);opacity:.7;cursor:pointer;transition:opacity var(--site-transition-fast)}.gbt-toaster__close:hover,.gbt-toaster__close:focus-visible{opacity:1}.gbt-toaster__close:active{opacity:.6}.gbt-toaster__close:focus-visible{outline:2px solid var(--text-on-color);outline-offset:2px}.gbt-toaster__close:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}@keyframes gbt-toaster-in{0%{opacity:0;transform:translateY(4px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.gbt-toaster__item{animation-duration:1ms}.gbt-toaster__close{transition:none}}\n"],
160
+ styles: [".gbt-toaster{position:fixed;z-index:1300;display:flex;flex-direction:column;gap:.5rem;max-width:min(90vw,360px);pointer-events:none}.gbt-toaster[data-position=top-right]{top:1rem;right:1rem;align-items:flex-end}.gbt-toaster[data-position=top-left]{top:1rem;left:1rem;align-items:flex-start}.gbt-toaster[data-position=top-center]{top:1rem;left:50%;align-items:center;transform:translate(-50%)}.gbt-toaster[data-position=bottom-right]{right:1rem;bottom:1rem;flex-direction:column-reverse;align-items:flex-end}.gbt-toaster[data-position=bottom-left]{bottom:1rem;left:1rem;flex-direction:column-reverse;align-items:flex-start}.gbt-toaster[data-position=bottom-center]{bottom:1rem;left:50%;flex-direction:column-reverse;align-items:center;transform:translate(-50%)}.gbt-toaster__item{box-sizing:border-box;display:flex;align-items:flex-start;gap:.625rem;width:100%;padding:.75rem 1rem;pointer-events:auto;border:none;border-radius:var(--gbt-radius-row);background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-toaster__item{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-toaster__item{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-toaster__item{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-toaster__item{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-toaster__item{animation:gbt-toaster-in var(--site-transition-base)}.gbt-toaster__item[data-variant=success] .gbt-toaster__icon{background:var(--color-success-vivid-base)}.gbt-toaster__item[data-variant=warning] .gbt-toaster__icon{background:var(--color-warning-vivid-base)}.gbt-toaster__item[data-variant=error] .gbt-toaster__icon{background:var(--color-error-vivid-base)}.gbt-toaster__item[data-variant=info] .gbt-toaster__icon{background:var(--color-info-vivid-base)}.gbt-toaster__icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;margin-top:.0625rem;color:var(--text-on-color);border-radius:50%}.gbt-toaster__icon gbt-icon{width:1.125em;height:1.125em}.gbt-toaster__message{flex:1 1 auto;margin:.3125rem 0;color:var(--text-primary);font-size:.875rem;line-height:1.4}.gbt-toaster__close{position:relative;display:inline-flex;flex:none;align-self:flex-start;margin-top:.3125rem;background:none;border:none;border-radius:50%;color:var(--text-secondary);cursor:pointer;transition:color var(--site-transition-fast)}.gbt-toaster__close:hover,.gbt-toaster__close:focus-visible{color:var(--text-primary)}.gbt-toaster__close:active{color:var(--text-secondary)}.gbt-toaster__close:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-toaster__close:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}@keyframes gbt-toaster-in{0%{opacity:0;transform:translateY(4px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.gbt-toaster__item{animation-duration:1ms}.gbt-toaster__close{transition:none}}\n"],
161
161
  dependencies: [{
162
162
  kind: "component",
163
163
  type: Icon,
@@ -180,7 +180,7 @@ i0.ɵɵngDeclareClassMetadata({
180
180
  imports: [Icon],
181
181
  changeDetection: ChangeDetectionStrategy.OnPush,
182
182
  template: "<div class=\"gbt-toaster\" [attr.data-position]=\"position()\">\n @for (toast of items(); track toast.id) {\n <div\n class=\"gbt-toaster__item\"\n [attr.data-variant]=\"toast.variant\"\n [attr.role]=\"roleFor(toast.variant)\"\n aria-atomic=\"true\"\n >\n <span class=\"gbt-toaster__icon\">\n <gbt-icon [name]=\"iconFor(toast.variant)\" aria-hidden=\"true\" />\n </span>\n <p class=\"gbt-toaster__message\">{{ toast.message }}</p>\n <button\n type=\"button\"\n class=\"gbt-toaster__close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close(toast.id)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n </div>\n }\n</div>\n",
183
- styles: [".gbt-toaster{position:fixed;z-index:1300;display:flex;flex-direction:column;gap:.5rem;max-width:min(90vw,360px);pointer-events:none}.gbt-toaster[data-position=top-right]{top:1rem;right:1rem;align-items:flex-end}.gbt-toaster[data-position=top-left]{top:1rem;left:1rem;align-items:flex-start}.gbt-toaster[data-position=top-center]{top:1rem;left:50%;align-items:center;transform:translate(-50%)}.gbt-toaster[data-position=bottom-right]{right:1rem;bottom:1rem;flex-direction:column-reverse;align-items:flex-end}.gbt-toaster[data-position=bottom-left]{bottom:1rem;left:1rem;flex-direction:column-reverse;align-items:flex-start}.gbt-toaster[data-position=bottom-center]{bottom:1rem;left:50%;flex-direction:column-reverse;align-items:center;transform:translate(-50%)}.gbt-toaster__item{box-sizing:border-box;display:flex;align-items:flex-start;gap:.625rem;width:100%;padding:.75rem 1rem;pointer-events:auto;background:var(--bg-inverse);border:none;border-radius:var(--site-border-radius);box-shadow:var(--site-shadow-lg);animation:gbt-toaster-in var(--site-transition-base)}.gbt-toaster__item[data-variant=success] .gbt-toaster__icon{background:var(--color-success-vivid-base)}.gbt-toaster__item[data-variant=warning] .gbt-toaster__icon{background:var(--color-warning-vivid-base)}.gbt-toaster__item[data-variant=error] .gbt-toaster__icon{background:var(--color-error-vivid-base)}.gbt-toaster__item[data-variant=info] .gbt-toaster__icon{background:var(--color-info-vivid-base)}.gbt-toaster__icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;margin-top:.0625rem;color:var(--text-on-color);border-radius:50%}.gbt-toaster__icon gbt-icon{width:1.125em;height:1.125em}.gbt-toaster__message{flex:1 1 auto;margin:.3125rem 0;color:var(--text-on-color);font-size:.875rem;line-height:1.4}.gbt-toaster__close{position:relative;display:inline-flex;flex:none;align-self:flex-start;margin-top:.3125rem;background:none;border:none;border-radius:50%;color:var(--text-on-color);opacity:.7;cursor:pointer;transition:opacity var(--site-transition-fast)}.gbt-toaster__close:hover,.gbt-toaster__close:focus-visible{opacity:1}.gbt-toaster__close:active{opacity:.6}.gbt-toaster__close:focus-visible{outline:2px solid var(--text-on-color);outline-offset:2px}.gbt-toaster__close:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}@keyframes gbt-toaster-in{0%{opacity:0;transform:translateY(4px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.gbt-toaster__item{animation-duration:1ms}.gbt-toaster__close{transition:none}}\n"]
183
+ styles: [".gbt-toaster{position:fixed;z-index:1300;display:flex;flex-direction:column;gap:.5rem;max-width:min(90vw,360px);pointer-events:none}.gbt-toaster[data-position=top-right]{top:1rem;right:1rem;align-items:flex-end}.gbt-toaster[data-position=top-left]{top:1rem;left:1rem;align-items:flex-start}.gbt-toaster[data-position=top-center]{top:1rem;left:50%;align-items:center;transform:translate(-50%)}.gbt-toaster[data-position=bottom-right]{right:1rem;bottom:1rem;flex-direction:column-reverse;align-items:flex-end}.gbt-toaster[data-position=bottom-left]{bottom:1rem;left:1rem;flex-direction:column-reverse;align-items:flex-start}.gbt-toaster[data-position=bottom-center]{bottom:1rem;left:50%;flex-direction:column-reverse;align-items:center;transform:translate(-50%)}.gbt-toaster__item{box-sizing:border-box;display:flex;align-items:flex-start;gap:.625rem;width:100%;padding:.75rem 1rem;pointer-events:auto;border:none;border-radius:var(--gbt-radius-row);background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-toaster__item{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-toaster__item{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-toaster__item{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-toaster__item{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-toaster__item{animation:gbt-toaster-in var(--site-transition-base)}.gbt-toaster__item[data-variant=success] .gbt-toaster__icon{background:var(--color-success-vivid-base)}.gbt-toaster__item[data-variant=warning] .gbt-toaster__icon{background:var(--color-warning-vivid-base)}.gbt-toaster__item[data-variant=error] .gbt-toaster__icon{background:var(--color-error-vivid-base)}.gbt-toaster__item[data-variant=info] .gbt-toaster__icon{background:var(--color-info-vivid-base)}.gbt-toaster__icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;margin-top:.0625rem;color:var(--text-on-color);border-radius:50%}.gbt-toaster__icon gbt-icon{width:1.125em;height:1.125em}.gbt-toaster__message{flex:1 1 auto;margin:.3125rem 0;color:var(--text-primary);font-size:.875rem;line-height:1.4}.gbt-toaster__close{position:relative;display:inline-flex;flex:none;align-self:flex-start;margin-top:.3125rem;background:none;border:none;border-radius:50%;color:var(--text-secondary);cursor:pointer;transition:color var(--site-transition-fast)}.gbt-toaster__close:hover,.gbt-toaster__close:focus-visible{color:var(--text-primary)}.gbt-toaster__close:active{color:var(--text-secondary)}.gbt-toaster__close:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:2px}.gbt-toaster__close:before{content:\"\";position:absolute;inset:50% auto auto 50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%)}@keyframes gbt-toaster-in{0%{opacity:0;transform:translateY(4px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.gbt-toaster__item{animation-duration:1ms}.gbt-toaster__close{transition:none}}\n"]
184
184
  }]
185
185
  }],
186
186
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-toaster.mjs","names":[],"sources":["../../../projects/gabarit/toaster/toast.service.ts","../../../projects/gabarit/toaster/toaster.ts","../../../projects/gabarit/toaster/toaster.html"],"sourcesContent":["import { DestroyRef, Injectable, inject, signal } from '@angular/core'\nimport type { ToastItem, ToastVariant } from './toaster'\n\nexport type GbtToastKind = ToastVariant\n\nexport interface GbtToastOptions {\n duration?: number\n}\n\nlet nextToastId = 0\n\n@Injectable({ providedIn: 'root' })\nexport class GbtToastService {\n private readonly items = signal<ToastItem[]>([])\n private readonly timers = new Map<string, ReturnType<typeof setTimeout>>()\n\n readonly toasts = this.items.asReadonly()\n\n readonly defaultDuration = signal(5000)\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.clearTimers())\n }\n\n show(message: string, kind: GbtToastKind = 'success', options: GbtToastOptions = {}): string {\n const id = `gbt-toast-${++nextToastId}`\n const duration = options.duration ?? this.defaultDuration()\n this.items.update((current) => [...current, { id, variant: kind, message, duration }])\n\n if (Number.isFinite(duration) && duration > 0) {\n this.timers.set(\n id,\n setTimeout(() => this.dismiss(id), duration),\n )\n }\n return id\n }\n\n dismiss(id: string): void {\n const timer = this.timers.get(id)\n if (timer !== undefined) {\n clearTimeout(timer)\n this.timers.delete(id)\n }\n this.items.update((current) => {\n const next = current.filter((toast) => toast.id !== id)\n return next.length === current.length ? current : next\n })\n }\n\n clear(): void {\n this.clearTimers()\n this.items.set([])\n }\n\n private clearTimers(): void {\n for (const timer of this.timers.values()) {\n clearTimeout(timer)\n }\n this.timers.clear()\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n computed,\n effect,\n inject,\n input,\n output,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { GbtToastService } from './toast.service'\n\nconst DEFAULT_DURATION_MS = 5000\n\nexport type ToastVariant = 'success' | 'error' | 'warning' | 'info'\n\nexport type ToasterPosition =\n 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center'\n\nexport interface ToastItem {\n id: string\n variant: ToastVariant\n message: string\n duration?: number\n}\n\nconst ASSERTIVE_VARIANTS: ReadonlySet<ToastVariant> = new Set(['warning', 'error'])\n\nconst VARIANT_ICONS: Record<ToastVariant, string> = {\n success: 'check-circle',\n error: 'alert-circle',\n warning: 'alert-triangle',\n info: 'info',\n}\n\n@Component({\n selector: 'gbt-toaster',\n standalone: true,\n imports: [Icon],\n templateUrl: './toaster.html',\n styleUrl: './toaster.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Toaster implements OnDestroy {\n toasts = input<ToastItem[] | undefined>(undefined)\n position = input<ToasterPosition>('bottom-right')\n closeLabel = input<string>('Close')\n\n dismissed = output<string>()\n\n private readonly service = inject(GbtToastService)\n private readonly timers = new Map<string, ReturnType<typeof setTimeout>>()\n\n protected readonly items = computed(() => this.toasts() ?? this.service.toasts())\n\n constructor() {\n effect(() => {\n const explicit = this.toasts()\n const list = explicit ?? []\n const currentIds = new Set(list.map((toast) => toast.id))\n\n for (const [id, timer] of this.timers) {\n if (!currentIds.has(id)) {\n clearTimeout(timer)\n this.timers.delete(id)\n }\n }\n\n for (const toast of list) {\n if (this.timers.has(toast.id)) {\n continue\n }\n const duration = toast.duration ?? DEFAULT_DURATION_MS\n if (!Number.isFinite(duration) || duration <= 0) {\n continue\n }\n this.timers.set(\n toast.id,\n setTimeout(() => {\n this.timers.delete(toast.id)\n this.dismissed.emit(toast.id)\n }, duration),\n )\n }\n })\n }\n\n ngOnDestroy(): void {\n for (const timer of this.timers.values()) {\n clearTimeout(timer)\n }\n this.timers.clear()\n }\n\n protected close(id: string): void {\n this.dismissed.emit(id)\n if (this.toasts() === undefined) {\n this.service.dismiss(id)\n }\n }\n\n protected roleFor(variant: ToastVariant): 'alert' | 'status' {\n return ASSERTIVE_VARIANTS.has(variant) ? 'alert' : 'status'\n }\n\n protected iconFor(variant: ToastVariant): string {\n return VARIANT_ICONS[variant]\n }\n}\n","<div class=\"gbt-toaster\" [attr.data-position]=\"position()\">\n @for (toast of items(); track toast.id) {\n <div\n class=\"gbt-toaster__item\"\n [attr.data-variant]=\"toast.variant\"\n [attr.role]=\"roleFor(toast.variant)\"\n aria-atomic=\"true\"\n >\n <span class=\"gbt-toaster__icon\">\n <gbt-icon [name]=\"iconFor(toast.variant)\" aria-hidden=\"true\" />\n </span>\n <p class=\"gbt-toaster__message\">{{ toast.message }}</p>\n <button\n type=\"button\"\n class=\"gbt-toaster__close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close(toast.id)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n </div>\n }\n</div>\n"],"mappings":";;;AASA,IAAI,cAAc;AAGlB,IAAa,kBAAb,MAAa,gBAAe;CACT,QAAQ,OAAoB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA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AAA;;AAKH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EARnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,SACP,CAAC,IAAI;GAAC,iBAGE,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,4nFAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"masmarino-gabarit-toaster.mjs","names":[],"sources":["../../../projects/gabarit/toaster/toast.service.ts","../../../projects/gabarit/toaster/toaster.ts","../../../projects/gabarit/toaster/toaster.html"],"sourcesContent":["import { DestroyRef, Injectable, inject, signal } from '@angular/core'\nimport type { ToastItem, ToastVariant } from './toaster'\n\nexport type GbtToastKind = ToastVariant\n\nexport interface GbtToastOptions {\n duration?: number\n}\n\nlet nextToastId = 0\n\n@Injectable({ providedIn: 'root' })\nexport class GbtToastService {\n private readonly items = signal<ToastItem[]>([])\n private readonly timers = new Map<string, ReturnType<typeof setTimeout>>()\n\n readonly toasts = this.items.asReadonly()\n\n readonly defaultDuration = signal(5000)\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.clearTimers())\n }\n\n show(message: string, kind: GbtToastKind = 'success', options: GbtToastOptions = {}): string {\n const id = `gbt-toast-${++nextToastId}`\n const duration = options.duration ?? this.defaultDuration()\n this.items.update((current) => [...current, { id, variant: kind, message, duration }])\n\n if (Number.isFinite(duration) && duration > 0) {\n this.timers.set(\n id,\n setTimeout(() => this.dismiss(id), duration),\n )\n }\n return id\n }\n\n dismiss(id: string): void {\n const timer = this.timers.get(id)\n if (timer !== undefined) {\n clearTimeout(timer)\n this.timers.delete(id)\n }\n this.items.update((current) => {\n const next = current.filter((toast) => toast.id !== id)\n return next.length === current.length ? current : next\n })\n }\n\n clear(): void {\n this.clearTimers()\n this.items.set([])\n }\n\n private clearTimers(): void {\n for (const timer of this.timers.values()) {\n clearTimeout(timer)\n }\n this.timers.clear()\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n computed,\n effect,\n inject,\n input,\n output,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { GbtToastService } from './toast.service'\n\nconst DEFAULT_DURATION_MS = 5000\n\nexport type ToastVariant = 'success' | 'error' | 'warning' | 'info'\n\nexport type ToasterPosition =\n 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center'\n\nexport interface ToastItem {\n id: string\n variant: ToastVariant\n message: string\n duration?: number\n}\n\nconst ASSERTIVE_VARIANTS: ReadonlySet<ToastVariant> = new Set(['warning', 'error'])\n\nconst VARIANT_ICONS: Record<ToastVariant, string> = {\n success: 'check-circle',\n error: 'alert-circle',\n warning: 'alert-triangle',\n info: 'info',\n}\n\n@Component({\n selector: 'gbt-toaster',\n standalone: true,\n imports: [Icon],\n templateUrl: './toaster.html',\n styleUrl: './toaster.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Toaster implements OnDestroy {\n toasts = input<ToastItem[] | undefined>(undefined)\n position = input<ToasterPosition>('bottom-right')\n closeLabel = input<string>('Close')\n\n dismissed = output<string>()\n\n private readonly service = inject(GbtToastService)\n private readonly timers = new Map<string, ReturnType<typeof setTimeout>>()\n\n protected readonly items = computed(() => this.toasts() ?? this.service.toasts())\n\n constructor() {\n effect(() => {\n const explicit = this.toasts()\n const list = explicit ?? []\n const currentIds = new Set(list.map((toast) => toast.id))\n\n for (const [id, timer] of this.timers) {\n if (!currentIds.has(id)) {\n clearTimeout(timer)\n this.timers.delete(id)\n }\n }\n\n for (const toast of list) {\n if (this.timers.has(toast.id)) {\n continue\n }\n const duration = toast.duration ?? DEFAULT_DURATION_MS\n if (!Number.isFinite(duration) || duration <= 0) {\n continue\n }\n this.timers.set(\n toast.id,\n setTimeout(() => {\n this.timers.delete(toast.id)\n this.dismissed.emit(toast.id)\n }, duration),\n )\n }\n })\n }\n\n ngOnDestroy(): void {\n for (const timer of this.timers.values()) {\n clearTimeout(timer)\n }\n this.timers.clear()\n }\n\n protected close(id: string): void {\n this.dismissed.emit(id)\n if (this.toasts() === undefined) {\n this.service.dismiss(id)\n }\n }\n\n protected roleFor(variant: ToastVariant): 'alert' | 'status' {\n return ASSERTIVE_VARIANTS.has(variant) ? 'alert' : 'status'\n }\n\n protected iconFor(variant: ToastVariant): string {\n return VARIANT_ICONS[variant]\n }\n}\n","<div class=\"gbt-toaster\" [attr.data-position]=\"position()\">\n @for (toast of items(); track toast.id) {\n <div\n class=\"gbt-toaster__item\"\n [attr.data-variant]=\"toast.variant\"\n [attr.role]=\"roleFor(toast.variant)\"\n aria-atomic=\"true\"\n >\n <span class=\"gbt-toaster__icon\">\n <gbt-icon [name]=\"iconFor(toast.variant)\" aria-hidden=\"true\" />\n </span>\n <p class=\"gbt-toaster__message\">{{ toast.message }}</p>\n <button\n type=\"button\"\n class=\"gbt-toaster__close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close(toast.id)\"\n >\n <gbt-icon name=\"x\" aria-hidden=\"true\" />\n </button>\n </div>\n }\n</div>\n"],"mappings":";;;AASA,IAAI,cAAc;AAGlB,IAAa,kBAAb,MAAa,gBAAe;CACT,QAAQ,OAAoB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,yBAAS,IAAI,IAAG;CAExB,SAAS,KAAK,MAAM,WAAU;CAE9B,kBAAkB,OAAO,KAAK,GAAA,YAAA,CAAA,EAAA,WAAA,kBAAA,CAAA,+BAAA,CAAA,CAAA;CAEvC,cAAA;EACE,OAAO,UAAU,CAAC,CAAC,gBAAgB,KAAK,YAAW,CAAE;CACvD;CAEA,KAAK,SAAiB,OAAqB,WAAW,UAA2B,CAAA,GAAE;EACjF,MAAM,KAAK,aAAa,EAAE;EAC1B,MAAM,WAAW,QAAQ,YAAY,KAAK,gBAAe;EACzD,KAAK,MAAM,QAAQ,YAAY,CAAC,GAAG,SAAS;GAAE;GAAI,SAAS;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B;CAEU,QAAQ,SAAqB;EACrC,OAAO,mBAAmB,IAAI,OAAO,IAAI,UAAU;CACrD;CAEU,QAAQ,SAAqB;EACrC,OAAO,cAAc;CACvB;CAhEW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAO,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAP,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAO,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,WAAA,YAAA;EAAA,UAAA;EAAA,UC5CpB;EAuBA,QAAA,CAAA,mnHAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MDgBY;GAAI,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAKH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EARnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,SACP,CAAC,IAAI;GAAC,iBAGE,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,mnHAAA;EAAA,CAAA"}
@@ -130,7 +130,7 @@ var Tooltip = class Tooltip {
130
130
  exportAs: ["gbtTooltip"],
131
131
  ngImport: i0,
132
132
  template: "<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n",
133
- styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--bg-inverse);color:var(--text-on-color);text-align:center;white-space:normal;border:1px solid rgba(255,255,255,.15);border-radius:var(--site-border-radius-sm);box-shadow:var(--site-shadow-md);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"],
133
+ styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-tooltip__bubble{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tooltip__bubble{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-tooltip__bubble{color:var(--text-primary);text-align:center;white-space:normal;border-radius:var(--site-border-radius);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"],
134
134
  changeDetection: i0.ChangeDetectionStrategy.OnPush
135
135
  });
136
136
  };
@@ -157,7 +157,7 @@ i0.ɵɵngDeclareClassMetadata({
157
157
  "(window:resize)": "updatePosition()"
158
158
  },
159
159
  template: "<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n",
160
- styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--bg-inverse);color:var(--text-on-color);text-align:center;white-space:normal;border:1px solid rgba(255,255,255,.15);border-radius:var(--site-border-radius-sm);box-shadow:var(--site-shadow-md);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"]
160
+ styles: [".gbt-tooltip-host{display:inline-block}.gbt-tooltip__bubble{position:fixed;z-index:1100;max-width:240px;padding:.375rem .625rem;background:var(--gbt-glass-thick);-webkit-backdrop-filter:var(--gbt-liquid-blur);backdrop-filter:var(--gbt-liquid-blur);box-shadow:var(--gbt-depth-liquid);--text-discret: var(--gbt-ground-text-discret);--border-color: var(--gbt-ground-border);--color-success-text: var(--color-success-bg-text);--color-warning-text: var(--color-warning-bg-text);--color-error-text: var(--color-error-bg-text);--text-secondary: var(--gbt-liquid-text);--text-discret: var(--gbt-liquid-text)}@media(prefers-reduced-transparency:reduce){.gbt-tooltip__bubble{background:linear-gradient(var(--gbt-glass-thick),var(--gbt-glass-thick)),var(--bg-principal);-webkit-backdrop-filter:none;backdrop-filter:none}}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid)}}.gbt-tooltip__bubble{box-shadow:var(--gbt-depth-liquid),var(--gbt-depth-glass)}@media(prefers-contrast:more){.gbt-tooltip__bubble{box-shadow:inset 0 0 0 1px var(--border-color),var(--gbt-depth-liquid),var(--gbt-depth-glass)}}.gbt-tooltip__bubble{color:var(--text-primary);text-align:center;white-space:normal;border-radius:var(--site-border-radius);font-size:.8125rem;line-height:1.3;pointer-events:none}.gbt-tooltip__bubble[data-position=top]{transform:translate(-50%,-100%)}.gbt-tooltip__bubble[data-position=bottom]{transform:translate(-50%)}.gbt-tooltip__bubble[data-position=left]{transform:translate(-100%,-50%)}.gbt-tooltip__bubble[data-position=right]{transform:translateY(-50%)}.gbt-tooltip__bubble{animation:gbt-tooltip-fade-in .12s ease-out}.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation:gbt-tooltip-fade-out .12s ease-in forwards}@keyframes gbt-tooltip-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gbt-tooltip-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.gbt-tooltip__bubble,.gbt-tooltip__bubble.gbt-tooltip__bubble--leaving{animation-duration:1ms}}\n"]
161
161
  }]
162
162
  }],
163
163
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-tooltip.mjs","names":[],"sources":["../../../projects/gabarit/tooltip/tooltip.ts","../../../projects/gabarit/tooltip/tooltip.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n inject,\n input,\n signal,\n} from '@angular/core'\nimport { followPageScroll } from '@masmarino/gabarit/floating-panel'\n\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right'\n\ninterface TooltipCoords {\n top: number\n left: number\n}\n\nconst SHOW_DELAY_MS = 400\nconst FADE_MS = 120\nconst GAP_PX = 8\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-tooltip',\n standalone: true,\n exportAs: 'gbtTooltip',\n imports: [],\n templateUrl: './tooltip.html',\n styleUrl: './tooltip.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'gbt-tooltip-host',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'hide()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'hide()',\n '(keydown.escape)': 'hide()',\n '(window:resize)': 'updatePosition()',\n },\n})\nexport class Tooltip implements OnDestroy {\n private readonly elementRef = inject(ElementRef<HTMLElement>)\n\n text = input.required<string>()\n position = input<TooltipPosition>('top')\n\n readonly tooltipId = `gbt-tooltip-${++nextId}`\n\n protected readonly visible = signal(false)\n protected readonly closing = signal(false)\n protected readonly coords = signal<TooltipCoords | null>(null)\n\n private showTimer: ReturnType<typeof setTimeout> | null = null\n private hideTimer: ReturnType<typeof setTimeout> | null = null\n\n protected onMouseEnter(): void {\n this.showTimer = setTimeout(() => {\n this.showTimer = null\n this.show()\n }, SHOW_DELAY_MS)\n }\n\n protected onFocusIn(): void {\n this.show()\n }\n\n private show(): void {\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n this.closing.set(false)\n this.updatePosition()\n this.visible.set(true)\n }\n\n constructor() {\n followPageScroll(() => this.updatePosition())\n }\n\n protected updatePosition(): void {\n const rect = this.elementRef.nativeElement.getBoundingClientRect()\n switch (this.position()) {\n case 'top':\n this.coords.set({ top: rect.top - GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'bottom':\n this.coords.set({ top: rect.bottom + GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'left':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.left - GAP_PX })\n break\n case 'right':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.right + GAP_PX })\n break\n }\n }\n\n protected hide(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (!this.visible() || this.closing()) return\n this.closing.set(true)\n this.hideTimer = setTimeout(() => {\n this.hideTimer = null\n this.closing.set(false)\n this.visible.set(false)\n }, FADE_MS)\n }\n\n ngOnDestroy(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n }\n}\n","<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n"],"mappings":";;;AAkBA,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,SAAS;AAEf,IAAI,SAAS;AAoBb,IAAa,UAAb,MAAa,QAAO;CACD,aAAa,OAAO,UAAuB;CAE5D,OAAO,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,WAAW,MAAuB,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAE/B,YAAY,eAAe,EAAE;CAEnB,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,SAAS,OAA6B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAEtD,YAAkD;CAClD,YAAkD;CAEhD,eAAY;EACpB,KAAK,YAAY,iBAAgB;GAC/B,KAAK,YAAY;GACjB,KAAK,KAAI;EACX,GAAG,aAAa;CAClB;CAEU,YAAS;EACjB,KAAK,KAAI;CACX;CAEQ,OAAI;EACV,IAAI,KAAK,cAAc,MAAM;GAC3B,aAAa,KAAK,SAAS;GAC3B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AAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAO,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAP,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAO,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,WAAA;IAAA,cAAA;IAAA,cAAA;IAAA,WAAA;IAAA,YAAA;IAAA,kBAAA;IAAA,iBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA,CAAA,YAAA;EAAA,UAAA;EAAA,UC1CpB;EAcA,QAAA,CAAA,wkCAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AD4Ba,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EAlBnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,UACN;GAAY,SACb,CAAA;GAAE,iBAGM,wBAAwB;GAAM,MACzC;IACJ,OAAO;IACP,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,mBAAmB;GACpB;GAAA,UAAA;GAAA,QAAA,CAAA,wkCAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"masmarino-gabarit-tooltip.mjs","names":[],"sources":["../../../projects/gabarit/tooltip/tooltip.ts","../../../projects/gabarit/tooltip/tooltip.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n inject,\n input,\n signal,\n} from '@angular/core'\nimport { followPageScroll } from '@masmarino/gabarit/floating-panel'\n\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right'\n\ninterface TooltipCoords {\n top: number\n left: number\n}\n\nconst SHOW_DELAY_MS = 400\nconst FADE_MS = 120\nconst GAP_PX = 8\n\nlet nextId = 0\n\n@Component({\n selector: 'gbt-tooltip',\n standalone: true,\n exportAs: 'gbtTooltip',\n imports: [],\n templateUrl: './tooltip.html',\n styleUrl: './tooltip.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'gbt-tooltip-host',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'hide()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'hide()',\n '(keydown.escape)': 'hide()',\n '(window:resize)': 'updatePosition()',\n },\n})\nexport class Tooltip implements OnDestroy {\n private readonly elementRef = inject(ElementRef<HTMLElement>)\n\n text = input.required<string>()\n position = input<TooltipPosition>('top')\n\n readonly tooltipId = `gbt-tooltip-${++nextId}`\n\n protected readonly visible = signal(false)\n protected readonly closing = signal(false)\n protected readonly coords = signal<TooltipCoords | null>(null)\n\n private showTimer: ReturnType<typeof setTimeout> | null = null\n private hideTimer: ReturnType<typeof setTimeout> | null = null\n\n protected onMouseEnter(): void {\n this.showTimer = setTimeout(() => {\n this.showTimer = null\n this.show()\n }, SHOW_DELAY_MS)\n }\n\n protected onFocusIn(): void {\n this.show()\n }\n\n private show(): void {\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n this.closing.set(false)\n this.updatePosition()\n this.visible.set(true)\n }\n\n constructor() {\n followPageScroll(() => this.updatePosition())\n }\n\n protected updatePosition(): void {\n const rect = this.elementRef.nativeElement.getBoundingClientRect()\n switch (this.position()) {\n case 'top':\n this.coords.set({ top: rect.top - GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'bottom':\n this.coords.set({ top: rect.bottom + GAP_PX, left: rect.left + rect.width / 2 })\n break\n case 'left':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.left - GAP_PX })\n break\n case 'right':\n this.coords.set({ top: rect.top + rect.height / 2, left: rect.right + GAP_PX })\n break\n }\n }\n\n protected hide(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (!this.visible() || this.closing()) return\n this.closing.set(true)\n this.hideTimer = setTimeout(() => {\n this.hideTimer = null\n this.closing.set(false)\n this.visible.set(false)\n }, FADE_MS)\n }\n\n ngOnDestroy(): void {\n if (this.showTimer !== null) {\n clearTimeout(this.showTimer)\n this.showTimer = null\n }\n if (this.hideTimer !== null) {\n clearTimeout(this.hideTimer)\n this.hideTimer = null\n }\n }\n}\n","<ng-content />\n@if (visible() && coords(); as pos) {\n <span\n class=\"gbt-tooltip__bubble\"\n [class.gbt-tooltip__bubble--leaving]=\"closing()\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.data-position]=\"position()\"\n [style.top.px]=\"pos.top\"\n [style.left.px]=\"pos.left\"\n >\n {{ text() }}\n </span>\n}\n"],"mappings":";;;AAkBA,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,SAAS;AAEf,IAAI,SAAS;AAoBb,IAAa,UAAb,MAAa,QAAO;CACD,aAAa,OAAO,UAAuB;CAE5D,OAAO,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,WAAW,MAAuB,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAE/B,YAAY,eAAe,EAAE;CAEnB,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,SAAS,OAA6B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAEtD,YAAkD;CAClD,YAAkD;CAEhD,eAAY;EACpB,KAAK,YAAY,iBA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"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.node.icon\" class=\"gbt-tree__icon\" aria-hidden=\"true\" />\n }\n <span class=\"gbt-tree__label\">{{ flat.node.label }}</span>\n </li>\n }\n</ul>\n",
170
- styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--site-border-radius-sm);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--color-info-bg);color:var(--color-info-bg-text);font-weight:600}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:var(--site-border-radius-xs);color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"],
170
+ styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--site-border-radius-sm);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--gbt-glass-thick);box-shadow:var(--gbt-glass-rim-light);color:var(--text-primary);font-weight:600}@media(prefers-contrast:more){.gbt-tree__item[aria-selected=true]{box-shadow:inset 0 0 0 1px var(--border-color)}}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:var(--site-border-radius-xs);color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"],
171
171
  dependencies: [{
172
172
  kind: "component",
173
173
  type: Icon,
@@ -190,7 +190,7 @@ i0.ɵɵngDeclareClassMetadata({
190
190
  imports: [Icon],
191
191
  changeDetection: ChangeDetectionStrategy.OnPush,
192
192
  template: "<ul\n class=\"gbt-tree\"\n role=\"tree\"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.node.icon\" class=\"gbt-tree__icon\" aria-hidden=\"true\" />\n }\n <span class=\"gbt-tree__label\">{{ flat.node.label }}</span>\n </li>\n }\n</ul>\n",
193
- styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--site-border-radius-sm);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--color-info-bg);color:var(--color-info-bg-text);font-weight:600}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:var(--site-border-radius-xs);color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"]
193
+ styles: [".gbt-tree{margin:0;padding:0;list-style:none}.gbt-tree__item{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;height:32px;padding-right:.5rem;border-radius:var(--site-border-radius-sm);color:var(--text-primary);font-size:13px;cursor:pointer}.gbt-tree__item:hover{background:var(--bg-hover)}.gbt-tree__item:active{background:var(--bg-press)}.gbt-tree__item:focus-visible{outline:2px solid var(--gbt-focus-ring, var(--focus-ring));outline-offset:-2px}.gbt-tree__item[aria-selected=true]{background:var(--gbt-glass-thick);box-shadow:var(--gbt-glass-rim-light);color:var(--text-primary);font-weight:600}@media(prefers-contrast:more){.gbt-tree__item[aria-selected=true]{box-shadow:inset 0 0 0 1px var(--border-color)}}.gbt-tree__toggle{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;height:20px;background:none;border:none;border-radius:var(--site-border-radius-xs);color:var(--text-secondary);cursor:pointer}.gbt-tree__toggle:hover{background:var(--bg-hover);color:var(--text-primary)}.gbt-tree__toggle:active{background:var(--bg-press);color:var(--text-primary)}.gbt-tree__spacer{flex-shrink:0;width:20px}.gbt-tree__chevron{transition:transform .15s cubic-bezier(.4,0,.2,1)}.gbt-tree__chevron--expanded{transform:rotate(90deg)}.gbt-tree__icon{flex-shrink:0;color:var(--text-secondary)}.gbt-tree__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.gbt-tree__chevron{transition:none}}\n"]
194
194
  }]
195
195
  }],
196
196
  propDecorators: {
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit-tree.mjs","names":[],"sources":["../../../projects/gabarit/tree/tree-flatten.ts","../../../projects/gabarit/tree/tree.ts","../../../projects/gabarit/tree/tree.html"],"sourcesContent":["export interface TreeNode {\n id: string\n label: string\n icon?: string\n children?: TreeNode[]\n}\n\nexport interface FlatTreeNode {\n node: TreeNode\n depth: number\n hasChildren: boolean\n parentId: string | null\n}\n\nexport function flattenTree(\n nodes: TreeNode[],\n expandedIds: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatTreeNode[] {\n const result: FlatTreeNode[] = []\n for (const node of nodes) {\n const hasChildren = !!node.children && node.children.length > 0\n result.push({ node, depth, hasChildren, parentId })\n if (hasChildren && expandedIds.has(node.id)) {\n result.push(...flattenTree(node.children!, expandedIds, depth + 1, node.id))\n }\n }\n return result\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n inject,\n input,\n model,\n signal,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { FlatTreeNode, TreeNode, flattenTree } from './tree-flatten'\n\n@Component({\n selector: 'gbt-tree',\n standalone: true,\n imports: [Icon],\n templateUrl: './tree.html',\n styleUrl: './tree.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tree {\n private readonly elementRef = inject(ElementRef)\n private readonly injector = inject(Injector)\n\n items = input.required<TreeNode[]>()\n ariaLabel = input<string>('')\n selectedId = model<string | null>(null)\n expandedIds = model<string[]>([])\n expandLabel = input<string>('Expand')\n collapseLabel = input<string>('Collapse')\n\n protected readonly focusedId = signal<string | null>(null)\n\n private readonly expandedSet = computed(() => new Set(this.expandedIds()))\n protected readonly flatNodes = computed(() => flattenTree(this.items(), this.expandedSet()))\n\n protected readonly activeId = computed(() => {\n const focused = this.focusedId()\n const flat = this.flatNodes()\n if (focused && flat.some((f) => f.node.id === focused)) {\n return focused\n }\n const selected = this.selectedId()\n if (selected && flat.some((f) => f.node.id === selected)) {\n return selected\n }\n return flat[0]?.node.id ?? null\n })\n\n protected isExpanded(id: string): boolean {\n return this.expandedSet().has(id)\n }\n\n protected toggle(id: string): void {\n const set = new Set(this.expandedIds())\n if (set.has(id)) {\n set.delete(id)\n } else {\n set.add(id)\n }\n this.expandedIds.set([...set])\n }\n\n protected select(node: TreeNode): void {\n this.selectedId.set(node.id)\n this.focusedId.set(node.id)\n }\n\n protected onItemClick(flat: FlatTreeNode): void {\n this.select(flat.node)\n if (flat.hasChildren) {\n this.toggle(flat.node.id)\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const flat = this.flatNodes()\n const index = flat.findIndex((f) => f.node.id === this.activeId())\n if (index === -1) {\n return\n }\n const current = flat[index]\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n this.focusIndex(Math.min(index + 1, flat.length - 1))\n break\n case 'ArrowUp':\n event.preventDefault()\n this.focusIndex(Math.max(index - 1, 0))\n break\n case 'ArrowRight':\n event.preventDefault()\n if (current.hasChildren && !this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.hasChildren) {\n this.focusIndex(index + 1)\n }\n break\n case 'ArrowLeft':\n event.preventDefault()\n if (current.hasChildren && this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.parentId) {\n const parentIndex = flat.findIndex((f) => f.node.id === current.parentId)\n if (parentIndex !== -1) {\n this.focusIndex(parentIndex)\n }\n }\n break\n case 'Home':\n event.preventDefault()\n this.focusIndex(0)\n break\n case 'End':\n event.preventDefault()\n this.focusIndex(flat.length - 1)\n break\n case 'Enter':\n case ' ':\n event.preventDefault()\n this.select(current.node)\n break\n default:\n return\n }\n }\n\n private focusIndex(index: number): void {\n const target = this.flatNodes()[index]\n if (!target) {\n return\n }\n this.focusedId.set(target.node.id)\n afterNextRender(\n () => {\n const host = this.elementRef.nativeElement as HTMLElement\n host.querySelector<HTMLElement>(`[data-node-id=\"${cssEscape(target.node.id)}\"]`)?.focus()\n },\n { injector: this.injector },\n )\n }\n}\n\nfunction cssEscape(value: string): string {\n return typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(value) : value.replace(/\"/g, '\\\\\"')\n}\n","<ul\n class=\"gbt-tree\"\n role=\"tree\"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.node.icon\" class=\"gbt-tree__icon\" aria-hidden=\"true\" />\n }\n <span class=\"gbt-tree__label\">{{ flat.node.label }}</span>\n </li>\n }\n</ul>\n"],"mappings":";;;AAcA,SAAgB,YACd,OACA,aACA,QAAQ,GACR,WAA0B,MAAI;CAE9B,MAAM,SAAyB,CAAA;CAC/B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,cAAc,CAAC,CAAC,KAAK,YAAY,KAAK,SAAS,SAAS;EAC9D,OAAO,KAAK;GAAE;GAAM;GAAO;GAAa;EAAQ,CAAE;EAClD,IAAI,eAAe,YAAY,IAAI,KAAK,EAAE,GACxC,OAAO,KAAK,GAAG,YAAY,KAAK,UAAW,aAAa,QAAQ,GAAG,KAAK,EAAE,CAAC;CAE/E;CACA,OAAO;AACT;ACNA,IAAa,OAAb,MAAa,KAAI;CACE,aAAa,OAAO,UAAU;CAC9B,WAAW,OAAO,QAAQ;CAE3C,QAAQ,MAAM,SAAsB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACpC,YAAY,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAC7B,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,cAAc,MAAgB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACjC,cAAc,MAAc,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACrC,gBAAgB,MAAc,YAAW,GAAA,YAAA,C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AI,SACP,CAAC,IAAI;GAAC,iBAGE,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,k1CAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HjD,SAAS,UAAU,OAAa;CAC9B,OAAO,OAAO,QAAQ,eAAe,IAAI,SAAS,IAAI,OAAO,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAK;AACjG"}
1
+ {"version":3,"file":"masmarino-gabarit-tree.mjs","names":[],"sources":["../../../projects/gabarit/tree/tree-flatten.ts","../../../projects/gabarit/tree/tree.ts","../../../projects/gabarit/tree/tree.html"],"sourcesContent":["export interface TreeNode {\n id: string\n label: string\n icon?: string\n children?: TreeNode[]\n}\n\nexport interface FlatTreeNode {\n node: TreeNode\n depth: number\n hasChildren: boolean\n parentId: string | null\n}\n\nexport function flattenTree(\n nodes: TreeNode[],\n expandedIds: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatTreeNode[] {\n const result: FlatTreeNode[] = []\n for (const node of nodes) {\n const hasChildren = !!node.children && node.children.length > 0\n result.push({ node, depth, hasChildren, parentId })\n if (hasChildren && expandedIds.has(node.id)) {\n result.push(...flattenTree(node.children!, expandedIds, depth + 1, node.id))\n }\n }\n return result\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n inject,\n input,\n model,\n signal,\n} from '@angular/core'\nimport { Icon } from '@masmarino/gabarit/icon'\nimport { FlatTreeNode, TreeNode, flattenTree } from './tree-flatten'\n\n@Component({\n selector: 'gbt-tree',\n standalone: true,\n imports: [Icon],\n templateUrl: './tree.html',\n styleUrl: './tree.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Tree {\n private readonly elementRef = inject(ElementRef)\n private readonly injector = inject(Injector)\n\n items = input.required<TreeNode[]>()\n ariaLabel = input<string>('')\n selectedId = model<string | null>(null)\n expandedIds = model<string[]>([])\n expandLabel = input<string>('Expand')\n collapseLabel = input<string>('Collapse')\n\n protected readonly focusedId = signal<string | null>(null)\n\n private readonly expandedSet = computed(() => new Set(this.expandedIds()))\n protected readonly flatNodes = computed(() => flattenTree(this.items(), this.expandedSet()))\n\n protected readonly activeId = computed(() => {\n const focused = this.focusedId()\n const flat = this.flatNodes()\n if (focused && flat.some((f) => f.node.id === focused)) {\n return focused\n }\n const selected = this.selectedId()\n if (selected && flat.some((f) => f.node.id === selected)) {\n return selected\n }\n return flat[0]?.node.id ?? null\n })\n\n protected isExpanded(id: string): boolean {\n return this.expandedSet().has(id)\n }\n\n protected toggle(id: string): void {\n const set = new Set(this.expandedIds())\n if (set.has(id)) {\n set.delete(id)\n } else {\n set.add(id)\n }\n this.expandedIds.set([...set])\n }\n\n protected select(node: TreeNode): void {\n this.selectedId.set(node.id)\n this.focusedId.set(node.id)\n }\n\n protected onItemClick(flat: FlatTreeNode): void {\n this.select(flat.node)\n if (flat.hasChildren) {\n this.toggle(flat.node.id)\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const flat = this.flatNodes()\n const index = flat.findIndex((f) => f.node.id === this.activeId())\n if (index === -1) {\n return\n }\n const current = flat[index]\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n this.focusIndex(Math.min(index + 1, flat.length - 1))\n break\n case 'ArrowUp':\n event.preventDefault()\n this.focusIndex(Math.max(index - 1, 0))\n break\n case 'ArrowRight':\n event.preventDefault()\n if (current.hasChildren && !this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.hasChildren) {\n this.focusIndex(index + 1)\n }\n break\n case 'ArrowLeft':\n event.preventDefault()\n if (current.hasChildren && this.isExpanded(current.node.id)) {\n this.toggle(current.node.id)\n } else if (current.parentId) {\n const parentIndex = flat.findIndex((f) => f.node.id === current.parentId)\n if (parentIndex !== -1) {\n this.focusIndex(parentIndex)\n }\n }\n break\n case 'Home':\n event.preventDefault()\n this.focusIndex(0)\n break\n case 'End':\n event.preventDefault()\n this.focusIndex(flat.length - 1)\n break\n case 'Enter':\n case ' ':\n event.preventDefault()\n this.select(current.node)\n break\n default:\n return\n }\n }\n\n private focusIndex(index: number): void {\n const target = this.flatNodes()[index]\n if (!target) {\n return\n }\n this.focusedId.set(target.node.id)\n afterNextRender(\n () => {\n const host = this.elementRef.nativeElement as HTMLElement\n host.querySelector<HTMLElement>(`[data-node-id=\"${cssEscape(target.node.id)}\"]`)?.focus()\n },\n { injector: this.injector },\n )\n }\n}\n\nfunction cssEscape(value: string): string {\n return typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(value) : value.replace(/\"/g, '\\\\\"')\n}\n","<ul\n class=\"gbt-tree\"\n role=\"tree\"\n tabindex=\"-1\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (flat of flatNodes(); track flat.node.id) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"gbt-tree__item\"\n role=\"treeitem\"\n [attr.data-node-id]=\"flat.node.id\"\n [attr.aria-level]=\"flat.depth + 1\"\n [attr.aria-expanded]=\"flat.hasChildren ? isExpanded(flat.node.id) : null\"\n [attr.aria-selected]=\"selectedId() === flat.node.id\"\n [style.paddingLeft.px]=\"flat.depth * 20\"\n [attr.tabindex]=\"activeId() === flat.node.id ? 0 : -1\"\n (click)=\"onItemClick(flat)\"\n >\n @if (flat.hasChildren) {\n <button\n type=\"button\"\n class=\"gbt-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"isExpanded(flat.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"toggle(flat.node.id); $event.stopPropagation()\"\n >\n <gbt-icon\n name=\"chevron-right\"\n class=\"gbt-tree__chevron\"\n [class.gbt-tree__chevron--expanded]=\"isExpanded(flat.node.id)\"\n aria-hidden=\"true\"\n />\n </button>\n } @else {\n <span class=\"gbt-tree__spacer\"></span>\n }\n @if (flat.node.icon) {\n <gbt-icon [name]=\"flat.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Aa;CAC9B,OAAO,OAAO,QAAQ,eAAe,IAAI,SAAS,IAAI,OAAO,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAK;AACjG"}
@@ -80,7 +80,7 @@ import { AuthResetPassword } from "@masmarino/gabarit/auth-reset-password";
80
80
  import { MfaSettings } from "@masmarino/gabarit/mfa-settings";
81
81
  import { PasskeySettings } from "@masmarino/gabarit/passkey-settings";
82
82
  import { GitField } from "@masmarino/gabarit/git-field";
83
- const GABARIT_VERSION = "3.1.0";
83
+ const GABARIT_VERSION = "4.0.0";
84
84
  export { ACTIVATION_TOKEN_SHAPE, AUTH_LABELS, AUTH_PORT, AUTH_PORT_ERROR_BODIES, Accordion, AccordionItem, Alert, AppShell, AppShellNavGroup, AuthActivate, AuthFooter, AuthFooterLink, AuthLogin, AuthPanel, AuthRegister, AuthResetPassword, Autocomplete, Avatar, AvatarGroup, BackupCodes, Badge, BarChart, BarSeries, Breadcrumb, Button, CHART_CONTEXT, COPY_FIELD_WRAP_AT, Card, CardHeader, CardLink, ChartAxis, ChartEmpty, ChartFrame, ChartLegend, ChartTable, ChartTooltip, Checkbox, CheckboxGroup, ClipboardFeedback, CommandPalette, CommandPaletteTrigger, ConfirmDangerModal, CopyButton, CopyField, DEFAULT_ACTIVATE_LABELS, DEFAULT_BACKUP_CODES_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_MFA_ENROLLMENT_LABELS, DEFAULT_MFA_SETTINGS_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_REGISTER_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEFAULT_TOTP_QR_LABELS, DatePicker, DateRangePicker, DescriptionList, DimensionCard, Disclosure, Divider, Drawer, EmptyState, FileUpload, FunnelChart, GABARIT_VERSION, GaugeBar, GbtBytesPipe, GbtDateTimePipe, GbtInput, GbtRelativeTimePipe, GbtToastService, GitField, Icon, IconMarker, IconRegistry, JobGraph, JobStatus, LineChart, LineSeries, ListCard, ListRow, ListToolbar, MFA_PORT, MIN_PASSWORD_LENGTH, Menu, MenuItem, MenuTrigger, MfaEnrollment, MfaSettings, MfaSettingsState, Modal, NavTab, NavTabs, NotificationDot, PASSKEY_NAME_MAX, PageHeader, PageLayout, Pagination, Panel, PasskeySettings, PieChart, Popover, RadioGroup, SaveStatus, SearchBar, SecretReveal, SegmentedControl, Select, Skeleton, SkeletonList, Slider, Sparkline, Spinner, StatGrid, StatTile, StatTileLink, Stepper, Switch, TOTP_QR_RENDERER, Tab, Table, Tabs, Tag, TagInput, Textarea, TimelineChart, TimelineSeries, Toaster, Tooltip, TotpQr, Tree, USERNAME_PATTERN, UserChip, accountName, activationToken, arcPath, areaPath, bandScale, base64UrlToBuffer, bufferToBase64Url, classifyActivateFailure, classifyMfaFailure, classifyPasskeyError, classifyPasswordFailure, classifyRegisterFailure, computeInitials, copyToClipboard, createListToolbarState, createPasskeyCredential, emailProblem, formatBytes, formatCompact, formatDateTime, formatDuration, formatNumber, formatPercent, formatRelativeTime, getPasskeyAssertion, isAuthPortError, isTooManyPasskeys, linePath, linearScale, matchCommand, nearestIndex, niceTicks, niceXDomain, niceYDomain, passkeyNameProblem, passkeysSupported, passwordProblem, portErrorMessage, provideAuthLabels, selectContents, shortcutLabel, timeScale, timeTicks, usernameProblem };
85
85
 
86
86
  //# sourceMappingURL=masmarino-gabarit.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"masmarino-gabarit.mjs","names":[],"sources":["../../../projects/gabarit/src/lib/version.ts"],"sourcesContent":["export const GABARIT_VERSION = '3.1.0'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,kBAAkB"}
1
+ {"version":3,"file":"masmarino-gabarit.mjs","names":[],"sources":["../../../projects/gabarit/src/lib/version.ts"],"sourcesContent":["export const GABARIT_VERSION = '4.0.0'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,kBAAkB"}
@@ -1,6 +1,6 @@
1
1
  # GitField
2
2
 
3
- The family's animated commit graph, drawn on the graphite frame: lanes that drift slowly
3
+ The family's animated commit graph, drawn on the page's ground: lanes that drift slowly
4
4
  sideways, commits that blink in turn, pushes running along some lanes, over two soft fields of
5
5
  colour (the rust accent and the indigo). It sits behind the sign-in panel or a dark band.
6
6
 
@@ -28,7 +28,7 @@ lift the content above it.
28
28
  events.
29
29
  - The drawing comes from a seeded generator, so it is the same on the server and in the browser.
30
30
  - Two identical tiles scroll by one width and start again, so the loop has no seam.
31
- - It reads the frame's colours (`frame-tokens`) in both themes, since it is drawn on the graphite.
31
+ - It reads the page's colours, since it is drawn on the ground.
32
32
  - The graph fades out towards the middle, where a centred panel sits, and stands further back
33
33
  (half opacity) below 48rem, where the panel takes the whole width.
34
34
  - Still under `prefers-reduced-motion: reduce`: the graph stays drawn, nothing moves.
@@ -7,8 +7,8 @@ right. Every column lines up on the title's first line.
7
7
 
8
8
  The page provides the list semantics and the surface around it
9
9
  (`ul > li > gbt-list-row`, inside a [`gbt-list-card`](../list-card/README.md)
10
- or any bordered box). The row adds hairlines between consecutive rows, a
11
- hover / focus-within background and title truncation.
10
+ or any glass). The row adds a rounded hover / focus-within background
11
+ (`--gbt-radius-row`) and title truncation; no line between the rows.
12
12
 
13
13
  **Selector**: `gbt-list-row`
14
14
 
@@ -42,9 +42,7 @@ hover / focus-within background and title truncation.
42
42
 
43
43
  ## Separators
44
44
 
45
- `li + li > gbt-list-row` and `gbt-list-row + gbt-list-row` get a `--gbt-hairline` border on top. Emulated
46
- view encapsulation cannot express "a row after a row" from inside the component, so this is one rule
47
- that is not scoped to the component, keyed on the element name.
45
+ None: light is the edge of things, a row is set apart by its own space and lit under the pointer.
48
46
 
49
47
  ## Example
50
48
 
package/modal/README.md CHANGED
@@ -22,7 +22,7 @@ backdrop, and stays shut while a request is running (`busy`).
22
22
  | Slot | Role |
23
23
  | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
24
  | default | The body. |
25
- | `[modal-footer]` | Actions under a hairline, kept in view while a long body scrolls. Nothing to import: add the attribute `modal-footer` to the element. A `div`, `footer` or `section` carrying it is the actions row itself (right aligned, wrapping, spaced); any other element (a button, a link) is one item of that row. Nothing projected, no footer. |
25
+ | `[modal-footer]` | Actions in the dialog's thick glass (no line above them), kept in view while a long body scrolls. Nothing to import: add the attribute `modal-footer` to the element. A `div`, `footer` or `section` carrying it is the actions row itself (right aligned, wrapping, spaced); any other element (a button, a link) is one item of that row. Nothing projected, no footer. |
26
26
 
27
27
  ## Outputs
28
28
 
@@ -36,10 +36,11 @@ The label is the projected content.
36
36
 
37
37
  ## Behaviour
38
38
 
39
- - **Horizontal** is a row of underline tabs with a hairline under it. When the tabs overflow, the row scrolls to
39
+ - **Horizontal** is a row of underline tabs, with no line under the row. When the tabs overflow, the row scrolls to
40
40
  the active one (keeping a glimpse of the previous tab) — the list scrolls, never the page — and fades at the edge
41
41
  that hides tabs. A tab keeps the width of its bold state, so nothing shifts when the active tab changes.
42
- - **Vertical** is a list of pills, the active one with an accent bar on its leading edge (not the tint alone). While
42
+ - **Vertical** is a list of pills, the active one in liquid glass, in bold (not a tint alone), as the current page in
43
+ the shell's rail. While
43
44
  a [`gbt-page-layout`](../page-layout/README.md) stacks its columns (its container is ≤ 768 px wide),
44
45
  a vertical nav folds into that same row of tabs above the section, instead of pushing it far down. Outside a page
45
46
  layout it stays a list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masmarino/gabarit",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "Angular design system — UI components and dataviz for self-hosted applications.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Masmarino/Gabarit",
@@ -47,8 +47,8 @@ An issue page, with a number after the title:
47
47
 
48
48
  ## Layout
49
49
 
50
- The host is a block with a `1.5rem` bottom margin; the header has a hairline
51
- (`--gbt-hairline`) under it. Give the header the same width as the content
50
+ The host is a block with a `1.5rem` bottom margin. The header sits on the
51
+ ground with no line under it, its title in Plex Condensed at 30px. Give the header the same width as the content
52
52
  below it: put both under the same `gbt-page-layout` or the same max-width.
53
53
 
54
54
  ## Accessibility
@@ -35,7 +35,7 @@ The layout adds no `<main>`: the application shell already has one.
35
35
 
36
36
  | Layout width | Columns |
37
37
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
38
- | up to 768 px | One column: nav, main, aside stacked in DOM order. The stacked aside opens with a hairline. |
38
+ | up to 768 px | One column: nav, main, aside stacked in DOM order. The stacked aside follows, set apart by space. |
39
39
  | 769 to 1100 px | Main + aside, or nav + main (with an aside under main). Aside on the `asidePosition` side when there is no nav. |
40
40
  | from 1101 px | Nav + main + aside side by side. The aside sticks (`top: 1rem`) while the main column scrolls, and so does the nav with `stickyNav`. |
41
41
 
package/panel/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A flat side-panel section: a small heading, an optional action on its
4
4
  right, then the content. It sits on the page background (no card, no
5
- shadow); consecutive panels are separated by a hairline. Made for the
5
+ shadow); consecutive panels are set apart by space, no line. Made for the
6
6
  `[page-aside]` of [`gbt-page-layout`](../page-layout/README.md)
7
7
  (about, metadata, participants, filters…).
8
8
 
@@ -24,8 +24,7 @@ shadow); consecutive panels are separated by a hairline. Made for the
24
24
 
25
25
  ## Separator between panels
26
26
 
27
- A panel that directly follows another gets `margin-top: 1rem`, `padding-top: 1rem` and a
28
- `--gbt-hairline` border on top. Emulated view encapsulation cannot express "a panel after a panel"
27
+ A panel that directly follows another gets `margin-top: 1.5rem`, no line. Emulated view encapsulation cannot express "a panel after a panel"
29
28
  from inside the component, so this is one rule that is not scoped to the component
30
29
  (`gbt-panel + gbt-panel`), keyed on the element name. Put other content between two panels and the
31
30
  separator is gone: it is the panels' business, not a general divider.
@@ -4,7 +4,7 @@ The placeholder of a list while it loads: `rows` rows of an optional leading blo
4
4
  avatar) and one to three text lines, at the rhythm of a real list row.
5
5
 
6
6
  **Selector**: `gbt-skeleton-list`. Built on [`gbt-skeleton`](../skeleton/README.md). `gbt-list-card`
7
- draws its own loading state; use this one in a settings section, a panel, a table body or any bordered box.
7
+ draws its own loading state; use this one in a settings section, a panel, a table body or any glass.
8
8
 
9
9
  ## Inputs
10
10
 
@@ -15,7 +15,6 @@ draws its own loading state; use this one in a settings section, a panel, a tabl
15
15
  | `leadingSize` | `string` | `'1rem'` | Its size (`1rem` a status dot, `2.25rem` an avatar). |
16
16
  | `lines` | `1 \| 2 \| 3` | `2` | Text lines per row. The first is the longest; its width varies from row to row. |
17
17
  | `loadingLabel` | `string` | `'Loading…'` | Read out (visually hidden, polite) while loading. |
18
- | `divided` | `boolean` | `true` | A hairline between rows. |
19
18
  | `padded` | `boolean` | `true` | 1 rem of side padding (a row inside a card). Turn it off in a bare list. |
20
19
 
21
20
  ## Behaviour and accessibility
@@ -1,3 +1,5 @@
1
+ @use 'glass';
2
+
1
3
  // The document's own elements, for an application that wants them in the family's type: include once,
2
4
  // at the root of its global styles (`@include tokens.document-base;`).
3
5
  @mixin document-base {
@@ -5,12 +7,9 @@
5
7
  margin: 0;
6
8
  font-family: var(--font-family);
7
9
  font-feature-settings: 'kern', 'liga';
8
- background: var(--bg-panel);
9
- // One light, from above: the page is lit at its top.
10
- background-image: var(--gbt-page-ground);
11
- background-repeat: no-repeat;
12
- background-size: 100% 40vh;
13
- color: var(--text-primary);
10
+ // The ground (4.0): one under the whole window, its light from above; the panels are glass laid on it.
11
+ @include glass.ground;
12
+ min-height: 100vh;
14
13
  -webkit-font-smoothing: antialiased;
15
14
  }
16
15
 
@@ -1,6 +1,6 @@
1
1
  // Gabarit's depth, a little of it, as on the apps: one light from above. What can be pressed has some volume, rises towards
2
2
  // the pointer and sinks when held; what holds a value is slightly hollow. The recipes are tokens (`_themes.scss`), so
3
- // they follow the frame's and the themes' colours.
3
+ // they follow the themes' colours.
4
4
 
5
5
  // The sink is a movement: none when the system asks for less of it, the shade stays.
6
6
  @mixin sink {
@@ -0,0 +1,87 @@
1
+ // The ground and the two glasses (4.0), as the components' recipes: one ground under the whole window, the content
2
+ // glass for the panels, the liquid glass for what commands and floats. Light is the edge of things: a rim at the top
3
+ // and a soft shadow stand where a hairline used to; the line stays on the controls (a field's 3:1 edge, the focus
4
+ // ring) and on the tables.
5
+ //
6
+ // The colours are tokens (`_themes.scss`, generated): these mixins only compose them.
7
+
8
+ // On the ground, and on the glass laid on it: the text keeps 7:1 and an edge 3:1 at the ground's worst point
9
+ // (contrast.spec.ts). The discreet text takes a deeper shade, the status texts the one they have on their tint.
10
+ @mixin on-ground {
11
+ --text-discret: var(--gbt-ground-text-discret);
12
+ --border-color: var(--gbt-ground-border);
13
+ --color-success-text: var(--color-success-bg-text);
14
+ --color-warning-text: var(--color-warning-bg-text);
15
+ --color-error-text: var(--color-error-bg-text);
16
+ }
17
+
18
+ // On the liquid glass, clearer than the ground it lets through: the secondary text is one more step up. What commands
19
+ // holds no status text (a status read over the page floats, in the thick fill: `floating-glass`).
20
+ @mixin on-liquid {
21
+ @include on-ground;
22
+ --text-secondary: var(--gbt-liquid-text);
23
+ --text-discret: var(--gbt-liquid-text);
24
+ }
25
+
26
+ // The ground: under a whole window (the body, the shell, a sign-in page). It holds still while the page scrolls.
27
+ @mixin ground {
28
+ background: var(--gbt-ground);
29
+ background-attachment: fixed;
30
+ color: var(--text-primary);
31
+ @include on-ground;
32
+ }
33
+
34
+ // Asked by the system: the glass is dense and opaque (no blur), or it has an edge again.
35
+ @mixin dense-when-asked {
36
+ @media (prefers-reduced-transparency: reduce) {
37
+ background:
38
+ linear-gradient(var(--gbt-glass-thick), var(--gbt-glass-thick)), var(--bg-principal);
39
+ -webkit-backdrop-filter: none;
40
+ backdrop-filter: none;
41
+ }
42
+ }
43
+
44
+ @mixin edged-when-asked($shadow) {
45
+ @media (prefers-contrast: more) {
46
+ box-shadow:
47
+ inset 0 0 0 1px var(--border-color),
48
+ $shadow;
49
+ }
50
+ }
51
+
52
+ // The content glass: a panel, a card, a sheet. `$density`: thin, regular or thick (a sheet, a drawer).
53
+ // `$shadow: false` for a glass laid in another glass (no second shadow under it).
54
+ @mixin glass($density: regular, $shadow: true) {
55
+ $depth: 0 0 transparent;
56
+ @if $shadow {
57
+ $depth: var(--gbt-depth-glass);
58
+ }
59
+ background: var(--gbt-glass-#{$density});
60
+ -webkit-backdrop-filter: var(--gbt-glass-blur);
61
+ backdrop-filter: var(--gbt-glass-blur);
62
+ box-shadow: var(--gbt-glass-rim-light), $depth;
63
+ @include on-ground;
64
+ @include dense-when-asked;
65
+ @include edged-when-asked($depth);
66
+ }
67
+
68
+ // The liquid glass: what commands (the current page in a rail, a search bar, a round button) and what floats (a
69
+ // menu, a popover, a tooltip, a toast). Never the content. `$fill: thick` for what floats over the page and holds
70
+ // text to be read (a menu, a list of options): it keeps the liquid's light and blur, with the dense fill.
71
+ @mixin liquid-glass($fill: liquid) {
72
+ background: var(--gbt-glass-#{$fill});
73
+ -webkit-backdrop-filter: var(--gbt-liquid-blur);
74
+ backdrop-filter: var(--gbt-liquid-blur);
75
+ box-shadow: var(--gbt-depth-liquid);
76
+ @include on-liquid;
77
+ @include dense-when-asked;
78
+ @include edged-when-asked(var(--gbt-depth-liquid));
79
+ }
80
+
81
+ // What floats over the page and is read: the liquid glass, dense, with the content glass's shadow under it so it
82
+ // rises above the panels.
83
+ @mixin floating-glass {
84
+ @include liquid-glass(thick);
85
+ box-shadow: var(--gbt-depth-liquid), var(--gbt-depth-glass);
86
+ @include edged-when-asked((var(--gbt-depth-liquid), var(--gbt-depth-glass)));
87
+ }