@domternal/theme 0.6.2 → 0.7.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.
@@ -27,9 +27,91 @@
27
27
  --dm-accent-surface: rgba(37, 99, 235, 0.1);
28
28
  --dm-focus-color: rgba(66, 133, 244, 0.3);
29
29
  --dm-selection: rgba(66, 133, 244, 0.2);
30
+
31
+ // Shared scrollbar thumb colors used by slash / context / floating menu
32
+ // and any other thin-scrollbar popup. Override in dark theme for contrast.
33
+ --dm-scrollbar-thumb: rgba(0, 0, 0, 0.18);
34
+ --dm-scrollbar-thumb-hover: rgba(0, 0, 0, 0.28);
35
+
36
+ // Centralised z-index ladder for overlays. Handle sits below floating
37
+ // menus so opening a menu overlays the handle naturally.
38
+ --dm-z-handle: 25;
39
+ --dm-z-popover: 50;
40
+
41
+ // Gutter width reserved on `.ProseMirror` when BlockHandle is active.
42
+ // Override per-editor if you need wider/narrower whitespace left of content.
43
+ --dm-block-handle-gutter: 3rem;
44
+
45
+ // Horizontal offset of the BlockHandle from the editor's left edge.
46
+ // Negative values place the handle in the surrounding whitespace
47
+ // (requires `.dm-editor--has-block-handle { overflow: visible }`).
48
+ // Override to move the handle fully outside a centered content column
49
+ // - see the Notion demo for an example.
50
+ --dm-block-handle-left: -0.5rem;
51
+
52
+ // Inline padding pre-applied to every colorable block (paragraph, heading,
53
+ // blockquote, list item, task item). Pre-applying it here means that the
54
+ // `[data-bg-color]` rule in `_block-colors.scss` only paints a background
55
+ // - it does NOT add padding - so toggling a color does NOT shift text.
56
+ // Mirrors Notion's layout convention.
57
+ --dm-block-inline-padding: 0.375rem;
58
+
59
+ // Horizontal indent applied to non-first-paragraph children of list/task
60
+ // items - the "children zone" below the bullet/checkbox label paragraph.
61
+ // Notion semantics: label aligns with the marker, additional blocks
62
+ // (heading, codeBlock, blockquote, etc.) render indented one level
63
+ // below it.
64
+ //
65
+ // `rem` (not `em`): we want every children-zone block to land in the
66
+ // SAME visual column regardless of its own font-size, so the indent
67
+ // stays decoupled from the child element's typography (a heading's
68
+ // larger font would otherwise produce a wider em-based indent than
69
+ // a sibling paragraph). Override per-editor for tighter/looser
70
+ // hierarchy.
71
+ --dm-block-children-indent: 1.5rem;
72
+
73
+ // Shared drop shadow for popover surfaces (floating menu, slash command,
74
+ // context menu). Override in dark theme for visibility on dark bg.
75
+ --dm-popover-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
30
76
  --dm-code-surface: #f0f0f0;
31
77
  --dm-code-color: inherit;
32
78
 
79
+ // ---------------------------------------------------------------------------
80
+ // Block colors (BlockColor extension)
81
+ // ---------------------------------------------------------------------------
82
+ // Notion-style block-level palette (9 named colors). Dark-mode overrides
83
+ // live in `themes/_dark.scss`. Source (light): https://matthiasfrank.de/en/notion-colors/
84
+ --dm-block-bg-gray: #f1f1ef;
85
+ --dm-block-bg-brown: #f3eeee;
86
+ --dm-block-bg-orange: #f8ecdf;
87
+ --dm-block-bg-yellow: #faf3dd;
88
+ --dm-block-bg-green: #eef3ed;
89
+ --dm-block-bg-blue: #e9f3f7;
90
+ --dm-block-bg-purple: #f6f3f8;
91
+ --dm-block-bg-pink: #f9f2f5;
92
+ --dm-block-bg-red: #faecec;
93
+
94
+ --dm-block-text-gray: #787774;
95
+ --dm-block-text-brown: #976d57;
96
+ --dm-block-text-orange: #cc782f;
97
+ --dm-block-text-yellow: #c29343;
98
+ --dm-block-text-green: #548164;
99
+ --dm-block-text-blue: #487ca5;
100
+ --dm-block-text-purple: #8a67ab;
101
+ --dm-block-text-pink: #b35488;
102
+ --dm-block-text-red: #c4554d;
103
+
104
+ // Halo around the currently-selected block while a drag handle is active.
105
+ // Used by `_block-handle.scss` as the `::before` background-color (the
106
+ // pseudo-element sits behind the block at `z-index: -1` so the halo
107
+ // never overlaps surrounding chrome the way a real outline would).
108
+ --dm-block-selected-halo: rgba(112, 207, 248, 0.25);
109
+
110
+ // Background tint applied to a block while its context menu is open.
111
+ // Used by `_context-menu.scss` via a Decoration class. Dark theme
112
+ // override lives in `themes/_dark.scss`.
113
+ --dm-block-context-active-bg: rgba(55, 53, 47, 0.06);
114
+
33
115
  // ---------------------------------------------------------------------------
34
116
  // Editor
35
117
  // ---------------------------------------------------------------------------
@@ -122,6 +204,18 @@
122
204
  --dm-details-border: 1px solid var(--dm-border-color);
123
205
  --dm-details-bg: var(--dm-surface);
124
206
  --dm-details-summary-font-weight: 600;
207
+
208
+ // ---------------------------------------------------------------------------
209
+ // Task list
210
+ // ---------------------------------------------------------------------------
211
+ // Position of the absolutely-positioned checkbox label inside a taskItem.
212
+ // `left` hangs the checkbox in the bullet column (paired with the
213
+ // wrapper's `padding-left: 1.5em` and the checkbox's own 1em width).
214
+ // `top` is tuned to the first text line's x-height. Override these when
215
+ // overriding `--dm-editor-line-height` so the checkbox stays aligned
216
+ // with the first label glyph.
217
+ --dm-task-checkbox-left: -1.15em;
218
+ --dm-task-checkbox-top: 0.45em;
125
219
  }
126
220
 
127
221
  // =============================================================================
@@ -148,3 +242,100 @@
148
242
  --dm-separator-color: var(--dm-border-color, #e5e7eb);
149
243
  --dm-separator-margin: 0.375rem;
150
244
  }
245
+
246
+ // =============================================================================
247
+ // Table-of-contents variables (on :root)
248
+ // =============================================================================
249
+ // The floating ToC outline mounts OUTSIDE `.dm-editor` (so it can sit in
250
+ // the page's right gutter instead of being clipped by the editor's
251
+ // `overflow: hidden`). Tokens therefore live on `:root` to be visible
252
+ // regardless of cascade. Dark theme overrides land in `_dark.scss`.
253
+
254
+ :root {
255
+ // Tick widths per heading level. H1 widest, H3 narrowest - the
256
+ // length encodes hierarchy in the collapsed (default) state.
257
+ --dm-toc-tick-h1-width: 18px;
258
+ --dm-toc-tick-h2-width: 12px;
259
+ --dm-toc-tick-h3-width: 8px;
260
+ --dm-toc-tick-h4-width: 6px;
261
+ --dm-toc-tick-h5-width: 5px;
262
+ --dm-toc-tick-h6-width: 4px;
263
+ --dm-toc-tick-height: 2px;
264
+ --dm-toc-tick-radius: 1px;
265
+ --dm-toc-tick-gap: 10px;
266
+
267
+ // Tick color: low-contrast neutral; active variant is full text color.
268
+ --dm-toc-tick-color: rgba(55, 53, 47, 0.4);
269
+ --dm-toc-tick-hover-color: rgba(55, 53, 47, 0.7);
270
+ --dm-toc-tick-active-color: rgba(55, 53, 47, 0.95);
271
+
272
+ // Panel chrome - mostly transparent in collapsed state, just enough
273
+ // padding to separate ticks visually from the page edge.
274
+ --dm-toc-padding-block: 12px;
275
+ --dm-toc-padding-inline: 8px;
276
+ --dm-toc-right-offset: 24px;
277
+ --dm-toc-z-index: 10;
278
+
279
+ // Editor-anchored outline (anchor: 'editor'): top offset from the
280
+ // editor's top edge. Used by `_toc.scss` sticky shell.
281
+ --dm-toc-editor-top: 1rem;
282
+
283
+ // Page-anchored outline (anchor: 'page'): right offset from the
284
+ // viewport (smaller than `--dm-toc-right-offset` when nav is mid-page).
285
+ --dm-toc-page-offset: 8px;
286
+
287
+ // Expanded card vertical margin from the viewport top/bottom.
288
+ // Used by `_toc.scss` viewport-clamp. The plugin writes
289
+ // `--dm-toc-card-shift-y` (a JS-computed shift) and reads this margin
290
+ // as the keep-out distance from the viewport edges.
291
+ --dm-toc-card-viewport-margin: 16px;
292
+
293
+ // Expanded card: replaces the tick column on hover/focus, showing the
294
+ // full heading text with per-level indent.
295
+ --dm-toc-card-bg: rgba(255, 255, 255, 0.98);
296
+ --dm-toc-card-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
297
+ --dm-toc-card-radius: 6px;
298
+ --dm-toc-card-border: 1px solid rgba(0, 0, 0, 0.06);
299
+ --dm-toc-card-min-width: 180px;
300
+ --dm-toc-card-max-width: 260px;
301
+ --dm-toc-card-padding-block: 6px;
302
+ // Card slides in from the right edge by this offset on hover/focus.
303
+ // 8px reads as a clearly intentional motion at 60fps without being
304
+ // showy; smaller values (4px) feel like a glitch on retina displays.
305
+ --dm-toc-card-offset: 8px;
306
+ --dm-toc-card-transition: 180ms;
307
+
308
+ --dm-toc-row-padding-block: 4px;
309
+ --dm-toc-row-padding-inline-start: 12px;
310
+ --dm-toc-row-padding-inline-end: 16px;
311
+ --dm-toc-row-indent: 14px;
312
+ --dm-toc-row-color: rgba(55, 53, 47, 0.7);
313
+ --dm-toc-row-hover-bg: rgba(0, 0, 0, 0.04);
314
+ --dm-toc-row-active-color: rgba(55, 53, 47, 0.95);
315
+ --dm-toc-row-active-weight: 600;
316
+ --dm-toc-row-font-size: 13px;
317
+ --dm-toc-row-line-height: 1.4;
318
+
319
+ // Inline /toc block: lives INSIDE the editor as a first-class document
320
+ // block. Notion-style callout (subtle surface tint, soft border).
321
+ --dm-toc-block-bg: rgba(0, 0, 0, 0.02);
322
+ --dm-toc-block-border: 1px solid rgba(0, 0, 0, 0.08);
323
+ --dm-toc-block-radius: 6px;
324
+ --dm-toc-block-padding-block: 12px;
325
+ --dm-toc-block-padding-inline: 16px;
326
+ --dm-toc-block-margin-block: 1rem;
327
+ --dm-toc-block-empty-color: rgba(55, 53, 47, 0.5);
328
+ --dm-toc-block-empty-font-style: italic;
329
+
330
+ --dm-toc-block-link-color: rgba(55, 53, 47, 0.8);
331
+ --dm-toc-block-link-hover-color: rgba(55, 53, 47, 1);
332
+ --dm-toc-block-link-hover-bg: rgba(0, 0, 0, 0.04);
333
+ --dm-toc-block-link-active-color: rgba(55, 53, 47, 0.95);
334
+ --dm-toc-block-link-active-weight: 600;
335
+ --dm-toc-block-link-padding-block: 4px;
336
+ --dm-toc-block-link-padding-inline: 8px;
337
+ --dm-toc-block-link-indent: 16px;
338
+ --dm-toc-block-link-radius: 3px;
339
+ --dm-toc-block-link-font-size: 0.9375rem;
340
+ --dm-toc-block-link-line-height: 1.5;
341
+ }
package/src/index.scss CHANGED
@@ -1,5 +1,5 @@
1
1
  // =============================================================================
2
- // @domternal/theme Main Entry
2
+ // @domternal/theme - Main Entry
3
3
  // =============================================================================
4
4
  // Import this file to get all Domternal editor styles:
5
5
  //
@@ -33,10 +33,13 @@
33
33
  @use 'toolbar';
34
34
  @use 'color-palette';
35
35
 
36
- // 6. Menus (bubble, floating, link popover)
36
+ // 6. Menus (bubble, floating, link popover, block-menu)
37
37
  @use 'bubble-menu';
38
38
  @use 'floating-menu';
39
39
  @use 'link-popover';
40
+ @use 'block-handle';
41
+ @use 'slash-command';
42
+ @use 'context-menu';
40
43
 
41
44
  // 7. Extension-specific styles
42
45
  @use 'placeholder';
@@ -47,12 +50,20 @@
47
50
  @use 'invisible-chars';
48
51
  @use 'emoji-picker';
49
52
  @use 'table-controls';
53
+ @use 'block-colors';
54
+ // MUST follow block-colors: the inline override depends on cascade ordering
55
+ // to win over the block-level [data-bg-color] padding rule.
56
+ @use 'inline-colors';
57
+ @use 'toc';
50
58
 
51
- // 8. Themes
59
+ // 8. Opt-in stylistic presets (apply via host class)
60
+ @use 'notion-mode';
61
+
62
+ // 9. Themes
52
63
  @use 'themes/light';
53
64
  @use 'themes/dark';
54
65
 
55
- // 9. Reduced motion must come last to override all animation/transition rules
66
+ // 9. Reduced motion - must come last to override all animation/transition rules
56
67
  // =============================================================================
57
68
  @media (prefers-reduced-motion: reduce) {
58
69
  .dm-emoji-picker,
@@ -88,7 +99,13 @@
88
99
  .dm-table-align-item,
89
100
  .dm-image-popover-btn,
90
101
  .dm-link-popover-btn,
102
+ .dm-block-handle,
103
+ .dm-block-handle-btn,
104
+ .dm-block-color-swatch,
105
+ .dm-slash-command-item,
106
+ .dm-block-context-menu-item,
91
107
  .dm-editor .ProseMirror div[data-type="details"] > button[type="button"]::before {
92
108
  transition: none;
109
+ transform: none;
93
110
  }
94
111
  }
@@ -29,9 +29,18 @@
29
29
  --dm-code-surface: #2d2d2d;
30
30
  --dm-code-color: inherit;
31
31
  --dm-highlight-bg: rgba(255, 243, 205, 0.2);
32
+
33
+ // Scrollbar thumb + popover shadow - lighten for contrast on dark bg.
34
+ --dm-scrollbar-thumb: rgba(255, 255, 255, 0.18);
35
+ --dm-scrollbar-thumb-hover: rgba(255, 255, 255, 0.32);
36
+ --dm-popover-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.25);
32
37
  --dm-blockquote-border: 3px solid #555555;
33
38
  --dm-blockquote-color: #a0a0a0;
34
39
 
40
+ // Subtle highlight tint for the block whose BlockContextMenu is open.
41
+ // Lighter alpha for dark backgrounds so the cue is visible but not jarring.
42
+ --dm-block-context-active-bg: rgba(255, 255, 255, 0.05);
43
+
35
44
  // Syntax highlighting
36
45
  --dm-syntax-keyword: #ff7b72;
37
46
  --dm-syntax-entity: #d2a8ff;
@@ -44,29 +53,139 @@
44
53
  --dm-syntax-addition-bg: #033a16;
45
54
  --dm-syntax-deletion: #ffdcd7;
46
55
  --dm-syntax-deletion-bg: #67060c;
56
+
57
+ // Block colors (Notion-style dark-mode palette). Backgrounds are
58
+ // desaturated darker tones; text colors carry the visible chroma.
59
+ // Source: Notion's published dark palette.
60
+ --dm-block-bg-gray: #2f2f2f;
61
+ --dm-block-bg-brown: #4a3228;
62
+ --dm-block-bg-orange: #5c3b1e;
63
+ --dm-block-bg-yellow: #564328;
64
+ --dm-block-bg-green: #243d30;
65
+ --dm-block-bg-blue: #143a4e;
66
+ --dm-block-bg-purple: #3c2d49;
67
+ --dm-block-bg-pink: #4e2c3c;
68
+ --dm-block-bg-red: #5c1e1e;
69
+
70
+ // Tuned for WCAG AA contrast (>= 4.5:1) against the dark editor
71
+ // background (#1e1e1e). Notion's published palette runs slightly
72
+ // darker on green/blue/orange/pink; we lift those a touch so text
73
+ // marks (which use these as the foreground color) remain readable
74
+ // without a tinted background.
75
+ --dm-block-text-gray: #9b9a97;
76
+ --dm-block-text-brown: #ba856f;
77
+ --dm-block-text-orange: #d68a52;
78
+ --dm-block-text-yellow: #ca9849;
79
+ --dm-block-text-green: #6db285;
80
+ --dm-block-text-blue: #7a9bd6;
81
+ --dm-block-text-purple: #a877d8;
82
+ --dm-block-text-pink: #dc6da4;
83
+ --dm-block-text-red: #df5452;
84
+
85
+ // Selected-block halo - lift opacity for visibility on dark bg.
86
+ --dm-block-selected-halo: rgba(112, 207, 248, 0.35);
87
+
88
+ // Note: layout / geometry tokens (--dm-block-handle-gutter,
89
+ // --dm-block-handle-left, --dm-block-inline-padding) are intentionally
90
+ // NOT overridden here - geometry stays identical between light/dark.
47
91
  }
48
92
 
49
93
  .dm-theme-dark,
50
94
  .dm-theme-dark .dm-editor,
51
95
  .dm-theme-dark .dm-toolbar,
52
96
  .dm-theme-dark .dm-bubble-menu,
97
+ .dm-theme-dark .dm-floating-menu,
53
98
  .dm-theme-dark .dm-emoji-picker,
54
99
  .dm-theme-dark .dm-emoji-suggestion,
55
100
  .dm-theme-dark .dm-mention-suggestion,
56
- .dm-theme-dark .dm-table-controls-dropdown {
101
+ .dm-theme-dark .dm-table-controls-dropdown,
102
+ .dm-theme-dark .dm-slash-command-menu,
103
+ .dm-theme-dark .dm-block-context-menu,
104
+ .dm-theme-dark .dm-link-popover,
105
+ .dm-theme-dark .dm-image-popover {
57
106
  @include dark-tokens;
58
107
  }
59
108
 
60
- // Auto dark mode follows system preference
109
+ // Auto dark mode - follows system preference
61
110
  @media (prefers-color-scheme: dark) {
62
111
  .dm-theme-auto,
63
112
  .dm-theme-auto .dm-editor,
64
113
  .dm-theme-auto .dm-toolbar,
65
114
  .dm-theme-auto .dm-bubble-menu,
115
+ .dm-theme-auto .dm-floating-menu,
66
116
  .dm-theme-auto .dm-emoji-picker,
67
117
  .dm-theme-auto .dm-emoji-suggestion,
68
118
  .dm-theme-auto .dm-mention-suggestion,
69
- .dm-theme-auto .dm-table-controls-dropdown {
119
+ .dm-theme-auto .dm-table-controls-dropdown,
120
+ .dm-theme-auto .dm-slash-command-menu,
121
+ .dm-theme-auto .dm-block-context-menu,
122
+ .dm-theme-auto .dm-link-popover,
123
+ .dm-theme-auto .dm-image-popover {
70
124
  @include dark-tokens;
71
125
  }
72
126
  }
127
+
128
+ // =============================================================================
129
+ // Floating ToC outline - dark variant
130
+ // =============================================================================
131
+ // The outline mounts OUTSIDE `.dm-editor`, so it needs its own dark
132
+ // selector list - the @include dark-tokens above scopes only general
133
+ // theme tokens (text, background, etc.) which we do not need to flip
134
+ // here. Tick colors are the only ToC tokens that need a dark variant.
135
+
136
+ .dm-theme-dark .dm-toc-outline,
137
+ .dm-theme-dark.dm-toc-outline {
138
+ --dm-toc-tick-color: rgba(255, 255, 255, 0.3);
139
+ --dm-toc-tick-hover-color: rgba(255, 255, 255, 0.6);
140
+ --dm-toc-tick-active-color: rgba(255, 255, 255, 0.95);
141
+
142
+ // Card variants - flip light surfaces to dark equivalents.
143
+ --dm-toc-card-bg: rgba(45, 50, 56, 0.98);
144
+ --dm-toc-card-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
145
+ --dm-toc-card-border: 1px solid rgba(255, 255, 255, 0.08);
146
+ --dm-toc-row-color: rgba(255, 255, 255, 0.7);
147
+ --dm-toc-row-hover-bg: rgba(255, 255, 255, 0.06);
148
+ --dm-toc-row-active-color: rgba(255, 255, 255, 0.95);
149
+ }
150
+
151
+ // Inline /toc block - dark variant. Only flip block-specific tokens; the
152
+ // rest inherits from the dark cascade via the editor host.
153
+ .dm-theme-dark .dm-toc-block,
154
+ .dm-theme-dark.dm-toc-block {
155
+ --dm-toc-block-bg: rgba(255, 255, 255, 0.04);
156
+ --dm-toc-block-border: 1px solid rgba(255, 255, 255, 0.08);
157
+ --dm-toc-block-empty-color: rgba(255, 255, 255, 0.4);
158
+ --dm-toc-block-link-color: rgba(255, 255, 255, 0.7);
159
+ --dm-toc-block-link-hover-color: rgba(255, 255, 255, 0.95);
160
+ --dm-toc-block-link-hover-bg: rgba(255, 255, 255, 0.06);
161
+ --dm-toc-block-link-active-color: rgba(255, 255, 255, 0.95);
162
+ }
163
+
164
+ @media (prefers-color-scheme: dark) {
165
+ .dm-theme-auto .dm-toc-block,
166
+ .dm-theme-auto.dm-toc-block {
167
+ --dm-toc-block-bg: rgba(255, 255, 255, 0.04);
168
+ --dm-toc-block-border: 1px solid rgba(255, 255, 255, 0.08);
169
+ --dm-toc-block-empty-color: rgba(255, 255, 255, 0.4);
170
+ --dm-toc-block-link-color: rgba(255, 255, 255, 0.7);
171
+ --dm-toc-block-link-hover-color: rgba(255, 255, 255, 0.95);
172
+ --dm-toc-block-link-hover-bg: rgba(255, 255, 255, 0.06);
173
+ --dm-toc-block-link-active-color: rgba(255, 255, 255, 0.95);
174
+ }
175
+ }
176
+
177
+ @media (prefers-color-scheme: dark) {
178
+ .dm-theme-auto .dm-toc-outline,
179
+ .dm-theme-auto.dm-toc-outline {
180
+ --dm-toc-tick-color: rgba(255, 255, 255, 0.3);
181
+ --dm-toc-tick-hover-color: rgba(255, 255, 255, 0.6);
182
+ --dm-toc-tick-active-color: rgba(255, 255, 255, 0.95);
183
+
184
+ --dm-toc-card-bg: rgba(45, 50, 56, 0.98);
185
+ --dm-toc-card-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
186
+ --dm-toc-card-border: 1px solid rgba(255, 255, 255, 0.08);
187
+ --dm-toc-row-color: rgba(255, 255, 255, 0.7);
188
+ --dm-toc-row-hover-bg: rgba(255, 255, 255, 0.06);
189
+ --dm-toc-row-active-color: rgba(255, 255, 255, 0.95);
190
+ }
191
+ }
@@ -1,7 +1,7 @@
1
1
  // =============================================================================
2
2
  // Light Theme
3
3
  // =============================================================================
4
- // Light is the default CSS variables in _variables.scss already use light
4
+ // Light is the default - CSS variables in _variables.scss already use light
5
5
  // values. This class exists for explicit light override in a dark context.
6
6
  // =============================================================================
7
7