@atelic-action/ui 7.0.0 → 7.2.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 +4 -4
- package/package.json +1 -1
- package/src/artifact/ArtifactShell.tsx +3 -2
- package/src/artifact/Paragraph.tsx +38 -11
- package/src/artifact/index.ts +3 -0
- package/src/chrome/ClosingBar.tsx +3 -2
- package/src/styles/chrome.css +4 -2
package/README.md
CHANGED
|
@@ -41,8 +41,8 @@ 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
|
|
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) |
|
|
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
|
+
| `ArtifactShell` | `@atelic-action/ui/artifact` | The chrome around a document page: skip link, dark header, the closing bar with the sender's copyright and the credit, 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 |
|
|
48
48
|
| `whoIsReading` | `@atelic-action/ui/artifact` and `@atelic-action/ui/artifact/readers` | Who opened a document, by the email they signed in with; the second entry is the same function, built, for what Node runs | none |
|
|
@@ -343,8 +343,8 @@ 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 `
|
|
347
|
-
- **The shell:** `ArtifactShell`, the `.atelic-ui` scope with the skip link, the dark header, the closing bar, and the watermark around a page.
|
|
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
|
+
- **The shell:** `ArtifactShell`, the `.atelic-ui` scope with the skip link, the dark header, the closing bar, and the watermark around a page. The closing bar is the one line after a document's sign off, and it closes the way a site does: `Copyright` with the sender's name on the left and `Credit` on the right (7.2.0; before it the credit stood alone, centered). Print drops it with the header and the skip link.
|
|
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`.
|
|
350
350
|
- **The error boundary:** `AppErrorBoundary` and its `ErrorFallback`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atelic-action/ui",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.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",
|
|
@@ -25,7 +25,8 @@ export interface ArtifactShellProps {
|
|
|
25
25
|
* variant with the sender's lockup and never a site nav or a CTA, because the
|
|
26
26
|
* document's own close is the ask. There is no footer and no sticky bar by
|
|
27
27
|
* design: a document ends on its own sign off, and the closing bar is the
|
|
28
|
-
* one line allowed after it
|
|
28
|
+
* one line allowed after it, closing the way a site does, with the copyright
|
|
29
|
+
* in the sender's name on the left and the practice's credit on the right.
|
|
29
30
|
*/
|
|
30
31
|
export function ArtifactShell({ site, currentPath, stops, children }: ArtifactShellProps) {
|
|
31
32
|
const { name, href, logo } = site.sender;
|
|
@@ -43,7 +44,7 @@ export function ArtifactShell({ site, currentPath, stops, children }: ArtifactSh
|
|
|
43
44
|
stops={stops}
|
|
44
45
|
/>
|
|
45
46
|
<main id="main">{children}</main>
|
|
46
|
-
<ClosingBar />
|
|
47
|
+
<ClosingBar name={name} />
|
|
47
48
|
<Watermark />
|
|
48
49
|
</div>
|
|
49
50
|
);
|
|
@@ -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
|
}
|
package/src/artifact/index.ts
CHANGED
|
@@ -21,8 +21,9 @@ export interface ClosingBarProps {
|
|
|
21
21
|
* The line that closes every page: two sides, each taking anything. By
|
|
22
22
|
* default the left is the copyright with the business's name and the right is
|
|
23
23
|
* the practice's credit. Footer renders it at its foot, and a page with no
|
|
24
|
-
* footer
|
|
25
|
-
*
|
|
24
|
+
* footer renders it on its own (ArtifactShell passes the sender's name, so a
|
|
25
|
+
* sent document closes the way a site does); with nothing on the left, the
|
|
26
|
+
* right side sits centered.
|
|
26
27
|
*/
|
|
27
28
|
export function ClosingBar({ name, left, right }: ClosingBarProps) {
|
|
28
29
|
const leftSide = left === undefined ? name ? <Copyright name={name} /> : null : left;
|
package/src/styles/chrome.css
CHANGED
|
@@ -455,8 +455,10 @@
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
/* ---- Closing bar ---- */
|
|
458
|
-
/* The
|
|
459
|
-
|
|
458
|
+
/* The line that closes every page, below the footer or after a document's
|
|
459
|
+
sign off: its own full width band, small and muted, the copyright on the
|
|
460
|
+
left and the credit on the right, or the one side centered when it stands
|
|
461
|
+
alone. Purely token themed (the hairline and hover lift derive
|
|
460
462
|
from --surface through color-mix), so it rebrands with theme.css on any
|
|
461
463
|
page it renders under, light or dark. */
|
|
462
464
|
.atelic-ui .closing-bar {
|