@erplora/outfitkit 0.1.1

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 (210) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +457 -0
  3. package/dist/base/anchor.d.ts +13 -0
  4. package/dist/base/define.d.ts +1 -0
  5. package/dist/base/relay.d.ts +1 -0
  6. package/dist/cdn.d.ts +96 -0
  7. package/dist/components/ok-app-launcher/ok-app-launcher.d.ts +57 -0
  8. package/dist/components/ok-audio/ok-audio.d.ts +45 -0
  9. package/dist/components/ok-avatar/ok-avatar.d.ts +36 -0
  10. package/dist/components/ok-avatar-group/ok-avatar-group.d.ts +38 -0
  11. package/dist/components/ok-bar-list/ok-bar-list.d.ts +36 -0
  12. package/dist/components/ok-bento/ok-bento.d.ts +17 -0
  13. package/dist/components/ok-bento-item/ok-bento-item.d.ts +34 -0
  14. package/dist/components/ok-calculator/ok-calculator.d.ts +46 -0
  15. package/dist/components/ok-calendar/ok-calendar.d.ts +63 -0
  16. package/dist/components/ok-carousel/ok-carousel.d.ts +48 -0
  17. package/dist/components/ok-chart/ok-chart.d.ts +55 -0
  18. package/dist/components/ok-chat/ok-chat.d.ts +54 -0
  19. package/dist/components/ok-coachmark/ok-coachmark.d.ts +69 -0
  20. package/dist/components/ok-code/ok-code.d.ts +28 -0
  21. package/dist/components/ok-color-picker/ok-color-picker.d.ts +63 -0
  22. package/dist/components/ok-combo/ok-combo.d.ts +46 -0
  23. package/dist/components/ok-command-palette/ok-command-palette.d.ts +72 -0
  24. package/dist/components/ok-contact-form/ok-contact-form.d.ts +54 -0
  25. package/dist/components/ok-cropper/ok-cropper.d.ts +60 -0
  26. package/dist/components/ok-cta-band/ok-cta-band.d.ts +18 -0
  27. package/dist/components/ok-currency/ok-currency.d.ts +31 -0
  28. package/dist/components/ok-data-table/ok-data-table.d.ts +312 -0
  29. package/dist/components/ok-date-picker/ok-date-picker.d.ts +81 -0
  30. package/dist/components/ok-detail-list/ok-detail-list.d.ts +30 -0
  31. package/dist/components/ok-diff/ok-diff.d.ts +38 -0
  32. package/dist/components/ok-donut/ok-donut.d.ts +38 -0
  33. package/dist/components/ok-drawer/ok-drawer.d.ts +56 -0
  34. package/dist/components/ok-dropzone/ok-dropzone.d.ts +48 -0
  35. package/dist/components/ok-empty-state/ok-empty-state.d.ts +16 -0
  36. package/dist/components/ok-error-page/ok-error-page.d.ts +77 -0
  37. package/dist/components/ok-event-card/ok-event-card.d.ts +56 -0
  38. package/dist/components/ok-feature-card/ok-feature-card.d.ts +23 -0
  39. package/dist/components/ok-file-item/ok-file-item.d.ts +31 -0
  40. package/dist/components/ok-file-manager/ok-file-manager.d.ts +145 -0
  41. package/dist/components/ok-footer/ok-footer.d.ts +10 -0
  42. package/dist/components/ok-funnel/ok-funnel.d.ts +31 -0
  43. package/dist/components/ok-gallery/ok-gallery.d.ts +34 -0
  44. package/dist/components/ok-gauge/ok-gauge.d.ts +49 -0
  45. package/dist/components/ok-heatmap/ok-heatmap.d.ts +45 -0
  46. package/dist/components/ok-hero/ok-hero.d.ts +10 -0
  47. package/dist/components/ok-hover-card/ok-hover-card.d.ts +76 -0
  48. package/dist/components/ok-icon-tile/ok-icon-tile.d.ts +24 -0
  49. package/dist/components/ok-image/ok-image.d.ts +56 -0
  50. package/dist/components/ok-inline-feedback/ok-inline-feedback.d.ts +33 -0
  51. package/dist/components/ok-invoice/ok-invoice.d.ts +137 -0
  52. package/dist/components/ok-json-viewer/ok-json-viewer.d.ts +31 -0
  53. package/dist/components/ok-kanban/ok-kanban.d.ts +56 -0
  54. package/dist/components/ok-kbd/ok-kbd.d.ts +21 -0
  55. package/dist/components/ok-keyboard/ok-keyboard.d.ts +35 -0
  56. package/dist/components/ok-kpi/ok-kpi.d.ts +24 -0
  57. package/dist/components/ok-language-select/ok-language-select.d.ts +31 -0
  58. package/dist/components/ok-lightbox/ok-lightbox.d.ts +59 -0
  59. package/dist/components/ok-logo-cloud/ok-logo-cloud.d.ts +14 -0
  60. package/dist/components/ok-loyalty-card/ok-loyalty-card.d.ts +35 -0
  61. package/dist/components/ok-mail/ok-mail.d.ts +117 -0
  62. package/dist/components/ok-menu/ok-menu.d.ts +75 -0
  63. package/dist/components/ok-menubar/ok-menubar.d.ts +75 -0
  64. package/dist/components/ok-navbar/ok-navbar.d.ts +42 -0
  65. package/dist/components/ok-notification-center/ok-notification-center.d.ts +79 -0
  66. package/dist/components/ok-org-chart/ok-org-chart.d.ts +67 -0
  67. package/dist/components/ok-otp/ok-otp.d.ts +31 -0
  68. package/dist/components/ok-page-header/ok-page-header.d.ts +23 -0
  69. package/dist/components/ok-pagination/ok-pagination.d.ts +44 -0
  70. package/dist/components/ok-pdf/ok-pdf.d.ts +32 -0
  71. package/dist/components/ok-phone/ok-phone.d.ts +48 -0
  72. package/dist/components/ok-pinpad/ok-pinpad.d.ts +29 -0
  73. package/dist/components/ok-pricing-card/ok-pricing-card.d.ts +31 -0
  74. package/dist/components/ok-product-card/ok-product-card.d.ts +25 -0
  75. package/dist/components/ok-qr/ok-qr.d.ts +24 -0
  76. package/dist/components/ok-qty-stepper/ok-qty-stepper.d.ts +35 -0
  77. package/dist/components/ok-range-dual/ok-range-dual.d.ts +38 -0
  78. package/dist/components/ok-rating/ok-rating.d.ts +33 -0
  79. package/dist/components/ok-receipt/ok-receipt.d.ts +103 -0
  80. package/dist/components/ok-reveal/ok-reveal.d.ts +21 -0
  81. package/dist/components/ok-rich-text/ok-rich-text.d.ts +46 -0
  82. package/dist/components/ok-scheduler/ok-scheduler.d.ts +74 -0
  83. package/dist/components/ok-select-card/ok-select-card.d.ts +37 -0
  84. package/dist/components/ok-signature/ok-signature.d.ts +55 -0
  85. package/dist/components/ok-skeleton/ok-skeleton.d.ts +40 -0
  86. package/dist/components/ok-sparkline/ok-sparkline.d.ts +27 -0
  87. package/dist/components/ok-split-button/ok-split-button.d.ts +49 -0
  88. package/dist/components/ok-splitter/ok-splitter.d.ts +36 -0
  89. package/dist/components/ok-stat/ok-stat.d.ts +16 -0
  90. package/dist/components/ok-status-dot/ok-status-dot.d.ts +24 -0
  91. package/dist/components/ok-status-pill/ok-status-pill.d.ts +22 -0
  92. package/dist/components/ok-stepper/ok-stepper.d.ts +33 -0
  93. package/dist/components/ok-store/ok-store.d.ts +33 -0
  94. package/dist/components/ok-tag-input/ok-tag-input.d.ts +39 -0
  95. package/dist/components/ok-testimonial/ok-testimonial.d.ts +21 -0
  96. package/dist/components/ok-time-picker/ok-time-picker.d.ts +50 -0
  97. package/dist/components/ok-timeline/ok-timeline.d.ts +33 -0
  98. package/dist/components/ok-tree/ok-tree.d.ts +46 -0
  99. package/dist/components/ok-video/ok-video.d.ts +49 -0
  100. package/dist/components/ok-widget-board/ok-widget-board.d.ts +71 -0
  101. package/dist/components/ok-wizard/ok-wizard.d.ts +30 -0
  102. package/dist/define.js +8 -0
  103. package/dist/erplora.css +112 -0
  104. package/dist/index.d.ts +158 -0
  105. package/dist/index.js +197 -0
  106. package/dist/layout.css +338 -0
  107. package/dist/ok-app-launcher.js +396 -0
  108. package/dist/ok-audio.js +308 -0
  109. package/dist/ok-avatar-group.js +158 -0
  110. package/dist/ok-avatar.js +179 -0
  111. package/dist/ok-bar-list.js +189 -0
  112. package/dist/ok-bento-item.js +168 -0
  113. package/dist/ok-bento.js +63 -0
  114. package/dist/ok-calculator.js +406 -0
  115. package/dist/ok-calendar.js +541 -0
  116. package/dist/ok-carousel.js +352 -0
  117. package/dist/ok-chart.js +325 -0
  118. package/dist/ok-chat.js +320 -0
  119. package/dist/ok-coachmark.js +500 -0
  120. package/dist/ok-code.js +190 -0
  121. package/dist/ok-color-picker.js +569 -0
  122. package/dist/ok-combo.js +294 -0
  123. package/dist/ok-command-palette.js +448 -0
  124. package/dist/ok-contact-form.js +288 -0
  125. package/dist/ok-cropper.js +404 -0
  126. package/dist/ok-cta-band.js +134 -0
  127. package/dist/ok-currency.js +172 -0
  128. package/dist/ok-data-table.js +1281 -0
  129. package/dist/ok-date-picker.js +736 -0
  130. package/dist/ok-detail-list.js +156 -0
  131. package/dist/ok-diff.js +200 -0
  132. package/dist/ok-donut.js +280 -0
  133. package/dist/ok-drawer.js +357 -0
  134. package/dist/ok-dropzone.js +376 -0
  135. package/dist/ok-empty-state.js +104 -0
  136. package/dist/ok-error-page.js +547 -0
  137. package/dist/ok-event-card.js +384 -0
  138. package/dist/ok-feature-card.js +152 -0
  139. package/dist/ok-file-item.js +259 -0
  140. package/dist/ok-file-manager.js +1116 -0
  141. package/dist/ok-footer.js +67 -0
  142. package/dist/ok-funnel.js +181 -0
  143. package/dist/ok-gallery.js +293 -0
  144. package/dist/ok-gauge.js +385 -0
  145. package/dist/ok-heatmap.js +268 -0
  146. package/dist/ok-hero.js +43 -0
  147. package/dist/ok-hover-card.js +480 -0
  148. package/dist/ok-icon-tile.js +123 -0
  149. package/dist/ok-image.js +471 -0
  150. package/dist/ok-inline-feedback.js +221 -0
  151. package/dist/ok-invoice.js +229 -0
  152. package/dist/ok-json-viewer.js +330 -0
  153. package/dist/ok-kanban.js +427 -0
  154. package/dist/ok-kbd.js +159 -0
  155. package/dist/ok-keyboard.js +402 -0
  156. package/dist/ok-kpi.js +147 -0
  157. package/dist/ok-language-select.js +188 -0
  158. package/dist/ok-lightbox.js +490 -0
  159. package/dist/ok-logo-cloud.js +92 -0
  160. package/dist/ok-loyalty-card.js +353 -0
  161. package/dist/ok-mail.js +562 -0
  162. package/dist/ok-menu.js +529 -0
  163. package/dist/ok-menubar.js +628 -0
  164. package/dist/ok-navbar.js +306 -0
  165. package/dist/ok-notification-center.js +545 -0
  166. package/dist/ok-org-chart.js +619 -0
  167. package/dist/ok-otp.js +199 -0
  168. package/dist/ok-page-header.js +202 -0
  169. package/dist/ok-pagination.js +366 -0
  170. package/dist/ok-pdf.js +160 -0
  171. package/dist/ok-phone.js +225 -0
  172. package/dist/ok-pinpad.js +171 -0
  173. package/dist/ok-pricing-card.js +184 -0
  174. package/dist/ok-product-card.js +178 -0
  175. package/dist/ok-qr.js +652 -0
  176. package/dist/ok-qty-stepper.js +212 -0
  177. package/dist/ok-range-dual.js +280 -0
  178. package/dist/ok-rating.js +199 -0
  179. package/dist/ok-receipt.js +183 -0
  180. package/dist/ok-reveal.js +94 -0
  181. package/dist/ok-rich-text.js +538 -0
  182. package/dist/ok-scheduler.js +518 -0
  183. package/dist/ok-select-card.js +231 -0
  184. package/dist/ok-signature.js +267 -0
  185. package/dist/ok-skeleton.js +345 -0
  186. package/dist/ok-sparkline.js +150 -0
  187. package/dist/ok-split-button.js +251 -0
  188. package/dist/ok-splitter.js +289 -0
  189. package/dist/ok-stat.js +77 -0
  190. package/dist/ok-status-dot.js +163 -0
  191. package/dist/ok-status-pill.js +123 -0
  192. package/dist/ok-stepper.js +299 -0
  193. package/dist/ok-store.js +83 -0
  194. package/dist/ok-tag-input.js +358 -0
  195. package/dist/ok-testimonial.js +136 -0
  196. package/dist/ok-time-picker.js +472 -0
  197. package/dist/ok-timeline.js +251 -0
  198. package/dist/ok-tree.js +266 -0
  199. package/dist/ok-video.js +362 -0
  200. package/dist/ok-widget-board.js +265 -0
  201. package/dist/ok-wizard.js +153 -0
  202. package/dist/outfitkit.js +96 -0
  203. package/dist/shared/anchor.js +14 -0
  204. package/dist/store/controller.d.ts +17 -0
  205. package/dist/store/idb.d.ts +16 -0
  206. package/dist/store/store.d.ts +39 -0
  207. package/dist/store-controller.js +31 -0
  208. package/dist/store.js +182 -0
  209. package/dist/theme.example.css +70 -0
  210. package/package.json +147 -0
@@ -0,0 +1,545 @@
1
+ import { LitElement, css, html, nothing } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { define } from "./define.js";
4
+ var __defProp = Object.defineProperty;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = void 0;
7
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8
+ if (decorator = decorators[i])
9
+ result = decorator(target, key, result) || result;
10
+ if (result) __defProp(target, key, result);
11
+ return result;
12
+ };
13
+ const DEFAULT_LABELS = {
14
+ markAllRead: "Mark all read",
15
+ close: "Close",
16
+ emptyTitle: "All caught up",
17
+ emptyText: "No notifications to show."
18
+ };
19
+ const BELL_SVG = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>';
20
+ class OkNotificationCenter extends LitElement {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.items = [];
24
+ this.filters = [];
25
+ this.open = false;
26
+ this.title = "Notifications";
27
+ this.labels = {};
28
+ this.onKeydown = (e) => {
29
+ if (e.key === "Escape" && this.open) this.requestClose("esc");
30
+ };
31
+ }
32
+ static {
33
+ this.styles = css`
34
+ :host {
35
+ /* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
36
+ --color: var(--ok-text, var(--ion-text-color, #1c1b17));
37
+ --color-muted: var(--ok-text-muted, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.62));
38
+ --color-faint: var(--ok-text-faint, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.45));
39
+ --panel-bg: var(--ok-surface, var(--ion-card-background, var(--ion-background-color, #ffffff)));
40
+ --head-bg: var(--ok-surface-2, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.025));
41
+ --hover-bg: var(--ok-hover, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.05));
42
+ --chip-active-bg: var(--ok-chip-active, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.09));
43
+ --border-soft: var(--ok-border-soft, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.1));
44
+ --scrim-bg: var(--ok-scrim, rgba(0, 0, 0, 0.4));
45
+ --shadow: var(--ok-shadow-md, 0 10px 40px rgba(0, 0, 0, 0.22));
46
+ --radius: var(--ok-radius, 12px);
47
+ --font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
48
+ --font-mono: var(--ok-font-mono, ui-monospace, 'SF Mono', 'Roboto Mono', monospace);
49
+ --brand: var(--ok-primary, var(--ion-color-primary, #3880ff));
50
+ --brand-contrast: var(--ok-primary-contrast, var(--ion-color-primary-contrast, #ffffff));
51
+ /* Tintes de estado de los avatares. */
52
+ --c-leaf: var(--ok-success, var(--ion-color-success, #2dd36f));
53
+ --c-warn: var(--ok-warning, var(--ion-color-warning, #ffc409));
54
+ --c-info: var(--ok-info, var(--ion-color-tertiary, #6a64ff));
55
+
56
+ /* El host no ocupa caja: scrim y panel van a position:fixed sobre todo. */
57
+ display: contents;
58
+ }
59
+
60
+ /* Scrim a pantalla completa. */
61
+ .scrim {
62
+ position: fixed;
63
+ inset: 0;
64
+ z-index: 2000;
65
+ background: var(--scrim-bg);
66
+ animation: fade-in 180ms ease;
67
+ }
68
+
69
+ /* Panel lateral derecho: columna header · filtros · lista (scroll) · footer. */
70
+ .panel {
71
+ position: fixed;
72
+ top: 0;
73
+ bottom: 0;
74
+ inset-inline-end: 0;
75
+ z-index: 2001;
76
+ width: var(--ok-notif-width, 380px);
77
+ max-width: 100vw;
78
+ display: flex;
79
+ flex-direction: column;
80
+ box-sizing: border-box;
81
+ background: var(--panel-bg);
82
+ color: var(--color);
83
+ font-family: var(--font);
84
+ box-shadow: var(--shadow);
85
+ border-inline-start: 1px solid var(--border-soft);
86
+ animation: slide-in 220ms cubic-bezier(0.32, 0.72, 0, 1);
87
+ }
88
+
89
+ @keyframes fade-in {
90
+ from { opacity: 0; }
91
+ to { opacity: 1; }
92
+ }
93
+ @keyframes slide-in {
94
+ from { transform: translateX(100%); }
95
+ to { transform: translateX(0); }
96
+ }
97
+ @media (prefers-reduced-motion: reduce) {
98
+ .scrim,
99
+ .panel {
100
+ animation: none;
101
+ }
102
+ }
103
+
104
+ /* Cabecera: título + badge de no-leídas + botón cerrar. */
105
+ .head {
106
+ flex: 0 0 auto;
107
+ display: flex;
108
+ align-items: center;
109
+ justify-content: space-between;
110
+ gap: 0.5rem;
111
+ padding: 0.85rem 1rem;
112
+ border-bottom: 1px solid var(--border-soft);
113
+ }
114
+ .title {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ margin: 0;
118
+ font-size: 0.95rem;
119
+ font-weight: 600;
120
+ color: var(--color);
121
+ }
122
+ .badge {
123
+ display: inline-flex;
124
+ align-items: center;
125
+ justify-content: center;
126
+ min-width: 18px;
127
+ height: 18px;
128
+ padding: 0 5px;
129
+ margin-inline-start: 8px;
130
+ border-radius: 999px;
131
+ background: var(--brand);
132
+ color: var(--brand-contrast);
133
+ font-family: var(--font-mono);
134
+ font-size: 0.625rem;
135
+ font-weight: 600;
136
+ line-height: 1;
137
+ }
138
+ .close-btn {
139
+ display: inline-flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ width: 34px;
143
+ height: 34px;
144
+ padding: 0;
145
+ border: 0;
146
+ background: none;
147
+ color: var(--color-muted);
148
+ cursor: pointer;
149
+ border-radius: 50%;
150
+ transition: background-color 150ms ease;
151
+ }
152
+ @media (hover: hover) {
153
+ .close-btn:hover {
154
+ background: var(--hover-bg);
155
+ }
156
+ }
157
+ .close-btn ion-icon {
158
+ font-size: 1.25rem;
159
+ }
160
+
161
+ /* Fila de chips de filtro. */
162
+ .filters {
163
+ flex: 0 0 auto;
164
+ display: flex;
165
+ flex-wrap: wrap;
166
+ gap: 4px;
167
+ padding: 0.5rem 0.65rem;
168
+ background: var(--head-bg);
169
+ border-bottom: 1px solid var(--border-soft);
170
+ }
171
+ .chip {
172
+ padding: 4px 10px;
173
+ border: 0;
174
+ background: transparent;
175
+ border-radius: 8px;
176
+ color: var(--color-muted);
177
+ font: inherit;
178
+ font-size: 0.72rem;
179
+ cursor: pointer;
180
+ transition: background-color 150ms ease, color 150ms ease;
181
+ }
182
+ @media (hover: hover) {
183
+ .chip:hover {
184
+ background: var(--hover-bg);
185
+ }
186
+ }
187
+ .chip[aria-pressed='true'] {
188
+ background: var(--chip-active-bg);
189
+ color: var(--color);
190
+ font-weight: 600;
191
+ }
192
+
193
+ /* Lista scrollable. */
194
+ .list {
195
+ flex: 1 1 auto;
196
+ min-height: 0;
197
+ overflow-y: auto;
198
+ display: flex;
199
+ flex-direction: column;
200
+ }
201
+
202
+ /* Fila de notificación: avatar · cuerpo · hora. */
203
+ .item {
204
+ position: relative;
205
+ display: grid;
206
+ grid-template-columns: 32px 1fr auto;
207
+ gap: 10px;
208
+ width: 100%;
209
+ box-sizing: border-box;
210
+ padding: 0.75rem 1rem;
211
+ border: 0;
212
+ border-bottom: 1px solid var(--border-soft);
213
+ background: none;
214
+ color: inherit;
215
+ font: inherit;
216
+ text-align: start;
217
+ cursor: pointer;
218
+ transition: background-color 150ms ease;
219
+ }
220
+ @media (hover: hover) {
221
+ .item:hover {
222
+ background: var(--hover-bg);
223
+ }
224
+ }
225
+ .item:last-child {
226
+ border-bottom: 0;
227
+ }
228
+ /* Punto de no-leída a la izquierda. */
229
+ .item.unread::before {
230
+ content: '';
231
+ position: absolute;
232
+ left: 5px;
233
+ top: 1.05rem;
234
+ width: 6px;
235
+ height: 6px;
236
+ border-radius: 50%;
237
+ background: var(--brand);
238
+ }
239
+
240
+ /* Avatar redondo status-tintado. */
241
+ .avatar {
242
+ display: inline-flex;
243
+ align-items: center;
244
+ justify-content: center;
245
+ width: 32px;
246
+ height: 32px;
247
+ border-radius: 50%;
248
+ background: var(--hover-bg);
249
+ color: var(--color-muted);
250
+ }
251
+ .avatar.leaf {
252
+ background: color-mix(in srgb, var(--c-leaf) 18%, transparent);
253
+ color: var(--c-leaf);
254
+ }
255
+ .avatar.warn {
256
+ background: color-mix(in srgb, var(--c-warn) 20%, transparent);
257
+ color: var(--c-warn);
258
+ }
259
+ .avatar.info {
260
+ background: color-mix(in srgb, var(--c-info) 18%, transparent);
261
+ color: var(--c-info);
262
+ }
263
+ .avatar.brand {
264
+ background: color-mix(in srgb, var(--brand) 18%, transparent);
265
+ color: var(--brand);
266
+ }
267
+ .avatar ion-icon {
268
+ font-size: 1rem;
269
+ }
270
+ .avatar svg {
271
+ display: block;
272
+ }
273
+
274
+ .body {
275
+ min-width: 0;
276
+ }
277
+ .text {
278
+ font-size: 0.8125rem;
279
+ line-height: 1.45;
280
+ color: var(--color);
281
+ overflow-wrap: anywhere;
282
+ }
283
+ .text b {
284
+ font-weight: 600;
285
+ }
286
+ .meta {
287
+ margin-top: 2px;
288
+ font-family: var(--font-mono);
289
+ font-size: 0.6875rem;
290
+ color: var(--color-faint);
291
+ overflow-wrap: anywhere;
292
+ }
293
+ .time {
294
+ font-family: var(--font-mono);
295
+ font-size: 0.6875rem;
296
+ color: var(--color-faint);
297
+ white-space: nowrap;
298
+ }
299
+
300
+ /* Estado vacío. */
301
+ .empty {
302
+ flex: 1 1 auto;
303
+ display: flex;
304
+ flex-direction: column;
305
+ align-items: center;
306
+ justify-content: center;
307
+ gap: 8px;
308
+ padding: 2rem 1.25rem;
309
+ text-align: center;
310
+ }
311
+ .empty .ic {
312
+ display: inline-flex;
313
+ align-items: center;
314
+ justify-content: center;
315
+ width: 52px;
316
+ height: 52px;
317
+ border-radius: 50%;
318
+ background: var(--hover-bg);
319
+ color: var(--color-faint);
320
+ margin-bottom: 4px;
321
+ }
322
+ .empty .ic ion-icon {
323
+ font-size: 1.5rem;
324
+ }
325
+ .empty .e-title {
326
+ font-size: 0.95rem;
327
+ font-weight: 600;
328
+ color: var(--color);
329
+ }
330
+ .empty .e-text {
331
+ font-size: 0.8125rem;
332
+ color: var(--color-faint);
333
+ max-width: 30ch;
334
+ line-height: 1.5;
335
+ }
336
+
337
+ /* Footer: marcar todas leídas. */
338
+ .foot {
339
+ flex: 0 0 auto;
340
+ padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
341
+ border-top: 1px solid var(--border-soft);
342
+ text-align: center;
343
+ }
344
+ .foot button {
345
+ border: 0;
346
+ background: none;
347
+ color: var(--brand);
348
+ font: inherit;
349
+ font-size: 0.8125rem;
350
+ font-weight: 600;
351
+ cursor: pointer;
352
+ padding: 4px 8px;
353
+ border-radius: 8px;
354
+ transition: background-color 150ms ease;
355
+ }
356
+ @media (hover: hover) {
357
+ .foot button:hover {
358
+ background: var(--hover-bg);
359
+ }
360
+ }
361
+ .foot button[disabled] {
362
+ color: var(--color-faint);
363
+ cursor: default;
364
+ }
365
+
366
+ /* Móvil: panel a pantalla completa. */
367
+ @media (max-width: 480px) {
368
+ .panel {
369
+ width: 100vw;
370
+ border-inline-start: 0;
371
+ }
372
+ }
373
+ `;
374
+ }
375
+ // Textos efectivos.
376
+ get t() {
377
+ return { ...DEFAULT_LABELS, ...this.labels };
378
+ }
379
+ // Contador derivado de no-leídas.
380
+ get unreadCount() {
381
+ return this.items.reduce((n, it) => n + (it.unread ? 1 : 0), 0);
382
+ }
383
+ connectedCallback() {
384
+ super.connectedCallback();
385
+ document.addEventListener("keydown", this.onKeydown);
386
+ }
387
+ disconnectedCallback() {
388
+ super.disconnectedCallback();
389
+ document.removeEventListener("keydown", this.onKeydown);
390
+ }
391
+ // Un icono es «SVG ya resuelto» si es un string `<svg…>` o un `data:` URI.
392
+ isResolvedSvg(icon) {
393
+ return /^\s*</.test(icon) || icon.startsWith("data:");
394
+ }
395
+ // Gesto de cierre: emite `ok-close` CANCELABLE; si nadie lo veta, cierra solo (fallback).
396
+ requestClose(reason) {
397
+ const ev = new CustomEvent("ok-close", {
398
+ detail: { reason },
399
+ bubbles: true,
400
+ composed: true,
401
+ cancelable: true
402
+ });
403
+ this.dispatchEvent(ev);
404
+ if (!ev.defaultPrevented) this.open = false;
405
+ }
406
+ onItemClick(it) {
407
+ if (!it.unread) return;
408
+ this.dispatchEvent(
409
+ new CustomEvent("ok-read", { detail: { id: it.id }, bubbles: true, composed: true })
410
+ );
411
+ }
412
+ onMarkAll() {
413
+ if (this.unreadCount === 0) return;
414
+ this.dispatchEvent(
415
+ new CustomEvent("ok-read-all", { detail: {}, bubbles: true, composed: true })
416
+ );
417
+ }
418
+ onFilter(f) {
419
+ this.dispatchEvent(
420
+ new CustomEvent("ok-filter", { detail: { id: f.id }, bubbles: true, composed: true })
421
+ );
422
+ }
423
+ // Emite ok-open al pasar a abierto (detecta el flanco en updated).
424
+ updated(changed) {
425
+ if (changed.has("open") && this.open) {
426
+ this.dispatchEvent(
427
+ new CustomEvent("ok-open", { detail: { open: true }, bubbles: true, composed: true })
428
+ );
429
+ }
430
+ }
431
+ renderAvatar(it) {
432
+ const icon = it.icon ?? BELL_SVG;
433
+ return html`<span class="avatar ${it.variant ?? ""}" aria-hidden="true">
434
+ ${this.isResolvedSvg(icon) ? (
435
+ // SVG resuelto: lo pinta ion-icon vía prop `icon`.
436
+ html`<ion-icon .icon=${icon}></ion-icon>`
437
+ ) : html`<ion-icon .name=${icon}></ion-icon>`}
438
+ </span>`;
439
+ }
440
+ // Pinta el texto principal interpretando SOLO <b>…</b> (sin HTML arbitrario, seguro para CSP).
441
+ renderText(text) {
442
+ const parts = [];
443
+ const re = /<b>(.*?)<\/b>/gis;
444
+ let last = 0;
445
+ let m;
446
+ while ((m = re.exec(text)) !== null) {
447
+ if (m.index > last) parts.push(text.slice(last, m.index));
448
+ parts.push(html`<b>${m[1]}</b>`);
449
+ last = m.index + m[0].length;
450
+ }
451
+ if (last < text.length) parts.push(text.slice(last));
452
+ return parts.length ? parts : text;
453
+ }
454
+ renderItem(it) {
455
+ return html`<button
456
+ type="button"
457
+ class="item ${it.unread ? "unread" : ""}"
458
+ @click=${() => this.onItemClick(it)}
459
+ >
460
+ ${this.renderAvatar(it)}
461
+ <span class="body">
462
+ <span class="text">${this.renderText(it.text)}</span>
463
+ ${it.meta ? html`<span class="meta">${it.meta}</span>` : nothing}
464
+ </span>
465
+ ${it.time ? html`<span class="time">${it.time}</span>` : nothing}
466
+ </button>`;
467
+ }
468
+ renderEmpty() {
469
+ return html`<div class="empty">
470
+ <span class="ic" aria-hidden="true"><ion-icon name="notifications-off-outline"></ion-icon></span>
471
+ <span class="e-title">${this.t.emptyTitle}</span>
472
+ <span class="e-text">${this.t.emptyText}</span>
473
+ </div>`;
474
+ }
475
+ render() {
476
+ if (!this.open) return nothing;
477
+ const count = this.unreadCount;
478
+ return html`
479
+ <div class="scrim" @click=${() => this.requestClose("scrim")}></div>
480
+ <aside
481
+ class="panel"
482
+ role="dialog"
483
+ aria-modal="true"
484
+ aria-label=${this.title}
485
+ >
486
+ <header class="head">
487
+ <h2 class="title">
488
+ ${this.title}${count > 0 ? html`<span class="badge" aria-label="${count} unread">${count}</span>` : nothing}
489
+ </h2>
490
+ <button
491
+ type="button"
492
+ class="close-btn"
493
+ aria-label=${this.t.close}
494
+ @click=${() => this.requestClose("button")}
495
+ >
496
+ <ion-icon name="close-outline"></ion-icon>
497
+ </button>
498
+ </header>
499
+
500
+ ${this.filters.length ? html`<div class="filters" role="group" aria-label="Filters">
501
+ ${this.filters.map(
502
+ (f) => html`<button
503
+ type="button"
504
+ class="chip"
505
+ aria-pressed=${this.active === f.id ? "true" : "false"}
506
+ @click=${() => this.onFilter(f)}
507
+ >
508
+ ${f.label}
509
+ </button>`
510
+ )}
511
+ </div>` : nothing}
512
+
513
+ ${this.items.length ? html`<div class="list" role="list">${this.items.map((it) => this.renderItem(it))}</div>` : this.renderEmpty()}
514
+
515
+ <footer class="foot">
516
+ <button type="button" ?disabled=${count === 0} @click=${() => this.onMarkAll()}>
517
+ ${this.t.markAllRead}
518
+ </button>
519
+ </footer>
520
+ </aside>
521
+ `;
522
+ }
523
+ }
524
+ __decorateClass([
525
+ property({ attribute: false })
526
+ ], OkNotificationCenter.prototype, "items");
527
+ __decorateClass([
528
+ property({ attribute: false })
529
+ ], OkNotificationCenter.prototype, "filters");
530
+ __decorateClass([
531
+ property({ reflect: true })
532
+ ], OkNotificationCenter.prototype, "active");
533
+ __decorateClass([
534
+ property({ type: Boolean, reflect: true })
535
+ ], OkNotificationCenter.prototype, "open");
536
+ __decorateClass([
537
+ property()
538
+ ], OkNotificationCenter.prototype, "title");
539
+ __decorateClass([
540
+ property({ attribute: false })
541
+ ], OkNotificationCenter.prototype, "labels");
542
+ define("ok-notification-center", OkNotificationCenter);
543
+ export {
544
+ OkNotificationCenter
545
+ };