@0m0g1/griot 0.1.0 → 0.1.2

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 (3) hide show
  1. package/README.md +2 -2
  2. package/package.json +9 -3
  3. package/src/griot.css +353 -0
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm install griot # (once published)
13
13
  ```
14
14
 
15
15
  ```js
16
- import 'griot/css'; // styles
16
+ import '@0m0g1/griot/css'; // styles
17
17
  import { Editor, Viewer, createDocument } from 'griot';
18
18
  ```
19
19
 
@@ -25,7 +25,7 @@ import { Editor, Viewer, createDocument } from 'griot';
25
25
 
26
26
  ```js
27
27
  import { Editor, createDocument } from 'griot';
28
- import 'griot/css';
28
+ import '@0m0g1/griot/css';
29
29
 
30
30
  const doc = createDocument('My Article');
31
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0m0g1/griot",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "A self-contained block-based rich text editor and renderer built for historical document authoring.",
5
5
  "type": "module",
6
6
  "main": "./src/Griot.js",
@@ -12,6 +12,12 @@
12
12
  "files": [
13
13
  "src/"
14
14
  ],
15
- "keywords": ["rich-text", "editor", "blocks", "history", "document"],
15
+ "keywords": [
16
+ "rich-text",
17
+ "editor",
18
+ "blocks",
19
+ "history",
20
+ "document"
21
+ ],
16
22
  "license": "MIT"
17
- }
23
+ }
package/src/griot.css ADDED
@@ -0,0 +1,353 @@
1
+ /* ─── griot.css ───────────────────────────────────────────────────────────────
2
+ All styles for both editor and viewer.
3
+ Import once; scope is via .griot-editor and .griot-viewer.
4
+ CSS variables let the host app theme everything.
5
+ ─────────────────────────────────────────────────────────────────────────── */
6
+
7
+ :root {
8
+ --griot-bg: #060918;
9
+ --griot-surface: rgba(255,255,255,0.03);
10
+ --griot-surface-hover: rgba(255,255,255,0.055);
11
+ --griot-border: rgba(255,255,255,0.07);
12
+ --griot-border-focus: rgba(99,102,241,0.5);
13
+ --griot-accent: #6366f1;
14
+ --griot-accent-soft: rgba(99,102,241,0.12);
15
+ --griot-accent-text: #a5b4fc;
16
+ --griot-text: #e2e8f0;
17
+ --griot-text-muted: #64748b;
18
+ --griot-text-faint: #334155;
19
+ --griot-code-bg: rgba(0,0,0,0.45);
20
+ --griot-code-color: #a5f3fc;
21
+ --griot-chip-event-bg: rgba(99,102,241,0.15);
22
+ --griot-chip-cite-bg: rgba(34,197,94,0.10);
23
+ --griot-font-body: system-ui, -apple-system, sans-serif;
24
+ --griot-font-mono: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
25
+ --griot-font-serif: 'Georgia', 'Times New Roman', serif;
26
+ --griot-radius: 8px;
27
+ --griot-radius-sm: 5px;
28
+ --griot-transition: 0.15s ease;
29
+ }
30
+
31
+ /* ── Shared base ───────────────────────────────────────────────────────────── */
32
+ .griot-editor,
33
+ .griot-viewer {
34
+ font-family: var(--griot-font-body);
35
+ color: var(--griot-text);
36
+ background: transparent;
37
+ line-height: 1.7;
38
+ }
39
+
40
+ /* ── Inline elements ────────────────────────────────────────────────────────── */
41
+ .griot-editor strong, .griot-viewer strong { color: #f1f5f9; font-weight: 700; }
42
+ .griot-editor em, .griot-viewer em { color: #94a3b8; }
43
+
44
+ .griot-inline-code {
45
+ background: rgba(139,92,246,0.15);
46
+ border: 1px solid rgba(139,92,246,0.25);
47
+ border-radius: 4px;
48
+ padding: 1px 6px;
49
+ font-family: var(--griot-font-mono);
50
+ font-size: 0.875em;
51
+ color: #c4b5fd;
52
+ }
53
+
54
+ .griot-link {
55
+ color: #7dd3fc;
56
+ text-decoration: none;
57
+ border-bottom: 1px solid rgba(125,211,252,0.3);
58
+ transition: border-color var(--griot-transition);
59
+ }
60
+ .griot-link:hover { border-bottom-color: #7dd3fc; }
61
+
62
+ /* Chips */
63
+ .griot-chip {
64
+ display: inline-flex;
65
+ align-items: center;
66
+ gap: 4px;
67
+ border-radius: var(--griot-radius-sm);
68
+ padding: 1px 8px;
69
+ font-family: var(--griot-font-body);
70
+ font-size: 0.85em;
71
+ cursor: pointer;
72
+ border: 1px solid;
73
+ vertical-align: middle;
74
+ transition: opacity var(--griot-transition);
75
+ line-height: 1.6;
76
+ }
77
+ .griot-chip:hover { opacity: 0.8; }
78
+ .griot-chip--event {
79
+ background: var(--griot-chip-event-bg);
80
+ border-color: rgba(99,102,241,0.35);
81
+ color: var(--griot-accent-text);
82
+ }
83
+ .griot-chip--cite {
84
+ background: var(--griot-chip-cite-bg);
85
+ border-color: rgba(34,197,94,0.25);
86
+ color: #86efac;
87
+ }
88
+ .griot-chip__icon { font-size: 0.85em; }
89
+
90
+ /* ── Viewer blocks ──────────────────────────────────────────────────────────── */
91
+ .griot-viewer .griot-block { scroll-margin-top: 80px; }
92
+
93
+ .griot-viewer .griot-paragraph {
94
+ color: var(--griot-text-muted);
95
+ margin: 0 0 14px;
96
+ font-size: 0.97em;
97
+ }
98
+
99
+ .griot-viewer .griot-heading { font-weight: 800; color: #f8fafc; }
100
+ .griot-viewer .griot-heading--1 { font-family: var(--griot-font-serif); font-size: 1.95em; margin: 32px 0 10px; letter-spacing: -0.02em; line-height: 1.15; }
101
+ .griot-viewer .griot-heading--2 { font-size: 1.4em; margin: 24px 0 8px; letter-spacing: -0.01em; }
102
+ .griot-viewer .griot-heading--3 { font-size: 0.85em; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--griot-accent); font-weight: 700; }
103
+ .griot-viewer .griot-heading--4 { font-size: 1.05em; margin: 14px 0 6px; color: #cbd5e1; }
104
+ .griot-viewer .griot-heading--5 { font-size: 0.95em; margin: 12px 0 5px; color: #94a3b8; }
105
+ .griot-viewer .griot-heading--6 { font-size: 0.85em; margin: 10px 0 4px; color: var(--griot-text-faint); text-transform: uppercase; }
106
+
107
+ .griot-viewer .griot-blockquote {
108
+ border-left: 3px solid var(--griot-accent);
109
+ margin: 18px 0;
110
+ padding: 10px 18px;
111
+ background: var(--griot-accent-soft);
112
+ border-radius: 0 var(--griot-radius) var(--griot-radius) 0;
113
+ color: #94a3b8;
114
+ font-style: italic;
115
+ font-family: var(--griot-font-serif);
116
+ font-size: 1.05em;
117
+ }
118
+
119
+ .griot-viewer .griot-callout {
120
+ display: flex;
121
+ gap: 12px;
122
+ background: rgba(99,102,241,0.07);
123
+ border: 1px solid rgba(99,102,241,0.2);
124
+ border-radius: 10px;
125
+ padding: 13px 16px;
126
+ margin: 14px 0;
127
+ }
128
+ .griot-callout__icon { font-size: 1.3em; flex-shrink: 0; line-height: 1.4; }
129
+ .griot-callout__body { color: var(--griot-text); line-height: 1.7; }
130
+
131
+ .griot-viewer .griot-code {
132
+ background: var(--griot-code-bg);
133
+ border: 1px solid rgba(255,255,255,0.06);
134
+ border-radius: 10px;
135
+ padding: 16px 18px;
136
+ margin: 14px 0;
137
+ font-family: var(--griot-font-mono);
138
+ font-size: 0.85em;
139
+ color: var(--griot-code-color);
140
+ line-height: 1.75;
141
+ overflow-x: auto;
142
+ }
143
+
144
+ .griot-viewer .griot-divider {
145
+ border: none;
146
+ border-top: 1px solid var(--griot-border);
147
+ margin: 28px 0;
148
+ }
149
+
150
+ .griot-viewer .griot-image { margin: 18px 0; }
151
+ .griot-viewer .griot-image img { max-width: 100%; border-radius: var(--griot-radius); display: block; }
152
+ .griot-viewer .griot-image figcaption { font-size: 0.8em; color: var(--griot-text-faint); margin-top: 6px; text-align: center; }
153
+
154
+ .griot-viewer .griot-timeline-ref {
155
+ display: flex;
156
+ align-items: center;
157
+ gap: 12px;
158
+ background: rgba(99,102,241,0.07);
159
+ border: 1px solid rgba(99,102,241,0.22);
160
+ border-radius: 10px;
161
+ padding: 12px 15px;
162
+ margin: 14px 0;
163
+ cursor: pointer;
164
+ transition: background var(--griot-transition);
165
+ }
166
+ .griot-viewer .griot-timeline-ref:hover { background: rgba(99,102,241,0.12); }
167
+ .griot-timeline-ref__icon { font-size: 1.5em; flex-shrink: 0; }
168
+ .griot-timeline-ref__body { flex: 1; }
169
+ .griot-timeline-ref__title { font-weight: 600; color: var(--griot-accent-text); font-size: 0.95em; }
170
+ .griot-timeline-ref__note { font-size: 0.85em; color: var(--griot-text-faint); margin-top: 3px; }
171
+ .griot-timeline-ref__arrow { font-size: 11px; color: var(--griot-text-faint); }
172
+
173
+ .griot-viewer .griot-citation {
174
+ background: rgba(8,12,36,0.6);
175
+ border: 1px solid rgba(99,102,241,0.25);
176
+ border-radius: 11px;
177
+ margin: 18px 0;
178
+ overflow: hidden;
179
+ }
180
+ .griot-citation__inner { border-left: 3px solid var(--griot-accent); padding: 13px 16px; }
181
+ .griot-citation__header { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.08em; color: var(--griot-accent); margin-bottom: 5px; }
182
+ .griot-citation__book-icon { }
183
+ .griot-citation__book-title { }
184
+ .griot-citation__author { color: var(--griot-text-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }
185
+ .griot-citation__unit { color: var(--griot-text-faint); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 10px; }
186
+ .griot-citation__quote {
187
+ border-left: 2px solid rgba(99,102,241,0.3);
188
+ padding-left: 12px; margin: 0 0 10px;
189
+ color: #94a3b8; font-style: italic;
190
+ font-family: var(--griot-font-serif);
191
+ font-size: 0.95em; line-height: 1.75;
192
+ }
193
+ .griot-citation__note { color: var(--griot-text); line-height: 1.7; font-size: 0.95em; }
194
+ .griot-citation__preview { padding: 7px 16px; border-top: 1px solid rgba(99,102,241,0.1); background: rgba(99,102,241,0.03); font-size: 11px; color: var(--griot-text-faint); line-height: 1.5; }
195
+ .griot-citation__empty,
196
+ .griot-citation__missing { padding: 14px 16px; font-size: 13px; font-style: italic; color: var(--griot-text-faint); }
197
+
198
+ /* Highlight animation */
199
+ @keyframes griot-hl-pulse {
200
+ 0% { outline-color: rgba(99,102,241,0.8); background: rgba(99,102,241,0.1); }
201
+ 70% { outline-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.05); }
202
+ 100% { outline-color: transparent; background: transparent; }
203
+ }
204
+ .griot-block--highlight {
205
+ border-radius: var(--griot-radius);
206
+ outline: 2px solid rgba(99,102,241,0.8);
207
+ outline-offset: 4px;
208
+ animation: griot-hl-pulse 2.2s ease forwards;
209
+ }
210
+
211
+ /* ── Editor blocks ──────────────────────────────────────────────────────────── */
212
+ .griot-editor-block {
213
+ border: 1px solid var(--griot-border);
214
+ border-radius: var(--griot-radius);
215
+ background: var(--griot-surface);
216
+ margin-bottom: 6px;
217
+ transition: border-color var(--griot-transition), background var(--griot-transition);
218
+ }
219
+ .griot-editor-block.is-focused {
220
+ border-color: var(--griot-border-focus);
221
+ background: var(--griot-surface-hover);
222
+ }
223
+
224
+ .griot-editor-block__toolbar {
225
+ display: flex;
226
+ align-items: center;
227
+ gap: 6px;
228
+ padding: 5px 10px;
229
+ border-bottom: 1px solid var(--griot-border);
230
+ background: rgba(0,0,0,0.15);
231
+ border-radius: var(--griot-radius) var(--griot-radius) 0 0;
232
+ flex-wrap: wrap;
233
+ }
234
+
235
+ .griot-editor-block__type-sel,
236
+ .griot-editor-block__lvl-sel {
237
+ background: rgba(255,255,255,0.04);
238
+ border: 1px solid var(--griot-border);
239
+ border-radius: var(--griot-radius-sm);
240
+ color: var(--griot-text-muted);
241
+ font-size: 10px;
242
+ padding: 3px 6px;
243
+ outline: none;
244
+ cursor: pointer;
245
+ }
246
+
247
+ .griot-editor-block__pick-btn {
248
+ background: rgba(99,102,241,0.08);
249
+ border: 1px solid rgba(99,102,241,0.25);
250
+ border-radius: var(--griot-radius-sm);
251
+ color: var(--griot-accent-text);
252
+ font-size: 10px;
253
+ padding: 3px 9px;
254
+ cursor: pointer;
255
+ outline: none;
256
+ }
257
+
258
+ .griot-editor-block__actions {
259
+ display: flex;
260
+ gap: 3px;
261
+ margin-left: auto;
262
+ }
263
+
264
+ .griot-editor-block__action-btn {
265
+ background: none;
266
+ border: 1px solid var(--griot-border);
267
+ border-radius: 4px;
268
+ color: var(--griot-text-faint);
269
+ font-size: 11px;
270
+ padding: 2px 7px;
271
+ cursor: pointer;
272
+ outline: none;
273
+ transition: color var(--griot-transition), border-color var(--griot-transition);
274
+ }
275
+ .griot-editor-block__action-btn:hover { color: var(--griot-text); }
276
+ .griot-editor-block__action-btn.is-disabled { opacity: 0.3; pointer-events: none; }
277
+ .griot-editor-block__action-btn.is-add { color: var(--griot-accent); border-color: rgba(99,102,241,0.25); }
278
+ .griot-editor-block__action-btn.is-delete { color: #f87171; border-color: rgba(248,113,113,0.25); }
279
+
280
+ .griot-editor-block__input {
281
+ display: block;
282
+ width: 100%;
283
+ padding: 10px 14px;
284
+ box-sizing: border-box;
285
+ background: transparent;
286
+ border: none;
287
+ color: var(--griot-text);
288
+ font-size: 13px;
289
+ font-family: var(--griot-font-body);
290
+ line-height: 1.7;
291
+ outline: none;
292
+ resize: none;
293
+ white-space: pre-wrap;
294
+ word-break: break-word;
295
+ min-height: 38px;
296
+ }
297
+ .griot-input--heading { font-weight: 700; font-size: 16px; }
298
+ .griot-input--code { font-family: var(--griot-font-mono); font-size: 12px; white-space: pre; min-height: 80px; color: var(--griot-code-color); }
299
+ .griot-input--blockquote { font-style: italic; color: #94a3b8; }
300
+
301
+ /* Placeholder via data attribute */
302
+ .griot-editor-block__input:empty::before {
303
+ content: attr(data-placeholder);
304
+ color: var(--griot-text-faint);
305
+ pointer-events: none;
306
+ }
307
+
308
+ /* Live preview strip */
309
+ .griot-editor-block__preview {
310
+ padding: 6px 14px 10px;
311
+ border-top: 1px solid rgba(99,102,241,0.1);
312
+ font-size: 12px;
313
+ color: #64748b;
314
+ background: rgba(99,102,241,0.02);
315
+ border-radius: 0 0 var(--griot-radius) var(--griot-radius);
316
+ line-height: 1.6;
317
+ }
318
+ .griot-editor-block__preview:empty { display: none; }
319
+
320
+ /* Special block UI */
321
+ .griot-editor-block__special { padding: 10px 12px; }
322
+
323
+ .griot-editor-block__meta-input {
324
+ background: rgba(255,255,255,0.04);
325
+ border: 1px solid var(--griot-border);
326
+ border-radius: var(--griot-radius-sm);
327
+ color: var(--griot-text);
328
+ font-size: 12px;
329
+ padding: 5px 8px;
330
+ outline: none;
331
+ font-family: var(--griot-font-body);
332
+ box-sizing: border-box;
333
+ width: 100%;
334
+ transition: border-color var(--griot-transition);
335
+ }
336
+ .griot-editor-block__meta-input:focus { border-color: var(--griot-border-focus); }
337
+ .griot-editor-block__meta-textarea { resize: vertical; min-height: 52px; display: block; }
338
+
339
+ .griot-editor-block__img-preview {
340
+ max-width: 100%;
341
+ max-height: 120px;
342
+ border-radius: 6px;
343
+ display: block;
344
+ margin-bottom: 8px;
345
+ opacity: 0.85;
346
+ }
347
+
348
+ .griot-editor-block__citation-label {
349
+ font-size: 11px;
350
+ color: var(--griot-accent);
351
+ margin-bottom: 7px;
352
+ font-weight: 600;
353
+ }