@noirmd/previewer 1.1.1 → 2.0.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.
Files changed (53) hide show
  1. package/dist/NReditor.cjs +950 -913
  2. package/dist/NReditor.cjs.map +1 -1
  3. package/dist/NReditor.d.cts +6 -1
  4. package/dist/NReditor.d.ts +6 -1
  5. package/dist/NReditor.js +951 -914
  6. package/dist/NReditor.js.map +1 -1
  7. package/dist/admonition.css +55 -0
  8. package/dist/{markdown.css → base.css} +96 -126
  9. package/dist/blockquote.css +16 -0
  10. package/dist/button.css +32 -0
  11. package/dist/card.css +143 -0
  12. package/dist/codeblock.css +59 -0
  13. package/dist/core.cjs +9 -1
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.js +9 -1
  16. package/dist/core.js.map +1 -1
  17. package/dist/details.css +45 -0
  18. package/dist/editor.css +226 -0
  19. package/dist/fonts/material-icons-round.woff2 +0 -0
  20. package/dist/index.cjs +852 -883
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +41 -70
  23. package/dist/index.d.ts +41 -70
  24. package/dist/index.js +851 -877
  25. package/dist/index.js.map +1 -1
  26. package/dist/list.css +18 -0
  27. package/dist/modal.css +82 -0
  28. package/dist/react.cjs +852 -886
  29. package/dist/react.cjs.map +1 -1
  30. package/dist/react.d.cts +44 -73
  31. package/dist/react.d.ts +44 -73
  32. package/dist/react.js +851 -880
  33. package/dist/react.js.map +1 -1
  34. package/dist/slide.css +21 -0
  35. package/dist/table.css +36 -0
  36. package/dist/toc.css +45 -0
  37. package/dist/vanilla.cjs +42 -28
  38. package/dist/vanilla.cjs.map +1 -1
  39. package/dist/vanilla.css +32 -677
  40. package/dist/vanilla.d.cts +8 -2
  41. package/dist/vanilla.d.ts +8 -2
  42. package/dist/vanilla.js +41 -28
  43. package/dist/vanilla.js.map +1 -1
  44. package/dist/variables.css +53 -0
  45. package/dist/vue.cjs +931 -1121
  46. package/dist/vue.cjs.map +1 -1
  47. package/dist/vue.d.cts +63 -214
  48. package/dist/vue.d.ts +63 -214
  49. package/dist/vue.js +930 -1120
  50. package/dist/vue.js.map +1 -1
  51. package/editor.css +226 -0
  52. package/package.json +6 -9
  53. package/markdown.css +0 -344
package/editor.css ADDED
@@ -0,0 +1,226 @@
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
+ /* ── Material Icons Round (self-hosted) ────────────────────
17
+ Toolbar buttons render icons via `material-icons-round`
18
+ ligatures. Self-hosted so icons work offline and without
19
+ host dependencies. */
20
+
21
+ @font-face {
22
+ font-family: 'Material Icons Round';
23
+ font-style: normal;
24
+ font-weight: 400;
25
+ font-display: block;
26
+ src: url('./fonts/material-icons-round.woff2') format('woff2');
27
+ }
28
+
29
+ .material-icons-round {
30
+ font-family: 'Material Icons Round';
31
+ font-weight: 400;
32
+ font-style: normal;
33
+ font-size: 24px;
34
+ line-height: 1;
35
+ letter-spacing: normal;
36
+ text-transform: none;
37
+ display: inline-block;
38
+ white-space: nowrap;
39
+ word-wrap: normal;
40
+ direction: ltr;
41
+ font-feature-settings: 'liga';
42
+ -webkit-font-smoothing: antialiased;
43
+ }
44
+
45
+ /* ── Editor root layout ───────────────────────────────────── */
46
+
47
+ .nr-editor {
48
+ position: relative;
49
+ display: flex;
50
+ flex-direction: column;
51
+ flex: 1 1 auto;
52
+ height: auto;
53
+ min-height: var(--nr-editor-min-height, 300px);
54
+ }
55
+
56
+ /* ── Toolbar ──────────────────────────────────────────────── */
57
+
58
+ .nr-editor-toolbar {
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: space-between;
62
+ padding: 0.25rem 0.5rem;
63
+ border-bottom: 1px solid color-mix(in srgb, var(--color-border, #334155) 50%, transparent);
64
+ background-color: color-mix(in srgb, var(--color-background-secondary-solid, #1e293b) 60%, transparent);
65
+ border-radius: 16px 16px 0 0;
66
+ flex-shrink: 0;
67
+ }
68
+
69
+ .nr-editor-toolbar-left,
70
+ .nr-editor-toolbar-right {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 0;
74
+ }
75
+
76
+ .nr-toolbar-btn {
77
+ display: flex;
78
+ align-items: center;
79
+ gap: 0.25rem;
80
+ padding: 0.25rem 0.5rem;
81
+ font-size: 0.75rem;
82
+ border-radius: 0.375rem;
83
+ transition: all 0.2s;
84
+ color: var(--color-text-secondary, #94a3b8);
85
+ background: transparent;
86
+ border: none;
87
+ cursor: pointer;
88
+ font-weight: 500;
89
+ font-family: inherit;
90
+ }
91
+ .nr-toolbar-btn:hover {
92
+ color: var(--color-text-primary, #e2e8f0);
93
+ background-color: color-mix(in srgb, var(--color-accent-primary, #38bdf8) 10%, transparent);
94
+ }
95
+ .nr-toolbar-btn:active {
96
+ transform: scale(0.96);
97
+ }
98
+
99
+ .nr-toolbar-btn .nr-toolbar-label {
100
+ display: none;
101
+ }
102
+ @media (min-width: 640px) {
103
+ .nr-toolbar-btn .nr-toolbar-label {
104
+ display: inline;
105
+ }
106
+ }
107
+
108
+ /* Fold (collapse all) button */
109
+ .nr-toolbar-btn-fold {
110
+ padding: 0.25rem;
111
+ }
112
+ .nr-toolbar-btn-fold .material-icons-round {
113
+ font-size: 15px;
114
+ }
115
+ .nr-toolbar-btn-fold:hover {
116
+ color: var(--color-accent-primary, #38bdf8);
117
+ }
118
+
119
+ /* Mode group — Editor / Split / Preview */
120
+ .nr-toolbar-mode-group {
121
+ display: flex;
122
+ align-items: center;
123
+ gap: 0.125rem;
124
+ padding: 0.125rem;
125
+ border-radius: 0.5rem;
126
+ background-color: color-mix(in srgb, var(--color-base, #0f172a) 40%, transparent);
127
+ }
128
+ .nr-toolbar-btn-mode {
129
+ padding: 0.125rem 0.375rem;
130
+ font-size: 11px;
131
+ border-radius: 0.375rem;
132
+ gap: 0.25rem;
133
+ font-weight: 500;
134
+ }
135
+ .nr-toolbar-btn-mode .material-icons-round {
136
+ font-size: 13px;
137
+ }
138
+ .nr-toolbar-btn-mode--active {
139
+ color: var(--color-accent-primary, #38bdf8);
140
+ background-color: color-mix(in srgb, var(--color-accent-primary, #38bdf8) 20%, transparent);
141
+ font-weight: 600;
142
+ }
143
+ @media (max-width: 639px) {
144
+ .nr-toolbar-btn-split {
145
+ display: none !important;
146
+ }
147
+ }
148
+
149
+ /* Right-side small buttons (Guía / Configurar) */
150
+ .nr-toolbar-btn-sm {
151
+ padding: 0.125rem 0.375rem;
152
+ font-size: 11px;
153
+ gap: 0.25rem;
154
+ font-weight: 500;
155
+ }
156
+ .nr-toolbar-btn-sm .material-icons-round {
157
+ font-size: 13px;
158
+ }
159
+ .nr-toolbar-btn-guide:hover,
160
+ .nr-toolbar-btn-config:hover {
161
+ color: var(--color-accent-primary, #38bdf8);
162
+ }
163
+
164
+ /* Vertical divider */
165
+ .nr-toolbar-divider {
166
+ width: 1px;
167
+ height: 16px;
168
+ margin: 0 2px;
169
+ background-color: color-mix(in srgb, var(--color-border, #334155) 60%, transparent);
170
+ flex-shrink: 0;
171
+ }
172
+
173
+ /* ── Content area — editor / split / preview ──────────────── */
174
+
175
+ .nr-editor-body {
176
+ display: flex;
177
+ flex: 1 1 auto;
178
+ min-height: 0;
179
+ }
180
+
181
+ .nr-editor-pane {
182
+ display: flex;
183
+ flex-direction: column;
184
+ flex: 1 1 auto;
185
+ min-width: 0;
186
+ min-height: 0;
187
+ }
188
+ .nr-editor-pane--half {
189
+ width: 50%;
190
+ border-right: 1px solid color-mix(in srgb, var(--color-border, #334155) 30%, transparent);
191
+ }
192
+
193
+ /* CodeMirror grows with its content — no fixed height. The uiw wrapper
194
+ is a plain block with no height of its own, so let the whole chain
195
+ size to the content and the root `min-height` (--nr-editor-min-height)
196
+ guarantees the editor never collapses. Self-contained: works in any
197
+ host, no Tailwind required. */
198
+ .nr-editor-pane .cm-theme {
199
+ display: flex;
200
+ flex-direction: column;
201
+ flex: 1 1 auto;
202
+ height: auto;
203
+ min-width: 0;
204
+ min-height: 0;
205
+ }
206
+ .nr-editor-pane .cm-editor {
207
+ flex: 1 1 auto;
208
+ height: auto;
209
+ min-height: 0;
210
+ }
211
+
212
+ .nr-editor-preview {
213
+ flex: 1 1 auto;
214
+ min-width: 0;
215
+ min-height: 0;
216
+ overflow: auto;
217
+ }
218
+ .nr-editor-preview--half {
219
+ width: 50%;
220
+ }
221
+
222
+ .nr-editor-prose {
223
+ height: 100%;
224
+ overflow: auto;
225
+ padding: 1rem;
226
+ }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@noirmd/previewer",
3
- "version": "1.1.1",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
- "description": "Framework-agnostic markdown parser with React renderer, directives, cards, modals, and Tailwind styling",
5
+ "description": "Framework-agnostic markdown renderer: one vanilla DOM engine with thin React/Vue wrappers, directives, cards, modals, and pure CSS styling",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -44,16 +44,17 @@
44
44
  "require": "./dist/NReditor.cjs",
45
45
  "default": "./dist/NReditor.js"
46
46
  },
47
- "./markdown.css": "./markdown.css"
47
+ "./editor.css": "./dist/editor.css"
48
48
  },
49
49
  "files": [
50
50
  "dist",
51
- "markdown.css"
51
+ "editor.css"
52
52
  ],
53
53
  "scripts": {
54
54
  "build": "tsup",
55
55
  "dev": "tsup --watch",
56
- "typecheck": "tsc --noEmit"
56
+ "typecheck": "tsc --noEmit",
57
+ "test:editor": "node test/build.mjs"
57
58
  },
58
59
  "keywords": [
59
60
  "markdown",
@@ -79,7 +80,6 @@
79
80
  "url": "https://github.com/NOIR-DexPrkr/NoirMD/issues"
80
81
  },
81
82
  "peerDependencies": {
82
- "@base-ui/react": ">=1.0.0",
83
83
  "@codemirror/language": ">=6.0.0",
84
84
  "@codemirror/state": ">=6.0.0",
85
85
  "@codemirror/view": ">=6.0.0",
@@ -90,9 +90,6 @@
90
90
  "vue": ">=3.0.0"
91
91
  },
92
92
  "peerDependenciesMeta": {
93
- "@base-ui/react": {
94
- "optional": true
95
- },
96
93
  "vue": {
97
94
  "optional": true
98
95
  },
package/markdown.css DELETED
@@ -1,344 +0,0 @@
1
- /* NRpreviewer — Markdown typography
2
- These styles work standalone without Tailwind.
3
- If consumer has Tailwind, utility classes in JSX still apply on top. */
4
-
5
- .md-h1 {
6
- font-size: 1.5rem;
7
- font-weight: 800;
8
- letter-spacing: -0.025em;
9
- line-height: 1.2;
10
- margin: 1.5rem 0 0.75rem;
11
- }
12
- @media (min-width: 640px) {
13
- .md-h1 { font-size: 1.875rem; }
14
- }
15
- @media (min-width: 768px) {
16
- .md-h1 { font-size: 2.25rem; }
17
- }
18
-
19
- .md-h2 {
20
- font-size: 1.25rem;
21
- font-weight: 700;
22
- letter-spacing: -0.025em;
23
- line-height: 1.25;
24
- margin: 1.25rem 0 0.625rem;
25
- }
26
- @media (min-width: 640px) {
27
- .md-h2 { font-size: 1.5rem; }
28
- }
29
- @media (min-width: 768px) {
30
- .md-h2 { font-size: 1.875rem; }
31
- }
32
-
33
- .md-h3 {
34
- font-size: 1.125rem;
35
- font-weight: 700;
36
- line-height: 1.3;
37
- margin: 1rem 0 0.5rem;
38
- }
39
- @media (min-width: 640px) {
40
- .md-h3 { font-size: 1.25rem; }
41
- }
42
- @media (min-width: 768px) {
43
- .md-h3 { font-size: 1.5rem; }
44
- }
45
-
46
- .md-h4 {
47
- font-size: 1rem;
48
- font-weight: 700;
49
- line-height: 1.35;
50
- margin: 0.75rem 0 0.375rem;
51
- }
52
- @media (min-width: 640px) {
53
- .md-h4 { font-size: 1.125rem; }
54
- }
55
- @media (min-width: 768px) {
56
- .md-h4 { font-size: 1.25rem; }
57
- }
58
-
59
- .md-h5 {
60
- font-size: 0.875rem;
61
- font-weight: 600;
62
- line-height: 1.4;
63
- margin: 0.625rem 0 0.25rem;
64
- }
65
- @media (min-width: 640px) {
66
- .md-h5 { font-size: 1rem; }
67
- }
68
- @media (min-width: 768px) {
69
- .md-h5 { font-size: 1.125rem; }
70
- }
71
-
72
- .md-h6 {
73
- font-size: 0.75rem;
74
- font-weight: 600;
75
- line-height: 1.4;
76
- margin: 0.5rem 0 0.25rem;
77
- }
78
- @media (min-width: 640px) {
79
- .md-h6 { font-size: 0.875rem; }
80
- }
81
- @media (min-width: 768px) {
82
- .md-h6 { font-size: 1rem; }
83
- }
84
-
85
- .md-p {
86
- font-size: 0.875rem;
87
- line-height: 1.625;
88
- margin: 0.75rem 0;
89
- }
90
- @media (min-width: 640px) {
91
- .md-p { font-size: 1rem; }
92
- }
93
-
94
- /* ── Links ── */
95
- .nr-prose a {
96
- text-decoration: none !important;
97
- color: var(--color-accent-primary, #0ea5e9);
98
- transition: color 0.15s;
99
- }
100
- .nr-prose a:hover {
101
- text-decoration: underline !important;
102
- color: var(--color-accent-hover, #38bdf8);
103
- }
104
-
105
- /* ── Lists ── */
106
- .nr-prose ul,
107
- .nr-prose ol {
108
- list-style-type: disc;
109
- margin: 0.75rem 0;
110
- padding-left: 1.5rem;
111
- font-size: 0.875rem;
112
- line-height: 1.625;
113
- }
114
- @media (min-width: 640px) {
115
- .nr-prose ul, .nr-prose ol { font-size: 1rem; }
116
- }
117
-
118
- .nr-prose ol {
119
- list-style-type: decimal;
120
- }
121
-
122
- .nr-prose li {
123
- margin: 0.25rem 0;
124
- line-height: 1.625;
125
- display: list-item;
126
- }
127
-
128
- .nr-prose li::marker {
129
- color: var(--color-text-secondary, #64748b);
130
- }
131
-
132
- /* Nested lists */
133
- .nr-prose li > ul,
134
- .nr-prose li > ol {
135
- margin: 0.25rem 0;
136
- }
137
-
138
- /* ── Tables ── */
139
- .nr-prose table {
140
- width: 100%;
141
- border-collapse: collapse;
142
- margin: 1rem 0;
143
- font-size: 0.875rem;
144
- line-height: 1.5;
145
- }
146
- @media (min-width: 640px) {
147
- .nr-prose table { font-size: 1rem; }
148
- }
149
-
150
- .nr-prose thead {
151
- border-bottom: 2px solid var(--color-border, #e2e8f0);
152
- }
153
-
154
- .nr-prose th {
155
- padding: 0.5rem 0.75rem;
156
- text-align: left;
157
- font-weight: 700;
158
- font-size: 0.75rem;
159
- background: var(--color-background-secondary-solid, #f1f5f9);
160
- border-bottom: 1px solid var(--color-border, #e2e8f0);
161
- }
162
-
163
- .nr-prose td {
164
- padding: 0.5rem 0.75rem;
165
- border-bottom: 1px solid var(--color-border, #e2e8f0);
166
- }
167
-
168
- .nr-prose tbody tr:last-child td {
169
- border-bottom: none;
170
- }
171
-
172
- /* ── Blockquotes ── */
173
- .nr-prose blockquote {
174
- margin: 1rem 0;
175
- padding: 0.5rem 1rem;
176
- border-left: 4px solid var(--color-accent-primary, #0ea5e9);
177
- color: var(--color-text-secondary, #64748b);
178
- font-style: italic;
179
- font-size: 0.875rem;
180
- line-height: 1.625;
181
- }
182
- @media (min-width: 640px) {
183
- .nr-prose blockquote { font-size: 1rem; }
184
- }
185
-
186
- .nr-prose blockquote p {
187
- margin: 0.25rem 0;
188
- }
189
-
190
- /* ── Inline code ── */
191
- .nr-prose :not(pre) > code {
192
- font-family: 'JetBrains Mono', 'Fira Code', monospace;
193
- font-size: 0.875em;
194
- background: var(--color-background-secondary-solid, #f1f5f9);
195
- padding: 0.125rem 0.375rem;
196
- border-radius: 0.25rem;
197
- color: var(--color-text-primary, #0f172a);
198
- }
199
-
200
- /* ── Code blocks ── */
201
- .nr-prose pre {
202
- margin: 1rem 0;
203
- padding: 1rem;
204
- overflow-x: auto;
205
- font-size: 0.8125rem;
206
- line-height: 1.6;
207
- border-radius: 0.75rem;
208
- background: var(--color-background-secondary-solid, #f1f5f9);
209
- }
210
-
211
- @media (min-width: 640px) {
212
- .nr-prose pre { font-size: 0.875rem; }
213
- }
214
-
215
- /* ── Inline formatting ── */
216
- .nr-prose strong,
217
- .nr-prose b {
218
- font-weight: 700;
219
- }
220
-
221
- .nr-prose em,
222
- .nr-prose i {
223
- font-style: italic;
224
- }
225
-
226
- .nr-prose del,
227
- .nr-prose s {
228
- text-decoration: line-through;
229
- opacity: 0.7;
230
- }
231
-
232
- /* ── Highlight ── */
233
- .nr-prose mark {
234
- background: rgba(250, 204, 21, 0.2);
235
- padding: 0 0.125rem;
236
- border-radius: 0.125rem;
237
- }
238
-
239
- /* ── Horizontal rules ── */
240
- .nr-prose hr {
241
- border: none;
242
- border-top: 1px solid var(--color-border, #e2e8f0);
243
- margin: 2rem 0;
244
- }
245
-
246
- /* ── Spoiler ── */
247
- .nr-prose .spoiler,
248
- .nr-prose [class*="bg-text-primary"][class*="text-bg-primary"] {
249
- background: var(--color-text-primary, #0f172a);
250
- color: var(--color-text-primary, #0f172a);
251
- border-radius: 0.25rem;
252
- padding: 0 0.25rem;
253
- cursor: pointer;
254
- transition: background-color 0.2s, color 0.2s;
255
- }
256
-
257
- .nr-prose .spoiler:hover,
258
- .nr-prose [class*="bg-text-primary"][class*="text-bg-primary"]:hover {
259
- background: transparent;
260
- color: inherit;
261
- }
262
-
263
- /* ── Images ── */
264
- .nr-prose img {
265
- max-width: 100%;
266
- height: auto;
267
- border-radius: 0.5rem;
268
- }
269
-
270
- /* ── Scrollbar (for code blocks and tables) ── */
271
- .nr-prose pre::-webkit-scrollbar,
272
- .nr-prose .overflow-x-auto::-webkit-scrollbar {
273
- height: 4px;
274
- }
275
- .nr-prose pre::-webkit-scrollbar-thumb,
276
- .nr-prose .overflow-x-auto::-webkit-scrollbar-thumb {
277
- background: var(--color-border, #e2e8f0);
278
- border-radius: 2px;
279
- }
280
-
281
- /* ── highlight.js theme — NoirMD ── */
282
- .hljs {
283
- color: #e2e8f0;
284
- background: transparent;
285
- }
286
- .hljs-keyword,
287
- .hljs-selector-tag,
288
- .hljs-literal,
289
- .hljs-section,
290
- .hljs-link {
291
- color: #c084fc;
292
- font-weight: 600;
293
- }
294
- .hljs-function .hljs-keyword {
295
- color: #c084fc;
296
- }
297
- .hljs-string,
298
- .hljs-title,
299
- .hljs-name,
300
- .hljs-type,
301
- .hljs-attribute,
302
- .hljs-symbol,
303
- .hljs-bullet,
304
- .hljs-addition,
305
- .hljs-variable,
306
- .hljs-template-tag,
307
- .hljs-template-variable {
308
- color: #4ade80;
309
- }
310
- .hljs-comment,
311
- .hljs-quote,
312
- .hljs-deletion,
313
- .hljs-meta {
314
- color: #64748b;
315
- font-style: italic;
316
- }
317
- .hljs-number,
318
- .hljs-regexp,
319
- .hljs-literal,
320
- .hljs-built_in {
321
- color: #fb923c;
322
- }
323
- .hljs-params {
324
- color: #e2e8f0;
325
- }
326
- .hljs-attr {
327
- color: #38bdf8;
328
- }
329
- .hljs-property {
330
- color: #0ea5e9;
331
- }
332
- .hljs-selector-class,
333
- .hljs-selector-id {
334
- color: #fbbf24;
335
- }
336
- .hljs-tag {
337
- color: #f87171;
338
- }
339
- .hljs-emphasis {
340
- font-style: italic;
341
- }
342
- .hljs-strong {
343
- font-weight: 700;
344
- }