@atelic-action/ui 7.0.0 → 7.1.0
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 -2
- package/package.json +1 -1
- package/src/artifact/Paragraph.tsx +38 -11
- package/src/artifact/index.ts +3 -0
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
|
|
|
41
41
|
| `GradeChip`, `gradeLabel`, `WriteupGrade` | `@atelic-action/ui/artifact` | A section's grade, A to D, as a chip in its color, the letter alone, and the grade type | [#grade-chip](https://ui.atelic.me/#grade-chip) |
|
|
42
42
|
| `SignOff`, `WriteupPerson` | `@atelic-action/ui/artifact` | The close a document ends on, and the person it names | [#sign-off](https://ui.atelic.me/#sign-off) |
|
|
43
43
|
| `Shot`, `WriteupShot` | `@atelic-action/ui/artifact` | The owner's own screen, opening the full picture, over its caption; a portrait crop is marked `data-portrait` and held to 200px (1.8in in print) | [#shot](https://ui.atelic.me/#shot) |
|
|
44
|
-
| `Paragraph`, `Runs`, `ArtifactAnchor`, `isEmpty`, `ArtifactLink`, `ArtifactParagraph` | `@atelic-action/ui/artifact` | Plain data text a routine can write as JSON: a paragraph, its runs alone, one link, the empty test, and the
|
|
44
|
+
| `Paragraph`, `Runs`, `ArtifactAnchor`, `isEmpty`, `isQuery`, `ArtifactLink`, `ArtifactQuery`, `ArtifactRun`, `ArtifactParagraph` | `@atelic-action/ui/artifact` | Plain data text a routine can write as JSON: a paragraph, its runs alone, one link, the empty test, the query test, and the four types | [#paragraph](https://ui.atelic.me/#paragraph) |
|
|
45
45
|
| `ArtifactShell` | `@atelic-action/ui/artifact` | The chrome around a document page: skip link, dark header, closing bar, watermark | [#site-header](https://ui.atelic.me/#site-header) (its dark bar) |
|
|
46
46
|
| `AppErrorBoundary`, `ErrorFallback` | `@atelic-action/ui/artifact` | The error boundary and the page it falls back to | none |
|
|
47
47
|
| `buildPageHead`, `canonicalURL`, `newTabProps`, the `ArtifactConfig` types | `@atelic-action/ui/artifact` | A page's head, a link's new tab props, and a site's contract | none |
|
|
@@ -343,7 +343,7 @@ The two pieces a reader sees are ordinary components, in `@atelic-action/ui/comp
|
|
|
343
343
|
|
|
344
344
|
`@atelic-action/ui/artifact` is the pieces an artifact document is built from and the site around it, so a fix to a piece reaches every business's documents with one version bump. The composed documents themselves (`Writeup`, `Read`, `Report`, `Note`, and the sealed `Gate`, with their content types and their stylesheet) live in [`@atelic-action/artifact`](https://github.com/atelic-action/artifact) since 2.0.0, which depends on this package for everything below:
|
|
345
345
|
|
|
346
|
-
- **The pieces:** `GradeChip` and `gradeLabel` with the `WriteupGrade` type, `SignOff` with the `WriteupPerson` type, `Shot` with the `WriteupShot` type (a crop taller than it is wide is measured in the browser, marked `data-portrait`, and held to 200px wide on screen and 1.8in in print; a layout that sizes its shots itself sets `--op-shot-portrait-max: none` to opt out, on screen and in print alike), and the plain data text (`Paragraph`, `Runs`, `ArtifactAnchor`, and `
|
|
346
|
+
- **The pieces:** `GradeChip` and `gradeLabel` with the `WriteupGrade` type, `SignOff` with the `WriteupPerson` type, `Shot` with the `WriteupShot` type (a crop taller than it is wide is measured in the browser, marked `data-portrait`, and held to 200px wide on screen and 1.8in in print; a layout that sizes its shots itself sets `--op-shot-portrait-max: none` to opt out, on screen and in print alike), and the plain data text (`Paragraph`, `Runs`, `ArtifactAnchor`, `isEmpty`, and `isQuery`, with the `ArtifactLink`, `ArtifactQuery`, `ArtifactRun`, and `ArtifactParagraph` types: a paragraph is a string or runs of text, `{ text, href }` links, and `{ query, href? }` search queries, so a routine can write a document as JSON). A query renders as `<em class="query">` around the words in curly quotes, which the component adds, so content passes the bare words; with an `href`, the link sits inside the `em` around the quoted words.
|
|
347
347
|
- **The shell:** `ArtifactShell`, the `.atelic-ui` scope with the skip link, the dark header, the closing bar, and the watermark around a page.
|
|
348
348
|
- **The contract and the head:** the `ArtifactConfig` types, and `buildPageHead` and `canonicalURL` with their `PageMeta` type.
|
|
349
349
|
- **Who opened it:** `whoIsReading`, the email a reader signed in with at the wall, by the form or by the sign in a send carried, and nobody on the sender's own domain. It is also built and exported alone as `@atelic-action/ui/artifact/readers`, because a Playwright spec runs under Node, which compiles nothing inside `node_modules`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atelic-action/ui",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Shared UI for the Atelic templates: site chrome, base styles, the component library, the access gate, and the app shell they install",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -2,8 +2,8 @@ import { newTabProps } from "../lib/newTabProps";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Plain data text for the documents in @atelic-action/artifact a routine
|
|
5
|
-
* can write as JSON (the note and the read): a paragraph is a string, or runs of text
|
|
6
|
-
* order. A link opens in a new tab when it leaves the page, and in place
|
|
5
|
+
* can write as JSON (the note and the read): a paragraph is a string, or runs of text,
|
|
6
|
+
* links, and search queries in order. A link opens in a new tab when it leaves the page, and in place
|
|
7
7
|
* when it is an anchor or a mail link.
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -13,8 +13,22 @@ export interface ArtifactLink {
|
|
|
13
13
|
href: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/** A
|
|
17
|
-
export
|
|
16
|
+
/** A search someone types, set the way every document sets one: in curly quotes and italics. With an href, the quoted words are the link. */
|
|
17
|
+
export interface ArtifactQuery {
|
|
18
|
+
query: string;
|
|
19
|
+
href?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** One run of a paragraph: plain text, a link, or a search query. */
|
|
23
|
+
export type ArtifactRun = string | ArtifactLink | ArtifactQuery;
|
|
24
|
+
|
|
25
|
+
/** A paragraph: a plain string, or runs of text, links, and search queries in order. */
|
|
26
|
+
export type ArtifactParagraph = string | Array<ArtifactRun>;
|
|
27
|
+
|
|
28
|
+
/** Whether a run is a search query rather than text or a link. */
|
|
29
|
+
export function isQuery(run: ArtifactRun): run is ArtifactQuery {
|
|
30
|
+
return typeof run !== "string" && "query" in run;
|
|
31
|
+
}
|
|
18
32
|
|
|
19
33
|
/** A link opens in a new tab when it leaves the page, and in place when it is an anchor or a mail link. */
|
|
20
34
|
export function ArtifactAnchor({ href, children }: { href: string; children: string }) {
|
|
@@ -25,27 +39,40 @@ export function ArtifactAnchor({ href, children }: { href: string; children: str
|
|
|
25
39
|
);
|
|
26
40
|
}
|
|
27
41
|
|
|
28
|
-
/** A paragraph with nothing to read: a blank string, or runs that are all blank strings. A link always counts. */
|
|
42
|
+
/** A paragraph with nothing to read: a blank string, or runs that are all blank strings. A link or a query always counts. */
|
|
29
43
|
export function isEmpty(paragraph: ArtifactParagraph): boolean {
|
|
30
44
|
const runs = typeof paragraph === "string" ? [paragraph] : paragraph;
|
|
31
45
|
return runs.every((run) => typeof run === "string" && run.trim() === "");
|
|
32
46
|
}
|
|
33
47
|
|
|
48
|
+
/** A search query in curly quotes and italics; the content passes the bare words and never types the quotes. */
|
|
49
|
+
function Query({ run }: { run: ArtifactQuery }) {
|
|
50
|
+
const quoted = `“${run.query}”`;
|
|
51
|
+
return (
|
|
52
|
+
<em className="query">
|
|
53
|
+
{run.href ? <ArtifactAnchor href={run.href}>{quoted}</ArtifactAnchor> : quoted}
|
|
54
|
+
</em>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
/** The runs alone, for a container that is not a paragraph (a list item, a table cell). */
|
|
35
59
|
export function Runs({ paragraph }: { paragraph: ArtifactParagraph }) {
|
|
36
60
|
const runs = typeof paragraph === "string" ? [paragraph] : paragraph;
|
|
37
61
|
return (
|
|
38
62
|
<>
|
|
39
|
-
{runs.map((run, i) =>
|
|
40
|
-
typeof run === "string"
|
|
41
|
-
|
|
42
|
-
|
|
63
|
+
{runs.map((run, i) => {
|
|
64
|
+
if (typeof run === "string") return run;
|
|
65
|
+
if (isQuery(run)) {
|
|
66
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: runs are static content in a fixed order
|
|
67
|
+
return <Query run={run} key={i} />;
|
|
68
|
+
}
|
|
69
|
+
return (
|
|
43
70
|
// biome-ignore lint/suspicious/noArrayIndexKey: runs are static content in a fixed order
|
|
44
71
|
<ArtifactAnchor href={run.href} key={i}>
|
|
45
72
|
{run.text}
|
|
46
73
|
</ArtifactAnchor>
|
|
47
|
-
)
|
|
48
|
-
)}
|
|
74
|
+
);
|
|
75
|
+
})}
|
|
49
76
|
</>
|
|
50
77
|
);
|
|
51
78
|
}
|