@notectl/core 1.0.3 → 1.0.5
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 +51 -148
- package/dist/chunks/AttrRegistry-DTsHyDVA.mjs +16 -0
- package/dist/chunks/AttrRegistry-DTsHyDVA.mjs.map +1 -0
- package/dist/chunks/Commands-DLP85Mp5.mjs +461 -0
- package/dist/chunks/Commands-DLP85Mp5.mjs.map +1 -0
- package/dist/chunks/Document-CI3iCwEP.mjs +177 -0
- package/dist/chunks/Document-CI3iCwEP.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-0wvCRvJc.mjs +7 -0
- package/dist/chunks/HTMLUtils-0wvCRvJc.mjs.map +1 -0
- package/dist/chunks/NodeResolver-D68ZLXti.mjs +81 -0
- package/dist/chunks/NodeResolver-D68ZLXti.mjs.map +1 -0
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs +8 -0
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +1 -0
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs +15 -0
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs.map +1 -0
- package/dist/chunks/Selection-D5ZjXoB7.mjs +44 -0
- package/dist/chunks/Selection-D5ZjXoB7.mjs.map +1 -0
- package/dist/chunks/ToolbarItem-ugDymuXi.mjs +7 -0
- package/dist/chunks/ToolbarItem-ugDymuXi.mjs.map +1 -0
- package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs +398 -0
- package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs.map +1 -0
- package/dist/chunks/TypeBrands-C09nE2qO.mjs +27 -0
- package/dist/chunks/TypeBrands-C09nE2qO.mjs.map +1 -0
- package/dist/chunks/color-picker-Csf0wx5a.mjs +5 -0
- package/dist/chunks/color-picker-Csf0wx5a.mjs.map +1 -0
- package/dist/chunks/index-CPPb-Jah.mjs +569 -0
- package/dist/chunks/index-CPPb-Jah.mjs.map +1 -0
- package/dist/commands/Commands.d.ts +71 -0
- package/dist/commands/Commands.d.ts.map +1 -0
- package/dist/commands/PasteCommand.d.ts +9 -0
- package/dist/commands/PasteCommand.d.ts.map +1 -0
- package/dist/decorations/Decoration.d.ts +76 -0
- package/dist/decorations/Decoration.d.ts.map +1 -0
- package/dist/decorations/PositionMapping.d.ts +9 -0
- package/dist/decorations/PositionMapping.d.ts.map +1 -0
- package/dist/editor/Announcer.d.ts +12 -0
- package/dist/editor/Announcer.d.ts.map +1 -0
- package/dist/editor/DocumentParser.d.ts +5 -0
- package/dist/editor/DocumentParser.d.ts.map +1 -0
- package/dist/editor/DocumentSerializer.d.ts +5 -0
- package/dist/editor/DocumentSerializer.d.ts.map +1 -0
- package/dist/editor/EditorDOM.d.ts +18 -0
- package/dist/editor/EditorDOM.d.ts.map +1 -0
- package/dist/editor/EditorThemeController.d.ts +21 -0
- package/dist/editor/EditorThemeController.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +131 -0
- package/dist/editor/NotectlEditor.d.ts.map +1 -0
- package/dist/editor/styles/base.d.ts +3 -0
- package/dist/editor/styles/base.d.ts.map +1 -0
- package/dist/editor/styles/code-block.d.ts +3 -0
- package/dist/editor/styles/code-block.d.ts.map +1 -0
- package/dist/editor/styles/color-picker.d.ts +3 -0
- package/dist/editor/styles/color-picker.d.ts.map +1 -0
- package/dist/editor/styles/font-select.d.ts +3 -0
- package/dist/editor/styles/font-select.d.ts.map +1 -0
- package/dist/editor/styles/font-size-select.d.ts +3 -0
- package/dist/editor/styles/font-size-select.d.ts.map +1 -0
- package/dist/editor/styles/heading-select.d.ts +3 -0
- package/dist/editor/styles/heading-select.d.ts.map +1 -0
- package/dist/editor/styles/image.d.ts +3 -0
- package/dist/editor/styles/image.d.ts.map +1 -0
- package/dist/editor/styles/list.d.ts +3 -0
- package/dist/editor/styles/list.d.ts.map +1 -0
- package/dist/editor/styles/reduced-motion.d.ts +3 -0
- package/dist/editor/styles/reduced-motion.d.ts.map +1 -0
- package/dist/editor/styles/table.d.ts +3 -0
- package/dist/editor/styles/table.d.ts.map +1 -0
- package/dist/editor/styles/toolbar.d.ts +3 -0
- package/dist/editor/styles/toolbar.d.ts.map +1 -0
- package/dist/editor/styles.d.ts +12 -0
- package/dist/editor/styles.d.ts.map +1 -0
- package/dist/editor/theme/ThemeEngine.d.ts +6 -0
- package/dist/editor/theme/ThemeEngine.d.ts.map +1 -0
- package/dist/editor/theme/ThemeTokens.d.ts +73 -0
- package/dist/editor/theme/ThemeTokens.d.ts.map +1 -0
- package/dist/fonts.d.ts +17 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.mjs +7 -0
- package/dist/fonts.mjs.map +1 -0
- package/dist/index.d.ts +81 -2360
- package/dist/index.d.ts.map +1 -0
- package/dist/input/ClipboardHandler.d.ts +29 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -0
- package/dist/input/InputHandler.d.ts +32 -0
- package/dist/input/InputHandler.d.ts.map +1 -0
- package/dist/input/InputRule.d.ts +9 -0
- package/dist/input/InputRule.d.ts.map +1 -0
- package/dist/input/InternalClipboard.d.ts +23 -0
- package/dist/input/InternalClipboard.d.ts.map +1 -0
- package/dist/input/KeyboardHandler.d.ts +42 -0
- package/dist/input/KeyboardHandler.d.ts.map +1 -0
- package/dist/input/Keymap.d.ts +11 -0
- package/dist/input/Keymap.d.ts.map +1 -0
- package/dist/input/PasteHandler.d.ts +38 -0
- package/dist/input/PasteHandler.d.ts.map +1 -0
- package/dist/input/SourceNormalizer.d.ts +7 -0
- package/dist/input/SourceNormalizer.d.ts.map +1 -0
- package/dist/model/AttrRegistry.d.ts +39 -0
- package/dist/model/AttrRegistry.d.ts.map +1 -0
- package/dist/model/BuiltinSpecs.d.ts +4 -0
- package/dist/model/BuiltinSpecs.d.ts.map +1 -0
- package/dist/model/ContentModel.d.ts +12 -0
- package/dist/model/ContentModel.d.ts.map +1 -0
- package/dist/model/ContentSlice.d.ts +17 -0
- package/dist/model/ContentSlice.d.ts.map +1 -0
- package/dist/model/Document.d.ts +127 -0
- package/dist/model/Document.d.ts.map +1 -0
- package/dist/model/HTMLParser.d.ts +36 -0
- package/dist/model/HTMLParser.d.ts.map +1 -0
- package/dist/model/HTMLUtils.d.ts +6 -0
- package/dist/model/HTMLUtils.d.ts.map +1 -0
- package/dist/model/InlineNodeSpec.d.ts +20 -0
- package/dist/model/InlineNodeSpec.d.ts.map +1 -0
- package/dist/model/MarkSpec.d.ts +22 -0
- package/dist/model/MarkSpec.d.ts.map +1 -0
- package/dist/model/NodeResolver.d.ts +36 -0
- package/dist/model/NodeResolver.d.ts.map +1 -0
- package/dist/model/NodeSpec.d.ts +67 -0
- package/dist/model/NodeSpec.d.ts.map +1 -0
- package/dist/model/ParseRule.d.ts +11 -0
- package/dist/model/ParseRule.d.ts.map +1 -0
- package/dist/model/SanitizeConfig.d.ts +9 -0
- package/dist/model/SanitizeConfig.d.ts.map +1 -0
- package/dist/model/Schema.d.ts +17 -0
- package/dist/model/Schema.d.ts.map +1 -0
- package/dist/model/SchemaRegistry.d.ts +81 -0
- package/dist/model/SchemaRegistry.d.ts.map +1 -0
- package/dist/model/Selection.d.ts +52 -0
- package/dist/model/Selection.d.ts.map +1 -0
- package/dist/model/TypeBrands.d.ts +28 -0
- package/dist/model/TypeBrands.d.ts.map +1 -0
- package/dist/notectl-core.mjs +2576 -11104
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +6810 -0
- package/dist/notectl-core.umd.js.map +1 -0
- package/dist/plugins/EventBus.d.ts +13 -0
- package/dist/plugins/EventBus.d.ts.map +1 -0
- package/dist/plugins/Plugin.d.ts +85 -0
- package/dist/plugins/Plugin.d.ts.map +1 -0
- package/dist/plugins/PluginManager.d.ts +66 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +48 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -0
- package/dist/plugins/alignment/index.d.ts +2 -0
- package/dist/plugins/alignment/index.d.ts.map +1 -0
- package/dist/plugins/alignment.mjs +92 -0
- package/dist/plugins/alignment.mjs.map +1 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +30 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -0
- package/dist/plugins/blockquote/index.d.ts +2 -0
- package/dist/plugins/blockquote/index.d.ts.map +1 -0
- package/dist/plugins/blockquote.mjs +58 -0
- package/dist/plugins/blockquote.mjs.map +1 -0
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts +5 -0
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +135 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -0
- package/dist/plugins/code-block/index.d.ts +2 -0
- package/dist/plugins/code-block/index.d.ts.map +1 -0
- package/dist/plugins/code-block.mjs +6 -0
- package/dist/plugins/code-block.mjs.map +1 -0
- package/dist/plugins/font/FontPlugin.d.ts +85 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -0
- package/dist/plugins/font/StarterFonts.d.ts +10 -0
- package/dist/plugins/font/StarterFonts.d.ts.map +1 -0
- package/dist/plugins/font/index.d.ts +2 -0
- package/dist/plugins/font/index.d.ts.map +1 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts +65 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -0
- package/dist/plugins/font-size/index.d.ts +2 -0
- package/dist/plugins/font-size/index.d.ts.map +1 -0
- package/dist/plugins/font-size.mjs +220 -0
- package/dist/plugins/font-size.mjs.map +1 -0
- package/dist/plugins/font.mjs +186 -0
- package/dist/plugins/font.mjs.map +1 -0
- package/dist/plugins/hard-break/HardBreakPlugin.d.ts +16 -0
- package/dist/plugins/hard-break/HardBreakPlugin.d.ts.map +1 -0
- package/dist/plugins/hard-break/index.d.ts +2 -0
- package/dist/plugins/hard-break/index.d.ts.map +1 -0
- package/dist/plugins/hard-break.mjs +28 -0
- package/dist/plugins/hard-break.mjs.map +1 -0
- package/dist/plugins/heading/BlockTypePickerEntry.d.ts +20 -0
- package/dist/plugins/heading/BlockTypePickerEntry.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts +78 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -0
- package/dist/plugins/heading/index.d.ts +3 -0
- package/dist/plugins/heading/index.d.ts.map +1 -0
- package/dist/plugins/heading.mjs +188 -0
- package/dist/plugins/heading.mjs.map +1 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts +37 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -0
- package/dist/plugins/highlight/index.d.ts +2 -0
- package/dist/plugins/highlight/index.d.ts.map +1 -0
- package/dist/plugins/highlight.mjs +126 -0
- package/dist/plugins/highlight.mjs.map +1 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +29 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/index.d.ts +2 -0
- package/dist/plugins/horizontal-rule/index.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule.mjs +59 -0
- package/dist/plugins/horizontal-rule.mjs.map +1 -0
- package/dist/plugins/image/ImageCommands.d.ts +26 -0
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -0
- package/dist/plugins/image/ImageNodeView.d.ts +6 -0
- package/dist/plugins/image/ImageNodeView.d.ts.map +1 -0
- package/dist/plugins/image/ImagePlugin.d.ts +43 -0
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -0
- package/dist/plugins/image/ImageUpload.d.ts +48 -0
- package/dist/plugins/image/ImageUpload.d.ts.map +1 -0
- package/dist/plugins/image/index.d.ts +3 -0
- package/dist/plugins/image/index.d.ts.map +1 -0
- package/dist/plugins/image.mjs +381 -0
- package/dist/plugins/image.mjs.map +1 -0
- package/dist/plugins/link/LinkPlugin.d.ts +32 -0
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -0
- package/dist/plugins/link/index.d.ts +2 -0
- package/dist/plugins/link/index.d.ts.map +1 -0
- package/dist/plugins/link.mjs +127 -0
- package/dist/plugins/link.mjs.map +1 -0
- package/dist/plugins/list/ListPlugin.d.ts +51 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -0
- package/dist/plugins/list/index.d.ts +2 -0
- package/dist/plugins/list/index.d.ts.map +1 -0
- package/dist/plugins/list.mjs +193 -0
- package/dist/plugins/list.mjs.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +23 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -0
- package/dist/plugins/strikethrough/index.d.ts +2 -0
- package/dist/plugins/strikethrough/index.d.ts.map +1 -0
- package/dist/plugins/strikethrough.mjs +35 -0
- package/dist/plugins/strikethrough.mjs.map +1 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts +44 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -0
- package/dist/plugins/super-sub/index.d.ts +2 -0
- package/dist/plugins/super-sub/index.d.ts.map +1 -0
- package/dist/plugins/super-sub.mjs +81 -0
- package/dist/plugins/super-sub.mjs.map +1 -0
- package/dist/plugins/table/TableCommands.d.ts +50 -0
- package/dist/plugins/table/TableCommands.d.ts.map +1 -0
- package/dist/plugins/table/TableControls.d.ts +10 -0
- package/dist/plugins/table/TableControls.d.ts.map +1 -0
- package/dist/plugins/table/TableControlsDOM.d.ts +18 -0
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -0
- package/dist/plugins/table/TableControlsLayout.d.ts +34 -0
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -0
- package/dist/plugins/table/TableHelpers.d.ts +39 -0
- package/dist/plugins/table/TableHelpers.d.ts.map +1 -0
- package/dist/plugins/table/TableNavigation.d.ts +4 -0
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -0
- package/dist/plugins/table/TableNodeViews.d.ts +18 -0
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -0
- package/dist/plugins/table/TablePlugin.d.ts +39 -0
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -0
- package/dist/plugins/table/TableSelection.d.ts +26 -0
- package/dist/plugins/table/TableSelection.d.ts.map +1 -0
- package/dist/plugins/table/TableTestUtils.d.ts +45 -0
- package/dist/plugins/table/TableTestUtils.d.ts.map +1 -0
- package/dist/plugins/table/index.d.ts +4 -0
- package/dist/plugins/table/index.d.ts.map +1 -0
- package/dist/plugins/table.mjs +663 -0
- package/dist/plugins/table.mjs.map +1 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts +37 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -0
- package/dist/plugins/text-color/index.d.ts +2 -0
- package/dist/plugins/text-color/index.d.ts.map +1 -0
- package/dist/plugins/text-color.mjs +126 -0
- package/dist/plugins/text-color.mjs.map +1 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +34 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -0
- package/dist/plugins/text-formatting/index.d.ts +2 -0
- package/dist/plugins/text-formatting/index.d.ts.map +1 -0
- package/dist/plugins/text-formatting.mjs +52 -0
- package/dist/plugins/text-formatting.mjs.map +1 -0
- package/dist/plugins/toolbar/ToolbarItem.d.ts +66 -0
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts +25 -0
- package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts +47 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts +25 -0
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts +19 -0
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarTooltip.d.ts +17 -0
- package/dist/plugins/toolbar/ToolbarTooltip.d.ts.map +1 -0
- package/dist/plugins/toolbar/index.d.ts +4 -0
- package/dist/plugins/toolbar/index.d.ts.map +1 -0
- package/dist/plugins/toolbar.mjs +8 -0
- package/dist/plugins/toolbar.mjs.map +1 -0
- package/dist/state/EditorState.d.ts +40 -0
- package/dist/state/EditorState.d.ts.map +1 -0
- package/dist/state/History.d.ts +38 -0
- package/dist/state/History.d.ts.map +1 -0
- package/dist/state/StepApplication.d.ts +5 -0
- package/dist/state/StepApplication.d.ts.map +1 -0
- package/dist/state/Transaction.d.ts +185 -0
- package/dist/state/Transaction.d.ts.map +1 -0
- package/dist/test/PluginTestUtils.d.ts +127 -0
- package/dist/test/PluginTestUtils.d.ts.map +1 -0
- package/dist/test/TestUtils.d.ts +153 -0
- package/dist/test/TestUtils.d.ts.map +1 -0
- package/dist/view/EditorView.d.ts +74 -0
- package/dist/view/EditorView.d.ts.map +1 -0
- package/dist/view/NodeView.d.ts +18 -0
- package/dist/view/NodeView.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts +23 -0
- package/dist/view/Reconciler.d.ts.map +1 -0
- package/dist/view/SelectionSync.d.ts +8 -0
- package/dist/view/SelectionSync.d.ts.map +1 -0
- package/package.json +112 -11
- package/dist/notectl-core.js +0 -1463
- package/dist/notectl-core.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../src/state/Transaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,WAAW,EACX,MAAM,sBAAsB,CAAC;AAY9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKpE,MAAM,WAA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AAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,GACxD,IAAI;IA+BP,kDAAkD;IAClD,YAAY,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAK9C,oDAAoD;IACpD,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAKjE,iDAAiD;IACjD,cAAc,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI;IAM1F,oCAAoC;IACpC,KAAK,IAAI,WAAW;IAapB,wDAAwD;IACxD,OAAO,CAAC,UAAU;CAKlB;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,eAAe,EAC1B,WAAW,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GACjC,kBAAkB,CAEpB;AAED,iEAAiE;AACjE,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,eAAe,EAC1B,WAAW,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GACjC,kBAAkB,CAEpB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { EditorState } from '../state/EditorState.js';
|
|
2
|
+
import { PluginHarnessResult } from './TestUtils.js';
|
|
3
|
+
/** Expected properties when asserting a MarkSpec. */
|
|
4
|
+
export interface ExpectedMarkSpec {
|
|
5
|
+
/** Expected HTML tag name (uppercase, e.g. 'STRONG'). */
|
|
6
|
+
readonly tag?: string;
|
|
7
|
+
/** Expected nesting rank. */
|
|
8
|
+
readonly rank?: number;
|
|
9
|
+
/** Expected attr definitions, e.g. `{ color: { default: '' } }`. */
|
|
10
|
+
readonly attrs?: Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Mark value passed to `toDOM()` for tag-name verification.
|
|
13
|
+
* Defaults to `{ type: markName }`.
|
|
14
|
+
*/
|
|
15
|
+
readonly toDOMInput?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Assert that a MarkSpec is registered and matches expected properties.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const h = await pluginHarness(new StrikethroughPlugin());
|
|
23
|
+
* expectMarkSpec(h, 'strikethrough', { tag: 'S', rank: 3 });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function expectMarkSpec(harness: PluginHarnessResult, markName: string, expected?: ExpectedMarkSpec): void;
|
|
27
|
+
/** Expected properties when asserting a NodeSpec. */
|
|
28
|
+
export interface ExpectedNodeSpec {
|
|
29
|
+
/** Expected HTML tag name (uppercase). */
|
|
30
|
+
readonly tag?: string;
|
|
31
|
+
/** Expected attr definitions. */
|
|
32
|
+
readonly attrs?: Record<string, unknown>;
|
|
33
|
+
/** Expected excludeMarks list. */
|
|
34
|
+
readonly excludeMarks?: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Assert that a NodeSpec is registered and matches expected properties.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const h = await pluginHarness(new BlockquotePlugin());
|
|
42
|
+
* expectNodeSpec(h, 'blockquote', { tag: 'BLOCKQUOTE' });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function expectNodeSpec(harness: PluginHarnessResult, nodeName: string, expected?: ExpectedNodeSpec): void;
|
|
46
|
+
/** Expected properties when asserting a toolbar item. */
|
|
47
|
+
export interface ExpectedToolbarItem {
|
|
48
|
+
readonly group?: string;
|
|
49
|
+
readonly label?: string;
|
|
50
|
+
readonly command?: string;
|
|
51
|
+
readonly priority?: number;
|
|
52
|
+
readonly popupType?: string;
|
|
53
|
+
readonly hasSvgIcon?: boolean;
|
|
54
|
+
readonly separatorAfter?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Assert that a toolbar item is registered and matches expected properties.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const h = await pluginHarness(new StrikethroughPlugin());
|
|
62
|
+
* expectToolbarItem(h, 'strikethrough', {
|
|
63
|
+
* group: 'format',
|
|
64
|
+
* label: 'Strikethrough',
|
|
65
|
+
* command: 'toggleStrikethrough',
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function expectToolbarItem(harness: PluginHarnessResult, itemId: string, expected?: ExpectedToolbarItem): void;
|
|
70
|
+
/**
|
|
71
|
+
* Assert that a toolbar item's `isActive()` returns the expected value.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const state = stateBuilder()
|
|
76
|
+
* .paragraph('bold', 'b1', { marks: [{ type: 'bold' }] })
|
|
77
|
+
* .cursor('b1', 2)
|
|
78
|
+
* .schema(['paragraph'], ['bold'])
|
|
79
|
+
* .build();
|
|
80
|
+
* const h = await pluginHarness(new TextFormattingPlugin(), state);
|
|
81
|
+
* expectToolbarActive(h, 'bold', true);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function expectToolbarActive(harness: PluginHarnessResult, itemId: string, active: boolean, state?: EditorState): void;
|
|
85
|
+
/**
|
|
86
|
+
* Assert that a toolbar item's `isEnabled()` returns the expected value.
|
|
87
|
+
*/
|
|
88
|
+
export declare function expectToolbarEnabled(harness: PluginHarnessResult, itemId: string, enabled: boolean, state?: EditorState): void;
|
|
89
|
+
/**
|
|
90
|
+
* Assert that a key binding is registered.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const h = await pluginHarness(new StrikethroughPlugin());
|
|
95
|
+
* expectKeyBinding(h, 'Mod-Shift-X');
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function expectKeyBinding(harness: PluginHarnessResult, key: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Assert that a key binding is NOT registered.
|
|
101
|
+
*/
|
|
102
|
+
export declare function expectNoKeyBinding(harness: PluginHarnessResult, key: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Assert that a command is registered (returns true when executed).
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const h = await pluginHarness(new BlockquotePlugin());
|
|
109
|
+
* expectCommandRegistered(h, 'toggleBlockquote');
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare function expectCommandRegistered(harness: PluginHarnessResult, commandName: string): void;
|
|
113
|
+
/**
|
|
114
|
+
* Assert that a command is NOT registered (returns false when executed).
|
|
115
|
+
*/
|
|
116
|
+
export declare function expectCommandNotRegistered(harness: PluginHarnessResult, commandName: string): void;
|
|
117
|
+
/**
|
|
118
|
+
* Assert that executing a command dispatches a transaction with steps.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* const h = await pluginHarness(new StrikethroughPlugin(), rangeState);
|
|
123
|
+
* expectCommandDispatches(h, 'toggleStrikethrough');
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare function expectCommandDispatches(harness: PluginHarnessResult, commandName: string): void;
|
|
127
|
+
//# sourceMappingURL=PluginTestUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginTestUtils.d.ts","sourceRoot":"","sources":["../../src/test/PluginTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAM1D,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAChC,yDAAyD;IACzD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,QAAQ,CAA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,CAChC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,mBAAwB,GAChC,IAAI,CAyBN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,KAAK,CAAC,EAAE,WAAW,GACjB,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,WAAW,GACjB,IAAI,CAKN;AAMD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAIhF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAIlF;AAMD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAG/F;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,MAAM,GACjB,IAAI,CAGN;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAM/F"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { InputRule } from '../input/InputRule.js';
|
|
3
|
+
import { Keymap } from '../input/Keymap.js';
|
|
4
|
+
import { BlockNode, Mark, createInlineNode, createTextNode } from '../model/Document.js';
|
|
5
|
+
import { MarkSpec } from '../model/MarkSpec.js';
|
|
6
|
+
import { NodeSpec } from '../model/NodeSpec.js';
|
|
7
|
+
import { Schema } from '../model/Schema.js';
|
|
8
|
+
import { Plugin, PluginContext } from '../plugins/Plugin.js';
|
|
9
|
+
import { PluginManager, PluginManagerInitOptions } from '../plugins/PluginManager.js';
|
|
10
|
+
import { BlockTypePickerEntry } from '../plugins/heading/BlockTypePickerEntry.js';
|
|
11
|
+
import { ToolbarItem } from '../plugins/toolbar/ToolbarItem.js';
|
|
12
|
+
import { EditorState } from '../state/EditorState.js';
|
|
13
|
+
/**
|
|
14
|
+
* Fluent builder for constructing EditorState instances with minimal boilerplate.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const state = new StateBuilder()
|
|
19
|
+
* .paragraph('Hello', 'b1')
|
|
20
|
+
* .paragraph('World', 'b2', { marks: [{ type: 'bold' }] })
|
|
21
|
+
* .cursor('b1', 3)
|
|
22
|
+
* .build();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class StateBuilder {
|
|
26
|
+
private readonly config;
|
|
27
|
+
/** Add a paragraph block. */
|
|
28
|
+
paragraph(text: string, id: string, options?: {
|
|
29
|
+
marks?: readonly Mark[];
|
|
30
|
+
attrs?: Record<string, string | number | boolean>;
|
|
31
|
+
}): this;
|
|
32
|
+
/** Add a heading block. */
|
|
33
|
+
heading(text: string, id: string, level: number, options?: {
|
|
34
|
+
marks?: readonly Mark[];
|
|
35
|
+
}): this;
|
|
36
|
+
/** Add any typed block with text content. */
|
|
37
|
+
block(type: string, text: string, id: string, options?: {
|
|
38
|
+
marks?: readonly Mark[];
|
|
39
|
+
attrs?: Record<string, string | number | boolean>;
|
|
40
|
+
}): this;
|
|
41
|
+
/** Add a block with explicit inline children (TextNodes and InlineNodes). */
|
|
42
|
+
blockWithInlines(type: string, children: readonly (ReturnType<typeof createTextNode> | ReturnType<typeof createInlineNode>)[], id: string, attrs?: Record<string, string | number | boolean>): this;
|
|
43
|
+
/** Add a void/leaf block (e.g. horizontal_rule) with no text children. */
|
|
44
|
+
voidBlock(type: string, id: string): this;
|
|
45
|
+
/** Add a nested block structure (e.g. table with rows/cells). */
|
|
46
|
+
nestedBlock(block: BlockNode): this;
|
|
47
|
+
/** Set collapsed cursor position. */
|
|
48
|
+
cursor(blockId: string, offset: number): this;
|
|
49
|
+
/** Set a range selection. */
|
|
50
|
+
selection(anchor: {
|
|
51
|
+
blockId: string;
|
|
52
|
+
offset: number;
|
|
53
|
+
}, head: {
|
|
54
|
+
blockId: string;
|
|
55
|
+
offset: number;
|
|
56
|
+
}): this;
|
|
57
|
+
/** Set a node selection (for void/selectable blocks). */
|
|
58
|
+
nodeSelection(nodeId: string, path?: readonly string[]): this;
|
|
59
|
+
/** Configure schema node types and mark types. */
|
|
60
|
+
schema(nodeTypes: string[], markTypes: string[], getNodeSpec?: Schema['getNodeSpec']): this;
|
|
61
|
+
/** Build the EditorState. */
|
|
62
|
+
build(): EditorState;
|
|
63
|
+
private resolveSelection;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Shorthand factory for StateBuilder.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const state = stateBuilder()
|
|
71
|
+
* .paragraph('Hello', 'b1')
|
|
72
|
+
* .cursor('b1', 3)
|
|
73
|
+
* .build();
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function stateBuilder(): StateBuilder;
|
|
77
|
+
/** Return type of `pluginHarness().init()`. */
|
|
78
|
+
export interface PluginHarnessResult {
|
|
79
|
+
/** The PluginManager instance. */
|
|
80
|
+
readonly pm: PluginManager;
|
|
81
|
+
/** Spy-wrapped dispatch that tracks calls and applies transactions. */
|
|
82
|
+
readonly dispatch: ReturnType<typeof vi.fn>;
|
|
83
|
+
/** Returns the current (latest) EditorState after all dispatched transactions. */
|
|
84
|
+
getState(): EditorState;
|
|
85
|
+
/** Execute a registered command by name. */
|
|
86
|
+
executeCommand(name: string): boolean;
|
|
87
|
+
/** Get a toolbar item by id. */
|
|
88
|
+
getToolbarItem(id: string): ToolbarItem | undefined;
|
|
89
|
+
/** Get all registered toolbar items. */
|
|
90
|
+
getToolbarItems(): ToolbarItem[];
|
|
91
|
+
/** Get a MarkSpec by type name. */
|
|
92
|
+
getMarkSpec(name: string): MarkSpec | undefined;
|
|
93
|
+
/** Get a NodeSpec by type name. */
|
|
94
|
+
getNodeSpec(name: string): NodeSpec | undefined;
|
|
95
|
+
/** Get all registered keymaps. */
|
|
96
|
+
getKeymaps(): readonly Keymap[];
|
|
97
|
+
/** Get all registered input rules. */
|
|
98
|
+
getInputRules(): readonly InputRule[];
|
|
99
|
+
/** Get all registered block type picker entries, sorted by priority. */
|
|
100
|
+
getBlockTypePickerEntries(): readonly BlockTypePickerEntry[];
|
|
101
|
+
}
|
|
102
|
+
/** Options for pluginHarness. */
|
|
103
|
+
export interface PluginHarnessOptions {
|
|
104
|
+
/** When true, dispatch routes through `pm.dispatchWithMiddleware()`. */
|
|
105
|
+
readonly useMiddleware?: boolean;
|
|
106
|
+
/** When true, registers built-in node specs (paragraph) before plugins. */
|
|
107
|
+
readonly builtinSpecs?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Streamlined plugin test initialization.
|
|
111
|
+
* Replaces the ~20-line `initPlugin()` boilerplate found in every plugin test.
|
|
112
|
+
*
|
|
113
|
+
* Accepts a single plugin or an array of plugins. When `useMiddleware` is true,
|
|
114
|
+
* dispatched transactions are routed through the plugin middleware chain. When
|
|
115
|
+
* `builtinSpecs` is true, built-in node specs (paragraph) are registered before
|
|
116
|
+
* plugin initialization.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const h = await pluginHarness(new HeadingPlugin(), state);
|
|
121
|
+
* h.executeCommand('setHeading1');
|
|
122
|
+
* expect(h.getState().doc.children[0]?.type).toBe('heading');
|
|
123
|
+
* expect(h.dispatch).toHaveBeenCalled();
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare function pluginHarness(plugin: Plugin | readonly Plugin[], state?: EditorState, options?: PluginHarnessOptions): Promise<PluginHarnessResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Creates PluginManagerInitOptions with sensible defaults.
|
|
129
|
+
* Overrides are merged on top.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* await pm.init(makePluginOptions({ getState: () => myState, dispatch }));
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare function makePluginOptions(overrides?: Partial<PluginManagerInitOptions>): PluginManagerInitOptions;
|
|
137
|
+
/**
|
|
138
|
+
* Creates a fully mocked PluginContext.
|
|
139
|
+
* Useful for testing `renderPopup` and other functions that require a PluginContext.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* const ctx = mockPluginContext({ getState: () => state, dispatch });
|
|
144
|
+
* item?.renderPopup?.(container, ctx);
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export declare function mockPluginContext(overrides?: Partial<PluginContext>): PluginContext;
|
|
148
|
+
/**
|
|
149
|
+
* Assert that a value is defined (not undefined/null).
|
|
150
|
+
* Provides type narrowing for subsequent code.
|
|
151
|
+
*/
|
|
152
|
+
export declare function assertDefined<T>(value: T | undefined | null, msg?: string): asserts value is T;
|
|
153
|
+
//# sourceMappingURL=TestUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestUtils.d.ts","sourceRoot":"","sources":["../../src/test/TestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EACN,KAAK,SAAS,EACd,KAAK,IAAI,EAGT,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AAE,OAAO,CAAC,wBAAwB,CAAC,GAC3C,wBAAwB,CAQ1B;AAMD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CA0BnF;AAMD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAI9F"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DecorationSet } from '../decorations/Decoration.js';
|
|
2
|
+
import { SchemaRegistry } from '../model/SchemaRegistry.js';
|
|
3
|
+
import { EditorState } from '../state/EditorState.js';
|
|
4
|
+
import { HistoryManager } from '../state/History.js';
|
|
5
|
+
import { Transaction } from '../state/Transaction.js';
|
|
6
|
+
export type StateChangeCallback = (oldState: EditorState, newState: EditorState, tr: Transaction) => void;
|
|
7
|
+
export interface EditorViewOptions {
|
|
8
|
+
state: EditorState;
|
|
9
|
+
schemaRegistry?: SchemaRegistry;
|
|
10
|
+
maxHistoryDepth?: number;
|
|
11
|
+
onStateChange?: StateChangeCallback;
|
|
12
|
+
getDecorations?: (state: EditorState, tr?: Transaction) => DecorationSet;
|
|
13
|
+
}
|
|
14
|
+
export declare class EditorView {
|
|
15
|
+
private state;
|
|
16
|
+
private readonly contentElement;
|
|
17
|
+
private readonly inputHandler;
|
|
18
|
+
private readonly keyboardHandler;
|
|
19
|
+
private readonly pasteHandler;
|
|
20
|
+
private readonly clipboardHandler;
|
|
21
|
+
readonly history: HistoryManager;
|
|
22
|
+
private readonly stateChangeCallbacks;
|
|
23
|
+
private readonly handleSelectionChange;
|
|
24
|
+
private readonly handleMousedown;
|
|
25
|
+
private readonly handleDragover;
|
|
26
|
+
private readonly handleDrop;
|
|
27
|
+
private isUpdating;
|
|
28
|
+
private pendingNodeSelectionClear;
|
|
29
|
+
private readonly schemaRegistry?;
|
|
30
|
+
private readonly nodeViews;
|
|
31
|
+
private decorations;
|
|
32
|
+
private readonly getDecorations?;
|
|
33
|
+
constructor(contentElement: HTMLElement, options: EditorViewOptions);
|
|
34
|
+
/** Returns the current editor state. */
|
|
35
|
+
getState(): EditorState;
|
|
36
|
+
/**
|
|
37
|
+
* Central update cycle: sets state, collects decorations, reconciles DOM,
|
|
38
|
+
* syncs selection, and notifies listeners. Guarded against re-entrancy.
|
|
39
|
+
*/
|
|
40
|
+
private applyUpdate;
|
|
41
|
+
/** Dispatches a transaction, updates state, reconciles DOM, syncs selection. */
|
|
42
|
+
dispatch(tr: Transaction): void;
|
|
43
|
+
/** Performs undo. */
|
|
44
|
+
undo(): void;
|
|
45
|
+
/** Performs redo. */
|
|
46
|
+
redo(): void;
|
|
47
|
+
/** Registers a state change callback. */
|
|
48
|
+
onStateChange(callback: StateChangeCallback): () => void;
|
|
49
|
+
/** Replaces the editor state without destroying handlers or history. */
|
|
50
|
+
replaceState(newState: EditorState): void;
|
|
51
|
+
/** Syncs the DOM selection to the editor state. */
|
|
52
|
+
private syncSelectionFromDOM;
|
|
53
|
+
/** Handles mousedown on selectable/void blocks to create NodeSelection. */
|
|
54
|
+
private onMousedown;
|
|
55
|
+
/**
|
|
56
|
+
* When the user clicks in empty space below all rendered blocks,
|
|
57
|
+
* appends a new paragraph after the last block and focuses it.
|
|
58
|
+
*/
|
|
59
|
+
private handleClickBelowContent;
|
|
60
|
+
/** Builds an array of block IDs from root to leaf. */
|
|
61
|
+
private buildBlockPath;
|
|
62
|
+
/** Allows file drop by preventing default on dragover when files are present. */
|
|
63
|
+
private onDragover;
|
|
64
|
+
/** Handles file drop by delegating to registered file handlers. */
|
|
65
|
+
private onDrop;
|
|
66
|
+
/** Converts screen coordinates to an editor Position. */
|
|
67
|
+
private getPositionFromPoint;
|
|
68
|
+
/** Handles DOM selection changes (clicks, arrow keys). */
|
|
69
|
+
private onSelectionChange;
|
|
70
|
+
private reconcileOptions;
|
|
71
|
+
/** Cleans up all event listeners and handlers. */
|
|
72
|
+
destroy(): void;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=EditorView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorView.d.ts","sourceRoot":"","sources":["../../src/view/EditorView.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAM7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAUjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAK3D,MAAM,MAAM,mBAAmB,GAAG,CACjC,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,WAAW,EACrB,EAAE,EAAE,WAAW,KACX,IAAI,CAAC;AAEV,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,WAAW,CAAC;IACnB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,WAAW,KAAK,aAAa,CAAC;CACzE;AAED,qBAAa,UAAU;IACtB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAc;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,OAAO,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AgB;IAgBxB,kDAAkD;IAClD,OAAO,IAAI,IAAI;CAef"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BlockNode } from '../model/Document.js';
|
|
2
|
+
import { EditorState } from '../state/EditorState.js';
|
|
3
|
+
import { Transaction } from '../state/Transaction.js';
|
|
4
|
+
export interface NodeView {
|
|
5
|
+
/** Root DOM element. Must have `data-block-id` set. */
|
|
6
|
+
readonly dom: HTMLElement;
|
|
7
|
+
/** Where text children are rendered. Null for void nodes. */
|
|
8
|
+
readonly contentDOM: HTMLElement | null;
|
|
9
|
+
/** For nodes with multiple content areas (e.g. table cells), returns the DOM for a specific child. */
|
|
10
|
+
getContentDOM?(childId: string): HTMLElement | null;
|
|
11
|
+
/** Returns true if the update was handled, false to re-create the NodeView. */
|
|
12
|
+
update?(node: BlockNode): boolean;
|
|
13
|
+
destroy?(): void;
|
|
14
|
+
selectNode?(): void;
|
|
15
|
+
deselectNode?(): void;
|
|
16
|
+
}
|
|
17
|
+
export type NodeViewFactory = (node: BlockNode, getState: () => EditorState, dispatch: (tr: Transaction) => void) => NodeView;
|
|
18
|
+
//# sourceMappingURL=NodeView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeView.d.ts","sourceRoot":"","sources":["../../src/view/NodeView.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,WAAW,QAAQ;IACxB,uDAAuD;IACvD,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IACxC,sGAAsG;IACtG,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;IACpD,+EAA+E;IAC/E,MAAM,CAAC,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAClC,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,UAAU,CAAC,IAAI,IAAI,CAAC;IACpB,YAAY,CAAC,IAAI,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,CAC7B,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,MAAM,WAAW,EAC3B,QAAQ,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,KAC/B,QAAQ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InlineDecoration, DecorationSet } from '../decorations/Decoration.js';
|
|
2
|
+
import { BlockNode } from '../model/Document.js';
|
|
3
|
+
import { SchemaRegistry } from '../model/SchemaRegistry.js';
|
|
4
|
+
import { BlockId } from '../model/TypeBrands.js';
|
|
5
|
+
import { EditorState } from '../state/EditorState.js';
|
|
6
|
+
import { NodeView } from './NodeView.js';
|
|
7
|
+
export interface ReconcileOptions {
|
|
8
|
+
registry?: SchemaRegistry;
|
|
9
|
+
nodeViews?: Map<string, NodeView>;
|
|
10
|
+
getState?: () => EditorState;
|
|
11
|
+
dispatch?: (tr: import('../state/Transaction.js').Transaction) => void;
|
|
12
|
+
decorations?: DecorationSet;
|
|
13
|
+
oldDecorations?: DecorationSet;
|
|
14
|
+
selectedNodeId?: BlockId;
|
|
15
|
+
previousSelectedNodeId?: BlockId;
|
|
16
|
+
}
|
|
17
|
+
/** Reconciles the DOM container to match the new state. */
|
|
18
|
+
export declare function reconcile(container: HTMLElement, oldState: EditorState | null, newState: EditorState, options?: ReconcileOptions): void;
|
|
19
|
+
/** Renders a block node to a DOM element, using registry specs or NodeViews. */
|
|
20
|
+
export declare function renderBlock(block: BlockNode, registry?: SchemaRegistry, nodeViews?: Map<string, NodeView>, options?: ReconcileOptions): HTMLElement;
|
|
21
|
+
/** Renders block content (inline children) into a container element. */
|
|
22
|
+
export declare function renderBlockContent(container: HTMLElement, block: BlockNode, registry?: SchemaRegistry, inlineDecos?: readonly InlineDecoration[]): void;
|
|
23
|
+
//# sourceMappingURL=Reconciler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reconciler.d.ts","sourceRoot":"","sources":["../../src/view/Reconciler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAA+B,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,KAAK,aAAa,EAAyB,MAAM,8BAA8B,CAAC;AAEzF,OAAO,KAAK,EAAE,SAAS,EAA8B,MAAM,sBAAsB,CAAC;AAWlF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,yBAAyB,EAAE,WAAW,KAAK,IAAI,CAAC;IACvE,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,2DAA2D;AAC3D,wBAAgB,SAAS,CACxB,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,QAAQ,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,gBAAgB,GACxB,IAAI,CAuIN;AA0DD,gFAAgF;AAChF,wBAAgB,WAAW,CAC1B,KAAK,EAAE,SAAS,EAChB,QAAQ,CAAC,EAAE,cAAc,EACzB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EACjC,OAAO,CAAC,EAAE,gBAAgB,GACxB,WAAW,CA0Fb;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,SAAS,EAChB,QAAQ,CAAC,EAAE,cAAc,EACzB,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,GACvC,IAAI,CAoCN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorSelection, Position, Selection } from '../model/Selection.js';
|
|
2
|
+
/** Syncs the editor state selection to the DOM. */
|
|
3
|
+
export declare function syncSelectionToDOM(container: HTMLElement, selection: EditorSelection): void;
|
|
4
|
+
/** Reads the current DOM selection and converts it to a state selection. */
|
|
5
|
+
export declare function readSelectionFromDOM(container: HTMLElement): Selection | null;
|
|
6
|
+
/** Converts a DOM position to a state position, including nested path. */
|
|
7
|
+
export declare function domPositionToState(container: HTMLElement, node: Node, domOffset: number): Position | null;
|
|
8
|
+
//# sourceMappingURL=SelectionSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionSync.d.ts","sourceRoot":"","sources":["../../src/view/SelectionSync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAmBlF,mDAAmD;AACnD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CA6B3F;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAgB7E;AAsED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,WAAW,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,GACf,QAAQ,GAAG,IAAI,CAwEjB"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notectl/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A modern and accessable rich text editor shipped as a single Web Component. Immutable state, transaction-based architecture, and a plugin system that powers every feature.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/notectl-core.umd.js",
|
|
8
9
|
"module": "./dist/notectl-core.mjs",
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/index.d.ts",
|
|
13
14
|
"import": "./dist/notectl-core.mjs",
|
|
14
|
-
"require": "./dist/notectl-core.js"
|
|
15
|
+
"require": "./dist/notectl-core.umd.js"
|
|
16
|
+
},
|
|
17
|
+
"./fonts": {
|
|
18
|
+
"types": "./dist/fonts.d.ts",
|
|
19
|
+
"import": "./dist/fonts.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./plugins/text-formatting": {
|
|
22
|
+
"types": "./dist/plugins/text-formatting/index.d.ts",
|
|
23
|
+
"import": "./dist/plugins/text-formatting.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./plugins/heading": {
|
|
26
|
+
"types": "./dist/plugins/heading/index.d.ts",
|
|
27
|
+
"import": "./dist/plugins/heading.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./plugins/toolbar": {
|
|
30
|
+
"types": "./dist/plugins/toolbar/index.d.ts",
|
|
31
|
+
"import": "./dist/plugins/toolbar.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./plugins/table": {
|
|
34
|
+
"types": "./dist/plugins/table/index.d.ts",
|
|
35
|
+
"import": "./dist/plugins/table.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./plugins/image": {
|
|
38
|
+
"types": "./dist/plugins/image/index.d.ts",
|
|
39
|
+
"import": "./dist/plugins/image.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./plugins/code-block": {
|
|
42
|
+
"types": "./dist/plugins/code-block/index.d.ts",
|
|
43
|
+
"import": "./dist/plugins/code-block.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./plugins/link": {
|
|
46
|
+
"types": "./dist/plugins/link/index.d.ts",
|
|
47
|
+
"import": "./dist/plugins/link.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./plugins/list": {
|
|
50
|
+
"types": "./dist/plugins/list/index.d.ts",
|
|
51
|
+
"import": "./dist/plugins/list.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./plugins/blockquote": {
|
|
54
|
+
"types": "./dist/plugins/blockquote/index.d.ts",
|
|
55
|
+
"import": "./dist/plugins/blockquote.mjs"
|
|
56
|
+
},
|
|
57
|
+
"./plugins/strikethrough": {
|
|
58
|
+
"types": "./dist/plugins/strikethrough/index.d.ts",
|
|
59
|
+
"import": "./dist/plugins/strikethrough.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./plugins/text-color": {
|
|
62
|
+
"types": "./dist/plugins/text-color/index.d.ts",
|
|
63
|
+
"import": "./dist/plugins/text-color.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./plugins/horizontal-rule": {
|
|
66
|
+
"types": "./dist/plugins/horizontal-rule/index.d.ts",
|
|
67
|
+
"import": "./dist/plugins/horizontal-rule.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./plugins/alignment": {
|
|
70
|
+
"types": "./dist/plugins/alignment/index.d.ts",
|
|
71
|
+
"import": "./dist/plugins/alignment.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./plugins/font": {
|
|
74
|
+
"types": "./dist/plugins/font/index.d.ts",
|
|
75
|
+
"import": "./dist/plugins/font.mjs"
|
|
76
|
+
},
|
|
77
|
+
"./plugins/font-size": {
|
|
78
|
+
"types": "./dist/plugins/font-size/index.d.ts",
|
|
79
|
+
"import": "./dist/plugins/font-size.mjs"
|
|
80
|
+
},
|
|
81
|
+
"./plugins/highlight": {
|
|
82
|
+
"types": "./dist/plugins/highlight/index.d.ts",
|
|
83
|
+
"import": "./dist/plugins/highlight.mjs"
|
|
84
|
+
},
|
|
85
|
+
"./plugins/super-sub": {
|
|
86
|
+
"types": "./dist/plugins/super-sub/index.d.ts",
|
|
87
|
+
"import": "./dist/plugins/super-sub.mjs"
|
|
88
|
+
},
|
|
89
|
+
"./plugins/hard-break": {
|
|
90
|
+
"types": "./dist/plugins/hard-break/index.d.ts",
|
|
91
|
+
"import": "./dist/plugins/hard-break.mjs"
|
|
15
92
|
}
|
|
16
93
|
},
|
|
17
94
|
"files": ["dist", "README.md"],
|
|
@@ -36,22 +113,46 @@
|
|
|
36
113
|
"url": "https://github.com/Samyssmile/notectl/issues"
|
|
37
114
|
},
|
|
38
115
|
"scripts": {
|
|
39
|
-
"build": "vite build",
|
|
116
|
+
"build": "vite build && vite build --config vite.config.umd.ts",
|
|
40
117
|
"prepack": "cp ../../README.md ./README.md",
|
|
41
118
|
"postpack": "rm -f ./README.md",
|
|
42
119
|
"test": "vitest run",
|
|
43
120
|
"test:watch": "vitest",
|
|
44
121
|
"typecheck": "tsc --noEmit",
|
|
45
|
-
"dev": "vite build --watch"
|
|
122
|
+
"dev": "vite build --watch",
|
|
123
|
+
"size": "size-limit",
|
|
124
|
+
"size:check": "size-limit --limit"
|
|
46
125
|
},
|
|
126
|
+
"size-limit": [
|
|
127
|
+
{
|
|
128
|
+
"name": "Core (main entry)",
|
|
129
|
+
"path": "dist/notectl-core.mjs",
|
|
130
|
+
"limit": "75 KB",
|
|
131
|
+
"gzip": true
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "Fonts (standalone)",
|
|
135
|
+
"path": "dist/fonts.mjs",
|
|
136
|
+
"limit": "300 KB",
|
|
137
|
+
"gzip": true
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "Plugin: Table",
|
|
141
|
+
"path": "dist/plugins/table.mjs",
|
|
142
|
+
"limit": "15 KB",
|
|
143
|
+
"gzip": true
|
|
144
|
+
}
|
|
145
|
+
],
|
|
47
146
|
"dependencies": {
|
|
48
|
-
"dompurify": "^3.
|
|
147
|
+
"dompurify": "^3.3.1"
|
|
49
148
|
},
|
|
50
149
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
150
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
151
|
+
"@size-limit/preset-small-lib": "^12.0.0",
|
|
152
|
+
"happy-dom": "^20.6.3",
|
|
153
|
+
"size-limit": "^12.0.0",
|
|
154
|
+
"vite": "^7.3.1",
|
|
155
|
+
"vite-plugin-dts": "^4.5.4",
|
|
156
|
+
"vitest": "^4.0.18"
|
|
56
157
|
}
|
|
57
158
|
}
|