stilo-editor 0.0.0-stage → 0.1.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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -2
  3. package/dist/characters--8h5uTeF.js +854 -0
  4. package/dist/content.css +161 -0
  5. package/dist/core/drop.d.ts +6 -0
  6. package/dist/core/editor.d.ts +108 -0
  7. package/dist/core/errors.d.ts +6 -0
  8. package/dist/core/events.d.ts +19 -0
  9. package/dist/core/extension-manager.d.ts +57 -0
  10. package/dist/core/extension.d.ts +43 -0
  11. package/dist/core/helpers/active.d.ts +33 -0
  12. package/dist/core/helpers/input-rules.d.ts +21 -0
  13. package/dist/core/helpers/lists.d.ts +12 -0
  14. package/dist/core/helpers/marks.d.ts +38 -0
  15. package/dist/core/helpers/nodes.d.ts +14 -0
  16. package/dist/core/helpers/parse-rules.d.ts +8 -0
  17. package/dist/core/html/css.d.ts +91 -0
  18. package/dist/core/html/parse.d.ts +7 -0
  19. package/dist/core/html/sanitize.d.ts +49 -0
  20. package/dist/core/html/serialize.d.ts +31 -0
  21. package/dist/core/types.d.ts +107 -0
  22. package/dist/extensions/blockquote/index.d.ts +15 -0
  23. package/dist/extensions/bold/index.d.ts +17 -0
  24. package/dist/extensions/bullet-list/index.d.ts +9 -0
  25. package/dist/extensions/clear-formatting/index.d.ts +12 -0
  26. package/dist/extensions/code/index.d.ts +15 -0
  27. package/dist/extensions/default-extensions/index.d.ts +46 -0
  28. package/dist/extensions/document/index.d.ts +17 -0
  29. package/dist/extensions/drop-cursor/index.d.ts +15 -0
  30. package/dist/extensions/gap-cursor/index.d.ts +6 -0
  31. package/dist/extensions/hard-break/index.d.ts +11 -0
  32. package/dist/extensions/heading/index.d.ts +24 -0
  33. package/dist/extensions/highlight/index.d.ts +24 -0
  34. package/dist/extensions/history/index.d.ts +21 -0
  35. package/dist/extensions/horizontal-rule/index.d.ts +11 -0
  36. package/dist/extensions/index.d.ts +27 -0
  37. package/dist/extensions/italic/index.d.ts +16 -0
  38. package/dist/extensions/link/index.d.ts +23 -0
  39. package/dist/extensions/list-item/index.d.ts +16 -0
  40. package/dist/extensions/move-block/index.d.ts +17 -0
  41. package/dist/extensions/ordered-list/index.d.ts +12 -0
  42. package/dist/extensions/paragraph/index.d.ts +14 -0
  43. package/dist/extensions/placeholder/index.d.ts +13 -0
  44. package/dist/extensions/strike/index.d.ts +16 -0
  45. package/dist/extensions/subscript/index.d.ts +16 -0
  46. package/dist/extensions/superscript/index.d.ts +17 -0
  47. package/dist/extensions/text/index.d.ts +12 -0
  48. package/dist/extensions/text-style/index.d.ts +14 -0
  49. package/dist/extensions/underline/index.d.ts +15 -0
  50. package/dist/index.d.ts +13 -0
  51. package/dist/index.js +1 -0
  52. package/dist/src-3tAxKI0c.js +1316 -0
  53. package/dist/style.css +797 -0
  54. package/dist/ui/components/character-picker.d.ts +22 -0
  55. package/dist/ui/components/characters.d.ts +10 -0
  56. package/dist/ui/components/color-button.d.ts +23 -0
  57. package/dist/ui/components/dropdown.d.ts +25 -0
  58. package/dist/ui/components/icon.d.ts +3 -0
  59. package/dist/ui/components/link-bubble.d.ts +19 -0
  60. package/dist/ui/components/link-popover.d.ts +20 -0
  61. package/dist/ui/components/popover.d.ts +27 -0
  62. package/dist/ui/components/shortcut.d.ts +11 -0
  63. package/dist/ui/i18n/en.d.ts +3 -0
  64. package/dist/ui/i18n/it.d.ts +3 -0
  65. package/dist/ui/i18n/types.d.ts +4 -0
  66. package/dist/ui/index.d.ts +19 -0
  67. package/dist/ui/toolbar/items.d.ts +12 -0
  68. package/dist/ui/toolbar/palette.d.ts +6 -0
  69. package/dist/ui/toolbar/toolbar.d.ts +28 -0
  70. package/dist/ui/toolbar/types.d.ts +87 -0
  71. package/dist/ui.css +635 -0
  72. package/dist/ui.js +1292 -0
  73. package/package.json +86 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alessio Coggiola
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,173 @@
1
- # Temporary Holding Version
1
+ <h1 align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kojak8791/stilo-editor/main/assets/logo-dark.svg">
4
+ <img src="https://raw.githubusercontent.com/kojak8791/stilo-editor/main/assets/logo.svg" alt="Stilo" width="300">
5
+ </picture>
6
+ </h1>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ Open-source HTML5 WYSIWYG editor built on [ProseMirror](https://prosemirror.net).
9
+ Clean HTML in and out, headless core, no paid tiers.
10
+
11
+ > [!WARNING]
12
+ > **Preview release.** Versions `0.x` are early previews: the editor works, but APIs may change
13
+ > in any minor version until `1.0.0`. Read the release notes before updating.
14
+
15
+ ## Why Stilo
16
+
17
+ - **Built for very large documents.** Typing stays immediate in a document longer than most
18
+ novels (see [Large documents](#large-documents)). Measured in a real browser, checked against
19
+ budgets, not assumed.
20
+ - **Entirely open source (MIT).** Aiming at the feature level of Tiptap or CKEditor 5, with no paid
21
+ tiers and no closed "pro" extensions.
22
+ - **HTML is the public format.** Content goes in as HTML and comes out as clean, semantic,
23
+ self-contained HTML, with a strict allowlist for tags, attributes and inline styles.
24
+ - **Headless core, optional UI.** The core works without any UI; the default toolbar and menus are
25
+ a separate, replaceable module.
26
+ - **Extensible by design.** Every feature is an extension with the same shape.
27
+ - **Framework-agnostic.** Vanilla TypeScript first; React/Vue wrappers later as thin layers.
28
+
29
+ ## Large documents
30
+
31
+ Stilo is made for long documents: contracts, manuals, books, reports. Typing feels immediate in
32
+ a document of 10,000 paragraphs — about 400,000 words, longer than most novels — and the editor
33
+ stays usable at five times that size, without pagination tricks and without splitting the
34
+ content. Formatting, search and selection keep up with the size of the text.
35
+
36
+ This is measured, not promised. A benchmark drives the editor in a real browser on generated
37
+ documents and times everything from loading and exporting the HTML down to the milliseconds
38
+ between a key press and the character on screen; every change is checked against performance
39
+ budgets. What it means in practice, the numbers and the limits:
40
+ [Performance](docs/PERFORMANCE.md).
41
+
42
+ ## Features
43
+
44
+ What the editor does today, with `defaultExtensions` and the default toolbar. On macOS, use
45
+ <kbd>⌘</kbd> for <kbd>Ctrl</kbd> and <kbd>Option</kbd> for <kbd>Alt</kbd>. The *Markdown*
46
+ column is what you type to get the format as you write.
47
+
48
+ | Feature | Keyboard | Markdown | Notes |
49
+ |---|---|---|---|
50
+ | **Text** | | | |
51
+ | Bold | <kbd>Ctrl</kbd>+<kbd>B</kbd> | `**text**` | |
52
+ | Italic | <kbd>Ctrl</kbd>+<kbd>I</kbd> | `*text*` `_text_` | |
53
+ | Underline | <kbd>Ctrl</kbd>+<kbd>U</kbd> | | |
54
+ | Strikethrough | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | `~~text~~` | |
55
+ | Inline code | <kbd>Ctrl</kbd>+<kbd>E</kbd> | `` `text` `` | |
56
+ | Subscript | <kbd>Ctrl</kbd>+<kbd>,</kbd> | | Subscript and superscript exclude each other |
57
+ | Superscript | <kbd>Ctrl</kbd>+<kbd>.</kbd> | | |
58
+ | Text color | | | The button applies the last color; its arrow opens a palette, "No color" and a custom color |
59
+ | Highlight | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> | `==text==` | Same button as text color; the shortcut applies the default highlight |
60
+ | Clear formatting | <kbd>Ctrl</kbd>+<kbd>\\</kbd> | | Links stay |
61
+ | **Links** | | | |
62
+ | Link | <kbd>Ctrl</kbd>+<kbd>K</kbd> | | A popover sets the URL and "open in new tab"; on a link, a small bubble offers open, edit and remove |
63
+ | **Blocks** | | | |
64
+ | Paragraph | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>0</kbd> | | |
65
+ | Headings 1–6 | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>1</kbd>…<kbd>6</kbd> | `# ` … `###### ` | Also in the toolbar dropdown |
66
+ | Quote | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>B</kbd> | `> ` | |
67
+ | Horizontal line | | `---` | |
68
+ | Line break | <kbd>Shift</kbd>+<kbd>Enter</kbd> | | New line in the same paragraph |
69
+ | Move block up / down | <kbd>Alt</kbd>+<kbd>↑</kbd> / <kbd>Alt</kbd>+<kbd>↓</kbd> | | The block or list item at the cursor, or all the selected ones; sub-items move along |
70
+ | **Lists** | | | |
71
+ | Bulleted list | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>8</kbd> | `- ` `* ` `+ ` | |
72
+ | Numbered list | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>7</kbd> | `1. ` | Starts from the number you type |
73
+ | Indent / outdent item | <kbd>Tab</kbd> / <kbd>Shift</kbd>+<kbd>Tab</kbd> | | |
74
+ | **Insert** | | | |
75
+ | Special characters and emoji | | | A popover with search, symbols and emoji; it stays open to insert several in a row |
76
+ | **Editing** | | | |
77
+ | Undo | <kbd>Ctrl</kbd>+<kbd>Z</kbd> | | <kbd>Backspace</kbd> right after a Markdown shortcut undoes it |
78
+ | Redo | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> or <kbd>Ctrl</kbd>+<kbd>Y</kbd> | | |
79
+ | Paste | <kbd>Ctrl</kbd>+<kbd>V</kbd> | | HTML is cleaned up; plain text lines become paragraphs |
80
+
81
+ **Keyboard and accessibility.** Most shortcuts are the ones of Google Docs; the others follow
82
+ the usual conventions of web editors, and every toolbar tooltip shows its shortcut. The toolbar
83
+ follows the WAI-ARIA *Toolbar* pattern: <kbd>Alt</kbd>+<kbd>F10</kbd> moves the focus from the
84
+ text to the toolbar, the arrow keys move between buttons, <kbd>Esc</kbd> goes back to the text.
85
+ Every popover works with the keyboard alone and <kbd>Esc</kbd> closes it.
86
+
87
+ ## Usage
88
+
89
+ ```sh
90
+ npm install stilo-editor
91
+ ```
92
+
93
+ ```ts
94
+ import 'stilo-editor/style.css';
95
+ import { Editor, defaultExtensions } from 'stilo-editor';
96
+ import { createToolbar } from 'stilo-editor/ui';
97
+
98
+ const editor = new Editor({
99
+ element: document.querySelector<HTMLElement>('#editor')!,
100
+ extensions: [defaultExtensions()],
101
+ content: '<p>Hello <strong>world</strong></p>',
102
+ });
103
+
104
+ createToolbar(editor, { container: document.querySelector<HTMLElement>('#toolbar')! });
105
+
106
+ editor.getHTML(); // '<p>Hello <strong>world</strong></p>'
107
+ ```
108
+
109
+ Options, commands, events, extensions and the toolbar: **[API reference](docs/API.md)**.
110
+ Without the default toolbar, import `stilo-editor/content.css` instead of `style.css` and build
111
+ your own controls on the same API.
112
+
113
+ ## Support
114
+
115
+ - **Bugs and feature requests:** open an
116
+ [issue](https://github.com/kojak8791/stilo-editor/issues/new/choose); the forms ask for what
117
+ is needed to reproduce a bug (steps, Stilo version, browser).
118
+ - **Questions:** open an issue too, with a short title that says what you are trying to do.
119
+ - **Security vulnerabilities:** never in a public issue; report them privately as described in
120
+ [SECURITY.md](SECURITY.md).
121
+
122
+ Contributions are welcome: start from [CONTRIBUTING.md](CONTRIBUTING.md).
123
+
124
+ ## Roadmap
125
+
126
+ | Milestone | Content | Status |
127
+ |---|---|---|
128
+ | M0 — Foundations | Docs, scaffolding, core contracts, HTML pipeline, test helpers, `Bold` reference extension | Done |
129
+ | M1 — MVP | Core editing, history, basic marks and blocks, lists, paste cleanup, default toolbar, demo, benchmarks | Done |
130
+ | M2 — v1.0 | Preview releases `0.x` on npm, then tables, images, fonts and colors, productivity tools up to `1.0.0` | In progress |
131
+ | M3 — Later | Real-time collaboration (Yjs), framework wrappers, embeds | Planned |
132
+
133
+ Full feature list and priorities in [docs/SPEC.md](docs/SPEC.md).
134
+
135
+ ## How it is built
136
+
137
+ Stilo is designed and owned by Alessio Coggiola and developed with AI assistance
138
+ ([Claude](https://claude.com/claude-code)). Every decision is written down before the code
139
+ ([docs/](docs/), [ADRs](docs/decisions/)), every change goes through the quality gate
140
+ (typecheck, lint, about 950 unit tests including XSS vectors) and is tried in the demo before
141
+ it is merged, and performance is measured against explicit budgets (`npm run bench`).
142
+
143
+ | Document | Content |
144
+ |---|---|
145
+ | [API.md](docs/API.md) | API reference for applications |
146
+ | [VISION.md](docs/VISION.md) | Why and what |
147
+ | [SPEC.md](docs/SPEC.md) | Features, non-functional requirements, roadmap |
148
+ | [ARCHITECTURE.md](docs/ARCHITECTURE.md) | Stack, file layout, extension API, HTML contract |
149
+ | [UI.md](docs/UI.md) | Design of the default UI |
150
+ | [PERFORMANCE.md](docs/PERFORMANCE.md) | Performance in practice, how it is measured, limits |
151
+ | [BACKLOG.md](docs/BACKLOG.md) | Tasks done and planned |
152
+ | [AGENTS.md](AGENTS.md) | Rules for contributors and coding agents |
153
+ | [CONTRIBUTING.md](CONTRIBUTING.md) | How to report bugs and propose changes |
154
+ | [SECURITY.md](SECURITY.md) | How to report a vulnerability |
155
+
156
+ ## Development
157
+
158
+ Requires Node.js 22 or later.
159
+
160
+ ```sh
161
+ npm install
162
+ npm run check # typecheck + lint + unit tests
163
+ npm run dev # demo page
164
+ npm run bench # performance benchmarks (needs: npx playwright install chromium)
165
+ npm run test:e2e # E2E tests in Chromium, Firefox and WebKit (needs: npx playwright install)
166
+ ```
167
+
168
+ ## License
169
+
170
+ [MIT](LICENSE) © 2026 Alessio Coggiola
171
+
172
+ The logo wordmark is drawn from [IBM Plex](https://github.com/IBM/plex), licensed under the
173
+ [SIL Open Font License 1.1](https://openfontlicense.org).