@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.
- package/LICENSE +21 -0
- package/README.md +457 -0
- package/dist/base/anchor.d.ts +13 -0
- package/dist/base/define.d.ts +1 -0
- package/dist/base/relay.d.ts +1 -0
- package/dist/cdn.d.ts +96 -0
- package/dist/components/ok-app-launcher/ok-app-launcher.d.ts +57 -0
- package/dist/components/ok-audio/ok-audio.d.ts +45 -0
- package/dist/components/ok-avatar/ok-avatar.d.ts +36 -0
- package/dist/components/ok-avatar-group/ok-avatar-group.d.ts +38 -0
- package/dist/components/ok-bar-list/ok-bar-list.d.ts +36 -0
- package/dist/components/ok-bento/ok-bento.d.ts +17 -0
- package/dist/components/ok-bento-item/ok-bento-item.d.ts +34 -0
- package/dist/components/ok-calculator/ok-calculator.d.ts +46 -0
- package/dist/components/ok-calendar/ok-calendar.d.ts +63 -0
- package/dist/components/ok-carousel/ok-carousel.d.ts +48 -0
- package/dist/components/ok-chart/ok-chart.d.ts +55 -0
- package/dist/components/ok-chat/ok-chat.d.ts +54 -0
- package/dist/components/ok-coachmark/ok-coachmark.d.ts +69 -0
- package/dist/components/ok-code/ok-code.d.ts +28 -0
- package/dist/components/ok-color-picker/ok-color-picker.d.ts +63 -0
- package/dist/components/ok-combo/ok-combo.d.ts +46 -0
- package/dist/components/ok-command-palette/ok-command-palette.d.ts +72 -0
- package/dist/components/ok-contact-form/ok-contact-form.d.ts +54 -0
- package/dist/components/ok-cropper/ok-cropper.d.ts +60 -0
- package/dist/components/ok-cta-band/ok-cta-band.d.ts +18 -0
- package/dist/components/ok-currency/ok-currency.d.ts +31 -0
- package/dist/components/ok-data-table/ok-data-table.d.ts +312 -0
- package/dist/components/ok-date-picker/ok-date-picker.d.ts +81 -0
- package/dist/components/ok-detail-list/ok-detail-list.d.ts +30 -0
- package/dist/components/ok-diff/ok-diff.d.ts +38 -0
- package/dist/components/ok-donut/ok-donut.d.ts +38 -0
- package/dist/components/ok-drawer/ok-drawer.d.ts +56 -0
- package/dist/components/ok-dropzone/ok-dropzone.d.ts +48 -0
- package/dist/components/ok-empty-state/ok-empty-state.d.ts +16 -0
- package/dist/components/ok-error-page/ok-error-page.d.ts +77 -0
- package/dist/components/ok-event-card/ok-event-card.d.ts +56 -0
- package/dist/components/ok-feature-card/ok-feature-card.d.ts +23 -0
- package/dist/components/ok-file-item/ok-file-item.d.ts +31 -0
- package/dist/components/ok-file-manager/ok-file-manager.d.ts +145 -0
- package/dist/components/ok-footer/ok-footer.d.ts +10 -0
- package/dist/components/ok-funnel/ok-funnel.d.ts +31 -0
- package/dist/components/ok-gallery/ok-gallery.d.ts +34 -0
- package/dist/components/ok-gauge/ok-gauge.d.ts +49 -0
- package/dist/components/ok-heatmap/ok-heatmap.d.ts +45 -0
- package/dist/components/ok-hero/ok-hero.d.ts +10 -0
- package/dist/components/ok-hover-card/ok-hover-card.d.ts +76 -0
- package/dist/components/ok-icon-tile/ok-icon-tile.d.ts +24 -0
- package/dist/components/ok-image/ok-image.d.ts +56 -0
- package/dist/components/ok-inline-feedback/ok-inline-feedback.d.ts +33 -0
- package/dist/components/ok-invoice/ok-invoice.d.ts +137 -0
- package/dist/components/ok-json-viewer/ok-json-viewer.d.ts +31 -0
- package/dist/components/ok-kanban/ok-kanban.d.ts +56 -0
- package/dist/components/ok-kbd/ok-kbd.d.ts +21 -0
- package/dist/components/ok-keyboard/ok-keyboard.d.ts +35 -0
- package/dist/components/ok-kpi/ok-kpi.d.ts +24 -0
- package/dist/components/ok-language-select/ok-language-select.d.ts +31 -0
- package/dist/components/ok-lightbox/ok-lightbox.d.ts +59 -0
- package/dist/components/ok-logo-cloud/ok-logo-cloud.d.ts +14 -0
- package/dist/components/ok-loyalty-card/ok-loyalty-card.d.ts +35 -0
- package/dist/components/ok-mail/ok-mail.d.ts +117 -0
- package/dist/components/ok-menu/ok-menu.d.ts +75 -0
- package/dist/components/ok-menubar/ok-menubar.d.ts +75 -0
- package/dist/components/ok-navbar/ok-navbar.d.ts +42 -0
- package/dist/components/ok-notification-center/ok-notification-center.d.ts +79 -0
- package/dist/components/ok-org-chart/ok-org-chart.d.ts +67 -0
- package/dist/components/ok-otp/ok-otp.d.ts +31 -0
- package/dist/components/ok-page-header/ok-page-header.d.ts +23 -0
- package/dist/components/ok-pagination/ok-pagination.d.ts +44 -0
- package/dist/components/ok-pdf/ok-pdf.d.ts +32 -0
- package/dist/components/ok-phone/ok-phone.d.ts +48 -0
- package/dist/components/ok-pinpad/ok-pinpad.d.ts +29 -0
- package/dist/components/ok-pricing-card/ok-pricing-card.d.ts +31 -0
- package/dist/components/ok-product-card/ok-product-card.d.ts +25 -0
- package/dist/components/ok-qr/ok-qr.d.ts +24 -0
- package/dist/components/ok-qty-stepper/ok-qty-stepper.d.ts +35 -0
- package/dist/components/ok-range-dual/ok-range-dual.d.ts +38 -0
- package/dist/components/ok-rating/ok-rating.d.ts +33 -0
- package/dist/components/ok-receipt/ok-receipt.d.ts +103 -0
- package/dist/components/ok-reveal/ok-reveal.d.ts +21 -0
- package/dist/components/ok-rich-text/ok-rich-text.d.ts +46 -0
- package/dist/components/ok-scheduler/ok-scheduler.d.ts +74 -0
- package/dist/components/ok-select-card/ok-select-card.d.ts +37 -0
- package/dist/components/ok-signature/ok-signature.d.ts +55 -0
- package/dist/components/ok-skeleton/ok-skeleton.d.ts +40 -0
- package/dist/components/ok-sparkline/ok-sparkline.d.ts +27 -0
- package/dist/components/ok-split-button/ok-split-button.d.ts +49 -0
- package/dist/components/ok-splitter/ok-splitter.d.ts +36 -0
- package/dist/components/ok-stat/ok-stat.d.ts +16 -0
- package/dist/components/ok-status-dot/ok-status-dot.d.ts +24 -0
- package/dist/components/ok-status-pill/ok-status-pill.d.ts +22 -0
- package/dist/components/ok-stepper/ok-stepper.d.ts +33 -0
- package/dist/components/ok-store/ok-store.d.ts +33 -0
- package/dist/components/ok-tag-input/ok-tag-input.d.ts +39 -0
- package/dist/components/ok-testimonial/ok-testimonial.d.ts +21 -0
- package/dist/components/ok-time-picker/ok-time-picker.d.ts +50 -0
- package/dist/components/ok-timeline/ok-timeline.d.ts +33 -0
- package/dist/components/ok-tree/ok-tree.d.ts +46 -0
- package/dist/components/ok-video/ok-video.d.ts +49 -0
- package/dist/components/ok-widget-board/ok-widget-board.d.ts +71 -0
- package/dist/components/ok-wizard/ok-wizard.d.ts +30 -0
- package/dist/define.js +8 -0
- package/dist/erplora.css +112 -0
- package/dist/index.d.ts +158 -0
- package/dist/index.js +197 -0
- package/dist/layout.css +338 -0
- package/dist/ok-app-launcher.js +396 -0
- package/dist/ok-audio.js +308 -0
- package/dist/ok-avatar-group.js +158 -0
- package/dist/ok-avatar.js +179 -0
- package/dist/ok-bar-list.js +189 -0
- package/dist/ok-bento-item.js +168 -0
- package/dist/ok-bento.js +63 -0
- package/dist/ok-calculator.js +406 -0
- package/dist/ok-calendar.js +541 -0
- package/dist/ok-carousel.js +352 -0
- package/dist/ok-chart.js +325 -0
- package/dist/ok-chat.js +320 -0
- package/dist/ok-coachmark.js +500 -0
- package/dist/ok-code.js +190 -0
- package/dist/ok-color-picker.js +569 -0
- package/dist/ok-combo.js +294 -0
- package/dist/ok-command-palette.js +448 -0
- package/dist/ok-contact-form.js +288 -0
- package/dist/ok-cropper.js +404 -0
- package/dist/ok-cta-band.js +134 -0
- package/dist/ok-currency.js +172 -0
- package/dist/ok-data-table.js +1281 -0
- package/dist/ok-date-picker.js +736 -0
- package/dist/ok-detail-list.js +156 -0
- package/dist/ok-diff.js +200 -0
- package/dist/ok-donut.js +280 -0
- package/dist/ok-drawer.js +357 -0
- package/dist/ok-dropzone.js +376 -0
- package/dist/ok-empty-state.js +104 -0
- package/dist/ok-error-page.js +547 -0
- package/dist/ok-event-card.js +384 -0
- package/dist/ok-feature-card.js +152 -0
- package/dist/ok-file-item.js +259 -0
- package/dist/ok-file-manager.js +1116 -0
- package/dist/ok-footer.js +67 -0
- package/dist/ok-funnel.js +181 -0
- package/dist/ok-gallery.js +293 -0
- package/dist/ok-gauge.js +385 -0
- package/dist/ok-heatmap.js +268 -0
- package/dist/ok-hero.js +43 -0
- package/dist/ok-hover-card.js +480 -0
- package/dist/ok-icon-tile.js +123 -0
- package/dist/ok-image.js +471 -0
- package/dist/ok-inline-feedback.js +221 -0
- package/dist/ok-invoice.js +229 -0
- package/dist/ok-json-viewer.js +330 -0
- package/dist/ok-kanban.js +427 -0
- package/dist/ok-kbd.js +159 -0
- package/dist/ok-keyboard.js +402 -0
- package/dist/ok-kpi.js +147 -0
- package/dist/ok-language-select.js +188 -0
- package/dist/ok-lightbox.js +490 -0
- package/dist/ok-logo-cloud.js +92 -0
- package/dist/ok-loyalty-card.js +353 -0
- package/dist/ok-mail.js +562 -0
- package/dist/ok-menu.js +529 -0
- package/dist/ok-menubar.js +628 -0
- package/dist/ok-navbar.js +306 -0
- package/dist/ok-notification-center.js +545 -0
- package/dist/ok-org-chart.js +619 -0
- package/dist/ok-otp.js +199 -0
- package/dist/ok-page-header.js +202 -0
- package/dist/ok-pagination.js +366 -0
- package/dist/ok-pdf.js +160 -0
- package/dist/ok-phone.js +225 -0
- package/dist/ok-pinpad.js +171 -0
- package/dist/ok-pricing-card.js +184 -0
- package/dist/ok-product-card.js +178 -0
- package/dist/ok-qr.js +652 -0
- package/dist/ok-qty-stepper.js +212 -0
- package/dist/ok-range-dual.js +280 -0
- package/dist/ok-rating.js +199 -0
- package/dist/ok-receipt.js +183 -0
- package/dist/ok-reveal.js +94 -0
- package/dist/ok-rich-text.js +538 -0
- package/dist/ok-scheduler.js +518 -0
- package/dist/ok-select-card.js +231 -0
- package/dist/ok-signature.js +267 -0
- package/dist/ok-skeleton.js +345 -0
- package/dist/ok-sparkline.js +150 -0
- package/dist/ok-split-button.js +251 -0
- package/dist/ok-splitter.js +289 -0
- package/dist/ok-stat.js +77 -0
- package/dist/ok-status-dot.js +163 -0
- package/dist/ok-status-pill.js +123 -0
- package/dist/ok-stepper.js +299 -0
- package/dist/ok-store.js +83 -0
- package/dist/ok-tag-input.js +358 -0
- package/dist/ok-testimonial.js +136 -0
- package/dist/ok-time-picker.js +472 -0
- package/dist/ok-timeline.js +251 -0
- package/dist/ok-tree.js +266 -0
- package/dist/ok-video.js +362 -0
- package/dist/ok-widget-board.js +265 -0
- package/dist/ok-wizard.js +153 -0
- package/dist/outfitkit.js +96 -0
- package/dist/shared/anchor.js +14 -0
- package/dist/store/controller.d.ts +17 -0
- package/dist/store/idb.d.ts +16 -0
- package/dist/store/store.d.ts +39 -0
- package/dist/store-controller.js +31 -0
- package/dist/store.js +182 -0
- package/dist/theme.example.css +70 -0
- package/package.json +147 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property, state } 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
|
+
empty: "No cards"
|
|
15
|
+
};
|
|
16
|
+
class OkKanban extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.columns = [];
|
|
20
|
+
this.labels = {};
|
|
21
|
+
this.view = [];
|
|
22
|
+
this.drag = null;
|
|
23
|
+
this.overColumn = null;
|
|
24
|
+
this.overCardId = null;
|
|
25
|
+
this.overAfter = false;
|
|
26
|
+
this.lastColumnsRef = null;
|
|
27
|
+
}
|
|
28
|
+
static {
|
|
29
|
+
this.styles = css`
|
|
30
|
+
:host {
|
|
31
|
+
/* Vars overridable estilo Ionic: cadena --ok-* → --ion-* → hex. */
|
|
32
|
+
--background: var(--ok-bg-soft, var(--ion-color-light, #f4f5f8));
|
|
33
|
+
--column-background: var(--ok-surface, var(--ion-card-background, #ffffff));
|
|
34
|
+
--color: var(--ok-text, var(--ion-text-color, #1c1b17));
|
|
35
|
+
--color-muted: var(--ok-text-muted, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.55));
|
|
36
|
+
--primary-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
37
|
+
--border-color: var(--ok-border-soft, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.12));
|
|
38
|
+
--card-background: var(--ok-card-bg, var(--ion-background-color, #ffffff));
|
|
39
|
+
--drop-highlight: var(
|
|
40
|
+
--ok-kanban-drop,
|
|
41
|
+
rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.1)
|
|
42
|
+
);
|
|
43
|
+
--border-radius: var(--ok-radius, 10px);
|
|
44
|
+
--column-width: var(--ok-kanban-column-width, 280px);
|
|
45
|
+
--gap: var(--ok-kanban-gap, 0.9rem);
|
|
46
|
+
--font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
47
|
+
|
|
48
|
+
/* Ocupa todo el contenedor; el scroll vive dentro (columnas y listas). */
|
|
49
|
+
display: block;
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: 100%;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
color: var(--color);
|
|
54
|
+
font-family: var(--font);
|
|
55
|
+
font-size: 0.95rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Fila de columnas con scroll horizontal (en móvil se desliza). */
|
|
59
|
+
.board {
|
|
60
|
+
display: flex;
|
|
61
|
+
gap: var(--gap);
|
|
62
|
+
align-items: flex-start;
|
|
63
|
+
height: 100%;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
padding: var(--gap);
|
|
66
|
+
overflow-x: auto;
|
|
67
|
+
overflow-y: hidden;
|
|
68
|
+
background: var(--background);
|
|
69
|
+
-webkit-overflow-scrolling: touch;
|
|
70
|
+
scroll-snap-type: x proximity;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Columna de ancho fijo; el contenido scrollea en vertical por dentro. */
|
|
74
|
+
.column {
|
|
75
|
+
flex: 0 0 var(--column-width);
|
|
76
|
+
width: var(--column-width);
|
|
77
|
+
max-height: 100%;
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
background: var(--column-background);
|
|
82
|
+
border: 1px solid var(--border-color);
|
|
83
|
+
border-radius: var(--border-radius);
|
|
84
|
+
scroll-snap-align: start;
|
|
85
|
+
transition: background 0.15s ease, box-shadow 0.15s ease;
|
|
86
|
+
}
|
|
87
|
+
/* Resaltado de la columna destino mientras se arrastra sobre ella. */
|
|
88
|
+
.column.drag-over {
|
|
89
|
+
background: var(--drop-highlight);
|
|
90
|
+
box-shadow: inset 0 0 0 2px var(--primary-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Cabecera: franja de color (si hay) + título + contador. */
|
|
94
|
+
.column-header {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: 0.5rem;
|
|
98
|
+
padding: 0.7rem 0.85rem;
|
|
99
|
+
border-bottom: 1px solid var(--border-color);
|
|
100
|
+
border-top-left-radius: var(--border-radius);
|
|
101
|
+
border-top-right-radius: var(--border-radius);
|
|
102
|
+
}
|
|
103
|
+
.swatch {
|
|
104
|
+
flex: 0 0 auto;
|
|
105
|
+
width: 10px;
|
|
106
|
+
height: 10px;
|
|
107
|
+
border-radius: 3px;
|
|
108
|
+
background: var(--swatch-color, var(--primary-color));
|
|
109
|
+
}
|
|
110
|
+
.column-title {
|
|
111
|
+
flex: 1 1 auto;
|
|
112
|
+
min-width: 0;
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
text-overflow: ellipsis;
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
}
|
|
118
|
+
.count {
|
|
119
|
+
flex: 0 0 auto;
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
min-width: 1.5rem;
|
|
124
|
+
height: 1.5rem;
|
|
125
|
+
padding: 0 0.45rem;
|
|
126
|
+
border-radius: 999px;
|
|
127
|
+
background: var(--background);
|
|
128
|
+
color: var(--color-muted);
|
|
129
|
+
font-size: 0.8rem;
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Lista de tarjetas con scroll vertical propio. */
|
|
134
|
+
.cards {
|
|
135
|
+
flex: 1 1 auto;
|
|
136
|
+
min-height: 2.5rem;
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: 0.55rem;
|
|
140
|
+
padding: 0.7rem;
|
|
141
|
+
margin: 0;
|
|
142
|
+
list-style: none;
|
|
143
|
+
overflow-y: auto;
|
|
144
|
+
-webkit-overflow-scrolling: touch;
|
|
145
|
+
}
|
|
146
|
+
.empty {
|
|
147
|
+
flex: 1 1 auto;
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
color: var(--color-muted);
|
|
152
|
+
font-size: 0.85rem;
|
|
153
|
+
text-align: center;
|
|
154
|
+
padding: 0.8rem;
|
|
155
|
+
border: 1px dashed var(--border-color);
|
|
156
|
+
border-radius: var(--border-radius);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Tarjeta arrastrable. */
|
|
160
|
+
.card {
|
|
161
|
+
box-sizing: border-box;
|
|
162
|
+
padding: 0.6rem 0.7rem;
|
|
163
|
+
background: var(--card-background);
|
|
164
|
+
border: 1px solid var(--border-color);
|
|
165
|
+
border-radius: var(--border-radius);
|
|
166
|
+
cursor: grab;
|
|
167
|
+
user-select: none;
|
|
168
|
+
transition: background-color var(--ok-transition, 150ms ease),
|
|
169
|
+
color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
|
|
170
|
+
box-shadow var(--ok-transition, 150ms ease), transform 120ms ease, opacity 0.15s ease;
|
|
171
|
+
}
|
|
172
|
+
/* Hover sutil solo con ratón: la tarjeta se levanta ligeramente. */
|
|
173
|
+
@media (hover: hover) {
|
|
174
|
+
.card:not(.dragging):hover {
|
|
175
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
176
|
+
transform: translateY(-2px);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
.card:active {
|
|
180
|
+
cursor: grabbing;
|
|
181
|
+
}
|
|
182
|
+
/* Press feedback solo cuando no se está arrastrando (no romper el drag&drop). */
|
|
183
|
+
.card:not(.dragging):active {
|
|
184
|
+
transform: translateY(0) scale(0.98);
|
|
185
|
+
}
|
|
186
|
+
.card.dragging {
|
|
187
|
+
opacity: 0.45;
|
|
188
|
+
}
|
|
189
|
+
@media (prefers-reduced-motion: reduce) {
|
|
190
|
+
.card:not(.dragging):hover,
|
|
191
|
+
.card:not(.dragging):active {
|
|
192
|
+
transform: none;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/* Marcador del punto de inserción (placeholder) durante el dragover. */
|
|
196
|
+
.card.drop-before {
|
|
197
|
+
box-shadow: inset 0 3px 0 -1px var(--primary-color);
|
|
198
|
+
}
|
|
199
|
+
.card.drop-after {
|
|
200
|
+
box-shadow: inset 0 -3px 0 -1px var(--primary-color);
|
|
201
|
+
}
|
|
202
|
+
.card-title {
|
|
203
|
+
font-weight: 600;
|
|
204
|
+
line-height: 1.3;
|
|
205
|
+
word-break: break-word;
|
|
206
|
+
}
|
|
207
|
+
.card-subtitle {
|
|
208
|
+
margin-top: 0.2rem;
|
|
209
|
+
color: var(--color-muted);
|
|
210
|
+
font-size: 0.85rem;
|
|
211
|
+
line-height: 1.3;
|
|
212
|
+
word-break: break-word;
|
|
213
|
+
}
|
|
214
|
+
.tags {
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-wrap: wrap;
|
|
217
|
+
gap: 0.3rem;
|
|
218
|
+
margin-top: 0.5rem;
|
|
219
|
+
}
|
|
220
|
+
.tag {
|
|
221
|
+
display: inline-flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
padding: 0.1rem 0.5rem;
|
|
224
|
+
border-radius: 999px;
|
|
225
|
+
background: var(--background);
|
|
226
|
+
color: var(--color-muted);
|
|
227
|
+
font-size: 0.72rem;
|
|
228
|
+
font-weight: 600;
|
|
229
|
+
line-height: 1.6;
|
|
230
|
+
}
|
|
231
|
+
`;
|
|
232
|
+
}
|
|
233
|
+
get t() {
|
|
234
|
+
return { ...DEFAULT_LABELS, ...this.labels };
|
|
235
|
+
}
|
|
236
|
+
// Clona en profundidad (solo los niveles que reordenamos) la prop hacia el estado interno.
|
|
237
|
+
syncFromProp() {
|
|
238
|
+
this.view = this.columns.map((col) => ({
|
|
239
|
+
...col,
|
|
240
|
+
cards: col.cards.map((card) => ({ ...card }))
|
|
241
|
+
}));
|
|
242
|
+
this.lastColumnsRef = this.columns;
|
|
243
|
+
}
|
|
244
|
+
// ---- Drag & drop nativo HTML5 ---------------------------------------------------------------
|
|
245
|
+
onDragStart(e, fromColumn, cardId) {
|
|
246
|
+
this.drag = { cardId, fromColumn };
|
|
247
|
+
if (e.dataTransfer) {
|
|
248
|
+
e.dataTransfer.effectAllowed = "move";
|
|
249
|
+
e.dataTransfer.setData("text/plain", cardId);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
onDragEnd() {
|
|
253
|
+
this.drag = null;
|
|
254
|
+
this.overColumn = null;
|
|
255
|
+
this.overCardId = null;
|
|
256
|
+
this.overAfter = false;
|
|
257
|
+
}
|
|
258
|
+
// Mientras se arrastra sobre una columna: permite soltar y resalta la columna.
|
|
259
|
+
onColumnDragOver(e, columnId) {
|
|
260
|
+
if (!this.drag) return;
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
263
|
+
if (this.overColumn !== columnId) this.overColumn = columnId;
|
|
264
|
+
this.overCardId = null;
|
|
265
|
+
this.overAfter = false;
|
|
266
|
+
}
|
|
267
|
+
// Mientras se arrastra sobre una tarjeta: calcula si la inserción va antes o después según
|
|
268
|
+
// la posición vertical del puntero respecto al centro de la tarjeta.
|
|
269
|
+
onCardDragOver(e, columnId, cardId) {
|
|
270
|
+
if (!this.drag) return;
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
e.stopPropagation();
|
|
273
|
+
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
274
|
+
const target = e.currentTarget;
|
|
275
|
+
const rect = target.getBoundingClientRect();
|
|
276
|
+
const after = e.clientY > rect.top + rect.height / 2;
|
|
277
|
+
if (this.overColumn !== columnId) this.overColumn = columnId;
|
|
278
|
+
if (this.overCardId !== cardId || this.overAfter !== after) {
|
|
279
|
+
this.overCardId = cardId;
|
|
280
|
+
this.overAfter = after;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Suelta sobre la columna (zona vacía o tras propagación): inserta al final si no hay tarjeta diana.
|
|
284
|
+
onColumnDrop(e, toColumn) {
|
|
285
|
+
if (!this.drag) return;
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
this.commitMove(toColumn);
|
|
288
|
+
}
|
|
289
|
+
// Suelta sobre una tarjeta concreta: inserta antes/después de ella.
|
|
290
|
+
onCardDrop(e, toColumn) {
|
|
291
|
+
if (!this.drag) return;
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
e.stopPropagation();
|
|
294
|
+
this.commitMove(toColumn);
|
|
295
|
+
}
|
|
296
|
+
// Aplica el movimiento en el modelo interno y emite `ok-card-move`.
|
|
297
|
+
commitMove(toColumn) {
|
|
298
|
+
const drag = this.drag;
|
|
299
|
+
if (!drag) return;
|
|
300
|
+
const fromCol = this.view.find((c) => c.id === drag.fromColumn);
|
|
301
|
+
const toCol = this.view.find((c) => c.id === toColumn);
|
|
302
|
+
if (!fromCol || !toCol) {
|
|
303
|
+
this.onDragEnd();
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const fromIndex = fromCol.cards.findIndex((c) => c.id === drag.cardId);
|
|
307
|
+
if (fromIndex === -1) {
|
|
308
|
+
this.onDragEnd();
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
let toIndex = toCol.cards.length;
|
|
312
|
+
if (this.overCardId) {
|
|
313
|
+
const targetIndex = toCol.cards.findIndex((c) => c.id === this.overCardId);
|
|
314
|
+
if (targetIndex !== -1) {
|
|
315
|
+
toIndex = this.overAfter ? targetIndex + 1 : targetIndex;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
const [card] = fromCol.cards.splice(fromIndex, 1);
|
|
319
|
+
if (fromCol === toCol && fromIndex < toIndex) {
|
|
320
|
+
toIndex -= 1;
|
|
321
|
+
}
|
|
322
|
+
toCol.cards.splice(toIndex, 0, card);
|
|
323
|
+
this.view = this.view.map((c) => ({ ...c, cards: [...c.cards] }));
|
|
324
|
+
this.dispatchEvent(
|
|
325
|
+
new CustomEvent("ok-card-move", {
|
|
326
|
+
detail: {
|
|
327
|
+
cardId: drag.cardId,
|
|
328
|
+
fromColumn: drag.fromColumn,
|
|
329
|
+
toColumn,
|
|
330
|
+
toIndex
|
|
331
|
+
},
|
|
332
|
+
bubbles: true,
|
|
333
|
+
composed: true
|
|
334
|
+
})
|
|
335
|
+
);
|
|
336
|
+
this.onDragEnd();
|
|
337
|
+
}
|
|
338
|
+
// Click en una tarjeta (no en arrastre): emite `ok-card-click`.
|
|
339
|
+
onCardClick(card) {
|
|
340
|
+
this.dispatchEvent(
|
|
341
|
+
new CustomEvent("ok-card-click", {
|
|
342
|
+
detail: { id: card.id, card },
|
|
343
|
+
bubbles: true,
|
|
344
|
+
composed: true
|
|
345
|
+
})
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
// ---- Render ---------------------------------------------------------------------------------
|
|
349
|
+
renderCard(column, card) {
|
|
350
|
+
const dragging = this.drag?.cardId === card.id;
|
|
351
|
+
const isOver = this.overCardId === card.id && this.overColumn === column.id;
|
|
352
|
+
const classes = [
|
|
353
|
+
"card",
|
|
354
|
+
dragging ? "dragging" : "",
|
|
355
|
+
isOver && !this.overAfter ? "drop-before" : "",
|
|
356
|
+
isOver && this.overAfter ? "drop-after" : ""
|
|
357
|
+
].filter(Boolean).join(" ");
|
|
358
|
+
return html`<li
|
|
359
|
+
class=${classes}
|
|
360
|
+
draggable="true"
|
|
361
|
+
@dragstart=${(e) => this.onDragStart(e, column.id, card.id)}
|
|
362
|
+
@dragend=${() => this.onDragEnd()}
|
|
363
|
+
@dragover=${(e) => this.onCardDragOver(e, column.id, card.id)}
|
|
364
|
+
@drop=${(e) => this.onCardDrop(e, column.id)}
|
|
365
|
+
@click=${() => this.onCardClick(card)}
|
|
366
|
+
>
|
|
367
|
+
<div class="card-title">${card.title}</div>
|
|
368
|
+
${card.subtitle ? html`<div class="card-subtitle">${card.subtitle}</div>` : ""}
|
|
369
|
+
${card.tags?.length ? html`<div class="tags">
|
|
370
|
+
${card.tags.map((tag) => html`<span class="tag">${tag}</span>`)}
|
|
371
|
+
</div>` : ""}
|
|
372
|
+
</li>`;
|
|
373
|
+
}
|
|
374
|
+
renderColumn(column) {
|
|
375
|
+
const over = this.overColumn === column.id;
|
|
376
|
+
const headerStyle = column.color ? `--swatch-color:${column.color}` : "";
|
|
377
|
+
return html`<section
|
|
378
|
+
class=${`column ${over ? "drag-over" : ""}`.trim()}
|
|
379
|
+
@dragover=${(e) => this.onColumnDragOver(e, column.id)}
|
|
380
|
+
@drop=${(e) => this.onColumnDrop(e, column.id)}
|
|
381
|
+
>
|
|
382
|
+
<header class="column-header">
|
|
383
|
+
<span class="swatch" style=${headerStyle}></span>
|
|
384
|
+
<span class="column-title">${column.title}</span>
|
|
385
|
+
<span class="count">${column.cards.length}</span>
|
|
386
|
+
</header>
|
|
387
|
+
${column.cards.length ? html`<ul class="cards">
|
|
388
|
+
${column.cards.map((card) => this.renderCard(column, card))}
|
|
389
|
+
</ul>` : html`<ul class="cards">
|
|
390
|
+
<li class="empty">${this.t.empty}</li>
|
|
391
|
+
</ul>`}
|
|
392
|
+
</section>`;
|
|
393
|
+
}
|
|
394
|
+
render() {
|
|
395
|
+
if (this.columns !== this.lastColumnsRef) {
|
|
396
|
+
this.syncFromProp();
|
|
397
|
+
}
|
|
398
|
+
return html`<div class="board">
|
|
399
|
+
${this.view.map((column) => this.renderColumn(column))}
|
|
400
|
+
</div>`;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
__decorateClass([
|
|
404
|
+
property({ attribute: false })
|
|
405
|
+
], OkKanban.prototype, "columns");
|
|
406
|
+
__decorateClass([
|
|
407
|
+
property({ attribute: false })
|
|
408
|
+
], OkKanban.prototype, "labels");
|
|
409
|
+
__decorateClass([
|
|
410
|
+
state()
|
|
411
|
+
], OkKanban.prototype, "view");
|
|
412
|
+
__decorateClass([
|
|
413
|
+
state()
|
|
414
|
+
], OkKanban.prototype, "drag");
|
|
415
|
+
__decorateClass([
|
|
416
|
+
state()
|
|
417
|
+
], OkKanban.prototype, "overColumn");
|
|
418
|
+
__decorateClass([
|
|
419
|
+
state()
|
|
420
|
+
], OkKanban.prototype, "overCardId");
|
|
421
|
+
__decorateClass([
|
|
422
|
+
state()
|
|
423
|
+
], OkKanban.prototype, "overAfter");
|
|
424
|
+
define("ok-kanban", OkKanban);
|
|
425
|
+
export {
|
|
426
|
+
OkKanban
|
|
427
|
+
};
|
package/dist/ok-kbd.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { LitElement, css, html } 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 MOD_KEYS = /* @__PURE__ */ new Set(["cmd", "command", "ctrl", "control", "shift", "alt", "option", "opt", "meta", "win", "super"]);
|
|
14
|
+
const GLYPHS = {
|
|
15
|
+
cmd: "⌘",
|
|
16
|
+
command: "⌘",
|
|
17
|
+
meta: "⌘",
|
|
18
|
+
super: "⌘",
|
|
19
|
+
win: "⊞",
|
|
20
|
+
ctrl: "Ctrl",
|
|
21
|
+
control: "Ctrl",
|
|
22
|
+
shift: "Shift",
|
|
23
|
+
alt: "Alt",
|
|
24
|
+
option: "⌥",
|
|
25
|
+
opt: "⌥",
|
|
26
|
+
enter: "↵",
|
|
27
|
+
return: "↵",
|
|
28
|
+
esc: "Esc",
|
|
29
|
+
escape: "Esc",
|
|
30
|
+
tab: "Tab",
|
|
31
|
+
space: "space",
|
|
32
|
+
up: "↑",
|
|
33
|
+
down: "↓",
|
|
34
|
+
left: "←",
|
|
35
|
+
right: "→",
|
|
36
|
+
del: "⌫",
|
|
37
|
+
delete: "⌫",
|
|
38
|
+
backspace: "⌫"
|
|
39
|
+
};
|
|
40
|
+
class OkKbd extends LitElement {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
this.keys = "";
|
|
44
|
+
this.size = "md";
|
|
45
|
+
this.combo = true;
|
|
46
|
+
}
|
|
47
|
+
static {
|
|
48
|
+
this.styles = css`
|
|
49
|
+
:host {
|
|
50
|
+
/* Átomo inline: ocupa solo su contenido. */
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 0.25rem;
|
|
54
|
+
vertical-align: middle;
|
|
55
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
56
|
+
--bg: var(--ok-kbd-bg, var(--ion-color-light, #f4f5f8));
|
|
57
|
+
--bg-mod: var(--ok-kbd-bg-mod, var(--ion-color-light-shade, #d7d8da));
|
|
58
|
+
--border-color: var(--ok-kbd-border, var(--ion-border-color, #c8c9cc));
|
|
59
|
+
--color: var(--ok-kbd-color, var(--ion-color-medium-shade, #808289));
|
|
60
|
+
--color-mod: var(--ok-kbd-color-mod, var(--ion-text-color, #1f2933));
|
|
61
|
+
--radius: var(--ok-kbd-radius, 4px);
|
|
62
|
+
--font-mono: var(--ok-kbd-font, ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', monospace);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.key {
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
min-width: 22px;
|
|
71
|
+
height: 22px;
|
|
72
|
+
padding: 0 5px;
|
|
73
|
+
background: var(--bg);
|
|
74
|
+
border: 1px solid var(--border-color);
|
|
75
|
+
/* Relieve 3D: borde inferior más grueso. */
|
|
76
|
+
border-bottom-width: 3px;
|
|
77
|
+
border-radius: var(--radius);
|
|
78
|
+
font-family: var(--font-mono);
|
|
79
|
+
font-size: 11px;
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
line-height: 1;
|
|
82
|
+
color: var(--color);
|
|
83
|
+
font-variant-numeric: tabular-nums;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Tamaño compacto. */
|
|
88
|
+
:host([size='sm']) .key {
|
|
89
|
+
min-width: 18px;
|
|
90
|
+
height: 18px;
|
|
91
|
+
padding: 0 4px;
|
|
92
|
+
font-size: 10px;
|
|
93
|
+
border-bottom-width: 2px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Modificadores: fondo más pesado, negrita, uppercase. */
|
|
97
|
+
.key.mod {
|
|
98
|
+
background: var(--bg-mod);
|
|
99
|
+
color: var(--color-mod);
|
|
100
|
+
font-weight: 600;
|
|
101
|
+
letter-spacing: 0.04em;
|
|
102
|
+
text-transform: uppercase;
|
|
103
|
+
font-size: 10px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([size='sm']) .key.mod {
|
|
107
|
+
font-size: 9px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Separador "+" entre teclas en modo combo. */
|
|
111
|
+
.plus {
|
|
112
|
+
font-size: 10px;
|
|
113
|
+
color: var(--color);
|
|
114
|
+
opacity: 0.6;
|
|
115
|
+
user-select: none;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
119
|
+
// Divide `keys` en tokens normalizados (sin vacíos).
|
|
120
|
+
parseKeys() {
|
|
121
|
+
return this.keys.split(/\s+/).map((k) => k.trim()).filter((k) => k.length > 0);
|
|
122
|
+
}
|
|
123
|
+
// ¿Es una tecla modificadora?
|
|
124
|
+
isMod(token) {
|
|
125
|
+
return MOD_KEYS.has(token.toLowerCase());
|
|
126
|
+
}
|
|
127
|
+
// Etiqueta visible: glifo bonito si existe, si no la tecla tal cual (en mayúscula si es 1 char).
|
|
128
|
+
label(token) {
|
|
129
|
+
const glyph = GLYPHS[token.toLowerCase()];
|
|
130
|
+
if (glyph) return glyph;
|
|
131
|
+
return token.length === 1 ? token.toUpperCase() : token;
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
const tokens = this.parseKeys();
|
|
135
|
+
return tokens.map((token, i) => {
|
|
136
|
+
const mod = this.isMod(token);
|
|
137
|
+
const cap = html`<kbd
|
|
138
|
+
class="key ${mod ? "mod" : ""}"
|
|
139
|
+
aria-label=${token}
|
|
140
|
+
>${this.label(token)}</kbd
|
|
141
|
+
>`;
|
|
142
|
+
const sep = this.combo && i < tokens.length - 1 ? html`<span class="plus" aria-hidden="true">+</span>` : null;
|
|
143
|
+
return html`${cap}${sep}`;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
__decorateClass([
|
|
148
|
+
property()
|
|
149
|
+
], OkKbd.prototype, "keys");
|
|
150
|
+
__decorateClass([
|
|
151
|
+
property({ reflect: true })
|
|
152
|
+
], OkKbd.prototype, "size");
|
|
153
|
+
__decorateClass([
|
|
154
|
+
property({ type: Boolean })
|
|
155
|
+
], OkKbd.prototype, "combo");
|
|
156
|
+
define("ok-kbd", OkKbd);
|
|
157
|
+
export {
|
|
158
|
+
OkKbd
|
|
159
|
+
};
|