vanilla-breeze 0.1.0 → 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/dist/cdn/components/adr-record.js +383 -0
- package/dist/cdn/components/adr-wc.js +403 -0
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/chart-wc.js +25 -25
- package/dist/cdn/components/day-view.js +2 -0
- package/dist/cdn/components/empathy-map.js +42 -25
- package/dist/cdn/components/flow-diagram.js +2 -0
- package/dist/cdn/components/gantt-chart.js +2 -0
- package/dist/cdn/components/glossary-wc.js +2 -0
- package/dist/cdn/components/manifest.json +42 -6
- package/dist/cdn/components/review-surface.js +541 -0
- package/dist/cdn/components/settings-panel.js +1 -1
- package/dist/cdn/components/site-map-wc.js +2 -0
- package/dist/cdn/components/user-journey.js +48 -30
- package/dist/cdn/components/user-persona.js +17 -15
- package/dist/cdn/components/user-story.js +55 -22
- package/dist/cdn/components/week-view.js +2 -0
- package/dist/cdn/components/work-item.js +446 -0
- package/dist/cdn/packs/manifest.json +4 -4
- package/dist/cdn/packs/prototype.full.js +1 -1
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ux-planning.full.css +1 -1
- package/dist/cdn/packs/ux-planning.full.js +1546 -92
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/brutalist.css +1 -1
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/manifest.json +14 -14
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/organic.css +1 -1
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/win9x.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +25 -25
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +1 -1
- package/dist/cdn/vanilla-breeze-dev.js +1 -1
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +1626 -242
- package/package.json +1 -1
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
var c=`
|
|
2
|
+
:host {
|
|
3
|
+
--_bg: var(--adr-wc-bg, var(--color-surface, #ffffff));
|
|
4
|
+
--_text: var(--adr-wc-text, var(--color-text, #1a1a1a));
|
|
5
|
+
--_muted: var(--adr-wc-muted, var(--color-text-muted, #666));
|
|
6
|
+
--_border: var(--adr-wc-border, var(--color-border, #e0e0e0));
|
|
7
|
+
--_accent: var(--adr-wc-accent, var(--color-interactive, #0066cc));
|
|
8
|
+
--_card-bg: var(--adr-wc-card-bg, var(--color-surface-raised, #f8f9fa));
|
|
9
|
+
--_highlight: var(--adr-wc-highlight, color-mix(in srgb, var(--_accent) 8%, transparent));
|
|
10
|
+
--_radius: var(--adr-wc-radius, var(--radius-l, 0.75rem));
|
|
11
|
+
--_shadow: var(--adr-wc-shadow, var(--shadow-sm));
|
|
12
|
+
--_shadow-hover: var(--adr-wc-shadow-hover, var(--shadow-md));
|
|
13
|
+
--_duration: var(--adr-wc-duration, var(--duration-normal, 200ms));
|
|
14
|
+
--_ease: var(--adr-wc-ease, var(--ease-default, ease));
|
|
15
|
+
--_space-2xs: var(--adr-wc-space-2xs, var(--size-2xs, 0.25rem));
|
|
16
|
+
--_space-xs: var(--adr-wc-space-xs, var(--size-xs, 0.5rem));
|
|
17
|
+
--_space-s: var(--adr-wc-space-s, var(--size-s, 0.75rem));
|
|
18
|
+
--_space-m: var(--adr-wc-space-m, var(--size-m, 1rem));
|
|
19
|
+
--_font-xs: var(--adr-wc-font-xs, var(--font-size-xs, 0.75rem));
|
|
20
|
+
--_font-sm: var(--adr-wc-font-sm, var(--font-size-sm, 0.875rem));
|
|
21
|
+
--_font-md: var(--adr-wc-font-md, var(--font-size-md, 1rem));
|
|
22
|
+
--_font-lg: var(--adr-wc-font-lg, var(--font-size-lg, 1.125rem));
|
|
23
|
+
--_font-mono: var(--adr-wc-font-mono, var(--font-mono, ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace));
|
|
24
|
+
--_radius-s: var(--adr-wc-radius-s, var(--radius-s, 0.25rem));
|
|
25
|
+
--_radius-full: var(--adr-wc-radius-full, var(--radius-full, 9999px));
|
|
26
|
+
|
|
27
|
+
display: block;
|
|
28
|
+
font-family: var(--adr-wc-font, var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; }
|
|
32
|
+
|
|
33
|
+
/* \u2500\u2500 Card \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
34
|
+
.adr-card {
|
|
35
|
+
background: var(--_bg);
|
|
36
|
+
border: 1px solid var(--_border);
|
|
37
|
+
border-radius: var(--_radius);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
box-shadow: var(--_shadow);
|
|
40
|
+
transition: box-shadow var(--_duration) var(--_ease);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.adr-card:hover {
|
|
44
|
+
box-shadow: var(--_shadow-hover);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* \u2500\u2500 Header \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
48
|
+
.adr-header {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
padding: var(--_space-s) var(--_space-m);
|
|
53
|
+
background: var(--_card-bg);
|
|
54
|
+
border-block-end: 1px solid var(--_border);
|
|
55
|
+
gap: var(--_space-s);
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.adr-meta {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: var(--_space-xs);
|
|
63
|
+
flex-wrap: wrap;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.adr-id {
|
|
68
|
+
font-size: var(--_font-xs);
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
color: var(--_muted);
|
|
71
|
+
font-family: var(--_font-mono);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* \u2500\u2500 Status badge \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
75
|
+
.adr-badges {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: var(--_space-xs);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.adr-status {
|
|
82
|
+
font-size: 11px;
|
|
83
|
+
padding: 4px 10px;
|
|
84
|
+
border-radius: var(--_radius-full);
|
|
85
|
+
font-weight: 600;
|
|
86
|
+
text-transform: uppercase;
|
|
87
|
+
letter-spacing: 0.3px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* \u2500\u2500 Date (slotted <time>) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
91
|
+
.adr-date-wrap {
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
gap: 4px;
|
|
95
|
+
font-size: var(--_font-xs);
|
|
96
|
+
color: var(--_muted);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.adr-date-wrap svg {
|
|
100
|
+
width: 12px;
|
|
101
|
+
height: 12px;
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
::slotted([slot="date"]) {
|
|
106
|
+
font-size: var(--_font-xs);
|
|
107
|
+
font-family: var(--_font-mono);
|
|
108
|
+
color: var(--_muted);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* \u2500\u2500 Body \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
112
|
+
.adr-body {
|
|
113
|
+
padding: 16px 20px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* \u2500\u2500 Title (slotted heading) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
117
|
+
.adr-title-wrap {
|
|
118
|
+
margin-block-end: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
::slotted([slot="title"]) {
|
|
122
|
+
font-size: var(--_font-lg) !important;
|
|
123
|
+
font-weight: 700 !important;
|
|
124
|
+
color: var(--_text) !important;
|
|
125
|
+
line-height: 1.4 !important;
|
|
126
|
+
margin: 0 !important;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Fallback title when no slot content */
|
|
130
|
+
.adr-title-fallback {
|
|
131
|
+
font-size: var(--_font-lg);
|
|
132
|
+
font-weight: 700;
|
|
133
|
+
color: var(--_text);
|
|
134
|
+
line-height: 1.4;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* \u2500\u2500 Supersedes / Superseded-by links \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
138
|
+
.adr-links {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-wrap: wrap;
|
|
141
|
+
gap: 4px;
|
|
142
|
+
margin-block-start: var(--_space-s);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.adr-links-label {
|
|
146
|
+
font-size: 11px;
|
|
147
|
+
font-weight: 600;
|
|
148
|
+
color: var(--_muted);
|
|
149
|
+
text-transform: uppercase;
|
|
150
|
+
letter-spacing: 0.3px;
|
|
151
|
+
margin-inline-end: var(--_space-2xs);
|
|
152
|
+
align-self: center;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.adr-link {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: 3px;
|
|
159
|
+
font-size: 11px;
|
|
160
|
+
font-weight: 500;
|
|
161
|
+
padding: 2px 8px;
|
|
162
|
+
border-radius: var(--_radius-s);
|
|
163
|
+
background: var(--_highlight);
|
|
164
|
+
color: var(--_accent);
|
|
165
|
+
text-decoration: none;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.adr-link:hover {
|
|
169
|
+
text-decoration: underline;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.adr-link svg {
|
|
173
|
+
width: 11px;
|
|
174
|
+
height: 11px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* \u2500\u2500 Sections \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
178
|
+
.adr-sections {
|
|
179
|
+
border-block-start: 1px solid var(--_border);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.adr-section {
|
|
183
|
+
padding: 14px 20px;
|
|
184
|
+
border-block-end: 1px solid var(--_border);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.adr-section:last-child {
|
|
188
|
+
border-block-end: none;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.adr-section-header {
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
gap: var(--_space-xs);
|
|
195
|
+
margin-block-end: var(--_space-s);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.adr-section-icon {
|
|
199
|
+
width: 22px;
|
|
200
|
+
height: 22px;
|
|
201
|
+
border-radius: 5px;
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.adr-section-icon svg {
|
|
208
|
+
width: 13px;
|
|
209
|
+
height: 13px;
|
|
210
|
+
fill: white;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.adr-section-icon.context { background: #8b5cf6; }
|
|
214
|
+
.adr-section-icon.decision { background: #22c55e; }
|
|
215
|
+
.adr-section-icon.consequences { background: #f59e0b; }
|
|
216
|
+
|
|
217
|
+
.adr-section-title {
|
|
218
|
+
font-size: var(--_font-xs);
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
color: var(--_muted);
|
|
221
|
+
text-transform: uppercase;
|
|
222
|
+
letter-spacing: 0.5px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.adr-section-content {
|
|
226
|
+
color: var(--_text);
|
|
227
|
+
font-size: var(--_font-sm);
|
|
228
|
+
line-height: 1.6;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.adr-section-content ::slotted(ul),
|
|
232
|
+
.adr-section-content ::slotted(ol) {
|
|
233
|
+
margin: 0;
|
|
234
|
+
padding-inline-start: 20px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.adr-section-content ::slotted(p) {
|
|
238
|
+
margin: 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.slot-fallback {
|
|
242
|
+
color: var(--_muted);
|
|
243
|
+
font-style: italic;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* \u2500\u2500 Minimal detail \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
247
|
+
.adr-card--minimal {
|
|
248
|
+
padding: var(--_space-xs);
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.adr-card--minimal:hover {
|
|
253
|
+
box-shadow: var(--_shadow-hover);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.adr-card--minimal:focus-visible {
|
|
257
|
+
outline: 2px solid var(--_accent);
|
|
258
|
+
outline-offset: 2px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.adr-card--minimal .adr-header { display: none; }
|
|
262
|
+
.adr-card--minimal .adr-sections { display: none; }
|
|
263
|
+
.adr-card--minimal .adr-links { display: none; }
|
|
264
|
+
.adr-card--minimal .adr-date-wrap { display: none; }
|
|
265
|
+
|
|
266
|
+
.adr-card--minimal .adr-body {
|
|
267
|
+
padding: var(--_space-xs) var(--_space-s);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.adr-card--minimal .adr-title-fallback,
|
|
271
|
+
.adr-card--minimal ::slotted([slot="title"]) {
|
|
272
|
+
font-size: var(--_font-sm) !important;
|
|
273
|
+
font-weight: 600 !important;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.adr-card--minimal .adr-id {
|
|
277
|
+
display: block;
|
|
278
|
+
margin-block-end: var(--_space-2xs);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.adr-card--minimal .adr-status {
|
|
282
|
+
font-size: 10px;
|
|
283
|
+
padding: 2px 6px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* \u2500\u2500 Compact detail \u2014 hide empty sections \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
287
|
+
.adr-card--compact .adr-section[data-empty] {
|
|
288
|
+
display: none;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.adr-card--compact .slot-fallback {
|
|
292
|
+
display: none;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.adr-card--compact .adr-body {
|
|
296
|
+
padding: var(--_space-s) var(--_space-m);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* \u2500\u2500 Responsive \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
300
|
+
@media (max-width: 480px) {
|
|
301
|
+
.adr-header {
|
|
302
|
+
flex-direction: column;
|
|
303
|
+
align-items: flex-start;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.adr-badges {
|
|
307
|
+
width: 100%;
|
|
308
|
+
justify-content: flex-start;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
@media (prefers-reduced-motion: reduce) {
|
|
313
|
+
.adr-card {
|
|
314
|
+
transition: none;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@media print {
|
|
319
|
+
.adr-card {
|
|
320
|
+
box-shadow: none;
|
|
321
|
+
break-inside: avoid;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.state-msg { padding: var(--_space-m); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
326
|
+
.state-msg--error { color: #dc2626; }
|
|
327
|
+
`;var g=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function f(o,t,r={}){let e=r.priority??10,s={impl:t,bundle:r.bundle,contract:r.contract,priority:e},a=m.get(o);if(customElements.get(o)){if(!a||a.priority>=e){a&&a.priority===e&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=e){a.priority===e&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${a.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}m.set(o,s),customElements.define(o,t)}function i(o){return String(o).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function d(o){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${o}</svg>`}var p={user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',check:'<path d="M20 6 9 17l-5-5"/>',target:'<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',alertTriangle:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',messageCircle:'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',lightbulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',wrench:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',mapPin:'<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',checkCircle:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>'},y={says:{label:"Says",icon:p.messageCircle,color:"#3b82f6"},thinks:{label:"Thinks",icon:p.lightbulb,color:"#8b5cf6"},does:{label:"Does",icon:p.wrench,color:"#f59e0b"},feels:{label:"Feels",icon:p.heart,color:"#ef4444"}};var v={proposed:{label:"Proposed",color:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)"},accepted:{label:"Accepted",color:"#22c55e",bg:"rgba(34, 197, 94, 0.1)"},deprecated:{label:"Deprecated",color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)"},superseded:{label:"Superseded",color:"#6b7280",bg:"rgba(107, 114, 128, 0.1)"}},n={calendar:'<rect width="18" height="18" x="3" y="4" rx="2" ry="2"/><line x1="16" x2="16" y1="2" y2="6"/><line x1="8" x2="8" y1="2" y2="6"/><line x1="3" x2="21" y1="10" y2="10"/>',context:'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/>',decision:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/>',consequences:'<path d="m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"/><path d="m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"/><path d="M7 21h10"/><path d="M12 3v18"/><path d="M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2"/>',arrowRight:'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>'},h=class extends HTMLElement{static get observedAttributes(){return["adr-id","status","supersedes","superseded-by","detail","compact","src"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"})}#a(){for(let t of[...this.children]){let r=t.getAttribute("slot");r&&this.#e.set(r,t.textContent.trim())}}connectedCallback(){this.#a(),this.adrId&&!this.id&&(this.id=this.adrId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#t(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t,r,e){r!==e&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(e):this.#t())}get adrId(){return this.getAttribute("adr-id")||""}get status(){return this.getAttribute("status")||"proposed"}get adrTitle(){return this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||""}get adrDate(){let t=this.querySelector('[slot="date"]');return t?.getAttribute("datetime")||t?.textContent?.trim()||this.#e.get("date")||""}get supersedes(){let t=this.getAttribute("supersedes")||"";return t?t.split(",").map(r=>r.trim()).filter(Boolean):[]}get supersededBy(){let t=this.getAttribute("superseded-by")||"";return t?t.split(",").map(r=>r.trim()).filter(Boolean):[]}get _detailLevel(){return this.getAttribute("detail")?this.getAttribute("detail"):this.hasAttribute("compact")?"compact":"full"}get _minimalLabel(){return this.adrTitle||this.adrId||"ADR"}async _loadSrc(t){if(t){this.shadowRoot.innerHTML=`<style>${c}</style><div class="state-msg">Loading\u2026</div>`;try{let r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}`);let e=await r.json();if(e.adrId!=null&&this.setAttribute("adr-id",String(e.adrId)),e.status!=null&&this.setAttribute("status",String(e.status)),e.detail!=null&&this.setAttribute("detail",String(e.detail)),e.supersedes&&this.setAttribute("supersedes",Array.isArray(e.supersedes)?e.supersedes.join(","):e.supersedes),e.supersededBy&&this.setAttribute("superseded-by",Array.isArray(e.supersededBy)?e.supersededBy.join(","):e.supersededBy),e.title&&!this.querySelector('[slot="title"]')){let s=document.createElement("h3");s.slot="title",s.textContent=e.title,this.appendChild(s)}if(e.date&&!this.querySelector('[slot="date"]')){let s=document.createElement("time");s.slot="date",s.setAttribute("datetime",e.date),s.textContent=new Date(e.date).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),this.appendChild(s)}for(let s of["context","decision"])if(e[s]&&!this.querySelector(`[slot="${s}"]`)){let a=document.createElement("p");a.slot=s,a.textContent=e[s],this.appendChild(a)}if(e.consequences&&!this.querySelector('[slot="consequences"]')){let s=document.createElement("ul");s.slot="consequences";let a=Array.isArray(e.consequences)?e.consequences:[e.consequences];for(let l of a){let u=document.createElement("li");u.textContent=l,s.appendChild(u)}this.appendChild(s)}this.#a(),this.#t()}catch(r){this.shadowRoot.innerHTML=`<style>${c}</style><div class="state-msg state-msg--error">Could not load: ${i(r.message)}</div>`}}}#t(){let t=v[this.status]||v.proposed,r=this._detailLevel,e=this.adrId?`ADR: ${i(this.adrId)}`:"Architectural Decision Record",s=!!this.querySelector('[slot="date"]')||this.#e.has("date");if(r==="minimal"){this.shadowRoot.innerHTML=`<style>${c}</style>
|
|
328
|
+
<article class="adr-card adr-card--minimal" role="article" aria-label="${e}"
|
|
329
|
+
tabindex="0">
|
|
330
|
+
<div class="adr-body">
|
|
331
|
+
<div class="adr-meta">
|
|
332
|
+
${this.adrId?`<span class="adr-id">${i(this.adrId)}</span>`:""}
|
|
333
|
+
<span class="adr-status" style="color:${t.color};background:${t.bg}">${i(t.label)}</span>
|
|
334
|
+
</div>
|
|
335
|
+
<div class="adr-title-wrap">
|
|
336
|
+
<slot name="title"><span class="adr-title-fallback">${i(this._minimalLabel)}</span></slot>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</article>`;return}if(this.shadowRoot.innerHTML=`<style>${c}</style>
|
|
340
|
+
<article class="adr-card adr-card--${r}" role="article" aria-label="${e}">
|
|
341
|
+
|
|
342
|
+
<header class="adr-header">
|
|
343
|
+
<div class="adr-meta">
|
|
344
|
+
${this.adrId?`<span class="adr-id">${i(this.adrId)}</span>`:""}
|
|
345
|
+
${s?`<span class="adr-date-wrap">${d(n.calendar)} <slot name="date"></slot></span>`:""}
|
|
346
|
+
</div>
|
|
347
|
+
<div class="adr-badges">
|
|
348
|
+
<span class="adr-status" style="color:${t.color};background:${t.bg}">${i(t.label)}</span>
|
|
349
|
+
</div>
|
|
350
|
+
</header>
|
|
351
|
+
|
|
352
|
+
<div class="adr-body">
|
|
353
|
+
<div class="adr-title-wrap">
|
|
354
|
+
<slot name="title"><span class="adr-title-fallback">[Untitled ADR]</span></slot>
|
|
355
|
+
</div>
|
|
356
|
+
|
|
357
|
+
${this.supersedes.length?`
|
|
358
|
+
<div class="adr-links">
|
|
359
|
+
<span class="adr-links-label">Supersedes</span>
|
|
360
|
+
${this.supersedes.map(a=>`<a class="adr-link" href="#${i(a)}">${d(n.arrowRight)} ${i(a)}</a>`).join("")}
|
|
361
|
+
</div>`:""}
|
|
362
|
+
|
|
363
|
+
${this.supersededBy.length?`
|
|
364
|
+
<div class="adr-links">
|
|
365
|
+
<span class="adr-links-label">Superseded by</span>
|
|
366
|
+
${this.supersededBy.map(a=>`<a class="adr-link" href="#${i(a)}">${d(n.arrowRight)} ${i(a)}</a>`).join("")}
|
|
367
|
+
</div>`:""}
|
|
368
|
+
</div>
|
|
369
|
+
|
|
370
|
+
<div class="adr-sections">
|
|
371
|
+
<div class="adr-section">
|
|
372
|
+
<div class="adr-section-header">
|
|
373
|
+
<div class="adr-section-icon context">${d(n.context)}</div>
|
|
374
|
+
<span class="adr-section-title">Context</span>
|
|
375
|
+
</div>
|
|
376
|
+
<div class="adr-section-content">
|
|
377
|
+
<slot name="context"><em class="slot-fallback">No context provided.</em></slot>
|
|
378
|
+
</div>
|
|
379
|
+
</div>
|
|
380
|
+
|
|
381
|
+
<div class="adr-section">
|
|
382
|
+
<div class="adr-section-header">
|
|
383
|
+
<div class="adr-section-icon decision">${d(n.decision)}</div>
|
|
384
|
+
<span class="adr-section-title">Decision</span>
|
|
385
|
+
</div>
|
|
386
|
+
<div class="adr-section-content">
|
|
387
|
+
<slot name="decision"><em class="slot-fallback">No decision recorded.</em></slot>
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
|
|
391
|
+
<div class="adr-section">
|
|
392
|
+
<div class="adr-section-header">
|
|
393
|
+
<div class="adr-section-icon consequences">${d(n.consequences)}</div>
|
|
394
|
+
<span class="adr-section-title">Consequences</span>
|
|
395
|
+
</div>
|
|
396
|
+
<div class="adr-section-content">
|
|
397
|
+
<slot name="consequences"><em class="slot-fallback">No consequences documented.</em></slot>
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
</article>`,r==="compact")for(let a of this.shadowRoot.querySelectorAll(".adr-section")){let l=a.querySelector("slot");l&&l.assignedNodes().length===0&&a.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("adr-wc:ready",{detail:{adrId:this.adrId,title:this.adrTitle,status:this.status},bubbles:!0,composed:!0}))}};f("adr-wc",h);export{h as AdrWc};
|
|
403
|
+
//# sourceMappingURL=adr-wc.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var _=window.matchMedia("(prefers-reduced-motion: reduce)");var I=new Map;function B(a,e,s={}){let r=s.priority??10,n={impl:e,bundle:s.bundle,contract:s.contract,priority:r},t=I.get(a);if(customElements.get(a)){if(!t||t.priority>=r){t&&t.priority===r&&t.impl!==e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${t.bundle}" (priority ${t.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${t.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(t&&t.priority>=r){t.priority===r&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${t.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}I.set(a,n),customElements.define(a,e)}var k=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,s,r,n){e.addEventListener(s,r,n),this.#t.push(()=>e.removeEventListener(s,r,n))}setup(){}teardown(){}};function M(a){let e=a.getFullYear(),s=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${e}-${s}-${r}`}function x(a){if(!a)return null;let[e,s,r]=a.split("-").map(Number);return new Date(e,s-1,r)}function O(a,e){return new Date(a,e+1,0).getDate()}function w(a,e){return a&&e&&a.getFullYear()===e.getFullYear()&&a.getMonth()===e.getMonth()&&a.getDate()===e.getDate()}function q(){try{let a=new Intl.Locale(navigator.language);if(a.weekInfo)return a.weekInfo.firstDay%7}catch{}return 0}function Y(a){return a?typeof a=="string"?[{label:a}]:Array.isArray(a)?a:typeof a=="object"?[a]:[]:[]}var H=["Su","Mo","Tu","We","Th","Fr","Sa"],P=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],z=Array.from({length:24},(a,e)=>{let s=e%12||12,r=e<12?"AM":"PM";return`${s}:00 ${r}`}),L=class extends k{#t;#e;#b;#f={};#C=new Set;#g=new Map;#y=null;#a=null;#s=null;#d=null;#i="none";#w="default";#E;#l;#h;#r;#n;#o;#c;#u=null;setup(){let e=new Date;this.#t=parseInt(this.getAttribute("data-month"),10)-1,isNaN(this.#t)&&(this.#t=e.getMonth()),this.#e=parseInt(this.getAttribute("data-year"),10),isNaN(this.#e)&&(this.#e=e.getFullYear()),this.#b=q(),this.#i=this.getAttribute("data-selection")||"none",this.#w=this.getAttribute("data-size")||"default";let s=this.getAttribute("data-events");if(s)try{this.#f=JSON.parse(s)}catch{}let r=this.getAttribute("data-disabled-dates");r&&r.split(",").forEach(t=>this.#C.add(t.trim()));let n=this.getAttribute("data-highlight-dates");n&&n.split(",").forEach(t=>{let[u,i]=t.trim().split(":");this.#g.set(u,i||null)}),this.#S(),this.#m()}#S(){this.#E=document.createElement("header"),this.#o=document.createElement("button"),this.#o.type="button",this.#o.setAttribute("aria-label","Previous month"),this.#o.textContent="\u2039",this.listen(this.#o,"click",()=>this.#v(-1)),this.#l=document.createElement("span"),this.#l.className="calendar-title",this.#l.setAttribute("aria-live","polite"),this.#h=document.createElement("span"),this.#h.className="calendar-month",this.#r=document.createElement("select"),this.#r.className="calendar-year",this.#r.setAttribute("aria-label","Year"),this.listen(this.#r,"change",()=>{this.#e=parseInt(this.#r.value,10),this.#m(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#e,month:this.#t+1}}))});let e=document.createElement("span");e.className="calendar-year-wrap",e.appendChild(this.#r),this.#l.append(this.#h," ",e),this.#c=document.createElement("button"),this.#c.type="button",this.#c.setAttribute("aria-label","Next month"),this.#c.textContent="\u203A",this.listen(this.#c,"click",()=>this.#v(1)),this.#E.append(this.#o,this.#l,this.#c),this.appendChild(this.#E);let s=document.createElement("div");s.className="calendar-banner",s.setAttribute("aria-hidden","true"),this.appendChild(s),this.#n=document.createElement("table"),this.#n.setAttribute("role","grid");let r=document.createElement("thead"),n=document.createElement("tr");for(let t=0;t<7;t++){let u=(this.#b+t)%7,i=document.createElement("th");i.setAttribute("scope","col"),i.setAttribute("abbr",P[u]),i.textContent=H[u],n.appendChild(i)}r.appendChild(n),this.#n.appendChild(r),this.appendChild(this.#n),this.listen(this.#n,"keydown",t=>this.#k(t)),this.listen(this.#n,"click",t=>{let u=t.target.closest("button[data-date]");if(!u||u.disabled)return;let i=u.getAttribute("data-date");if(this.#i!=="none")this.#D(i);else{let E=Y(this.#f[i]);E.length&&this.#N(i,E)}}),this.#i==="range"&&this.listen(this.#n,"mouseover",t=>{let u=t.target.closest("button[data-date]");u&&this.#a&&!this.#s&&(this.#d=x(u.getAttribute("data-date")),this.#A())})}#x(){this.#r.innerHTML="";let e=new Date().getFullYear(),s=e-10,r=e+10;for(let n=s;n<=r;n++){let t=document.createElement("option");t.value=n,t.textContent=n,n===this.#e&&(t.selected=!0),this.#r.appendChild(t)}}#v(e){this.#t+=e,this.#t<0&&(this.#t=11,this.#e--),this.#t>11&&(this.#t=0,this.#e++),this.#m(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#e,month:this.#t+1}}))}#D(e){if(this.#i==="none")return;let s=x(e);this.#i==="single"?(this.#y=s,this.#A(),this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{value:e,date:s}}))):this.#i==="range"&&(!this.#a||this.#s?(this.#a=s,this.#s=null,this.#d=null):(this.#s=s,this.#a>this.#s&&([this.#a,this.#s]=[this.#s,this.#a]),this.#d=null,this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{start:M(this.#a),end:M(this.#s),startDate:this.#a,endDate:this.#s}}))),this.#A())}#A(){let e=this.#n.querySelector("tbody");if(!e)return;let s=this.#a,r=this.#s||this.#d;for(let n of e.querySelectorAll("td")){let t=n.querySelector("button[data-date]");if(!t)continue;let u=t.getAttribute("data-date"),i=x(u);if(n.removeAttribute("data-selected"),n.removeAttribute("data-range-start"),n.removeAttribute("data-range-end"),n.removeAttribute("data-in-range"),t.removeAttribute("aria-selected"),this.#i==="single"&&w(i,this.#y)&&(n.setAttribute("data-selected",""),t.setAttribute("aria-selected","true")),this.#i==="range"&&s)if(r){let E=s<r?s:r,A=s<r?r:s;w(i,E)&&n.setAttribute("data-range-start",""),w(i,A)&&n.setAttribute("data-range-end",""),i>=E&&i<=A&&n.setAttribute("data-in-range","")}else w(i,s)&&n.setAttribute("data-range-start","")}}#m(){let e=new Date,s=O(this.#e,this.#t),r=this.#w==="large";try{let c=new Date(this.#e,this.#t,1),l=new Intl.DateTimeFormat(void 0,{month:"long"}).format(c);this.#h.textContent=l,this.#n.setAttribute("aria-label",`${l} ${this.#e}`)}catch{this.#h.textContent=String(this.#t+1)}this.#x(),this.setAttribute("data-month",String(this.#t+1)),this.setAttribute("data-year",String(this.#e));let n=this.#n.querySelector("tbody");n&&n.remove();let t=document.createElement("tbody"),u=1,i=document.createElement("tr");i.setAttribute("data-week",String(u));let A=(new Date(this.#e,this.#t,1).getDay()-this.#b+7)%7,N=O(this.#e,this.#t-1);for(let c=0;c<A;c++){let l=N-A+1+c,h=document.createElement("td");h.setAttribute("data-outside-month","");let o=document.createElement("button");o.type="button",o.disabled=!0,o.setAttribute("tabindex","-1"),o.setAttribute("data-day",String(l));let m=document.createElement("span");m.className="day-number",m.textContent=String(l),o.appendChild(m),h.appendChild(o),i.appendChild(h)}let d=this.#a,b=this.#s||this.#d;for(let c=1;c<=s;c++){let l=new Date(this.#e,this.#t,c),h=M(l),o=document.createElement("td"),m=document.createElement("button");m.type="button",m.setAttribute("data-date",h);let S=document.createElement("span");if(S.className="day-number",S.textContent=String(c),m.appendChild(S),m.setAttribute("data-day",String(c)),w(l,e)&&(m.setAttribute("aria-current","date"),o.setAttribute("data-today","")),this.#i==="single"&&w(l,this.#y)&&(m.setAttribute("aria-selected","true"),o.setAttribute("data-selected","")),this.#i==="range"&&d&&b){let C=d<b?d:b,p=d<b?b:d;w(l,C)&&o.setAttribute("data-range-start",""),w(l,p)&&o.setAttribute("data-range-end",""),l>=C&&l<=p&&o.setAttribute("data-in-range","")}else this.#i==="range"&&d&&w(l,d)&&o.setAttribute("data-range-start","");this.#C.has(h)&&(m.setAttribute("aria-disabled","true"),m.disabled=!0),this.#g.has(h)&&m.setAttribute("data-highlight",this.#g.get(h)||"");let y=Y(this.#f[h]);if(y.length){if(o.setAttribute("data-events",""),o.setAttribute("data-event-count",String(y.length)),r){let p=document.createElement("span");p.className="event-list";let v=2;if(y.slice(0,v).forEach(f=>{let D=document.createElement("span");if(D.className="event-item",f.color&&D.style.setProperty("--event-color",f.color),f.icon){let $=document.createElement("icon-wc");$.setAttribute("name",f.icon),$.setAttribute("size","xs"),D.appendChild($)}let T=document.createElement("span");T.textContent=f.time?`${f.time} ${f.label}`:f.label,D.appendChild(T),p.appendChild(D)}),y.length>v){let f=document.createElement("span");f.className="event-more",f.textContent=`+${y.length-v} more`,p.appendChild(f)}m.appendChild(p)}else{let p=document.createElement("span");p.className="event-dots",p.setAttribute("aria-hidden","true");let v=Math.min(y.length,3);for(let f=0;f<v;f++){let D=document.createElement("span");D.setAttribute("data-event-dot",""),y[f].color&&D.style.setProperty("--event-color",y[f].color),p.appendChild(D)}o.appendChild(p)}let C=y.map(p=>p.time?`${p.time} \u2014 ${p.label}`:p.label);m.setAttribute("title",C.join(`
|
|
2
|
-
`))}let
|
|
1
|
+
var G=window.matchMedia("(prefers-reduced-motion: reduce)");var V=new Map;function z(a,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=V.get(a);if(customElements.get(a)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}V.set(a,n),customElements.define(a,t)}var Y=class extends HTMLElement{#h=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#h)t();this.#h=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#h.push(()=>t.removeEventListener(e,i,n))}setup(){}teardown(){}};function M(a){let t=a.getFullYear(),e=String(a.getMonth()+1).padStart(2,"0"),i=String(a.getDate()).padStart(2,"0");return`${t}-${e}-${i}`}function k(a){if(!a)return null;let[t,e,i]=a.split("-").map(Number);return new Date(t,e-1,i)}function _(a,t){return new Date(a,t+1,0).getDate()}function w(a,t){return a&&t&&a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()}function J(){try{let a=new Intl.Locale(navigator.language);if(a.weekInfo)return a.weekInfo.firstDay%7}catch{}return 0}function j(a){return a?typeof a=="string"?[{label:a}]:Array.isArray(a)?a:typeof a=="object"?[a]:[]:[]}var O=new Map;function H(a,t="short"){let e=`${a}:${t}`;if(O.has(e))return O.get(e);let i=new Intl.DateTimeFormat(a,{weekday:t}),n=Array.from({length:7},(s,r)=>i.format(new Date(2026,0,4+r)));return O.set(e,n),n}var B=class extends Y{static formAssociated=!0;#h;#b;#e;#t;#x;#S={};#r=null;#o=null;#F=new Set;#M=new Map;#g=null;#l=new Set;#n=null;#a=null;#y=null;#s="none";#I="default";#N=1;#Y=null;get isDateDisallowed(){return this.#Y}set isDateDisallowed(t){this.#Y=t,this.#w&&this.#p()}#L=null;get getDayParts(){return this.#L}set getDayParts(t){this.#L=t,this.#w&&this.#p()}#w=!1;#k;#A;#u;#c;#d;#q;#i;#m;#f;#D=null;constructor(){super(),typeof this.attachInternals=="function"&&(this.#h=this.attachInternals())}setup(){this.#b=this.closest("[lang]")?.lang||navigator.language;let t=new Date;this.#e=parseInt(this.getAttribute("data-month"),10)-1,isNaN(this.#e)&&(this.#e=t.getMonth()),this.#t=parseInt(this.getAttribute("data-year"),10),isNaN(this.#t)&&(this.#t=t.getFullYear()),this.#x=J(),this.#s=this.getAttribute("data-selection")||"none",this.#I=this.getAttribute("data-size")||"default",this.#N=Math.max(1,Math.min(12,parseInt(this.dataset.months,10)||1));let e=this.getAttribute("data-events");if(e)try{this.#S=JSON.parse(e)}catch{}this.#r=k(this.dataset.minDate),this.#o=k(this.dataset.maxDate);let i=this.getAttribute("data-disabled-dates");i&&i.split(",").forEach(s=>this.#F.add(s.trim()));let n=this.getAttribute("data-highlight-dates");n&&n.split(",").forEach(s=>{let[r,c]=s.trim().split(":");this.#M.set(r,c||null)}),this.#P(),this.#p(),this.#w=!0}refresh(){this.#w&&this.#p()}#P(){this.#k=document.createElement("header"),this.#m=document.createElement("button"),this.#m.type="button",this.#m.setAttribute("aria-label","Previous month"),this.#m.textContent="\u2039",this.listen(this.#m,"click",()=>this.#T(-1)),this.#A=document.createElement("span"),this.#A.className="calendar-title",this.#A.setAttribute("aria-live","polite"),this.#u=document.createElement("span"),this.#u.className="calendar-month",this.#c=document.createElement("select"),this.#c.className="calendar-year",this.#c.setAttribute("aria-label","Year"),this.listen(this.#c,"change",()=>{this.#t=parseInt(this.#c.value,10),this.#p(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#t,month:this.#e+1}}))}),this.#d=document.createElement("span"),this.#d.className="calendar-year-wrap",this.#d.appendChild(this.#c),this.#A.append(this.#u," ",this.#d),this.#f=document.createElement("button"),this.#f.type="button",this.#f.setAttribute("aria-label","Next month"),this.#f.textContent="\u203A",this.listen(this.#f,"click",()=>this.#T(1)),this.#k.append(this.#m,this.#A,this.#f),this.appendChild(this.#k);let t=document.createElement("div");t.className="calendar-banner",t.setAttribute("aria-hidden","true"),this.appendChild(t),this.#i=document.createElement("div"),this.#i.className="cal-months",this.appendChild(this.#i),this.listen(this.#i,"click",e=>{let i=e.target.closest("button[data-date]");if(!i||i.disabled)return;let n=i.getAttribute("data-date");if(this.#s!=="none")this.#O(n);else{let s=j(this.#S[n]);s.length&&this.#z(n,s)}}),this.listen(this.#i,"keydown",e=>this.#_(e)),this.#s==="range"&&this.listen(this.#i,"mouseover",e=>{let i=e.target.closest("button[data-date]");i&&this.#n&&!this.#a&&(this.#y=k(i.getAttribute("data-date")),this.#C())})}#V(){this.#c.innerHTML="";let t=new Date().getFullYear(),e=this.#r?this.#r.getFullYear():t-10,i=this.#o?this.#o.getFullYear():t+10;for(let n=e;n<=i;n++){let s=document.createElement("option");s.value=n,s.textContent=n,n===this.#t&&(s.selected=!0),this.#c.appendChild(s)}}#T(t){this.#e+=t,this.#e<0&&(this.#e=11,this.#t--),this.#e>11&&(this.#e=0,this.#t++),this.#p(),this.dispatchEvent(new CustomEvent("calendar:navigate",{bubbles:!0,detail:{year:this.#t,month:this.#e+1}}))}#O(t){if(this.#s==="none")return;let e=k(t);if(this.#s==="single")this.#g=e,this.#C(),this.#$(),this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{value:t,date:e}}));else if(this.#s==="range"){if(!this.#n||this.#a)this.#n=e,this.#a=null,this.#y=null,this.dataset.tentative=M(this.#n);else{this.#a=e,this.#n>this.#a&&([this.#n,this.#a]=[this.#a,this.#n]),this.#y=null,delete this.dataset.tentative;let i=M(this.#n),n=M(this.#a);this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{value:`${i}/${n}`,start:i,end:n,startDate:this.#n,endDate:this.#a}}))}this.#C(),this.#$()}else if(this.#s==="multi"){this.#l.has(t)?this.#l.delete(t):this.#l.add(t),this.#C(),this.#$();let i=[...this.#l].sort();this.dispatchEvent(new CustomEvent("calendar:select",{bubbles:!0,detail:{values:i,dates:i.map(k)}}))}}#$(){this.#h&&this.getAttribute("name")&&this.#h.setFormValue(this.value)}get value(){switch(this.#s){case"single":return this.#g?M(this.#g):null;case"range":return this.#n&&this.#a?`${M(this.#n)}/${M(this.#a)}`:this.#n?M(this.#n):null;case"multi":return this.#l.size?[...this.#l].sort().join(" "):null;default:return null}}#C(){if(!this.#i)return;let t=this.#n,e=this.#a||this.#y;for(let i of this.#i.querySelectorAll("td")){let n=i.querySelector("button[data-date]");if(!n)continue;let s=n.getAttribute("data-date"),r=k(s);if(i.removeAttribute("data-selected"),i.removeAttribute("data-range-start"),i.removeAttribute("data-range-end"),i.removeAttribute("data-in-range"),n.removeAttribute("aria-selected"),this.#s==="single"&&w(r,this.#g)&&(i.setAttribute("data-selected",""),n.setAttribute("aria-selected","true")),this.#s==="multi"&&this.#l.has(s)&&(i.setAttribute("data-selected",""),n.setAttribute("aria-selected","true")),this.#s==="range"&&t)if(e){let c=t<e?t:e,b=t<e?e:t;w(r,c)&&i.setAttribute("data-range-start",""),w(r,b)&&i.setAttribute("data-range-end",""),r>=c&&r<=b&&i.setAttribute("data-in-range","")}else w(r,t)&&i.setAttribute("data-range-start","")}}#v(t){let e=new Date(this.#t,this.#e+t,1);return{year:e.getFullYear(),month:e.getMonth()}}#p(){let t=this.#N,e=new Intl.DateTimeFormat(this.#b,{month:"long"}),i=new Intl.DateTimeFormat(this.#b,{month:"long",year:"numeric"});try{let s=new Date(this.#t,this.#e,1);if(t===1)this.#u.textContent=e.format(s),this.#d&&(this.#d.style.display="");else{let r=this.#v(t-1);s.getFullYear()===r.year?this.#u.textContent=String(this.#t):this.#u.textContent=`${s.getFullYear()} \u2013 ${r.year}`,this.#d&&(this.#d.style.display="none")}}catch{this.#u.textContent=String(this.#e+1)}this.#V(),this.#m.disabled=!!(this.#r&&(this.#t<this.#r.getFullYear()||this.#t===this.#r.getFullYear()&&this.#e<=this.#r.getMonth()));let n=this.#v(t-1);this.#f.disabled=!!(this.#o&&(n.year>this.#o.getFullYear()||n.year===this.#o.getFullYear()&&n.month>=this.#o.getMonth())),this.setAttribute("data-month",String(this.#e+1)),this.setAttribute("data-year",String(this.#t)),this.#i.innerHTML="";for(let s=0;s<t;s++){let{year:r,month:c}=this.#v(s);if(t>1){let b=document.createElement("div");b.className="cal-month-column";let D=document.createElement("h4");D.className="cal-month-title",D.textContent=i.format(new Date(r,c,1)),b.appendChild(D);let N=this.#B(r,c);b.appendChild(N),this.#i.appendChild(b)}else{let b=this.#B(r,c);this.#i.appendChild(b)}}this.#q=this.#i.querySelector("table")}#B(t,e){let i=new Date,n=_(t,e),s=this.#I==="large",r=document.createElement("table");r.setAttribute("role","grid");try{let u=new Date(t,e,1),o=new Intl.DateTimeFormat(void 0,{month:"long"}).format(u);r.setAttribute("aria-label",`${o} ${t}`)}catch{}let c=document.createElement("thead"),b=document.createElement("tr"),D=H(this.#b,"short"),N=H(this.#b,"long");for(let u=0;u<7;u++){let o=(this.#x+u)%7,m=document.createElement("th");m.setAttribute("scope","col"),m.setAttribute("abbr",N[o]),m.textContent=D[o],b.appendChild(m)}c.appendChild(b),r.appendChild(c);let d=document.createElement("tbody"),A=1,h=document.createElement("tr");h.setAttribute("data-week",String(A));let f=(new Date(t,e,1).getDay()-this.#x+7)%7,$=_(t,e-1);for(let u=0;u<f;u++){let o=$-f+1+u,m=document.createElement("td");m.setAttribute("data-outside-month","");let l=document.createElement("button");l.type="button",l.disabled=!0,l.setAttribute("tabindex","-1"),l.setAttribute("data-day",String(o));let p=document.createElement("span");p.className="day-number",p.textContent=String(o),l.appendChild(p),m.appendChild(l),h.appendChild(m)}let E=this.#n,F=this.#a||this.#y;for(let u=1;u<=n;u++){let o=new Date(t,e,u),m=M(o),l=document.createElement("td"),p=document.createElement("button");p.type="button",p.setAttribute("data-date",m);let L=document.createElement("span");if(L.className="day-number",L.textContent=String(u),p.appendChild(L),p.setAttribute("data-day",String(u)),w(o,i)&&(p.setAttribute("aria-current","date"),l.setAttribute("data-today","")),this.#s==="single"&&w(o,this.#g)&&(p.setAttribute("aria-selected","true"),l.setAttribute("data-selected","")),this.#s==="multi"&&this.#l.has(m)&&(p.setAttribute("aria-selected","true"),l.setAttribute("data-selected","")),this.#s==="range"&&E&&F){let x=E<F?E:F,g=E<F?F:E;w(o,x)&&l.setAttribute("data-range-start",""),w(o,g)&&l.setAttribute("data-range-end",""),o>=x&&o<=g&&l.setAttribute("data-in-range","")}else this.#s==="range"&&E&&w(o,E)&&l.setAttribute("data-range-start","");let W=this.#r&&o<this.#r,K=this.#o&&o>this.#o,R=typeof this.isDateDisallowed=="function"&&this.isDateDisallowed(o);if((this.#F.has(m)||W||K||R)&&(p.setAttribute("aria-disabled","true"),p.disabled=!0),this.#M.has(m)&&p.setAttribute("data-highlight",this.#M.get(m)||""),typeof this.getDayParts=="function"){let x=this.getDayParts(o);x!=null&&(l.dataset.dayPart=Array.isArray(x)?x.join(" "):x)}let v=j(this.#S[m]);if(v.length){if(l.setAttribute("data-events",""),l.setAttribute("data-event-count",String(v.length)),s){let g=document.createElement("span");g.className="event-list";let I=2;if(v.slice(0,I).forEach(y=>{let S=document.createElement("span");if(S.className="event-item",y.color&&S.style.setProperty("--event-color",y.color),y.icon){let T=document.createElement("icon-wc");T.setAttribute("name",y.icon),T.setAttribute("size","xs"),S.appendChild(T)}let P=document.createElement("span");P.textContent=y.time?`${y.time} ${y.label}`:y.label,S.appendChild(P),g.appendChild(S)}),v.length>I){let y=document.createElement("span");y.className="event-more",y.textContent=`+${v.length-I} more`,g.appendChild(y)}p.appendChild(g)}else{let g=document.createElement("span");g.className="event-dots",g.setAttribute("aria-hidden","true");let I=Math.min(v.length,3);for(let y=0;y<I;y++){let S=document.createElement("span");S.setAttribute("data-event-dot",""),v[y].color&&S.style.setProperty("--event-color",v[y].color),g.appendChild(S)}l.appendChild(g)}let x=v.map(g=>g.time?`${g.time} \u2014 ${g.label}`:g.label);p.setAttribute("title",x.join(`
|
|
2
|
+
`))}let U=u===1||w(o,i);p.setAttribute("tabindex",U?"0":"-1"),l.insertBefore(p,l.firstChild),h.appendChild(l),(f+u)%7===0&&(d.appendChild(h),A++,h=document.createElement("tr"),h.setAttribute("data-week",String(A)))}let q=(f+n)%7;if(q>0){for(let u=1;u<=7-q;u++){let o=document.createElement("td");o.setAttribute("data-outside-month","");let m=document.createElement("button");m.type="button",m.disabled=!0,m.setAttribute("tabindex","-1"),m.setAttribute("data-day",String(u));let l=document.createElement("span");l.className="day-number",l.textContent=String(u),m.appendChild(l),o.appendChild(m),h.appendChild(o)}d.appendChild(h)}return r.appendChild(d),r}#z(t,e){this.#E();let i=k(t),n=document.createElement("div");n.className="day-detail",n.setAttribute("role","dialog"),n.setAttribute("aria-label",`Events for ${t}`);let s=document.createElement("header"),r=document.createElement("h3");try{r.textContent=new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(i)}catch{r.textContent=t}let c=document.createElement("button");if(c.type="button",c.setAttribute("aria-label","Close"),c.textContent="\xD7",c.addEventListener("click",()=>this.#E()),s.append(r,c),n.appendChild(s),e.some(d=>d.time)){let d=document.createElement("day-view");d.dataset.date=t,d.dataset.startHour="auto",d.dataset.compact="";let A=new Intl.DateTimeFormat(this.#b,{hour:"numeric",minute:"2-digit"});e.forEach(h=>{let C=document.createElement("calendar-event");if(h.color&&C.style.setProperty("--event-color",h.color),h.icon){let f=document.createElement("icon-wc");f.setAttribute("name",h.icon),f.setAttribute("size","sm"),C.appendChild(f)}if(h.time){let f=document.createElement("time");f.setAttribute("datetime",h.time);try{let[$,E]=h.time.split(":"),F=new Date(2026,0,1,parseInt($,10),parseInt(E,10));f.textContent=A.format(F)}catch{f.textContent=h.time}C.appendChild(f)}C.append(h.label||""),d.appendChild(C)}),n.appendChild(d)}else{let d=document.createElement("ul");d.className="detail-list",e.forEach(A=>{let h=document.createElement("li");A.color&&h.style.setProperty("--event-color",A.color);let C=document.createElement("span");C.className="detail-dot";let f=document.createElement("span");if(f.className="detail-content",A.icon){let E=document.createElement("icon-wc");E.setAttribute("name",A.icon),E.setAttribute("size","sm"),f.appendChild(E)}let $=document.createElement("span");$.className="detail-label",$.textContent=A.label||"",f.append($),h.append(C,f),d.appendChild(h)}),n.appendChild(d)}this.appendChild(n),this.#D=n;let D=d=>{d.key==="Escape"&&this.#E()},N=d=>{n.contains(d.target)||this.#E()};this._detailCleanup=()=>{document.removeEventListener("keydown",D),document.removeEventListener("mousedown",N)},document.addEventListener("keydown",D),requestAnimationFrame(()=>{document.addEventListener("mousedown",N)}),this.dispatchEvent(new CustomEvent("calendar:day-open",{bubbles:!0,detail:{date:t,events:e}}))}#E(){this.#D&&(this._detailCleanup?.(),this._detailCleanup=null,this.#D.remove(),this.#D=null)}teardown(){delete this.dataset.tentative,this.#E()}#_(t){let e=this.#i.querySelector('button[tabindex="0"]');if(!e)return;let i=e.getAttribute("data-date"),n=k(i);if(!n)return;let s;switch(t.key){case"ArrowRight":s=new Date(n),s.setDate(n.getDate()+1);break;case"ArrowLeft":s=new Date(n),s.setDate(n.getDate()-1);break;case"ArrowDown":s=new Date(n),s.setDate(n.getDate()+7);break;case"ArrowUp":s=new Date(n),s.setDate(n.getDate()-7);break;case"Enter":case" ":t.preventDefault(),e.disabled||this.#O(i);return;default:return}if(t.preventDefault(),this.#r&&s<this.#r||this.#o&&s>this.#o)return;let r=s.getMonth(),c=s.getFullYear(),b=this.#v(this.#N-1);(c>this.#t||c===this.#t&&r>=this.#e)&&(c<b.year||c===b.year&&r<=b.month)||(this.#e=r,this.#t=c,this.#p());let N=M(s),d=this.#i.querySelector(`button[data-date="${N}"]`);d&&(this.#i.querySelectorAll('button[tabindex="0"]').forEach(A=>A.setAttribute("tabindex","-1")),d.setAttribute("tabindex","0"),d.focus())}};z("calendar-wc",B);export{B as CalendarWc};
|
|
3
3
|
//# sourceMappingURL=calendar-wc.js.map
|