@blueshed/joined 0.2.2 → 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/SKILL.md +9 -1
- package/.claude/skills/joined/reference.md +316 -63
- package/.claude/skills/joined-door/SKILL.md +57 -0
- package/README.md +19 -50
- package/docs/design.md +158 -37
- package/docs/introduction.md +27 -27
- package/docs/light-and-shadow.svg +2 -1
- 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/README.md +20 -0
- package/examples/account/account.json +1 -0
- package/examples/account/derive.ts +41 -0
- package/examples/account/generated/elements.ts +52 -0
- package/examples/account/generated/rows.ts +22 -0
- package/examples/account/generated/rules.ts +32 -0
- package/examples/account/routes.ts +5 -0
- package/examples/app.css +11 -1
- package/examples/cafe/books.html +2 -2
- package/examples/cafe/cafe.css +96 -85
- package/examples/cafe/generated/books.rows.ts +22 -0
- package/examples/cafe/generated/books.rules.ts +3 -2
- package/examples/cafe/generated/kitchen.rows.ts +27 -0
- package/examples/cafe/generated/kitchen.rules.ts +11 -1
- package/examples/cafe/generated/menu.rows.ts +22 -0
- package/examples/cafe/generated/menu.rules.ts +3 -2
- package/examples/cafe/generated/order.rows.ts +27 -0
- package/examples/cafe/generated/order.rules.ts +11 -1
- package/examples/cafe/generated/staff.elements.ts +7 -2
- package/examples/cafe/generated/staff.rows.ts +22 -0
- package/examples/cafe/generated/staff.rules.ts +9 -1
- package/examples/cafe/generated/supplies.queries.ts +4 -2
- package/examples/cafe/generated/supplies.rows.ts +22 -0
- package/examples/cafe/generated/supplies.rules.ts +17 -1
- package/examples/cafe/generated/till.queries.ts +2 -0
- package/examples/cafe/generated/till.rows.ts +27 -0
- package/examples/cafe/generated/till.rules.ts +11 -1
- package/examples/cafe/index.html +14 -15
- package/examples/cafe/kitchen.css +11 -19
- package/examples/cafe/kitchen.ts +7 -3
- package/examples/cafe/look.ts +30 -0
- package/examples/cafe/menu.html +10 -26
- package/examples/cafe/menu.ts +8 -80
- package/examples/cafe/migrations/002-guard-supplies.ts +15 -0
- package/examples/cafe/order.html +8 -7
- package/examples/cafe/order.ts +6 -2
- package/examples/cafe/routes.ts +0 -1
- package/examples/cafe/staff.json +5 -0
- package/examples/cafe/stories.jsonl +6 -2
- package/examples/cafe/supplies.html +35 -34
- package/examples/cafe/supplies.ts +59 -39
- package/examples/cafe/till.ts +19 -11
- package/examples/cafe/views.ts +7 -5
- package/examples/chart/arches.ts +150 -0
- package/examples/chart/chart.css +11 -0
- package/examples/chart/chart.json +87 -0
- package/examples/chart/generated/elements.ts +105 -0
- package/examples/chart/generated/queries.ts +36 -0
- package/examples/chart/generated/rows.ts +27 -0
- package/examples/chart/generated/rules.ts +111 -0
- package/examples/chart/grid.ts +118 -0
- package/examples/chart/index.html +78 -0
- package/examples/chart/migrations/001-chart.ts +6 -0
- package/examples/chart/migrations/002-create-conditions.ts +6 -0
- package/examples/chart/page.ts +20 -0
- package/examples/chart/routes.ts +7 -0
- package/examples/chart/stories.jsonl +14 -0
- package/examples/chart/teeth.ts +57 -0
- package/examples/desk/desk.css +6 -10
- package/examples/desk/generated/elements.ts +1 -1
- package/examples/desk/generated/rows.ts +22 -0
- package/examples/desk/generated/rules.ts +34 -1
- package/examples/desk/index.html +10 -3
- package/examples/desk/lanes.css +21 -19
- package/examples/desk/routes.ts +0 -2
- package/examples/desk/stories.jsonl +4 -3
- package/examples/desk/tally.css +1 -1
- package/examples/desk/thumbs.ts +2 -2
- package/examples/docs.ts +7 -4
- package/examples/hello/generated/elements.ts +2 -2
- package/examples/hello/generated/rules.ts +3 -2
- package/examples/hello/hello.css +2 -4
- package/examples/hello/index.html +10 -3
- package/examples/hello/page.ts +4 -4
- package/examples/index.html +20 -12
- package/examples/notes/generated/elements.ts +112 -0
- package/examples/notes/generated/queries.ts +42 -0
- package/examples/notes/generated/rows.ts +27 -0
- package/examples/notes/generated/rules.ts +133 -0
- package/examples/notes/index.html +32 -0
- package/examples/notes/look.ts +41 -0
- package/examples/notes/migrations/001-notes.ts +7 -0
- package/examples/notes/notes.json +78 -0
- package/examples/notes/page.ts +21 -0
- package/examples/notes/routes.ts +6 -0
- package/examples/notes/stories.jsonl +24 -0
- package/examples/page.ts +9 -2
- package/examples/people/generated/rows.ts +22 -0
- package/examples/people/generated/rules.ts +11 -1
- package/examples/people/links.ts +8 -9
- package/examples/people/people.css +1 -1
- package/examples/people/routes.ts +1 -3
- package/examples/people/stories.jsonl +1 -0
- package/examples/people/view.ts +5 -2
- package/examples/trip/generated/elements.ts +5 -3
- package/examples/trip/generated/queries.ts +12 -1
- package/examples/trip/generated/rows.ts +27 -0
- package/examples/trip/generated/rules.ts +56 -2
- package/examples/trip/index.html +58 -12
- package/examples/trip/line.css +186 -0
- package/examples/trip/line.ts +51 -40
- package/examples/trip/page.ts +65 -71
- package/examples/trip/routes.ts +9 -5
- package/examples/trip/stays.css +13 -13
- package/examples/trip/stays.ts +15 -10
- package/examples/trip/stories.jsonl +2 -0
- package/examples/trip/told.ts +3 -26
- package/examples/trip/trip.css +16 -0
- package/examples/trips/generated/elements.ts +1 -1
- package/examples/trips/generated/rows.ts +22 -0
- package/examples/trips/generated/rules.ts +9 -1
- package/examples/trips/index.html +10 -10
- package/examples/trips/map.ts +3 -14
- package/examples/trips/new-trip.ts +14 -16
- package/examples/trips/trips.css +24 -23
- package/examples/weeks/generated/elements.ts +1 -1
- package/examples/weeks/generated/queries.ts +11 -0
- package/examples/weeks/generated/rows.ts +22 -0
- package/examples/weeks/generated/rules.ts +11 -5
- package/examples/weeks/routes.ts +3 -2
- package/examples/weeks/stories.jsonl +1 -0
- package/examples/welcome.css +43 -33
- package/package.json +8 -2
- package/src/attachment.ts +17 -2
- package/src/awesome.ts +103 -0
- package/src/board.css +76 -0
- package/src/board.ts +173 -0
- package/src/cli.ts +28 -3
- package/src/compile.ts +821 -109
- package/src/definitions.ts +113 -27
- package/src/demo.css +2 -5
- package/src/draft.ts +48 -27
- package/src/drawer.ts +248 -0
- package/src/engine.ts +253 -170
- package/src/fields.ts +341 -0
- package/src/file-value.ts +12 -2
- package/src/files.ts +113 -33
- package/src/ground.ts +110 -0
- package/src/icon-names.ts +19 -2
- package/src/keep.ts +16 -3
- package/src/kit.ts +51 -0
- package/src/link.ts +3 -3
- package/src/map.css +140 -0
- package/src/map.ts +200 -0
- package/src/mcp.ts +129 -24
- package/src/members/demo.ts +13 -12
- package/src/members/generated/rows.ts +22 -0
- package/src/members/generated/rules.ts +3 -2
- package/src/members/group.ts +105 -55
- package/src/members/keys.ts +95 -79
- package/src/members/panel.css +40 -35
- package/src/members/panel.ts +58 -37
- package/src/migrate.ts +178 -125
- package/src/migrations/005-change-kept.ts +7 -0
- package/src/month.css +129 -0
- package/src/month.ts +179 -0
- package/src/ops.ts +40 -1
- package/src/page.css +11 -2
- package/src/page.ts +68 -17
- package/src/parts.css +614 -230
- package/src/parts.ts +259 -36
- package/src/plane.css +61 -0
- package/src/plane.ts +153 -0
- package/src/postgres-server.ts +60 -0
- package/src/reading.css +73 -0
- package/src/reading.ts +238 -0
- package/src/rows.css +289 -0
- package/src/rows.ts +864 -0
- package/src/search.css +80 -0
- package/src/search.ts +130 -0
- package/src/server.ts +355 -137
- package/src/settings.ts +9 -4
- package/src/sheet.ts +116 -0
- package/src/skill.ts +40 -0
- package/src/slots.css +90 -0
- package/src/slots.ts +213 -0
- package/src/specs.ts +38 -0
- package/src/starter.ts +19 -2
- package/src/store.ts +224 -161
- package/src/stories.ts +43 -11
- package/src/surface.ts +164 -0
- package/src/time.ts +2 -0
- package/src/timeline.css +111 -0
- package/src/timeline.ts +235 -0
- package/src/toast.ts +21 -48
- package/src/together.ts +15 -24
- package/src/tokens.css +89 -3
- package/src/tokens.json +287 -7
- package/src/tool.ts +210 -0
- package/src/upkeep.ts +47 -22
- package/src/views.css +43 -0
- package/src/views.ts +111 -0
- package/src/week.css +150 -0
- package/src/week.ts +254 -0
- package/src/write.ts +326 -78
- package/starter/CHANGELOG.md +8 -0
- package/starter/CLAUDE.md +9 -3
- package/starter/bunfig +5 -0
- package/starter/githooks/pre-commit +13 -0
- package/starter/prettierignore +5 -0
- package/starter/tests/hello.test.ts +2 -0
- package/starter/tests/records.test.ts +40 -0
- package/starter/todo.jsonl +0 -0
- package/docs/learning.md +0 -76
- package/examples/cafe/trust.ts +0 -20
- package/examples/desk/trust.ts +0 -24
- package/examples/people/trust.ts +0 -14
- package/examples/trip/answer-rows.ts +0 -70
- package/examples/trip/bar.ts +0 -89
- package/examples/trip/calendar-map.css +0 -711
- package/examples/trip/calendar-map.ts +0 -249
- package/examples/trip/drags.ts +0 -143
- package/examples/trip/drawer.ts +0 -250
- package/examples/trip/event-form.ts +0 -200
- package/examples/trip/holding.ts +0 -61
- package/examples/trip/map.ts +0 -234
- package/examples/trip/month.ts +0 -87
- package/examples/trip/other-weeks.ts +0 -67
- package/examples/trip/peek.ts +0 -71
- package/examples/trip/people-chips.ts +0 -74
- package/examples/trip/shell.ts +0 -39
- package/examples/trip/trust.ts +0 -51
- package/examples/trip/week.ts +0 -237
- package/examples/trip/writes.ts +0 -91
- package/examples/trip/zones.ts +0 -16
- package/examples/weeks/derive.ts +0 -23
- package/src/scrim.ts +0 -81
package/src/search.css
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* <j-search> (./search.ts): a field, the magnifier at its start and its × at its end, at the head of what it finds in
|
|
2
|
+
and as wide as it (a list's own width: rows' 40rem, in the middle of a wide page); how many it found beside it.
|
|
3
|
+
Folded, the magnifier alone, until it's tapped or holds words. */
|
|
4
|
+
:host {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: var(--space-8);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
max-width: var(--size-list);
|
|
10
|
+
min-width: 0;
|
|
11
|
+
margin-inline: auto;
|
|
12
|
+
}
|
|
13
|
+
:host([folded]) {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
margin-inline: 0;
|
|
16
|
+
}
|
|
17
|
+
.box {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
flex: 1 1 auto;
|
|
22
|
+
min-width: 0;
|
|
23
|
+
}
|
|
24
|
+
.box input {
|
|
25
|
+
width: 100%;
|
|
26
|
+
padding-inline: var(--size-control);
|
|
27
|
+
}
|
|
28
|
+
.mark {
|
|
29
|
+
position: absolute;
|
|
30
|
+
left: 0;
|
|
31
|
+
width: var(--size-control);
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
color: var(--muted);
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
.box > .icon-only {
|
|
38
|
+
position: absolute;
|
|
39
|
+
right: 0;
|
|
40
|
+
}
|
|
41
|
+
.look {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
:host([folded]) .look {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
}
|
|
47
|
+
:host([folded][open]) .look,
|
|
48
|
+
:host([folded][found]:not([open])) .mark {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
.look[aria-pressed="true"] {
|
|
52
|
+
color: var(--ink);
|
|
53
|
+
}
|
|
54
|
+
output {
|
|
55
|
+
flex: none;
|
|
56
|
+
font: var(--font-small);
|
|
57
|
+
color: var(--muted);
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
}
|
|
60
|
+
:host([folded]:not([open]):not([found])) :is(.box, output) {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
/* the browser's own clear, where it draws one, is the field's × alone */
|
|
64
|
+
input[type="search"]::-webkit-search-cancel-button {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
@media (pointer: coarse) {
|
|
68
|
+
.look,
|
|
69
|
+
.box > .icon-only {
|
|
70
|
+
width: var(--size-finger);
|
|
71
|
+
height: var(--size-finger);
|
|
72
|
+
}
|
|
73
|
+
.box input {
|
|
74
|
+
min-height: var(--size-finger);
|
|
75
|
+
padding-inline: var(--size-finger);
|
|
76
|
+
}
|
|
77
|
+
.mark {
|
|
78
|
+
width: var(--size-finger);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/src/search.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// <j-search for="items"> (joined/kit): find among a collection's items as the page shows them. A field, the magnifier
|
|
2
|
+
// at its start, at the head of what it finds in; each letter looks again: what's shown of the collection (its rows) is
|
|
3
|
+
// only what has every word typed, and the search says how many of how many. Its ×, or Escape, clears the words and
|
|
4
|
+
// everything comes back. Where there's no room for a field (a bar, `folded`), it's the magnifier alone, a field opening
|
|
5
|
+
// beside it as it's tapped and folding back when it's done (Enter, or a tap elsewhere), its words kept. Finding
|
|
6
|
+
// changes nothing in the document: it's this page's alone, kept in the address (?q=ramen), so a reload or a link
|
|
7
|
+
// keeps it. As cardlet's filter and idea-cards' search had it (Peter, 14 Nov).
|
|
8
|
+
//
|
|
9
|
+
// What's shown is the displays' to say: each is told by a `j-search` event on the document ({ for, words }), and
|
|
10
|
+
// tells what it found by a `j-found` ({ for, shown, of }).
|
|
11
|
+
|
|
12
|
+
import { el } from "./fields.ts";
|
|
13
|
+
import { icon, iconButton } from "./icons.ts";
|
|
14
|
+
import { adopt } from "./parts.ts";
|
|
15
|
+
import STYLE from "./search.css" with { type: "text" };
|
|
16
|
+
|
|
17
|
+
const SHEET = new CSSStyleSheet();
|
|
18
|
+
SHEET.replaceSync(STYLE);
|
|
19
|
+
|
|
20
|
+
/** A search's words, as what's typed is read: lower case, each one apart. */
|
|
21
|
+
export const wordsOf = (typed: string) => typed.toLowerCase().split(/\s+/).filter(Boolean);
|
|
22
|
+
/** Whether words said of a thing have every word looked for. */
|
|
23
|
+
export const found = (said: string, words: string[]) => {
|
|
24
|
+
const s = said.toLowerCase();
|
|
25
|
+
return words.every((w) => s.includes(w));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export class JSearch extends HTMLElement {
|
|
29
|
+
root = this.attachShadow({ mode: "open" });
|
|
30
|
+
#open = el(
|
|
31
|
+
"button",
|
|
32
|
+
{ type: "button", className: "icon-only look", ariaLabel: "Find", title: "Find" },
|
|
33
|
+
icon("search"),
|
|
34
|
+
);
|
|
35
|
+
#mark = el("span", { className: "mark", ariaHidden: "true" }, icon("search"));
|
|
36
|
+
#field = el("input", { type: "search", autocomplete: "off", enterKeyHint: "done", part: "field" });
|
|
37
|
+
#clear = iconButton("close", "Clear");
|
|
38
|
+
#said = el("output", { part: "said", ariaLive: "polite" });
|
|
39
|
+
#away = new AbortController();
|
|
40
|
+
/** How many of how many each display last said it shows. */
|
|
41
|
+
#found = { shown: 0, of: 0 };
|
|
42
|
+
|
|
43
|
+
get for() {
|
|
44
|
+
return this.getAttribute("for") ?? "";
|
|
45
|
+
}
|
|
46
|
+
/** Where its words are kept in the address. */
|
|
47
|
+
get #param() {
|
|
48
|
+
return this.getAttribute("param") ?? "q";
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
if (!this.root.childElementCount) {
|
|
52
|
+
adopt(this.root, SHEET);
|
|
53
|
+
this.#field.placeholder = this.getAttribute("placeholder") ?? `Find ${this.for}`;
|
|
54
|
+
this.#field.ariaLabel = this.#field.placeholder;
|
|
55
|
+
this.root.append(
|
|
56
|
+
this.#open,
|
|
57
|
+
el("span", { className: "box", part: "box" }, this.#mark, this.#field, this.#clear),
|
|
58
|
+
this.#said,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const signal = (this.#away = new AbortController()).signal;
|
|
62
|
+
this.#open.addEventListener("click", () => this.#unfold(), { signal });
|
|
63
|
+
this.#field.addEventListener("input", () => this.#look(), { signal });
|
|
64
|
+
this.#field.addEventListener(
|
|
65
|
+
"keydown",
|
|
66
|
+
(e) => {
|
|
67
|
+
if (e.key === "Enter") (e.preventDefault(), this.#fold());
|
|
68
|
+
if (e.key === "Escape") (e.preventDefault(), this.clear());
|
|
69
|
+
},
|
|
70
|
+
{ signal },
|
|
71
|
+
);
|
|
72
|
+
this.#field.addEventListener("blur", () => this.#fold(), { signal });
|
|
73
|
+
this.#clear.addEventListener("click", () => this.clear(), { signal });
|
|
74
|
+
document.addEventListener(
|
|
75
|
+
"j-found",
|
|
76
|
+
(e) => {
|
|
77
|
+
const d = (e as CustomEvent).detail;
|
|
78
|
+
if (d.for === this.for) ((this.#found = d), this.#say());
|
|
79
|
+
},
|
|
80
|
+
{ signal },
|
|
81
|
+
);
|
|
82
|
+
this.#field.value = new URLSearchParams(location.search).get(this.#param) ?? "";
|
|
83
|
+
this.#look(false);
|
|
84
|
+
this.#fold();
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() {
|
|
87
|
+
this.#away.abort();
|
|
88
|
+
}
|
|
89
|
+
/** Its words, as they're looked for. */
|
|
90
|
+
get words() {
|
|
91
|
+
return wordsOf(this.#field.value);
|
|
92
|
+
}
|
|
93
|
+
/** Its words taken away: everything comes back, and the magnifier is left. */
|
|
94
|
+
clear() {
|
|
95
|
+
this.#field.value = "";
|
|
96
|
+
this.#look();
|
|
97
|
+
this.#fold();
|
|
98
|
+
}
|
|
99
|
+
/** Whether it's the magnifier alone until it's tapped. */
|
|
100
|
+
get #folds() {
|
|
101
|
+
return this.hasAttribute("folded");
|
|
102
|
+
}
|
|
103
|
+
#unfold() {
|
|
104
|
+
this.toggleAttribute("open", true);
|
|
105
|
+
this.#field.focus();
|
|
106
|
+
}
|
|
107
|
+
#fold() {
|
|
108
|
+
this.toggleAttribute("open", !this.#folds);
|
|
109
|
+
this.#open.ariaPressed = String(this.words.length > 0);
|
|
110
|
+
this.#say();
|
|
111
|
+
}
|
|
112
|
+
/** Each display told to show what has every word, and the words kept in the address. */
|
|
113
|
+
#look(keep = true) {
|
|
114
|
+
if (keep) {
|
|
115
|
+
const url = new URL(location.href);
|
|
116
|
+
if (this.words.length) url.searchParams.set(this.#param, this.#field.value.trim());
|
|
117
|
+
else url.searchParams.delete(this.#param);
|
|
118
|
+
history.replaceState(history.state, "", url);
|
|
119
|
+
}
|
|
120
|
+
this.toggleAttribute("found", this.words.length > 0);
|
|
121
|
+
document.dispatchEvent(new CustomEvent("j-search", { detail: { for: this.for, words: this.words } }));
|
|
122
|
+
this.#say();
|
|
123
|
+
}
|
|
124
|
+
/** How many it found, where it's looking: "3 of 12". */
|
|
125
|
+
#say() {
|
|
126
|
+
const { shown, of } = this.#found;
|
|
127
|
+
this.#said.textContent = this.words.length ? `${shown} of ${of}` : "";
|
|
128
|
+
this.#clear.hidden = !this.#field.value;
|
|
129
|
+
}
|
|
130
|
+
}
|