@finstack-com-public/design 0.9.1 → 0.10.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 +57 -0
- package/dist/css/data-type.css +32 -0
- package/dist/css/data-type.md +45 -0
- package/dist/css/diagram.css +119 -0
- package/dist/css/diagram.md +32 -0
- package/dist/css/mark-dot.css +62 -0
- package/dist/css/mark-dot.md +54 -0
- package/dist/css/node.css +248 -0
- package/dist/css/node.md +108 -0
- package/dist/css/reset.css +3 -1
- package/dist/css/reset.md +1 -0
- package/dist/css/tokens.css +28 -0
- package/dist/css/xyflow.css +102 -0
- package/dist/css/xyflow.md +97 -0
- package/dist/css-text/data-type.d.ts +2 -0
- package/dist/css-text/data-type.js +1 -0
- package/dist/css-text/diagram.d.ts +2 -0
- package/dist/css-text/diagram.js +1 -0
- package/dist/css-text/kit.js +493 -0
- package/dist/css-text/mark-dot.d.ts +2 -0
- package/dist/css-text/mark-dot.js +1 -0
- package/dist/css-text/node.d.ts +2 -0
- package/dist/css-text/node.js +1 -0
- package/dist/css-text/reset.js +1 -1
- package/dist/css-text/tokens.js +1 -1
- package/dist/css-text/xyflow.d.ts +2 -0
- package/dist/css-text/xyflow.js +1 -0
- package/dist/kit.css +493 -0
- package/dist/react/data.d.ts +24 -0
- package/dist/react/data.js +14 -0
- package/dist/react/diagram.d.ts +27 -0
- package/dist/react/diagram.js +14 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/tokens/color.d.ts +8 -0
- package/dist/tokens/color.js +13 -0
- package/dist/tokens/contrast-pairs.js +22 -0
- package/dist/tokens/index.d.ts +18 -4
- package/dist/tokens/index.js +2 -1
- package/dist/tokens/scale.d.ts +14 -0
- package/dist/tokens/scale.js +17 -0
- package/dist/tokens.json +30 -0
- package/package.json +7 -6
package/dist/css/node.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Node frame — `.fs-node`
|
|
2
|
+
|
|
3
|
+
Spec 02 J (T96, Phase G). CSS: `css/node.css`; width from `--fs-node-width` (default 248 px). React: `DiagramNode`. Gallery: `diagram.html`
|
|
4
|
+
(standalone in all six panels, and inside the live xyflow example).
|
|
5
|
+
**A frame that takes any children.** The kit styles the box and never draws a diagram or a port: handles stay the product's
|
|
6
|
+
(core's are invisible and not connectable). No xyflow import. D37 applies with no exception: corners 0, no shadow.
|
|
7
|
+
**Handles go beside the frame, not in the header:** a `headerAs="button"` header may not hold `<div>`s, and xyflow's `<Handle>` is one. Render the
|
|
8
|
+
`<Handle>`s as siblings of `DiagramNode` in the node component (they position against xyflow's node wrapper).
|
|
9
|
+
**Focus ring on the xyflow wrapper is the product's.** xyflow gives a selectable node wrapper (`.react-flow__node`) focus and sets `outline: none` on it,
|
|
10
|
+
and the kit does not style xyflow's wrapper. A product that leaves nodes selectable draws its own focus ring on the wrapper (the kit's
|
|
11
|
+
`--fs-ring`, `--fs-ring-width`); core sets `elementsSelectable={false}`, and the gallery example does too.
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<div class="fs-node fs-is-selected fs-node--lit" style="--fs-node-width: 260px">
|
|
15
|
+
<div class="fs-node__header">
|
|
16
|
+
<svg class="fs-icon fs-node__icon" aria-hidden="true"></svg>
|
|
17
|
+
<span class="fs-node__name">orders</span><span class="fs-node__meta">12 columns</span>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="fs-node__body">
|
|
20
|
+
<button type="button" class="fs-node__row nodrag fs-is-key">
|
|
21
|
+
<span class="fs-data-type" aria-hidden="true">…</span><span class="fs-visually-hidden">Whole number</span>
|
|
22
|
+
<span class="fs-node__row-name">order_id</span>
|
|
23
|
+
</button>
|
|
24
|
+
<details class="fs-disclosure fs-node__section" open>
|
|
25
|
+
<summary class="fs-disclosure__summary fs-node__section-head">
|
|
26
|
+
<span class="fs-disclosure__title">Measures</span>
|
|
27
|
+
<span class="fs-node__counts">…two .fs-mark-count…</span>
|
|
28
|
+
</summary>
|
|
29
|
+
<div class="fs-disclosure__body">…rows…</div>
|
|
30
|
+
</details>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<DiagramNode selected lit header={<><span className="fs-node__name">orders</span></>}>…rows…</DiagramNode>
|
|
37
|
+
// Core's header is a button that selects the table and is the drag handle:
|
|
38
|
+
<DiagramNode headerAs="button" headerProps={{ 'aria-pressed': selected, onClick }} header={…} />
|
|
39
|
+
```
|
|
40
|
+
`headerAs` is `'div'` (default) or `'button'`; a button gets `type="button"`. `headerProps` go to the header element.
|
|
41
|
+
|
|
42
|
+
## Parts
|
|
43
|
+
|
|
44
|
+
| Class | What it is |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `.fs-node` | The frame: surface, 1 px `--fs-line-strong` edge, square. |
|
|
47
|
+
| `__header` | Chrome background, bottom hairline, grab cursor: a `div` or a `button`. It is the drag-handle selector you give xyflow (`dragHandle: '.fs-node__header'`). |
|
|
48
|
+
| `__icon`, `__name`, `__meta` | A 16 px icon in `--fs-ink-2`; the name (600, ellipsis); the right-hand meta, muted, tabular (a row count, or "No data"). |
|
|
49
|
+
| `__body` | Any children. Omitted by `DiagramNode` when it has none. |
|
|
50
|
+
| `__row` | A column row, 24 px. Every row has hover; a `button` or an element with `tabindex` also gets the pointer cursor and the inset focus ring. |
|
|
51
|
+
| `__row-name`, `__tag`, `__gap`, `__more` | The row's name (flex, ellipsis); a muted small tag or icon (hidden, key, calculated); the gap word in the gap ink; the "+ 3 more columns" line. |
|
|
52
|
+
| `__section`, `__section-head`, `__counts` | A folding section on `.fs-disclosure` (a `details`; chevron, open state and ring are the disclosure's, the chevron in the head's `--fs-ink-2`, `CanvasText` in forced colours): caps text (12 px, `--fs-tracking-caps`); `__counts` is the right-hand slot for `.fs-mark-count`s (T92). |
|
|
53
|
+
|
|
54
|
+
## States
|
|
55
|
+
|
|
56
|
+
| Class | On | Look |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| `.fs-is-selected` | node | 2 px accent outline, 2 px outside the edge (no layout shift). On a row: `--fs-bg-selected`. |
|
|
59
|
+
| `.fs-node--lit` | node | Accent edge and an accent-wash header. |
|
|
60
|
+
| `.fs-node--match` | node | A search match: looks like `--lit`. |
|
|
61
|
+
| `.fs-node--dim` | node | `opacity: var(--fs-diagram-dim-node)` (0.38; a deliberate contrast exception, spec 06 §2). |
|
|
62
|
+
| `.fs-node--fail` | node | Two filter paths: dashed `--fs-gap-ink` edge and a gap-hatched header. |
|
|
63
|
+
| `.fs-node--nodata` | node | Hatched header; the meta turns 600 and `--fs-ink-2`. The product writes "No data" in the meta. |
|
|
64
|
+
| `.fs-node--measures-only` | node | A dashed edge. |
|
|
65
|
+
| `.fs-is-lit` | row | Accent wash and a 3 px accent left edge. |
|
|
66
|
+
| `.fs-is-hidden`, `.fs-is-key` | row | Muted name; 600 name. |
|
|
67
|
+
| `.fs-is-gap` | row | The small gap hatch; put the word in `__gap`. |
|
|
68
|
+
|
|
69
|
+
Every state that colour alone would carry also changes the edge, the text or a fill pattern: selected is an outline, fail is dashed
|
|
70
|
+
and hatched, nodata is hatched with a changed meta, measures-only is dashed, a gap row is hatched and carries its word.
|
|
71
|
+
**Lit and match differ from a default node only in colour** (the edge and the header fill). Their non-colour cue is that the
|
|
72
|
+
product dims every other node (core `ModelView.tsx`, the `dim` state), so a lit node is the one that is not dimmed.
|
|
73
|
+
**Why "lit" has three spellings:** node states are `--` modifiers as the ticket named them (grid precedent: `--dirty`, `--editing`, `--nodata`); row states are `fs-is-*`, mirroring core's `.is-*` row classes; a line's `--emphasis` (T94) covers hover, selected, lit and flow.
|
|
74
|
+
Forced colours use `Highlight` for the selected outline, the lit edge, a selected row's outline and a lit row's 3 px left
|
|
75
|
+
border (forced colours removes `box-shadow`).
|
|
76
|
+
|
|
77
|
+
- **Dim nodes stay interactive: never `inert` them.** A dimmed node is below 3:1 on purpose (spec 06 §2); a product's axe run
|
|
78
|
+
excludes `.fs-node--dim` from the contrast check (the gallery's `e2e/matrix.spec.ts` does).
|
|
79
|
+
- **Text is 12/16 (`--fs-text-xs-*`) at every density**, and a row is 24 px: fixed geometry, like core's rows.
|
|
80
|
+
- **Hover applies to every row;** only the pointer cursor is limited to a `button` or an element with `tabindex`.
|
|
81
|
+
|
|
82
|
+
## Mapping core's `TableNode` (`ModelView.tsx`, `model-view.css`)
|
|
83
|
+
|
|
84
|
+
| Core | Kit |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `.model__box` (`style={{ width: BOX_WIDTH }}`) | `.fs-node` (set `--fs-node-width`, default 248) |
|
|
87
|
+
| `.is-selected` | `.fs-is-selected` |
|
|
88
|
+
| `.is-lit`, `.is-match` | `.fs-node--lit`, `.fs-node--match` |
|
|
89
|
+
| `.is-dim` | `.fs-node--dim` |
|
|
90
|
+
| `.is-fail` | `.fs-node--fail` |
|
|
91
|
+
| `.model__box--nodata` | `.fs-node--nodata` |
|
|
92
|
+
| the `square-function` icon core swaps in for a table with no columns | `.fs-node__icon` (the product picks the icon); `.fs-node--measures-only` adds the dashed edge. The "Measures only" `.fs-pill` is in core's details pane (`.model__facts`), not on the node |
|
|
93
|
+
| `.model__box-head` (`<button aria-pressed onClick>`) | `.fs-node__header`; React: `headerAs="button"` with `headerProps={{ 'aria-pressed': selected, onClick }}` |
|
|
94
|
+
| `.model__box-icon`, `-name`, `-meta` | `__icon`, `__name`, `__meta` |
|
|
95
|
+
| `.model__rows` | `.fs-node__body` |
|
|
96
|
+
| `.model__row` (`nodrag`) | `.fs-node__row` (keep `nodrag`) |
|
|
97
|
+
| row `.is-selected`, `.is-lit`, `.is-hidden`, `.is-key`, `.is-gap` | `.fs-is-selected`, `.fs-is-lit`, `.fs-is-hidden`, `.fs-is-key`, `.fs-is-gap` |
|
|
98
|
+
| `.model__row-name`, `.model__tag`, `.model__gap`, `.model__more` | `__row-name`, `__tag`, `__gap`, `__more` |
|
|
99
|
+
| `.model__type` | `.fs-data-type` (T93; add the hidden word) |
|
|
100
|
+
| `.model__dot` | `.fs-mark-dot` (T92) |
|
|
101
|
+
| `.model__measures`, `.model__measures-head`, `.model__counts`, `.model__count` | `.fs-node__section` on `.fs-disclosure` (`<details>`), `__section-head`, `__counts`, `.fs-mark-count` |
|
|
102
|
+
| `.model__handle` and `<Handle>`s | unchanged: the product's, unstyled by the kit |
|
|
103
|
+
|
|
104
|
+
- **Look changes core takes on adopting (D37):** corners 0 (core: radius-md), no 3 px wash ring on lit/match (core: box-shadow;
|
|
105
|
+
the header wash replaces it), the section chevron is the disclosure's (core: a "▸" glyph), and the disclosure is a native
|
|
106
|
+
`<details>`: core's `aria-expanded` button with `view.toggleMeasures` becomes `open` plus `onToggle`. Text goes from core's 11 px and 13 px to
|
|
107
|
+
12 px (D35), and core's `opacity` transition on dim is dropped (the kit does not animate it).
|
|
108
|
+
- **The product owns the state.** The kit has no handler; the frame never changes its own classes.
|
package/dist/css/reset.css
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* The opt-in reset (spec 02 G; CE H4). Usage: reset.md. Never part of kit.css: load it yourself,
|
|
2
|
-
and only in an app the kit owns, never inside an embed on someone else's page.
|
|
2
|
+
and only in an app the kit owns, never inside an embed on someone else's page. It starts with the
|
|
3
|
+
kit's layer order, so it can load before or after kit.css (T102). */
|
|
4
|
+
@layer fs.tokens, fs.reset, fs.base, fs.components, fs.utilities;
|
|
3
5
|
@layer fs.reset {
|
|
4
6
|
*,
|
|
5
7
|
*::before,
|
package/dist/css/reset.md
CHANGED
|
@@ -7,5 +7,6 @@ Spec 02 G (CE H4). CSS: `css/reset.css`, in `fs.reset`. **Not** part of `kit.css
|
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
- Box-sizing, no body margin, form controls inherit their font, media fits its box.
|
|
10
|
+
- It starts with the kit's layer order, so it can load before or after `kit.css`.
|
|
10
11
|
- Load it only in an app the kit owns. Never put it in an embed on someone else's page: it styles
|
|
11
12
|
bare elements.
|
package/dist/css/tokens.css
CHANGED
|
@@ -121,6 +121,14 @@
|
|
|
121
121
|
--fs-editor-lint-refusal: var(--fs-gap-ink);
|
|
122
122
|
--fs-editor-tooltip-bg: var(--fs-bg-surface);
|
|
123
123
|
--fs-editor-tooltip-line: var(--fs-line-strong);
|
|
124
|
+
--fs-diagram-bg: var(--fs-bg-plane);
|
|
125
|
+
--fs-diagram-dot: var(--fs-line-strong);
|
|
126
|
+
--fs-diagram-line: var(--fs-ink-muted);
|
|
127
|
+
--fs-diagram-line-inactive: var(--fs-line-strong);
|
|
128
|
+
--fs-diagram-line-emphasis: var(--fs-accent);
|
|
129
|
+
--fs-diagram-end-bg: var(--fs-bg-surface);
|
|
130
|
+
--fs-diagram-end-line: var(--fs-ink-muted);
|
|
131
|
+
--fs-diagram-end-ink: var(--fs-ink-2);
|
|
124
132
|
--fs-chart-1: var(--fs-p-blue-600);
|
|
125
133
|
--fs-chart-2: #0891b2;
|
|
126
134
|
--fs-chart-3: #6646a8;
|
|
@@ -288,6 +296,18 @@
|
|
|
288
296
|
--fs-gradient-brand-soft: linear-gradient(135deg, var(--fs-brand-wash-end), var(--fs-brand-wash-start));
|
|
289
297
|
--fs-chart-area-alpha: 0.18;
|
|
290
298
|
--fs-chart-series-alpha: 0.6;
|
|
299
|
+
--fs-diagram-line-width: 1.5px;
|
|
300
|
+
--fs-diagram-emphasis-width: 2.25px;
|
|
301
|
+
--fs-diagram-inactive-dash: 5 4;
|
|
302
|
+
--fs-diagram-flow-dash: 6 5;
|
|
303
|
+
--fs-diagram-flow-offset: -22;
|
|
304
|
+
--fs-diagram-flow-period: 900ms;
|
|
305
|
+
--fs-diagram-dim-node: 0.38;
|
|
306
|
+
--fs-diagram-dim-edge: 0.25;
|
|
307
|
+
--fs-diagram-end-size: 14px;
|
|
308
|
+
--fs-diagram-end-line-width: 1.2px;
|
|
309
|
+
--fs-diagram-dot-size: 1px;
|
|
310
|
+
--fs-diagram-grid-gap: 20px;
|
|
291
311
|
--fs-text-body-size: 12px;
|
|
292
312
|
--fs-text-body-line: 16px;
|
|
293
313
|
--fs-control-h: 28px;
|
|
@@ -819,6 +839,14 @@
|
|
|
819
839
|
--fs-editor-lint-refusal: var(--fs-gap-ink);
|
|
820
840
|
--fs-editor-tooltip-bg: var(--fs-bg-surface);
|
|
821
841
|
--fs-editor-tooltip-line: var(--fs-line-strong);
|
|
842
|
+
--fs-diagram-bg: var(--fs-bg-plane);
|
|
843
|
+
--fs-diagram-dot: var(--fs-line-strong);
|
|
844
|
+
--fs-diagram-line: var(--fs-ink-muted);
|
|
845
|
+
--fs-diagram-line-inactive: var(--fs-line-strong);
|
|
846
|
+
--fs-diagram-line-emphasis: var(--fs-accent);
|
|
847
|
+
--fs-diagram-end-bg: var(--fs-bg-surface);
|
|
848
|
+
--fs-diagram-end-line: var(--fs-ink-muted);
|
|
849
|
+
--fs-diagram-end-ink: var(--fs-ink-2);
|
|
822
850
|
--fs-chart-1: var(--fs-p-blue-500);
|
|
823
851
|
--fs-chart-2: var(--fs-p-cyan-400);
|
|
824
852
|
--fs-chart-3: #b49df8;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* A scoped, CSS-only theme for xyflow (spec 02 J, T95). Usage: xyflow.md. Opt-in like reset.css: never part of kit.css, load it yourself. It starts with the kit's layer order, so the load order doesn't matter, against xyflow's stylesheet or the kit's (T102). The kit has no xyflow dependency. */
|
|
2
|
+
@layer fs.tokens, fs.reset, fs.base, fs.components, fs.utilities;
|
|
3
|
+
@layer fs.components {
|
|
4
|
+
/* xyflow reads its own --xy-* variables before its -default ones, so setting them here themes every
|
|
5
|
+
part that reads them. Set on the plane, they reach a `.react-flow` inside it or on the same element. */
|
|
6
|
+
.fs-diagram {
|
|
7
|
+
--xy-background-color: var(--fs-diagram-bg);
|
|
8
|
+
--xy-background-pattern-color: var(--fs-diagram-dot);
|
|
9
|
+
--xy-edge-stroke: var(--fs-diagram-line);
|
|
10
|
+
--xy-edge-stroke-width: var(--fs-diagram-line-width);
|
|
11
|
+
--xy-edge-stroke-selected: var(--fs-diagram-line-emphasis);
|
|
12
|
+
--xy-connectionline-stroke: var(--fs-diagram-line);
|
|
13
|
+
--xy-connectionline-stroke-width: var(--fs-diagram-line-width);
|
|
14
|
+
--xy-edge-label-background-color: var(--fs-bg-surface);
|
|
15
|
+
--xy-edge-label-color: var(--fs-ink-2);
|
|
16
|
+
--xy-attribution-background-color: var(--fs-bg-surface);
|
|
17
|
+
--xy-selection-background-color: var(--fs-accent-wash);
|
|
18
|
+
--xy-selection-border: var(--fs-line-width) dotted var(--fs-accent);
|
|
19
|
+
--xy-minimap-background-color: var(--fs-bg-surface);
|
|
20
|
+
--xy-minimap-mask-background-color: var(--fs-bg-sunken);
|
|
21
|
+
--xy-minimap-mask-stroke-color: transparent;
|
|
22
|
+
--xy-minimap-node-background-color: var(--fs-line-strong);
|
|
23
|
+
--xy-minimap-node-stroke-color: transparent;
|
|
24
|
+
--xy-controls-button-background-color: var(--fs-bg-surface);
|
|
25
|
+
--xy-controls-button-background-color-hover: var(--fs-bg-hover);
|
|
26
|
+
--xy-controls-button-color: var(--fs-ink-2);
|
|
27
|
+
--xy-controls-button-color-hover: var(--fs-ink);
|
|
28
|
+
--xy-controls-button-border-color: var(--fs-line);
|
|
29
|
+
/* D37: flat. xyflow's default is a 2 px shadow. */
|
|
30
|
+
--xy-controls-box-shadow: none;
|
|
31
|
+
}
|
|
32
|
+
/* A `.react-flow` inside the plane lets the plane's dot grid show; on the plane itself the colour above stays. */
|
|
33
|
+
.fs-diagram .react-flow {
|
|
34
|
+
--xy-background-color: transparent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* The line states on an xyflow edge path. xyflow's unlayered `.react-flow__edge-path` sets stroke, stroke-width and fill
|
|
38
|
+
itself, so it beats diagram.css's stroke rules; its --xy-edge-stroke and --xy-edge-stroke-width are the way in. The
|
|
39
|
+
product puts the T94 classes on `BaseEdge`'s className (they land on the path). Hover is the edge group's, not the
|
|
40
|
+
path's: xyflow draws a wider invisible interaction path on top of it. */
|
|
41
|
+
.fs-diagram .fs-diagram-edge {
|
|
42
|
+
--xy-edge-stroke: var(--fs-diagram-line);
|
|
43
|
+
--xy-edge-stroke-width: var(--fs-diagram-line-width);
|
|
44
|
+
}
|
|
45
|
+
.fs-diagram .fs-diagram-edge--inactive {
|
|
46
|
+
--xy-edge-stroke: var(--fs-diagram-line-inactive);
|
|
47
|
+
}
|
|
48
|
+
.fs-diagram .fs-diagram-edge--emphasis,
|
|
49
|
+
.fs-diagram .fs-diagram-edge--flow,
|
|
50
|
+
.fs-diagram .react-flow__edge:hover .fs-diagram-edge,
|
|
51
|
+
.fs-diagram .react-flow__edge.selected .fs-diagram-edge {
|
|
52
|
+
--xy-edge-stroke: var(--fs-diagram-line-emphasis);
|
|
53
|
+
--xy-edge-stroke-width: var(--fs-diagram-emphasis-width);
|
|
54
|
+
}
|
|
55
|
+
/* The end circle and the arrow: xyflow sets nothing on them, so the kit's own properties work; only hover needs the
|
|
56
|
+
edge group, as above. */
|
|
57
|
+
.fs-diagram .react-flow__edge:hover .fs-diagram-end > circle {
|
|
58
|
+
stroke: var(--fs-diagram-line-emphasis);
|
|
59
|
+
}
|
|
60
|
+
.fs-diagram .react-flow__edge:hover .fs-diagram-arrow {
|
|
61
|
+
fill: var(--fs-diagram-line-emphasis);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* The kit's reset caps an svg at its container's width; the edge layer's container has none, and a
|
|
65
|
+
zero-wide svg draws nothing. */
|
|
66
|
+
.fs-diagram .react-flow__edges svg {
|
|
67
|
+
max-width: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Square, with a hairline edge (D37). */
|
|
71
|
+
.fs-diagram .react-flow__controls,
|
|
72
|
+
.fs-diagram .react-flow__minimap {
|
|
73
|
+
border: var(--fs-line-width) solid var(--fs-line);
|
|
74
|
+
border-radius: 0;
|
|
75
|
+
}
|
|
76
|
+
.fs-diagram .react-flow__controls-button {
|
|
77
|
+
border-radius: 0;
|
|
78
|
+
}
|
|
79
|
+
.fs-diagram .react-flow__controls-button:focus-visible {
|
|
80
|
+
outline: var(--fs-ring-width) solid var(--fs-ring);
|
|
81
|
+
outline-offset: calc(-1 * var(--fs-ring-width));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Forced colours: the same variables, as system colours. */
|
|
85
|
+
@media (forced-colors: active) {
|
|
86
|
+
.fs-diagram .fs-diagram-edge {
|
|
87
|
+
--xy-edge-stroke: CanvasText;
|
|
88
|
+
}
|
|
89
|
+
.fs-diagram .fs-diagram-edge--emphasis,
|
|
90
|
+
.fs-diagram .fs-diagram-edge--flow,
|
|
91
|
+
.fs-diagram .react-flow__edge:hover .fs-diagram-edge,
|
|
92
|
+
.fs-diagram .react-flow__edge.selected .fs-diagram-edge {
|
|
93
|
+
--xy-edge-stroke: Highlight;
|
|
94
|
+
}
|
|
95
|
+
.fs-diagram .react-flow__edge:hover .fs-diagram-end > circle {
|
|
96
|
+
stroke: Highlight;
|
|
97
|
+
}
|
|
98
|
+
.fs-diagram .react-flow__edge:hover .fs-diagram-arrow {
|
|
99
|
+
fill: Highlight;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# xyflow theme — `css/xyflow.css`
|
|
2
|
+
|
|
3
|
+
Spec 02 J (T95, Phase G). CSS: `css/xyflow.css`. Gallery: `diagram.html` (live, in all six panels, and once outside `.fs-diagram`).
|
|
4
|
+
**A CSS-only theme for [xyflow](https://xyflow.com).** The kit has no xyflow dependency (the rule of `codemirror.md`):
|
|
5
|
+
`@xyflow/react` is a devDependency of the gallery and its tests, and the product keeps its own copy.
|
|
6
|
+
|
|
7
|
+
**Opt-in, like `reset.css`.** `kit.css` does not contain it. Import it yourself, in any order. It starts with the kit's layer order, so it may come before `kit.css` (T102); against xyflow's stylesheet, see "Layers decide what works" below.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import '@xyflow/react/dist/style.css';
|
|
11
|
+
import '@finstack-com-public/design/kit.css';
|
|
12
|
+
import '@finstack-com-public/design/css/xyflow.css';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<div className="fs-diagram" style={{ height: 480 }}>
|
|
17
|
+
<ReactFlow nodes={nodes} edges={edges}>
|
|
18
|
+
<Controls showInteractive={false} />
|
|
19
|
+
<MiniMap />
|
|
20
|
+
</ReactFlow>
|
|
21
|
+
</div>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Scoped.** Every selector starts at `.fs-diagram` (the plane, T94), so a `.react-flow` outside it keeps xyflow's look.
|
|
25
|
+
The `.react-flow` can sit inside the plane (the plane's dot grid then shows) or carry `fs-diagram` itself (the sheet then
|
|
26
|
+
gives it the plane colour; add xyflow's `<Background>` for dots).
|
|
27
|
+
|
|
28
|
+
## What it sets
|
|
29
|
+
|
|
30
|
+
xyflow reads `--xy-*` before its own `-default` values, so these set the whole look. All are set on `.fs-diagram`:
|
|
31
|
+
|
|
32
|
+
| `--xy-*` | Token |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `background-color` | `--fs-diagram-bg` (`transparent` on a `.react-flow` inside the plane, so the dots show) |
|
|
35
|
+
| `background-pattern-color` | `--fs-diagram-dot` (for xyflow's `<Background>`) |
|
|
36
|
+
| `edge-stroke`, `connectionline-stroke` | `--fs-diagram-line` |
|
|
37
|
+
| `edge-stroke-width`, `connectionline-stroke-width` | `--fs-diagram-line-width` |
|
|
38
|
+
| `edge-stroke-selected` | `--fs-diagram-line-emphasis` |
|
|
39
|
+
| `edge-label-background-color`, `edge-label-color` | `--fs-bg-surface`, `--fs-ink-2` |
|
|
40
|
+
| `attribution-background-color` | `--fs-bg-surface` |
|
|
41
|
+
| `selection-background-color`, `selection-border` | `--fs-accent-wash`, `--fs-line-width dotted --fs-accent` |
|
|
42
|
+
| `minimap-background-color` | `--fs-bg-surface` |
|
|
43
|
+
| `minimap-mask-background-color` | `--fs-bg-sunken` |
|
|
44
|
+
| `minimap-node-background-color` | `--fs-line-strong` |
|
|
45
|
+
| `minimap-mask-stroke-color`, `minimap-node-stroke-color` | `transparent` |
|
|
46
|
+
| `controls-button-background-color` (`-hover`) | `--fs-bg-surface` (`--fs-bg-hover`) |
|
|
47
|
+
| `controls-button-color` (`-hover`) | `--fs-ink-2` (`--fs-ink`) |
|
|
48
|
+
| `controls-button-border-color` | `--fs-line` |
|
|
49
|
+
| `controls-box-shadow` | `none` (D37: flat; xyflow's default is a 2 px shadow) |
|
|
50
|
+
|
|
51
|
+
## What else it styles
|
|
52
|
+
|
|
53
|
+
- `.react-flow__controls` and `.react-flow__minimap`: a `--fs-line-width` `--fs-line` border, square (D37).
|
|
54
|
+
- `.react-flow__controls-button`: square, with the kit's focus ring inside the button.
|
|
55
|
+
- `.react-flow__edges svg { max-width: none }`: the kit's reset caps an svg at its container's width, and the edge layer's
|
|
56
|
+
container has none, so a zero-wide svg would draw nothing.
|
|
57
|
+
- The line-state variables and the hover rules of an edge, described under "What it leaves to the product".
|
|
58
|
+
|
|
59
|
+
- **Layers decide what works.** The sheet's `--xy-*` variables always work, because xyflow reads them in its own rules. A
|
|
60
|
+
direct property works only where xyflow's unlayered `style.css` sets none: an unlayered declaration beats any layered one,
|
|
61
|
+
whatever the load order, and the kit forbids `!important`.
|
|
62
|
+
- **The attribution link keeps xyflow's `#999`**, which fails AA on the surface (only its background is set here). A product
|
|
63
|
+
that shows the attribution restyles the link in its own unlayered CSS (the gallery's `gallery.css` gives it
|
|
64
|
+
`--fs-ink-link`, a text pair on the surface this sheet puts behind it); otherwise it hides it
|
|
65
|
+
(`proOptions={{ hideAttribution: true }}`).
|
|
66
|
+
- **More than one diagram on a page:** give each `<ReactFlow>` its own `id`. The default is the same for all, and the ids of
|
|
67
|
+
xyflow's aria descriptions and live region would repeat. xyflow also puts that `id` on its root element, so it must be unique
|
|
68
|
+
on the page and must not reuse another element's id (the gallery uses `<host id>-flow`).
|
|
69
|
+
|
|
70
|
+
## What it leaves to the product
|
|
71
|
+
|
|
72
|
+
- **Nodes** (`.react-flow__node`, the `--xy-node-*` variables): the product renders them, with the kit's node frame (T96)
|
|
73
|
+
or its own.
|
|
74
|
+
- **Handles** (`.react-flow__handle`, `--xy-handle-*`): the product styles them through its own class.
|
|
75
|
+
- **Edge paths** (`.react-flow__edge-path`): the product writes a custom edge type and puts T94's classes on `BaseEdge`'s
|
|
76
|
+
`className`, which xyflow adds to the visible path:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
function KitEdge({ id, data, ...p }: EdgeProps<Edge<{ state?: 'emphasis' | 'inactive' | 'flow' }>>) {
|
|
80
|
+
const [path] = getBezierPath(p);
|
|
81
|
+
const state = data?.state ? ` fs-diagram-edge--${data.state}` : '';
|
|
82
|
+
return <BaseEdge id={id} path={path} className={`fs-diagram-edge${state}`} interactionWidth={16} />;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
xyflow's own `.react-flow__edge-path` rule is unlayered and sets `stroke`, `stroke-width` and `fill`, so it beats
|
|
87
|
+
the kit's `stroke` in `diagram.css`. The sheet therefore sets xyflow's `--xy-edge-stroke` and `--xy-edge-stroke-width`
|
|
88
|
+
**on `.fs-diagram-edge`** (the line ink and width), and the same two for `--inactive` (inactive ink), `--emphasis` and
|
|
89
|
+
`--flow` (emphasis ink and width), and for forced colours (`CanvasText`, `Highlight`). The dash (`--inactive`, `--flow`),
|
|
90
|
+
the flow animation and `--dim` are not set by xyflow, so `diagram.css` does them directly.
|
|
91
|
+
**Hover works from the edge group:** xyflow draws a wide invisible interaction path over the visible one, so the pointer
|
|
92
|
+
never reaches the path. `.react-flow__edge:hover` (the group that wraps your edge component) lights the path
|
|
93
|
+
(`.fs-diagram-edge`), the `.fs-diagram-end` circle and the `.fs-diagram-arrow` for you; put them inside your edge
|
|
94
|
+
component. A path's own `:hover` in `diagram.css` still serves a plain SVG diagram. Selected is xyflow's own
|
|
95
|
+
`.selected` (emphasis ink, set from `--xy-edge-stroke-selected`) plus the emphasis width.
|
|
96
|
+
The other state classes of the ends and the arrow (`--emphasis`, `--dim`) stay the product's, as in `diagram.md`.
|
|
97
|
+
- `colorMode`: leave it at xyflow's default. The kit's tokens already follow the scheme.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "/* Data-type badge: a column's data type as one icon in a small frame (spec 02 F, T93). Usage: data-type.md. */\n@layer fs.components {\n /* A frame for one icon. The product picks the icon; the kit draws the frame. It is a glyph like an icon: the size does not follow density. */\n .fs-data-type {\n --fs-data-type-w: 22px;\n --fs-data-type-h: 16px;\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: var(--fs-data-type-w);\n height: var(--fs-data-type-h);\n vertical-align: middle;\n color: var(--fs-ink-2);\n background: var(--fs-bg-sunken);\n /* A badge (D37), but a small square-cornered chip, not a pill: the 4 px control corner. */\n border-radius: var(--fs-radius-sm);\n }\n .fs-data-type > .fs-icon {\n width: 12px;\n height: 12px;\n }\n\n /* The sunken fill is dropped in forced colours, so the frame is drawn as an edge. */\n @media (forced-colors: active) {\n .fs-data-type {\n color: CanvasText;\n border: var(--fs-line-width) solid CanvasText;\n }\n }\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "/* Diagram looks: the plane, the line, the cardinality end and the filter arrow (spec 02 J, T94). Usage: diagram.md. The kit styles a diagram and never draws one. */\n@layer fs.components {\n /* The plane: the surround with a dot grid. The product places and sizes it; xyflow's own stylesheet moves it. */\n .fs-diagram {\n background-color: var(--fs-diagram-bg);\n background-image: radial-gradient(\n var(--fs-diagram-dot) var(--fs-diagram-dot-size),\n transparent calc(var(--fs-diagram-dot-size) + 0.2px)\n );\n background-size: var(--fs-diagram-grid-gap) var(--fs-diagram-grid-gap);\n }\n\n /* A line, drawn as an SVG path. */\n .fs-diagram-edge {\n fill: none;\n stroke: var(--fs-diagram-line);\n stroke-width: var(--fs-diagram-line-width);\n transition: stroke var(--fs-dur);\n }\n .fs-diagram-edge--inactive {\n stroke: var(--fs-diagram-line-inactive);\n stroke-dasharray: var(--fs-diagram-inactive-dash);\n }\n /* Hover, selected, lit: the product sets --emphasis on the parts of a line it lights; a path's own hover does it too. */\n .fs-diagram-edge--emphasis,\n .fs-diagram-edge:hover,\n .fs-diagram-edge--flow {\n stroke: var(--fs-diagram-line-emphasis);\n stroke-width: var(--fs-diagram-emphasis-width);\n }\n .fs-diagram-edge--dim {\n opacity: var(--fs-diagram-dim-edge);\n }\n /* The way a filter goes: dashes moving along the line. --back runs them the other way. */\n .fs-diagram-edge--flow {\n stroke-dasharray: var(--fs-diagram-flow-dash);\n animation: fs-diagram-flow var(--fs-diagram-flow-period) linear infinite;\n }\n .fs-diagram-edge--flow.fs-diagram-edge--back {\n animation-direction: reverse;\n }\n @keyframes fs-diagram-flow {\n to {\n stroke-dashoffset: var(--fs-diagram-flow-offset);\n }\n }\n /* Reduced motion: the line is solid and still. */\n @media (prefers-reduced-motion: reduce) {\n .fs-diagram-edge--flow {\n animation: none;\n stroke-dasharray: none;\n }\n }\n\n /* The \"1\" / \"*\" end: an SVG group of a circle and a text. The product places it and sets the circle's r to half --fs-diagram-end-size (core's r is 7). Give the text dy=\"0.36em\": half the cap height at any size, so \"1\" and \"*\" sit centred. */\n .fs-diagram-end > circle {\n fill: var(--fs-diagram-end-bg);\n stroke: var(--fs-diagram-end-line);\n stroke-width: var(--fs-diagram-end-line-width);\n }\n .fs-diagram-end > text {\n fill: var(--fs-diagram-end-ink);\n font-family: var(--fs-font-sans);\n font-size: var(--fs-text-xs-size);\n font-weight: var(--fs-weight-semibold);\n text-anchor: middle;\n }\n .fs-diagram-end--emphasis > circle {\n stroke: var(--fs-diagram-line-emphasis);\n }\n .fs-diagram-end--dim {\n opacity: var(--fs-diagram-dim-edge);\n }\n\n /* The filter-direction triangle: an SVG path. */\n .fs-diagram-arrow {\n fill: var(--fs-diagram-line);\n }\n .fs-diagram-arrow--inactive {\n fill: var(--fs-diagram-line-inactive);\n }\n .fs-diagram-arrow--emphasis {\n fill: var(--fs-diagram-line-emphasis);\n }\n .fs-diagram-arrow--dim {\n opacity: var(--fs-diagram-dim-edge);\n }\n\n /* Forced colours: system colours; the dash still tells inactive from active. */\n @media (forced-colors: active) {\n .fs-diagram {\n background-image: none;\n }\n .fs-diagram-edge {\n stroke: CanvasText;\n }\n .fs-diagram-edge--emphasis,\n .fs-diagram-edge:hover,\n .fs-diagram-edge--flow {\n stroke: Highlight;\n }\n .fs-diagram-end > circle {\n fill: Canvas;\n stroke: CanvasText;\n }\n .fs-diagram-end--emphasis > circle {\n stroke: Highlight;\n }\n .fs-diagram-end > text {\n fill: CanvasText;\n }\n .fs-diagram-arrow {\n fill: CanvasText;\n }\n .fs-diagram-arrow--emphasis {\n fill: Highlight;\n }\n }\n}\n";
|