@domternal/core 0.3.0 → 0.4.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
@@ -3,12 +3,13 @@
3
3
  [![Version](https://img.shields.io/npm/v/@domternal/core.svg)](https://www.npmjs.com/package/@domternal/core)
4
4
  [![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/domternal/domternal/blob/main/LICENSE)
5
5
 
6
- A lightweight, extensible rich text editor toolkit built on <u>[ProseMirror](https://prosemirror.net/)</u>. Framework-agnostic headless core with first-class Angular support.
7
- Use it headless with vanilla JS/TS, add the built-in toolbar and theme, or drop in ready-made Angular components. Fully tree-shakeable, import only what you use, unused extensions are stripped from your bundle.
6
+ A lightweight, extensible rich text editor toolkit built on <u>[ProseMirror](https://prosemirror.net/)</u>. Framework-agnostic headless core with first-class Angular and React support.
7
+ Use it headless with vanilla JS/TS, add the built-in toolbar and theme, or drop in ready-made framework components. Fully tree-shakeable, import only what you use, unused extensions are stripped from your bundle.
8
8
 
9
9
  ## Links
10
10
 
11
- <u>[Website](https://domternal.dev)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[Documentation](https://domternal.dev/v1/introduction)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[StackBlitz (Vanilla TS)](https://stackblitz.com/edit/domternal-vanilla-full-example)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[StackBlitz (Angular)](https://stackblitz.com/edit/domternal-angular-full-example)</u>
11
+ <u>[Website](https://domternal.dev)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[Documentation](https://domternal.dev/v1/introduction)</u>
12
+ <u>[StackBlitz (Angular)](https://stackblitz.com/edit/domternal-angular-full-example)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[StackBlitz (React)](https://stackblitz.com/edit/domternal-react-full-example)</u> &nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp; <u>[StackBlitz (Vanilla TS)](https://stackblitz.com/edit/domternal-vanilla-full-example)</u>
12
13
 
13
14
  ## Features
14
15
 
@@ -16,13 +17,14 @@ See <u>[Packages & Bundle Size](https://domternal.dev/v1/packages)</u> for a ful
16
17
 
17
18
  - **Headless core** - use with any framework or vanilla JS/TS
18
19
  - **Angular components** - editor, toolbar, bubble menu, floating menu, emoji picker (signals, OnPush, zoneless-ready)
19
- - **57 extensions across 10 packages** - 23 nodes, 9 marks, and 25 behavior extensions
20
+ - **React components** - composable `Domternal` component, toolbar, bubble menu, floating menu, emoji picker, custom node views (React 18+)
21
+ - **57 extensions across 11 packages** - 23 nodes, 9 marks, and 25 behavior extensions
20
22
  - **140+ chainable commands** - `editor.chain().focus().toggleBold().run()`
21
23
  - **Full table support** - cell merging, column resize, row/column controls, cell toolbar, all free and MIT licensed
22
24
  - **Tree-shakeable** - import only what you use, your bundler strips the rest
23
25
  - **~38 KB gzipped** (own code), <u>[~108 KB total](https://domternal.dev/v1/packages)</u> with ProseMirror
24
26
  - **TypeScript first** - 100% typed, zero `any`
25
- - **4,400+ tests** - 2,687 unit tests and 1,796 E2E tests across 37 Playwright specs
27
+ - **7,500+ tests** - 3,936 unit tests and 3,652 E2E tests across 76 Playwright specs
26
28
  - **Light and dark theme** - 70+ CSS custom properties for full visual control
27
29
  - **Inline styles export** - `getHTML({ styled: true })` produces inline CSS ready for email clients, CMS, and Google Docs
28
30
  - **SSR helpers** - `generateHTML`, `generateJSON`, `generateText` for server-side rendering
package/dist/index.cjs CHANGED
@@ -708,8 +708,12 @@ var ExtensionManager = class {
708
708
  return items;
709
709
  }
710
710
  /**
711
- * Collects node views from all Node extensions
712
- * Returns a map of node name NodeViewConstructor for EditorView
711
+ * Collects node views from all Node extensions.
712
+ * Returns a map of node name to NodeViewConstructor for EditorView.
713
+ *
714
+ * Each constructor is annotated with `__domternalContext` containing
715
+ * the editor and extension metadata so framework wrappers (React, Vue)
716
+ * can access them without changing the ProseMirror calling convention.
713
717
  */
714
718
  collectNodeViews() {
715
719
  const nodeViews = {};
@@ -723,6 +727,10 @@ var ExtensionManager = class {
723
727
  `${ext.name}.addNodeView`
724
728
  );
725
729
  if (nodeView) {
730
+ nodeView.__domternalContext = {
731
+ editor: this.editor,
732
+ extension: { name: nodeExt.name, options: nodeExt.options }
733
+ };
726
734
  nodeViews[ext.name] = nodeView;
727
735
  }
728
736
  }
@@ -7657,31 +7665,31 @@ var InvisibleChars = Extension.create({
7657
7665
 
7658
7666
  // src/extensions/TextColor.ts
7659
7667
  var DEFAULT_TEXT_COLORS = [
7660
- // Row 1 Neutrals
7668
+ // Row 1 - Neutrals
7661
7669
  "#000000",
7662
7670
  "#595959",
7663
7671
  "#a6a6a6",
7664
7672
  "#d9d9d9",
7665
7673
  "#ffffff",
7666
- // Row 2 Pastel
7674
+ // Row 2 - Pastel
7667
7675
  "#ffc9c9",
7668
7676
  "#fff3bf",
7669
7677
  "#b2f2bb",
7670
7678
  "#a5d8ff",
7671
7679
  "#d0bfff",
7672
- // Row 3 Vivid
7680
+ // Row 3 - Vivid
7673
7681
  "#e03131",
7674
7682
  "#f08c00",
7675
7683
  "#2f9e44",
7676
7684
  "#1971c2",
7677
7685
  "#7048e8",
7678
- // Row 4 Medium
7686
+ // Row 4 - Medium
7679
7687
  "#ff6b6b",
7680
7688
  "#ffd43b",
7681
7689
  "#69db7c",
7682
7690
  "#4dabf7",
7683
7691
  "#9775fa",
7684
- // Row 5 Dark
7692
+ // Row 5 - Dark
7685
7693
  "#c92a2a",
7686
7694
  "#e67700",
7687
7695
  "#2b8a3e",
@@ -7771,31 +7779,31 @@ var TextColor = Extension.create({
7771
7779
  }
7772
7780
  });
7773
7781
  var DEFAULT_HIGHLIGHT_COLORS = [
7774
- // Row 1 Classic warm highlights
7782
+ // Row 1 - Classic warm highlights
7775
7783
  "#fef08a",
7776
7784
  "#fde68a",
7777
7785
  "#fed7aa",
7778
7786
  "#fecaca",
7779
7787
  "#fbcfe8",
7780
- // Row 2 Lighter warm pastels
7788
+ // Row 2 - Lighter warm pastels
7781
7789
  "#fef9c3",
7782
7790
  "#fef3c7",
7783
7791
  "#ffedd5",
7784
7792
  "#fee2e2",
7785
7793
  "#fce7f3",
7786
- // Row 3 Cool highlights
7794
+ // Row 3 - Cool highlights
7787
7795
  "#a7f3d0",
7788
7796
  "#99f6e4",
7789
7797
  "#a5f3fc",
7790
7798
  "#bfdbfe",
7791
7799
  "#c4b5fd",
7792
- // Row 4 Lighter cool pastels
7800
+ // Row 4 - Lighter cool pastels
7793
7801
  "#d1fae5",
7794
7802
  "#ccfbf1",
7795
7803
  "#cffafe",
7796
7804
  "#dbeafe",
7797
7805
  "#ede9fe",
7798
- // Row 5 Neutrals
7806
+ // Row 5 - Neutrals
7799
7807
  "#e5e7eb",
7800
7808
  "#d1d5db",
7801
7809
  "#f3f4f6",