@domternal/core 0.9.1 → 0.10.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/README.md CHANGED
@@ -21,14 +21,14 @@ See <u>[Packages & Bundle Size](https://domternal.dev/v1/packages)</u> for a ful
21
21
  - **Vue components** - composable `Domternal` component, `useEditor`/`useEditorState` composables, toolbar, bubble menu, floating menu, emoji picker, notion color picker, custom node views (Vue 3.3+)
22
22
  - **Vanilla wrapper** - framework-free class-based API for Astro, Svelte, Solid, plain HTML, and Web Components - editor, toolbar, bubble menu, floating menu, emoji picker, notion color picker
23
23
  - **Notion-style block UX** - drag-to-reorder, block context menu, slash command, smart paste, keyboard reorder, floating Table of Contents
24
- - **65+ extensions across 15 packages** - nodes, marks, and behavior extensions
25
- - **120+ chainable commands** - `editor.chain().focus().toggleBold().run()`
24
+ - **70+ extensions across 16 packages** - nodes, marks, and behavior extensions
25
+ - **125+ chainable commands** - `editor.chain().focus().toggleBold().run()`
26
26
  - **Full table support** - cell merging, column resize, row/column controls, cell toolbar, all free and MIT licensed
27
27
  - **Tree-shakeable** - import only what you use, your bundler strips the rest
28
28
  - **~44 KB gzipped** (own code), <u>[see Packages](https://domternal.dev/v1/packages)</u> for full bundle breakdown with ProseMirror
29
29
  - **TypeScript first** - 100% typed, zero `any`
30
30
  - **15,000+ tests** - 4,000+ unit and 11,000+ E2E across 230+ Playwright specs and 4 demo apps
31
- - **Light and dark theme** - 70+ CSS custom properties for full visual control
31
+ - **Light and dark theme** - 120+ CSS custom properties for full visual control
32
32
  - **Inline styles export** - `getHTML({ styled: true })` produces inline CSS ready for email clients, CMS, and Google Docs
33
33
  - **SSR helpers** - `generateHTML`, `generateJSON`, `generateText` for server-side rendering
34
34
 
package/dist/index.cjs CHANGED
@@ -4134,6 +4134,21 @@ function copyThemeClass(view, target) {
4134
4134
  });
4135
4135
  }
4136
4136
 
4137
+ // src/utils/refocusEditorAfterCommand.ts
4138
+ function refocusEditorAfterCommand(view) {
4139
+ requestAnimationFrame(() => {
4140
+ const ae = document.activeElement;
4141
+ if (!ae) {
4142
+ view.focus();
4143
+ return;
4144
+ }
4145
+ if (ae.closest("[data-dm-editor-ui]") && !ae.closest(".dm-toolbar") && !ae.closest(".dm-bubble-menu") && !ae.closest(".dm-floating-menu") && !view.dom.contains(ae)) {
4146
+ return;
4147
+ }
4148
+ view.focus();
4149
+ });
4150
+ }
4151
+
4137
4152
  // src/utils/defaultBubbleContexts.ts
4138
4153
  var NOTION_MODE_CLASS = "dm-notion-mode";
4139
4154
  var NOTION_TEXT_CONTEXT = Object.freeze([
@@ -4142,6 +4157,7 @@ var NOTION_TEXT_CONTEXT = Object.freeze([
4142
4157
  "underline",
4143
4158
  "strike",
4144
4159
  "code",
4160
+ "mathInline",
4145
4161
  "|",
4146
4162
  "link",
4147
4163
  "|",
@@ -4153,6 +4169,7 @@ var STANDARD_TEXT_CONTEXT = Object.freeze([
4153
4169
  "underline",
4154
4170
  "strike",
4155
4171
  "code",
4172
+ "mathInline",
4156
4173
  "|",
4157
4174
  "link"
4158
4175
  ]);
@@ -5389,6 +5406,9 @@ var defaultIcons = {
5389
5406
  highlighterCircle: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M201.54,54.46A104,104,0,0,0,54.46,201.54,104,104,0,0,0,201.54,54.46ZM96,210V152h64v58a88.33,88.33,0,0,1-64,0Zm48-74H112V100.94l32-16Zm46.22,54.22A88.09,88.09,0,0,1,176,201.77V152a16,16,0,0,0-16-16V72a8,8,0,0,0-11.58-7.16l-48,24A8,8,0,0,0,96,96v40a16,16,0,0,0-16,16v49.77a88,88,0,1,1,110.22-11.55Z"/></svg>',
5390
5407
  textSubscript: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M248,208a8,8,0,0,1-8,8H192a8,8,0,0,1-6.4-12.8l43.17-57.56a16,16,0,1,0-27.86-15,8,8,0,0,1-15.09-5.34,32.18,32.18,0,0,1,4.63-8.59,32,32,0,0,1,51.11,38.52L208,200h32A8,8,0,0,1,248,208ZM149.24,50a8,8,0,0,0-11.29.81L92,103.78l-45.95-53A8,8,0,0,0,34,61.24L81.41,116,34,170.76a8,8,0,0,0,12.1,10.48l46-53,45.95,53a8,8,0,1,0,12.1-10.48L102.59,116l47.46-54.76A8,8,0,0,0,149.24,50Z"/></svg>',
5391
5408
  textSuperscript: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M248,144a8,8,0,0,1-8,8H192a8,8,0,0,1-6.4-12.8l43.17-57.55a16,16,0,1,0-27.86-15,8,8,0,0,1-15.09-5.33,32,32,0,1,1,55.74,29.92L208,136h32A8,8,0,0,1,248,144ZM149.24,74a8,8,0,0,0-11.29.8L92,127.79l-45.95-53A8,8,0,0,0,34,85.24L81.41,140,34,194.76a8,8,0,0,0,12.1,10.48l46-53,45.95,53a8,8,0,1,0,12.1-10.48L102.59,140l47.46-54.76A8,8,0,0,0,149.24,74Z"/></svg>',
5409
+ // --- Math ---
5410
+ sigma: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"><path d="M196 56H64l64 72-64 72h132"/></svg>',
5411
+ radical: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"><path d="M24 150 L66 200 L118 56 L236 56 M150 98 L204 156 M204 98 L150 156"/></svg>',
5392
5412
  link: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"/></svg>',
5393
5413
  // --- Format: Block ---
5394
5414
  paragraph: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,40H96a64,64,0,0,0,0,128h40v40a8,8,0,0,0,16,0V56h24V208a8,8,0,0,0,16,0V56h16a8,8,0,0,0,0-16ZM136,152H96a48,48,0,0,1,0-96h40Z"/></svg>',
@@ -10622,6 +10642,7 @@ exports.outdentBlockFromListItem = outdentBlockFromListItem;
10622
10642
  exports.placeholderPluginKey = placeholderPluginKey;
10623
10643
  exports.positionFloating = positionFloating;
10624
10644
  exports.positionFloatingOnce = positionFloatingOnce;
10645
+ exports.refocusEditorAfterCommand = refocusEditorAfterCommand;
10625
10646
  exports.resetAttributes = resetAttributes;
10626
10647
  exports.selectAll = selectAll;
10627
10648
  exports.selectNodeBackward = selectNodeBackward;