@blueshed/joined 0.3.0 → 0.3.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/.claude/skills/joined/reference.md +57 -18
- package/docs/design.md +93 -38
- package/docs/introduction.md +9 -9
- package/docs/light-and-shadow.svg +1 -0
- package/docs/links-and-trust.svg +1 -0
- package/docs/stories-to-code.svg +2 -1
- package/docs/wire-op.svg +1 -0
- package/examples/app.css +9 -0
- package/examples/cafe/cafe.css +87 -69
- package/examples/cafe/generated/staff.elements.ts +7 -2
- package/examples/cafe/generated/staff.rules.ts +3 -0
- package/examples/cafe/generated/supplies.rules.ts +5 -0
- package/examples/cafe/kitchen.css +11 -19
- package/examples/cafe/kitchen.ts +6 -2
- package/examples/cafe/migrations/002-guard-supplies.ts +15 -0
- package/examples/cafe/order.html +2 -1
- package/examples/cafe/order.ts +1 -1
- package/examples/cafe/staff.json +5 -0
- package/examples/cafe/stories.jsonl +4 -2
- package/examples/cafe/supplies.html +1 -0
- package/examples/cafe/supplies.ts +45 -28
- package/examples/cafe/till.ts +14 -10
- package/examples/cafe/views.ts +7 -5
- package/examples/chart/arches.ts +5 -3
- package/examples/chart/chart.css +7 -2
- package/examples/desk/desk.css +6 -10
- package/examples/desk/generated/elements.ts +1 -1
- package/examples/desk/index.html +1 -1
- package/examples/desk/lanes.css +21 -19
- package/examples/desk/stories.jsonl +1 -1
- package/examples/desk/tally.css +1 -1
- package/examples/docs.ts +7 -4
- package/examples/index.html +16 -7
- package/examples/notes/generated/queries.ts +8 -2
- package/examples/notes/index.html +1 -1
- package/examples/notes/stories.jsonl +3 -0
- package/examples/page.ts +9 -2
- package/examples/people/links.ts +7 -9
- package/examples/people/people.css +1 -1
- package/examples/people/view.ts +1 -1
- package/examples/trip/generated/elements.ts +1 -1
- package/examples/trip/stays.css +1 -1
- package/examples/trip/stays.ts +1 -1
- package/examples/trips/generated/elements.ts +1 -1
- package/examples/trips/trips.css +24 -23
- package/examples/welcome.css +41 -33
- package/package.json +1 -1
- package/src/attachment.ts +17 -2
- package/src/board.css +2 -1
- package/src/board.ts +4 -4
- package/src/cli.ts +14 -2
- package/src/compile.ts +255 -77
- package/src/definitions.ts +62 -14
- package/src/demo.css +2 -5
- package/src/draft.ts +10 -4
- package/src/drawer.ts +30 -4
- package/src/engine.ts +14 -5
- package/src/fields.ts +88 -15
- package/src/file-value.ts +12 -2
- package/src/files.ts +113 -35
- package/src/icon-names.ts +4 -0
- package/src/keep.ts +16 -3
- package/src/map.css +23 -16
- package/src/map.ts +3 -3
- package/src/mcp.ts +24 -3
- package/src/members/group.ts +41 -17
- package/src/members/keys.ts +3 -3
- package/src/members/panel.css +17 -18
- package/src/members/panel.ts +9 -2
- package/src/migrate.ts +58 -21
- package/src/migrations/005-change-kept.ts +7 -0
- package/src/month.css +6 -2
- package/src/month.ts +5 -5
- package/src/ops.ts +40 -1
- package/src/page.css +3 -2
- package/src/page.ts +64 -16
- package/src/parts.css +178 -86
- package/src/parts.ts +60 -20
- package/src/plane.css +9 -4
- package/src/plane.ts +4 -2
- package/src/reading.css +1 -5
- package/src/rows.css +2 -21
- package/src/rows.ts +123 -39
- package/src/server.ts +157 -30
- package/src/sheet.ts +4 -2
- package/src/slots.css +0 -4
- package/src/specs.ts +1 -1
- package/src/starter.ts +15 -1
- package/src/store.ts +40 -18
- package/src/surface.ts +7 -2
- package/src/time.ts +2 -0
- package/src/timeline.ts +14 -5
- package/src/together.ts +15 -17
- package/src/tokens.css +12 -3
- package/src/tokens.json +38 -7
- package/src/tool.ts +6 -7
- package/src/upkeep.ts +31 -4
- package/src/views.css +8 -9
- package/src/views.ts +23 -6
- package/src/week.css +1 -2
- package/src/week.ts +11 -7
- package/src/write.ts +130 -15
- package/starter/CHANGELOG.md +8 -0
- package/starter/CLAUDE.md +7 -1
- package/starter/bunfig +2 -1
- package/starter/githooks/pre-commit +13 -0
- package/starter/prettierignore +1 -0
- package/starter/tests/records.test.ts +40 -0
- package/starter/todo.jsonl +0 -0
package/examples/cafe/cafe.css
CHANGED
|
@@ -63,7 +63,7 @@ body[data-flavour] {
|
|
|
63
63
|
header.band {
|
|
64
64
|
margin: 0 0 var(--space-16);
|
|
65
65
|
padding: var(--space-12) var(--space-16);
|
|
66
|
-
border-radius:
|
|
66
|
+
border-radius: var(--radius);
|
|
67
67
|
background: var(--flavour-tint);
|
|
68
68
|
color: var(--flavour-ink);
|
|
69
69
|
}
|
|
@@ -75,18 +75,29 @@ header.band .lead {
|
|
|
75
75
|
color: inherit;
|
|
76
76
|
}
|
|
77
77
|
nav.bar a {
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
min-height: var(--size-touch);
|
|
81
|
+
padding: 0 var(--space-10);
|
|
82
|
+
border-radius: var(--radius-pill);
|
|
80
83
|
background: color-mix(in srgb, var(--card) 60%, transparent);
|
|
81
84
|
color: var(--flavour-ink);
|
|
85
|
+
font: var(--font-tool);
|
|
82
86
|
text-decoration: none;
|
|
83
87
|
}
|
|
88
|
+
@media (max-width: 40rem), (pointer: coarse) {
|
|
89
|
+
nav.bar a {
|
|
90
|
+
min-height: var(--size-finger);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
84
93
|
nav.bar a[aria-current="page"] {
|
|
85
94
|
background: var(--flavour-solid);
|
|
86
95
|
color: var(--on-flavour);
|
|
87
96
|
}
|
|
88
97
|
.cafe {
|
|
89
98
|
display: grid;
|
|
99
|
+
/* its parts the page's width, never what's in them (a field two columns wide grew the supply form past a phone) */
|
|
100
|
+
grid-template-columns: minmax(0, 1fr);
|
|
90
101
|
gap: var(--space-16);
|
|
91
102
|
}
|
|
92
103
|
/* each part of a page is joined's card (wa-card) */
|
|
@@ -144,7 +155,7 @@ form.place j-item {
|
|
|
144
155
|
gap: var(--space-4) var(--space-8);
|
|
145
156
|
padding: var(--space-8) var(--space-12);
|
|
146
157
|
border: 1px solid var(--edge);
|
|
147
|
-
border-radius:
|
|
158
|
+
border-radius: var(--radius);
|
|
148
159
|
background: var(--card);
|
|
149
160
|
}
|
|
150
161
|
form.place j-item p {
|
|
@@ -157,32 +168,26 @@ form.place j-item .price {
|
|
|
157
168
|
color: var(--muted);
|
|
158
169
|
font: var(--font-row);
|
|
159
170
|
}
|
|
160
|
-
/* one fewer, how many, one more: a
|
|
171
|
+
/* one fewer, how many, one more: each an icon alone, a control's size (a finger's under one: joined's .icon-only) */
|
|
161
172
|
form.place j-item .steps {
|
|
162
173
|
display: flex;
|
|
163
174
|
align-items: center;
|
|
164
175
|
gap: var(--space-8);
|
|
165
176
|
}
|
|
166
|
-
form.place j-item .steps .act {
|
|
167
|
-
min-width: 40px;
|
|
168
|
-
min-height: 40px;
|
|
169
|
-
justify-content: center;
|
|
170
|
-
font: var(--font-heading);
|
|
171
|
-
}
|
|
172
177
|
form.place j-item output {
|
|
173
178
|
min-width: 2ch;
|
|
174
179
|
text-align: center;
|
|
175
180
|
font: var(--font-heading);
|
|
176
181
|
}
|
|
177
182
|
/* how many of what's left: a bar the whole width, and its words */
|
|
178
|
-
form.place j-item .
|
|
183
|
+
form.place j-item .stock {
|
|
179
184
|
grid-column: 1 / -1;
|
|
180
185
|
height: 6px;
|
|
181
|
-
border-radius:
|
|
186
|
+
border-radius: var(--radius-inner);
|
|
182
187
|
background: var(--well);
|
|
183
188
|
overflow: hidden;
|
|
184
189
|
}
|
|
185
|
-
form.place j-item .
|
|
190
|
+
form.place j-item .stock i {
|
|
186
191
|
display: block;
|
|
187
192
|
height: 100%;
|
|
188
193
|
background: var(--flavour-solid);
|
|
@@ -208,7 +213,7 @@ form.place .order {
|
|
|
208
213
|
gap: var(--space-8);
|
|
209
214
|
padding: var(--space-12);
|
|
210
215
|
border: 1px solid var(--edge);
|
|
211
|
-
border-radius:
|
|
216
|
+
border-radius: var(--radius);
|
|
212
217
|
background: var(--card);
|
|
213
218
|
position: sticky;
|
|
214
219
|
top: var(--space-16);
|
|
@@ -240,6 +245,12 @@ form.place .total {
|
|
|
240
245
|
grid-template-columns: repeat(3, 1fr);
|
|
241
246
|
gap: var(--space-12);
|
|
242
247
|
}
|
|
248
|
+
/* each column filled from its top: a ticket takes the first free row of its own column, not the row after the last
|
|
249
|
+
ticket placed in another */
|
|
250
|
+
.board j-orders {
|
|
251
|
+
grid-auto-flow: dense;
|
|
252
|
+
align-items: start;
|
|
253
|
+
}
|
|
243
254
|
.board j-order {
|
|
244
255
|
grid-column: 1;
|
|
245
256
|
}
|
|
@@ -273,11 +284,11 @@ j-order {
|
|
|
273
284
|
display: block;
|
|
274
285
|
padding: var(--space-8) var(--space-12);
|
|
275
286
|
border: 1px solid var(--line);
|
|
276
|
-
border-radius:
|
|
287
|
+
border-radius: var(--radius);
|
|
277
288
|
}
|
|
278
289
|
j-order .state {
|
|
279
290
|
padding: 1px var(--space-8);
|
|
280
|
-
border-radius:
|
|
291
|
+
border-radius: var(--radius-pill);
|
|
281
292
|
background: var(--flavour-tint);
|
|
282
293
|
color: var(--flavour-ink);
|
|
283
294
|
font: var(--font-small);
|
|
@@ -316,27 +327,38 @@ j-lines {
|
|
|
316
327
|
display: none;
|
|
317
328
|
}
|
|
318
329
|
|
|
319
|
-
/* a customer's steps: where their order is
|
|
330
|
+
/* a customer's steps: where their order is, read not pressed. Four across, each a track over its word: the steps
|
|
331
|
+
it's been through and the one it's at, the track filled in the page's flavour; the one it's at, its word in ink */
|
|
320
332
|
ol.steps {
|
|
321
333
|
display: grid;
|
|
322
|
-
grid-template-columns: repeat(
|
|
323
|
-
gap: var(--space-
|
|
334
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
335
|
+
gap: var(--space-4);
|
|
336
|
+
margin: 0 0 var(--space-16);
|
|
324
337
|
padding: 0;
|
|
325
338
|
list-style: none;
|
|
326
339
|
}
|
|
327
340
|
ol.steps li {
|
|
328
|
-
padding: var(--space-
|
|
329
|
-
border-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
341
|
+
padding-top: var(--space-6);
|
|
342
|
+
border-top: var(--size-stripe) solid var(--line);
|
|
343
|
+
color: var(--muted);
|
|
344
|
+
font: var(--font-small);
|
|
345
|
+
}
|
|
346
|
+
body[data-status="placed"] :is([data-step="placed"], li:has(~ [data-step="placed"])),
|
|
347
|
+
body[data-status="being made"] :is([data-step="being made"], li:has(~ [data-step="being made"])),
|
|
348
|
+
body[data-status="ready"] :is([data-step="ready"], li:has(~ [data-step="ready"])),
|
|
349
|
+
body[data-status="collected"] :is([data-step="collected"], li:has(~ [data-step="collected"])) {
|
|
350
|
+
border-top-color: var(--flavour-solid);
|
|
333
351
|
}
|
|
334
352
|
body[data-status="placed"] [data-step="placed"],
|
|
335
353
|
body[data-status="being made"] [data-step="being made"],
|
|
336
354
|
body[data-status="ready"] [data-step="ready"],
|
|
337
355
|
body[data-status="collected"] [data-step="collected"] {
|
|
338
|
-
|
|
339
|
-
|
|
356
|
+
color: var(--ink);
|
|
357
|
+
font-weight: 600;
|
|
358
|
+
}
|
|
359
|
+
/* its order under them says no step again: the steps are where it is */
|
|
360
|
+
main.yours j-order .state {
|
|
361
|
+
display: none;
|
|
340
362
|
}
|
|
341
363
|
|
|
342
364
|
/* the supply form: each field over its name, Order at the end of the row */
|
|
@@ -346,73 +368,65 @@ form.add.buy {
|
|
|
346
368
|
align-items: end;
|
|
347
369
|
gap: var(--space-12);
|
|
348
370
|
}
|
|
371
|
+
/* what it's for, the field with the most to say: two columns wide (the whole width on a phone), never cut to a word */
|
|
372
|
+
form.add.buy > [name="title"] {
|
|
373
|
+
grid-column: span 2;
|
|
374
|
+
}
|
|
375
|
+
/* Order at the end of the row; on a phone, the form's whole width, as every form's main deed is there */
|
|
376
|
+
form.add.buy > .act {
|
|
377
|
+
grid-column: -2 / -1;
|
|
378
|
+
}
|
|
379
|
+
@media (max-width: 40rem) {
|
|
380
|
+
form.add.buy > .act {
|
|
381
|
+
grid-column: 1 / -1;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
349
384
|
form.add.buy label {
|
|
350
385
|
display: grid;
|
|
351
386
|
gap: var(--space-4);
|
|
352
387
|
font: var(--font-label);
|
|
353
388
|
}
|
|
354
|
-
form.add.buy button {
|
|
355
|
-
min-height: 40px;
|
|
356
|
-
}
|
|
357
389
|
|
|
358
|
-
/* supplies and books: a row each */
|
|
390
|
+
/* supplies and books: a row each (a supply is joined's Row: its look is the part's) */
|
|
359
391
|
j-supplies,
|
|
360
392
|
j-entries {
|
|
361
393
|
display: grid;
|
|
362
394
|
}
|
|
363
|
-
j-supply,
|
|
364
395
|
j-entry {
|
|
365
396
|
display: block;
|
|
366
397
|
padding: var(--space-12) 0;
|
|
367
398
|
border-bottom: 1px solid var(--line);
|
|
368
399
|
}
|
|
369
|
-
j-supply:last-child,
|
|
370
400
|
j-entry:last-child {
|
|
371
401
|
border-bottom: 0;
|
|
372
402
|
}
|
|
373
|
-
/* a supply
|
|
403
|
+
/* a supply's Delivered, beside its row's words; what it said, under them */
|
|
374
404
|
j-supply {
|
|
375
|
-
display: grid;
|
|
376
|
-
gap: var(--space-4);
|
|
377
|
-
}
|
|
378
|
-
j-supply p {
|
|
379
|
-
margin: 0;
|
|
380
|
-
}
|
|
381
|
-
j-supply .head {
|
|
382
|
-
display: flex;
|
|
383
405
|
flex-wrap: wrap;
|
|
384
|
-
align-items: baseline;
|
|
385
|
-
gap: var(--space-4) var(--space-12);
|
|
386
|
-
}
|
|
387
|
-
j-supply .head b {
|
|
388
|
-
font: var(--font-title);
|
|
389
|
-
}
|
|
390
|
-
j-supply .what {
|
|
391
|
-
font: var(--font-row);
|
|
392
|
-
}
|
|
393
|
-
j-supply .whose {
|
|
394
|
-
color: var(--muted);
|
|
395
|
-
font: var(--font-small);
|
|
396
406
|
}
|
|
397
|
-
j-supply .
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
gap: var(--space-8);
|
|
407
|
+
j-supply > .act {
|
|
408
|
+
align-self: center;
|
|
409
|
+
margin-right: var(--space-12);
|
|
401
410
|
}
|
|
402
|
-
j-supply .
|
|
411
|
+
j-supply > .said:empty {
|
|
403
412
|
display: none;
|
|
404
413
|
}
|
|
414
|
+
j-supply > .said {
|
|
415
|
+
flex-basis: 100%;
|
|
416
|
+
margin: 0 var(--space-16) var(--space-8);
|
|
417
|
+
}
|
|
418
|
+
/* what an entry is, a tag as a row's state is drawn (joined's rows): a pill in the edge, its words muted */
|
|
405
419
|
.pill {
|
|
406
|
-
border-radius:
|
|
420
|
+
border-radius: var(--radius-pill);
|
|
407
421
|
padding: 0 var(--space-8);
|
|
408
|
-
border: 1px solid var(--
|
|
409
|
-
|
|
422
|
+
border: 1px solid var(--edge);
|
|
423
|
+
color: var(--muted);
|
|
424
|
+
font: var(--font-small);
|
|
410
425
|
}
|
|
411
|
-
|
|
426
|
+
/* sold, money in: told from bought by its words in ink */
|
|
412
427
|
.pill.sold {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
color: var(--on-flavour);
|
|
428
|
+
border-color: var(--ink);
|
|
429
|
+
color: var(--ink);
|
|
416
430
|
}
|
|
417
431
|
/* a statement: what it was, bought or sold, its total at the right */
|
|
418
432
|
j-entry {
|
|
@@ -429,17 +443,20 @@ j-entry small {
|
|
|
429
443
|
color: var(--muted);
|
|
430
444
|
font: var(--font-small);
|
|
431
445
|
}
|
|
446
|
+
/* an amount, a row's words in bold, its figures lined up */
|
|
432
447
|
j-entry > b,
|
|
433
448
|
.sums b {
|
|
434
449
|
text-align: right;
|
|
435
|
-
font: var(--font-
|
|
450
|
+
font: var(--font-row);
|
|
451
|
+
font-weight: 600;
|
|
452
|
+
font-variant-numeric: tabular-nums;
|
|
436
453
|
}
|
|
437
454
|
.sums {
|
|
438
455
|
display: grid;
|
|
439
456
|
gap: var(--space-6);
|
|
440
457
|
margin: var(--space-12) 0 0;
|
|
441
458
|
padding-top: var(--space-12);
|
|
442
|
-
border-top:
|
|
459
|
+
border-top: 1px solid var(--edge);
|
|
443
460
|
}
|
|
444
461
|
.sums span {
|
|
445
462
|
display: flex;
|
|
@@ -473,7 +490,7 @@ main.menu .card {
|
|
|
473
490
|
gap: var(--space-4);
|
|
474
491
|
padding: var(--space-12) var(--space-16);
|
|
475
492
|
border: 1px solid var(--edge);
|
|
476
|
-
border-radius:
|
|
493
|
+
border-radius: var(--radius);
|
|
477
494
|
background: var(--card);
|
|
478
495
|
color: var(--ink);
|
|
479
496
|
text-decoration: none;
|
|
@@ -497,6 +514,7 @@ main.menu .card {
|
|
|
497
514
|
font: var(--font-row);
|
|
498
515
|
}
|
|
499
516
|
.front .go .act {
|
|
517
|
+
flex-direction: row-reverse;
|
|
500
518
|
text-decoration: none;
|
|
501
519
|
}
|
|
502
520
|
/* the menu's search, at the head of its rows */
|
|
@@ -17,7 +17,7 @@ const send = (from: Element, ops: object[], why?: string) => new Promise<Answer>
|
|
|
17
17
|
/** A post's fields, as the stories give them. */
|
|
18
18
|
export type JPostData = { "role": string; "members": number[] };
|
|
19
19
|
/** An add of a post, as it's sent: its fields as the stories write them. */
|
|
20
|
-
export type JPostValue = { "role": string; "members": number[] };
|
|
20
|
+
export type JPostValue = { "role": string; "members": (number | `$${number}`)[] };
|
|
21
21
|
|
|
22
22
|
/** <j-post key>: role (string), members (ids in members), each an attribute. */
|
|
23
23
|
export class JPost extends HTMLElement {
|
|
@@ -33,6 +33,10 @@ export class JPost extends HTMLElement {
|
|
|
33
33
|
/** How a view shows it, drawn again whenever an attribute changes (what its person may do, its may, too). */
|
|
34
34
|
draw?(): void;
|
|
35
35
|
attributeChangedCallback() { this.#data = undefined; this.draw?.(); }
|
|
36
|
+
/** Replace some of its fields (members): one write for all of them. */
|
|
37
|
+
replace(fields: Partial<Pick<JPostData, "members">>, why?: string) {
|
|
38
|
+
return send(this, Object.entries(fields).filter(([, value]) => value !== undefined).map(([field, value]) => ({ op: "replace", path: `${this.path}/${field.replace(".", "/")}`, value })), why);
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
/** <j-posts>: the document's posts, each a <j-post> inside it. */
|
|
@@ -48,7 +52,8 @@ customElements.define("j-posts", JPosts);
|
|
|
48
52
|
|
|
49
53
|
/** An op on staff the stories allow, in any of its collections. */
|
|
50
54
|
export type StaffOp =
|
|
51
|
-
| { op: "add"; path: "/posts/-"; value: JPostValue }
|
|
55
|
+
| { op: "add"; path: "/posts/-"; value: JPostValue }
|
|
56
|
+
| { op: "replace"; path: `/posts/${number}/members`; value: number[] };
|
|
52
57
|
|
|
53
58
|
/** One write to staff across its collections (a move with its legs): sent from an element of it, checked
|
|
54
59
|
* whole by its rules, and made whole or not at all. */
|
|
@@ -56,6 +56,11 @@ export const anonymous = false;
|
|
|
56
56
|
export const type = "shared";
|
|
57
57
|
/** The parts of supplies a page may hold alone, by its query's parameters (its definitions' window): null, none. */
|
|
58
58
|
export const window = null;
|
|
59
|
+
/** Each link whose every id names one a who-path finds, its test and the words another is refused in (its
|
|
60
|
+
* definitions' links, holds). */
|
|
61
|
+
export const names: Record<string, readonly [(m: number, read: (doc: string) => any, doc: string) => boolean, string]> = {
|
|
62
|
+
"supplier": [(m, read, doc) => (read("staff")["posts"] ?? []).some((i: any) => String(i["role"]) === "supplier" && (i["members"] === m || (Array.isArray(i["members"]) && i["members"].includes(m)))), "supplier names someone who isn't among staff's posts with role supplier"],
|
|
63
|
+
};
|
|
59
64
|
/** The document as one statement over its tables (generated/supplies.queries.ts). */
|
|
60
65
|
export { query, postgres, items, triggers } from "./supplies.queries.ts";
|
|
61
66
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* <kitchen-rail>'s look, adopted in its shadow (with joined's parts): a kitchen's screen, read from across the room,
|
|
2
|
-
|
|
3
|
-
edge, ink words, how long it's waited
|
|
4
|
-
filled
|
|
2
|
+
who and what large. Its colours are the cafe's, as the till's and a customer's order are drawn: a ticket a card in
|
|
3
|
+
its edge, ink words, how long it's waited in muted words beside who it's for; late, after ten minutes, it says so,
|
|
4
|
+
a tag filled in the page's flavour, and the ticket edged in it. Light and dark as the device asks. */
|
|
5
5
|
:host {
|
|
6
6
|
display: block;
|
|
7
7
|
}
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
}
|
|
20
20
|
section {
|
|
21
21
|
min-height: 8rem;
|
|
22
|
-
border-radius:
|
|
22
|
+
border-radius: var(--radius);
|
|
23
23
|
}
|
|
24
24
|
section[over] {
|
|
25
|
-
outline:
|
|
26
|
-
outline-offset:
|
|
25
|
+
outline: var(--size-ring) dashed var(--ink);
|
|
26
|
+
outline-offset: var(--size-ring);
|
|
27
27
|
}
|
|
28
28
|
h3 {
|
|
29
29
|
margin: 0 0 var(--space-8);
|
|
@@ -43,7 +43,7 @@ ol {
|
|
|
43
43
|
gap: var(--space-8);
|
|
44
44
|
padding: var(--space-12);
|
|
45
45
|
border: 1px solid var(--edge);
|
|
46
|
-
border-radius:
|
|
46
|
+
border-radius: var(--radius);
|
|
47
47
|
background: var(--card);
|
|
48
48
|
color: var(--ink);
|
|
49
49
|
}
|
|
@@ -63,19 +63,11 @@ ol {
|
|
|
63
63
|
}
|
|
64
64
|
.wait {
|
|
65
65
|
padding: 0 var(--space-8);
|
|
66
|
-
border-radius:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
font: var(--font-heading);
|
|
66
|
+
border-radius: var(--radius-pill);
|
|
67
|
+
color: var(--muted);
|
|
68
|
+
font: var(--font-row);
|
|
70
69
|
white-space: nowrap;
|
|
71
70
|
}
|
|
72
|
-
.ticket[data-status="being made"] .wait {
|
|
73
|
-
background: color-mix(in srgb, var(--flavour) 24%, transparent);
|
|
74
|
-
}
|
|
75
|
-
.ticket[data-status="ready"] .wait {
|
|
76
|
-
background: none;
|
|
77
|
-
box-shadow: inset 0 0 0 1px var(--flavour-deep);
|
|
78
|
-
}
|
|
79
71
|
.ticket[late] .wait {
|
|
80
72
|
background: var(--flavour-solid);
|
|
81
73
|
color: var(--on-flavour);
|
|
@@ -93,7 +85,7 @@ ul {
|
|
|
93
85
|
.acts .act {
|
|
94
86
|
width: 100%;
|
|
95
87
|
justify-content: center;
|
|
96
|
-
min-height:
|
|
88
|
+
min-height: var(--size-finger);
|
|
97
89
|
}
|
|
98
90
|
/* a ticket picked up: over the rest, following the pointer */
|
|
99
91
|
.ticket[dragged] {
|
package/examples/cafe/kitchen.ts
CHANGED
|
@@ -85,14 +85,18 @@ class KitchenRail extends HTMLElement {
|
|
|
85
85
|
make: () => {
|
|
86
86
|
const ticket = Object.assign(document.createElement("li"), { className: "ticket" });
|
|
87
87
|
ticket.dataset.status = status;
|
|
88
|
-
|
|
88
|
+
const late = status !== "ready" && waited >= 10;
|
|
89
|
+
ticket.toggleAttribute("late", late);
|
|
89
90
|
const head = Object.assign(document.createElement("p"), { className: "head" }),
|
|
90
91
|
acts = Object.assign(document.createElement("p"), { className: "acts" }),
|
|
91
92
|
why = Object.assign(document.createElement("p"), { className: "said", role: "status" });
|
|
92
93
|
// read from across the room: who, and how long they've waited, large; its column says where it is
|
|
93
94
|
head.append(
|
|
94
95
|
Object.assign(document.createElement("b"), { textContent: `#${order.key} ${customer}` }),
|
|
95
|
-
Object.assign(document.createElement("span"), {
|
|
96
|
+
Object.assign(document.createElement("span"), {
|
|
97
|
+
className: "wait",
|
|
98
|
+
textContent: `${late ? "late, " : ""}${waitOf(waited)}`,
|
|
99
|
+
}),
|
|
96
100
|
);
|
|
97
101
|
const list = document.createElement("ul");
|
|
98
102
|
list.append(...lines.map((words) => Object.assign(document.createElement("li"), { textContent: words })));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Made by `bun run compile` from the stories, its change by hand: a supply's terms.days and terms.by are needed, as
|
|
2
|
+
// every add gives them and every supply of the seed has them in its terms (the compiler read the seed's objects
|
|
3
|
+
// unopened before, so they were left optional). SQLite makes the table again without them empty; Postgres's are
|
|
4
|
+
// made needed in place.
|
|
5
|
+
import { guardTable, type Up } from "joined/migrate";
|
|
6
|
+
|
|
7
|
+
export const changes = [
|
|
8
|
+
guardTable("supplies", { columns: { title: { type: "text", is: { type: "string", said: "title is a string" } }, item: { type: "integer", is: { type: "integer", said: "item is a whole number" }, to: { table: "items", said: "item links only to items the menu document holds", held: ["supply in supplies links to it", "supplys in supplies link to it"] } }, qty: { type: "integer", is: { type: "integer", said: "qty is a whole number" } }, price: { type: "integer", is: { type: "integer", said: "price is a whole number" } }, buyer: { type: "integer", nullable: true, is: { type: "integer", said: "buyer is a whole number" }, to: { table: "members", said: "buyer links only to members the members document holds", onDelete: "set null" } }, supplier: { type: "integer", nullable: true, is: { type: "integer", said: "supplier is a whole number" }, to: { table: "members", said: "supplier links only to members the members document holds", onDelete: "set null" } }, "terms.days": { type: "integer", is: { type: "integer", said: "terms.days is a whole number" } }, "terms.by": { type: "text", is: { type: "string", said: "terms.by is a string" } }, delivered: { type: "boolean", is: { type: "boolean", said: "delivered is a boolean" } } }, strict: true, needs: { columns: ["title", "item", "qty", "price", "buyer", "supplier", "terms.days", "terms.by", "delivered"], said: "a supply needs title (string), item (an id in items), qty (integer), price (integer), buyer (an id in members), supplier (an id in members), terms.days (integer), terms.by (string), delivered (boolean)" } }),
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const up: Up = (db) => {
|
|
12
|
+
if (db.dialect === "postgres")
|
|
13
|
+
for (const column of ["terms.days", "terms.by"])
|
|
14
|
+
db.run(`ALTER TABLE supplies ALTER COLUMN "${column}" SET NOT NULL`);
|
|
15
|
+
};
|
package/examples/cafe/order.html
CHANGED
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
<link rel="stylesheet" href="./cafe.css" />
|
|
11
11
|
</head>
|
|
12
12
|
<body data-flavour="bondi">
|
|
13
|
+
<a class="brand" href="/"><img src="joined/icon.png" alt="" width="28" height="28" />joined</a>
|
|
13
14
|
<header class="band">
|
|
14
15
|
<h1>Your order</h1>
|
|
15
16
|
</header>
|
|
16
17
|
<main class="cafe yours">
|
|
17
18
|
<wa-card class="card" aria-label="Your order">
|
|
18
|
-
<ol class="steps">
|
|
19
|
+
<ol class="steps" aria-label="Where it is">
|
|
19
20
|
<li data-step="placed">Placed</li>
|
|
20
21
|
<li data-step="being made">Being made</li>
|
|
21
22
|
<li data-step="ready">Ready</li>
|
package/examples/cafe/order.ts
CHANGED
|
@@ -22,7 +22,7 @@ const SAYS: Record<string, string> = {
|
|
|
22
22
|
};
|
|
23
23
|
const Order = orderView(
|
|
24
24
|
JOrder,
|
|
25
|
-
[{ words: "Cancel my order", from: "placed", to: "cancelled", ask: "
|
|
25
|
+
[{ words: "Cancel my order", from: "placed", to: "cancelled", ask: "Your order will be cancelled." }],
|
|
26
26
|
askFirst(
|
|
27
27
|
document.querySelector("wa-dialog.ask")!,
|
|
28
28
|
"Cancel it",
|
package/examples/cafe/staff.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{"cast":{"wai":"nora","cook":"dev","manager":"peter","buyer":"peter","roaster":"nick"}}
|
|
2
|
-
{"links":{"item":{"to":"items","one":true},"order":{"to":"orders","one":true,"part":true},"buyer":{"to":"members","one":true},"supplier":{"to":"members","one":true}}}
|
|
2
|
+
{"links":{"item":{"to":"items","one":true},"order":{"to":"orders","one":true,"part":true},"buyer":{"to":"members","one":true},"supplier":{"to":"members","one":true,"holds":"staff/posts[role=supplier]@members"}}}
|
|
3
3
|
{"roles":{"manager":"staff/posts[role=manager]@members","till":"staff/posts[role=till]@members","kitchen":"staff/posts[role=kitchen]@members","buyer":"@buyer","supplier":"@supplier"}}
|
|
4
4
|
{"owns":{"supplies":"@buyer | @supplier"}}
|
|
5
5
|
{"fills":{"orders":{"status":"placed","placed":"now","code":"random","total":0}}}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
{"addedWith":{"lines":{"order":"an order's lines are set when it's placed"}}}
|
|
16
16
|
{"frozen":{"supplies":{"by":"delivered","fields":["price","terms"],"refused":"a delivered supply keeps its price and terms"}}}
|
|
17
17
|
{"story":"Peter puts Dev in the kitchen too","as":"manager","does":{"doc":"staff","ops":[{"op":"add","path":"/posts/-","value":{"role":"kitchen","members":[4]}}]},"seen":["manager"]}
|
|
18
|
+
{"story":"Peter takes Nora off the till","as":"manager","does":{"doc":"staff","ops":[{"op":"replace","path":"/posts/2/members","value":[1]}]},"seen":["manager"]}
|
|
18
19
|
{"story":"Wai can't give anyone a role","as":"wai","cannot":{"doc":"staff","ops":[{"op":"add","path":"/posts/-","value":{"role":"till","members":[4]}}]},"refused":"you may not add at /posts/-"}
|
|
19
20
|
{"story":"Peter puts muffins on the menu","as":"manager","does":{"doc":"menu","ops":[{"op":"add","path":"/items/-","value":{"name":"Muffin","price":300,"stock":12}}]},"seen":["manager","wai"]}
|
|
20
21
|
{"story":"Peter prices a latte at £3.80","as":"manager","does":{"doc":"menu","ops":[{"op":"replace","path":"/items/3/price","value":380}]},"seen":["manager","wai"]}
|
|
@@ -41,5 +42,6 @@
|
|
|
41
42
|
{"story":"Nick delivers: the kitchen has twenty more croissants","as":"roaster","does":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/1/delivered","value":true}]},"seen":["roaster","buyer"],"then":{"menu/items/5/stock":22}}
|
|
42
43
|
{"story":"Peter can't say it's delivered: that's Nick's","as":"buyer","cannot":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/1/delivered","value":true}]},"refused":"you may not replace at /supplies/1/delivered"}
|
|
43
44
|
{"story":"Nora can't order in Peter's name","as":"wai","cannot":{"doc":"supplies","ops":[{"op":"add","path":"/supplies/-","value":{"title":"Croissants, Monday","item":5,"qty":20,"price":120,"buyer":1,"supplier":2,"terms":{"days":14,"by":"invoice"},"delivered":false}}]},"refused":"you may not add at /supplies/-"}
|
|
45
|
+
{"story":"Peter can't order from Nora: she isn't a supplier","as":"buyer","cannot":{"doc":"supplies","ops":[{"op":"add","path":"/supplies/-","value":{"title":"Croissants, Monday","item":5,"qty":20,"price":120,"buyer":1,"supplier":3,"terms":{"days":14,"by":"invoice"},"delivered":false}}]},"refused":"supplier names someone who isn't among staff's posts with role supplier"}
|
|
44
46
|
{"story":"Nick can't change his price once it's delivered: both books have it","as":"roaster","cannot":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/2/price","value":200}]},"refused":"a delivered supply keeps its price and terms"}
|
|
45
|
-
{"story":"Nick can't take back
|
|
47
|
+
{"story":"Taking back a delivery takes it from stock, while there's stock: Nick can't take back 30 croissants when the kitchen has 2","as":"roaster","cannot":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/2/delivered","value":false}]},"refused":"The kitchen has 2 of Croissant: not enough to take 30."}
|