@whity/ui 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -3
- package/package.json +192 -6
- package/src/access-denied.stories.tsx +179 -0
- package/src/access-denied.tsx +305 -0
- package/src/action-proposal.tsx +302 -0
- package/src/actor-chip.tsx +71 -0
- package/src/agent-activity.tsx +163 -0
- package/src/agent-collaboration.stories.tsx +156 -0
- package/src/agent-run-status.tsx +196 -0
- package/src/alert-dialog.stories.tsx +45 -0
- package/src/alert-dialog.tsx +147 -0
- package/src/alert.stories.tsx +91 -0
- package/src/alert.tsx +89 -0
- package/src/app-sidebar.stories.tsx +195 -0
- package/src/app-sidebar.tsx +500 -0
- package/src/approval-queue.tsx +108 -0
- package/src/audience-group-picker.stories.tsx +198 -0
- package/src/audience-group-picker.tsx +362 -0
- package/src/audience-people-picker.stories.tsx +102 -0
- package/src/audience-people-picker.tsx +279 -0
- package/src/avatar.tsx +83 -0
- package/src/badge.stories.tsx +105 -0
- package/src/badge.tsx +68 -0
- package/src/beta-warning.stories.tsx +79 -0
- package/src/beta-warning.tsx +189 -0
- package/src/bilingual-input.stories.tsx +82 -0
- package/src/bilingual-input.tsx +183 -0
- package/src/breadcrumb.stories.tsx +51 -0
- package/src/breadcrumb.tsx +90 -0
- package/src/button.stories.tsx +87 -0
- package/src/button.tsx +118 -0
- package/src/card.stories.tsx +423 -0
- package/src/card.tsx +180 -0
- package/src/chart.stories.tsx +66 -0
- package/src/chart.tsx +228 -0
- package/src/checkbox.stories.tsx +62 -0
- package/src/checkbox.tsx +54 -0
- package/src/collapsible.stories.tsx +48 -0
- package/src/collapsible.tsx +34 -0
- package/src/color-card.stories.tsx +61 -0
- package/src/color-card.tsx +270 -0
- package/src/color-picker.stories.tsx +65 -0
- package/src/color-picker.tsx +425 -0
- package/src/command-palette.tsx +306 -0
- package/src/copy-block.stories.tsx +38 -0
- package/src/copy-block.tsx +85 -0
- package/src/data-table.stories.tsx +200 -0
- package/src/data-table.tsx +1106 -0
- package/src/date-picker.stories.tsx +61 -0
- package/src/date-picker.tsx +422 -0
- package/src/design-cards.stories.tsx +458 -0
- package/src/dialog.stories.tsx +48 -0
- package/src/dialog.tsx +166 -0
- package/src/documents/barcode-svg.stories.tsx +72 -0
- package/src/documents/barcode-svg.tsx +79 -0
- package/src/dropdown-menu.stories.tsx +77 -0
- package/src/dropdown-menu.tsx +271 -0
- package/src/editor/behaviour.ts +279 -0
- package/src/editor/block-ids.ts +44 -0
- package/src/editor/block-list.tsx +101 -0
- package/src/editor/block-toolbar.tsx +477 -0
- package/src/editor/bubble.tsx +93 -0
- package/src/editor/catalogue.ts +103 -0
- package/src/editor/collab-rail.tsx +746 -0
- package/src/editor/collab.stories.tsx +207 -0
- package/src/editor/collab.ts +87 -0
- package/src/editor/contract.ts +408 -0
- package/src/editor/convert.ts +362 -0
- package/src/editor/doc-editor.stories.tsx +98 -0
- package/src/editor/doc-editor.tsx +1287 -0
- package/src/editor/editor.css +536 -0
- package/src/editor/extensions.ts +86 -0
- package/src/editor/field-picker.tsx +107 -0
- package/src/editor/fields.ts +100 -0
- package/src/editor/gutter.tsx +367 -0
- package/src/editor/index.ts +22 -0
- package/src/editor/label-sheet.tsx +289 -0
- package/src/editor/labels.ts +310 -0
- package/src/editor/link-tools.tsx +141 -0
- package/src/editor/node-views.tsx +450 -0
- package/src/editor/page-view.tsx +353 -0
- package/src/editor/publish-check.tsx +182 -0
- package/src/editor/rich-blocks.stories.tsx +146 -0
- package/src/editor/sample.ts +40 -0
- package/src/editor/schema-rich.ts +150 -0
- package/src/editor/schema.ts +315 -0
- package/src/editor/services.tsx +127 -0
- package/src/editor/slash.ts +64 -0
- package/src/editor/suggesting.ts +372 -0
- package/src/editor/suggestions.ts +763 -0
- package/src/editor/table-keys.ts +66 -0
- package/src/editor/templates.stories.tsx +324 -0
- package/src/editor/toolbar.tsx +358 -0
- package/src/empty-state.stories.tsx +51 -0
- package/src/empty-state.tsx +100 -0
- package/src/empty-state.usage-notes.md +30 -0
- package/src/form.stories.tsx +112 -0
- package/src/form.tsx +176 -0
- package/src/globals.css +20 -0
- package/src/icon-button.tsx +85 -0
- package/src/icon-map.ts +244 -0
- package/src/icon.tsx +41 -0
- package/src/index.ts +67 -0
- package/src/input.stories.tsx +157 -0
- package/src/input.tsx +759 -0
- package/src/locked-screen.stories.tsx +29 -0
- package/src/locked-screen.tsx +61 -0
- package/src/mark.tsx +62 -0
- package/src/math-text.stories.tsx +33 -0
- package/src/math-text.tsx +43 -0
- package/src/menu-bar.stories.tsx +198 -0
- package/src/menu-bar.tsx +373 -0
- package/src/money/currency.ts +230 -0
- package/src/page-header.stories.tsx +95 -0
- package/src/page-header.tsx +122 -0
- package/src/page-shell.stories.tsx +42 -0
- package/src/page-shell.tsx +32 -0
- package/src/pagination.stories.tsx +45 -0
- package/src/pagination.tsx +98 -0
- package/src/plugin-card.stories.tsx +180 -0
- package/src/plugin-card.tsx +848 -0
- package/src/popover.stories.tsx +48 -0
- package/src/popover.tsx +55 -0
- package/src/radio-group.stories.tsx +26 -0
- package/src/radio-group.tsx +44 -0
- package/src/route-flow/editor.tsx +1014 -0
- package/src/route-flow/model.ts +716 -0
- package/src/scope-grant.tsx +139 -0
- package/src/screen-too-small.stories.tsx +61 -0
- package/src/screen-too-small.tsx +104 -0
- package/src/select.stories.tsx +44 -0
- package/src/select.tsx +197 -0
- package/src/separator.stories.tsx +34 -0
- package/src/separator.tsx +34 -0
- package/src/sheet.stories.tsx +49 -0
- package/src/sheet.tsx +168 -0
- package/src/skeleton.stories.tsx +28 -0
- package/src/skeleton.tsx +19 -0
- package/src/slider.stories.tsx +78 -0
- package/src/slider.tsx +300 -0
- package/src/spinner.stories.tsx +33 -0
- package/src/spinner.tsx +55 -0
- package/src/switch.stories.tsx +42 -0
- package/src/switch.tsx +41 -0
- package/src/switcher.stories.tsx +111 -0
- package/src/switcher.tsx +131 -0
- package/src/table.stories.tsx +48 -0
- package/src/table.tsx +121 -0
- package/src/tabs.stories.tsx +74 -0
- package/src/tabs.tsx +90 -0
- package/src/tag-input.stories.tsx +67 -0
- package/src/tag-input.tsx +117 -0
- package/src/tenant-logo.tsx +63 -0
- package/src/tenant-switcher.stories.tsx +38 -0
- package/src/tenant-switcher.tsx +164 -0
- package/src/textarea.stories.tsx +27 -0
- package/src/textarea.tsx +18 -0
- package/src/theme-mode.ts +52 -0
- package/src/time-picker.stories.tsx +62 -0
- package/src/time-picker.tsx +615 -0
- package/src/toggle-group.tsx +138 -0
- package/src/tooltip.stories.tsx +43 -0
- package/src/tooltip.tsx +73 -0
- package/src/top-nav.stories.tsx +58 -0
- package/src/top-nav.tsx +324 -0
- package/src/undo-bar.tsx +107 -0
- package/src/utils.ts +45 -0
- package/src/view-toggle.stories.tsx +84 -0
- package/src/view-toggle.tsx +110 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The document editor's content styles (docs/design/components/Editor*,
|
|
3
|
+
* bundle.css `.wy-blk`). Tokens only, sizes included (--doc-text-*, from the
|
|
4
|
+
* `document` group in base.json). The sheet's text is 16px at line height
|
|
5
|
+
* 1.5 (Arabic 1.7); headings are Noto Sans 600 at 24, 20 and 18px (E.33);
|
|
6
|
+
* bold is 600 (3.6); one highlight colour, the sky series at 40% (E.25).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
.wy-doc {
|
|
10
|
+
font-family: var(--font-sans);
|
|
11
|
+
font-size: var(--doc-text-sheet-body);
|
|
12
|
+
line-height: var(--doc-leading-body);
|
|
13
|
+
color: var(--foreground);
|
|
14
|
+
outline: none;
|
|
15
|
+
overflow-wrap: break-word;
|
|
16
|
+
}
|
|
17
|
+
.wy-doc:lang(ar),
|
|
18
|
+
[dir="rtl"] .wy-doc {
|
|
19
|
+
font-family: var(--font-arabic);
|
|
20
|
+
line-height: var(--doc-leading-body-arabic);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.wy-doc > * {
|
|
24
|
+
position: relative;
|
|
25
|
+
margin: 0;
|
|
26
|
+
padding-block: 3px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.wy-doc p,
|
|
30
|
+
.wy-doc h2,
|
|
31
|
+
.wy-doc h3,
|
|
32
|
+
.wy-doc h4 {
|
|
33
|
+
unicode-bidi: plaintext; /* each block follows its own text's direction */
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.wy-doc h2 { padding-top: 24px; font-size: var(--doc-text-sheet-h1); font-weight: 600; line-height: var(--doc-leading-h1); }
|
|
37
|
+
.wy-doc h3 { padding-top: 18px; font-size: var(--doc-text-sheet-h2); font-weight: 600; line-height: var(--doc-leading-h2); }
|
|
38
|
+
.wy-doc h4 { padding-top: 12px; font-size: var(--doc-text-sheet-h3); font-weight: 600; line-height: var(--doc-leading-h3); }
|
|
39
|
+
|
|
40
|
+
.wy-doc blockquote {
|
|
41
|
+
border-inline-start: 3px solid var(--foreground);
|
|
42
|
+
padding-inline-start: 14px;
|
|
43
|
+
margin-block: 3px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.wy-doc pre {
|
|
47
|
+
margin-block: 3px;
|
|
48
|
+
padding: 12px 14px;
|
|
49
|
+
border-radius: var(--radius-control-lg);
|
|
50
|
+
background: var(--muted);
|
|
51
|
+
font-family: var(--font-mono);
|
|
52
|
+
font-size: 0.8125rem;
|
|
53
|
+
line-height: 1.6;
|
|
54
|
+
overflow-x: auto;
|
|
55
|
+
white-space: pre;
|
|
56
|
+
direction: ltr;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Flat list items: the marker is a decoration (behaviour.ts `listMarkers`). */
|
|
60
|
+
.wy-doc [data-type="list-item"] {
|
|
61
|
+
display: flex;
|
|
62
|
+
gap: 8px;
|
|
63
|
+
padding-inline-start: 4px;
|
|
64
|
+
}
|
|
65
|
+
.wy-doc [data-type="list-item"]::before {
|
|
66
|
+
content: attr(data-marker);
|
|
67
|
+
flex: none;
|
|
68
|
+
min-width: 18px;
|
|
69
|
+
color: var(--muted-foreground);
|
|
70
|
+
font-variant-numeric: tabular-nums;
|
|
71
|
+
text-align: end;
|
|
72
|
+
}
|
|
73
|
+
.wy-doc [data-type="list-item"][data-level="1"],
|
|
74
|
+
.wy-doc [data-type="check-item"][data-level="1"] { padding-inline-start: 28px; }
|
|
75
|
+
.wy-doc [data-type="list-item"][data-level="2"],
|
|
76
|
+
.wy-doc [data-type="check-item"][data-level="2"] { padding-inline-start: 52px; }
|
|
77
|
+
|
|
78
|
+
.wy-doc [data-type="check-item"] {
|
|
79
|
+
display: flex;
|
|
80
|
+
gap: 10px;
|
|
81
|
+
align-items: flex-start;
|
|
82
|
+
}
|
|
83
|
+
.wy-doc .wy-check {
|
|
84
|
+
flex: none;
|
|
85
|
+
width: 16px;
|
|
86
|
+
height: 16px;
|
|
87
|
+
margin-top: 4px;
|
|
88
|
+
padding: 0;
|
|
89
|
+
border: 1.5px solid var(--input);
|
|
90
|
+
border-radius: 4px;
|
|
91
|
+
background: var(--card);
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
display: grid;
|
|
94
|
+
place-items: center;
|
|
95
|
+
}
|
|
96
|
+
.wy-doc .wy-check:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
97
|
+
.wy-doc [data-checked="true"] > .wy-check {
|
|
98
|
+
background: var(--primary);
|
|
99
|
+
border-color: var(--primary);
|
|
100
|
+
}
|
|
101
|
+
.wy-doc [data-checked="true"] > .wy-check::after {
|
|
102
|
+
content: "";
|
|
103
|
+
width: 8px;
|
|
104
|
+
height: 4px;
|
|
105
|
+
margin-top: -2px;
|
|
106
|
+
border-inline-start: 2px solid var(--primary-foreground);
|
|
107
|
+
border-bottom: 2px solid var(--primary-foreground);
|
|
108
|
+
rotate: -45deg;
|
|
109
|
+
}
|
|
110
|
+
.wy-doc [data-checked="true"] > .wy-check-text {
|
|
111
|
+
color: var(--muted-foreground);
|
|
112
|
+
text-decoration: line-through;
|
|
113
|
+
}
|
|
114
|
+
.wy-doc .wy-check-text { flex: 1; min-width: 0; }
|
|
115
|
+
|
|
116
|
+
.wy-doc hr {
|
|
117
|
+
border: 0;
|
|
118
|
+
border-top: 1px solid var(--border);
|
|
119
|
+
margin: 12px 0;
|
|
120
|
+
padding: 0;
|
|
121
|
+
}
|
|
122
|
+
.wy-doc hr.ProseMirror-selectednode { outline: 2px solid var(--ring); outline-offset: 4px; }
|
|
123
|
+
|
|
124
|
+
/* A block a later milestone edits: kept whole, shown as a quiet placeholder. */
|
|
125
|
+
.wy-doc [data-type="unknown-block"] {
|
|
126
|
+
margin-block: 3px;
|
|
127
|
+
padding: 10px 12px;
|
|
128
|
+
border: 1px dashed var(--input);
|
|
129
|
+
border-radius: var(--radius-control-lg);
|
|
130
|
+
color: var(--muted-foreground);
|
|
131
|
+
font-size: 0.875rem;
|
|
132
|
+
}
|
|
133
|
+
.wy-doc [data-type="unknown-block"]::before { content: attr(data-label); }
|
|
134
|
+
|
|
135
|
+
/* Inline */
|
|
136
|
+
.wy-doc strong { font-weight: 600; }
|
|
137
|
+
.wy-doc code {
|
|
138
|
+
font-family: var(--font-mono);
|
|
139
|
+
font-size: 0.875em;
|
|
140
|
+
padding: 1px 4px;
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
background: var(--muted);
|
|
143
|
+
}
|
|
144
|
+
.wy-doc pre code { padding: 0; background: none; font-size: inherit; }
|
|
145
|
+
.wy-doc a {
|
|
146
|
+
color: var(--primary);
|
|
147
|
+
text-decoration: underline;
|
|
148
|
+
text-underline-offset: 2px;
|
|
149
|
+
cursor: text;
|
|
150
|
+
}
|
|
151
|
+
.wy-doc mark[data-type="highlight"] {
|
|
152
|
+
color: inherit;
|
|
153
|
+
background: color-mix(in oklab, var(--chart-3) 40%, transparent);
|
|
154
|
+
border-radius: 2px;
|
|
155
|
+
}
|
|
156
|
+
/* E.26: a merge field, a chip with braces on the tint (EditorInline). */
|
|
157
|
+
.wy-mf {
|
|
158
|
+
display: inline-block;
|
|
159
|
+
padding: 0 5px;
|
|
160
|
+
margin: 0 1px;
|
|
161
|
+
border-radius: 4px;
|
|
162
|
+
background: var(--primary-tint);
|
|
163
|
+
color: var(--primary-tint-foreground);
|
|
164
|
+
font-size: 0.9em;
|
|
165
|
+
font-weight: 500;
|
|
166
|
+
line-height: 1.45;
|
|
167
|
+
white-space: nowrap;
|
|
168
|
+
}
|
|
169
|
+
.wy-mf::before { content: "{"; opacity: 0.55; margin-inline-end: 2px; }
|
|
170
|
+
.wy-mf::after { content: "}"; opacity: 0.55; margin-inline-start: 2px; }
|
|
171
|
+
.wy-mf:hover { outline: 1px solid var(--primary); }
|
|
172
|
+
.wy-mf.is-selected, .wy-doc .ProseMirror-selectednode.wy-mf { background: var(--primary); color: var(--primary-foreground); }
|
|
173
|
+
/* E.12: in preview, the record's value with a dotted underline. */
|
|
174
|
+
.wy-mf.is-preview { background: none; color: inherit; font-size: inherit; font-weight: inherit; padding: 0; margin: 0; border-bottom: 1px dotted var(--primary); border-radius: 0; }
|
|
175
|
+
.wy-mf.is-preview:hover { outline: 0; }
|
|
176
|
+
/* E.27: no value for this record. */
|
|
177
|
+
.wy-mf.is-missing { display: inline-flex; align-items: center; gap: 3px; background: var(--error-tint); color: var(--error-text); }
|
|
178
|
+
.wy-mf.is-preview::before, .wy-mf.is-preview::after, .wy-mf.is-missing::before, .wy-mf.is-missing::after { content: none; }
|
|
179
|
+
|
|
180
|
+
/* The field picker ({{ or Field ▾). */
|
|
181
|
+
.wy-fpick__it .wy-mf { pointer-events: none; }
|
|
182
|
+
|
|
183
|
+
/* The focused empty line says what it takes (EditorInsert). */
|
|
184
|
+
.wy-doc p.is-empty::before {
|
|
185
|
+
content: attr(data-placeholder);
|
|
186
|
+
float: inline-start;
|
|
187
|
+
height: 0;
|
|
188
|
+
pointer-events: none;
|
|
189
|
+
color: var(--muted-foreground);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* A whole block selected from the keyboard (Esc) or the gutter: a 2px focus ring. */
|
|
193
|
+
.wy-doc > .ProseMirror-selectednode:not(hr) {
|
|
194
|
+
outline: 2px solid var(--ring);
|
|
195
|
+
outline-offset: 4px;
|
|
196
|
+
border-radius: 4px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* Dragging: the block fades in place while its copy follows the pointer. */
|
|
200
|
+
.wy-doc > .is-dragging { opacity: 0.4; }
|
|
201
|
+
|
|
202
|
+
/* Viewing mode: no caret, no placeholder. */
|
|
203
|
+
.wy-doc[contenteditable="false"] p.is-empty::before { content: none; }
|
|
204
|
+
|
|
205
|
+
/* ---------------------------------------------------- Rich blocks (M3) */
|
|
206
|
+
|
|
207
|
+
.wy-doc .wy-rich { position: relative; margin-block: 3px; }
|
|
208
|
+
.wy-doc .wy-rich.is-selected,
|
|
209
|
+
.wy-doc .ProseMirror-selectednode > .wy-rich { outline: 2px solid var(--ring); outline-offset: 4px; border-radius: 4px; }
|
|
210
|
+
|
|
211
|
+
/* Callout (E.14): Note on the muted grey, Important on the warning tint. */
|
|
212
|
+
.wy-doc [data-type="callout"] {
|
|
213
|
+
display: flex;
|
|
214
|
+
gap: 10px;
|
|
215
|
+
padding: 12px 14px;
|
|
216
|
+
border-radius: var(--radius-control-lg);
|
|
217
|
+
background: var(--muted);
|
|
218
|
+
}
|
|
219
|
+
.wy-doc [data-type="callout"][data-kind="important"] { background: var(--warning-tint); }
|
|
220
|
+
.wy-doc .wy-callout-icon { flex: none; margin-top: 3px; color: var(--muted-foreground); }
|
|
221
|
+
.wy-doc [data-kind="important"] .wy-callout-icon { color: var(--warning-text); }
|
|
222
|
+
.wy-doc .wy-callout-text { flex: 1; min-width: 0; unicode-bidi: plaintext; }
|
|
223
|
+
|
|
224
|
+
/* Toggle: the summary line, and the blocks it hides. */
|
|
225
|
+
.wy-doc [data-type="toggle"] { display: flex; gap: 4px; align-items: flex-start; }
|
|
226
|
+
.wy-doc .wy-toggle-button {
|
|
227
|
+
flex: none; margin-top: 2px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px;
|
|
228
|
+
display: grid; place-items: center; background: none; color: var(--muted-foreground); cursor: pointer;
|
|
229
|
+
transition: rotate var(--dur-fast) var(--ease-out);
|
|
230
|
+
}
|
|
231
|
+
.wy-doc .wy-toggle-button:hover { background: var(--muted); }
|
|
232
|
+
.wy-doc .wy-toggle-button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
233
|
+
.wy-doc [data-type="toggle"][data-open="true"] > .wy-toggle-button { rotate: 90deg; }
|
|
234
|
+
[dir="rtl"] .wy-doc [data-type="toggle"] > .wy-toggle-button { scale: -1 1; }
|
|
235
|
+
[dir="rtl"] .wy-doc [data-type="toggle"][data-open="true"] > .wy-toggle-button { rotate: -90deg; }
|
|
236
|
+
.wy-doc .wy-toggle-content { flex: 1; min-width: 0; }
|
|
237
|
+
.wy-doc .wy-toggle-content > [data-node-view-content-react] > * + *,
|
|
238
|
+
.wy-doc .wy-toggle-content > * + * { padding-inline-start: 0; }
|
|
239
|
+
.wy-doc [data-type="toggle-summary"] { unicode-bidi: plaintext; padding-block: 0; }
|
|
240
|
+
.wy-doc [data-type="toggle"][data-open="false"] [data-type="toggle-summary"] ~ * { display: none; }
|
|
241
|
+
|
|
242
|
+
/* Columns (2). */
|
|
243
|
+
.wy-doc [data-type="columns"] { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
|
|
244
|
+
.wy-doc [data-type="column"] { min-width: 0; min-height: 1.5em; }
|
|
245
|
+
@media (max-width: 640px) { .wy-doc [data-type="columns"] { grid-template-columns: 1fr; gap: 12px; } }
|
|
246
|
+
|
|
247
|
+
/* Table (E.15): a document table, hairlines, numbers end-aligned. */
|
|
248
|
+
.wy-doc table[data-type="table"] { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-block: 3px; }
|
|
249
|
+
.wy-doc table[data-type="table"] td { border: 1px solid var(--border); padding: 6px 10px; vertical-align: top; text-align: start; unicode-bidi: plaintext; }
|
|
250
|
+
.wy-doc table[data-type="table"] td[data-align="end"] { text-align: end; font-variant-numeric: tabular-nums; }
|
|
251
|
+
.wy-doc table[data-type="table"][data-header-row="true"] tr:first-child td { background: var(--muted); font-weight: 500; }
|
|
252
|
+
.wy-doc table[data-type="table"] .selectedCell { background: var(--primary-tint); }
|
|
253
|
+
|
|
254
|
+
/* Page break: a dashed line that prints as a new page. */
|
|
255
|
+
.wy-doc .wy-pagebreak { display: flex; align-items: center; gap: 10px; color: var(--muted-foreground); font-size: 0.75rem; margin: 10px 0; }
|
|
256
|
+
.wy-doc .wy-pagebreak::before, .wy-doc .wy-pagebreak::after { content: ""; flex: 1; border-top: 1px dashed var(--input); }
|
|
257
|
+
|
|
258
|
+
/* Image: half, wide or full width, with a caption. */
|
|
259
|
+
.wy-doc .wy-figure { margin: 0; display: grid; gap: 6px; }
|
|
260
|
+
.wy-doc .wy-figure img { display: block; width: 100%; border-radius: var(--radius-control-lg); border: 1px solid var(--border); }
|
|
261
|
+
.wy-doc [data-type="image"][data-width="half"] .wy-figure { width: 50%; }
|
|
262
|
+
.wy-doc [data-type="image"][data-width="wide"] .wy-figure { margin-inline: -48px; }
|
|
263
|
+
.wy-doc .wy-figure figcaption { font-size: 0.8125rem; color: var(--muted-foreground); text-align: center; }
|
|
264
|
+
|
|
265
|
+
/* File, record and chart sit on a bordered card. */
|
|
266
|
+
.wy-doc .wy-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control-lg); font-size: 0.875rem; }
|
|
267
|
+
.wy-doc .wy-file-meta { flex: 1; min-width: 0; display: grid; gap: 1px; }
|
|
268
|
+
.wy-doc .wy-file-download { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-control-sm); color: var(--foreground); }
|
|
269
|
+
.wy-doc .wy-file-download:hover { background: var(--muted); }
|
|
270
|
+
.wy-doc .wy-tile { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--muted); color: var(--muted-foreground); flex: none; }
|
|
271
|
+
.wy-doc .wy-tile.is-tint { width: 36px; height: 36px; border-radius: 9px; background: var(--primary-tint); color: var(--primary-tint-foreground); }
|
|
272
|
+
.wy-doc .wy-embed { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); font-size: 0.875rem; }
|
|
273
|
+
.wy-doc .wy-embed-head { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted-foreground); }
|
|
274
|
+
.wy-doc .wy-embed-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
|
275
|
+
.wy-doc .wy-embed-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
|
|
276
|
+
|
|
277
|
+
/* Signature and stamp (stage 6). */
|
|
278
|
+
/* Signers and the date share one row, the stamp at its end (EditorBlocks card); narrow sheets wrap. */
|
|
279
|
+
.wy-doc .wy-sign { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-end; padding-top: 28px; font-size: 0.8125rem; color: var(--muted-foreground); }
|
|
280
|
+
.wy-doc .wy-sign-line { flex: 1 1 0; min-width: 120px; border-top: 1px solid var(--foreground); padding-top: 6px; display: grid; gap: 2px; }
|
|
281
|
+
.wy-doc .wy-sign-line b { color: var(--foreground); font-weight: 500; }
|
|
282
|
+
.wy-doc .wy-sign-stamp { flex: none; width: 84px; height: 84px; border: 1.5px dashed var(--input); border-radius: 50%; display: grid; place-items: center; text-align: center; font-size: 0.6875rem; }
|
|
283
|
+
|
|
284
|
+
/* The chart block header and its table view (BarChart card: "Show as table" gives every value). */
|
|
285
|
+
.wy-doc .wy-chart-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
|
|
286
|
+
.wy-doc .wy-chart-title { font-size: 0.875rem; font-weight: 600; color: var(--foreground); }
|
|
287
|
+
.wy-doc .wy-chart-sub { font-size: 0.75rem; color: var(--muted-foreground); }
|
|
288
|
+
.wy-doc .wy-chart-toggle { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 4px; border-radius: 4px; font: inherit; font-size: 0.75rem; color: var(--muted-foreground); cursor: pointer; }
|
|
289
|
+
.wy-doc .wy-chart-toggle:hover { color: var(--foreground); background: var(--muted); }
|
|
290
|
+
.wy-doc .wy-chart-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
|
|
291
|
+
.wy-doc .wy-chart-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
|
|
292
|
+
.wy-doc .wy-chart-table th { text-align: start; font-weight: 500; color: var(--muted-foreground); border-bottom: 1px solid var(--border); padding: 4px 6px; }
|
|
293
|
+
.wy-doc .wy-chart-table td { border-bottom: 1px solid var(--border); padding: 4px 6px; }
|
|
294
|
+
.wy-doc .wy-chart-table td:last-child, .wy-doc .wy-chart-table th:last-child { text-align: end; font-variant-numeric: tabular-nums; }
|
|
295
|
+
|
|
296
|
+
/* Barcode, QR code and maths (E.40–E.42). Codes stay ink on white in both themes so they scan (mark-sheet is white in both). */
|
|
297
|
+
.wy-doc .wy-code { margin: 0; display: grid; gap: 6px; justify-items: start; }
|
|
298
|
+
.wy-doc .wy-code-art { background: var(--mark-sheet); padding: 6px; border-radius: 4px; }
|
|
299
|
+
.wy-doc .wy-code.is-bar .wy-code-art { width: 220px; }
|
|
300
|
+
.wy-doc .wy-code.is-qr .wy-code-art { width: 120px; }
|
|
301
|
+
.wy-doc .wy-code figcaption { font-size: 0.75rem; color: var(--muted-foreground); }
|
|
302
|
+
.wy-doc .wy-math-block { overflow-x: auto; padding-block: 4px; }
|
|
303
|
+
.wy-doc .wy-math { font-family: var(--font-mono); font-size: 0.875em; }
|
|
304
|
+
|
|
305
|
+
/* Empty and unavailable states. */
|
|
306
|
+
.wy-doc .wy-placeholder { padding: 10px 12px; border: 1px dashed var(--input); border-radius: var(--radius-control-lg); color: var(--muted-foreground); font-size: 0.875rem; }
|
|
307
|
+
.wy-doc .wy-placeholder.is-field { border-style: dotted; border-color: var(--primary); color: var(--primary-tint-foreground); background: var(--primary-tint); }
|
|
308
|
+
.wy-doc .wy-skeleton { height: 40px; border-radius: var(--radius-control); background: var(--muted); }
|
|
309
|
+
.wy-doc .wy-skeleton.is-tall { height: 170px; }
|
|
310
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
311
|
+
.wy-doc .wy-skeleton { animation: wy-pulse 1.2s ease-in-out infinite; }
|
|
312
|
+
}
|
|
313
|
+
@keyframes wy-pulse { 50% { opacity: 0.55; } }
|
|
314
|
+
|
|
315
|
+
/* ------------------------------------------------------------------
|
|
316
|
+
* The page view (E.7, EditorPageView): A4 at 96 dpi, 16mm margins. The
|
|
317
|
+
* stack carries `.light`, so the pages stay white like paper in dark mode
|
|
318
|
+
* (E.11) while the ground around them follows the theme.
|
|
319
|
+
* ------------------------------------------------------------------ */
|
|
320
|
+
.wy-pv { width: 794px; margin-inline: auto; }
|
|
321
|
+
.wy-pv__stack { position: relative; width: 794px; color: var(--foreground); --primary: var(--doc-accent, var(--brand)); }
|
|
322
|
+
.wy-pv__page {
|
|
323
|
+
position: absolute;
|
|
324
|
+
inset-inline: 0;
|
|
325
|
+
height: 1123px;
|
|
326
|
+
background: var(--card);
|
|
327
|
+
box-shadow: 0 0 0 1px var(--border), 0 1px 3px color-mix(in oklab, var(--foreground) 6%, transparent);
|
|
328
|
+
}
|
|
329
|
+
.wy-pv__margin { position: absolute; inset: 60px; border: 1px dashed transparent; pointer-events: none; }
|
|
330
|
+
.wy-pv__page.show-margins .wy-pv__margin { border-color: color-mix(in oklab, var(--ring) 35%, transparent); }
|
|
331
|
+
.wy-pv__run {
|
|
332
|
+
position: absolute;
|
|
333
|
+
top: 60px;
|
|
334
|
+
inset-inline: 60px;
|
|
335
|
+
display: flex;
|
|
336
|
+
align-items: center;
|
|
337
|
+
justify-content: space-between;
|
|
338
|
+
padding-bottom: 10px;
|
|
339
|
+
border-bottom: 1px solid var(--border);
|
|
340
|
+
font-size: 11px;
|
|
341
|
+
color: var(--muted-foreground);
|
|
342
|
+
}
|
|
343
|
+
.wy-pv__foot {
|
|
344
|
+
position: absolute;
|
|
345
|
+
inset-inline: 60px;
|
|
346
|
+
bottom: 28px;
|
|
347
|
+
display: flex;
|
|
348
|
+
justify-content: space-between;
|
|
349
|
+
font-family: var(--font-mono);
|
|
350
|
+
font-size: 11px;
|
|
351
|
+
color: var(--muted-foreground);
|
|
352
|
+
}
|
|
353
|
+
.wy-pv__column { position: relative; padding: 60px; min-height: 1123px; box-sizing: border-box; }
|
|
354
|
+
.wy-pv__lh {
|
|
355
|
+
display: flex;
|
|
356
|
+
justify-content: space-between;
|
|
357
|
+
gap: 24px;
|
|
358
|
+
padding-bottom: 14px;
|
|
359
|
+
margin-bottom: 18px;
|
|
360
|
+
border-bottom: 1px solid var(--border);
|
|
361
|
+
font-size: var(--doc-text-print-label);
|
|
362
|
+
color: var(--muted-foreground);
|
|
363
|
+
}
|
|
364
|
+
.wy-pv__lh b { color: var(--foreground); font-weight: 600; }
|
|
365
|
+
.wy-pv__lhend { text-align: end; display: grid; gap: 2px; align-content: start; }
|
|
366
|
+
/* The document title: Readex Pro 600 in the tenant's print colour. */
|
|
367
|
+
.wy-pv__title { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; font-size: var(--doc-text-print-title); line-height: var(--doc-leading-title); color: var(--doc-accent, var(--brand)); }
|
|
368
|
+
/* E.45: a theme with accentUse `title-and-headings` gives H1-H3 the print colour too. */
|
|
369
|
+
.wy-pv__stack[data-accent-use="title-and-headings"] .wy-doc :is(h2, h3, h4) { color: var(--doc-accent, var(--brand)); }
|
|
370
|
+
/* Stage 6 (6.5) and E.33 on paper; at 96 dpi a pt is the same size on screen. */
|
|
371
|
+
.wy-pv .wy-doc { font-size: var(--doc-text-print-body); }
|
|
372
|
+
.wy-pv .wy-doc h2 { font-size: var(--doc-text-print-h1); padding-top: 14px; }
|
|
373
|
+
.wy-pv .wy-doc h3 { font-size: var(--doc-text-print-h2); padding-top: 10px; }
|
|
374
|
+
.wy-pv .wy-doc h4 { font-size: var(--doc-text-print-h3); padding-top: 8px; }
|
|
375
|
+
.wy-pv .wy-doc table[data-type="table"] { font-size: var(--doc-text-print-label); }
|
|
376
|
+
.wy-pv .wy-doc table[data-type="table"] td { border: 0; border-bottom: 1px solid var(--border); }
|
|
377
|
+
/* On paper the header row is a rule under muted labels, not a filled row. */
|
|
378
|
+
.wy-pv .wy-doc table[data-type="table"][data-header-row="true"] tr:first-child td { background: none; border-bottom: 1.5px solid var(--foreground); color: var(--muted-foreground); }
|
|
379
|
+
/* A page break's own line is hidden: the next page shows where it falls. */
|
|
380
|
+
.wy-pv .wy-doc .wy-pagebreak { visibility: hidden; height: 0; margin: 0; }
|
|
381
|
+
.wy-pv__gap { pointer-events: none; }
|
|
382
|
+
|
|
383
|
+
/* Label sheets (E.43): one sheet of identical labels. The first is the one
|
|
384
|
+
you edit; the others repeat it. A label's outline is dashed, as on the
|
|
385
|
+
stock's backing sheet; content past it is cut off on paper. */
|
|
386
|
+
.wy-ls__label {
|
|
387
|
+
position: absolute;
|
|
388
|
+
box-sizing: border-box;
|
|
389
|
+
overflow: hidden;
|
|
390
|
+
border-radius: 4px;
|
|
391
|
+
outline: 1px dashed color-mix(in oklab, var(--border) 100%, var(--foreground) 15%);
|
|
392
|
+
outline-offset: -1px;
|
|
393
|
+
}
|
|
394
|
+
.wy-ls__label.is-first { outline: 1px solid var(--ring); overflow: visible; z-index: 1; }
|
|
395
|
+
.wy-ls__label.is-first .ProseMirror { min-height: 100%; }
|
|
396
|
+
/* What runs past the label stays readable above its neighbours while it's edited. */
|
|
397
|
+
.wy-ls__label.is-over { outline-color: var(--error); }
|
|
398
|
+
.wy-ls__label.is-over .ProseMirror { background: var(--card); box-shadow: 0 0 0 1px var(--error); border-radius: 4px; }
|
|
399
|
+
.wy-ls__label:not(.is-first) { color: var(--muted-foreground); }
|
|
400
|
+
.wy-ls__label .wy-doc > * { margin-block: 0 2px; }
|
|
401
|
+
.wy-ls__over {
|
|
402
|
+
position: absolute;
|
|
403
|
+
inset-inline-end: 4px;
|
|
404
|
+
inset-block-end: 4px;
|
|
405
|
+
display: inline-flex;
|
|
406
|
+
align-items: center;
|
|
407
|
+
gap: 4px;
|
|
408
|
+
padding: 1px 6px;
|
|
409
|
+
border-radius: 4px;
|
|
410
|
+
background: var(--error-tint);
|
|
411
|
+
color: var(--error-text);
|
|
412
|
+
font-size: 11px;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* Preview with a record (E.12): the bar above the pages. */
|
|
416
|
+
.wy-previewbar {
|
|
417
|
+
display: flex;
|
|
418
|
+
align-items: center;
|
|
419
|
+
gap: 6px;
|
|
420
|
+
width: fit-content;
|
|
421
|
+
margin: 0 auto 16px;
|
|
422
|
+
padding: 4px 4px 4px 12px;
|
|
423
|
+
border: 1px solid var(--border);
|
|
424
|
+
border-radius: 999px;
|
|
425
|
+
background: var(--card);
|
|
426
|
+
font-size: 0.8125rem;
|
|
427
|
+
color: var(--muted-foreground);
|
|
428
|
+
}
|
|
429
|
+
.wy-previewbar b { color: var(--foreground); font-weight: 500; }
|
|
430
|
+
|
|
431
|
+
/* ------------------------------------------------------------------
|
|
432
|
+
* The continuous sheet's title (E.11): the text colour in light mode; in
|
|
433
|
+
* dark mode the theme's `accentOnDark`, which never prints.
|
|
434
|
+
* ------------------------------------------------------------------ */
|
|
435
|
+
.wy-sheet__title { color: var(--foreground); }
|
|
436
|
+
.dark .wy-sheet__title { color: var(--doc-accent-on-dark, var(--foreground)); }
|
|
437
|
+
|
|
438
|
+
/*
|
|
439
|
+
* Comments and suggestions (editor M5, EditorCollab, E.4, E.6, E.10, E.39).
|
|
440
|
+
* Suggested text is dashed because it hasn't happened yet (4.3): an insertion
|
|
441
|
+
* in the main colour with a dashed underline; a deletion struck through in the
|
|
442
|
+
* error colour, dashed, still visible. The comment highlight is the warning
|
|
443
|
+
* tint with a warning underline, a decoration on screen only, never printed,
|
|
444
|
+
* and not the highlight colour (E.25).
|
|
445
|
+
*/
|
|
446
|
+
.wy-doc ins[data-suggestion],
|
|
447
|
+
.wy-sug-ins {
|
|
448
|
+
color: var(--primary-tint-foreground);
|
|
449
|
+
text-decoration: underline dashed var(--primary);
|
|
450
|
+
text-decoration-thickness: 1.5px;
|
|
451
|
+
text-underline-offset: 3px;
|
|
452
|
+
}
|
|
453
|
+
.wy-doc del[data-suggestion],
|
|
454
|
+
.wy-sug-del {
|
|
455
|
+
color: var(--muted-foreground);
|
|
456
|
+
text-decoration: line-through dashed var(--error-text);
|
|
457
|
+
text-decoration-thickness: 1.5px;
|
|
458
|
+
}
|
|
459
|
+
.wy-sug-fmt {
|
|
460
|
+
text-decoration: underline dashed var(--primary);
|
|
461
|
+
text-decoration-thickness: 1.5px;
|
|
462
|
+
text-underline-offset: 3px;
|
|
463
|
+
}
|
|
464
|
+
/* Suggested blocks: inserted ones dashed at the start edge, deleted ones struck. */
|
|
465
|
+
.wy-doc .wy-sug-block.is-insert {
|
|
466
|
+
border-inline-start: 2px dashed var(--primary);
|
|
467
|
+
padding-inline-start: 10px;
|
|
468
|
+
color: var(--primary-tint-foreground);
|
|
469
|
+
}
|
|
470
|
+
.wy-doc .wy-sug-block.is-delete {
|
|
471
|
+
border-inline-start: 2px dashed var(--error-text);
|
|
472
|
+
padding-inline-start: 10px;
|
|
473
|
+
color: var(--muted-foreground);
|
|
474
|
+
text-decoration: line-through dashed var(--error-text);
|
|
475
|
+
}
|
|
476
|
+
.wy-doc .wy-sug-block.is-move { border-inline-start: 2px dashed var(--input); padding-inline-start: 10px; }
|
|
477
|
+
.wy-doc ins[data-suggestion].is-active,
|
|
478
|
+
.wy-doc .wy-sug-block.is-active { background: var(--primary-tint); }
|
|
479
|
+
|
|
480
|
+
.wy-cmt { background: var(--warning-tint); color: inherit; border-bottom: 2px solid var(--warning); padding-block: 1px; }
|
|
481
|
+
.wy-cmt.is-active { background: color-mix(in oklab, var(--warning) 45%, var(--card)); }
|
|
482
|
+
|
|
483
|
+
@media print {
|
|
484
|
+
/* E.39: comments never print. Suggestions aren't in what prints either; this is the screen's print only. */
|
|
485
|
+
.wy-cmt { background: none; border-bottom: 0; padding: 0; }
|
|
486
|
+
.wy-edx__rail { display: none; }
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/* The rail and its cards (E.6). */
|
|
490
|
+
.wy-edx__rail { position: relative; padding-block: 32px; padding-inline: 0 16px; min-width: 0; }
|
|
491
|
+
.wy-edx__railhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 0.75rem; color: var(--muted-foreground); }
|
|
492
|
+
.wy-edx__railnote { margin: 0; padding: 12px; border: 1px dashed var(--input); border-radius: var(--radius-control-lg); color: var(--muted-foreground); font-size: 0.8125rem; line-height: 1.45; }
|
|
493
|
+
.wy-rc {
|
|
494
|
+
--wy-lift: -8px;
|
|
495
|
+
position: absolute;
|
|
496
|
+
inset-inline: 0 16px;
|
|
497
|
+
display: grid;
|
|
498
|
+
gap: 8px;
|
|
499
|
+
padding: 12px;
|
|
500
|
+
background: var(--card);
|
|
501
|
+
border: 1px solid var(--border);
|
|
502
|
+
border-radius: var(--radius-control-lg);
|
|
503
|
+
font-size: 0.8125rem;
|
|
504
|
+
line-height: 1.45;
|
|
505
|
+
box-sizing: border-box;
|
|
506
|
+
transition: top 150ms ease, translate 150ms ease;
|
|
507
|
+
}
|
|
508
|
+
[dir="rtl"] .wy-rc { --wy-lift: 8px; }
|
|
509
|
+
.wy-rc.is-active { box-shadow: var(--shadow-float); border-color: var(--input); translate: var(--wy-lift) 0; z-index: 1; }
|
|
510
|
+
.wy-rc.is-agent, .wy-rc.is-pending { border-style: dashed; border-color: var(--input); }
|
|
511
|
+
.wy-rc--static { position: relative; inset: auto; }
|
|
512
|
+
.wy-rc--static.is-active { translate: none; }
|
|
513
|
+
.wy-rc__who { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
514
|
+
.wy-drawerlist .wy-rc__who { flex-wrap: wrap; }
|
|
515
|
+
.wy-rc__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
516
|
+
.wy-rc__time { color: var(--muted-foreground); font-size: 0.75rem; white-space: nowrap; }
|
|
517
|
+
.wy-rc__acts { margin-inline-start: auto; display: flex; gap: 2px; }
|
|
518
|
+
.wy-rc__what { color: var(--muted-foreground); overflow-wrap: anywhere; }
|
|
519
|
+
.wy-rc__what b { color: var(--foreground); font-weight: 500; }
|
|
520
|
+
.wy-rc__reply { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--input); border-radius: var(--radius-control-sm); background: none; color: var(--muted-foreground); font: inherit; cursor: text; }
|
|
521
|
+
.wy-rc__box { border: 1px solid var(--input); border-radius: var(--radius-control); padding: 8px 10px; min-height: 56px; color: var(--foreground); font: inherit; font-size: 0.8125rem; box-sizing: border-box; width: 100%; }
|
|
522
|
+
.wy-mention { color: var(--primary-tint-foreground); background: var(--primary-tint); border-radius: 4px; padding: 0 3px; font-weight: 500; }
|
|
523
|
+
.wy-rc__foot { display: flex; justify-content: flex-end; gap: 6px; }
|
|
524
|
+
.wy-rc__replies { display: grid; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
|
|
525
|
+
.wy-rc__q { color: var(--muted-foreground); border-inline-start: 2px solid var(--warning); padding-inline-start: 8px; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
526
|
+
.wy-rc.is-resolved { opacity: .7; }
|
|
527
|
+
.wy-rc__resolved { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--success-text); }
|
|
528
|
+
.wy-drawerlist { display: grid; gap: 10px; }
|
|
529
|
+
.wy-mentionpop { padding: 4px; }
|
|
530
|
+
|
|
531
|
+
/* The mode menu (E.10). */
|
|
532
|
+
.wy-modemenu__it { display: flex; gap: 10px; align-items: flex-start; }
|
|
533
|
+
.wy-modemenu__it .wy-modemenu__t { display: grid; gap: 1px; flex: 1; }
|
|
534
|
+
.wy-modemenu__it .wy-modemenu__t span { font-size: 0.75rem; color: var(--muted-foreground); }
|
|
535
|
+
.wy-modemenu__it.is-on { background: var(--primary-tint); color: var(--primary-tint-foreground); }
|
|
536
|
+
.wy-modemenu__it.is-on .wy-modemenu__t span { color: inherit; opacity: .8; }
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { AnyExtension } from "@tiptap/core"
|
|
2
|
+
import { Gapcursor, Placeholder, UndoRedo } from "@tiptap/extensions"
|
|
3
|
+
|
|
4
|
+
import { BlockIds } from "./block-ids"
|
|
5
|
+
import { DocumentBehaviour } from "./behaviour"
|
|
6
|
+
import { richNodeViews } from "./node-views"
|
|
7
|
+
import { CheckItem, schemaExtensions } from "./schema"
|
|
8
|
+
import { Suggesting } from "./suggesting"
|
|
9
|
+
import { TableKeys } from "./table-keys"
|
|
10
|
+
|
|
11
|
+
/** The checklist box: a real checkbox button, outside the editable text. */
|
|
12
|
+
const CheckItemWithBox = CheckItem.extend({
|
|
13
|
+
addNodeView() {
|
|
14
|
+
return ({ node: initial, getPos, editor }) => {
|
|
15
|
+
let node = initial
|
|
16
|
+
const dom = document.createElement("div")
|
|
17
|
+
const box = document.createElement("button")
|
|
18
|
+
const contentDOM = document.createElement("div")
|
|
19
|
+
box.type = "button"
|
|
20
|
+
box.contentEditable = "false"
|
|
21
|
+
box.setAttribute("role", "checkbox")
|
|
22
|
+
box.className = "wy-check"
|
|
23
|
+
contentDOM.className = "wy-check-text"
|
|
24
|
+
dom.append(box, contentDOM)
|
|
25
|
+
|
|
26
|
+
const paint = () => {
|
|
27
|
+
dom.dataset.type = "check-item"
|
|
28
|
+
dom.dataset.level = String(node.attrs.level)
|
|
29
|
+
dom.dataset.checked = node.attrs.checked ? "true" : "false"
|
|
30
|
+
if (node.attrs.id) dom.dataset.blockId = node.attrs.id
|
|
31
|
+
box.setAttribute("aria-checked", node.attrs.checked ? "true" : "false")
|
|
32
|
+
box.setAttribute("aria-label", node.textContent || "Checklist item")
|
|
33
|
+
}
|
|
34
|
+
paint()
|
|
35
|
+
|
|
36
|
+
box.addEventListener("mousedown", (e) => e.preventDefault())
|
|
37
|
+
box.addEventListener("click", () => {
|
|
38
|
+
if (!editor.isEditable) return
|
|
39
|
+
const pos = typeof getPos === "function" ? getPos() : undefined
|
|
40
|
+
if (pos === undefined) return
|
|
41
|
+
editor.view.dispatch(editor.state.tr.setNodeMarkup(pos, undefined, { ...node.attrs, checked: !node.attrs.checked }))
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
dom,
|
|
46
|
+
contentDOM,
|
|
47
|
+
update(next) {
|
|
48
|
+
if (next.type !== node.type) return false
|
|
49
|
+
node = next
|
|
50
|
+
paint()
|
|
51
|
+
return true
|
|
52
|
+
},
|
|
53
|
+
ignoreMutation: (m) => m.target === box || box.contains(m.target as globalThis.Node),
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export interface DocumentExtensionOptions {
|
|
60
|
+
/** The focused empty line's hint (EditorInsert card). */
|
|
61
|
+
placeholder?: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Everything the document editor runs on, in one list. */
|
|
65
|
+
export function documentExtensions({ placeholder }: DocumentExtensionOptions = {}): AnyExtension[] {
|
|
66
|
+
return [
|
|
67
|
+
...schemaExtensions.map((ext) => {
|
|
68
|
+
if (ext.name === "checkItem") return CheckItemWithBox
|
|
69
|
+
// M3 blocks get their editor views (node-views.tsx).
|
|
70
|
+
return richNodeViews.find((view) => view.name === ext.name) ?? ext
|
|
71
|
+
}),
|
|
72
|
+
Gapcursor,
|
|
73
|
+
TableKeys,
|
|
74
|
+
BlockIds,
|
|
75
|
+
DocumentBehaviour,
|
|
76
|
+
// Off until the editor turns Suggesting mode on (M5); also draws comment highlights.
|
|
77
|
+
Suggesting,
|
|
78
|
+
UndoRedo.configure({ depth: 200 }),
|
|
79
|
+
Placeholder.configure({
|
|
80
|
+
placeholder: placeholder ?? "Type / for blocks, {{ for fields, or just write",
|
|
81
|
+
showOnlyCurrent: true,
|
|
82
|
+
includeChildren: false,
|
|
83
|
+
emptyNodeClass: "is-empty",
|
|
84
|
+
}),
|
|
85
|
+
]
|
|
86
|
+
}
|