@mistriwork/kit 1.0.0-rc.17 → 1.0.0-rc.18

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.
Files changed (99) hide show
  1. package/dist/client/components/AppList.js +16 -6
  2. package/dist/client/components/Chart.css +5 -0
  3. package/dist/client/components/Chart.d.ts +17 -2
  4. package/dist/client/components/Chart.js +83 -22
  5. package/dist/client/components/ChartFigure.d.ts +3 -1
  6. package/dist/client/components/ChartFigure.js +14 -8
  7. package/dist/client/components/Content.js +3 -1
  8. package/dist/client/components/DashHead.d.ts +6 -0
  9. package/dist/client/components/DashHead.js +20 -0
  10. package/dist/client/components/Editable.js +1 -1
  11. package/dist/client/components/Grid.js +33 -4
  12. package/dist/client/components/JsonPreview.css +29 -0
  13. package/dist/client/components/JsonPreview.js +1 -1
  14. package/dist/client/components/JsonView.css +201 -62
  15. package/dist/client/components/JsonView.d.ts +43 -1
  16. package/dist/client/components/JsonView.js +320 -55
  17. package/dist/client/components/LayoutSwitch.d.ts +9 -0
  18. package/dist/client/components/LayoutSwitch.js +61 -0
  19. package/dist/client/components/ListEmpty.css +3 -0
  20. package/dist/client/components/LiveNotices.css +3 -0
  21. package/dist/client/components/NewRecord.d.ts +0 -2
  22. package/dist/client/components/NewRecord.js +61 -17
  23. package/dist/client/components/PageFields.js +22 -3
  24. package/dist/client/components/PageHead.js +26 -6
  25. package/dist/client/components/PageRelated.d.ts +28 -0
  26. package/dist/client/components/PageRelated.js +50 -3
  27. package/dist/client/components/PageSectionBox.d.ts +5 -1
  28. package/dist/client/components/PageSectionBox.js +5 -3
  29. package/dist/client/components/PageSections.js +26 -13
  30. package/dist/client/components/PageSkeleton.css +2 -0
  31. package/dist/client/components/PageSkeleton.js +11 -3
  32. package/dist/client/components/Palette.js +108 -10
  33. package/dist/client/components/RecordPicker.d.ts +2 -0
  34. package/dist/client/components/RecordPicker.js +34 -8
  35. package/dist/client/components/RecordSummaries.js +6 -1
  36. package/dist/client/components/Rooms.js +2 -2
  37. package/dist/client/components/TableRoom.js +15 -5
  38. package/dist/client/components/TableView.d.ts +2 -0
  39. package/dist/client/components/Value.js +1 -1
  40. package/dist/client/components/appListModel.d.ts +4 -0
  41. package/dist/client/components/appRooms.d.ts +2 -0
  42. package/dist/client/components/appRooms.js +2 -0
  43. package/dist/client/components/dashboardModel.d.ts +5 -0
  44. package/dist/client/components/directoryModel.d.ts +25 -0
  45. package/dist/client/components/directoryModel.js +88 -0
  46. package/dist/client/components/gridSizing.d.ts +3 -0
  47. package/dist/client/components/gridSizing.js +6 -2
  48. package/dist/client/components/jsonTree.d.ts +54 -0
  49. package/dist/client/components/jsonTree.js +190 -0
  50. package/dist/client/components/listSubtitles.d.ts +1 -0
  51. package/dist/client/components/listSubtitles.js +7 -0
  52. package/dist/client/components/newMenuModel.d.ts +14 -6
  53. package/dist/client/components/newMenuModel.js +37 -5
  54. package/dist/client/components/newRecordModel.d.ts +24 -2
  55. package/dist/client/components/newRecordModel.js +47 -4
  56. package/dist/client/components/pageContext.d.ts +2 -0
  57. package/dist/client/components/pageModel.d.ts +2 -0
  58. package/dist/client/components/sidebarModel.js +7 -3
  59. package/dist/client/composedReads.js +3 -1
  60. package/dist/client/copy/lists/components/AppList.d.ts +1 -0
  61. package/dist/client/copy/lists/components/AppList.js +1 -0
  62. package/dist/client/copy/lists/components/LayoutSwitch.d.ts +4 -0
  63. package/dist/client/copy/lists/components/LayoutSwitch.js +6 -0
  64. package/dist/client/copy/record/components/JsonView.d.ts +22 -0
  65. package/dist/client/copy/record/components/JsonView.js +19 -0
  66. package/dist/client/copy/record/components/PageHead.d.ts +1 -0
  67. package/dist/client/copy/record/components/PageHead.js +2 -0
  68. package/dist/client/copy/shell/components/Palette.d.ts +11 -0
  69. package/dist/client/copy/shell/components/Palette.js +14 -0
  70. package/dist/client/copy/shell/components/TopNav.d.ts +2 -1
  71. package/dist/client/copy/shell/components/TopNav.js +4 -2
  72. package/dist/client/copy/shell/components/directoryModel.d.ts +4 -0
  73. package/dist/client/copy/shell/components/directoryModel.js +6 -0
  74. package/dist/client/copy/shell/components/sidebarModel.d.ts +1 -0
  75. package/dist/client/copy/shell/components/sidebarModel.js +1 -0
  76. package/dist/client/core.d.ts +3 -3
  77. package/dist/client/core.js +6 -7
  78. package/dist/client/features.css +67 -7
  79. package/dist/client/index.html +2 -1
  80. package/dist/client/insert.js +1 -8
  81. package/dist/client/locale.d.ts +7 -0
  82. package/dist/client/locale.js +0 -0
  83. package/dist/client/lumenLook.css +9 -12
  84. package/dist/client/page.css +56 -15
  85. package/dist/client/palette.d.ts +3 -1
  86. package/dist/client/palette.js +19 -4
  87. package/dist/client/paletteRecents.d.ts +25 -0
  88. package/dist/client/paletteRecents.js +64 -0
  89. package/dist/client/partsLook.css +6 -3
  90. package/dist/client/sageLook.css +5 -3
  91. package/dist/client/shellMode.d.ts +2 -0
  92. package/dist/client/shellMode.js +1 -0
  93. package/dist/client/structure.css +201 -1
  94. package/dist/client/style.css +59 -10
  95. package/dist/client/themeFamilies.css +37 -0
  96. package/dist/client/visualThemes.css +12 -0
  97. package/dist/client/workbenchLook.css +415 -0
  98. package/dist/client/workshopLook.css +48 -25
  99. package/package.json +4 -3
@@ -21,5 +21,5 @@ export function JsonPreview({ value, name, type }) {
21
21
  return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "json-preview", "data-cell-opens": "", tabIndex: -1, "aria-haspopup": "dialog", title: say('openName', { name }), onClick: (e) => {
22
22
  e.stopPropagation();
23
23
  setOpen(true);
24
- }, children: previewOf(value) }), open && here && (_jsxs(Modal, { ref: modal, className: "confirm json-overlay", ariaLabel: `${name} (JSON)`, onClose: () => setOpen(false), children: [_jsxs("header", { className: "json-overlay-head", children: [_jsx("h2", { children: name }), type && _jsx("span", { className: "json-overlay-type", children: type.toLowerCase() }), _jsx("button", { type: "button", className: "ghost json-overlay-close", onClick: () => modal.current?.close(), children: say('common.close') })] }), _jsx(JsonView, { value: value })] }))] }));
24
+ }, children: previewOf(value) }), open && here && (_jsx(Modal, { ref: modal, className: "confirm json-overlay", ariaLabel: `${name} (JSON)`, onClose: () => setOpen(false), children: _jsx(JsonView, { value: value, label: name, head: _jsxs("header", { className: "json-overlay-title", children: [_jsx("h2", { children: name }), type && _jsx("span", { className: "json-overlay-type", children: type.toLowerCase() })] }), tail: _jsx("button", { type: "button", className: "ghost json-overlay-close", onClick: () => modal.current?.close(), children: say('common.close') }) }) }))] }));
25
25
  }
@@ -1,108 +1,247 @@
1
- /* Imported by features.css: part of the tool's own rules (style.css names the order). */
1
+ /* A JSON document, laid out (components/JsonView.tsx), and the overlay that
2
+ shows one from a grid cell (JsonPreview.tsx). Its own sheet, fetched with
3
+ the viewer, so no first page carries the rules of a part most visits never
4
+ draw; what a first page needs (the cell's line, the field's width) is in
5
+ JsonPreview.css. Every value is a token from style.css, so light, dark and
6
+ an App's theme dress it the same way. In the tool's own layer, as it was
7
+ when features.css took it: a look's rules still come after. */
2
8
  @layer base {
3
- /* A JSON document, laid out (components/JsonView.tsx), its one-line grid
4
- preview and its overlay (JsonPreview.tsx). Every value is a token from
5
- style.css, so light, dark and an App's theme dress it the same way. */
6
9
 
7
- .json-view { min-width: 0; max-width: 70rem; font: var(--text-base)/1.55 var(--sans); color: var(--ink); }
8
- /* A document is a block: in a record's or a page's field grid it takes the
9
- full width, as long text does, rather than being squeezed into a column. */
10
- .field:has(.json-view), .page-field:has(.json-view) { grid-column: 1 / -1; }
10
+ .json-view {
11
+ /* The type tints, shared by the tree and the raw text: each a status ink
12
+ drawn back toward the text's own, so a payload's kinds are told apart at a
13
+ glance and none of them shouts (docs/design.md: bold by type and
14
+ contrast, never by saturation). Mixed toward the ink, never the ground,
15
+ so each keeps at least its status ink's contrast, light and dark. Keys
16
+ and punctuation stay the quiet greys: they are the frame, not the data. */
17
+ --json-key: var(--ink-muted);
18
+ --json-string: color-mix(in srgb, var(--status-good) 64%, var(--ink));
19
+ --json-number: color-mix(in srgb, var(--status-info) 70%, var(--ink));
20
+ --json-literal: color-mix(in srgb, var(--status-warning) 70%, var(--ink));
21
+ --json-null: var(--ink-subtle);
22
+ --json-punct: var(--ink-subtle);
23
+ /* The caret's gutter: every key at a level starts on one line, folding or not. */
24
+ --json-caret: 1.15em;
25
+ min-width: 0; max-width: 70rem; font: var(--text-base)/1.55 var(--sans); color: var(--ink);
26
+ }
27
+
28
+ /* ---------- the bar ---------- */
11
29
 
12
- .json-bar { display: flex; justify-content: flex-end; gap: var(--space-2); margin-bottom: var(--space-1); }
30
+ .json-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-3); }
31
+ .json-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-left: auto; }
13
32
  .json-tool {
14
- background: transparent; color: var(--ink-muted); border: 1px solid transparent;
15
- padding: 1px var(--space-3); font-size: var(--text-sm); line-height: 1.6;
33
+ background: transparent; color: var(--ink-muted); border: 1px solid transparent; border-radius: var(--radius);
34
+ padding: var(--space-1) var(--space-3); font-size: var(--text-sm); line-height: 1.6;
16
35
  }
17
- .json-tool:hover { color: var(--ink); background: var(--raised); }
18
36
  .json-tool[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); }
37
+ /* Tree | Raw: a segmented pair, the chosen one filled, as a list's Records | Table is. */
38
+ .json-modes { display: inline-flex; gap: var(--space-1); padding: var(--space-1); border: 1px solid var(--line); border-radius: var(--radius); }
39
+ .json-mode {
40
+ background: transparent; color: var(--ink-muted); border: 0; border-radius: var(--radius);
41
+ padding: 0 var(--space-3); font-size: var(--text-sm); line-height: 1.6;
42
+ }
43
+ .json-mode[aria-pressed="true"] { background: var(--raised); color: var(--ink); }
44
+
45
+ .json-filter { display: flex; align-items: center; gap: var(--space-3); flex: 1 1 14rem; max-width: 24rem; min-width: 0; }
46
+ .json-filter-input {
47
+ flex: 1; min-width: 0; padding: var(--space-1h) var(--space-3);
48
+ border: 1px solid var(--line-control); border-radius: var(--radius); background: var(--field-fill); color: var(--ink);
49
+ font: var(--text-sm)/1.5 var(--sans);
50
+ }
51
+ .json-filter-input::placeholder { color: var(--ink-subtle); }
52
+ .json-filter-input:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: -1px; border-color: transparent; }
53
+ .json-count { flex: none; color: var(--ink-subtle); font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
54
+
55
+ /* ---------- the tree ---------- */
19
56
 
20
- /* Labels beside values. The label column is as wide as its longest key up to
21
- a cap, so a short document is not stretched across the room and a long key
22
- wraps rather than pushing its value off the edge. */
23
- .json-fields {
24
- display: grid; grid-template-columns: fit-content(14rem) minmax(0, 1fr);
25
- gap: var(--space-2) var(--space-5); margin: 0;
57
+ /* Labels beside values. The caret has a gutter of its own, so keys line up
58
+ whether they fold or not; the label column is as wide as its longest key up
59
+ to a cap, so a short document is not stretched across the room and a long
60
+ key wraps rather than pushing its value off the edge. Each node is a row
61
+ of the one grid (subgrid), so a row can be hovered, focused and ringed as
62
+ one line while every key at its level still shares a column. The value
63
+ column is as wide as its widest value and no wider, so a line's band and
64
+ its copies end near what it says, not at the far side of the room. The
65
+ copies have a column of their own past the widest value, held while they
66
+ are hidden, so a short value is never under them. */
67
+ .json-fields { display: grid; grid-template-columns: var(--json-caret) fit-content(14rem) minmax(0, max-content) max-content; justify-content: start; row-gap: var(--space-2); }
68
+ .json-entry { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; row-gap: var(--space-2); min-width: 0; }
69
+ .json-row {
70
+ grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline;
71
+ position: relative; border-radius: min(3px, var(--radius));
72
+ }
73
+ .json-caret { color: var(--ink-subtle); font-size: var(--text-xs); text-align: center; user-select: none; }
74
+ .json-row .json-caret { grid-column: 1; }
75
+ .json-key {
76
+ grid-column: 2; padding-right: var(--space-5);
77
+ color: var(--json-key); font: var(--text-sm)/1.65 var(--code); overflow-wrap: anywhere;
26
78
  }
27
- .json-field { display: contents; }
28
- .json-key { color: var(--ink-muted); font: var(--text-sm)/1.65 var(--code); overflow-wrap: anywhere; }
29
79
  .json-index { color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
30
- .json-fields dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
31
- /* A nested object is indented under its count by a hairline, not boxed:
32
- one box, hairlines inside. */
33
- .json-group { margin: var(--space-1) 0 var(--space-2h); padding-left: var(--space-4); border-left: 1px solid var(--line); }
80
+ .json-value { grid-column: 3; min-width: 0; overflow-wrap: anywhere; }
81
+ .is-fold > .json-caret, .is-fold > .json-key, .json-summary, .json-fold-row > .json-caret { cursor: pointer; }
82
+ /* A nested level is indented under its count by a hairline, not boxed: one
83
+ box, hairlines inside, and the hairline is the guide that says which level
84
+ a line is on. */
85
+ .json-group { grid-column: 3 / -1; min-width: 0; margin-bottom: var(--space-2); padding-left: var(--space-3); border-left: 1px solid var(--line); }
86
+ /* On a phone the value column is a third of the screen: a level indents under its key instead, the value column
87
+ takes the rest of the line, and a key never takes more than two fifths of it. Size containment keeps a nested
88
+ level (a wide table, say) out of the sizing of the keys it sits under; it fills the width they leave and scrolls
89
+ inside itself past that. */
90
+ @media (max-width: 600px) {
91
+ .json-fields { grid-template-columns: var(--json-caret) fit-content(40%) minmax(0, 1fr); }
92
+ .json-group { grid-column: 2 / -1; contain: inline-size; }
93
+ }
94
+ .json-summary { color: var(--ink-muted); font: var(--text-sm)/1.65 var(--code); }
95
+
96
+ /* The node the keyboard is on, and the one under the pointer: a tint across the line, and the house ring for the keyboard. */
97
+ .json-entry:focus, .json-fold:focus, .json-tr:focus, .json-chip:focus, .json-item:focus { outline: none; }
98
+ .json-entry:focus > .json-row, .json-fold:focus > .json-fold-row, .json-tr:focus > td, .json-item:focus { background: var(--raised); }
99
+ .json-entry:focus-visible > .json-row, .json-fold:focus-visible > .json-fold-row, .json-chip:focus-visible, .json-item:focus-visible {
100
+ outline: var(--focus-width) solid var(--focus); outline-offset: 1px;
101
+ }
102
+ .json-tr:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: -1px; }
103
+
104
+ .json-fold { min-width: 0; }
105
+ .json-fold-row { display: flex; align-items: baseline; position: relative; border-radius: min(3px, var(--radius)); }
106
+ .json-fold-row > .json-caret { flex: none; width: var(--json-caret); }
107
+ .json-fold > .json-group { margin-left: calc(var(--json-caret) / 2); }
108
+
109
+ /* A node's copies: hidden, not dimmed, until its line is hovered or it is the
110
+ node the keyboard is on (docs/design.md: a row's own menu). A field's sit in
111
+ its own column; elsewhere, and on a phone where that column would cost a
112
+ third of the line, they sit over the end of the line on its own tint. Either
113
+ way showing them moves nothing. */
114
+ .json-actions {
115
+ position: absolute; top: 0; bottom: 0; right: 0; z-index: 1;
116
+ display: flex; align-items: flex-start; gap: var(--space-1); padding-left: var(--space-3);
117
+ background: var(--raised); border-radius: min(3px, var(--radius)); visibility: hidden;
118
+ }
119
+ /* Shorter than 24px, so the line's band holds them; the pair sits apart, and only one line's pair shows at a time
120
+ (WCAG 2.5.8's spacing). */
121
+ .json-row > .json-actions { position: static; grid-column: 4; align-self: start; }
122
+ @media (max-width: 600px) { .json-row > .json-actions { position: absolute; } }
123
+ .json-act {
124
+ padding: var(--space-1) var(--space-2h); border: 0; border-radius: min(3px, var(--radius));
125
+ background: transparent; color: var(--link); font: var(--text-xs)/1.4 var(--sans); white-space: nowrap; cursor: pointer;
126
+ }
127
+ .json-act:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: -1px; }
128
+ .json-entry:focus > .json-row > .json-actions,
129
+ .json-fold:focus > .json-fold-row > .json-actions,
130
+ .json-tr:focus > .json-act-cell > .json-actions,
131
+ .json-chip:focus > .json-actions,
132
+ .json-item:focus > .json-actions,
133
+ .json-actions:focus-within { visibility: visible; }
134
+ @media (hover: hover) and (pointer: fine) {
135
+ .json-row:hover, .json-fold-row:hover, .json-tr:hover > td, .json-item:hover { background: var(--raised); }
136
+ .json-row:hover > .json-actions,
137
+ .json-fold-row:hover > .json-actions,
138
+ .json-tr:hover > .json-act-cell > .json-actions,
139
+ .json-chip:hover > .json-actions,
140
+ .json-item:hover > .json-actions { visibility: visible; }
141
+ .json-tool:hover, .json-mode:hover { color: var(--ink); }
142
+ .json-tool:not([aria-pressed="true"]):hover { background: var(--raised); }
143
+ .json-act:hover { background: var(--accent-soft); }
144
+ .json-fold-row:hover > .json-summary, .is-fold:hover > .json-key { color: var(--ink); }
145
+ .json-more:hover { text-decoration: underline; }
146
+ }
34
147
 
35
- .json-fold, .json-more {
36
- background: none; border: 0; padding: 0; border-radius: min(3px, var(--radius));
37
- font: var(--text-sm)/1.65 var(--sans); cursor: pointer;
148
+ .json-more {
149
+ display: block; margin-top: var(--space-2); padding: 0; border: 0; border-radius: min(3px, var(--radius)); background: none;
150
+ color: var(--link); font: var(--text-sm)/1.65 var(--sans); cursor: pointer;
38
151
  }
39
- .json-fold { color: var(--ink-muted); }
40
- .json-fold:hover { color: var(--ink); }
41
- .json-caret { display: inline-block; width: 1.1em; color: var(--ink-subtle); }
42
- .json-more { display: block; margin-top: var(--space-2); color: var(--link); }
43
- .json-more:hover { text-decoration: underline; }
44
152
 
45
153
  /* Like records, lined up. Wide ones scroll inside themselves; the page never does. */
46
154
  .json-table-wrap { overflow-x: auto; max-width: 100%; }
47
155
  .json-table { border-collapse: collapse; font-size: var(--text-sm); }
48
156
  .json-table th {
49
- text-align: left; font: var(--text-xs)/1.5 var(--code); font-weight: normal; color: var(--ink-muted);
157
+ text-align: left; font: var(--text-xs)/1.5 var(--code); font-weight: normal; color: var(--json-key);
50
158
  padding: var(--space-1h) var(--space-4h) var(--space-1h) 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
51
159
  }
52
160
  .json-table td {
53
161
  padding: var(--space-2) var(--space-4h) var(--space-2) 0; border-bottom: 1px solid var(--line);
54
162
  vertical-align: top; max-width: 24rem; overflow-wrap: anywhere;
55
163
  }
164
+ .json-table :is(th, td).json-figures { text-align: right; }
165
+ /* The row's copies hang from a column of no width at its end, over the row's last cells. */
166
+ .json-table :is(th, td).json-act-cell { position: relative; width: 0; padding: 0; }
167
+ .json-act-cell > .json-actions { top: var(--space-1); bottom: auto; }
56
168
 
57
169
  .json-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
58
170
  .json-chip {
59
- border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised);
171
+ position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised);
60
172
  padding: 0 var(--space-3); font-size: var(--text-sm); line-height: 1.65;
61
173
  }
174
+ /* A chip is too short to cover: its copies drop below it, a popover's box. */
175
+ .json-chip > .json-actions {
176
+ top: calc(100% + var(--space-1)); bottom: auto; left: 0; right: auto; padding: var(--space-1);
177
+ background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop);
178
+ }
62
179
  .json-lines { margin: 0; padding-left: 2em; }
180
+ .json-item { position: relative; border-radius: min(3px, var(--radius)); }
63
181
  .json-lines li::marker { color: var(--ink-subtle); font: var(--text-xs) var(--code); }
64
182
 
65
- .json-number, .json-date { font-variant-numeric: tabular-nums; }
66
- .json-table :is(th, td).json-figures { text-align: right; }
67
- .json-number { font-family: var(--mono); }
68
- .json-null, .json-empty { color: var(--ink-subtle); }
69
- .json-empty { font-family: var(--code); }
70
- .json-bool {
71
- display: inline-block; padding: 0 var(--space-3); border-radius: 999px;
72
- font-size: var(--text-xs); line-height: 1.65; background: var(--raised); color: var(--ink-muted);
73
- }
74
- .json-bool.yes { background: var(--accent-soft); color: var(--accent-ink); }
183
+ /* ---------- values, by type ---------- */
184
+
185
+ .json-text { color: var(--json-string); }
186
+ /* Prose is read, not scanned: a paragraph stays in the text's own ink. */
187
+ .json-long { display: block; white-space: pre-wrap; color: var(--ink); }
188
+ .json-code { font: var(--text-sm) var(--code); }
189
+ .json-number { color: var(--json-number); font-family: var(--mono); font-variant-numeric: tabular-nums; }
190
+ .json-date { font-variant-numeric: tabular-nums; }
191
+ .json-bool { color: var(--json-literal); font: var(--text-sm) var(--code); }
192
+ .json-null { color: var(--json-null); font: var(--text-sm) var(--code); }
193
+ .json-empty { color: var(--ink-subtle); font-family: var(--code); }
75
194
  .json-link { color: var(--link); overflow-wrap: anywhere; }
76
- .json-long { display: block; white-space: pre-wrap; }
195
+ /* A hex color carries a swatch of itself, edged so white on white and black on black still show. */
196
+ .json-swatch {
197
+ display: inline-block; width: 0.8em; height: 0.8em; margin-right: var(--space-2); vertical-align: -0.05em;
198
+ border: 1px solid var(--line-strong); border-radius: min(2px, var(--radius));
199
+ }
200
+ /* A match: the warm hue a change from elsewhere is said in (--changed-hue), lightly, under the text's own ink. */
201
+ .json-mark { background: color-mix(in srgb, var(--changed-hue) 32%, transparent); color: inherit; border-radius: min(2px, var(--radius)); }
202
+
203
+ /* ---------- raw ---------- */
77
204
 
78
205
  .json-raw {
79
206
  margin: 0; padding: var(--space-3) var(--space-3h); max-height: 24rem; overflow: auto;
80
- font: var(--text-sm)/1.55 var(--code); white-space: pre; tab-size: 2;
207
+ font: var(--text-sm)/1.55 var(--code); white-space: pre; tab-size: 2; color: var(--ink);
81
208
  background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius);
82
209
  }
210
+ .json-raw.is-wrapped { white-space: pre-wrap; overflow-wrap: anywhere; }
83
211
  .json-raw:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: -1px; }
84
-
85
- /* In a grid cell: the shape in one quiet line, the whole cell a button. */
86
- .json-preview {
87
- display: block; width: 100%; padding: 0; border: 0; border-radius: 0; background: none;
88
- text-align: left; font: var(--text-sm)/inherit var(--code); color: var(--ink-muted);
89
- white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
212
+ /* Each line's number in a gutter as wide as the last one's: generated
213
+ content, so a selection and a copy never take it. */
214
+ .json-line { display: block; position: relative; padding-left: calc((var(--json-digits, 2) + 2) * 1ch); }
215
+ .json-line::before {
216
+ content: attr(data-n); position: absolute; left: 0; width: calc(var(--json-digits, 2) * 1ch);
217
+ text-align: right; color: var(--ink-subtle); opacity: 0.85; user-select: none;
90
218
  }
91
- .json-preview:hover { color: var(--link); }
92
- .json-preview:focus-visible { outline-offset: -2px; }
93
- .json-preview-text { font: var(--text-sm) var(--code); color: var(--ink-muted); }
219
+ /* In the text, the keys are its frame: the ink, with the punctuation receding behind them. */
220
+ .json-t-key { color: var(--ink); }
221
+ .json-t-string { color: var(--json-string); }
222
+ .json-t-number { color: var(--json-number); }
223
+ .json-t-boolean { color: var(--json-literal); }
224
+ .json-t-null, .json-t-punct { color: var(--json-null); }
225
+
226
+ /* ---------- the overlay ---------- */
94
227
 
95
- /* The overlay is the confirm dialog's box and scrim, at a document's width. */
96
- .json-overlay { width: min(60rem, calc(100vw - 2rem)); max-width: none; max-height: 85vh; }
228
+ /* The confirm dialog's box and scrim, at a document's width; its bar is the
229
+ dialog's head (the title, the filter, the tools, Close) and stays put while
230
+ a long document scrolls under it. */
231
+ .json-overlay { width: min(72rem, calc(100vw - 2rem)); max-width: none; max-height: 85vh; overflow: auto; padding-top: 0; }
97
232
  .json-overlay .json-view { max-width: none; }
98
- .json-overlay .json-raw { max-height: 60vh; }
99
- .json-overlay-head { display: flex; align-items: baseline; gap: var(--space-3h); margin-bottom: var(--space-3h); }
100
- .json-overlay-head h2 { margin: 0; font: 600 calc(15px * var(--type-k))/1.4 var(--sans); overflow-wrap: anywhere; }
233
+ .json-overlay .json-bar {
234
+ position: sticky; top: 0; z-index: 2; margin-bottom: var(--space-3h);
235
+ padding: var(--space-5) 0 var(--space-3); background: var(--surface); border-bottom: 1px solid var(--line);
236
+ }
237
+ .json-overlay .json-raw { max-height: none; }
238
+ .json-overlay-title { display: flex; align-items: baseline; gap: var(--space-3h); min-width: 0; }
239
+ .json-overlay-title h2 { margin: 0; font: 600 calc(15px * var(--type-k))/1.4 var(--sans); overflow-wrap: anywhere; }
101
240
  .json-overlay-type { color: var(--ink-subtle); font: var(--text-xs) var(--code); }
102
- .json-overlay-close { margin-left: auto; padding: var(--space-1h) var(--space-3h); font-size: var(--text-sm); }
241
+ .json-overlay-close { padding: var(--space-1h) var(--space-3h); font-size: var(--text-sm); }
103
242
 
104
243
  @media (prefers-reduced-motion: no-preference) {
105
- .json-tool, .json-fold, .json-preview {
244
+ .json-tool, .json-mode, .json-act, .json-row, .json-fold-row {
106
245
  transition: color var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out);
107
246
  }
108
247
  }
@@ -1,4 +1,46 @@
1
- export declare function JsonView({ value, bar }: {
1
+ /**
2
+ * A JSON document, laid out by its shape.
3
+ *
4
+ * jsonModel.ts decides what each part is best shown as; this draws it: an
5
+ * object as quiet labels beside their values, like records as a table,
6
+ * words as chips. Two levels open and deeper ones folded behind a count,
7
+ * long arrays a page at a time — so a document of any size reads top-down
8
+ * instead of as one line of braces. Raw is the text itself, pretty-printed
9
+ * and tinted, for the reader who wants the braces; Copy takes that text.
10
+ *
11
+ * What a developer's viewer gives, it gives too, without giving up the
12
+ * layout: a filter over keys and values that marks each match and opens
13
+ * whatever holds one; Expand all and Collapse all; each node's value and
14
+ * path (`data.lines[2].sku`) a click or a key away; values tinted by type,
15
+ * quietly, from the tokens (a hex color with its swatch, an id in the code
16
+ * face).
17
+ *
18
+ * The keyboard's tree pattern (APG), as TreeList.tsx has it: the document is
19
+ * one `role="tree"` and one Tab stop, the node last visited. Up and Down move
20
+ * through what is open, Right opens a node or steps into it, Left folds it or
21
+ * steps out to its parent, Home and End go to the ends, Enter and Space fold.
22
+ * Every key, value, row and item is a `treeitem` with its level, its place
23
+ * among its siblings and, when it holds something, `aria-expanded`; its name
24
+ * is said for it (`city: London`), so a folded branch is never read out
25
+ * whole. The tree rather than the description list and table it draws:
26
+ * those name a pair or a cell, but not where it is, whether it opens, or
27
+ * how to get back out — and a reader moving by key needs all three. A table
28
+ * row's name carries its column names, so nothing the header said is lost.
29
+ * The current node's own controls (Copy value, Copy path, a link) are the
30
+ * Tab stops after it; every other node's wait until it is current.
31
+ *
32
+ * Read-only on purpose: a document is changed by the statement that owns
33
+ * it, not by a box pretending a tree is a line of text.
34
+ */
35
+ import './JsonView.css';
36
+ import { type ReactNode } from 'react';
37
+ export declare function JsonView({ value, bar, label, head, tail, }: {
2
38
  value: object;
39
+ /** False for a list of plain values (Value.tsx): its words with neither the bar nor a node's copies over them. */
3
40
  bar?: boolean;
41
+ /** The tree's name: the field's or the column's, where there is one. */
42
+ label?: string;
43
+ /** Drawn at the start of the bar, and at its end: the overlay's title and its Close. */
44
+ head?: ReactNode;
45
+ tail?: ReactNode;
4
46
  }): import("react").JSX.Element;