@shivaedev/work-board 0.3.0 → 0.4.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/CHANGELOG.md +36 -0
- package/README.md +70 -11
- package/dist/attention/overviewHtml.d.ts +3 -0
- package/dist/attention/overviewHtml.d.ts.map +1 -0
- package/dist/attention/overviewHtml.js +41 -0
- package/dist/attention/overviewHtml.js.map +1 -0
- package/dist/attention/requests.d.ts +24 -0
- package/dist/attention/requests.d.ts.map +1 -0
- package/dist/attention/requests.js +40 -0
- package/dist/attention/requests.js.map +1 -0
- package/dist/attention/style.d.ts +2 -0
- package/dist/attention/style.d.ts.map +1 -0
- package/dist/attention/style.js +10 -0
- package/dist/attention/style.js.map +1 -0
- package/dist/board.d.ts.map +1 -1
- package/dist/board.js +6 -1
- package/dist/board.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/files/changes.d.ts.map +1 -1
- package/dist/files/changes.js +4 -9
- package/dist/files/changes.js.map +1 -1
- package/dist/files/home.d.ts.map +1 -1
- package/dist/files/home.js +4 -0
- package/dist/files/home.js.map +1 -1
- package/dist/files/list.d.ts +7 -0
- package/dist/files/list.d.ts.map +1 -1
- package/dist/files/list.js +23 -13
- package/dist/files/list.js.map +1 -1
- package/dist/files/markdownPath.d.ts +3 -0
- package/dist/files/markdownPath.d.ts.map +1 -0
- package/dist/files/markdownPath.js +31 -0
- package/dist/files/markdownPath.js.map +1 -0
- package/dist/files/watchDirectories.d.ts +9 -0
- package/dist/files/watchDirectories.d.ts.map +1 -0
- package/dist/files/watchDirectories.js +33 -0
- package/dist/files/watchDirectories.js.map +1 -0
- package/dist/history/baseline.d.ts +19 -0
- package/dist/history/baseline.d.ts.map +1 -0
- package/dist/history/baseline.js +40 -0
- package/dist/history/baseline.js.map +1 -0
- package/dist/history/compare.d.ts +14 -0
- package/dist/history/compare.d.ts.map +1 -0
- package/dist/history/compare.js +47 -0
- package/dist/history/compare.js.map +1 -0
- package/dist/history/documents.d.ts +10 -0
- package/dist/history/documents.d.ts.map +1 -0
- package/dist/history/documents.js +15 -0
- package/dist/history/documents.js.map +1 -0
- package/dist/history/fields.d.ts +3 -0
- package/dist/history/fields.d.ts.map +1 -0
- package/dist/history/fields.js +27 -0
- package/dist/history/fields.js.map +1 -0
- package/dist/history/html.d.ts +4 -0
- package/dist/history/html.d.ts.map +1 -0
- package/dist/history/html.js +22 -0
- package/dist/history/html.js.map +1 -0
- package/dist/history/limits.d.ts +3 -0
- package/dist/history/limits.d.ts.map +1 -0
- package/dist/history/limits.js +3 -0
- package/dist/history/limits.js.map +1 -0
- package/dist/history/response.d.ts +4 -0
- package/dist/history/response.d.ts.map +1 -0
- package/dist/history/response.js +20 -0
- package/dist/history/response.js.map +1 -0
- package/dist/history/schema.d.ts +24 -0
- package/dist/history/schema.d.ts.map +1 -0
- package/dist/history/schema.js +19 -0
- package/dist/history/schema.js.map +1 -0
- package/dist/history/script.d.ts +2 -0
- package/dist/history/script.d.ts.map +1 -0
- package/dist/history/script.js +125 -0
- package/dist/history/script.js.map +1 -0
- package/dist/http/assets.d.ts.map +1 -1
- package/dist/http/assets.js +2 -0
- package/dist/http/assets.js.map +1 -1
- package/dist/http/history.d.ts +7 -0
- package/dist/http/history.d.ts.map +1 -0
- package/dist/http/history.js +45 -0
- package/dist/http/history.js.map +1 -0
- package/dist/http/overview.d.ts +5 -0
- package/dist/http/overview.d.ts.map +1 -0
- package/dist/http/overview.js +13 -0
- package/dist/http/overview.js.map +1 -0
- package/dist/http/page.d.ts +2 -2
- package/dist/http/page.d.ts.map +1 -1
- package/dist/http/page.js +5 -6
- package/dist/http/page.js.map +1 -1
- package/dist/metadata/attentionProblems.d.ts +4 -0
- package/dist/metadata/attentionProblems.d.ts.map +1 -0
- package/dist/metadata/attentionProblems.js +16 -0
- package/dist/metadata/attentionProblems.js.map +1 -0
- package/dist/metadata/backlinks.d.ts.map +1 -1
- package/dist/metadata/backlinks.js +5 -0
- package/dist/metadata/backlinks.js.map +1 -1
- package/dist/metadata/fields.d.ts +8 -0
- package/dist/metadata/fields.d.ts.map +1 -1
- package/dist/metadata/problems.d.ts.map +1 -1
- package/dist/metadata/problems.js +3 -1
- package/dist/metadata/problems.js.map +1 -1
- package/dist/metadata/relationshipLabel.d.ts.map +1 -1
- package/dist/metadata/relationshipLabel.js +1 -0
- package/dist/metadata/relationshipLabel.js.map +1 -1
- package/dist/metadata/schema.d.ts +10 -0
- package/dist/metadata/schema.d.ts.map +1 -1
- package/dist/metadata/schema.js +9 -0
- package/dist/metadata/schema.js.map +1 -1
- package/dist/page/attentionDetails.d.ts +4 -0
- package/dist/page/attentionDetails.d.ts.map +1 -0
- package/dist/page/attentionDetails.js +13 -0
- package/dist/page/attentionDetails.js.map +1 -0
- package/dist/page/client.d.ts +1 -1
- package/dist/page/client.d.ts.map +1 -1
- package/dist/page/client.js +1 -0
- package/dist/page/client.js.map +1 -1
- package/dist/page/metadataDetails.d.ts.map +1 -1
- package/dist/page/metadataDetails.js +2 -0
- package/dist/page/metadataDetails.js.map +1 -1
- package/dist/page/navigationScript.js +1 -1
- package/dist/page/shell.d.ts +1 -1
- package/dist/page/shell.d.ts.map +1 -1
- package/dist/page/shell.js +2 -2
- package/dist/page/shell.js.map +1 -1
- package/dist/page/stateScript.d.ts.map +1 -1
- package/dist/page/stateScript.js +6 -0
- package/dist/page/stateScript.js.map +1 -1
- package/dist/page/style.d.ts.map +1 -1
- package/dist/page/style.js +2 -1
- package/dist/page/style.js.map +1 -1
- package/dist/search/attentionEntries.d.ts +4 -0
- package/dist/search/attentionEntries.d.ts.map +1 -0
- package/dist/search/attentionEntries.js +20 -0
- package/dist/search/attentionEntries.js.map +1 -0
- package/dist/search/metadataEntries.d.ts.map +1 -1
- package/dist/search/metadataEntries.js +2 -0
- package/dist/search/metadataEntries.js.map +1 -1
- package/dist/search/snapshot.d.ts +2 -2
- package/dist/search/snapshot.d.ts.map +1 -1
- package/dist/search/snapshot.js +4 -5
- package/dist/search/snapshot.js.map +1 -1
- package/package.json +5 -4
- package/src/attention/overviewHtml.ts +44 -0
- package/src/attention/requests.ts +64 -0
- package/src/attention/style.ts +9 -0
- package/src/board.ts +7 -2
- package/src/cli.ts +1 -1
- package/src/files/changes.ts +4 -16
- package/src/files/home.ts +4 -0
- package/src/files/list.ts +25 -14
- package/src/files/markdownPath.ts +31 -0
- package/src/files/watchDirectories.ts +60 -0
- package/src/history/baseline.ts +43 -0
- package/src/history/compare.ts +54 -0
- package/src/history/documents.ts +21 -0
- package/src/history/fields.ts +32 -0
- package/src/history/html.ts +23 -0
- package/src/history/limits.ts +2 -0
- package/src/history/response.ts +23 -0
- package/src/history/schema.ts +36 -0
- package/src/history/script.ts +124 -0
- package/src/http/assets.ts +2 -0
- package/src/http/history.ts +50 -0
- package/src/http/overview.ts +19 -0
- package/src/http/page.ts +6 -6
- package/src/metadata/attentionProblems.ts +18 -0
- package/src/metadata/backlinks.ts +7 -0
- package/src/metadata/problems.ts +5 -1
- package/src/metadata/relationshipLabel.ts +1 -0
- package/src/metadata/schema.ts +9 -0
- package/src/page/attentionDetails.ts +18 -0
- package/src/page/client.ts +1 -0
- package/src/page/metadataDetails.ts +2 -0
- package/src/page/navigationScript.ts +1 -1
- package/src/page/shell.ts +11 -3
- package/src/page/stateScript.ts +6 -0
- package/src/page/style.ts +2 -1
- package/src/search/attentionEntries.ts +22 -0
- package/src/search/metadataEntries.ts +2 -0
- package/src/search/snapshot.ts +4 -5
package/src/page/shell.ts
CHANGED
|
@@ -9,7 +9,15 @@ function location(file: string): string {
|
|
|
9
9
|
.join('<span class="separator">/</span>');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const shell = (
|
|
12
|
+
export const shell = (
|
|
13
|
+
title: string,
|
|
14
|
+
nav: string,
|
|
15
|
+
main: string,
|
|
16
|
+
workspace: string,
|
|
17
|
+
board: boolean,
|
|
18
|
+
identity?: string,
|
|
19
|
+
view: boolean | "overview" | "changes" = false,
|
|
20
|
+
): string =>
|
|
13
21
|
[
|
|
14
22
|
`<!doctype html><html lang="en" data-workspace="${escapeHtml(workspace)}"><head><meta charset="utf-8">`,
|
|
15
23
|
'<meta name="viewport" content="width=device-width, initial-scale=1"><meta name="color-scheme" content="light dark">',
|
|
@@ -21,11 +29,11 @@ export const shell = (title: string, nav: string, main: string, workspace: strin
|
|
|
21
29
|
`<nav id="files" class="files" aria-label="Project files">${nav}</nav></aside>`,
|
|
22
30
|
'<div class="page"><header class="bar"><button id="sidebar-toggle" type="button" aria-controls="sidebar" aria-expanded="true">Files</button>',
|
|
23
31
|
`<nav id="breadcrumbs" class="breadcrumbs" aria-label="File location"><a href="/">Workspace</a><span class="separator">/</span>${location(title)}</nav>`,
|
|
24
|
-
`<a id="work-open" class="work-open" href="/_board/work?view=board"${view ? ' aria-current="page"' : ""}>Work</a><button id="search-open" type="button" disabled aria-haspopup="dialog" aria-controls="search-dialog">Search <kbd>⌘/Ctrl K</kbd></button><span id="live" class="live" role="status">connecting</span><span id="navigation-status" role="status"></span></header>`,
|
|
32
|
+
`<a id="overview-open" class="work-open" href="/_board/overview"${view === "overview" ? ' aria-current="page"' : ""}>Overview</a><a id="work-open" class="work-open" href="/_board/work?view=board"${view === true ? ' aria-current="page"' : ""}>Work</a><a id="changes-open" class="work-open" href="/_board/changes"${view === "changes" ? ' aria-current="page"' : ""}>Changes</a><button id="search-open" type="button" disabled aria-haspopup="dialog" aria-controls="search-dialog">Search <kbd>⌘/Ctrl K</kbd></button><span id="live" class="live" role="status">connecting</span><span id="navigation-status" role="status"></span></header>`,
|
|
25
33
|
'<div class="preferences" role="group" aria-label="Reading preferences">',
|
|
26
34
|
'<div class="preference"><label for="theme">Theme</label><select id="theme"><option value="system">System</option><option value="light">Light</option><option value="dark">Dark</option></select></div>',
|
|
27
35
|
'<div class="preference"><label for="density">Density</label><select id="density"><option value="comfortable">Comfortable</option><option value="compact">Compact</option></select></div>',
|
|
28
36
|
'<span id="preference-status" role="status"></span></div>',
|
|
29
|
-
`<main${view ?
|
|
37
|
+
`<main${view ? ` data-view="${typeof view === "string" ? view : "work"}"` : ""}${identity ? ` data-identity="${escapeHtml(identity)}"` : ""} id="doc" data-file="${escapeHtml(title)}" data-url="${escapeHtml(fileUrl(title))}" class="${board ? "board-view" : "document-view"}" tabindex="-1">${main}</main>`,
|
|
30
38
|
`</div></div>${searchDialog}</body></html>`,
|
|
31
39
|
].join("");
|
package/src/page/stateScript.ts
CHANGED
|
@@ -18,6 +18,10 @@ export const applyPage = (page, preserve = false) => {
|
|
|
18
18
|
const reading = preserve ? captureReading() : null;
|
|
19
19
|
const cachedScheme = incoming.dataset.scheme;
|
|
20
20
|
if (preserve && (current.dataset.file === incoming.dataset.file || (current.dataset.identity && current.dataset.identity === incoming.dataset.identity))) {
|
|
21
|
+
if (current.dataset.view === "changes" && incoming.dataset.view === "changes") {
|
|
22
|
+
const content = current.querySelector("#changes-content");
|
|
23
|
+
if (content) incoming.querySelector("#changes-content")?.replaceWith(content.cloneNode(true));
|
|
24
|
+
}
|
|
21
25
|
swap(current, incoming);
|
|
22
26
|
} else {
|
|
23
27
|
current.replaceWith(document.importNode(incoming, true));
|
|
@@ -30,6 +34,8 @@ export const applyPage = (page, preserve = false) => {
|
|
|
30
34
|
doc.dataset.url = incoming.dataset.url;
|
|
31
35
|
if (incoming.dataset.view) doc.dataset.view = incoming.dataset.view; else delete doc.dataset.view;
|
|
32
36
|
document.getElementById("work-open")?.setAttribute("aria-current", doc.dataset.view === "work" ? "page" : "false");
|
|
37
|
+
document.getElementById("overview-open")?.setAttribute("aria-current", doc.dataset.view === "overview" ? "page" : "false");
|
|
38
|
+
document.getElementById("changes-open")?.setAttribute("aria-current", doc.dataset.view === "changes" ? "page" : "false");
|
|
33
39
|
doc.dataset.scheme = document.documentElement.dataset.scheme;
|
|
34
40
|
swap(document.getElementById("files"), page.getElementById("files"));
|
|
35
41
|
const crumbs = page.getElementById("breadcrumbs");
|
package/src/page/style.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { attentionStyle } from "#attention/style.ts";
|
|
1
2
|
import { workStyle } from "#views/workStyle.ts";
|
|
2
3
|
import { metadataStyles } from "./metadata.ts";
|
|
3
4
|
import { readingStyles } from "./readingStyles.ts";
|
|
@@ -55,4 +56,4 @@ figure.diagram[data-state="failed"]::after { content: attr(data-error); color: v
|
|
|
55
56
|
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
|
|
56
57
|
`;
|
|
57
58
|
|
|
58
|
-
export const style = theme + layout + prose + board + diagrams + readingStyles() + searchStyles + metadataStyles + workStyle();
|
|
59
|
+
export const style = theme + layout + prose + board + diagrams + readingStyles() + searchStyles + metadataStyles + workStyle() + attentionStyle();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MetadataDocument } from "#metadata/model.ts";
|
|
2
|
+
import type { Entry } from "./entries.ts";
|
|
3
|
+
|
|
4
|
+
export function attentionEntries(document: MetadataDocument, href: string): readonly Entry[] {
|
|
5
|
+
const requests = document.parsed.fields.attention ?? [];
|
|
6
|
+
return requests.flatMap((request, index) => {
|
|
7
|
+
if (requests.filter((other) => other.id === request.id).length !== 1) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const line = document.parsed.lines[`attention.${index}`] ?? document.parsed.lines.attention;
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
file: document.file,
|
|
14
|
+
href: `${href}#attention-request-${encodeURIComponent(request.id)}`,
|
|
15
|
+
kind: "passage",
|
|
16
|
+
...(line === undefined ? {} : { line }),
|
|
17
|
+
text: [request.reason, request.id, request.kind, request.state, ...request.responseFrom, ...request.unblocks].join(" "),
|
|
18
|
+
title: request.reason,
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fileUrl } from "#files/url.ts";
|
|
2
2
|
import { identityUrl } from "#metadata/links.ts";
|
|
3
3
|
import type { MetadataDocument, MetadataModel } from "#metadata/model.ts";
|
|
4
|
+
import { attentionEntries } from "./attentionEntries.ts";
|
|
4
5
|
import type { Entry } from "./entries.ts";
|
|
5
6
|
|
|
6
7
|
function itemUrl(document: MetadataDocument, model: MetadataModel): string {
|
|
@@ -22,6 +23,7 @@ export function metadataEntries(entries: readonly Entry[], documents: readonly M
|
|
|
22
23
|
};
|
|
23
24
|
});
|
|
24
25
|
for (const document of documents) {
|
|
26
|
+
enriched.push(...attentionEntries(document, itemUrl(document, model)));
|
|
25
27
|
const criteria = document.parsed.fields.criteria ?? [];
|
|
26
28
|
for (const [index, criterion] of criteria.entries()) {
|
|
27
29
|
if (criteria.filter((item) => item.id === criterion.id).length !== 1) {
|
package/src/search/snapshot.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Effect, FileSystem, Option,
|
|
1
|
+
import { Effect, FileSystem, Option, Ref, Semaphore } from "effect";
|
|
2
2
|
import type { Changes } from "#files/changes.ts";
|
|
3
|
-
import {
|
|
3
|
+
import { markdownPath } from "#files/markdownPath.ts";
|
|
4
4
|
import { type MetadataDocument, metadataModel } from "#metadata/model.ts";
|
|
5
5
|
import { metadataParse } from "#metadata/parse.ts";
|
|
6
6
|
import { type Entry, entriesOf } from "./entries.ts";
|
|
@@ -24,7 +24,6 @@ export const searchSnapshot = Effect.fn("WorkBoard.searchSnapshot")(function* (r
|
|
|
24
24
|
return hit;
|
|
25
25
|
}
|
|
26
26
|
const fs = yield* FileSystem.FileSystem;
|
|
27
|
-
const path = yield* Path.Path;
|
|
28
27
|
const files = yield* changes.files;
|
|
29
28
|
const entries: Entry[] = [];
|
|
30
29
|
const documents: MetadataDocument[] = [];
|
|
@@ -32,8 +31,8 @@ export const searchSnapshot = Effect.fn("WorkBoard.searchSnapshot")(function* (r
|
|
|
32
31
|
for (const file of files) {
|
|
33
32
|
const found = yield* Effect.option(
|
|
34
33
|
Effect.gen(function* () {
|
|
35
|
-
const real = yield*
|
|
36
|
-
if (
|
|
34
|
+
const real = yield* markdownPath(root, changes.realRoot, file.path);
|
|
35
|
+
if (real === undefined) {
|
|
37
36
|
return undefined;
|
|
38
37
|
}
|
|
39
38
|
const source = yield* fs.readFileString(real);
|