@ascribed/astro 0.2.0 → 0.2.1-next.11
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/README.md +2 -0
- package/dist/attributes.js +6 -5
- package/dist/attributes.js.map +1 -1
- package/dist/content.d.ts +1 -1
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/names.d.ts +95 -0
- package/dist/names.js +99 -0
- package/dist/names.js.map +1 -0
- package/dist/review/diff.d.ts +3 -3
- package/dist/review/diff.js +1 -0
- package/dist/review/diff.js.map +1 -1
- package/dist/review/protocol.d.ts +12 -30
- package/dist/review/protocol.js.map +1 -1
- package/dist/review/routes.d.ts +3 -0
- package/dist/review/routes.js +49 -35
- package/dist/review/routes.js.map +1 -1
- package/dist/review/server.d.ts +2 -0
- package/dist/review/server.js +14 -7
- package/dist/review/server.js.map +1 -1
- package/dist/satteri.js +2 -0
- package/dist/satteri.js.map +1 -1
- package/dist/shapes.d.ts +158 -0
- package/dist/shapes.js +8 -0
- package/dist/shapes.js.map +1 -0
- package/dist/toolbar/app.js +14 -13
- package/dist/toolbar/app.js.map +1 -1
- package/dist/toolbar/page.d.ts +3 -5
- package/dist/toolbar/page.js +7 -6
- package/dist/toolbar/page.js.map +1 -1
- package/dist/toolbar/style.d.ts +1 -1
- package/dist/toolbar/style.js +31 -23
- package/dist/toolbar/style.js.map +1 -1
- package/dist/toolbar/text.d.ts +3 -3
- package/dist/toolbar/text.js.map +1 -1
- package/package.json +16 -5
package/dist/toolbar/style.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PANEL_CSS = "\n.panel {\n --ink: #
|
|
1
|
+
export declare const PANEL_CSS = "\n.panel {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */\n --ink: #22272e;\n --muted: #676c75;\n --win: #ffffff;\n --side: #f7f9fd;\n --line: #e3e6ec;\n --accent: #5962e8;\n --accent-ink: #ffffff;\n --notice: #fef5eb;\n --ui: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --mono: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;\n /* End of generated panel. */\n}\n/* Light or dark as the page is (data-scheme), else as the reader's system is. */\n@media (prefers-color-scheme: dark) {\n .panel:not([data-scheme=\"light\"]) {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n }\n}\n.panel[data-scheme=\"dark\"] {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n}\n.panel {\n position: fixed;\n left: 50%;\n bottom: 72px;\n transform: translateX(-50%);\n width: min(960px, calc(100vw - 20px));\n box-sizing: border-box;\n max-height: 300px;\n overflow-y: auto;\n background: var(--win);\n color: var(--ink);\n border: 1px solid var(--ink);\n border-radius: 8px;\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: shadow, light. */\n box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);\n /* End of generated shadow. */\n font: 12.5px/1.45 var(--ui);\n z-index: 1;\n}\n.ttl {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 4px 10px;\n font-size: 11px;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n font-weight: 700;\n background: var(--ink);\n color: var(--win);\n position: sticky;\n top: 0;\n}\n.ttl .grow {\n flex: 1;\n}\n.ttl button {\n border: 0;\n background: transparent;\n color: var(--win);\n padding: 0;\n font: inherit;\n text-transform: none;\n letter-spacing: 0;\n font-weight: 400;\n cursor: pointer;\n}\n.row,\n.notice,\n.unsent {\n display: flex;\n flex-wrap: wrap;\n gap: 6px 10px;\n align-items: center;\n padding: 6px 10px;\n border-bottom: 1px solid var(--line);\n font-size: 12px;\n}\n.row {\n background: var(--side);\n}\n.row .grow {\n flex: 1;\n min-width: 160px;\n color: var(--muted);\n}\n.row b {\n color: var(--ink);\n font-weight: 600;\n}\n.legend {\n flex-basis: 100%;\n color: var(--muted);\n font-size: 11.5px;\n}\n.notice,\n.unsent {\n background: var(--notice);\n font-size: 12.5px;\n}\n.notice code {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.95em;\n}\n.spacer {\n flex: 1;\n}\n.body {\n padding: 8px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n border-bottom: 1px solid var(--line);\n}\n.body:last-child,\n.row:last-child,\n.notice:last-child,\n.unsent:last-child {\n border-bottom: 0;\n}\n.hint {\n color: var(--muted);\n font-size: 11.5px;\n}\nul {\n margin: 0;\n padding-left: 18px;\n}\nli + li {\n margin-top: 2px;\n}\n.thread {\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.thread .where {\n color: var(--muted);\n font-size: 11.5px;\n}\n.thread .comment p {\n margin: 0;\n}\ncode {\n font-family: var(--mono);\n font-size: 0.92em;\n}\nbutton {\n font: inherit;\n cursor: pointer;\n color: inherit;\n}\nbutton:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\nbutton:focus-visible,\na:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 1px;\n}\n.ghost {\n border: 1px solid var(--line);\n background: var(--win);\n border-radius: 5px;\n padding: 2px 8px;\n font-size: 12px;\n}\n.ghost:hover {\n border-color: var(--accent);\n color: var(--accent);\n}\n.square {\n min-width: 28px;\n min-height: 24px;\n}\n.primary {\n border: 1px solid var(--accent);\n background: var(--accent);\n color: var(--accent-ink);\n border-radius: 5px;\n padding: 2px 10px;\n font-size: 12.5px;\n font-weight: 600;\n}\n.link,\na {\n border: 0;\n background: transparent;\n color: var(--accent);\n padding: 0;\n font-size: inherit;\n text-decoration: none;\n}\n.link:hover,\na:hover {\n text-decoration: underline;\n}\n.position {\n white-space: nowrap;\n}\n.segmented {\n display: inline-flex;\n border: 1px solid var(--line);\n border-radius: 5px;\n overflow: hidden;\n}\n.segmented button {\n border: 0;\n background: transparent;\n padding: 2px 9px;\n font-size: 12px;\n color: var(--muted);\n}\n.segmented button + button {\n border-left: 1px solid var(--line);\n}\n.segmented button[aria-pressed=\"true\"] {\n background: var(--accent);\n color: var(--accent-ink);\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n";
|
package/dist/toolbar/style.js
CHANGED
|
@@ -2,39 +2,45 @@
|
|
|
2
2
|
// don't reach it, and its don't reach the page.
|
|
3
3
|
export const PANEL_CSS = `
|
|
4
4
|
.panel {
|
|
5
|
-
|
|
6
|
-
--
|
|
5
|
+
/* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */
|
|
6
|
+
--ink: #22272e;
|
|
7
|
+
--muted: #676c75;
|
|
7
8
|
--win: #ffffff;
|
|
8
|
-
--side: #
|
|
9
|
-
--line: #
|
|
10
|
-
--accent: #
|
|
9
|
+
--side: #f7f9fd;
|
|
10
|
+
--line: #e3e6ec;
|
|
11
|
+
--accent: #5962e8;
|
|
11
12
|
--accent-ink: #ffffff;
|
|
12
|
-
--notice: #
|
|
13
|
+
--notice: #fef5eb;
|
|
13
14
|
--ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
14
15
|
--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
16
|
+
/* End of generated panel. */
|
|
15
17
|
}
|
|
16
18
|
/* Light or dark as the page is (data-scheme), else as the reader's system is. */
|
|
17
19
|
@media (prefers-color-scheme: dark) {
|
|
18
20
|
.panel:not([data-scheme="light"]) {
|
|
19
|
-
|
|
20
|
-
--
|
|
21
|
-
--
|
|
22
|
-
--
|
|
23
|
-
--
|
|
24
|
-
--
|
|
25
|
-
--accent
|
|
26
|
-
--
|
|
21
|
+
/* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */
|
|
22
|
+
--ink: #f0f3f7;
|
|
23
|
+
--muted: #a5a9b2;
|
|
24
|
+
--win: #0c0f16;
|
|
25
|
+
--side: #13171f;
|
|
26
|
+
--line: #393d46;
|
|
27
|
+
--accent: #91a1fe;
|
|
28
|
+
--accent-ink: #0c0f16;
|
|
29
|
+
--notice: #2b1a03;
|
|
30
|
+
/* End of generated panel. */
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
.panel[data-scheme="dark"] {
|
|
30
|
-
|
|
31
|
-
--
|
|
32
|
-
--
|
|
33
|
-
--
|
|
34
|
-
--
|
|
35
|
-
--
|
|
36
|
-
--accent
|
|
37
|
-
--
|
|
34
|
+
/* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */
|
|
35
|
+
--ink: #f0f3f7;
|
|
36
|
+
--muted: #a5a9b2;
|
|
37
|
+
--win: #0c0f16;
|
|
38
|
+
--side: #13171f;
|
|
39
|
+
--line: #393d46;
|
|
40
|
+
--accent: #91a1fe;
|
|
41
|
+
--accent-ink: #0c0f16;
|
|
42
|
+
--notice: #2b1a03;
|
|
43
|
+
/* End of generated panel. */
|
|
38
44
|
}
|
|
39
45
|
.panel {
|
|
40
46
|
position: fixed;
|
|
@@ -49,7 +55,9 @@ export const PANEL_CSS = `
|
|
|
49
55
|
color: var(--ink);
|
|
50
56
|
border: 1px solid var(--ink);
|
|
51
57
|
border-radius: 8px;
|
|
52
|
-
|
|
58
|
+
/* Generated from design/tokens.toml by scripts/design/tokens.ts: shadow, light. */
|
|
59
|
+
box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);
|
|
60
|
+
/* End of generated shadow. */
|
|
53
61
|
font: 12.5px/1.45 var(--ui);
|
|
54
62
|
z-index: 1;
|
|
55
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/toolbar/style.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gDAAgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAG
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/toolbar/style.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gDAAgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8PxB,CAAC","sourcesContent":["// The toolbar app's panel, in the app's own shadow root: the page's styles\n// don't reach it, and its don't reach the page.\nexport const PANEL_CSS = `\n.panel {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */\n --ink: #22272e;\n --muted: #676c75;\n --win: #ffffff;\n --side: #f7f9fd;\n --line: #e3e6ec;\n --accent: #5962e8;\n --accent-ink: #ffffff;\n --notice: #fef5eb;\n --ui: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --mono: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;\n /* End of generated panel. */\n}\n/* Light or dark as the page is (data-scheme), else as the reader's system is. */\n@media (prefers-color-scheme: dark) {\n .panel:not([data-scheme=\"light\"]) {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n }\n}\n.panel[data-scheme=\"dark\"] {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n}\n.panel {\n position: fixed;\n left: 50%;\n bottom: 72px;\n transform: translateX(-50%);\n width: min(960px, calc(100vw - 20px));\n box-sizing: border-box;\n max-height: 300px;\n overflow-y: auto;\n background: var(--win);\n color: var(--ink);\n border: 1px solid var(--ink);\n border-radius: 8px;\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: shadow, light. */\n box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);\n /* End of generated shadow. */\n font: 12.5px/1.45 var(--ui);\n z-index: 1;\n}\n.ttl {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 4px 10px;\n font-size: 11px;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n font-weight: 700;\n background: var(--ink);\n color: var(--win);\n position: sticky;\n top: 0;\n}\n.ttl .grow {\n flex: 1;\n}\n.ttl button {\n border: 0;\n background: transparent;\n color: var(--win);\n padding: 0;\n font: inherit;\n text-transform: none;\n letter-spacing: 0;\n font-weight: 400;\n cursor: pointer;\n}\n.row,\n.notice,\n.unsent {\n display: flex;\n flex-wrap: wrap;\n gap: 6px 10px;\n align-items: center;\n padding: 6px 10px;\n border-bottom: 1px solid var(--line);\n font-size: 12px;\n}\n.row {\n background: var(--side);\n}\n.row .grow {\n flex: 1;\n min-width: 160px;\n color: var(--muted);\n}\n.row b {\n color: var(--ink);\n font-weight: 600;\n}\n.legend {\n flex-basis: 100%;\n color: var(--muted);\n font-size: 11.5px;\n}\n.notice,\n.unsent {\n background: var(--notice);\n font-size: 12.5px;\n}\n.notice code {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.95em;\n}\n.spacer {\n flex: 1;\n}\n.body {\n padding: 8px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n border-bottom: 1px solid var(--line);\n}\n.body:last-child,\n.row:last-child,\n.notice:last-child,\n.unsent:last-child {\n border-bottom: 0;\n}\n.hint {\n color: var(--muted);\n font-size: 11.5px;\n}\nul {\n margin: 0;\n padding-left: 18px;\n}\nli + li {\n margin-top: 2px;\n}\n.thread {\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.thread .where {\n color: var(--muted);\n font-size: 11.5px;\n}\n.thread .comment p {\n margin: 0;\n}\ncode {\n font-family: var(--mono);\n font-size: 0.92em;\n}\nbutton {\n font: inherit;\n cursor: pointer;\n color: inherit;\n}\nbutton:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\nbutton:focus-visible,\na:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 1px;\n}\n.ghost {\n border: 1px solid var(--line);\n background: var(--win);\n border-radius: 5px;\n padding: 2px 8px;\n font-size: 12px;\n}\n.ghost:hover {\n border-color: var(--accent);\n color: var(--accent);\n}\n.square {\n min-width: 28px;\n min-height: 24px;\n}\n.primary {\n border: 1px solid var(--accent);\n background: var(--accent);\n color: var(--accent-ink);\n border-radius: 5px;\n padding: 2px 10px;\n font-size: 12.5px;\n font-weight: 600;\n}\n.link,\na {\n border: 0;\n background: transparent;\n color: var(--accent);\n padding: 0;\n font-size: inherit;\n text-decoration: none;\n}\n.link:hover,\na:hover {\n text-decoration: underline;\n}\n.position {\n white-space: nowrap;\n}\n.segmented {\n display: inline-flex;\n border: 1px solid var(--line);\n border-radius: 5px;\n overflow: hidden;\n}\n.segmented button {\n border: 0;\n background: transparent;\n padding: 2px 9px;\n font-size: 12px;\n color: var(--muted);\n}\n.segmented button + button {\n border-left: 1px solid var(--line);\n}\n.segmented button[aria-pressed=\"true\"] {\n background: var(--accent);\n color: var(--accent-ink);\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n`;\n"]}
|
package/dist/toolbar/text.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { LocatedThread } from "@ascribed/review/overlay";
|
|
2
|
-
import type { ChangedPage, Counts,
|
|
2
|
+
import type { ChangedPage, Counts, PageDiff, PageView, ThreadsState } from "../review/protocol.js";
|
|
3
3
|
/** "10 changes on this page", or "3 of 10 on this page" while stepping through them. */
|
|
4
4
|
export declare function position(total: number, at: number): string;
|
|
5
5
|
/** "5 changed · 3 added · 1 removed · 1 moved", leaving out kinds with none. */
|
|
6
6
|
export declare function countsText(counts: Counts): string;
|
|
7
7
|
/** A changed page's line in the list: its counts, or what happened to it. */
|
|
8
|
-
export declare function pageDetail(page: Omit<
|
|
8
|
+
export declare function pageDetail(page: Omit<PageDiff, "changes">): string;
|
|
9
9
|
/**
|
|
10
10
|
* The notice about the working tree's errors, or `undefined` with none: a
|
|
11
11
|
* page with an error may render oddly, which shouldn't read as the change.
|
|
@@ -27,7 +27,7 @@ export declare function threadsNotice(threads: ThreadsState): string | undefined
|
|
|
27
27
|
* path order, or past the last, the first (`first`). Removed pages are
|
|
28
28
|
* skipped. `null` when no other page changed.
|
|
29
29
|
*/
|
|
30
|
-
export declare function nextChangedPage<P extends Omit<
|
|
30
|
+
export declare function nextChangedPage<P extends Omit<PageDiff, "changes">>(pages: readonly P[], current: string | null): {
|
|
31
31
|
page: P;
|
|
32
32
|
first: boolean;
|
|
33
33
|
} | null;
|
package/dist/toolbar/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/toolbar/text.ts"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,EAAU;IAChD,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,yBAAyB,CAAC;IAClD,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,K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,KAAK,CAAC;IAC3B,IAAI,OAAO,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACpE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7F,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC","sourcesContent":["// What the toolbar app says, apart from the DOM so it can be tested by itself.\nimport type { LocatedThread } from \"@ascribed/review/overlay\";\nimport type { ChangedPage, Counts, DiffPage, PageView, ThreadsState } from \"../review/protocol.js\";\n\n/** \"10 changes on this page\", or \"3 of 10 on this page\" while stepping through them. */\nexport function position(total: number, at: number): string {\n if (total === 0) return \"No changes on this page\";\n if (at >= 0 && at < total) return `${at + 1} of ${total} on this page`;\n return total === 1 ? \"1 change on this page\" : `${total} changes on this page`;\n}\n\n/** \"5 changed · 3 added · 1 removed · 1 moved\", leaving out kinds with none. */\nexport function countsText(counts: Counts): string {\n const parts: string[] = [];\n if (counts.changed > 0) parts.push(`${counts.changed} changed`);\n if (counts.added > 0) parts.push(`${counts.added} added`);\n if (counts.removed > 0) parts.push(`${counts.removed} removed`);\n if (counts.moved > 0) parts.push(`${counts.moved} moved`);\n return parts.join(\" · \");\n}\n\n/** A changed page's line in the list: its counts, or what happened to it. */\nexport function pageDetail(page: Omit<DiffPage, \"changes\">): string {\n if (page.status === \"added\") return \"new page\";\n if (page.status === \"removed\") return \"removed\";\n const counts = countsText(page.counts);\n if (counts !== \"\") return counts;\n return page.page_changed.length > 0 ? `${page.page_changed.join(\", \")} changed` : \"changed\";\n}\n\n/**\n * The notice about the working tree's errors, or `undefined` with none: a\n * page with an error may render oddly, which shouldn't read as the change.\n */\nexport function errorsNotice(errors: number): string | undefined {\n if (errors <= 0) return undefined;\n const one = errors === 1;\n return (\n `The working tree has ${one ? \"1 error\" : `${errors} errors`}, so a page may not show as ` +\n `it will once ${one ? \"it's\" : \"they're\"} fixed. \\`ascribe check\\` lists ${one ? \"it\" : \"them\"}.`\n );\n}\n\n/** \"1 unsent comment\", \"2 unsent comments\". */\nexport function unsentText(count: number): string {\n return count === 1 ? \"1 unsent comment\" : `${count} unsent comments`;\n}\n\n/** The toolbar button's label: \"Ascribe review\", with the unsent count when there is one. */\nexport function buttonLabel(unsent: number): string {\n return unsent > 0 ? `Ascribe review · ${unsentText(unsent)}` : \"Ascribe review\";\n}\n\n/** The base's name and the pull request, as the panel's first words: \"#128 against main\". */\nexport function againstText(view: PageView): { pullRequest: string | null; base: string | null } {\n const pullRequest = view.threads.state === \"on\" ? `#${view.threads.pullRequest.number}` : null;\n const requested = view.base?.requested ?? null;\n // The pull request's base by its name (\"main\"), not the remote branch compared with (\"origin/main\").\n const name = view.threads.state === \"on\" ? view.threads.pullRequest.baseRefName : undefined;\n const base =\n requested !== null && name !== undefined && requested.endsWith(`/${name}`) ? name : requested;\n return { pullRequest, base };\n}\n\n/** A sentence about the threads: why there are none, or how the checkout differs. */\nexport function threadsNotice(threads: ThreadsState): string | undefined {\n if (threads.state !== \"on\") return threads.message;\n const { local, pullRequest } = threads;\n const name = `#${pullRequest.number}`;\n const commits = (n: number) => (n === 1 ? \"1 commit\" : `${n} commits`);\n switch (local.state) {\n case \"same\":\n return undefined;\n case \"behind\":\n return `Your checkout is ${commits(local.behind)} behind ${name}, so some comments may be on lines you don't have. Pull to see the latest.`;\n case \"ahead\":\n return `You have ${commits(local.ahead)} that ${local.ahead === 1 ? \"isn't\" : \"aren't\"} pushed. You can comment only on lines that are on GitHub.`;\n case \"diverged\":\n return `Your checkout and ${name} have both moved on (${local.behind} behind, ${local.ahead} ahead). Some comments may be on lines you don't have, and you can comment only on lines that are on GitHub.`;\n case \"missing\":\n return `Your checkout doesn't have ${name}'s latest commit, so some comments may be on lines you don't have. Fetch to see the latest.`;\n }\n}\n\n/**\n * The changed page to offer after `current` (a content path): the next in\n * path order, or past the last, the first (`first`). Removed pages are\n * skipped. `null` when no other page changed.\n */\nexport function nextChangedPage<P extends Omit<DiffPage, \"changes\">>(\n pages: readonly P[],\n current: string | null,\n): { page: P; first: boolean } | null {\n const open = pages.filter((p) => p.status !== \"removed\" && p.path !== current);\n const first = open[0];\n if (first === undefined) return null;\n const after = current === null ? undefined : open.find((p) => p.path > current);\n return after ? { page: after, first: false } : { page: first, first: true };\n}\n\n/** The button past the last change: \"Next changed page: Install Loom\", by title as the page preview says it. */\nexport function nextPageText(next: { page: ChangedPage; first: boolean }): string {\n return `${next.first ? \"First\" : \"Next\"} changed page: ${next.page.title ?? next.page.route}`;\n}\n\n/**\n * Where a listed thread is, as the overlay's cards say it: its file's name\n * and lines (`Options.md:16`), or for a thread on removed text, only the\n * file's name, since its lines are the base's.\n */\nexport function threadLocation(thread: LocatedThread): { label: string; removed: boolean } {\n const file = thread.path.slice(thread.path.lastIndexOf(\"/\") + 1);\n const removed = thread.kind === \"review\" && thread.side === \"LEFT\";\n const lines = thread.lines;\n if (removed || lines === undefined) return { label: file, removed };\n const range = lines.first === lines.last ? `${lines.first}` : `${lines.first}-${lines.last}`;\n return { label: `${file}:${range}`, removed };\n}\n\n/** The hash that tells a page to go to a thread once it's drawn. */\nexport const THREAD_HASH = \"#ascribe-thread=\";\n"]}
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/toolbar/text.ts"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,EAAU;IAChD,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,yBAAyB,CAAC;IAClD,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,G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,CAAC,KAAK,CAAC;IAC3B,IAAI,OAAO,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACpE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7F,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC","sourcesContent":["// What the toolbar app says, apart from the DOM so it can be tested by itself.\nimport type { LocatedThread } from \"@ascribed/review/overlay\";\nimport type { ChangedPage, Counts, PageDiff, PageView, ThreadsState } from \"../review/protocol.js\";\n\n/** \"10 changes on this page\", or \"3 of 10 on this page\" while stepping through them. */\nexport function position(total: number, at: number): string {\n if (total === 0) return \"No changes on this page\";\n if (at >= 0 && at < total) return `${at + 1} of ${total} on this page`;\n return total === 1 ? \"1 change on this page\" : `${total} changes on this page`;\n}\n\n/** \"5 changed · 3 added · 1 removed · 1 moved\", leaving out kinds with none. */\nexport function countsText(counts: Counts): string {\n const parts: string[] = [];\n if (counts.changed > 0) parts.push(`${counts.changed} changed`);\n if (counts.added > 0) parts.push(`${counts.added} added`);\n if (counts.removed > 0) parts.push(`${counts.removed} removed`);\n if (counts.moved > 0) parts.push(`${counts.moved} moved`);\n return parts.join(\" · \");\n}\n\n/** A changed page's line in the list: its counts, or what happened to it. */\nexport function pageDetail(page: Omit<PageDiff, \"changes\">): string {\n if (page.status === \"added\") return \"new page\";\n if (page.status === \"removed\") return \"removed\";\n const counts = countsText(page.counts);\n if (counts !== \"\") return counts;\n return page.page_changed.length > 0 ? `${page.page_changed.join(\", \")} changed` : \"changed\";\n}\n\n/**\n * The notice about the working tree's errors, or `undefined` with none: a\n * page with an error may render oddly, which shouldn't read as the change.\n */\nexport function errorsNotice(errors: number): string | undefined {\n if (errors <= 0) return undefined;\n const one = errors === 1;\n return (\n `The working tree has ${one ? \"1 error\" : `${errors} errors`}, so a page may not show as ` +\n `it will once ${one ? \"it's\" : \"they're\"} fixed. \\`ascribe check\\` lists ${one ? \"it\" : \"them\"}.`\n );\n}\n\n/** \"1 unsent comment\", \"2 unsent comments\". */\nexport function unsentText(count: number): string {\n return count === 1 ? \"1 unsent comment\" : `${count} unsent comments`;\n}\n\n/** The toolbar button's label: \"Ascribe review\", with the unsent count when there is one. */\nexport function buttonLabel(unsent: number): string {\n return unsent > 0 ? `Ascribe review · ${unsentText(unsent)}` : \"Ascribe review\";\n}\n\n/** The base's name and the pull request, as the panel's first words: \"#128 against main\". */\nexport function againstText(view: PageView): { pullRequest: string | null; base: string | null } {\n const pullRequest = view.threads.state === \"on\" ? `#${view.threads.pullRequest.number}` : null;\n const requested = view.base?.requested ?? null;\n // The pull request's base by its name (\"main\"), not the remote branch compared with (\"origin/main\").\n const name = view.threads.state === \"on\" ? view.threads.pullRequest.baseRefName : undefined;\n const base =\n requested !== null && name !== undefined && requested.endsWith(`/${name}`) ? name : requested;\n return { pullRequest, base };\n}\n\n/** A sentence about the threads: why there are none, or how the checkout differs. */\nexport function threadsNotice(threads: ThreadsState): string | undefined {\n if (threads.state !== \"on\") return threads.message;\n const { local, pullRequest } = threads;\n const name = `#${pullRequest.number}`;\n const commits = (n: number) => (n === 1 ? \"1 commit\" : `${n} commits`);\n switch (local.state) {\n case \"same\":\n return undefined;\n case \"behind\":\n return `Your checkout is ${commits(local.behind)} behind ${name}, so some comments may be on lines you don't have. Pull to see the latest.`;\n case \"ahead\":\n return `You have ${commits(local.ahead)} that ${local.ahead === 1 ? \"isn't\" : \"aren't\"} pushed. You can comment only on lines that are on GitHub.`;\n case \"diverged\":\n return `Your checkout and ${name} have both moved on (${local.behind} behind, ${local.ahead} ahead). Some comments may be on lines you don't have, and you can comment only on lines that are on GitHub.`;\n case \"missing\":\n return `Your checkout doesn't have ${name}'s latest commit, so some comments may be on lines you don't have. Fetch to see the latest.`;\n }\n}\n\n/**\n * The changed page to offer after `current` (a content path): the next in\n * path order, or past the last, the first (`first`). Removed pages are\n * skipped. `null` when no other page changed.\n */\nexport function nextChangedPage<P extends Omit<PageDiff, \"changes\">>(\n pages: readonly P[],\n current: string | null,\n): { page: P; first: boolean } | null {\n const open = pages.filter((p) => p.status !== \"removed\" && p.path !== current);\n const first = open[0];\n if (first === undefined) return null;\n const after = current === null ? undefined : open.find((p) => p.path > current);\n return after ? { page: after, first: false } : { page: first, first: true };\n}\n\n/** The button past the last change: \"Next changed page: Install Loom\", by title as the page preview says it. */\nexport function nextPageText(next: { page: ChangedPage; first: boolean }): string {\n return `${next.first ? \"First\" : \"Next\"} changed page: ${next.page.title ?? next.page.route}`;\n}\n\n/**\n * Where a listed thread is, as the overlay's cards say it: its file's name\n * and lines (`Options.md:16`), or for a thread on removed text, only the\n * file's name, since its lines are the base's.\n */\nexport function threadLocation(thread: LocatedThread): { label: string; removed: boolean } {\n const file = thread.path.slice(thread.path.lastIndexOf(\"/\") + 1);\n const removed = thread.kind === \"review\" && thread.side === \"LEFT\";\n const lines = thread.lines;\n if (removed || lines === undefined) return { label: file, removed };\n const range = lines.first === lines.last ? `${lines.first}` : `${lines.first}-${lines.last}`;\n return { label: `${file}:${range}`, removed };\n}\n\n/** The hash that tells a page to go to a thread once it's drawn. */\nexport const THREAD_HASH = \"#ascribe-thread=\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ascribed/astro",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-next.11",
|
|
4
4
|
"description": "The Astro integration for Ascribe.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -41,14 +41,24 @@
|
|
|
41
41
|
"node": ">=24"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@ascribed/cli": "0.2.
|
|
45
|
-
"@ascribed/elements": "0.2.
|
|
46
|
-
"@ascribed/review": "0.2.
|
|
44
|
+
"@ascribed/cli": "0.2.1-next.11",
|
|
45
|
+
"@ascribed/elements": "0.2.1-next.11",
|
|
46
|
+
"@ascribed/review": "0.2.1-next.11",
|
|
47
47
|
"property-information": "^7.2.0",
|
|
48
48
|
"smol-toml": "^1.9.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"
|
|
51
|
+
"@types/hast": "^3.0.0",
|
|
52
|
+
"astro": "^7.3.5",
|
|
53
|
+
"satteri": "^0.10.3"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"@types/hast": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"satteri": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
52
62
|
},
|
|
53
63
|
"devDependencies": {
|
|
54
64
|
"@types/hast": "^3.0.4",
|
|
@@ -68,6 +78,7 @@
|
|
|
68
78
|
"publishConfig": {
|
|
69
79
|
"access": "public"
|
|
70
80
|
},
|
|
81
|
+
"gitHead": "dd64394135ff782efb8db030c81ac3b38e0f92c5",
|
|
71
82
|
"scripts": {
|
|
72
83
|
"build": "tsc -p tsconfig.build.json",
|
|
73
84
|
"typecheck": "tsc --noEmit",
|