noteloom 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -9,6 +9,17 @@
9
9
 
10
10
  A React-first, block-based rich text editor with **zero runtime dependencies** — the only things it expects from your app are `react` and `react-dom`. Everything else (undo/redo, clipboard, slash commands, tables, inline widgets) is built from scratch on top of a small normalized document store.
11
11
 
12
+ ## ✨ Highlights
13
+
14
+ - **12 built-in block types** — paragraph, heading, list (bulleted/numbered/to-do/toggle), table, multi-column layout, divider, callout, blockquote, code, toggle heading, button, embed, and a freehand **canvas** (draw/sketch/shapes/arrows/text — [see below](#drawing--sketching-the-canvas-block)).
15
+ - **Inline widgets mid-sentence** — select dropdowns, dates, checkboxes, and `@mentions`, spliced directly into running text, not forced onto their own line.
16
+ - **A real default theme**, injected automatically, fully retheme-able via CSS custom properties, or opt out entirely and bring your own.
17
+ - **Mobile/touch-first UI** — a bottom action bar, tap-friendly block picker, and touch-aware popovers, not just a desktop UI that technically renders on a phone.
18
+ - **Voice typing** — continuous dictation plus spoken structural commands ("heading one", "bulleted list", "undo") via the browser's own Speech API, no SDK bundled.
19
+ - **RTL & accessibility built in** — automatic per-block text direction, keyboard-operable menus, live-region announcements, and more.
20
+ - **Two JSON export shapes** — the normalized engine format, or a simpler self-contained shape for storage/API/CRUD use — plus HTML and plain-text export, all with a drop-in "View source" button.
21
+ - **Zero runtime dependencies**, a flat/normalized document model that diffs and stores cleanly, and fine-grained React re-rendering (editing one paragraph in a 500-block doc repaints just that block).
22
+
12
23
  ## Why this exists
13
24
 
14
25
  Most rich-text editors either bring their own large dependency tree, or force every "special" piece of content (a dropdown, a date, a mention) onto its own line. This one is built around two ideas:
@@ -194,12 +205,12 @@ This is purely an additive, alternate *interchange* format — the internal engi
194
205
  Every block defaults to `dir="auto"` — the browser's own Unicode bidi algorithm detects direction per block from its first strong character, so a document mixing LTR and RTL blocks (an English heading over an Arabic paragraph, say) just works with zero configuration. For the cases `auto` can't infer on its own (most commonly an empty block, which has no text yet to detect a direction from), set an explicit override:
195
206
 
196
207
  ```js
197
- import { updateBlockProps } from 'noteloom';
208
+ import { operations } from 'noteloom';
198
209
 
199
210
  // Document-wide default:
200
- store.applyOperation(updateBlockProps(store.getRootId(), { dir: 'rtl' }));
211
+ store.applyOperation(operations.updateBlockProps(store.getRootId(), { dir: 'rtl' }));
201
212
  // Or just one block:
202
- store.applyOperation(updateBlockProps(blockId, { dir: 'rtl' }));
213
+ store.applyOperation(operations.updateBlockProps(blockId, { dir: 'rtl' }));
203
214
  ```
204
215
 
205
216
  A block's own `dir` wins over the document's; the block gutter menu also has a "Switch to right-to-left"/"left-to-right" item that sets this per-block. Code blocks are always `dir="ltr"` regardless of the surrounding document's default — code syntax (brackets, operators) is structurally LTR no matter what language a comment or string literal happens to be written in.
@@ -266,7 +277,20 @@ Trigger-menu and `Select` popovers reposition above the caret instead of below i
266
277
 
267
278
  ## Built-in block types
268
279
 
269
- `paragraph`, `heading` (h1–h3), `listItem` (bulleted, numbered, and to-do — with Notion-style Tab/Shift+Tab nesting and Enter conventions), `table` (with row/column insert/delete), `layout` (multi-column), `divider`.
280
+ `paragraph`, `heading` (h1–h3), `listItem` (bulleted, numbered, to-do, and toggle — with Notion-style Tab/Shift+Tab nesting and Enter conventions), `table` (with row/column insert/delete), `layout` (multi-column), `divider`, `callout`, `blockquote`, `code`, `toggleHeading`, `button`, `embed` (image/video/audio/file), and `canvas` (see next section).
281
+
282
+ ### Drawing & sketching: the canvas block
283
+
284
+ A freehand drawing surface, insertable via `/canvas` (or the icon in the slash menu) — pen, eraser, resizable text, and rectangle/ellipse/arrow shapes, each with their own color/fill pickers, all in a fixed-size box you can resize like an embed. Exports to a self-contained inline `<svg>` (see `exportSvg.js`) as part of the document's normal HTML export, so it round-trips through copy/paste and `exportDocumentHTML` without a canvas-to-image conversion step.
285
+
286
+ ```js
287
+ import { createBlockRegistry, registerBlocks, canvasBlockType } from 'noteloom';
288
+
289
+ const registry = createBlockRegistry();
290
+ registerBlocks(registry, { canvas: canvasBlockType /* , ...other blocks */ });
291
+ ```
292
+
293
+ Strokes/shapes are authored in a fixed 0–1000 normalized coordinate space, independent of the block's own rendered pixel size — resizing the canvas never has to rescale the drawing data itself. There's no OCR/description generation, so a canvas has no plain-text representation (`toPlainText` returns `''`, matching a divider's decorative nature) and, in this first version, pasted/foreign SVG markup doesn't reverse-parse back into editable stroke data — a canvas block can only be created via its own slash command.
270
294
 
271
295
  ## Picking only the blocks you want
272
296