@0001-labs/design-system-1 0.3.0-alpha.20 → 0.3.0-alpha.21
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/DS1/0-face/bento.ts +84 -0
- package/DS1/0-face/calendar.ts +2 -2
- package/DS1/1-root/bento.css +97 -0
- package/DS1/1-root/card.css +6 -1
- package/DS1/1-root/cjk.css +1 -1
- package/DS1/1-root/controls.css +1 -0
- package/DS1/1-root/fonts.css +1 -1
- package/DS1/1-root/one.css +1 -1
- package/DS1/1-root/one.semantic.css +1 -1
- package/DS1/3-unit/calendar-base.ts +31 -22
- package/DS1/3-unit/ds-bento.ts +67 -0
- package/DS1/3-unit/ds-calendar.ts +477 -22
- package/DS1/3-unit/styles/ds-bento.css +66 -0
- package/DS1/3-unit/styles/ds-calendar.css +119 -1
- package/DS1/index.ts +1 -1
- package/dist/0-face/bento.d.ts +41 -0
- package/dist/0-face/bento.d.ts.map +1 -0
- package/dist/0-face/bento.js +77 -0
- package/dist/0-face/calendar.js +2 -2
- package/dist/3-unit/calendar-base.d.ts +17 -12
- package/dist/3-unit/calendar-base.d.ts.map +1 -1
- package/dist/3-unit/calendar-base.js +21 -16
- package/dist/3-unit/ds-bento.d.ts +31 -0
- package/dist/3-unit/ds-bento.d.ts.map +1 -0
- package/dist/3-unit/ds-bento.js +47 -0
- package/dist/3-unit/ds-calendar-large.d.ts +3 -4
- package/dist/3-unit/ds-calendar-large.d.ts.map +1 -1
- package/dist/3-unit/ds-calendar.d.ts +139 -12
- package/dist/3-unit/ds-calendar.d.ts.map +1 -1
- package/dist/3-unit/ds-calendar.js +464 -23
- package/dist/design-system-1.bundle.js +1124 -1094
- package/dist/design-system-1.bundle.js.map +1 -1
- package/dist/design-system-1.bundle.min.js +2483 -2456
- package/dist/design-system-1.bundle.min.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/DS1/3-unit/ds-date-picker.ts +0 -540
- package/DS1/3-unit/styles/ds-date-picker.css +0 -124
- package/dist/3-unit/ds-date-picker.d.ts +0 -203
- package/dist/3-unit/ds-date-picker.d.ts.map +0 -1
- package/dist/3-unit/ds-date-picker.js +0 -499
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* ds-bento.css */
|
|
2
|
+
/* The element's bento: the same as 1-root/bento.css's .ds-bento, on the host and its slotted tiles. */
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
--ds-bento-gap: calc(var(--ds-unit) / 2);
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: repeat(var(--ds-bento-columns, 3), minmax(0, 1fr));
|
|
9
|
+
grid-auto-rows: minmax(var(--ds-bento-row, calc(10 * var(--ds-unit))), auto);
|
|
10
|
+
grid-auto-flow: row dense;
|
|
11
|
+
gap: var(--ds-bento-gap);
|
|
12
|
+
}
|
|
13
|
+
:host([hidden]) { display: none !important; }
|
|
14
|
+
|
|
15
|
+
::slotted(*) {
|
|
16
|
+
--ds-card-width: auto;
|
|
17
|
+
--ds-card-height: auto;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
min-height: 0;
|
|
21
|
+
grid-column: span var(--ds-bento-span, 1);
|
|
22
|
+
grid-row: span var(--ds-bento-rows, 1);
|
|
23
|
+
}
|
|
24
|
+
::slotted([data-span="2"]) { --ds-bento-span: 2; }
|
|
25
|
+
::slotted([data-span="3"]) { --ds-bento-span: 3; }
|
|
26
|
+
::slotted([data-span="4"]) { --ds-bento-span: 4; }
|
|
27
|
+
::slotted([data-span="5"]) { --ds-bento-span: 5; }
|
|
28
|
+
::slotted([data-span="6"]) { --ds-bento-span: 6; }
|
|
29
|
+
::slotted([data-rows="2"]) { --ds-bento-rows: 2; }
|
|
30
|
+
::slotted([data-rows="3"]) { --ds-bento-rows: 3; }
|
|
31
|
+
::slotted([data-rows="4"]) { --ds-bento-rows: 4; }
|
|
32
|
+
::slotted([data-rows="5"]) { --ds-bento-rows: 5; }
|
|
33
|
+
::slotted([data-rows="6"]) { --ds-bento-rows: 6; }
|
|
34
|
+
|
|
35
|
+
@media (max-width: 600px) {
|
|
36
|
+
:host(:not([squares])) { grid-template-columns: minmax(0, 1fr); }
|
|
37
|
+
:host(:not([squares])) ::slotted(*) { grid-column: auto; }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host([squares]) {
|
|
41
|
+
--ds-bento-reach: calc(var(--ds-unit) / 4);
|
|
42
|
+
/* Exactly its squares wide: each column one square. */
|
|
43
|
+
width: calc(var(--ds-bento-columns, 48) * var(--ds-unit));
|
|
44
|
+
max-width: none;
|
|
45
|
+
grid-template-columns: repeat(var(--ds-bento-columns, 48), var(--ds-unit));
|
|
46
|
+
grid-auto-rows: var(--ds-unit);
|
|
47
|
+
grid-auto-flow: row;
|
|
48
|
+
gap: 0;
|
|
49
|
+
}
|
|
50
|
+
:host([squares]) ::slotted(*) {
|
|
51
|
+
--ds-bento-inset-top: calc(var(--ds-bento-reach) * var(--ds-bento-top, 0));
|
|
52
|
+
--ds-bento-inset-end: calc(var(--ds-bento-reach) * var(--ds-bento-end, 0));
|
|
53
|
+
--ds-bento-inset-bottom: calc(var(--ds-bento-reach) * var(--ds-bento-bottom, 0));
|
|
54
|
+
--ds-bento-inset-start: calc(var(--ds-bento-reach) * var(--ds-bento-start, 0));
|
|
55
|
+
grid-column: calc(var(--ds-bento-x, 0) + 1) / span var(--ds-bento-w, 4);
|
|
56
|
+
grid-row: calc(var(--ds-bento-y, 0) + 1) / span var(--ds-bento-h, 4);
|
|
57
|
+
margin: calc(-1 * var(--ds-bento-inset-top)) calc(-1 * var(--ds-bento-inset-end)) calc(-1 * var(--ds-bento-inset-bottom)) calc(-1 * var(--ds-bento-inset-start));
|
|
58
|
+
}
|
|
59
|
+
/* A card grows its own padding by the reach (card.css); any other tile is padded here, a square inside. */
|
|
60
|
+
:host([squares]) ::slotted(:not(.ds-card, ds-card)) {
|
|
61
|
+
padding:
|
|
62
|
+
calc(var(--ds-unit) + var(--ds-bento-inset-top))
|
|
63
|
+
calc(var(--ds-unit) + var(--ds-bento-inset-end))
|
|
64
|
+
calc(var(--ds-unit) + var(--ds-bento-inset-bottom))
|
|
65
|
+
calc(var(--ds-unit) + var(--ds-bento-inset-start));
|
|
66
|
+
}
|
|
@@ -3,7 +3,16 @@
|
|
|
3
3
|
* one when compact) and, beside its date's square, holds --ds-calendar-lines
|
|
4
4
|
* one-square lines of events and one square to spare. Every line of words
|
|
5
5
|
* stands on the lower sixteen of its square. The boxes are hairlines centred
|
|
6
|
-
* on the grid lines; today is a red disc nine tenths of a square across.
|
|
6
|
+
* on the grid lines; today is a red disc nine tenths of a square across.
|
|
7
|
+
*
|
|
8
|
+
* A picker is the select's face: one control high at the foot of its square,
|
|
9
|
+
* ten squares wide by default, the calendar icon at its start and the down
|
|
10
|
+
* arrow at its end. Its month opens on the menu's frame, half a square from
|
|
11
|
+
* the field: a 1px line, half a square inside it, no shadow, so eight squares
|
|
12
|
+
* wide. Inside, on whole squares: the first and last day to type (each with
|
|
13
|
+
* its time below when times are on), one square spare, the compact month one
|
|
14
|
+
* square a day, then Include time and Clear, each one square, set off by
|
|
15
|
+
* one-square separators with a line through them. */
|
|
7
16
|
|
|
8
17
|
:host {
|
|
9
18
|
--ds-calendar-day: calc(var(--ds-unit) * var(--ds-calendar-day-squares, 4));
|
|
@@ -236,3 +245,112 @@
|
|
|
236
245
|
/* In a compact month the pointer's day and the chosen day take squares with the system's corners; today keeps its disc. */
|
|
237
246
|
:host([compact]) .date { border-radius: var(--ds-radius); }
|
|
238
247
|
:host([compact]) .day[data-today]:not([data-selected]) .date { border-radius: 999px; }
|
|
248
|
+
|
|
249
|
+
/* The picker: a field that opens the small month. */
|
|
250
|
+
:host([picker]) {
|
|
251
|
+
--ds-calendar-picker-width: calc(10 * var(--ds-unit));
|
|
252
|
+
display: inline-flex;
|
|
253
|
+
align-items: flex-end;
|
|
254
|
+
vertical-align: bottom;
|
|
255
|
+
height: var(--ds-unit);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.trigger {
|
|
259
|
+
display: inline-flex;
|
|
260
|
+
align-items: flex-end;
|
|
261
|
+
gap: calc(4px * var(--ds-sf, 1));
|
|
262
|
+
width: var(--ds-calendar-picker-width);
|
|
263
|
+
padding-inline: 0 calc(4px * var(--ds-sf, 1));
|
|
264
|
+
text-align: start;
|
|
265
|
+
cursor: pointer;
|
|
266
|
+
}
|
|
267
|
+
.trigger:disabled { cursor: default; }
|
|
268
|
+
.trigger .icon,
|
|
269
|
+
.trigger .arrow { flex: 0 0 auto; }
|
|
270
|
+
.trigger .text {
|
|
271
|
+
flex: 1 1 auto;
|
|
272
|
+
min-width: 0;
|
|
273
|
+
overflow: hidden;
|
|
274
|
+
text-overflow: ellipsis;
|
|
275
|
+
white-space: nowrap;
|
|
276
|
+
}
|
|
277
|
+
.trigger[data-empty] .text { color: var(--ds-title-color); }
|
|
278
|
+
.trigger[aria-expanded="true"] .arrow { transform: rotate(180deg); }
|
|
279
|
+
|
|
280
|
+
/* The month's panel, on the menu's frame. */
|
|
281
|
+
.popover {
|
|
282
|
+
position: fixed;
|
|
283
|
+
inset: auto;
|
|
284
|
+
box-sizing: border-box;
|
|
285
|
+
margin: 0;
|
|
286
|
+
padding: calc(var(--ds-unit) / 2 - 1px);
|
|
287
|
+
border: 1px solid var(--ds-border-color);
|
|
288
|
+
border-radius: var(--ds-radius-card);
|
|
289
|
+
background: var(--ds-paper);
|
|
290
|
+
color: var(--ds-text-color);
|
|
291
|
+
box-shadow: none;
|
|
292
|
+
overflow: visible;
|
|
293
|
+
}
|
|
294
|
+
.popover:not(:popover-open) { display: none; }
|
|
295
|
+
|
|
296
|
+
/* The days to type: a row of one square for each end, its time on the row below; one square spare after. */
|
|
297
|
+
.fields { margin-block-end: var(--ds-unit); }
|
|
298
|
+
.field-row {
|
|
299
|
+
display: flex;
|
|
300
|
+
align-items: flex-end;
|
|
301
|
+
gap: calc(var(--ds-unit) / 2);
|
|
302
|
+
height: var(--ds-unit);
|
|
303
|
+
}
|
|
304
|
+
.field { flex: 1 1 auto; min-width: 0; }
|
|
305
|
+
.clock { flex: 1 1 auto; min-width: 0; }
|
|
306
|
+
.fields, .options { width: calc(7 * var(--ds-unit)); }
|
|
307
|
+
|
|
308
|
+
/* Include time and Clear, each one square, the words on the sixteen. */
|
|
309
|
+
.option {
|
|
310
|
+
box-sizing: border-box;
|
|
311
|
+
display: flex;
|
|
312
|
+
align-items: flex-end;
|
|
313
|
+
justify-content: space-between;
|
|
314
|
+
gap: var(--ds-unit);
|
|
315
|
+
width: 100%;
|
|
316
|
+
height: var(--ds-unit);
|
|
317
|
+
margin: 0;
|
|
318
|
+
padding: 0 calc(4px * var(--ds-sf, 1));
|
|
319
|
+
border: 0;
|
|
320
|
+
border-radius: var(--ds-radius);
|
|
321
|
+
background: transparent;
|
|
322
|
+
color: var(--ds-text-color);
|
|
323
|
+
font: inherit;
|
|
324
|
+
letter-spacing: inherit;
|
|
325
|
+
text-align: start;
|
|
326
|
+
cursor: pointer;
|
|
327
|
+
}
|
|
328
|
+
.option:hover:not(:disabled) { background: var(--ds-row-fill-hover, var(--ds-fill)); }
|
|
329
|
+
.option:focus-visible { outline: 2px solid var(--ds-focus-ring); outline-offset: -2px; }
|
|
330
|
+
.option:disabled { color: var(--ds-title-color); cursor: default; }
|
|
331
|
+
.option .ds-switch { flex: 0 0 auto; }
|
|
332
|
+
|
|
333
|
+
/* A separator: one square with a 1px line through its middle. */
|
|
334
|
+
.separator {
|
|
335
|
+
position: relative;
|
|
336
|
+
height: var(--ds-unit);
|
|
337
|
+
}
|
|
338
|
+
.separator::after {
|
|
339
|
+
position: absolute;
|
|
340
|
+
inset-inline: 0;
|
|
341
|
+
top: calc(50% - 0.5px);
|
|
342
|
+
height: 1px;
|
|
343
|
+
background: var(--ds-border-color);
|
|
344
|
+
content: "";
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
348
|
+
.popover:popover-open {
|
|
349
|
+
animation: ds-calendar-picker-in 140ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
350
|
+
}
|
|
351
|
+
.trigger .arrow { transition: transform 140ms ease; }
|
|
352
|
+
}
|
|
353
|
+
@keyframes ds-calendar-picker-in {
|
|
354
|
+
from { opacity: 0; transform: translateY(calc(-4px * var(--ds-sf, 1))); }
|
|
355
|
+
to { opacity: 1; transform: none; }
|
|
356
|
+
}
|
package/DS1/index.ts
CHANGED
|
@@ -71,8 +71,8 @@ export * from "./2-core/ds-avatar";
|
|
|
71
71
|
export * from "./3-unit/ds-avatar-group";
|
|
72
72
|
export * from "./3-unit/ds-calendar";
|
|
73
73
|
export * from "./3-unit/ds-calendar-large";
|
|
74
|
+
export * from "./3-unit/ds-bento";
|
|
74
75
|
export * from "./3-unit/ds-carousel";
|
|
75
|
-
export * from "./3-unit/ds-date-picker";
|
|
76
76
|
export * from "./3-unit/ds-form";
|
|
77
77
|
export * from "./3-unit/ds-list";
|
|
78
78
|
export * from "./3-unit/ds-matrix";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bentos without Lit: places the tiles of a `.ds-bento[data-squares]` (drawn
|
|
3
|
+
* by `1-root/bento.css`) on their squares and lets each surface reach a
|
|
4
|
+
* quarter square towards the tiles beside it, so the tiles stand half a
|
|
5
|
+
* square apart while what they hold stays on the squares. A flow bento needs
|
|
6
|
+
* no script. No framework and no imports.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <div class="ds-bento" data-squares style="--ds-bento-columns: 48">
|
|
10
|
+
* <a class="ds-card" href="/archive/" data-place="0 0 15 7">…</a>
|
|
11
|
+
* <a class="ds-card" href="/ezo/" data-place="16 0 16 20">…</a>
|
|
12
|
+
* </div>
|
|
13
|
+
* <script type="module">
|
|
14
|
+
* import { placeBentos } from "/ds1/0-face/bento.js";
|
|
15
|
+
* placeBentos();
|
|
16
|
+
* </script>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* A tile's `data-place` is its square across, its square down, its width and
|
|
20
|
+
* its height, in whole squares counted from 0. Tiles are placed a square
|
|
21
|
+
* apart; a tile a square away from another, with the two overlapping along
|
|
22
|
+
* that side, reaches towards it.
|
|
23
|
+
*/
|
|
24
|
+
/** A tile's place in squares: across, down, wide, high. */
|
|
25
|
+
export type BentoPlace = readonly [x: number, y: number, w: number, h: number];
|
|
26
|
+
/** Which sides of each tile face another tile a square away. */
|
|
27
|
+
export interface BentoReach {
|
|
28
|
+
start: boolean;
|
|
29
|
+
top: boolean;
|
|
30
|
+
end: boolean;
|
|
31
|
+
bottom: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Reads `data-place` ("x y w h"); `undefined` unless it is four whole numbers with a size. */
|
|
34
|
+
export declare function bentoPlace(value: string | null | undefined): BentoPlace | undefined;
|
|
35
|
+
/** For each place, the sides that face another tile across a one-square gap. */
|
|
36
|
+
export declare function bentoReach(places: readonly BentoPlace[]): BentoReach[];
|
|
37
|
+
/** Places one squares bento's tiles: their squares and their reach, as custom properties. */
|
|
38
|
+
export declare function placeBento(bento: HTMLElement): void;
|
|
39
|
+
/** Places every squares bento on the page (or under `root`), and again when its tiles change. */
|
|
40
|
+
export declare function placeBentos(root?: ParentNode): () => void;
|
|
41
|
+
//# sourceMappingURL=bento.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento.d.ts","sourceRoot":"","sources":["../../DS1/0-face/bento.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAE/E,gEAAgE;AAChE,MAAM,WAAW,UAAU;IAAG,KAAK,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE;AAE3F,+FAA+F;AAC/F,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAKnF;AAID,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE,CAUtE;AAED,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAYnD;AAED,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,IAAI,GAAE,UAAqB,GAAG,MAAM,IAAI,CAcnE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bentos without Lit: places the tiles of a `.ds-bento[data-squares]` (drawn
|
|
3
|
+
* by `1-root/bento.css`) on their squares and lets each surface reach a
|
|
4
|
+
* quarter square towards the tiles beside it, so the tiles stand half a
|
|
5
|
+
* square apart while what they hold stays on the squares. A flow bento needs
|
|
6
|
+
* no script. No framework and no imports.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <div class="ds-bento" data-squares style="--ds-bento-columns: 48">
|
|
10
|
+
* <a class="ds-card" href="/archive/" data-place="0 0 15 7">…</a>
|
|
11
|
+
* <a class="ds-card" href="/ezo/" data-place="16 0 16 20">…</a>
|
|
12
|
+
* </div>
|
|
13
|
+
* <script type="module">
|
|
14
|
+
* import { placeBentos } from "/ds1/0-face/bento.js";
|
|
15
|
+
* placeBentos();
|
|
16
|
+
* </script>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* A tile's `data-place` is its square across, its square down, its width and
|
|
20
|
+
* its height, in whole squares counted from 0. Tiles are placed a square
|
|
21
|
+
* apart; a tile a square away from another, with the two overlapping along
|
|
22
|
+
* that side, reaches towards it.
|
|
23
|
+
*/
|
|
24
|
+
/** Reads `data-place` ("x y w h"); `undefined` unless it is four whole numbers with a size. */
|
|
25
|
+
export function bentoPlace(value) {
|
|
26
|
+
const parts = (value ?? "").trim().split(/[\s,]+/).map(Number);
|
|
27
|
+
if (parts.length !== 4 || parts.some(part => !Number.isInteger(part) || part < 0))
|
|
28
|
+
return undefined;
|
|
29
|
+
const [x, y, w, h] = parts;
|
|
30
|
+
return w > 0 && h > 0 ? [x, y, w, h] : undefined;
|
|
31
|
+
}
|
|
32
|
+
const overlaps = (a0, a1, b0, b1) => a0 < b1 && b0 < a1;
|
|
33
|
+
/** For each place, the sides that face another tile across a one-square gap. */
|
|
34
|
+
export function bentoReach(places) {
|
|
35
|
+
return places.map(([x, y, w, h], index) => {
|
|
36
|
+
const others = places.filter((_, other) => other !== index);
|
|
37
|
+
return {
|
|
38
|
+
start: others.some(([ox, oy, ow, oh]) => ox + ow + 1 === x && overlaps(y, y + h, oy, oy + oh)),
|
|
39
|
+
end: others.some(([ox, oy, , oh]) => x + w + 1 === ox && overlaps(y, y + h, oy, oy + oh)),
|
|
40
|
+
top: others.some(([ox, oy, ow, oh]) => oy + oh + 1 === y && overlaps(x, x + w, ox, ox + ow)),
|
|
41
|
+
bottom: others.some(([ox, oy, ow]) => y + h + 1 === oy && overlaps(x, x + w, ox, ox + ow)),
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** Places one squares bento's tiles: their squares and their reach, as custom properties. */
|
|
46
|
+
export function placeBento(bento) {
|
|
47
|
+
const tiles = [...bento.children].filter((child) => child instanceof HTMLElement && !child.hidden);
|
|
48
|
+
const placed = tiles.map(tile => ({ tile, place: bentoPlace(tile.dataset.place) })).filter((entry) => !!entry.place);
|
|
49
|
+
const reach = bentoReach(placed.map(entry => entry.place));
|
|
50
|
+
placed.forEach(({ tile, place: [x, y, w, h] }, index) => {
|
|
51
|
+
const sides = reach[index];
|
|
52
|
+
tile.style.setProperty("--ds-bento-x", String(x));
|
|
53
|
+
tile.style.setProperty("--ds-bento-y", String(y));
|
|
54
|
+
tile.style.setProperty("--ds-bento-w", String(w));
|
|
55
|
+
tile.style.setProperty("--ds-bento-h", String(h));
|
|
56
|
+
for (const side of ["start", "top", "end", "bottom"])
|
|
57
|
+
tile.style.setProperty(`--ds-bento-${side}`, sides[side] ? "1" : "0");
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Places every squares bento on the page (or under `root`), and again when its tiles change. */
|
|
61
|
+
export function placeBentos(root = document) {
|
|
62
|
+
const bentos = [...root.querySelectorAll(".ds-bento[data-squares]")];
|
|
63
|
+
const observer = new MutationObserver(records => {
|
|
64
|
+
for (const record of records) {
|
|
65
|
+
const bento = record.target instanceof HTMLElement && record.target.matches(".ds-bento[data-squares]") ? record.target : record.target.parentElement;
|
|
66
|
+
if (bento?.matches(".ds-bento[data-squares]"))
|
|
67
|
+
placeBento(bento);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
for (const bento of bentos) {
|
|
71
|
+
placeBento(bento);
|
|
72
|
+
observer.observe(bento, { childList: true, subtree: false, attributes: true, attributeFilter: ["data-place", "hidden"] });
|
|
73
|
+
for (const tile of bento.children)
|
|
74
|
+
observer.observe(tile, { attributes: true, attributeFilter: ["data-place", "hidden"] });
|
|
75
|
+
}
|
|
76
|
+
return () => observer.disconnect();
|
|
77
|
+
}
|
package/dist/0-face/calendar.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// calendar.ts
|
|
2
2
|
// Days as the calendars count them: a day is written `YYYY-MM-DD` and read on
|
|
3
3
|
// its own date in every zone, a month is the whole weeks that hold it, and the
|
|
4
|
-
// week starts where the language starts it. Shared by ds-calendar
|
|
5
|
-
//
|
|
4
|
+
// week starts where the language starts it. Shared by ds-calendar (its
|
|
5
|
+
// picker too) and ds-calendar-large; no Lit, so a page can use it alone.
|
|
6
6
|
import { currentLanguage } from "./i18n";
|
|
7
7
|
import { dateFormatter, localeTag } from "./format";
|
|
8
8
|
const DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
@@ -12,9 +12,10 @@ export interface CalendarEventDetail {
|
|
|
12
12
|
day: Day;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Detail of `change`: the value a person chose and the one before it.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Detail of `change`: the value a person chose and the one before it. The
|
|
16
|
+
* first day pressed is `value` alone, with `end` empty while the end is still
|
|
17
|
+
* to come; the second ends it, and `value` is `start/end` (one day when the
|
|
18
|
+
* same day is pressed twice).
|
|
18
19
|
*/
|
|
19
20
|
export interface CalendarChangeDetail {
|
|
20
21
|
value: string;
|
|
@@ -56,10 +57,6 @@ export declare abstract class CalendarBase extends LitElement {
|
|
|
56
57
|
type: BooleanConstructor;
|
|
57
58
|
reflect: boolean;
|
|
58
59
|
};
|
|
59
|
-
range: {
|
|
60
|
-
type: BooleanConstructor;
|
|
61
|
-
reflect: boolean;
|
|
62
|
-
};
|
|
63
60
|
label: {
|
|
64
61
|
type: StringConstructor;
|
|
65
62
|
};
|
|
@@ -76,8 +73,11 @@ export declare abstract class CalendarBase extends LitElement {
|
|
|
76
73
|
hoverDay: {
|
|
77
74
|
state: boolean;
|
|
78
75
|
};
|
|
76
|
+
endPending: {
|
|
77
|
+
state: boolean;
|
|
78
|
+
};
|
|
79
79
|
};
|
|
80
|
-
/** The selected day, `YYYY-MM-DD`, or
|
|
80
|
+
/** The selected day, `YYYY-MM-DD`, or a range of days, `YYYY-MM-DD/YYYY-MM-DD`; empty for none. */
|
|
81
81
|
value: string;
|
|
82
82
|
/** The first day a person may choose. */
|
|
83
83
|
min: string | undefined;
|
|
@@ -87,10 +87,8 @@ export declare abstract class CalendarBase extends LitElement {
|
|
|
87
87
|
today: string | undefined;
|
|
88
88
|
/** The first day of the week: `0`–`6` from Sunday, or a day's English name; the language's own when left out. */
|
|
89
89
|
weekStart: string | undefined;
|
|
90
|
-
/** Pressing a day selects it and fires `change
|
|
90
|
+
/** Pressing a day selects it and fires `change`: one day, or a first and a last. */
|
|
91
91
|
selectable: boolean;
|
|
92
|
-
/** A selectable calendar chooses a first and a last day. */
|
|
93
|
-
range: boolean;
|
|
94
92
|
/** The grid's name: a translation key, or literal words. The month's name when left out. */
|
|
95
93
|
label: string | undefined;
|
|
96
94
|
/** Show `label` as written, never looked up. */
|
|
@@ -101,6 +99,10 @@ export declare abstract class CalendarBase extends LitElement {
|
|
|
101
99
|
focusDay: Day | undefined;
|
|
102
100
|
/** The day under the pointer, which previews a range's end. */
|
|
103
101
|
hoverDay: Day | undefined;
|
|
102
|
+
/** A first day has been pressed and the next press ends the range. */
|
|
103
|
+
protected endPending: boolean;
|
|
104
|
+
/** The value the last press wrote, so a value set from outside settles the range. */
|
|
105
|
+
private pressedValue;
|
|
104
106
|
/** Weeks run along rows (a month) or along columns (the large calendar). */
|
|
105
107
|
protected abstract readonly weeksRun: "rows" | "columns";
|
|
106
108
|
private readonly relabel;
|
|
@@ -138,7 +140,10 @@ export declare abstract class CalendarBase extends LitElement {
|
|
|
138
140
|
protected abstract eventsOn(day: Day): CalendarEvent[];
|
|
139
141
|
/**
|
|
140
142
|
* A person pressed a day: `day-press` fires, and unless it is cancelled a
|
|
141
|
-
* selectable calendar takes the day and fires `change`.
|
|
143
|
+
* selectable calendar takes the day and fires `change`. There is one way to
|
|
144
|
+
* pick: the first press chooses a day, which is the value; the next ends a
|
|
145
|
+
* range from it, before or after (the same day again keeps the one day);
|
|
146
|
+
* the press after that starts again.
|
|
142
147
|
*/
|
|
143
148
|
protected press(day: Day): void;
|
|
144
149
|
protected pressEvent(event: CalendarEvent, day: Day): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-base.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/calendar-base.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,M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AAC,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG;IAInD,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG;IAIlC,qEAAqE;cACrD,SAAS,CAAC,GAAG,EAAE,GAAG;CAOnC"}
|
|
@@ -28,7 +28,7 @@ export class CalendarBase extends LitElement {
|
|
|
28
28
|
this.relabel = () => this.requestUpdate();
|
|
29
29
|
this.value = "";
|
|
30
30
|
this.selectable = false;
|
|
31
|
-
this.
|
|
31
|
+
this.endPending = false;
|
|
32
32
|
this.literal = false;
|
|
33
33
|
this.events = [];
|
|
34
34
|
}
|
|
@@ -46,6 +46,9 @@ export class CalendarBase extends LitElement {
|
|
|
46
46
|
super.willUpdate(changed);
|
|
47
47
|
if (changed.has("value") && this.value && !readRange(this.value).start)
|
|
48
48
|
this.value = "";
|
|
49
|
+
// A value given from outside is whole: the next press starts again.
|
|
50
|
+
if (changed.has("value") && this.value !== this.pressedValue)
|
|
51
|
+
this.endPending = false;
|
|
49
52
|
}
|
|
50
53
|
/** Shared words, filled in: `words("Week {week}", { week: 42 })`. */
|
|
51
54
|
words(key, params) {
|
|
@@ -77,17 +80,17 @@ export class CalendarBase extends LitElement {
|
|
|
77
80
|
/** The chosen days: the first and the last of a range, or the one day twice. */
|
|
78
81
|
get chosen() {
|
|
79
82
|
const { start, end } = readRange(this.value);
|
|
80
|
-
return
|
|
83
|
+
return { start, end: end || start };
|
|
81
84
|
}
|
|
82
85
|
/** How a day stands to the selection: an end of it, inside it, or neither; with the end still to come, the pointer previews it. */
|
|
83
86
|
selection(day) {
|
|
84
87
|
let { start, end } = this.chosen;
|
|
85
|
-
if (this.
|
|
88
|
+
if (this.endPending && start && this.hoverDay)
|
|
86
89
|
end = this.hoverDay;
|
|
87
90
|
if (end && end < start)
|
|
88
91
|
[start, end] = [end, start];
|
|
89
92
|
const selected = day === start || day === end;
|
|
90
|
-
const spans = Boolean(
|
|
93
|
+
const spans = Boolean(start && end && start !== end);
|
|
91
94
|
return { selected, inside: spans && day > start && day < end, first: spans && day === start, last: spans && day === end };
|
|
92
95
|
}
|
|
93
96
|
/** What a day's cell is called: the whole date, then what is on it. */
|
|
@@ -114,7 +117,10 @@ export class CalendarBase extends LitElement {
|
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
116
119
|
* A person pressed a day: `day-press` fires, and unless it is cancelled a
|
|
117
|
-
* selectable calendar takes the day and fires `change`.
|
|
120
|
+
* selectable calendar takes the day and fires `change`. There is one way to
|
|
121
|
+
* pick: the first press chooses a day, which is the value; the next ends a
|
|
122
|
+
* range from it, before or after (the same day again keeps the one day);
|
|
123
|
+
* the press after that starts again.
|
|
118
124
|
*/
|
|
119
125
|
press(day) {
|
|
120
126
|
const pressed = new CustomEvent("day-press", {
|
|
@@ -126,20 +132,19 @@ export class CalendarBase extends LitElement {
|
|
|
126
132
|
if (!this.dispatchEvent(pressed) || !this.selectable || !this.allowed(day))
|
|
127
133
|
return;
|
|
128
134
|
const previous = this.value || "";
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const { start, end } = readRange(previous);
|
|
133
|
-
if (start && !end)
|
|
134
|
-
value = day < start ? `${day}/${start}` : `${start}/${day}`;
|
|
135
|
-
}
|
|
135
|
+
const { start: first } = readRange(previous);
|
|
136
|
+
const ending = this.endPending && Boolean(first);
|
|
137
|
+
const value = !ending || day === first ? day : day < first ? `${day}/${first}` : `${first}/${day}`;
|
|
136
138
|
this.focusDay = day;
|
|
137
|
-
|
|
139
|
+
this.endPending = !ending;
|
|
140
|
+
this.hoverDay = undefined;
|
|
141
|
+
this.pressedValue = value;
|
|
142
|
+
// An end on the first day keeps the value but still says the range is whole.
|
|
143
|
+
if (value === previous && !ending)
|
|
138
144
|
return;
|
|
139
145
|
this.value = value;
|
|
140
|
-
this.hoverDay = undefined;
|
|
141
146
|
const { start, end } = readRange(value);
|
|
142
|
-
this.dispatchEvent(new CustomEvent("change", { bubbles: true, composed: true, detail: { value, previous, start, end:
|
|
147
|
+
this.dispatchEvent(new CustomEvent("change", { bubbles: true, composed: true, detail: { value, previous, start, end: ending ? end || start : "" } }));
|
|
143
148
|
}
|
|
144
149
|
pressEvent(event, day) {
|
|
145
150
|
this.dispatchEvent(new CustomEvent("event-press", { bubbles: true, composed: true, detail: { event, day } }));
|
|
@@ -163,10 +168,10 @@ CalendarBase.properties = {
|
|
|
163
168
|
today: { type: String },
|
|
164
169
|
weekStart: { type: String, attribute: "week-start" },
|
|
165
170
|
selectable: { type: Boolean, reflect: true },
|
|
166
|
-
range: { type: Boolean, reflect: true },
|
|
167
171
|
label: { type: String },
|
|
168
172
|
literal: { type: Boolean, reflect: true },
|
|
169
173
|
events: { attribute: false },
|
|
170
174
|
focusDay: { state: true },
|
|
171
175
|
hoverDay: { state: true },
|
|
176
|
+
endPending: { state: true },
|
|
172
177
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class Bento extends LitElement {
|
|
3
|
+
static properties: {
|
|
4
|
+
columns: {
|
|
5
|
+
type: NumberConstructor;
|
|
6
|
+
reflect: boolean;
|
|
7
|
+
};
|
|
8
|
+
squares: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
reflect: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
/** The number of columns (flow, three by default), or the squares across (`squares`, 48 by default). */
|
|
14
|
+
columns: number | undefined;
|
|
15
|
+
/** Places every tile on whole squares by its `data-place`. */
|
|
16
|
+
squares: boolean;
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
private observer?;
|
|
19
|
+
constructor();
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
protected updated(): void;
|
|
23
|
+
private place;
|
|
24
|
+
render(): import("lit").TemplateResult<1>;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
"ds-bento": Bento;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ds-bento.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-bento.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-bento.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAMlD,qBAAa,KAAM,SAAQ,UAAU;IACnC,MAAM,CAAC,UAAU;;;;;;;;;MAGf;IAEF,wGAAwG;IAChG,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,8DAA8D;IACtD,OAAO,EAAE,OAAO,CAAC;IAEzB,MAAM,CAAC,MAAM,4BAA2C;IAExD,OAAO,CAAC,QAAQ,CAAC,CAAmB;;IAOpC,iBAAiB;IAMjB,oBAAoB;IAKpB,SAAS,CAAC,OAAO;IAMjB,OAAO,CAAC,KAAK;IAIb,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAC;KACnB;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// ds-bento.ts
|
|
2
|
+
// Tiles of different sizes, half a square apart: in columns that share the
|
|
3
|
+
// width (a tile `data-span` columns wide, `data-rows` rows high), or with
|
|
4
|
+
// `squares`, each placed on whole squares by its `data-place`, its surface
|
|
5
|
+
// reaching towards the tiles beside it. The tiles are cards (`ds-card`) or
|
|
6
|
+
// any box. Drawn as 1-root/bento.css draws `.ds-bento`, and placed by the
|
|
7
|
+
// helpers it shares with 0-face/bento.ts.
|
|
8
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
9
|
+
import { define } from "../0-face/define";
|
|
10
|
+
import { placeBento } from "../0-face/bento";
|
|
11
|
+
import metrics from "../1-root/component-metrics.css?inline";
|
|
12
|
+
import styles from "./styles/ds-bento.css?inline";
|
|
13
|
+
export class Bento extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.squares = false;
|
|
17
|
+
}
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
super.connectedCallback();
|
|
20
|
+
this.observer = new MutationObserver(() => this.place());
|
|
21
|
+
this.observer.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-place", "hidden"] });
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
this.observer?.disconnect();
|
|
25
|
+
super.disconnectedCallback();
|
|
26
|
+
}
|
|
27
|
+
updated() {
|
|
28
|
+
if (this.columns)
|
|
29
|
+
this.style.setProperty("--ds-bento-columns", String(this.columns));
|
|
30
|
+
else
|
|
31
|
+
this.style.removeProperty("--ds-bento-columns");
|
|
32
|
+
this.place();
|
|
33
|
+
}
|
|
34
|
+
place() {
|
|
35
|
+
if (this.squares)
|
|
36
|
+
placeBento(this);
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return html `<slot @slotchange=${() => this.place()}></slot>`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
Bento.properties = {
|
|
43
|
+
columns: { type: Number, reflect: true },
|
|
44
|
+
squares: { type: Boolean, reflect: true },
|
|
45
|
+
};
|
|
46
|
+
Bento.styles = [unsafeCSS(metrics), unsafeCSS(styles)];
|
|
47
|
+
define("ds-bento", Bento);
|
|
@@ -71,10 +71,6 @@ export declare class CalendarLarge extends CalendarBase {
|
|
|
71
71
|
type: BooleanConstructor;
|
|
72
72
|
reflect: boolean;
|
|
73
73
|
};
|
|
74
|
-
range: {
|
|
75
|
-
type: BooleanConstructor;
|
|
76
|
-
reflect: boolean;
|
|
77
|
-
};
|
|
78
74
|
label: {
|
|
79
75
|
type: StringConstructor;
|
|
80
76
|
};
|
|
@@ -91,6 +87,9 @@ export declare class CalendarLarge extends CalendarBase {
|
|
|
91
87
|
hoverDay: {
|
|
92
88
|
state: boolean;
|
|
93
89
|
};
|
|
90
|
+
endPending: {
|
|
91
|
+
state: boolean;
|
|
92
|
+
};
|
|
94
93
|
};
|
|
95
94
|
static styles: import("lit").CSSResult[];
|
|
96
95
|
start: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-calendar-large.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-calendar-large.ts"],"names":[],"mappings":"AAOA,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEpE,OAAO,EAUL,KAAK,aAAa,EAClB,KAAK,GAAG,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC1D,OAAO,mBAAmB,CAAC;AAK3B,cAAc,iBAAiB,CAAC;AAWhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C,MAAM,CAAC,UAAU
|
|
1
|
+
{"version":3,"file":"ds-calendar-large.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-calendar-large.ts"],"names":[],"mappings":"AAOA,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEpE,OAAO,EAUL,KAAK,aAAa,EAClB,KAAK,GAAG,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC1D,OAAO,mBAAmB,CAAC;AAK3B,cAAc,iBAAiB,CAAC;AAWhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQf;IAEF,MAAM,CAAC,MAAM,4BAAgE;IAErE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;I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