@noirmd/previewer 1.1.1 → 1.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.
- package/dist/NReditor.cjs +139 -58
- package/dist/NReditor.cjs.map +1 -1
- package/dist/NReditor.d.cts +5 -0
- package/dist/NReditor.d.ts +5 -0
- package/dist/NReditor.js +124 -43
- package/dist/NReditor.js.map +1 -1
- package/dist/editor.css +179 -0
- package/editor.css +179 -0
- package/package.json +4 -2
package/dist/editor.css
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/* ============================================================
|
|
2
|
+
NoirMD Editor CSS
|
|
3
|
+
|
|
4
|
+
Self-contained styles for the CodeMirror-based editor
|
|
5
|
+
(toolbar, fold toggle, mode buttons, split layout).
|
|
6
|
+
|
|
7
|
+
Pure CSS — no Tailwind dependency. Every rule uses CSS
|
|
8
|
+
variables with reference-palette fallbacks, so the host's
|
|
9
|
+
theme wins when defined and the editor still looks right
|
|
10
|
+
when it isn't.
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
import '@noirmd/previewer/editor.css';
|
|
14
|
+
============================================================ */
|
|
15
|
+
|
|
16
|
+
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block');
|
|
17
|
+
|
|
18
|
+
/* ── Editor root layout ───────────────────────────────────── */
|
|
19
|
+
|
|
20
|
+
.nr-editor {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
flex: 1 1 0%;
|
|
25
|
+
min-height: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ── Toolbar ──────────────────────────────────────────────── */
|
|
29
|
+
|
|
30
|
+
.nr-editor-toolbar {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
padding: 0.25rem 0.5rem;
|
|
35
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-border, #334155) 50%, transparent);
|
|
36
|
+
background-color: color-mix(in srgb, var(--color-background-secondary-solid, #1e293b) 60%, transparent);
|
|
37
|
+
border-radius: 16px 16px 0 0;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nr-editor-toolbar-left,
|
|
42
|
+
.nr-editor-toolbar-right {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.nr-toolbar-btn {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 0.25rem;
|
|
52
|
+
padding: 0.25rem 0.5rem;
|
|
53
|
+
font-size: 0.75rem;
|
|
54
|
+
border-radius: 0.375rem;
|
|
55
|
+
transition: all 0.2s;
|
|
56
|
+
color: var(--color-text-secondary, #94a3b8);
|
|
57
|
+
background: transparent;
|
|
58
|
+
border: none;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
font-family: inherit;
|
|
62
|
+
}
|
|
63
|
+
.nr-toolbar-btn:hover {
|
|
64
|
+
color: var(--color-text-primary, #e2e8f0);
|
|
65
|
+
background-color: color-mix(in srgb, var(--color-accent-primary, #38bdf8) 10%, transparent);
|
|
66
|
+
}
|
|
67
|
+
.nr-toolbar-btn:active {
|
|
68
|
+
transform: scale(0.96);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.nr-toolbar-btn .nr-toolbar-label {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
@media (min-width: 640px) {
|
|
75
|
+
.nr-toolbar-btn .nr-toolbar-label {
|
|
76
|
+
display: inline;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Fold (collapse all) button */
|
|
81
|
+
.nr-toolbar-btn-fold {
|
|
82
|
+
padding: 0.25rem;
|
|
83
|
+
}
|
|
84
|
+
.nr-toolbar-btn-fold .material-symbols-rounded {
|
|
85
|
+
font-size: 15px;
|
|
86
|
+
}
|
|
87
|
+
.nr-toolbar-btn-fold:hover {
|
|
88
|
+
color: var(--color-accent-primary, #38bdf8);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Mode group — Editor / Split / Preview */
|
|
92
|
+
.nr-toolbar-mode-group {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 0.125rem;
|
|
96
|
+
padding: 0.125rem;
|
|
97
|
+
border-radius: 0.5rem;
|
|
98
|
+
background-color: color-mix(in srgb, var(--color-base, #0f172a) 40%, transparent);
|
|
99
|
+
}
|
|
100
|
+
.nr-toolbar-btn-mode {
|
|
101
|
+
padding: 0.125rem 0.375rem;
|
|
102
|
+
font-size: 11px;
|
|
103
|
+
border-radius: 0.375rem;
|
|
104
|
+
gap: 0.25rem;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
}
|
|
107
|
+
.nr-toolbar-btn-mode .material-symbols-rounded {
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
}
|
|
110
|
+
.nr-toolbar-btn-mode--active {
|
|
111
|
+
color: var(--color-accent-primary, #38bdf8);
|
|
112
|
+
background-color: color-mix(in srgb, var(--color-accent-primary, #38bdf8) 20%, transparent);
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
}
|
|
115
|
+
@media (max-width: 639px) {
|
|
116
|
+
.nr-toolbar-btn-split {
|
|
117
|
+
display: none !important;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Right-side small buttons (Guía / Configurar) */
|
|
122
|
+
.nr-toolbar-btn-sm {
|
|
123
|
+
padding: 0.125rem 0.375rem;
|
|
124
|
+
font-size: 11px;
|
|
125
|
+
gap: 0.25rem;
|
|
126
|
+
font-weight: 500;
|
|
127
|
+
}
|
|
128
|
+
.nr-toolbar-btn-sm .material-symbols-rounded {
|
|
129
|
+
font-size: 13px;
|
|
130
|
+
}
|
|
131
|
+
.nr-toolbar-btn-guide:hover,
|
|
132
|
+
.nr-toolbar-btn-config:hover {
|
|
133
|
+
color: var(--color-accent-primary, #38bdf8);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Vertical divider */
|
|
137
|
+
.nr-toolbar-divider {
|
|
138
|
+
width: 1px;
|
|
139
|
+
height: 16px;
|
|
140
|
+
margin: 0 2px;
|
|
141
|
+
background-color: color-mix(in srgb, var(--color-border, #334155) 60%, transparent);
|
|
142
|
+
flex-shrink: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* ── Content area — editor / split / preview ──────────────── */
|
|
146
|
+
|
|
147
|
+
.nr-editor-body {
|
|
148
|
+
display: flex;
|
|
149
|
+
flex: 1 1 0%;
|
|
150
|
+
min-height: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.nr-editor-pane {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
flex: 1 1 0%;
|
|
157
|
+
min-width: 0;
|
|
158
|
+
min-height: 0;
|
|
159
|
+
}
|
|
160
|
+
.nr-editor-pane--half {
|
|
161
|
+
width: 50%;
|
|
162
|
+
border-right: 1px solid color-mix(in srgb, var(--color-border, #334155) 30%, transparent);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.nr-editor-preview {
|
|
166
|
+
flex: 1 1 0%;
|
|
167
|
+
min-width: 0;
|
|
168
|
+
min-height: 0;
|
|
169
|
+
overflow: auto;
|
|
170
|
+
}
|
|
171
|
+
.nr-editor-preview--half {
|
|
172
|
+
width: 50%;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.nr-editor-prose {
|
|
176
|
+
height: 100%;
|
|
177
|
+
overflow: auto;
|
|
178
|
+
padding: 1rem;
|
|
179
|
+
}
|
package/editor.css
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/* ============================================================
|
|
2
|
+
NoirMD Editor CSS
|
|
3
|
+
|
|
4
|
+
Self-contained styles for the CodeMirror-based editor
|
|
5
|
+
(toolbar, fold toggle, mode buttons, split layout).
|
|
6
|
+
|
|
7
|
+
Pure CSS — no Tailwind dependency. Every rule uses CSS
|
|
8
|
+
variables with reference-palette fallbacks, so the host's
|
|
9
|
+
theme wins when defined and the editor still looks right
|
|
10
|
+
when it isn't.
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
import '@noirmd/previewer/editor.css';
|
|
14
|
+
============================================================ */
|
|
15
|
+
|
|
16
|
+
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block');
|
|
17
|
+
|
|
18
|
+
/* ── Editor root layout ───────────────────────────────────── */
|
|
19
|
+
|
|
20
|
+
.nr-editor {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
flex: 1 1 0%;
|
|
25
|
+
min-height: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ── Toolbar ──────────────────────────────────────────────── */
|
|
29
|
+
|
|
30
|
+
.nr-editor-toolbar {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
padding: 0.25rem 0.5rem;
|
|
35
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-border, #334155) 50%, transparent);
|
|
36
|
+
background-color: color-mix(in srgb, var(--color-background-secondary-solid, #1e293b) 60%, transparent);
|
|
37
|
+
border-radius: 16px 16px 0 0;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nr-editor-toolbar-left,
|
|
42
|
+
.nr-editor-toolbar-right {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.nr-toolbar-btn {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 0.25rem;
|
|
52
|
+
padding: 0.25rem 0.5rem;
|
|
53
|
+
font-size: 0.75rem;
|
|
54
|
+
border-radius: 0.375rem;
|
|
55
|
+
transition: all 0.2s;
|
|
56
|
+
color: var(--color-text-secondary, #94a3b8);
|
|
57
|
+
background: transparent;
|
|
58
|
+
border: none;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
font-family: inherit;
|
|
62
|
+
}
|
|
63
|
+
.nr-toolbar-btn:hover {
|
|
64
|
+
color: var(--color-text-primary, #e2e8f0);
|
|
65
|
+
background-color: color-mix(in srgb, var(--color-accent-primary, #38bdf8) 10%, transparent);
|
|
66
|
+
}
|
|
67
|
+
.nr-toolbar-btn:active {
|
|
68
|
+
transform: scale(0.96);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.nr-toolbar-btn .nr-toolbar-label {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
@media (min-width: 640px) {
|
|
75
|
+
.nr-toolbar-btn .nr-toolbar-label {
|
|
76
|
+
display: inline;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Fold (collapse all) button */
|
|
81
|
+
.nr-toolbar-btn-fold {
|
|
82
|
+
padding: 0.25rem;
|
|
83
|
+
}
|
|
84
|
+
.nr-toolbar-btn-fold .material-symbols-rounded {
|
|
85
|
+
font-size: 15px;
|
|
86
|
+
}
|
|
87
|
+
.nr-toolbar-btn-fold:hover {
|
|
88
|
+
color: var(--color-accent-primary, #38bdf8);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Mode group — Editor / Split / Preview */
|
|
92
|
+
.nr-toolbar-mode-group {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 0.125rem;
|
|
96
|
+
padding: 0.125rem;
|
|
97
|
+
border-radius: 0.5rem;
|
|
98
|
+
background-color: color-mix(in srgb, var(--color-base, #0f172a) 40%, transparent);
|
|
99
|
+
}
|
|
100
|
+
.nr-toolbar-btn-mode {
|
|
101
|
+
padding: 0.125rem 0.375rem;
|
|
102
|
+
font-size: 11px;
|
|
103
|
+
border-radius: 0.375rem;
|
|
104
|
+
gap: 0.25rem;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
}
|
|
107
|
+
.nr-toolbar-btn-mode .material-symbols-rounded {
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
}
|
|
110
|
+
.nr-toolbar-btn-mode--active {
|
|
111
|
+
color: var(--color-accent-primary, #38bdf8);
|
|
112
|
+
background-color: color-mix(in srgb, var(--color-accent-primary, #38bdf8) 20%, transparent);
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
}
|
|
115
|
+
@media (max-width: 639px) {
|
|
116
|
+
.nr-toolbar-btn-split {
|
|
117
|
+
display: none !important;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Right-side small buttons (Guía / Configurar) */
|
|
122
|
+
.nr-toolbar-btn-sm {
|
|
123
|
+
padding: 0.125rem 0.375rem;
|
|
124
|
+
font-size: 11px;
|
|
125
|
+
gap: 0.25rem;
|
|
126
|
+
font-weight: 500;
|
|
127
|
+
}
|
|
128
|
+
.nr-toolbar-btn-sm .material-symbols-rounded {
|
|
129
|
+
font-size: 13px;
|
|
130
|
+
}
|
|
131
|
+
.nr-toolbar-btn-guide:hover,
|
|
132
|
+
.nr-toolbar-btn-config:hover {
|
|
133
|
+
color: var(--color-accent-primary, #38bdf8);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Vertical divider */
|
|
137
|
+
.nr-toolbar-divider {
|
|
138
|
+
width: 1px;
|
|
139
|
+
height: 16px;
|
|
140
|
+
margin: 0 2px;
|
|
141
|
+
background-color: color-mix(in srgb, var(--color-border, #334155) 60%, transparent);
|
|
142
|
+
flex-shrink: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* ── Content area — editor / split / preview ──────────────── */
|
|
146
|
+
|
|
147
|
+
.nr-editor-body {
|
|
148
|
+
display: flex;
|
|
149
|
+
flex: 1 1 0%;
|
|
150
|
+
min-height: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.nr-editor-pane {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
flex: 1 1 0%;
|
|
157
|
+
min-width: 0;
|
|
158
|
+
min-height: 0;
|
|
159
|
+
}
|
|
160
|
+
.nr-editor-pane--half {
|
|
161
|
+
width: 50%;
|
|
162
|
+
border-right: 1px solid color-mix(in srgb, var(--color-border, #334155) 30%, transparent);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.nr-editor-preview {
|
|
166
|
+
flex: 1 1 0%;
|
|
167
|
+
min-width: 0;
|
|
168
|
+
min-height: 0;
|
|
169
|
+
overflow: auto;
|
|
170
|
+
}
|
|
171
|
+
.nr-editor-preview--half {
|
|
172
|
+
width: 50%;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.nr-editor-prose {
|
|
176
|
+
height: 100%;
|
|
177
|
+
overflow: auto;
|
|
178
|
+
padding: 1rem;
|
|
179
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noirmd/previewer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Framework-agnostic markdown parser with React renderer, directives, cards, modals, and Tailwind styling",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -44,11 +44,13 @@
|
|
|
44
44
|
"require": "./dist/NReditor.cjs",
|
|
45
45
|
"default": "./dist/NReditor.js"
|
|
46
46
|
},
|
|
47
|
+
"./editor.css": "./dist/editor.css",
|
|
47
48
|
"./markdown.css": "./markdown.css"
|
|
48
49
|
},
|
|
49
50
|
"files": [
|
|
50
51
|
"dist",
|
|
51
|
-
"markdown.css"
|
|
52
|
+
"markdown.css",
|
|
53
|
+
"editor.css"
|
|
52
54
|
],
|
|
53
55
|
"scripts": {
|
|
54
56
|
"build": "tsup",
|