@domternal/theme 0.6.1 → 0.7.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.
@@ -0,0 +1,174 @@
1
+ // =============================================================================
2
+ // Slash Command Menu
3
+ // Popup shown when the user types `/`. Rendered by
4
+ // `createSlashSuggestionRenderer()` and positioned at the cursor.
5
+ // Visual vocabulary mirrors the floating menu for consistency.
6
+ //
7
+ // Class names follow the renderer's output verbatim:
8
+ // - `dm-slash-command-menu` (outer)
9
+ // - `dm-slash-command-group` / `-group-label`
10
+ // - `dm-slash-command-item` / `-item-icon` / `-item-text` / `-item-label`
11
+ // / `-item-description` / `-item-shortcut`
12
+ // - `dm-slash-command-empty`
13
+ // - `dm-slash-command-query` (inline decoration on the active `/query`)
14
+ //
15
+ // We intentionally do NOT nest the inner elements under `.dm-slash-command-menu`
16
+ // (a previous version did so via SCSS `&-item` concatenation, which produced
17
+ // `.dm-slash-command-menu-item-*` selectors that the renderer never emitted -
18
+ // items rendered without size constraints, ballooning the menu).
19
+ // =============================================================================
20
+
21
+ .dm-slash-command-menu {
22
+ position: absolute;
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: 0.25rem;
26
+ min-width: 17rem;
27
+ max-height: 22rem;
28
+ overflow-y: auto;
29
+ padding: 0.375rem;
30
+ background: var(--dm-toolbar-bg, var(--dm-bg, #ffffff));
31
+ border: 1px solid var(--dm-border-color, #e5e7eb);
32
+ border-radius: var(--dm-toolbar-border-radius, 0.5rem);
33
+ box-shadow: var(--dm-popover-shadow,
34
+ 0 10px 25px rgba(0, 0, 0, 0.08),
35
+ 0 4px 10px rgba(0, 0, 0, 0.04));
36
+ z-index: var(--dm-z-popover, 50);
37
+
38
+ // Slim custom scrollbar - matches the floating-menu styling.
39
+ scrollbar-width: thin;
40
+ scrollbar-color: var(--dm-scrollbar-thumb, rgba(0, 0, 0, 0.18)) transparent;
41
+
42
+ &::-webkit-scrollbar {
43
+ width: 6px;
44
+ }
45
+ &::-webkit-scrollbar-track {
46
+ background: transparent;
47
+ margin: 0.375rem 0;
48
+ }
49
+ &::-webkit-scrollbar-thumb {
50
+ background: var(--dm-scrollbar-thumb, rgba(0, 0, 0, 0.18));
51
+ border-radius: 3px;
52
+ transition: background-color 0.15s;
53
+ }
54
+ &::-webkit-scrollbar-thumb:hover {
55
+ background: var(--dm-scrollbar-thumb-hover, rgba(0, 0, 0, 0.28));
56
+ }
57
+ }
58
+
59
+ // Inline decoration on the active `/query` range (highlight subtle).
60
+ .dm-slash-command-query {
61
+ color: var(--dm-accent, #2563eb);
62
+ }
63
+
64
+ // ---------------------------------------------------------------------------
65
+ // Group heading
66
+ // ---------------------------------------------------------------------------
67
+ .dm-slash-command-group-label {
68
+ padding: 0.375rem 0.5rem 0.125rem;
69
+ font-size: 0.6875rem;
70
+ font-weight: 600;
71
+ letter-spacing: 0.04em;
72
+ text-transform: uppercase;
73
+ color: var(--dm-muted, #999);
74
+ user-select: none;
75
+ }
76
+
77
+ .dm-slash-command-group {
78
+ display: flex;
79
+ flex-direction: column;
80
+ gap: 0.125rem;
81
+ }
82
+
83
+ // ---------------------------------------------------------------------------
84
+ // Menu item button
85
+ // ---------------------------------------------------------------------------
86
+ .dm-slash-command-item {
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 0.5rem;
90
+ width: 100%;
91
+ padding: 0.375rem 0.5rem;
92
+ border: none;
93
+ border-radius: var(--dm-button-border-radius, 0.375rem);
94
+ background: transparent;
95
+ color: var(--dm-editor-text, inherit);
96
+ text-align: left;
97
+ font: inherit;
98
+ cursor: pointer;
99
+ transition: background-color 0.1s;
100
+
101
+ // Selected state set imperatively by the renderer so keyboard and
102
+ // mouse selection share the same visual.
103
+ &[data-selected] {
104
+ background: var(--dm-button-hover-bg, rgba(0, 0, 0, 0.04));
105
+ }
106
+
107
+ &:focus-visible {
108
+ // INSET ring (-2px): slash items are tightly packed; outset would overlap
109
+ // the neighbour. Matches the context-menu item rule.
110
+ outline: 2px solid var(--dm-accent, #2563eb);
111
+ outline-offset: -2px;
112
+ }
113
+ }
114
+
115
+ .dm-slash-command-item-icon {
116
+ display: inline-flex;
117
+ align-items: center;
118
+ justify-content: center;
119
+ width: 1.25rem;
120
+ height: 1.25rem;
121
+ flex-shrink: 0;
122
+ color: var(--dm-editor-text, inherit);
123
+
124
+ svg {
125
+ width: 1.125rem;
126
+ height: 1.125rem;
127
+ }
128
+ }
129
+
130
+ .dm-slash-command-item-text {
131
+ display: flex;
132
+ flex-direction: column;
133
+ flex: 1;
134
+ min-width: 0;
135
+ line-height: 1.25;
136
+ }
137
+
138
+ .dm-slash-command-item-label {
139
+ font-size: 0.875rem;
140
+ font-weight: 500;
141
+ color: var(--dm-editor-text, inherit);
142
+ white-space: nowrap;
143
+ overflow: hidden;
144
+ text-overflow: ellipsis;
145
+ }
146
+
147
+ .dm-slash-command-item-description {
148
+ font-size: 0.75rem;
149
+ color: var(--dm-muted, #999);
150
+ white-space: nowrap;
151
+ overflow: hidden;
152
+ text-overflow: ellipsis;
153
+ }
154
+
155
+ // Shortcut hint chip (e.g. `# `, `> `)
156
+ .dm-slash-command-item-shortcut {
157
+ flex-shrink: 0;
158
+ padding: 0.0625rem 0.375rem;
159
+ font-family: var(--dm-code-font, ui-monospace, monospace);
160
+ font-size: 0.6875rem;
161
+ color: var(--dm-muted, #999);
162
+ background: var(--dm-surface, #f8f9fa);
163
+ border: 1px solid var(--dm-border-color, #e5e7eb);
164
+ border-radius: 0.25rem;
165
+ user-select: none;
166
+ }
167
+
168
+ // Shown when the filter returns no items
169
+ .dm-slash-command-empty {
170
+ padding: 0.5rem 0.75rem;
171
+ font-size: 0.8125rem;
172
+ color: var(--dm-muted, #999);
173
+ user-select: none;
174
+ }
@@ -5,7 +5,7 @@
5
5
  // above columns and beside rows. Clicking opens a dropdown with operations.
6
6
  // =============================================================================
7
7
 
8
- // Outer container holds handles + tableWrapper
8
+ // Outer container - holds handles + tableWrapper
9
9
  .dm-editor .dm-table-container {
10
10
  position: relative;
11
11
  }
@@ -54,7 +54,7 @@
54
54
  height: 24px;
55
55
  }
56
56
 
57
- // Cell handle small circle at cell corner (appears when cursor is in a cell)
57
+ // Cell handle - small circle at cell corner (appears when cursor is in a cell)
58
58
  .dm-table-cell-handle {
59
59
  position: absolute;
60
60
  z-index: 10;
@@ -277,7 +277,7 @@
277
277
  }
278
278
  }
279
279
 
280
- // Cell dropdown color palette
280
+ // Cell dropdown - color palette
281
281
  .dm-table-cell-dropdown {
282
282
  min-width: auto;
283
283
  width: max-content;
@@ -3,23 +3,38 @@
3
3
  // =============================================================================
4
4
  // TaskList renders as ul[data-type="taskList"]
5
5
  // TaskItem renders as li[data-type="taskItem"] with label > input[checkbox] + div
6
+ //
7
+ // Visual goal: render task items the same way bullet items render. The checkbox
8
+ // hangs in the padding-left area of the wrapper (like a native bullet marker)
9
+ // and the label paragraph starts at the same column as bullet-list text. This
10
+ // is achieved by giving the wrapper the same `padding-left: 1.5em` as <ul> and
11
+ // absolutely positioning the label so it visually replaces the bullet glyph.
6
12
  // =============================================================================
7
13
 
8
14
  .dm-editor .ProseMirror {
9
15
  ul[data-type="taskList"] {
10
16
  list-style: none;
11
- padding-left: 0;
17
+ padding-left: 1.5em;
12
18
 
13
19
  li[data-type="taskItem"] {
14
- display: flex;
15
- align-items: flex-start;
16
- gap: 0.5em;
20
+ position: relative;
21
+ margin: 0.25em 0;
17
22
 
18
23
  > label {
24
+ position: absolute;
25
+ // Position is driven by tokens (defined in `_variables.scss`):
26
+ // - `left` hangs the checkbox in the bullet column (paired with
27
+ // the wrapper's `padding-left: 1.5em` and the checkbox's
28
+ // 1em width, the right edge of the checkbox sits at
29
+ // `li.left - 0.25em` and text starts at `li.left`).
30
+ // - `top` aligns with the first text line's x-height, so the
31
+ // checkbox visually rests next to lower-case glyphs the way
32
+ // a bullet glyph does. Override the token alongside
33
+ // `--dm-editor-line-height` to keep alignment.
34
+ left: var(--dm-task-checkbox-left, -1.15em);
35
+ top: var(--dm-task-checkbox-top, 0.45em);
19
36
  display: flex;
20
37
  align-items: center;
21
- flex-shrink: 0;
22
- margin-top: 0.4em;
23
38
  user-select: none;
24
39
 
25
40
  input[type="checkbox"] {
@@ -33,16 +48,40 @@
33
48
  }
34
49
 
35
50
  > div {
36
- flex: 1;
37
- min-width: 0;
38
-
39
51
  > p {
40
- margin: 0;
52
+ // Small breathing gap (~5px at the editor's default font size)
53
+ // between the checkbox and the paragraph text, applied only on
54
+ // the paragraph so nested ul/ol siblings stay flush with li.left
55
+ // and visually align with bullet-list nesting.
56
+ margin: 0.1em 0;
57
+ padding-inline: 0.3em 0;
58
+ }
59
+
60
+ // Notion-style "children zone" indent: post-label blocks
61
+ // (heading, codeBlock, blockquote, etc.) render indented one
62
+ // level below the label paragraph aligned with the checkbox.
63
+ //
64
+ // Excluded: ALL nested `<ul>` and `<ol>` (plain and taskList).
65
+ // Each list type already gains the same visual indent through
66
+ // its own `padding-left: 1.5em`, so adding the children-zone
67
+ // margin would push nested taskLists ~1.5em further right than
68
+ // nested plain bullet lists. `margin-inline-start` (logical
69
+ // property) flips the indent to the right edge in RTL.
70
+ > :not(p:first-child):not(ul):not(ol) {
71
+ margin-inline-start: var(--dm-block-children-indent, 1.5rem);
72
+ margin-top: 0.25rem;
41
73
  }
42
74
  }
43
75
 
44
- // Checked state strikethrough and dimmed
45
- &[data-checked="true"] > div {
76
+ // Checked state: strikethrough and dim ONLY the label paragraph
77
+ // (the first child of the children-zone div). Targeting `> div`
78
+ // would propagate `text-decoration` and `opacity` into the
79
+ // entire children-zone subtree, including nested taskItems and
80
+ // children-zone notes paragraphs. Notion-style: checking a
81
+ // parent task marks ONLY that task's label, never bleeds into
82
+ // children. Schema enforces paragraph-as-first-child via
83
+ // `taskItem.content = 'paragraph block*'`.
84
+ &[data-checked="true"] > div > p:first-child {
46
85
  text-decoration: line-through;
47
86
  opacity: 0.6;
48
87
  }