@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,362 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { property, state, query } 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
+ play: "Play",
15
+ pause: "Pause",
16
+ mute: "Mute",
17
+ unmute: "Unmute",
18
+ volume: "Volume",
19
+ fullscreen: "Fullscreen"
20
+ };
21
+ class OkVideo extends LitElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.src = "";
25
+ this.poster = "";
26
+ this.labels = {};
27
+ this.playing = false;
28
+ this.current = 0;
29
+ this.duration = 0;
30
+ this.volume = 1;
31
+ this.muted = false;
32
+ }
33
+ static {
34
+ this.styles = css`
35
+ :host {
36
+ /* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
37
+ --color: var(--ok-text, var(--ion-text-color, #1c1b17));
38
+ --primary-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
39
+ --track-bg: rgba(255, 255, 255, 0.3);
40
+ --bar-bg: var(--ok-video-bar, rgba(0, 0, 0, 0.55));
41
+ --border-radius: var(--ok-radius, 10px);
42
+ --aspect: var(--ok-video-aspect, 16 / 9);
43
+ --font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
44
+
45
+ /* Responsive: bloque al ancho del contenedor. */
46
+ display: block;
47
+ width: 100%;
48
+ color: var(--color);
49
+ font-family: var(--font);
50
+ }
51
+ .stage {
52
+ position: relative;
53
+ width: 100%;
54
+ aspect-ratio: var(--aspect);
55
+ background: #000;
56
+ border-radius: var(--border-radius);
57
+ overflow: hidden;
58
+ }
59
+ video {
60
+ display: block;
61
+ width: 100%;
62
+ height: 100%;
63
+ object-fit: contain;
64
+ background: #000;
65
+ }
66
+ /* Botón grande de play/pausa centrado sobre el vídeo. */
67
+ .overlay {
68
+ position: absolute;
69
+ inset: 0;
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ background: transparent;
74
+ border: 0;
75
+ color: #fff;
76
+ cursor: pointer;
77
+ }
78
+ .overlay .big {
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ width: 64px;
83
+ height: 64px;
84
+ border-radius: 50%;
85
+ background: rgba(0, 0, 0, 0.45);
86
+ transition: opacity 0.18s ease, transform 0.18s ease;
87
+ }
88
+ .overlay .big ion-icon {
89
+ font-size: 2rem;
90
+ }
91
+ /* Mientras reproduce, el overlay se atenúa salvo al pasar el ratón. */
92
+ .overlay.playing .big {
93
+ opacity: 0;
94
+ }
95
+ .stage:hover .overlay.playing .big {
96
+ opacity: 1;
97
+ }
98
+ /* Barra de controles inferior. */
99
+ .bar {
100
+ position: absolute;
101
+ left: 0;
102
+ right: 0;
103
+ bottom: 0;
104
+ display: flex;
105
+ align-items: center;
106
+ gap: 0.5rem;
107
+ padding: 0.4rem 0.6rem;
108
+ background: linear-gradient(transparent, var(--bar-bg));
109
+ color: #fff;
110
+ }
111
+ ion-button {
112
+ --color: #fff;
113
+ --padding-start: 0;
114
+ --padding-end: 0;
115
+ margin: 0;
116
+ flex: 0 0 auto;
117
+ }
118
+ .progress {
119
+ position: relative;
120
+ flex: 1 1 auto;
121
+ min-width: 0;
122
+ height: 6px;
123
+ border-radius: 999px;
124
+ background: var(--track-bg);
125
+ cursor: pointer;
126
+ }
127
+ .progress .fill {
128
+ position: absolute;
129
+ inset: 0 auto 0 0;
130
+ height: 100%;
131
+ border-radius: inherit;
132
+ background: var(--primary-color);
133
+ width: 0%;
134
+ }
135
+ .progress .knob {
136
+ position: absolute;
137
+ top: 50%;
138
+ width: 12px;
139
+ height: 12px;
140
+ border-radius: 50%;
141
+ background: var(--primary-color);
142
+ transform: translate(-50%, -50%);
143
+ left: 0%;
144
+ }
145
+ .time {
146
+ flex: 0 0 auto;
147
+ font-size: 0.75rem;
148
+ font-variant-numeric: tabular-nums;
149
+ white-space: nowrap;
150
+ }
151
+ .volume input[type='range'] {
152
+ width: 64px;
153
+ accent-color: var(--primary-color);
154
+ cursor: pointer;
155
+ vertical-align: middle;
156
+ }
157
+ /* En estrecho, se ocultan el slider de volumen y el reloj para no saturar. */
158
+ @media (max-width: 420px) {
159
+ .volume input[type='range'] {
160
+ display: none;
161
+ }
162
+ .time {
163
+ display: none;
164
+ }
165
+ }
166
+ `;
167
+ }
168
+ get t() {
169
+ return { ...DEFAULT_LABELS, ...this.labels };
170
+ }
171
+ // Alterna play/pausa sobre el elemento nativo.
172
+ togglePlay() {
173
+ if (!this.videoEl) return;
174
+ if (this.videoEl.paused) this.videoEl.play();
175
+ else this.videoEl.pause();
176
+ }
177
+ onPlay() {
178
+ this.playing = true;
179
+ this.dispatchEvent(
180
+ new CustomEvent("ok-play", {
181
+ detail: { currentTime: this.videoEl?.currentTime ?? 0 },
182
+ bubbles: true,
183
+ composed: true
184
+ })
185
+ );
186
+ }
187
+ onPause() {
188
+ this.playing = false;
189
+ this.dispatchEvent(
190
+ new CustomEvent("ok-pause", {
191
+ detail: { currentTime: this.videoEl?.currentTime ?? 0 },
192
+ bubbles: true,
193
+ composed: true
194
+ })
195
+ );
196
+ }
197
+ onEnded() {
198
+ this.playing = false;
199
+ this.dispatchEvent(
200
+ new CustomEvent("ok-ended", {
201
+ detail: { duration: this.duration },
202
+ bubbles: true,
203
+ composed: true
204
+ })
205
+ );
206
+ }
207
+ onTimeUpdate() {
208
+ this.current = this.videoEl?.currentTime ?? 0;
209
+ }
210
+ onLoadedMeta() {
211
+ this.duration = this.videoEl?.duration ?? 0;
212
+ }
213
+ // Seek: traduce la posición del click dentro de la barra a un tiempo del vídeo.
214
+ seek(e) {
215
+ e.stopPropagation();
216
+ const bar = e.currentTarget;
217
+ const rect = bar.getBoundingClientRect();
218
+ const ratio = rect.width > 0 ? (e.clientX - rect.left) / rect.width : 0;
219
+ const clamped = Math.min(1, Math.max(0, ratio));
220
+ if (this.videoEl && this.duration) {
221
+ this.videoEl.currentTime = clamped * this.duration;
222
+ }
223
+ }
224
+ onVolume(e) {
225
+ const v = Number(e.target.value);
226
+ this.volume = v;
227
+ if (this.videoEl) {
228
+ this.videoEl.volume = v;
229
+ this.videoEl.muted = v === 0;
230
+ }
231
+ this.muted = v === 0;
232
+ }
233
+ toggleMute() {
234
+ this.muted = !this.muted;
235
+ if (this.videoEl) this.videoEl.muted = this.muted;
236
+ }
237
+ // Pantalla completa con la API nativa (sobre el contenedor, para conservar los controles).
238
+ toggleFullscreen() {
239
+ if (document.fullscreenElement) {
240
+ document.exitFullscreen();
241
+ } else if (this.stageEl?.requestFullscreen) {
242
+ this.stageEl.requestFullscreen();
243
+ }
244
+ }
245
+ // Formatea segundos a m:ss (sin libs de fechas).
246
+ fmt(secs) {
247
+ if (!isFinite(secs) || secs < 0) secs = 0;
248
+ const m = Math.floor(secs / 60);
249
+ const s = Math.floor(secs % 60);
250
+ return `${m}:${s.toString().padStart(2, "0")}`;
251
+ }
252
+ render() {
253
+ const pct = this.duration ? this.current / this.duration * 100 : 0;
254
+ const volIcon = this.muted || this.volume === 0 ? "volume-mute-outline" : this.volume < 0.5 ? "volume-low-outline" : "volume-high-outline";
255
+ return html`
256
+ <div class="stage">
257
+ <video
258
+ .src=${this.src}
259
+ poster=${this.poster || ""}
260
+ playsinline
261
+ @play=${this.onPlay}
262
+ @pause=${this.onPause}
263
+ @ended=${this.onEnded}
264
+ @timeupdate=${this.onTimeUpdate}
265
+ @loadedmetadata=${this.onLoadedMeta}
266
+ @click=${this.togglePlay}
267
+ ></video>
268
+
269
+ <button
270
+ class=${`overlay ${this.playing ? "playing" : ""}`}
271
+ aria-label=${this.playing ? this.t.pause : this.t.play}
272
+ @click=${this.togglePlay}
273
+ >
274
+ <span class="big">
275
+ <ion-icon name=${this.playing ? "pause" : "play"}></ion-icon>
276
+ </span>
277
+ </button>
278
+
279
+ <div class="bar">
280
+ <ion-button
281
+ fill="clear"
282
+ size="small"
283
+ aria-label=${this.playing ? this.t.pause : this.t.play}
284
+ @click=${this.togglePlay}
285
+ >
286
+ <ion-icon slot="icon-only" name=${this.playing ? "pause" : "play"}></ion-icon>
287
+ </ion-button>
288
+
289
+ <div class="progress" @click=${this.seek}>
290
+ <div class="fill" style=${`width:${pct}%`}></div>
291
+ <div class="knob" style=${`left:${pct}%`}></div>
292
+ </div>
293
+
294
+ <span class="time">${this.fmt(this.current)} / ${this.fmt(this.duration)}</span>
295
+
296
+ <div class="volume">
297
+ <ion-button
298
+ fill="clear"
299
+ size="small"
300
+ aria-label=${this.muted ? this.t.unmute : this.t.mute}
301
+ @click=${this.toggleMute}
302
+ >
303
+ <ion-icon slot="icon-only" name=${volIcon}></ion-icon>
304
+ </ion-button>
305
+ <input
306
+ type="range"
307
+ min="0"
308
+ max="1"
309
+ step="0.01"
310
+ .value=${String(this.muted ? 0 : this.volume)}
311
+ @input=${this.onVolume}
312
+ aria-label=${this.t.volume}
313
+ />
314
+ </div>
315
+
316
+ <ion-button
317
+ fill="clear"
318
+ size="small"
319
+ aria-label=${this.t.fullscreen}
320
+ @click=${this.toggleFullscreen}
321
+ >
322
+ <ion-icon slot="icon-only" name="expand-outline"></ion-icon>
323
+ </ion-button>
324
+ </div>
325
+ </div>
326
+ `;
327
+ }
328
+ }
329
+ __decorateClass([
330
+ property()
331
+ ], OkVideo.prototype, "src");
332
+ __decorateClass([
333
+ property()
334
+ ], OkVideo.prototype, "poster");
335
+ __decorateClass([
336
+ property({ attribute: false })
337
+ ], OkVideo.prototype, "labels");
338
+ __decorateClass([
339
+ state()
340
+ ], OkVideo.prototype, "playing");
341
+ __decorateClass([
342
+ state()
343
+ ], OkVideo.prototype, "current");
344
+ __decorateClass([
345
+ state()
346
+ ], OkVideo.prototype, "duration");
347
+ __decorateClass([
348
+ state()
349
+ ], OkVideo.prototype, "volume");
350
+ __decorateClass([
351
+ state()
352
+ ], OkVideo.prototype, "muted");
353
+ __decorateClass([
354
+ query("video")
355
+ ], OkVideo.prototype, "videoEl");
356
+ __decorateClass([
357
+ query(".stage")
358
+ ], OkVideo.prototype, "stageEl");
359
+ define("ok-video", OkVideo);
360
+ export {
361
+ OkVideo
362
+ };
@@ -0,0 +1,265 @@
1
+ import { LitElement, css, nothing, html } from "lit";
2
+ import { property, state } from "lit/decorators.js";
3
+ import { repeat } from "lit/directives/repeat.js";
4
+ import { define } from "./define.js";
5
+ var __defProp = Object.defineProperty;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = void 0;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = decorator(target, key, result) || result;
11
+ if (result) __defProp(target, key, result);
12
+ return result;
13
+ };
14
+ const DEFAULT_LABELS = {
15
+ customize: "Customize panel",
16
+ close: "Close",
17
+ presets: "Start from a preset",
18
+ active: "Active · drag to reorder",
19
+ available: "Available",
20
+ empty: "Empty panel. Tap ⋮ to add widgets."
21
+ };
22
+ class OkWidgetBoard extends LitElement {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.widgets = [];
26
+ this.presets = [];
27
+ this.value = [];
28
+ this.editable = false;
29
+ this.storageKey = "";
30
+ this.labels = {};
31
+ this.initialized = false;
32
+ this.openConfig = () => {
33
+ if (!this.modal) this.buildModal();
34
+ this.modal?.present?.();
35
+ };
36
+ }
37
+ static {
38
+ this.styles = css`
39
+ :host { display: block; width: 100%; }
40
+ .bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; min-height: 28px; }
41
+ .title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ion-color-medium, #6b7280); }
42
+ .grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--ok-widget-gap, 16px); align-items: start; }
43
+ .cell { min-width: 0; grid-column: span 12; }
44
+ @media (min-width: 768px) {
45
+ .cell[data-size='sm'] { grid-column: span 3; }
46
+ .cell[data-size='md'] { grid-column: span 6; }
47
+ .cell[data-size='lg'] { grid-column: span 8; }
48
+ }
49
+ .empty { grid-column: span 12; border: 1px dashed var(--ion-border-color, rgba(127,127,127,0.3)); border-radius: 12px; padding: 32px; text-align: center; color: var(--ion-color-medium, #6b7280); }
50
+ `;
51
+ }
52
+ get t() {
53
+ return { ...DEFAULT_LABELS, ...this.labels };
54
+ }
55
+ get byId() {
56
+ return new Map(this.widgets.map((w) => [w.id, w]));
57
+ }
58
+ get active() {
59
+ const m = this.byId;
60
+ return (this.value || []).filter((id) => m.has(id));
61
+ }
62
+ willUpdate() {
63
+ if (this.initialized || !this.widgets.length) return;
64
+ let initial = null;
65
+ if (this.storageKey) {
66
+ try {
67
+ const saved = JSON.parse(localStorage.getItem(`okwb:${this.storageKey}`) || "null");
68
+ if (Array.isArray(saved)) initial = saved;
69
+ } catch (_) {
70
+ }
71
+ }
72
+ if (!initial) {
73
+ if (this.value && this.value.length) initial = this.value.slice();
74
+ else if (this.presets.length) initial = this.presets[0].widgets.slice();
75
+ else initial = this.widgets.map((w) => w.id);
76
+ }
77
+ this.value = initial;
78
+ this.initialized = true;
79
+ }
80
+ persist() {
81
+ if (!this.storageKey) return;
82
+ try {
83
+ localStorage.setItem(`okwb:${this.storageKey}`, JSON.stringify(this.value));
84
+ } catch (_) {
85
+ }
86
+ }
87
+ /** Cambia el estado activo, persiste, re-renderiza el selector y emite `ok-change`. */
88
+ setValue(next) {
89
+ this.value = next.slice();
90
+ this.persist();
91
+ this.dispatchEvent(new CustomEvent("ok-change", { detail: { value: this.value.slice() }, bubbles: true, composed: true }));
92
+ this.refreshModal();
93
+ }
94
+ render() {
95
+ const items = this.active;
96
+ return html`
97
+ <div class="bar">
98
+ <slot name="title"><span class="title"></span></slot>
99
+ ${this.editable ? html`<ion-button fill="clear" size="small" aria-label=${this.t.customize} @click=${this.openConfig}>
100
+ <ion-icon slot="icon-only" name="ellipsis-vertical"></ion-icon>
101
+ </ion-button>` : nothing}
102
+ </div>
103
+ <div class="grid">
104
+ ${items.length ? repeat(
105
+ items,
106
+ (id) => id,
107
+ (id) => {
108
+ const w = this.byId.get(id);
109
+ return w ? html`<div class="cell" data-size=${w.size || "md"} data-id=${id}></div>` : nothing;
110
+ }
111
+ ) : html`<div class="empty">${this.t.empty}</div>`}
112
+ </div>`;
113
+ }
114
+ updated() {
115
+ const map = this.byId;
116
+ this.renderRoot.querySelectorAll(".cell").forEach((cell) => {
117
+ const id = cell.dataset.id || "";
118
+ if (cell.dataset.mounted === id) return;
119
+ cell.replaceChildren();
120
+ try {
121
+ map.get(id)?.render(cell);
122
+ } catch (err) {
123
+ console.error("[ok-widget-board]", id, err);
124
+ }
125
+ cell.dataset.mounted = id;
126
+ });
127
+ }
128
+ buildModal() {
129
+ const t = this.t;
130
+ const make = (tag, opts = {}) => {
131
+ const n = document.createElement(tag);
132
+ for (const [k, v] of Object.entries(opts.attrs || {})) v === true ? n.setAttribute(k, "") : v != null && n.setAttribute(k, String(v));
133
+ for (const [k, v] of Object.entries(opts.props || {})) n[k] = v;
134
+ if (opts.text != null) n.textContent = opts.text;
135
+ return n;
136
+ };
137
+ const modal = make("ion-modal");
138
+ modal.initialBreakpoint = 0.9;
139
+ modal.breakpoints = [0, 0.9, 1];
140
+ const header = make("ion-header");
141
+ const tb = make("ion-toolbar");
142
+ tb.appendChild(make("ion-title", { text: t.customize }));
143
+ const endBtns = make("ion-buttons", { attrs: { slot: "end" } });
144
+ const closeBtn = make("ion-button", { text: t.close });
145
+ closeBtn.addEventListener("click", () => modal.dismiss?.());
146
+ endBtns.appendChild(closeBtn);
147
+ tb.appendChild(endBtns);
148
+ header.appendChild(tb);
149
+ modal.appendChild(header);
150
+ const content = make("ion-content");
151
+ if (this.presets.length) {
152
+ content.appendChild(make("div", { attrs: { class: "okwb-sub" }, text: t.presets }));
153
+ const wrap = make("div", { attrs: { class: "okwb-presets" } });
154
+ for (const p of this.presets) {
155
+ const chip = make("ion-chip", { attrs: { outline: true } });
156
+ chip.appendChild(make("ion-label", { text: p.label }));
157
+ chip.addEventListener("click", () => this.setValue(p.widgets.filter((id) => this.byId.has(id))));
158
+ wrap.appendChild(chip);
159
+ }
160
+ content.appendChild(wrap);
161
+ }
162
+ content.appendChild(make("div", { attrs: { class: "okwb-sub" }, text: t.active }));
163
+ const activeList = make("ion-list");
164
+ const reorder = make("ion-reorder-group", { props: { disabled: false } });
165
+ reorder.addEventListener("ionItemReorder", (ev) => {
166
+ const e = ev;
167
+ const next = this.active;
168
+ const moved = next.splice(e.detail.from, 1)[0];
169
+ next.splice(e.detail.to, 0, moved);
170
+ e.detail.complete();
171
+ this.setValue(next);
172
+ });
173
+ activeList.appendChild(reorder);
174
+ content.appendChild(activeList);
175
+ content.appendChild(make("div", { attrs: { class: "okwb-sub" }, text: t.available }));
176
+ const availList = make("ion-list");
177
+ content.appendChild(availList);
178
+ const style = make("style", { text: `.okwb-sub{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--ion-color-medium);padding:12px 16px 4px}.okwb-presets{display:flex;gap:8px;flex-wrap:wrap;padding:12px 16px}` });
179
+ modal.appendChild(style);
180
+ modal.appendChild(content);
181
+ document.body.appendChild(modal);
182
+ this.modal = modal;
183
+ this.reorderEl = reorder;
184
+ this.availEl = availList;
185
+ this.refreshModal();
186
+ }
187
+ /** Repinta las listas de activos/disponibles del modal según `value`. */
188
+ refreshModal() {
189
+ const reorder = this.reorderEl;
190
+ const availList = this.availEl;
191
+ if (!reorder || !availList) return;
192
+ const map = this.byId;
193
+ const item = (w, checked, onToggle, withHandle) => {
194
+ const it = document.createElement("ion-item");
195
+ if (w.icon) {
196
+ const ic = document.createElement("ion-icon");
197
+ ic.setAttribute("slot", "start");
198
+ ic.setAttribute("name", w.icon);
199
+ it.appendChild(ic);
200
+ }
201
+ const lbl = document.createElement("ion-label");
202
+ const h3 = document.createElement("h3");
203
+ h3.textContent = w.title;
204
+ lbl.appendChild(h3);
205
+ if (w.category) {
206
+ const p = document.createElement("p");
207
+ p.textContent = w.category;
208
+ lbl.appendChild(p);
209
+ }
210
+ it.appendChild(lbl);
211
+ const tog = document.createElement("ion-toggle");
212
+ tog.setAttribute("slot", "end");
213
+ tog.checked = checked;
214
+ tog.addEventListener("ionChange", onToggle);
215
+ it.appendChild(tog);
216
+ if (withHandle) {
217
+ const r = document.createElement("ion-reorder");
218
+ r.setAttribute("slot", "end");
219
+ it.appendChild(r);
220
+ }
221
+ return it;
222
+ };
223
+ reorder.replaceChildren();
224
+ for (const id of this.active) {
225
+ const w = map.get(id);
226
+ if (!w) continue;
227
+ reorder.appendChild(item(w, true, () => this.setValue(this.active.filter((x) => x !== id)), true));
228
+ }
229
+ availList.replaceChildren();
230
+ for (const w of this.widgets) {
231
+ if (this.active.includes(w.id)) continue;
232
+ availList.appendChild(item(w, false, () => this.setValue([...this.active, w.id]), false));
233
+ }
234
+ }
235
+ disconnectedCallback() {
236
+ super.disconnectedCallback();
237
+ this.modal?.remove();
238
+ this.modal = void 0;
239
+ }
240
+ }
241
+ __decorateClass([
242
+ property({ attribute: false })
243
+ ], OkWidgetBoard.prototype, "widgets");
244
+ __decorateClass([
245
+ property({ attribute: false })
246
+ ], OkWidgetBoard.prototype, "presets");
247
+ __decorateClass([
248
+ property({ attribute: false })
249
+ ], OkWidgetBoard.prototype, "value");
250
+ __decorateClass([
251
+ property({ type: Boolean })
252
+ ], OkWidgetBoard.prototype, "editable");
253
+ __decorateClass([
254
+ property({ attribute: "storage-key" })
255
+ ], OkWidgetBoard.prototype, "storageKey");
256
+ __decorateClass([
257
+ property({ attribute: false })
258
+ ], OkWidgetBoard.prototype, "labels");
259
+ __decorateClass([
260
+ state()
261
+ ], OkWidgetBoard.prototype, "initialized");
262
+ define("ok-widget-board", OkWidgetBoard);
263
+ export {
264
+ OkWidgetBoard
265
+ };