@nanisoft/prism-ui 0.7.0 → 0.9.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/dist/.tsbuildinfo +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +30 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -0
- package/dist/components/ui/breadcrumb.d.ts +6 -2
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +5 -3
- package/dist/components/ui/dialog.d.ts +12 -1
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +2 -2
- package/dist/components/ui/live-region.d.ts +78 -0
- package/dist/components/ui/live-region.d.ts.map +1 -0
- package/dist/components/ui/live-region.js +48 -0
- package/dist/components/ui/mark.d.ts +44 -0
- package/dist/components/ui/mark.d.ts.map +1 -0
- package/dist/components/ui/mark.js +79 -0
- package/dist/components/ui/pagination.d.ts +24 -6
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +23 -9
- package/dist/components/ui/product-switcher.d.ts +7 -0
- package/dist/components/ui/product-switcher.d.ts.map +1 -1
- package/dist/components/ui/product-switcher.js +2 -2
- package/dist/components/ui/slider.d.ts +1 -1
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/tree.d.ts +115 -0
- package/dist/components/ui/tree.d.ts.map +1 -0
- package/dist/components/ui/tree.js +137 -0
- package/dist/fonts/Inter-OFL.txt +93 -0
- package/dist/fonts/inter-latin-400.woff2 +0 -0
- package/dist/fonts/inter-latin-500.woff2 +0 -0
- package/dist/fonts/inter-latin-600.woff2 +0 -0
- package/dist/styles.css +52 -0
- package/gates/README.md +98 -0
- package/gates/cli.mjs +133 -0
- package/gates/hidden-state.mjs +243 -0
- package/gates/index.mjs +81 -0
- package/gates/laws.mjs +170 -0
- package/gates/links.mjs +187 -0
- package/gates/pack-boundary.mjs +421 -0
- package/gates/pin.mjs +130 -0
- package/gates/retired-line.mjs +314 -0
- package/gates/run.mjs +320 -0
- package/gates/runtime-token-read.mjs +129 -0
- package/gates/stylesheet-ownership.mjs +207 -0
- package/package.json +16 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/ui/slider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C;;;;;GAKG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/ui/slider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C;;;;;GAKG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC1E,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mDAAmD;IACnD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gEAAgE;IAChE,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mCAAmC;IACnC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AAED;;;;;;;;GAQG;AACH,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,WAAW,+BAiCb;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A node a reader can arrive at: a title and the address it is read at.
|
|
4
|
+
*
|
|
5
|
+
* `href` is required. A node in a tree that goes nowhere is an entry a reader can
|
|
6
|
+
* focus and not follow, and this Component renders every node with a destination
|
|
7
|
+
* as a native anchor so a reader can see where it goes before taking it.
|
|
8
|
+
*/
|
|
9
|
+
export type TreeNodePage = {
|
|
10
|
+
type: 'page';
|
|
11
|
+
/** The words the reader meets. */
|
|
12
|
+
title: string;
|
|
13
|
+
/** The address the node is read at. */
|
|
14
|
+
href: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A label over a list of nodes, at any depth.
|
|
18
|
+
*
|
|
19
|
+
* `href` is the group's own index and it is optional on purpose. A group with no
|
|
20
|
+
* index is a place in the tree and not a route, so this Component renders it as a
|
|
21
|
+
* label: no anchor, no `href`, nothing focusable. Inventing a route for it would
|
|
22
|
+
* publish an address that resolves to nothing.
|
|
23
|
+
*
|
|
24
|
+
* `items` is required, because a group that renders a label and holds nothing is
|
|
25
|
+
* an empty entry rather than a group. Pass a node with no children rather than a
|
|
26
|
+
* group with none.
|
|
27
|
+
*/
|
|
28
|
+
export type TreeNodeGroup = {
|
|
29
|
+
type: 'group';
|
|
30
|
+
/** The words on the label. A status inside them stays inside them. */
|
|
31
|
+
title: string;
|
|
32
|
+
/** The group's own index, where it has one. Omit it for a label over a list. */
|
|
33
|
+
href?: string;
|
|
34
|
+
/** The nodes under this group, in the order a reader should meet them. */
|
|
35
|
+
items: readonly TreeNode[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A rule between nodes, carrying a name that is usually empty.
|
|
39
|
+
*
|
|
40
|
+
* It is a label and never a link. The alternative spelling, a page node with an
|
|
41
|
+
* empty `href`, is a control that cannot be operated, so a rule is its own type.
|
|
42
|
+
*/
|
|
43
|
+
export type TreeNodeDivider = {
|
|
44
|
+
type: 'divider';
|
|
45
|
+
/** The words on the rule, which may be the empty string. */
|
|
46
|
+
title: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* One node in a tree, of any of the three kinds.
|
|
50
|
+
*
|
|
51
|
+
* The union is closed, and it is a union rather than one shape with optional
|
|
52
|
+
* fields because a reader meets three different things in a tree: a destination, a
|
|
53
|
+
* label over a list, and a rule. A single shape would make all three look alike,
|
|
54
|
+
* and "a place that is a heading, not a link" is the distinction the whole
|
|
55
|
+
* arrangement turns on.
|
|
56
|
+
*/
|
|
57
|
+
export type TreeNode = TreeNodePage | TreeNodeGroup | TreeNodeDivider;
|
|
58
|
+
/** The props the Tree accepts. */
|
|
59
|
+
export interface TreeProps {
|
|
60
|
+
/** The nodes, in the order a reader should meet them. */
|
|
61
|
+
nodes: readonly TreeNode[];
|
|
62
|
+
/**
|
|
63
|
+
* The address the reader is currently at, which is what marks the current node.
|
|
64
|
+
*
|
|
65
|
+
* The marking is the attribute and not a class, so it survives a theme change and
|
|
66
|
+
* does not depend on a colour a reader may not distinguish.
|
|
67
|
+
*/
|
|
68
|
+
currentHref?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The accessible name of the tree, read before its nodes.
|
|
71
|
+
*
|
|
72
|
+
* Required rather than defaulted, because a tree with no name is announced as
|
|
73
|
+
* "tree" and a page with two of them is a page where a reader cannot tell which
|
|
74
|
+
* is which. The name is the caller's word.
|
|
75
|
+
*/
|
|
76
|
+
label: string;
|
|
77
|
+
/** Layout only. */
|
|
78
|
+
className?: string;
|
|
79
|
+
/**
|
|
80
|
+
* The words a reader is told when the tree is empty, and optionally what to do
|
|
81
|
+
* about it.
|
|
82
|
+
*
|
|
83
|
+
* A tree that renders nothing is a control with nothing in it, so the empty case
|
|
84
|
+
* is authored rather than left to a caller to notice.
|
|
85
|
+
*/
|
|
86
|
+
empty?: {
|
|
87
|
+
message: string;
|
|
88
|
+
action?: ReactNode;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A tree of nodes, given as data.
|
|
93
|
+
*
|
|
94
|
+
* This is the third of the three primitives the expansion found missing, and the
|
|
95
|
+
* one with a different kind of work behind it: the implementation already existed
|
|
96
|
+
* as two private renderers inside the documentation Page, with its depth rule, its
|
|
97
|
+
* `aria-current` marking and its rule that a group with no index renders a label.
|
|
98
|
+
* What was missing was that it was unreachable, and that its data type was bound
|
|
99
|
+
* to documentation navigation rather than being a tree's own vocabulary. So this is
|
|
100
|
+
* a promotion rather than a second implementation, and the reasoning in the
|
|
101
|
+
* documentation Page is carried across rather than rewritten.
|
|
102
|
+
*
|
|
103
|
+
* **A flat list renders a flat tree.** An outline is a tree of depth one, so a
|
|
104
|
+
* caller passes leaves and gets leaves. A Component that required nesting to
|
|
105
|
+
* express a flat structure would make the common case the awkward one.
|
|
106
|
+
*
|
|
107
|
+
* **The Page keeps its own renderers and does not change.** Its two rules, that a
|
|
108
|
+
* section carries no status or count and that a group with no index is a label,
|
|
109
|
+
* are specific to a documentation rail and are reasoned at length in the design
|
|
110
|
+
* rules. A documentation rail is one shape a tree takes, not the shape. Whether the
|
|
111
|
+
* Page composes this Component later is a decision this ticket does not make.
|
|
112
|
+
*/
|
|
113
|
+
declare function Tree({ nodes, currentHref, label, className, empty }: TreeProps): import("react").JSX.Element;
|
|
114
|
+
export { Tree };
|
|
115
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/components/ui/tree.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIlE;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAA;CAC3B,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAA;IACf,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,aAAa,GAAG,eAAe,CAAA;AAErE,kCAAkC;AAClC,MAAM,WAAW,SAAS;IACxB,yDAAyD;IACzD,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAA;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAChD;AAqKD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,SAAS,+BAkEvE;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
/** Whether a group's subtree contains the current address, at any depth. */
|
|
6
|
+
function containsHref(nodes, currentHref) {
|
|
7
|
+
if (currentHref === undefined)
|
|
8
|
+
return false;
|
|
9
|
+
for (const node of nodes) {
|
|
10
|
+
if (node.type === 'page' && node.href === currentHref)
|
|
11
|
+
return true;
|
|
12
|
+
if (node.type === 'group') {
|
|
13
|
+
if (node.href === currentHref)
|
|
14
|
+
return true;
|
|
15
|
+
if (containsHref(node.items, currentHref))
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
/** Whether an address is the current one or lies under it, for a heading's emphasis. */
|
|
22
|
+
function under(href, currentHref) {
|
|
23
|
+
if (currentHref === undefined)
|
|
24
|
+
return false;
|
|
25
|
+
return currentHref === href || currentHref.startsWith(`${href}/`);
|
|
26
|
+
}
|
|
27
|
+
function TreeLevel({ nodes, currentHref, depth, }) {
|
|
28
|
+
return (_jsx("ul", { "data-slot": "tree-list", "data-depth": depth,
|
|
29
|
+
// `group` on the list, not `treeitem`: the items are the things a reader
|
|
30
|
+
// navigates between, and a `ul` of them is a group. `role="none"` on each
|
|
31
|
+
// item below removes the listitem role so that only the anchors and labels
|
|
32
|
+
// are the navigable things, which is what lets a caller's own keyboard model
|
|
33
|
+
// move between them without a roving tabindex fighting the document's.
|
|
34
|
+
role: "group", className: cn('border-border flex flex-col gap-1 border-l',
|
|
35
|
+
// One level of indent per nested group and none at the top, so the depth
|
|
36
|
+
// reads from the rule rather than from the words.
|
|
37
|
+
depth > 0 && 'ps-3'), children: nodes.map((node, index) => (_jsx(TreeItem, { node: node, currentHref: currentHref, depth: depth }, `${node.type}:${index}`))) }));
|
|
38
|
+
}
|
|
39
|
+
function TreeItem({ node, currentHref, depth, }) {
|
|
40
|
+
if (node.type === 'divider') {
|
|
41
|
+
// A rule between nodes. It is a label, so it is not focusable and a reader
|
|
42
|
+
// does not meet it as a destination, and the empty title renders no words
|
|
43
|
+
// above the hairline rather than a word a reader has to interpret.
|
|
44
|
+
return (_jsx("li", { "data-slot": "tree-divider", role: "none", className: "border-border mt-2 border-t pt-2 first:mt-0 first:border-t-0 first:pt-0", children: node.title ? (_jsx("span", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: node.title })) : null }));
|
|
45
|
+
}
|
|
46
|
+
if (node.type === 'group') {
|
|
47
|
+
return (_jsx("li", { "data-slot": "tree-group", role: "none", children: _jsxs("div", { className: "flex flex-col gap-1", children: [node.href === undefined ? (
|
|
48
|
+
/*
|
|
49
|
+
* A group with no index is a tree item that is not a destination, so it
|
|
50
|
+
* carries `role="treeitem"` and its level and nothing else. It is not a
|
|
51
|
+
* bare span: `aria-level` on an element with no role is prohibited
|
|
52
|
+
* rather than ignored, which the accessibility gate caught the first
|
|
53
|
+
* time this was rendered, and a reader needs the level to place a label
|
|
54
|
+
* that has no anchor to place it by.
|
|
55
|
+
*/
|
|
56
|
+
_jsx("span", { "data-slot": "tree-label", role: "treeitem", "aria-level": depth + 1, "aria-expanded": node.items.length > 0 ? true : undefined, className: cn('rounded-sm text-sm font-semibold tracking-tight', containsHref(node.items, currentHref) ? 'text-foreground' : 'text-muted-foreground'), children: node.title })) : (_jsx("a", { "data-slot": "tree-heading", href: node.href, role: "treeitem", "aria-level": depth + 1, "aria-expanded": node.items.length > 0 ? true : undefined, "aria-current": currentHref === node.href ? 'page' : undefined, className: cn('hover:text-foreground rounded-sm text-sm font-semibold tracking-tight transition-colors duration-fast ease-out', under(node.href, currentHref) ? 'text-foreground' : 'text-muted-foreground'), children: node.title })), node.items.length > 0 ? (_jsx(TreeLevel, { nodes: node.items, currentHref: currentHref, depth: depth + 1 })) : null] }) }));
|
|
57
|
+
}
|
|
58
|
+
return (_jsx("li", { "data-slot": "tree-item", role: "none", children: _jsx("a", { "data-slot": "tree-link", href: node.href,
|
|
59
|
+
// A destination in a tree is a `treeitem`, not a link with a level hung
|
|
60
|
+
// off it: the level belongs to the item, and a reader placing it in the
|
|
61
|
+
// tree is reading the item rather than the anchor inside it.
|
|
62
|
+
role: "treeitem", "aria-level": depth + 1, "aria-current": currentHref === node.href ? 'page' : undefined, className: cn('-ms-px block border-l-2 py-1 ps-3 text-sm transition-colors duration-fast ease-out', currentHref === node.href
|
|
63
|
+
? 'text-foreground border-primary font-medium'
|
|
64
|
+
: 'text-muted-foreground hover:text-foreground border-transparent'), children: node.title }) }));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A tree of nodes, given as data.
|
|
68
|
+
*
|
|
69
|
+
* This is the third of the three primitives the expansion found missing, and the
|
|
70
|
+
* one with a different kind of work behind it: the implementation already existed
|
|
71
|
+
* as two private renderers inside the documentation Page, with its depth rule, its
|
|
72
|
+
* `aria-current` marking and its rule that a group with no index renders a label.
|
|
73
|
+
* What was missing was that it was unreachable, and that its data type was bound
|
|
74
|
+
* to documentation navigation rather than being a tree's own vocabulary. So this is
|
|
75
|
+
* a promotion rather than a second implementation, and the reasoning in the
|
|
76
|
+
* documentation Page is carried across rather than rewritten.
|
|
77
|
+
*
|
|
78
|
+
* **A flat list renders a flat tree.** An outline is a tree of depth one, so a
|
|
79
|
+
* caller passes leaves and gets leaves. A Component that required nesting to
|
|
80
|
+
* express a flat structure would make the common case the awkward one.
|
|
81
|
+
*
|
|
82
|
+
* **The Page keeps its own renderers and does not change.** Its two rules, that a
|
|
83
|
+
* section carries no status or count and that a group with no index is a label,
|
|
84
|
+
* are specific to a documentation rail and are reasoned at length in the design
|
|
85
|
+
* rules. A documentation rail is one shape a tree takes, not the shape. Whether the
|
|
86
|
+
* Page composes this Component later is a decision this ticket does not make.
|
|
87
|
+
*/
|
|
88
|
+
function Tree({ nodes, currentHref, label, className, empty }) {
|
|
89
|
+
const root = useRef(null);
|
|
90
|
+
/**
|
|
91
|
+
* The keyboard model, and the reason it lives here rather than in a caller's.
|
|
92
|
+
*
|
|
93
|
+
* A tree is one Tab stop, and the arrow keys move inside it. That is the ARIA
|
|
94
|
+
* pattern, and a consumer who composes the markup themselves gets the Tab order
|
|
95
|
+
* of the document instead, which is every node in the tree and none of the
|
|
96
|
+
* arrows. A roving tabindex is the mechanism: one node is tabbable at a time and
|
|
97
|
+
* the arrows move which one.
|
|
98
|
+
*
|
|
99
|
+
* The flat order is collected from the DOM rather than computed from the node
|
|
100
|
+
* data, because the DOM is what a reader actually moves through and computing a
|
|
101
|
+
* second order from the data is a second list to fall behind the first. Only
|
|
102
|
+
* focusable nodes take part, so a label that is not a destination is skipped
|
|
103
|
+
* rather than focused and doing nothing.
|
|
104
|
+
*/
|
|
105
|
+
const onKeyDown = (event) => {
|
|
106
|
+
const keys = ['ArrowDown', 'ArrowUp', 'Home', 'End'];
|
|
107
|
+
if (!keys.includes(event.key))
|
|
108
|
+
return;
|
|
109
|
+
const root_ = root.current;
|
|
110
|
+
if (root_ === null)
|
|
111
|
+
return;
|
|
112
|
+
const items = [
|
|
113
|
+
...root_.querySelectorAll('[data-slot="tree-link"], [data-slot="tree-heading"]'),
|
|
114
|
+
];
|
|
115
|
+
if (items.length === 0)
|
|
116
|
+
return;
|
|
117
|
+
const at = items.indexOf(document.activeElement);
|
|
118
|
+
if (at === -1)
|
|
119
|
+
return;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
const next = event.key === 'ArrowDown'
|
|
122
|
+
? Math.min(at + 1, items.length - 1)
|
|
123
|
+
: event.key === 'ArrowUp'
|
|
124
|
+
? Math.max(at - 1, 0)
|
|
125
|
+
: event.key === 'Home'
|
|
126
|
+
? 0
|
|
127
|
+
: items.length - 1;
|
|
128
|
+
items[next]?.focus();
|
|
129
|
+
};
|
|
130
|
+
if (nodes.length === 0) {
|
|
131
|
+
// A tree that renders nothing is a control with nothing in it, so the empty
|
|
132
|
+
// case is authored rather than left for a caller to notice.
|
|
133
|
+
return (_jsxs("div", { "data-slot": "tree-empty", className: cn('text-muted-foreground text-sm', className), children: [empty?.message ?? null, empty?.action] }));
|
|
134
|
+
}
|
|
135
|
+
return (_jsx("div", { "data-slot": "tree", ref: root, role: "tree", "aria-label": label, onKeyDown: onKeyDown, className: cn('flex flex-col', className), children: _jsx(TreeLevel, { nodes: nodes, currentHref: currentHref, depth: 0 }) }));
|
|
136
|
+
}
|
|
137
|
+
export { Tree };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) Inter-Italic[opsz,wght].ttf: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/styles.css
CHANGED
|
@@ -635,6 +635,9 @@
|
|
|
635
635
|
--tw-translate-y: var(--spacing-0\.5);
|
|
636
636
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
637
637
|
}
|
|
638
|
+
.transform {
|
|
639
|
+
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
|
640
|
+
}
|
|
638
641
|
.cursor-default {
|
|
639
642
|
cursor: default;
|
|
640
643
|
}
|
|
@@ -1002,6 +1005,9 @@
|
|
|
1002
1005
|
.p-6 {
|
|
1003
1006
|
padding: var(--spacing-6);
|
|
1004
1007
|
}
|
|
1008
|
+
.px-0\.5 {
|
|
1009
|
+
padding-inline: var(--spacing-0\.5);
|
|
1010
|
+
}
|
|
1005
1011
|
.px-1 {
|
|
1006
1012
|
padding-inline: var(--spacing-1);
|
|
1007
1013
|
}
|
|
@@ -2116,6 +2122,27 @@
|
|
|
2116
2122
|
color: var(--destructive);
|
|
2117
2123
|
}
|
|
2118
2124
|
}
|
|
2125
|
+
@font-face {
|
|
2126
|
+
font-family: 'Inter';
|
|
2127
|
+
font-style: normal;
|
|
2128
|
+
font-weight: 400;
|
|
2129
|
+
font-display: swap;
|
|
2130
|
+
src: url('./fonts/inter-latin-400.woff2') format('woff2');
|
|
2131
|
+
}
|
|
2132
|
+
@font-face {
|
|
2133
|
+
font-family: 'Inter';
|
|
2134
|
+
font-style: normal;
|
|
2135
|
+
font-weight: 500;
|
|
2136
|
+
font-display: swap;
|
|
2137
|
+
src: url('./fonts/inter-latin-500.woff2') format('woff2');
|
|
2138
|
+
}
|
|
2139
|
+
@font-face {
|
|
2140
|
+
font-family: 'Inter';
|
|
2141
|
+
font-style: normal;
|
|
2142
|
+
font-weight: 600;
|
|
2143
|
+
font-display: swap;
|
|
2144
|
+
src: url('./fonts/inter-latin-600.woff2') format('woff2');
|
|
2145
|
+
}
|
|
2119
2146
|
:root {
|
|
2120
2147
|
--radius: 0.5rem;
|
|
2121
2148
|
--background: #ffffff;
|
|
@@ -2624,6 +2651,26 @@
|
|
|
2624
2651
|
inherits: false;
|
|
2625
2652
|
initial-value: 0;
|
|
2626
2653
|
}
|
|
2654
|
+
@property --tw-rotate-x {
|
|
2655
|
+
syntax: "*";
|
|
2656
|
+
inherits: false;
|
|
2657
|
+
}
|
|
2658
|
+
@property --tw-rotate-y {
|
|
2659
|
+
syntax: "*";
|
|
2660
|
+
inherits: false;
|
|
2661
|
+
}
|
|
2662
|
+
@property --tw-rotate-z {
|
|
2663
|
+
syntax: "*";
|
|
2664
|
+
inherits: false;
|
|
2665
|
+
}
|
|
2666
|
+
@property --tw-skew-x {
|
|
2667
|
+
syntax: "*";
|
|
2668
|
+
inherits: false;
|
|
2669
|
+
}
|
|
2670
|
+
@property --tw-skew-y {
|
|
2671
|
+
syntax: "*";
|
|
2672
|
+
inherits: false;
|
|
2673
|
+
}
|
|
2627
2674
|
@property --tw-border-style {
|
|
2628
2675
|
syntax: "*";
|
|
2629
2676
|
inherits: false;
|
|
@@ -2891,6 +2938,11 @@
|
|
|
2891
2938
|
--tw-translate-x: 0;
|
|
2892
2939
|
--tw-translate-y: 0;
|
|
2893
2940
|
--tw-translate-z: 0;
|
|
2941
|
+
--tw-rotate-x: initial;
|
|
2942
|
+
--tw-rotate-y: initial;
|
|
2943
|
+
--tw-rotate-z: initial;
|
|
2944
|
+
--tw-skew-x: initial;
|
|
2945
|
+
--tw-skew-y: initial;
|
|
2894
2946
|
--tw-border-style: solid;
|
|
2895
2947
|
--tw-gradient-position: initial;
|
|
2896
2948
|
--tw-gradient-from: #0000;
|
package/gates/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# `@nanisoft/prism-ui/gates`
|
|
2
|
+
|
|
3
|
+
The cross-repository laws, as programs, in the package a consumer already pins
|
|
4
|
+
exactly.
|
|
5
|
+
|
|
6
|
+
For four years the five NaniSoft repositories coordinated through a prose
|
|
7
|
+
contract mirrored in four files. It drifted into three implementations of one rule
|
|
8
|
+
and one of the three rules was false, and it could not be enforced because prose
|
|
9
|
+
cannot fail. This subpath is the replacement: every law is the failure message of
|
|
10
|
+
a gate, and the gate is here, so a change to a law lands once and reaches every
|
|
11
|
+
consumer in one release.
|
|
12
|
+
|
|
13
|
+
## What a consumer holds, and what the package holds
|
|
14
|
+
|
|
15
|
+
A consumer's repository holds **data**:
|
|
16
|
+
|
|
17
|
+
| the consumer declares | because |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| its stylesheets | which sheets are its own is a fact about its own pages |
|
|
20
|
+
| its pack map | the regions it allows, and why each one exists |
|
|
21
|
+
| its region resolver | naming a region means knowing its own DOM |
|
|
22
|
+
| its coverage floors | how many rules or routes count as having read something |
|
|
23
|
+
| its destinations known to be broken | one site's content defect, with a reason |
|
|
24
|
+
| its custom properties the build supplies | one site's build, one site's font |
|
|
25
|
+
|
|
26
|
+
The package holds **every law**: what the judgements are, what each failure says,
|
|
27
|
+
and why each one exists. A consumer that restates any of it has two rules that will
|
|
28
|
+
disagree, and the disagreement is invisible until a reader sees the difference.
|
|
29
|
+
|
|
30
|
+
## Running it
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm exec prism-gates # every gate prism-gates.json names
|
|
34
|
+
pnpm exec prism-gates --gate=links # one gate
|
|
35
|
+
pnpm exec prism-gates --json # machine-readable, for a test
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
In a consumer's `package.json`:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"scripts": {
|
|
43
|
+
"check:gates": "prism-gates"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
And in `prism-gates.json`, at the repository root:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"gateKit": 1,
|
|
53
|
+
"gates": ["pin", "retired-line", "stylesheet-ownership", "links", "hidden-state"],
|
|
54
|
+
"stylesheet-ownership": { "sheets": ["app/globals.css"], "minDeclarations": 20 },
|
|
55
|
+
"links": { "outDir": "out", "minRoutes": 30, "minAnchors": 200 },
|
|
56
|
+
"hidden-state": { "sheets": ["app/globals.css"], "minRules": 25 }
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`gateKit` is the generation of the contract the consumer is holding itself to. A
|
|
61
|
+
consumer that does not state one gets the package's current generation, and a law
|
|
62
|
+
rewritten in a later release is then a version the consumer has not moved to rather
|
|
63
|
+
than a silent change of wording underneath it.
|
|
64
|
+
|
|
65
|
+
## The laws
|
|
66
|
+
|
|
67
|
+
| id | the law |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `pin` | the design system is an exact version, and the token package is the component package's dependency rather than the consumer's |
|
|
70
|
+
| `retired-line` | no trace of the retired component library survives |
|
|
71
|
+
| `stylesheet-ownership` | a site stylesheet does not own a surface the design system owns |
|
|
72
|
+
| `token-read` | a custom property that nothing declares is not a wrong colour, it is no declaration at all |
|
|
73
|
+
| `links` | every internal destination resolves and every fragment names an element that exists |
|
|
74
|
+
| `pack-boundary` | a pack boundary lands on a mark, and a declared region set is the whole of what may carry a second pack |
|
|
75
|
+
| `hidden-state` | a CSS-authored hidden state is escapable, and its exit is not a clock |
|
|
76
|
+
|
|
77
|
+
The full text of each, and the failure each one prevents, is in `laws.mjs` and is
|
|
78
|
+
printed by the gate that holds it. It is not restated here on purpose: this file is
|
|
79
|
+
the one place a reader looks when a build is red, and a second copy of a law in a
|
|
80
|
+
second file is a second rule.
|
|
81
|
+
|
|
82
|
+
## What a gate here cannot do
|
|
83
|
+
|
|
84
|
+
Stated here rather than left for a reader to discover:
|
|
85
|
+
|
|
86
|
+
- **It reads text, not a cascade.** The ownership gate sees a selector and a
|
|
87
|
+
declaration. It does not resolve which rule wins.
|
|
88
|
+
- **It reads the emitted export, not a browser.** The links and pack-boundary gates
|
|
89
|
+
read `out/`. Run the build first; a gate that read nothing fails rather than
|
|
90
|
+
reporting a clean page.
|
|
91
|
+
- **It does not see a runtime.** A `data-pack` attribute set after paint, or a
|
|
92
|
+
token read in client code, is outside every gate in this kit.
|
|
93
|
+
- **A stylesheet half is not a rendered half.** A consumer that ships a hidden
|
|
94
|
+
state also needs a test that renders with scripting switched off.
|
|
95
|
+
|
|
96
|
+
These limits are printed on every run as well, because a gate that appeared to
|
|
97
|
+
resolve cascades and did not would be worse than no gate: it would retire the
|
|
98
|
+
question.
|