@domternal/theme 0.2.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,176 @@
1
+ // =============================================================================
2
+ // ProseMirror Required Styles
3
+ // =============================================================================
4
+ // Bundles essential CSS from prosemirror-view, prosemirror-gapcursor, and
5
+ // prosemirror-tables. Scoped to .dm-editor with hardcoded colors replaced
6
+ // by CSS variables.
7
+ // =============================================================================
8
+
9
+ // ---------------------------------------------------------------------------
10
+ // prosemirror-view base
11
+ // ---------------------------------------------------------------------------
12
+
13
+ .dm-editor .ProseMirror {
14
+ position: relative;
15
+ word-wrap: break-word;
16
+ white-space: pre-wrap;
17
+ white-space: break-spaces;
18
+ -webkit-font-variant-ligatures: none;
19
+ font-variant-ligatures: none;
20
+ font-feature-settings: "liga" 0;
21
+ outline: none;
22
+ }
23
+
24
+ .dm-editor .ProseMirror pre {
25
+ white-space: pre-wrap;
26
+ }
27
+
28
+ .dm-editor .ProseMirror li {
29
+ position: relative;
30
+ }
31
+
32
+ // Selection hiding (ProseMirror internal)
33
+ .ProseMirror-hideselection *::selection {
34
+ background: transparent;
35
+ }
36
+
37
+ .ProseMirror-hideselection *::-moz-selection {
38
+ background: transparent;
39
+ }
40
+
41
+ .ProseMirror-hideselection {
42
+ caret-color: transparent;
43
+ }
44
+
45
+ // Draggable contenteditable false
46
+ .ProseMirror [draggable][contenteditable="false"] {
47
+ user-select: text;
48
+ }
49
+
50
+ // Selected node
51
+ .dm-editor .ProseMirror-selectednode {
52
+ outline: 2px solid var(--dm-accent, #2563eb);
53
+ }
54
+
55
+ .dm-editor li.ProseMirror-selectednode {
56
+ outline: none;
57
+ }
58
+
59
+ .dm-editor li.ProseMirror-selectednode::after {
60
+ content: "";
61
+ position: absolute;
62
+ left: -32px;
63
+ right: -2px;
64
+ top: -2px;
65
+ bottom: -2px;
66
+ border: 2px solid var(--dm-accent, #2563eb);
67
+ pointer-events: none;
68
+ }
69
+
70
+ // ProseMirror separator (internal)
71
+ img.ProseMirror-separator {
72
+ display: inline !important;
73
+ border: none !important;
74
+ margin: 0 !important;
75
+ }
76
+
77
+ // ---------------------------------------------------------------------------
78
+ // prosemirror-gapcursor
79
+ // ---------------------------------------------------------------------------
80
+
81
+ .dm-editor .ProseMirror-gapcursor {
82
+ display: none;
83
+ pointer-events: none;
84
+ position: absolute;
85
+ }
86
+
87
+ .dm-editor .ProseMirror-gapcursor::after {
88
+ content: "";
89
+ display: block;
90
+ position: absolute;
91
+ top: -2px;
92
+ width: 20px;
93
+ border-top: 1px solid var(--dm-editor-text, #1a1a1a);
94
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
95
+ }
96
+
97
+ @keyframes ProseMirror-cursor-blink {
98
+ to {
99
+ visibility: hidden;
100
+ }
101
+ }
102
+
103
+ .dm-editor .ProseMirror-focused .ProseMirror-gapcursor {
104
+ display: block;
105
+ }
106
+
107
+ // ---------------------------------------------------------------------------
108
+ // prosemirror-tables
109
+ // ---------------------------------------------------------------------------
110
+
111
+ .dm-editor .tableWrapper {
112
+ overflow-x: auto;
113
+ }
114
+
115
+ .dm-editor table {
116
+ border-collapse: collapse;
117
+ table-layout: fixed;
118
+ width: 100%;
119
+ overflow: hidden;
120
+ }
121
+
122
+ .dm-editor td,
123
+ .dm-editor th {
124
+ vertical-align: top;
125
+ box-sizing: border-box;
126
+ position: relative;
127
+ }
128
+
129
+ .dm-editor .column-resize-handle {
130
+ position: absolute;
131
+ right: -1.5px;
132
+ top: 0;
133
+ bottom: 0;
134
+ width: 2px;
135
+ z-index: 20;
136
+ background-color: var(--dm-accent, #2563eb);
137
+ pointer-events: none;
138
+ }
139
+
140
+ // Hide resize handle + cursor during non-resize mouse drag (cell/text selection).
141
+ // The dm-mouse-drag class is added by the Table extension's suppressor plugin.
142
+ .dm-editor .dm-mouse-drag .column-resize-handle {
143
+ display: none;
144
+ }
145
+
146
+ .dm-editor .ProseMirror.resize-cursor {
147
+ cursor: ew-resize;
148
+ cursor: col-resize;
149
+ }
150
+
151
+ .dm-editor .ProseMirror.resize-cursor.dm-mouse-drag {
152
+ cursor: auto;
153
+ }
154
+
155
+ .dm-editor .selectedCell {
156
+ &::after {
157
+ z-index: 2;
158
+ position: absolute;
159
+ content: "";
160
+ left: 0;
161
+ right: 0;
162
+ top: 0;
163
+ bottom: 0;
164
+ background: var(--dm-table-selected-bg, rgba(66, 133, 244, 0.15));
165
+ pointer-events: none;
166
+ }
167
+ }
168
+
169
+ // Hide native text selection inside selected cells — the ::after overlay is sufficient
170
+ .dm-editor .selectedCell,
171
+ .dm-editor .selectedCell * {
172
+ &::selection {
173
+ background: transparent !important;
174
+ color: inherit !important;
175
+ }
176
+ }
@@ -0,0 +1,101 @@
1
+ // =============================================================================
2
+ // Syntax Highlighting (CodeBlockLowlight)
3
+ // =============================================================================
4
+ // Colors for highlight.js CSS classes generated by the lowlight plugin.
5
+ // Semantic grouping follows GitHub's highlight.js theme.
6
+ // Customize via --dm-syntax-* variables on .dm-editor or a parent.
7
+ // =============================================================================
8
+
9
+ .dm-editor .ProseMirror pre code {
10
+ // Keywords, types, doctags
11
+ .hljs-doctag,
12
+ .hljs-keyword,
13
+ .hljs-meta .hljs-keyword,
14
+ .hljs-template-tag,
15
+ .hljs-template-variable,
16
+ .hljs-type,
17
+ .hljs-variable.language_ {
18
+ color: var(--dm-syntax-keyword);
19
+ }
20
+
21
+ // Function & class names
22
+ .hljs-title,
23
+ .hljs-title.class_,
24
+ .hljs-title.class_.inherited__,
25
+ .hljs-title.function_ {
26
+ color: var(--dm-syntax-entity);
27
+ }
28
+
29
+ // Constants, numbers, operators, attributes
30
+ .hljs-attr,
31
+ .hljs-attribute,
32
+ .hljs-literal,
33
+ .hljs-meta,
34
+ .hljs-number,
35
+ .hljs-operator,
36
+ .hljs-variable,
37
+ .hljs-selector-attr,
38
+ .hljs-selector-class,
39
+ .hljs-selector-id {
40
+ color: var(--dm-syntax-constant);
41
+ }
42
+
43
+ // Strings & regex
44
+ .hljs-regexp,
45
+ .hljs-string,
46
+ .hljs-meta .hljs-string {
47
+ color: var(--dm-syntax-string);
48
+ }
49
+
50
+ // Built-ins & symbols
51
+ .hljs-built_in,
52
+ .hljs-symbol {
53
+ color: var(--dm-syntax-variable);
54
+ }
55
+
56
+ // Comments
57
+ .hljs-comment,
58
+ .hljs-code,
59
+ .hljs-formula {
60
+ color: var(--dm-syntax-comment);
61
+ }
62
+
63
+ // HTML/XML tag names, selectors
64
+ .hljs-name,
65
+ .hljs-quote,
66
+ .hljs-selector-tag,
67
+ .hljs-selector-pseudo {
68
+ color: var(--dm-syntax-tag);
69
+ }
70
+
71
+ // Markup headings
72
+ .hljs-section {
73
+ color: var(--dm-syntax-constant);
74
+ font-weight: bold;
75
+ }
76
+
77
+ // Markup lists
78
+ .hljs-bullet {
79
+ color: var(--dm-syntax-tag);
80
+ }
81
+
82
+ // Diff additions & deletions
83
+ .hljs-addition {
84
+ color: var(--dm-syntax-addition);
85
+ background-color: var(--dm-syntax-addition-bg);
86
+ }
87
+
88
+ .hljs-deletion {
89
+ color: var(--dm-syntax-deletion);
90
+ background-color: var(--dm-syntax-deletion-bg);
91
+ }
92
+
93
+ // Text formatting
94
+ .hljs-emphasis {
95
+ font-style: italic;
96
+ }
97
+
98
+ .hljs-strong {
99
+ font-weight: bold;
100
+ }
101
+ }
@@ -0,0 +1,271 @@
1
+ // =============================================================================
2
+ // Table Row/Column Controls
3
+ // =============================================================================
4
+ // Hover controls for table rows and columns. Shows "..." handle buttons
5
+ // above columns and beside rows. Clicking opens a dropdown with operations.
6
+ // =============================================================================
7
+
8
+ // Outer container — holds handles + tableWrapper
9
+ .dm-editor .dm-table-container {
10
+ position: relative;
11
+ }
12
+
13
+ // Handle buttons (col, row)
14
+ .dm-table-col-handle,
15
+ .dm-table-row-handle {
16
+ position: absolute;
17
+ z-index: 10;
18
+ display: none;
19
+ align-items: center;
20
+ justify-content: center;
21
+ border: 1px solid var(--dm-border-color, #e0e0e0);
22
+ border-radius: 4px;
23
+ background: var(--dm-bg, #ffffff);
24
+ color: var(--dm-muted, #999999);
25
+ cursor: pointer;
26
+ padding: 0;
27
+ transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
28
+
29
+ &:hover {
30
+ background: var(--dm-hover, rgba(0, 0, 0, 0.06));
31
+ color: var(--dm-text, #1a1a1a);
32
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
33
+ }
34
+
35
+ svg {
36
+ display: block;
37
+ }
38
+ }
39
+
40
+ // Column handle (horizontal dots, above column)
41
+ .dm-table-col-handle {
42
+ width: 24px;
43
+ height: 14px;
44
+ }
45
+
46
+ // Row handle (vertical dots, left of row)
47
+ .dm-table-row-handle {
48
+ width: 14px;
49
+ height: 24px;
50
+ }
51
+
52
+ // Cell handle — small circle at cell corner (appears when cursor is in a cell)
53
+ .dm-table-cell-handle {
54
+ position: absolute;
55
+ z-index: 10;
56
+ display: none;
57
+ align-items: center;
58
+ justify-content: center;
59
+ width: 14px;
60
+ height: 14px;
61
+ border: 1px solid var(--dm-accent, #2563eb);
62
+ border-radius: 50%;
63
+ background: var(--dm-bg, #ffffff);
64
+ color: var(--dm-accent, #2563eb);
65
+ cursor: pointer;
66
+ padding: 0;
67
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
68
+ transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
69
+
70
+ &:hover {
71
+ background: var(--dm-accent, #2563eb);
72
+ color: #fff;
73
+ border-color: var(--dm-accent, #2563eb);
74
+ box-shadow: 0 1px 4px color-mix(in srgb, var(--dm-accent, #2563eb) 30%, transparent);
75
+ }
76
+
77
+ svg {
78
+ display: block;
79
+ width: 8px;
80
+ height: 8px;
81
+ }
82
+ }
83
+
84
+ // ─── Cell toolbar (floating strip above selected cells) ─────────────────────
85
+ .dm-table-cell-toolbar {
86
+ position: absolute;
87
+ z-index: 10;
88
+ display: none;
89
+ align-items: center;
90
+ gap: 2px;
91
+ padding: 2px;
92
+ border: 1px solid var(--dm-border-color, #e0e0e0);
93
+ border-radius: 6px;
94
+ background: var(--dm-bg, #ffffff);
95
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
96
+ animation: dm-fade-in 0.12s ease;
97
+ }
98
+
99
+ .dm-table-cell-toolbar-btn {
100
+ display: flex;
101
+ align-items: center;
102
+ gap: 1px;
103
+ padding: 4px 5px;
104
+ border: none;
105
+ border-radius: 4px;
106
+ background: transparent;
107
+ color: var(--dm-text, #1a1a1a);
108
+ cursor: pointer;
109
+ transition: background-color 0.15s, color 0.15s;
110
+
111
+ &:hover,
112
+ &.dm-table-cell-toolbar-btn--open {
113
+ background: var(--dm-hover, rgba(0, 0, 0, 0.06));
114
+ }
115
+
116
+ &--active {
117
+ color: var(--dm-accent, #2563eb);
118
+ background: var(--dm-accent-surface, rgba(37, 99, 235, 0.1));
119
+ }
120
+
121
+ &:disabled {
122
+ opacity: 0.3;
123
+ cursor: default;
124
+ pointer-events: none;
125
+ }
126
+
127
+ svg {
128
+ display: block;
129
+ flex-shrink: 0;
130
+ }
131
+ }
132
+
133
+ .dm-table-cell-toolbar-chevron {
134
+ display: flex;
135
+ align-items: center;
136
+ }
137
+
138
+ .dm-table-cell-toolbar-sep {
139
+ width: 1px;
140
+ height: 16px;
141
+ margin: 0 2px;
142
+ background: var(--dm-border-color, #e0e0e0);
143
+ }
144
+
145
+ // ─── Alignment dropdown ─────────────────────────────────────────────────────
146
+ // Scoped under .dm-table-cell-align-dropdown so specificity (0,2,0) beats the
147
+ // generic .dm-table-controls-dropdown > button rule (0,1,1).
148
+ .dm-table-cell-align-dropdown {
149
+ min-width: auto;
150
+ width: max-content;
151
+ padding: 0.25rem;
152
+
153
+ .dm-table-align-item {
154
+ display: flex;
155
+ align-items: center;
156
+ gap: 0.5rem;
157
+ width: 100%;
158
+ padding: 0.3rem 0.5rem;
159
+ border: none;
160
+ border-radius: 0.25rem;
161
+ background: transparent;
162
+ color: var(--dm-text, #1a1a1a);
163
+ cursor: pointer;
164
+ font-size: 0.8125rem;
165
+ white-space: nowrap;
166
+ transition: background-color 0.15s, color 0.15s;
167
+
168
+ &:hover {
169
+ background: var(--dm-hover, rgba(0, 0, 0, 0.06));
170
+ }
171
+
172
+ &--active {
173
+ color: var(--dm-accent, #2563eb);
174
+ background: var(--dm-accent-surface, rgba(37, 99, 235, 0.1));
175
+ }
176
+ }
177
+
178
+ .dm-table-align-item-icon {
179
+ display: flex;
180
+ align-items: center;
181
+
182
+ svg {
183
+ display: block;
184
+ }
185
+ }
186
+ }
187
+
188
+ // ─── Cell alignment via data attributes ─────────────────────────────────────
189
+ // Scoped under .ProseMirror table to beat the content rule
190
+ // .dm-editor .ProseMirror table th { text-align: left } (specificity 0,2,2).
191
+ .dm-editor .ProseMirror table {
192
+ td, th {
193
+ &[data-text-align='center'] { text-align: center; }
194
+ &[data-text-align='right'] { text-align: right; }
195
+ &[data-vertical-align='middle'] { vertical-align: middle; }
196
+ &[data-vertical-align='bottom'] { vertical-align: bottom; }
197
+ }
198
+ }
199
+
200
+ // ─── Focused cell highlight (cursor is inside this cell) ─────────────────────
201
+ .dm-editor td.dm-cell-focused,
202
+ .dm-editor th.dm-cell-focused {
203
+ outline: 1px solid var(--dm-accent, #2563eb);
204
+ outline-offset: -1px;
205
+ }
206
+
207
+ // Dropdown panel
208
+ .dm-table-controls-dropdown {
209
+ position: absolute;
210
+ z-index: 50;
211
+ display: flex;
212
+ flex-direction: column;
213
+ gap: 0.125rem;
214
+ min-width: 10rem;
215
+ padding: 0.25rem;
216
+ background: var(--dm-bg, #fff);
217
+ border: 1px solid var(--dm-border-color, #e5e7eb);
218
+ border-radius: 0.5rem;
219
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
220
+ animation: dm-fade-in 0.2s ease;
221
+
222
+ > button {
223
+ display: flex;
224
+ align-items: center;
225
+ gap: 0.375rem;
226
+ width: 100%;
227
+ padding: 0.375rem 0.5rem;
228
+ border: none;
229
+ border-radius: var(--dm-button-border-radius);
230
+ background: transparent;
231
+ color: var(--dm-button-color);
232
+ cursor: pointer;
233
+ font-size: 0.8125rem;
234
+ line-height: 1.4;
235
+ text-align: left;
236
+ white-space: nowrap;
237
+ transition: background-color 0.15s;
238
+
239
+ &:hover {
240
+ background: var(--dm-button-hover-bg);
241
+ }
242
+ }
243
+ }
244
+
245
+ .dm-table-controls-dropdown-icon {
246
+ display: flex;
247
+ align-items: center;
248
+ color: var(--dm-icon, #666);
249
+
250
+ svg {
251
+ display: block;
252
+ }
253
+ }
254
+
255
+ // Cell dropdown — color palette
256
+ .dm-table-cell-dropdown {
257
+ min-width: auto;
258
+ width: max-content;
259
+ padding: 0;
260
+ border-radius: 0.75rem;
261
+
262
+ .dm-color-palette {
263
+ padding: 0.5rem;
264
+ }
265
+ }
266
+
267
+ .dm-table-cell-dropdown-separator {
268
+ height: 1px;
269
+ background: var(--dm-border-color, #e0e0e0);
270
+ margin: 0.25rem 0;
271
+ }
@@ -0,0 +1,51 @@
1
+ // =============================================================================
2
+ // Task List Styles
3
+ // =============================================================================
4
+ // TaskList renders as ul[data-type="taskList"]
5
+ // TaskItem renders as li[data-type="taskItem"] with label > input[checkbox] + div
6
+ // =============================================================================
7
+
8
+ .dm-editor .ProseMirror {
9
+ ul[data-type="taskList"] {
10
+ list-style: none;
11
+ padding-left: 0;
12
+
13
+ li[data-type="taskItem"] {
14
+ display: flex;
15
+ align-items: flex-start;
16
+ gap: 0.5em;
17
+
18
+ > label {
19
+ display: flex;
20
+ align-items: center;
21
+ flex-shrink: 0;
22
+ margin-top: 0.4em;
23
+ user-select: none;
24
+
25
+ input[type="checkbox"] {
26
+ width: 1em;
27
+ height: 1em;
28
+ margin: 0;
29
+ padding: 0;
30
+ cursor: pointer;
31
+ accent-color: var(--dm-accent, #2563eb);
32
+ }
33
+ }
34
+
35
+ > div {
36
+ flex: 1;
37
+ min-width: 0;
38
+
39
+ > p {
40
+ margin: 0;
41
+ }
42
+ }
43
+
44
+ // Checked state — strikethrough and dimmed
45
+ &[data-checked="true"] > div {
46
+ text-decoration: line-through;
47
+ opacity: 0.6;
48
+ }
49
+ }
50
+ }
51
+ }