platejs 54.0.0-beta.1 → 54.0.0-beta.10
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 +2 -2
- package/THIRD_PARTY_NOTICES.md +85 -0
- package/dist/EditorStatic-4yeXBk1l.d.ts +770 -0
- package/dist/_virtual/_rolldown/runtime.js +28 -0
- package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
- package/dist/ai/index.d.ts +2 -0
- package/dist/ai/index.js +5 -0
- package/dist/ai/lib/aiDraftSession.js +984 -0
- package/dist/ai/lib/aiOutputLanding.internal.js +266 -0
- package/dist/ai/lib/aiPolicy.internal.js +403 -0
- package/dist/ai/lib/editorAgent.js +2285 -0
- package/dist/ai/lib/lockedContext.internal.js +144 -0
- package/dist/ai/lib/lockedContext.js +271 -0
- package/dist/ai/lib/registerEditorTools.js +236 -0
- package/dist/ai/react/AIPlugin.js +246 -0
- package/dist/ai/react/CopilotPlugin.js +553 -0
- package/dist/ai/react/copilotInline.internal.js +358 -0
- package/dist/ai/react/index.d.ts +637 -0
- package/dist/ai/react/index.js +4 -0
- package/dist/ai/react/useEditorAgent.js +193 -0
- package/dist/authored/AuthoredPlugin.js +43 -0
- package/dist/authored/index.d.ts +5 -0
- package/dist/authored/index.js +4 -0
- package/dist/authored/suggestionColorOf.js +15 -0
- package/dist/authored-mT5Oeocy-CDtuTn9d.d.ts +601 -0
- package/dist/clipboard-format-key-CagX2TDf-DE0xLvUC.d.ts +1 -0
- package/dist/code-block/codemirror/createCodeMirrorAdapter.js +673 -0
- package/dist/code-block/codemirror/index.d.ts +19 -0
- package/dist/code-block/codemirror/index.js +2 -0
- package/dist/comment-anchor.internal-D88DNGve.d.ts +28 -0
- package/dist/compiler/compileEditor.js +10 -0
- package/dist/compiler/index.d.ts +18 -0
- package/dist/compiler/index.js +4 -0
- package/dist/core-BkabAj0S.d.ts +11057 -0
- package/dist/core.js +28 -0
- package/dist/diff/index.d.ts +3 -0
- package/dist/diff/index.js +1 -0
- package/dist/docs/agents/mcp.md +105 -0
- package/dist/docs/agents/skills.md +47 -0
- package/dist/docs/agents.md +84 -0
- package/dist/docs/ai.md +761 -0
- package/dist/docs/annotations.md +159 -0
- package/dist/docs/api/anchor.md +105 -0
- package/dist/docs/api/core/plate-components.md +600 -0
- package/dist/docs/api/core/plate-controller.md +81 -0
- package/dist/docs/api/core/plate-editor.md +310 -0
- package/dist/docs/api/core/plate-plugin.md +833 -0
- package/dist/docs/api/core/plate-store.md +107 -0
- package/dist/docs/api/core.md +723 -0
- package/dist/docs/api/document-change.md +257 -0
- package/dist/docs/api/dom.md +438 -0
- package/dist/docs/api/editor-api.md +604 -0
- package/dist/docs/api/editor-transforms.md +673 -0
- package/dist/docs/api/element.md +88 -0
- package/dist/docs/api/location.md +51 -0
- package/dist/docs/api/node.md +213 -0
- package/dist/docs/api/path.md +123 -0
- package/dist/docs/api/plate.md +99 -0
- package/dist/docs/api/point.md +59 -0
- package/dist/docs/api/range.md +105 -0
- package/dist/docs/api/react-hooks.md +692 -0
- package/dist/docs/api/resizable.md +121 -0
- package/dist/docs/api/selection.md +176 -0
- package/dist/docs/api/text.md +55 -0
- package/dist/docs/api/utils.md +149 -0
- package/dist/docs/authored-changes.md +458 -0
- package/dist/docs/autoformat.md +178 -0
- package/dist/docs/basic-blocks.md +205 -0
- package/dist/docs/basic-marks.md +186 -0
- package/dist/docs/block-menu.md +68 -0
- package/dist/docs/block-placeholder.md +165 -0
- package/dist/docs/blockquote.md +164 -0
- package/dist/docs/board.md +738 -0
- package/dist/docs/bold.md +140 -0
- package/dist/docs/browser.md +189 -0
- package/dist/docs/callout.md +200 -0
- package/dist/docs/clear-formatting.md +169 -0
- package/dist/docs/clipboard.md +511 -0
- package/dist/docs/code-block.md +579 -0
- package/dist/docs/code.md +134 -0
- package/dist/docs/column.md +186 -0
- package/dist/docs/combobox.md +232 -0
- package/dist/docs/comment.md +604 -0
- package/dist/docs/controlled.md +278 -0
- package/dist/docs/copilot.md +479 -0
- package/dist/docs/date.md +209 -0
- package/dist/docs/debugging.md +209 -0
- package/dist/docs/decorations.md +66 -0
- package/dist/docs/details.md +324 -0
- package/dist/docs/discussion.md +176 -0
- package/dist/docs/dnd.md +355 -0
- package/dist/docs/document-meta.md +232 -0
- package/dist/docs/document-model.md +396 -0
- package/dist/docs/docx.md +490 -0
- package/dist/docs/dom-coverage.md +101 -0
- package/dist/docs/editing-behavior.md +322 -0
- package/dist/docs/editor-methods.md +257 -0
- package/dist/docs/editor.md +909 -0
- package/dist/docs/emoji.md +223 -0
- package/dist/docs/equation.md +295 -0
- package/dist/docs/examples/collaboration-example.md +46 -0
- package/dist/docs/examples/editable-voids.md +58 -0
- package/dist/docs/examples/export.md +90 -0
- package/dist/docs/examples/huge-document.md +3 -0
- package/dist/docs/examples/hundreds-editors.md +41 -0
- package/dist/docs/examples/preview-markdown.md +43 -0
- package/dist/docs/examples/version-history.md +55 -0
- package/dist/docs/excalidraw.md +200 -0
- package/dist/docs/exit-break.md +240 -0
- package/dist/docs/external-text.md +158 -0
- package/dist/docs/feature-kits.md +147 -0
- package/dist/docs/field.md +682 -0
- package/dist/docs/find.md +151 -0
- package/dist/docs/font.md +188 -0
- package/dist/docs/footnote.md +575 -0
- package/dist/docs/form.md +441 -0
- package/dist/docs/format-painter.md +224 -0
- package/dist/docs/heading.md +99 -0
- package/dist/docs/highlight.md +135 -0
- package/dist/docs/history.md +548 -0
- package/dist/docs/horizontal-rule.md +181 -0
- package/dist/docs/html.md +415 -0
- package/dist/docs/indent.md +233 -0
- package/dist/docs/index.md +116 -0
- package/dist/docs/ink.md +246 -0
- package/dist/docs/installation/manual.md +392 -0
- package/dist/docs/installation/next.md +368 -0
- package/dist/docs/installation/node.md +152 -0
- package/dist/docs/installation/plate-ui.md +316 -0
- package/dist/docs/installation/react.md +347 -0
- package/dist/docs/installation/rsc.md +138 -0
- package/dist/docs/installation.md +93 -0
- package/dist/docs/italic.md +128 -0
- package/dist/docs/kbd.md +125 -0
- package/dist/docs/line-height.md +171 -0
- package/dist/docs/link.md +316 -0
- package/dist/docs/lint.md +482 -0
- package/dist/docs/list.md +317 -0
- package/dist/docs/llms.txt +151 -0
- package/dist/docs/locations.md +232 -0
- package/dist/docs/lock.md +271 -0
- package/dist/docs/markdown.md +809 -0
- package/dist/docs/media.md +703 -0
- package/dist/docs/mention.md +184 -0
- package/dist/docs/multi-select.md +105 -0
- package/dist/docs/navigation-feedback.md +196 -0
- package/dist/docs/pagination.md +181 -0
- package/dist/docs/performance.md +105 -0
- package/dist/docs/plugin-components.md +236 -0
- package/dist/docs/plugin-context.md +391 -0
- package/dist/docs/plugin-input-rules.md +993 -0
- package/dist/docs/plugin-methods.md +468 -0
- package/dist/docs/plugin-rules.md +880 -0
- package/dist/docs/plugin-shortcuts.md +443 -0
- package/dist/docs/plugin.md +611 -0
- package/dist/docs/prompt-editor.md +269 -0
- package/dist/docs/releases.md +3 -0
- package/dist/docs/roots.md +399 -0
- package/dist/docs/rtl.md +64 -0
- package/dist/docs/schema.md +159 -0
- package/dist/docs/selection.md +239 -0
- package/dist/docs/serializing.md +216 -0
- package/dist/docs/single-block.md +136 -0
- package/dist/docs/slash-command.md +143 -0
- package/dist/docs/static.md +458 -0
- package/dist/docs/strikethrough.md +131 -0
- package/dist/docs/subscript.md +113 -0
- package/dist/docs/suggestion.md +345 -0
- package/dist/docs/superscript.md +113 -0
- package/dist/docs/sync.md +286 -0
- package/dist/docs/tabbable.md +238 -0
- package/dist/docs/table.md +378 -0
- package/dist/docs/text-align.md +161 -0
- package/dist/docs/toc.md +295 -0
- package/dist/docs/toolbar.md +321 -0
- package/dist/docs/trailing-block.md +111 -0
- package/dist/docs/transactions.md +300 -0
- package/dist/docs/troubleshooting.md +159 -0
- package/dist/docs/typescript.md +77 -0
- package/dist/docs/underline.md +125 -0
- package/dist/docs/unit-testing.md +340 -0
- package/dist/docs/upload.md +379 -0
- package/dist/docs/virtualized-rendering.md +75 -0
- package/dist/docx/export/index.d.ts +225 -0
- package/dist/docx/export/index.js +2 -0
- package/dist/docx/export/lib/colors.js +307 -0
- package/dist/docx/export/lib/compileAst.js +1955 -0
- package/dist/docx/export/lib/exportDocx.js +415 -0
- package/dist/docx/export/lib/mathOmml.js +233 -0
- package/dist/docx/export/lib/ooxmlBuilder.js +1760 -0
- package/dist/docx/export/lib/outputSafety.js +196 -0
- package/dist/docx/export/lib/reviewProjection.js +135 -0
- package/dist/docx/export/lib/sourcePreservation.js +435 -0
- package/dist/docx/export/lib/wordStyles.js +399 -0
- package/dist/docx/html/cleanWordHtml.internal.js +371 -0
- package/dist/docx/import/index.d.ts +44 -0
- package/dist/docx/import/index.js +3 -0
- package/dist/docx/import/lib/importDocx.js +1637 -0
- package/dist/docx/import/lib/opcRelationships.js +77 -0
- package/dist/docx/import/lib/readWordDocument.js +990 -0
- package/dist/docx/import/lib/wordStyles.js +534 -0
- package/dist/docx/internal/abort.js +8 -0
- package/dist/docx/internal/diagnostics.js +67 -0
- package/dist/docx/internal/docxPackage.js +298 -0
- package/dist/docx/internal/domParser.js +4 -0
- package/dist/docx/internal/packageParts.js +72 -0
- package/dist/docx/internal/readDocxNumbering.js +196 -0
- package/dist/docx/internal/reviewPart.js +250 -0
- package/dist/docx/internal/source.js +77 -0
- package/dist/docx/internal/sourceEligibility.js +406 -0
- package/dist/docx/internal/wordMath.js +340 -0
- package/dist/docx/internal/wordMathVocabulary.js +110 -0
- package/dist/docx/internal/xmlTree.js +262 -0
- package/dist/docx/internal/xmlWriter.js +44 -0
- package/dist/docx/paste/index.d.ts +28 -0
- package/dist/docx/paste/index.js +2 -0
- package/dist/docx/paste/lib/WordPastePlugin.js +330 -0
- package/dist/dom/index.d.ts +2 -0
- package/dist/dom/index.js +2 -0
- package/dist/dom/plite-dom.internal.js +2 -0
- package/dist/excalidraw/index.d.ts +60 -0
- package/dist/excalidraw/index.js +2 -0
- package/dist/excalidraw/lib/BaseExcalidrawPlugin.js +27 -0
- package/dist/excalidraw/react/ExcalidrawPlugin.js +6 -0
- package/dist/excalidraw/react/index.d.ts +104 -0
- package/dist/excalidraw/react/index.js +3 -0
- package/dist/excalidraw/react/useExcalidrawSync.js +103 -0
- package/dist/facade.js +3 -0
- package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +215 -0
- package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +167 -0
- package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +404 -0
- package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +394 -0
- package/dist/features/basic-styles/lib/BaseStylePlugins.js +258 -0
- package/dist/features/board/index.d.ts +2 -0
- package/dist/features/board/index.js +10 -0
- package/dist/features/board/lib/BaseBoardArrowPlugin.js +126 -0
- package/dist/features/board/lib/BaseBoardFramePlugin.js +84 -0
- package/dist/features/board/lib/BaseBoardGeoPlugin.js +13 -0
- package/dist/features/board/lib/BaseBoardImagePlugin.js +72 -0
- package/dist/features/board/lib/BaseBoardNotePlugin.js +12 -0
- package/dist/features/board/lib/BaseBoardPlugin.js +765 -0
- package/dist/features/board/lib/BaseBoardStrokePlugin.js +83 -0
- package/dist/features/board/lib/BaseBoardTextPlugin.js +13 -0
- package/dist/features/board/lib/boardArrow.internal.js +193 -0
- package/dist/features/board/lib/boardCopy.internal.js +284 -0
- package/dist/features/board/lib/boardFrame.internal.js +123 -0
- package/dist/features/board/lib/boardGeometry.internal.js +124 -0
- package/dist/features/board/lib/boardHeights.internal.js +57 -0
- package/dist/features/board/lib/boardHtml.internal.js +114 -0
- package/dist/features/board/lib/boardMember.internal.js +143 -0
- package/dist/features/board/lib/boardRatio.internal.js +21 -0
- package/dist/features/board/lib/boardShape.internal.js +84 -0
- package/dist/features/board/lib/boardStroke.internal.js +45 -0
- package/dist/features/board/lib/boardStyle.internal.js +130 -0
- package/dist/features/board/lib/boardTypes.internal.js +28 -0
- package/dist/features/callout/index.d.ts +160 -0
- package/dist/features/callout/index.js +2 -0
- package/dist/features/callout/lib/BaseCalloutPlugin.js +356 -0
- package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +736 -0
- package/dist/features/code-block/lib/CodeBlockRules.js +140 -0
- package/dist/features/column/index.d.ts +2 -0
- package/dist/features/column/index.js +2 -0
- package/dist/features/column/lib/BaseColumnPlugin.js +693 -0
- package/dist/features/comments/BaseCommentsPlugin.js +1984 -0
- package/dist/features/comments/comment-thread-index.internal.js +823 -0
- package/dist/features/comments/index.d.ts +3 -0
- package/dist/features/comments/index.js +2 -0
- package/dist/features/date/index.d.ts +42 -0
- package/dist/features/date/index.js +3 -0
- package/dist/features/date/lib/BaseDatePlugin.js +158 -0
- package/dist/features/date/lib/dateValue.js +17 -0
- package/dist/features/date/lib/legacyDateValue.internal.js +39 -0
- package/dist/features/details/index.d.ts +364 -0
- package/dist/features/details/index.js +2 -0
- package/dist/features/details/lib/BaseDetailsPlugin.js +615 -0
- package/dist/features/field/index.d.ts +2 -0
- package/dist/features/field/index.js +4 -0
- package/dist/features/field/lib/BaseFieldPlugin.js +550 -0
- package/dist/features/field/lib/applyFieldValues.js +437 -0
- package/dist/features/field/lib/fieldRules.internal.js +710 -0
- package/dist/features/find/index.d.ts +138 -0
- package/dist/features/find/index.js +2 -0
- package/dist/features/find/lib/BaseFindPlugin.js +1618 -0
- package/dist/features/footnote/index.d.ts +428 -0
- package/dist/features/footnote/index.js +2 -0
- package/dist/features/footnote/lib/BaseFootnotePlugin.js +733 -0
- package/dist/features/footnote/lib/internal/getFootnoteTarget.js +31 -0
- package/dist/features/indent/lib/BaseIndentPlugin.js +311 -0
- package/dist/features/indent/lib/indentHtml.internal.js +9 -0
- package/dist/features/indent/lib/indentLevel.internal.js +9 -0
- package/dist/features/ink/index.d.ts +2 -0
- package/dist/features/ink/index.js +2 -0
- package/dist/features/ink/lib/BaseInkPlugin.js +801 -0
- package/dist/features/ink/lib/inkAnchor.internal.js +436 -0
- package/dist/features/ink/lib/inkCodec.internal.js +145 -0
- package/dist/features/ink/lib/inkMatch.internal.js +443 -0
- package/dist/features/ink/lib/inkPlaces.internal.js +232 -0
- package/dist/features/ink/lib/inkReflow.internal.js +406 -0
- package/dist/features/link/lib/BaseLinkPlugin.js +786 -0
- package/dist/features/lint/index.d.ts +117 -0
- package/dist/features/lint/index.js +2 -0
- package/dist/features/lint/lib/BaseLintPlugin.js +1034 -0
- package/dist/features/list/lib/BaseListPlugin.js +279 -0
- package/dist/features/list/lib/listCommands.internal.js +161 -0
- package/dist/features/list/lib/listConversion.internal.js +55 -0
- package/dist/features/list/lib/listFamily.internal.js +165 -0
- package/dist/features/list/lib/listHtml.internal.js +195 -0
- package/dist/features/list/lib/listIdentity.internal.js +455 -0
- package/dist/features/list/lib/listIndex.internal.js +376 -0
- package/dist/features/list/lib/listKeyboard.internal.js +176 -0
- package/dist/features/list/lib/listMarkdown.internal.js +127 -0
- package/dist/features/list/lib/listNumbering.internal.js +391 -0
- package/dist/features/list/lib/listPaste.internal.js +81 -0
- package/dist/features/list/lib/listRules.internal.js +125 -0
- package/dist/features/lock/index.d.ts +2 -0
- package/dist/features/lock/index.js +2 -0
- package/dist/features/lock/lib/BaseLockPlugin.js +644 -0
- package/dist/features/media/index.d.ts +2 -0
- package/dist/features/media/index.js +5 -0
- package/dist/features/media/lib/BaseMediaPlugin.js +316 -0
- package/dist/features/media/lib/image/BaseImagePlugin.js +355 -0
- package/dist/features/media/lib/media/parseMediaEmbedUrl.internal.js +326 -0
- package/dist/features/media/lib/media/parseMediaEmbedUrl.js +12 -0
- package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +193 -0
- package/dist/features/media/lib/mediaHtml.internal.js +43 -0
- package/dist/features/media/lib/mediaPasteRule.internal.js +89 -0
- package/dist/features/media/lib/mediaPlugin.internal.js +201 -0
- package/dist/features/mention/index.d.ts +66 -0
- package/dist/features/mention/index.js +2 -0
- package/dist/features/mention/lib/BaseMentionPlugin.js +116 -0
- package/dist/features/table/index.d.ts +3 -0
- package/dist/features/table/index.js +2 -0
- package/dist/features/table/lib/BaseTablePlugin.js +1886 -0
- package/dist/features/table/lib/internal/authoredProjection.js +172 -0
- package/dist/features/table/lib/internal/axisMove.js +152 -0
- package/dist/features/table/lib/internal/context.js +58 -0
- package/dist/features/table/lib/internal/docxBorders.js +39 -0
- package/dist/features/table/lib/internal/grid.js +226 -0
- package/dist/features/table/lib/internal/mutation.js +546 -0
- package/dist/features/table/lib/internal/paste.js +327 -0
- package/dist/features/table/lib/internal/selection.js +420 -0
- package/dist/features/table/lib/internal/tableCellHtml.js +280 -0
- package/dist/features/table/lib/internal/tabularText.js +51 -0
- package/dist/features/table/lib/internal/widths.js +136 -0
- package/dist/features/toc/index.d.ts +2 -0
- package/dist/features/toc/index.js +2 -0
- package/dist/features/toc/lib/BaseTocPlugin.js +133 -0
- package/dist/features/upload/index.d.ts +2 -0
- package/dist/features/upload/index.js +3 -0
- package/dist/features/upload/lib/BaseUploadPlugin.js +895 -0
- package/dist/features/upload/lib/uploadRules.internal.js +259 -0
- package/dist/history/index.d.ts +2 -0
- package/dist/history/index.js +2 -0
- package/dist/history/plite-history.internal.js +2 -0
- package/dist/html/index.d.ts +5 -0
- package/dist/html/index.js +3 -0
- package/dist/html/server/index.d.ts +7 -0
- package/dist/html/server/index.js +20 -0
- package/dist/html/server/serverCssParser.internal.js +500 -0
- package/dist/html/server/serverCssStyle.internal.js +208 -0
- package/dist/htmlConversion-BvIl0E7N.d.ts +9 -0
- package/dist/htmlTypes-Cn2NA_Ob.d.ts +208 -0
- package/dist/hyperscript/index.d.ts +2 -0
- package/dist/hyperscript/index.js +1 -0
- package/dist/index-892oQuAa.d.ts +652 -0
- package/dist/index-B5qZ1xmJ.d.ts +602 -0
- package/dist/index-B9-eQ9Fa.d.ts +97 -0
- package/dist/index-BEuhgxYz-D9RcNZzE.d.ts +328 -0
- package/dist/index-BJMoiUqB.d.ts +57 -0
- package/dist/index-BRQpLUWT.d.ts +451 -0
- package/dist/index-BbxcY2IS.d.ts +1328 -0
- package/dist/index-Bkxx74P-.d.ts +37 -0
- package/dist/index-C-okUBnX.d.ts +116 -0
- package/dist/index-CDXEH2X0.d.ts +81 -0
- package/dist/index-CV_mklE2.d.ts +283 -0
- package/dist/index-ClDyiA1c-Bf4Rfc1t.d.ts +111 -0
- package/dist/index-Cz3XONhi.d.ts +899 -0
- package/dist/index-D-erws2m.d.ts +359 -0
- package/dist/index-DA6Ffr7b.d.ts +222 -0
- package/dist/index-DDJTmHad.d.ts +2414 -0
- package/dist/index-DH36U6tA.d.ts +21 -0
- package/dist/index-DN80H5GJ.d.ts +3 -0
- package/dist/index-DjKIXVz4.d.ts +1 -0
- package/dist/index-bZwY4JGn.d.ts +1414 -0
- package/dist/index-lyvnkmwk.d.ts +1 -0
- package/dist/index-s9cC9I5m-BgzFbzDU.d.ts +139 -0
- package/dist/index-wLIOjeY1.d.ts +5653 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +39 -7
- package/dist/internal/comments/comment-anchor.internal.js +636 -0
- package/dist/internal/failInvariant.js +6 -0
- package/dist/internal/mergePlateRenderedAttributes.js +38 -0
- package/dist/internal/penStroke.internal.js +91 -0
- package/dist/internal/plugin/OverridePlugin.js +281 -0
- package/dist/internal/plugin/blockInsertion.js +67 -0
- package/dist/internal/plugin/blockRelease.js +60 -0
- package/dist/internal/plugin/collectPlateNodeMappings.js +72 -0
- package/dist/internal/plugin/compilePlainTextMappings.js +109 -0
- package/dist/internal/plugin/compilePlateFormats.js +127 -0
- package/dist/internal/plugin/compilePlateModel.js +829 -0
- package/dist/internal/plugin/compilePlateShortcuts.js +22 -0
- package/dist/internal/plugin/compilePluginInputMaps.js +126 -0
- package/dist/internal/plugin/createPlateModelPublication.js +270 -0
- package/dist/internal/plugin/createPlateRuntimePlugins.js +274 -0
- package/dist/internal/plugin/defaultElementTag.js +24 -0
- package/dist/internal/plugin/domHandlers.js +166 -0
- package/dist/internal/plugin/getPlateDecorationSources.js +48 -0
- package/dist/internal/plugin/getPluginRenderAttributes.js +16 -0
- package/dist/internal/plugin/imageLink.js +11 -0
- package/dist/internal/plugin/indentShift.js +44 -0
- package/dist/internal/plugin/inlineInsertion.js +29 -0
- package/dist/internal/plugin/insertionAnchor.js +28 -0
- package/dist/internal/plugin/isEditOnlyDisabled.js +27 -0
- package/dist/internal/plugin/markdownEscapes.js +20 -0
- package/dist/internal/plugin/markdownParagraph.js +29 -0
- package/dist/internal/plugin/matchesPluginInject.internal.js +20 -0
- package/dist/internal/plugin/mergeNodeAttributes.internal.js +76 -0
- package/dist/internal/plugin/mergePluginCapabilities.js +90 -0
- package/dist/internal/plugin/pastedUploadFiles.js +4 -0
- package/dist/internal/plugin/pipeInjectNodeProps.js +25 -0
- package/dist/internal/plugin/plateRuntime.js +29 -0
- package/dist/internal/plugin/pluginDescriptorSnapshot.js +171 -0
- package/dist/internal/plugin/pluginFormatOperation.js +105 -0
- package/dist/internal/plugin/pluginInjectNodeProps.js +66 -0
- package/dist/internal/plugin/pluginNodeClass.internal.js +6 -0
- package/dist/internal/plugin/pluginStore.js +161 -0
- package/dist/internal/plugin/resolvePlugin.js +250 -0
- package/dist/internal/plugin/resolvePluginGraph.js +352 -0
- package/dist/internal/plugin/resolvePlugins.js +57 -0
- package/dist/internal/plugin/staticReuseKey.internal.js +15 -0
- package/dist/internal/plugin/uploadDrafts.js +11 -0
- package/dist/internal/utils/isFunction.js +6 -0
- package/dist/internal/utils/mergePlugins.js +220 -0
- package/dist/internal/utils/snapshotApiValue.js +29 -0
- package/dist/internal/utils/trustedContentSlice.js +9 -0
- package/dist/internal/utils/urlPolicy.js +128 -0
- package/dist/internal/utils/vscodeClipboard.js +11 -0
- package/dist/lib/editor/editorApplicationSchema.js +19 -0
- package/dist/lib/editor/editorUser.internal.js +47 -0
- package/dist/lib/editor/withPlite.js +528 -0
- package/dist/lib/libs/nanoid.js +2 -0
- package/dist/lib/libs/zustand.js +53 -0
- package/dist/lib/plugin/assertNoPrepareDocument.internal.js +7 -0
- package/dist/lib/plugin/basePluginFactory.internal.js +7 -0
- package/dist/lib/plugin/createPluginContext.internal.js +344 -0
- package/dist/lib/plugin/defineBasePlugin.internal.js +263 -0
- package/dist/lib/plugin/definePlugin.js +11 -0
- package/dist/lib/plugin/pluginAuthoringContext.js +19 -0
- package/dist/lib/plugin/pluginFactoryRuntime.internal.js +40 -0
- package/dist/lib/plugins/HistoryPlugin.js +15 -0
- package/dist/lib/plugins/TransferPlugin.js +7 -0
- package/dist/lib/plugins/affinity/AffinityPlugin.js +185 -0
- package/dist/lib/plugins/debug/DebugPlugin.js +62 -0
- package/dist/lib/plugins/dom/DOMPlugin.js +92 -0
- package/dist/lib/plugins/dom/clipboardFormatKey.internal.js +9 -0
- package/dist/lib/plugins/dom/isPlainTextPasteTarget.internal.js +13 -0
- package/dist/lib/plugins/dom/plateDOMPlugin.internal.js +6 -0
- package/dist/lib/plugins/getCorePlugins.internal.js +23 -0
- package/dist/lib/plugins/html/HtmlPlugin.js +256 -0
- package/dist/lib/plugins/html/htmlAst.js +319 -0
- package/dist/lib/plugins/html/htmlConversion.js +19 -0
- package/dist/lib/plugins/html/htmlDecode.internal.js +891 -0
- package/dist/lib/plugins/html/htmlDom.js +194 -0
- package/dist/lib/plugins/html/htmlMatcher.internal.js +108 -0
- package/dist/lib/plugins/html/htmlRules.internal.js +490 -0
- package/dist/lib/plugins/html/htmlSafety.js +150 -0
- package/dist/lib/plugins/html/htmlSerialize.internal.js +462 -0
- package/dist/lib/plugins/html/htmlWhitespace.internal.js +137 -0
- package/dist/lib/plugins/input-rules/InputRulesPlugin.js +470 -0
- package/dist/lib/plugins/input-rules/createInputRules.js +286 -0
- package/dist/lib/plugins/input-rules/defineInputRule.js +6 -0
- package/dist/lib/plugins/input-rules/inputRuleContinuation.internal.js +13 -0
- package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +118 -0
- package/dist/lib/plugins/input-rules/inputRuleVeto.js +9 -0
- package/dist/lib/plugins/input-rules/inputRules.internal.js +20 -0
- package/dist/lib/plugins/input-rules/markInputRule.internal.js +106 -0
- package/dist/lib/plugins/paragraph/BaseParagraphPlugin.js +30 -0
- package/dist/lib/utils/applyDeepToNodes.js +17 -0
- package/dist/lib/utils/defaultsDeepToNodes.js +12 -0
- package/dist/lib/utils/environment.js +4 -0
- package/dist/lib/utils/getFragmentProp.js +27 -0
- package/dist/lib/utils/getInjectMatch.js +9 -0
- package/dist/lib/utils/isDefined.js +5 -0
- package/dist/lib/utils/isUrl.js +27 -0
- package/dist/lib/utils/mergeDeepToNodes.js +12 -0
- package/dist/markdown/index.d.ts +2 -0
- package/dist/markdown/index.js +3 -0
- package/dist/markdown/lib/MarkdownPlugin.js +159 -0
- package/dist/markdown/lib/deserializer/convertChildrenDeserialize.js +8 -0
- package/dist/markdown/lib/deserializer/convertNodesDeserialize.js +103 -0
- package/dist/markdown/lib/deserializer/mdastToSlate.js +26 -0
- package/dist/markdown/lib/internal/markdownAttributes.js +178 -0
- package/dist/markdown/lib/internal/markdownBareLinks.js +265 -0
- package/dist/markdown/lib/internal/markdownBreaks.js +191 -0
- package/dist/markdown/lib/internal/markdownDiagnostics.js +145 -0
- package/dist/markdown/lib/internal/markdownDocument.js +51 -0
- package/dist/markdown/lib/internal/markdownFootnoteWriter.js +35 -0
- package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
- package/dist/markdown/lib/internal/markdownIntrinsics.js +228 -0
- package/dist/markdown/lib/internal/markdownLine.js +575 -0
- package/dist/markdown/lib/internal/markdownMappings.js +767 -0
- package/dist/markdown/lib/internal/markdownParse.js +601 -0
- package/dist/markdown/lib/internal/markdownReferences.js +76 -0
- package/dist/markdown/lib/internal/markdownRuntime.js +353 -0
- package/dist/markdown/lib/internal/markdownSafety.js +175 -0
- package/dist/markdown/lib/internal/markdownSerialize.js +197 -0
- package/dist/markdown/lib/internal/markdownStream.js +1239 -0
- package/dist/markdown/lib/internal/markdownTags.js +704 -0
- package/dist/markdown/lib/internal/markdownTailHeal.js +813 -0
- package/dist/markdown/lib/internal/walkMdast.js +34 -0
- package/dist/markdown/lib/serializer/convertNodesSerialize.js +98 -0
- package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +307 -0
- package/dist/markdown/lib/serializer/listToMdastTree.js +254 -0
- package/dist/markdown/lib/serializer/mdastContent.js +22 -0
- package/dist/markdown/lib/serializer/reportOmittedProperties.js +35 -0
- package/dist/markdown/lib/utils/remarkPlugins.js +55 -0
- package/dist/math/index.d.ts +523 -0
- package/dist/math/index.js +2 -0
- package/dist/math/lib/BaseEquationPlugin.js +427 -0
- package/dist/math/lib/mathmlTex.internal.js +1123 -0
- package/dist/math/lib/mathmlTexSymbols.internal.js +1852 -0
- package/dist/math/react/EquationPlugin.js +7 -0
- package/dist/math/react/index.d.ts +66 -0
- package/dist/math/react/index.js +2 -0
- package/dist/migrations/documentMigrationAuthored.internal.js +19 -0
- package/dist/migrations/documentMigrationSelection.internal.js +163 -0
- package/dist/migrations/documentMigrationTarget.internal.js +25 -0
- package/dist/migrations/documentMigrations.js +311 -0
- package/dist/migrations/extractLegacyCommentRanges.js +141 -0
- package/dist/migrations/index.d.ts +192 -0
- package/dist/migrations/index.js +4 -0
- package/dist/migrations/migratePlateV54.js +173 -0
- package/dist/migrations/migratePlateV54Ast.internal.js +504 -0
- package/dist/migrations/migratePlateV54BuiltIns.internal.js +87 -0
- package/dist/migrations/migratePlateV54CodeBlocks.internal.js +121 -0
- package/dist/migrations/migratePlateV54Inputs.internal.js +193 -0
- package/dist/migrations/migratePlateV54ListIdentity.internal.js +220 -0
- package/dist/migrations/migratePlateV54Ownership.internal.js +20 -0
- package/dist/migrations/migratePlateV54Profile.internal.js +393 -0
- package/dist/migrations/migratePlateV54RetiredMarks.internal.js +63 -0
- package/dist/migrations/migratePlateV54Stage.internal.js +127 -0
- package/dist/migrations/migratePlateV54Suggestions.internal.js +236 -0
- package/dist/migrations/migratePlateV54Toggle.internal.js +66 -0
- package/dist/migrations/migratePlateV54Urls.internal.js +154 -0
- package/dist/migrations/v53-manifest.internal.js +275 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +73 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +75 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/with-selector.js +11 -0
- package/dist/pagination/index.d.ts +2 -0
- package/dist/pagination/index.js +2 -0
- package/dist/pagination/react/PaginationPlugin.js +278 -0
- package/dist/pagination/react/index.d.ts +100 -0
- package/dist/pagination/react/index.js +3 -0
- package/dist/plain-text.js +35 -0
- package/dist/react/authored/AuthoredReactPlugin.js +126 -0
- package/dist/react/authored/index.d.ts +34 -0
- package/dist/react/authored/index.js +3 -0
- package/dist/react/authored/useAuthored.js +82 -0
- package/dist/react/components/EditorContentView.internal.js +323 -0
- package/dist/react/components/EditorProvider.js +33 -0
- package/dist/react/components/EditorRefEffect.internal.js +59 -0
- package/dist/react/components/EditorRefEffect.js +21 -0
- package/dist/react/components/NodeSelection.js +880 -0
- package/dist/react/components/Plate.js +337 -0
- package/dist/react/components/PlateContainer.js +160 -0
- package/dist/react/components/PlateContent.js +36 -0
- package/dist/react/components/PlateController.js +39 -0
- package/dist/react/components/PlateRoot.internal.js +89 -0
- package/dist/react/components/PlateView.js +43 -0
- package/dist/react/components/getPlainText.internal.js +20 -0
- package/dist/react/components/plate-nodes.js +125 -0
- package/dist/react/components/writeStaticSelectionClipboardData.internal.js +221 -0
- package/dist/react/core.js +53 -0
- package/dist/react/editor/getPlateCorePlugins.internal.js +20 -0
- package/dist/react/editor/useCreateEditor.js +45 -0
- package/dist/react/editor/withPlate.js +25 -0
- package/dist/react/features/basic-nodes/BasicNodesPlugins.js +29 -0
- package/dist/react/features/basic-styles/BasicStylePlugins.js +14 -0
- package/dist/react/features/board/BoardPlugin.js +29 -0
- package/dist/react/features/board/BoardShape.js +573 -0
- package/dist/react/features/board/BoardSurface.js +315 -0
- package/dist/react/features/board/boardCamera.internal.js +295 -0
- package/dist/react/features/board/boardClipboard.internal.js +100 -0
- package/dist/react/features/board/boardConnect.internal.js +190 -0
- package/dist/react/features/board/boardExport.internal.js +616 -0
- package/dist/react/features/board/boardGesture.internal.js +749 -0
- package/dist/react/features/board/boardIndex.internal.js +672 -0
- package/dist/react/features/board/boardInk.internal.js +30 -0
- package/dist/react/features/board/boardKeys.internal.js +513 -0
- package/dist/react/features/board/boardLanding.internal.js +147 -0
- package/dist/react/features/board/boardPick.internal.js +74 -0
- package/dist/react/features/board/boardPicking.internal.js +67 -0
- package/dist/react/features/board/boardPictureStyles.internal.js +415 -0
- package/dist/react/features/board/boardPictures.internal.js +96 -0
- package/dist/react/features/board/boardPreview.internal.js +239 -0
- package/dist/react/features/board/boardResize.internal.js +220 -0
- package/dist/react/features/board/boardSnap.internal.js +272 -0
- package/dist/react/features/board/boardStyleView.internal.js +123 -0
- package/dist/react/features/board/boardTextFit.internal.js +311 -0
- package/dist/react/features/board/boardView.internal.js +919 -0
- package/dist/react/features/board/boardVoice.internal.js +205 -0
- package/dist/react/features/board/boardWindow.internal.js +138 -0
- package/dist/react/features/board/index.d.ts +2484 -0
- package/dist/react/features/board/index.js +4 -0
- package/dist/react/features/callout/CalloutPlugin.js +6 -0
- package/dist/react/features/callout/index.d.ts +167 -0
- package/dist/react/features/callout/index.js +2 -0
- package/dist/react/features/code-block/CodeBlockPlugin.js +9 -0
- package/dist/react/features/column/ColumnPlugin.js +9 -0
- package/dist/react/features/column/index.d.ts +560 -0
- package/dist/react/features/column/index.js +2 -0
- package/dist/react/features/combobox/combobox.internal.js +106 -0
- package/dist/react/features/combobox/comboboxOwner.internal.js +291 -0
- package/dist/react/features/combobox/index.d.ts +94 -0
- package/dist/react/features/combobox/index.js +2 -0
- package/dist/react/features/combobox/useCombobox.js +108 -0
- package/dist/react/features/comments/CommentsPlugin.js +33 -0
- package/dist/react/features/comments/index.d.ts +671 -0
- package/dist/react/features/comments/index.js +3 -0
- package/dist/react/features/comments/useCommentThreadIndex.js +288 -0
- package/dist/react/features/date/DatePlugin.js +6 -0
- package/dist/react/features/date/index.d.ts +40 -0
- package/dist/react/features/date/index.js +2 -0
- package/dist/react/features/details/DetailsPlugin.js +8 -0
- package/dist/react/features/details/index.d.ts +501 -0
- package/dist/react/features/details/index.js +2 -0
- package/dist/react/features/field/FieldPlugin.js +35 -0
- package/dist/react/features/field/index.d.ts +311 -0
- package/dist/react/features/field/index.js +2 -0
- package/dist/react/features/footnote/FootnotePlugin.js +41 -0
- package/dist/react/features/footnote/index.d.ts +1095 -0
- package/dist/react/features/footnote/index.js +2 -0
- package/dist/react/features/format-painter/FormatPainterPlugin.js +202 -0
- package/dist/react/features/format-painter/index.d.ts +205 -0
- package/dist/react/features/format-painter/index.js +2 -0
- package/dist/react/features/indent/IndentPlugin.js +6 -0
- package/dist/react/features/ink/InkContent.js +307 -0
- package/dist/react/features/ink/InkPlugin.js +105 -0
- package/dist/react/features/ink/index.d.ts +503 -0
- package/dist/react/features/ink/index.js +3 -0
- package/dist/react/features/ink/inkCapture.internal.js +407 -0
- package/dist/react/features/ink/inkImages.internal.js +278 -0
- package/dist/react/features/ink/inkInput.internal.js +19 -0
- package/dist/react/features/ink/inkLayout.internal.js +29 -0
- package/dist/react/features/ink/inkMeasure.internal.js +268 -0
- package/dist/react/features/ink/inkPaint.internal.js +111 -0
- package/dist/react/features/ink/inkPick.internal.js +243 -0
- package/dist/react/features/ink/inkPlacement.internal.js +583 -0
- package/dist/react/features/ink/inkWatch.internal.js +257 -0
- package/dist/react/features/link/LinkPlugin.js +7 -0
- package/dist/react/features/list/ListPlugin.js +161 -0
- package/dist/react/features/lock/LockPlugin.js +105 -0
- package/dist/react/features/lock/index.d.ts +58 -0
- package/dist/react/features/lock/index.js +2 -0
- package/dist/react/features/media/index.d.ts +689 -0
- package/dist/react/features/media/index.js +2 -0
- package/dist/react/features/media/plugins.js +12 -0
- package/dist/react/features/mention/MentionPlugin.js +6 -0
- package/dist/react/features/mention/index.d.ts +56 -0
- package/dist/react/features/mention/index.js +2 -0
- package/dist/react/features/resizable/Resizable.js +204 -0
- package/dist/react/features/resizable/index.d.ts +28 -0
- package/dist/react/features/resizable/index.js +2 -0
- package/dist/react/features/resizable/resizeLength.internal.js +11 -0
- package/dist/react/features/table/TablePlugin.js +586 -0
- package/dist/react/features/table/index.d.ts +4806 -0
- package/dist/react/features/table/index.js +4 -0
- package/dist/react/features/table/measureTableColumnWidths.internal.js +44 -0
- package/dist/react/features/table/tableSelectionHostBinding.internal.js +95 -0
- package/dist/react/features/table/useTableControls.js +897 -0
- package/dist/react/features/table/useTableResize.js +114 -0
- package/dist/react/features/toc/TocPlugin.js +7 -0
- package/dist/react/features/toc/index.d.ts +18 -0
- package/dist/react/features/toc/index.js +2 -0
- package/dist/react/features/upload/UploadPlugin.js +50 -0
- package/dist/react/features/upload/index.d.ts +252 -0
- package/dist/react/features/upload/index.js +2 -0
- package/dist/react/index.d.ts +7 -4
- package/dist/react/index.js +70 -7
- package/dist/react/internal/block-redraws.js +83 -0
- package/dist/react/internal/getPlateEditorInstanceKey.js +13 -0
- package/dist/react/internal/plate-context.js +537 -0
- package/dist/react/internal/plite-components.js +12 -0
- package/dist/react/internal/react-helpers.js +19 -0
- package/dist/react/internal/rendered-attributes.js +190 -0
- package/dist/react/internal/useDeepCompareMemo.js +42 -0
- package/dist/react/internal/usePlateInstancesWarn.js +24 -0
- package/dist/react/internal/usePlateModelRevision.js +21 -0
- package/dist/react/internal/useZustandSelector.js +35 -0
- package/dist/react/plite-react.js +2 -0
- package/dist/react/plugin/createPluginContext.internal.js +7 -0
- package/dist/react/plugin/definePlugin.js +26 -0
- package/dist/react/plugin/pluginFactory.internal.js +7 -0
- package/dist/react/plugin/toReactPlugin.js +97 -0
- package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +109 -0
- package/dist/react/plugins/paragraph/ParagraphPlugin.js +14 -0
- package/dist/react/stores/element/useElement.js +11 -0
- package/dist/react/stores/element/useElementSelector.js +22 -0
- package/dist/react/stores/element/useElementStore.js +186 -0
- package/dist/react/stores/element/useElementStoreSelector.internal.js +125 -0
- package/dist/react/stores/element/usePath.js +57 -0
- package/dist/react/stores/plate/pluginStoreSelector.internal.js +44 -0
- package/dist/react/stores/plate/useEditor.js +147 -0
- package/dist/react/stores/plate/useEditorHistory.js +55 -0
- package/dist/react/stores/plate/useEditorSelector.js +36 -0
- package/dist/react/stores/plate/usePluginStore.js +49 -0
- package/dist/react/stores/plate/useViewStore.js +50 -0
- package/dist/react/stores/plate-controller/document-focus.internal.js +72 -0
- package/dist/react/stores/plate-controller/useFocusedLast.js +30 -0
- package/dist/react/utils/BlockPlaceholderPlugin.js +79 -0
- package/dist/react/utils/annotationPointer.internal.js +35 -0
- package/dist/react/utils/bindPointerSession.internal.js +35 -0
- package/dist/react/utils/dispatchPlateShortcut.internal.js +19 -0
- package/dist/react/utils/editableKeyDown.internal.js +12 -0
- package/dist/react/utils/getRenderNodeProps.internal.js +57 -0
- package/dist/react/utils/hardAffinityBoundary.internal.js +25 -0
- package/dist/react/utils/pipeHandler.internal.js +95 -0
- package/dist/react/utils/pipeRenderElement.internal.js +511 -0
- package/dist/react/utils/pipeRenderLeaf.internal.js +162 -0
- package/dist/react/utils/pipeRenderText.internal.js +140 -0
- package/dist/react/utils/pluginRenderElement.internal.js +165 -0
- package/dist/react/utils/pluginRenderLeaf.internal.js +67 -0
- package/dist/react/utils/pluginRenderText.internal.js +40 -0
- package/dist/react/utils/tapOrder.internal.js +106 -0
- package/dist/react/utils/useSelectionFragment.js +30 -0
- package/dist/react/virtualized.d.ts +14 -0
- package/dist/react/virtualized.js +48 -0
- package/dist/refusal-Bd_fl5WN-DE0xLvUC.d.ts +1 -0
- package/dist/registerEditorTools-DO-PSLVj.d.ts +409 -0
- package/dist/root.js +39 -0
- package/dist/skills/plate/SKILL.md +48 -0
- package/dist/skills/plate/references/ai-and-agents.md +16 -0
- package/dist/skills/plate/references/plugins.md +22 -0
- package/dist/skills/plate/references/plus-and-pro.md +12 -0
- package/dist/skills/plate/references/report-a-bug.md +8 -0
- package/dist/skills/plate/references/setup.md +61 -0
- package/dist/skills/plate/references/testing.md +15 -0
- package/dist/skills/plate/references/ui-and-sync.md +23 -0
- package/dist/source-ZEzJ6HMc.d.ts +144 -0
- package/dist/static/components/EditorStatic.js +455 -0
- package/dist/static/components/plite-nodes.js +68 -0
- package/dist/static/index.d.ts +133 -1
- package/dist/static/index.js +4 -1
- package/dist/static/internal/loadStaticRenderer.js +4 -0
- package/dist/static/internal/staticDocumentView.js +122 -0
- package/dist/static/internal/staticPendingMedia.internal.js +136 -0
- package/dist/static/internal/staticPresentation.js +67 -0
- package/dist/static/pipeRenderElementStatic.internal.js +23 -0
- package/dist/static/pluginRenderElementStatic.internal.js +96 -0
- package/dist/static/pluginRenderLeafStatic.internal.js +82 -0
- package/dist/static/pluginRenderTextStatic.internal.js +83 -0
- package/dist/static/renderStaticHtml.js +38 -0
- package/dist/static/utils/fallbackContentRoots.internal.js +15 -0
- package/dist/static/utils/getRenderNodeStaticProps.internal.js +38 -0
- package/dist/sync/SyncPlugin.js +16 -0
- package/dist/sync/cloudflare/index.d.ts +71 -0
- package/dist/sync/cloudflare/index.js +2 -0
- package/dist/sync/index.d.ts +4 -0
- package/dist/sync/index.js +3 -0
- package/dist/sync/react/SyncReactPlugin.js +20 -0
- package/dist/sync/react/hooks.js +64 -0
- package/dist/sync/react/index.d.ts +100 -0
- package/dist/sync/react/index.js +4 -0
- package/dist/sync/server/index.d.ts +4 -0
- package/dist/sync/server/index.js +2 -0
- package/dist/tabbable/react/TabbableEffects.internal.js +261 -0
- package/dist/tabbable/react/TabbablePlugin.js +20 -0
- package/dist/tabbable/react/index.d.ts +67 -0
- package/dist/tabbable/react/index.js +2 -0
- package/dist/testing/index.d.ts +176 -0
- package/dist/testing/index.js +1 -0
- package/dist/transport-C54J2-C4-C3WX_jBu.d.ts +129 -0
- package/dist/tx-only-D93eVI65-Brv2zR4A.d.ts +8164 -0
- package/dist/utils/plate-keys.js +72 -0
- package/dist/utils/plugins/SingleBlockPlugin.js +21 -0
- package/dist/utils/plugins/SingleLinePlugin.js +32 -0
- package/dist/utils/plugins/TrailingBlockPlugin.js +32 -0
- package/dist/utils/plugins/joinSingleRootBlock.internal.js +24 -0
- package/dist/utils/plugins/resolveTrailingBlockType.internal.js +8 -0
- package/dist/widths-BMZN3LCs.d.ts +2750 -0
- package/package.json +620 -36
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { getViewPresentation, onPresentationRelease, reportEditorLifecycleError } from "../../facade.js";
|
|
2
|
+
import { brandPluginDescriptor, freezePluginDataSnapshot, getPluginSchemaFamily, isImmutablePluginData, isNominalPluginDescriptor } from "../utils/mergePlugins.js";
|
|
3
|
+
import { getPlateRuntimeOwner } from "./plateRuntime.js";
|
|
4
|
+
import { createZustandStore } from "../../lib/libs/zustand.js";
|
|
5
|
+
import { create } from "mutative";
|
|
6
|
+
//#region src/internal/plugin/pluginStore.ts
|
|
7
|
+
const createPluginStore = (editor, plugin, base, selectors) => {
|
|
8
|
+
const owner = getPlateRuntimeOwner(editor);
|
|
9
|
+
const name = typeof plugin === "string" ? plugin : plugin.name;
|
|
10
|
+
const state = base.store.getState();
|
|
11
|
+
for (const key of Object.keys(selectors)) if (Object.hasOwn(state, key)) throw new Error(`Plate plugin "${name}" defines "${key}" as both state and selector.`);
|
|
12
|
+
const replace = (value) => {
|
|
13
|
+
base.set("state", snapshotPluginState(value, true));
|
|
14
|
+
};
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
base,
|
|
17
|
+
public: Object.freeze({
|
|
18
|
+
get(key, ...args) {
|
|
19
|
+
const current = base.store.getState();
|
|
20
|
+
if (key === void 0) return current;
|
|
21
|
+
const selector = selectors[key];
|
|
22
|
+
if (typeof selector === "function") return selector(current, ...args);
|
|
23
|
+
if (Object.hasOwn(current, key)) return current[key];
|
|
24
|
+
throw new Error(`Plate plugin "${name}" has no state field or selector "${String(key)}".`);
|
|
25
|
+
},
|
|
26
|
+
set(value) {
|
|
27
|
+
const current = base.store.getState();
|
|
28
|
+
if (typeof value === "function") replace(create(current, value));
|
|
29
|
+
else replace({
|
|
30
|
+
...current,
|
|
31
|
+
...value
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
subscribe: (listener) => base.store.subscribe((current, previous) => {
|
|
35
|
+
try {
|
|
36
|
+
listener(current, previous);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
reportEditorLifecycleError({
|
|
39
|
+
cause: error,
|
|
40
|
+
editor: owner,
|
|
41
|
+
phase: "snapshot-listener",
|
|
42
|
+
pluginName: name
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
selectors: Object.freeze({ ...selectors })
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const isMinimalPluginReference = (value) => Object.isFrozen(value) && Reflect.ownKeys(value).every((key) => key === "name");
|
|
51
|
+
const ownedStateSnapshots = /* @__PURE__ */ new WeakSet();
|
|
52
|
+
const snapshotPluginStateValue = (value, context) => {
|
|
53
|
+
if (!value || typeof value !== "object") return value;
|
|
54
|
+
if (isImmutablePluginData(value)) return value;
|
|
55
|
+
if (context.reuseSnapshots && ownedStateSnapshots.has(value)) return value;
|
|
56
|
+
if (isNominalPluginDescriptor(value)) {
|
|
57
|
+
const family = getPluginSchemaFamily(value);
|
|
58
|
+
const canonicalByName = family ? context.canonicalReferences?.get(family) : void 0;
|
|
59
|
+
const canonicalReference = canonicalByName?.get(value.name);
|
|
60
|
+
if (canonicalReference) return canonicalReference;
|
|
61
|
+
if (isMinimalPluginReference(value)) {
|
|
62
|
+
if (context.canonicalReferences && family) {
|
|
63
|
+
const byName = canonicalByName ?? /* @__PURE__ */ new Map();
|
|
64
|
+
byName.set(value.name, value);
|
|
65
|
+
context.canonicalReferences.set(family, byName);
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
const existingReference = context.references.get(value);
|
|
70
|
+
if (existingReference) return existingReference;
|
|
71
|
+
const reference = Object.freeze(brandPluginDescriptor({ name: value.name }, value));
|
|
72
|
+
context.references.set(value, reference);
|
|
73
|
+
if (context.canonicalReferences && family) {
|
|
74
|
+
const byName = canonicalByName ?? /* @__PURE__ */ new Map();
|
|
75
|
+
byName.set(value.name, reference);
|
|
76
|
+
context.canonicalReferences.set(family, byName);
|
|
77
|
+
}
|
|
78
|
+
return reference;
|
|
79
|
+
}
|
|
80
|
+
const existing = context.snapshots.get(value);
|
|
81
|
+
if (existing !== void 0) return existing;
|
|
82
|
+
if (Array.isArray(value)) {
|
|
83
|
+
const snapshot = [];
|
|
84
|
+
context.snapshots.set(value, snapshot);
|
|
85
|
+
snapshot.push(...value.map((item) => snapshotPluginStateValue(item, context)));
|
|
86
|
+
ownedStateSnapshots.add(snapshot);
|
|
87
|
+
return freezePluginDataSnapshot(snapshot);
|
|
88
|
+
}
|
|
89
|
+
const prototype = Object.getPrototypeOf(value);
|
|
90
|
+
if (prototype !== Object.prototype && prototype !== null) return value;
|
|
91
|
+
const snapshot = Object.create(prototype);
|
|
92
|
+
context.snapshots.set(value, snapshot);
|
|
93
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
94
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
95
|
+
if (!descriptor) continue;
|
|
96
|
+
if (!Object.hasOwn(descriptor, "value")) throw new Error("Plate plugin `initialState` must be data-only. Accessor properties are not supported; declare computed values as pure plugin selectors.");
|
|
97
|
+
Object.defineProperty(snapshot, key, {
|
|
98
|
+
enumerable: descriptor.enumerable,
|
|
99
|
+
value: snapshotPluginStateValue(descriptor.value, context)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
ownedStateSnapshots.add(snapshot);
|
|
103
|
+
return freezePluginDataSnapshot(snapshot);
|
|
104
|
+
};
|
|
105
|
+
/** Own one initial-state graph without retaining caller-owned plain data. */
|
|
106
|
+
const snapshotPluginState = (value, reuseSnapshots = false) => snapshotPluginStateValue(value, {
|
|
107
|
+
references: /* @__PURE__ */ new WeakMap(),
|
|
108
|
+
reuseSnapshots,
|
|
109
|
+
snapshots: /* @__PURE__ */ new WeakMap()
|
|
110
|
+
});
|
|
111
|
+
/** Canonicalize resolved state graphs through one editor-local token set. */
|
|
112
|
+
const createPluginStateSnapshot = () => {
|
|
113
|
+
const context = {
|
|
114
|
+
canonicalReferences: /* @__PURE__ */ new WeakMap(),
|
|
115
|
+
references: /* @__PURE__ */ new WeakMap(),
|
|
116
|
+
snapshots: /* @__PURE__ */ new WeakMap()
|
|
117
|
+
};
|
|
118
|
+
return (value) => snapshotPluginStateValue(value, context);
|
|
119
|
+
};
|
|
120
|
+
const PLUGIN_STORES = /* @__PURE__ */ new WeakMap();
|
|
121
|
+
const getPluginStoreEntry = (owner) => {
|
|
122
|
+
let entry = PLUGIN_STORES.get(owner);
|
|
123
|
+
if (!entry) {
|
|
124
|
+
entry = {
|
|
125
|
+
plugins: /* @__PURE__ */ new Map(),
|
|
126
|
+
views: /* @__PURE__ */ new WeakMap()
|
|
127
|
+
};
|
|
128
|
+
PLUGIN_STORES.set(owner, entry);
|
|
129
|
+
}
|
|
130
|
+
return entry;
|
|
131
|
+
};
|
|
132
|
+
const clearPluginStores = (editor) => {
|
|
133
|
+
PLUGIN_STORES.delete(getPlateRuntimeOwner(editor));
|
|
134
|
+
};
|
|
135
|
+
const getViewStore = (editor, plugin, presentation) => {
|
|
136
|
+
const entry = getPluginStoreEntry(getPlateRuntimeOwner(editor));
|
|
137
|
+
const stores = entry.views.get(presentation) ?? /* @__PURE__ */ new Map();
|
|
138
|
+
if (!entry.views.has(presentation)) {
|
|
139
|
+
entry.views.set(presentation, stores);
|
|
140
|
+
onPresentationRelease(presentation, () => {
|
|
141
|
+
entry.views.delete(presentation);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
let store = stores.get(plugin.name);
|
|
145
|
+
if (!store) {
|
|
146
|
+
store = createPluginStore(editor, plugin, createZustandStore(snapshotPluginState(plugin.initialViewState?.() ?? {}), { name: plugin.name }), {});
|
|
147
|
+
stores.set(plugin.name, store);
|
|
148
|
+
}
|
|
149
|
+
return store;
|
|
150
|
+
};
|
|
151
|
+
const getEditorViewStore = (editor, plugin) => getViewStore(editor, plugin, getViewPresentation(editor));
|
|
152
|
+
function getPluginStore(editor, plugin) {
|
|
153
|
+
const name = typeof plugin === "string" ? plugin : plugin.name;
|
|
154
|
+
return PLUGIN_STORES.get(getPlateRuntimeOwner(editor))?.plugins.get(name);
|
|
155
|
+
}
|
|
156
|
+
const setPluginStore = (editor, plugin, store) => {
|
|
157
|
+
const name = typeof plugin === "string" ? plugin : plugin.name;
|
|
158
|
+
getPluginStoreEntry(getPlateRuntimeOwner(editor)).plugins.set(name, store);
|
|
159
|
+
};
|
|
160
|
+
//#endregion
|
|
161
|
+
export { clearPluginStores, createPluginStateSnapshot, createPluginStore, getEditorViewStore, getPluginStore, getViewStore, setPluginStore, snapshotPluginState };
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { isRuntimePlugin } from "../../facade.js";
|
|
2
|
+
import { getPluginDescriptorMetadata, isNominalPluginDescriptor, mergePlugins, registerHtmlMappingSchemaFamilies, setPluginDescriptorMetadata } from "../utils/mergePlugins.js";
|
|
3
|
+
import { withResolvingPlatePlugin } from "./compilePlateModel.js";
|
|
4
|
+
import { pluginFormatMapDeclaration } from "../../lib/plugin/pluginAuthoringContext.js";
|
|
5
|
+
import { createPluginContext, withPluginViewStore } from "../../lib/plugin/createPluginContext.internal.js";
|
|
6
|
+
import { assertNoPrepareDocument } from "../../lib/plugin/assertNoPrepareDocument.internal.js";
|
|
7
|
+
import { snapshotApiValue } from "../utils/snapshotApiValue.js";
|
|
8
|
+
import { DebugPlugin } from "../../lib/plugins/debug/DebugPlugin.js";
|
|
9
|
+
//#region src/internal/plugin/resolvePlugin.ts
|
|
10
|
+
const emptyResolvedPluginCapabilities = Object.freeze({
|
|
11
|
+
api: Object.freeze([]),
|
|
12
|
+
nativeSources: Object.freeze([]),
|
|
13
|
+
read: Object.freeze([]),
|
|
14
|
+
update: Object.freeze([])
|
|
15
|
+
});
|
|
16
|
+
const resolvedPluginCapabilities = /* @__PURE__ */ new WeakMap();
|
|
17
|
+
const getResolvedPluginCapabilities = (plugin) => resolvedPluginCapabilities.get(plugin) ?? emptyResolvedPluginCapabilities;
|
|
18
|
+
const inheritResolvedPluginCapabilities = (source, target) => {
|
|
19
|
+
const capabilities = resolvedPluginCapabilities.get(source);
|
|
20
|
+
if (capabilities) resolvedPluginCapabilities.set(target, capabilities);
|
|
21
|
+
return target;
|
|
22
|
+
};
|
|
23
|
+
const isObjectRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24
|
+
const assertConfiguredInputRules = (value) => {
|
|
25
|
+
if (value === void 0 || Array.isArray(value)) return;
|
|
26
|
+
throw new Error("inputRules must be an array of explicit rule instances.");
|
|
27
|
+
};
|
|
28
|
+
const mergeLifecycleHandlers = (plugin, previous, contribution) => {
|
|
29
|
+
const handlers = isObjectRecord(previous) ? { ...previous } : {};
|
|
30
|
+
for (const name of Reflect.ownKeys(contribution)) {
|
|
31
|
+
const prior = handlers[name];
|
|
32
|
+
const next = contribution[name];
|
|
33
|
+
if (typeof prior === "function" && typeof next === "function") handlers[name] = (...args) => {
|
|
34
|
+
return Reflect.apply(prior, void 0, args) === true ? true : Reflect.apply(next, void 0, args);
|
|
35
|
+
};
|
|
36
|
+
else if (next === null || next === void 0 || typeof next === "function") handlers[name] = next;
|
|
37
|
+
else throw new Error(`Plate plugin "${plugin.name}" on.${String(name)} must be a function or null.`);
|
|
38
|
+
}
|
|
39
|
+
return handlers;
|
|
40
|
+
};
|
|
41
|
+
const mergeFactory = (previous, next, pluginContext) => (context) => {
|
|
42
|
+
const prior = typeof previous === "function" ? Reflect.apply(previous, void 0, [context]) : {};
|
|
43
|
+
const contribution = Reflect.apply(next, void 0, [Object.assign(Object.create(pluginContext), context)]);
|
|
44
|
+
if (!isObjectRecord(contribution)) throw new Error(`Plate plugin "${pluginContext.plugin.name}" capability factories must return an object.`);
|
|
45
|
+
return mergePlugins(prior, contribution);
|
|
46
|
+
};
|
|
47
|
+
const mergeActivate = (plugin, previous, next) => {
|
|
48
|
+
if (typeof next !== "function") throw new Error(`Plate plugin "${plugin.name}" activate must be a function.`);
|
|
49
|
+
if (typeof previous !== "function") return next;
|
|
50
|
+
return (context) => {
|
|
51
|
+
Reflect.apply(previous, void 0, [context]);
|
|
52
|
+
Reflect.apply(next, void 0, [context]);
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const mergeCommandFactories = (plugin, previous, next) => (context) => {
|
|
56
|
+
const prior = typeof previous === "function" ? Reflect.apply(previous, void 0, [context]) : [];
|
|
57
|
+
const contribution = Reflect.apply(next, void 0, [context]);
|
|
58
|
+
if (!Array.isArray(prior) || !Array.isArray(contribution)) throw new Error(`Plate plugin "${plugin.name}" command factories must return arrays.`);
|
|
59
|
+
return [...prior, ...contribution];
|
|
60
|
+
};
|
|
61
|
+
const assertNativeTopology = (plugin, field, contribution) => {
|
|
62
|
+
if (contribution === void 0) return;
|
|
63
|
+
if (!Array.isArray(contribution) || contribution.some((reference) => !reference || typeof reference !== "object" || typeof Reflect.get(reference, "name") !== "string")) throw new Error(`Plate plugin "${plugin.name}" adopted a native plugin with invalid ${field}.`);
|
|
64
|
+
const declared = plugin[field];
|
|
65
|
+
if (declared.length !== contribution.length || declared.some((reference, index) => reference.name !== Reflect.get(contribution[index], "name"))) throw new Error(`Plate plugin "${plugin.name}" must declare the same ${field} as its adopted native plugin.`);
|
|
66
|
+
};
|
|
67
|
+
const applyFormatDeclaration = (plugin, formats) => {
|
|
68
|
+
if (formats[pluginFormatMapDeclaration] !== true) throw new Error(`Plate plugin "${plugin.name}" formats must be declared with the context-bound \`defineFormats(...)\` helper.`);
|
|
69
|
+
const { html: htmlMapping, ...productMappings } = formats;
|
|
70
|
+
for (const format of Object.keys(productMappings)) if (format !== "docx" && format !== "markdown" && format !== "plainText") throw new Error(`Plate plugin "${plugin.name}" declares unknown format "${format}".`);
|
|
71
|
+
const currentFormats = Reflect.get(plugin, "formats");
|
|
72
|
+
const definedProductMappings = Object.entries(productMappings).filter(([, value]) => value !== void 0);
|
|
73
|
+
if (definedProductMappings.length > 0) {
|
|
74
|
+
const merged = {};
|
|
75
|
+
if (isObjectRecord(currentFormats)) for (const [format, existing] of Object.entries(currentFormats)) {
|
|
76
|
+
if (existing === void 0) continue;
|
|
77
|
+
merged[format] = Array.isArray(existing) ? existing : [existing];
|
|
78
|
+
}
|
|
79
|
+
for (const [format, value] of definedProductMappings) {
|
|
80
|
+
const incoming = Array.isArray(value) ? value : [value];
|
|
81
|
+
if (incoming.length === 0) throw new Error(`Plate plugin "${plugin.name}" \`formats.${format}\` tuples must be non-empty.`);
|
|
82
|
+
merged[format] = Object.freeze([...merged[format] ?? [], ...incoming]);
|
|
83
|
+
}
|
|
84
|
+
Reflect.set(plugin, "formats", Object.freeze(merged));
|
|
85
|
+
}
|
|
86
|
+
if (htmlMapping === void 0) return;
|
|
87
|
+
const htmlMappings = Array.isArray(htmlMapping) ? htmlMapping : [htmlMapping];
|
|
88
|
+
if (htmlMappings.length === 0) throw new Error("Plate plugin `formats.html` tuples must be non-empty.");
|
|
89
|
+
for (const declaration of htmlMappings) {
|
|
90
|
+
if (!isObjectRecord(declaration)) throw new Error("Plate plugin `formats.html` must contain mapping declarations.");
|
|
91
|
+
const { target, ...rule } = declaration;
|
|
92
|
+
const targetPlugin = target ?? plugin;
|
|
93
|
+
if (!isNominalPluginDescriptor(targetPlugin)) throw new Error("Plate plugin HTML mapping `target` must be a plugin descriptor.");
|
|
94
|
+
if (target !== void 0 && targetPlugin.name === plugin.name) throw new Error("Plate plugin HTML mapping `target` must be a different plugin descriptor.");
|
|
95
|
+
const contribution = registerHtmlMappingSchemaFamilies(() => rule, plugin, targetPlugin);
|
|
96
|
+
const metadata = getPluginDescriptorMetadata(plugin);
|
|
97
|
+
setPluginDescriptorMetadata(plugin, {
|
|
98
|
+
...metadata,
|
|
99
|
+
htmlMappingContributions: [...metadata.htmlMappingContributions, Object.freeze({
|
|
100
|
+
factory: contribution,
|
|
101
|
+
targetPlugin: target === void 0 ? null : targetPlugin.name
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const applyFormats = (plugin, formats) => {
|
|
107
|
+
if (Array.isArray(formats)) {
|
|
108
|
+
if (formats.length === 0) throw new Error(`Plate plugin "${plugin.name}" \`formats\` tuples must be non-empty.`);
|
|
109
|
+
for (const entry of formats) {
|
|
110
|
+
if (!isObjectRecord(entry)) throw new Error(`Plate plugin "${plugin.name}" formats must be a semantic mapping object.`);
|
|
111
|
+
applyFormatDeclaration(plugin, entry);
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (!isObjectRecord(formats)) throw new Error(`Plate plugin "${plugin.name}" formats must be a semantic mapping object.`);
|
|
116
|
+
applyFormatDeclaration(plugin, formats);
|
|
117
|
+
};
|
|
118
|
+
const applyStage = (editor, plugin, contribution, pluginContext) => {
|
|
119
|
+
assertNoPrepareDocument(contribution);
|
|
120
|
+
const isRawPliteDescriptor = Boolean(isRuntimePlugin(contribution) && !isNominalPluginDescriptor(contribution));
|
|
121
|
+
if (isRawPliteDescriptor && contribution.name !== void 0 && contribution.name !== plugin.name) throw new Error(`Plate plugin "${plugin.name}" cannot adopt native plugin "${contribution.name}". Their names must match.`);
|
|
122
|
+
const { activate, api, dataTransferFormats, formats, commands, conflicts, dependencies, name: _name, on, read, update, ...configuration } = contribution;
|
|
123
|
+
if (isRawPliteDescriptor) {
|
|
124
|
+
assertNativeTopology(plugin, "conflicts", conflicts);
|
|
125
|
+
assertNativeTopology(plugin, "dependencies", dependencies);
|
|
126
|
+
}
|
|
127
|
+
const next = mergePlugins(plugin, isRawPliteDescriptor ? configuration : {
|
|
128
|
+
...configuration,
|
|
129
|
+
...conflicts === void 0 ? {} : { conflicts },
|
|
130
|
+
...dependencies === void 0 ? {} : { dependencies }
|
|
131
|
+
});
|
|
132
|
+
const previousCapabilities = getResolvedPluginCapabilities(plugin);
|
|
133
|
+
let apiContributions = previousCapabilities.api;
|
|
134
|
+
let { nativeSources } = previousCapabilities;
|
|
135
|
+
let readContributions = previousCapabilities.read;
|
|
136
|
+
let updateContributions = previousCapabilities.update;
|
|
137
|
+
if (isRawPliteDescriptor) nativeSources = Object.freeze([...nativeSources, contribution]);
|
|
138
|
+
if (activate !== void 0) Reflect.set(next, "activate", mergeActivate(plugin, Reflect.get(next, "activate"), activate));
|
|
139
|
+
if (on !== void 0) {
|
|
140
|
+
if (!isObjectRecord(on)) throw new Error(`Plate plugin "${plugin.name}" on must be an object.`);
|
|
141
|
+
Reflect.set(next, "on", mergeLifecycleHandlers(plugin, Reflect.get(next, "on"), on));
|
|
142
|
+
}
|
|
143
|
+
if (commands !== void 0) {
|
|
144
|
+
if (typeof commands !== "function") throw new Error(`Plate plugin "${plugin.name}" commands must be a context factory.`);
|
|
145
|
+
Reflect.set(next, "commands", mergeCommandFactories(plugin, Reflect.get(next, "commands"), commands));
|
|
146
|
+
}
|
|
147
|
+
if (dataTransferFormats !== void 0) {
|
|
148
|
+
if (!Array.isArray(dataTransferFormats)) throw new Error(`Plate plugin "${plugin.name}" dataTransferFormats must be an array.`);
|
|
149
|
+
const previous = Reflect.get(next, "dataTransferFormats");
|
|
150
|
+
if (previous !== void 0 && !Array.isArray(previous)) throw new Error(`Plate plugin "${plugin.name}" dataTransferFormats must be an array.`);
|
|
151
|
+
Reflect.set(next, "dataTransferFormats", Object.freeze([...previous ?? [], ...dataTransferFormats]));
|
|
152
|
+
}
|
|
153
|
+
if (api !== void 0) {
|
|
154
|
+
if (typeof api !== "function") throw new Error(`Plate plugin "${plugin.name}" API must be a context factory.`);
|
|
155
|
+
if (isRawPliteDescriptor) apiContributions = Object.freeze([...apiContributions, Object.freeze({
|
|
156
|
+
factory: api,
|
|
157
|
+
kind: "native"
|
|
158
|
+
})]);
|
|
159
|
+
else {
|
|
160
|
+
const apiValue = Reflect.apply(api, void 0, [withPluginViewStore(pluginContext, editor, plugin)]);
|
|
161
|
+
if (!isObjectRecord(apiValue)) throw new Error(`Plate plugin "${plugin.name}" API factories must return an object.`);
|
|
162
|
+
const snapshot = snapshotApiValue(apiValue);
|
|
163
|
+
apiContributions = Object.freeze([...apiContributions, Object.freeze({
|
|
164
|
+
factory: api,
|
|
165
|
+
kind: "definition",
|
|
166
|
+
value: snapshot
|
|
167
|
+
})]);
|
|
168
|
+
Reflect.set(next, "api", snapshotApiValue(mergePlugins(isObjectRecord(Reflect.get(next, "api")) ? Reflect.get(next, "api") : {}, snapshot)));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (typeof read === "function") {
|
|
172
|
+
readContributions = Object.freeze([...readContributions, Object.freeze({
|
|
173
|
+
factory: read,
|
|
174
|
+
kind: isRawPliteDescriptor ? "native" : "definition"
|
|
175
|
+
})]);
|
|
176
|
+
if (!isRawPliteDescriptor) Reflect.set(next, "read", mergeFactory(Reflect.get(next, "read"), read, pluginContext));
|
|
177
|
+
}
|
|
178
|
+
if (typeof update === "function") {
|
|
179
|
+
updateContributions = Object.freeze([...updateContributions, Object.freeze({
|
|
180
|
+
factory: update,
|
|
181
|
+
kind: isRawPliteDescriptor ? "native" : "definition"
|
|
182
|
+
})]);
|
|
183
|
+
if (!isRawPliteDescriptor) Reflect.set(next, "update", mergeFactory(Reflect.get(next, "update"), update, pluginContext));
|
|
184
|
+
}
|
|
185
|
+
if (formats !== void 0) {
|
|
186
|
+
const resolvedFormats = typeof formats === "function" ? Reflect.apply(formats, void 0, [Object.freeze({
|
|
187
|
+
defineFormats: pluginContext.defineFormats,
|
|
188
|
+
schema: pluginContext.schema
|
|
189
|
+
})]) : formats;
|
|
190
|
+
applyFormats(next, resolvedFormats);
|
|
191
|
+
}
|
|
192
|
+
if (apiContributions.length > 0 || nativeSources.length > 0 || readContributions.length > 0 || updateContributions.length > 0) resolvedPluginCapabilities.set(next, Object.freeze({
|
|
193
|
+
api: apiContributions,
|
|
194
|
+
nativeSources,
|
|
195
|
+
read: readContributions,
|
|
196
|
+
update: updateContributions
|
|
197
|
+
}));
|
|
198
|
+
return next;
|
|
199
|
+
};
|
|
200
|
+
const finalizeResolvedPlugin = (editor, plugin) => {
|
|
201
|
+
plugin.targetPlugins = Object.freeze([...plugin.targetPlugins]);
|
|
202
|
+
validatePlugin(editor, plugin);
|
|
203
|
+
return plugin;
|
|
204
|
+
};
|
|
205
|
+
/** Reapply captured terminal configuration without executing callbacks again. */
|
|
206
|
+
const reapplyResolvedPluginConfigurations = (editor, plugin, configurations) => {
|
|
207
|
+
let configured = plugin;
|
|
208
|
+
for (const configuration of configurations) {
|
|
209
|
+
assertNoPrepareDocument(configuration);
|
|
210
|
+
configured = inheritResolvedPluginCapabilities(configured, mergePlugins(configured, configuration));
|
|
211
|
+
}
|
|
212
|
+
return finalizeResolvedPlugin(editor, configured);
|
|
213
|
+
};
|
|
214
|
+
const resolvePluginWithConfigurations = (editor, descriptor) => {
|
|
215
|
+
assertNoPrepareDocument(descriptor);
|
|
216
|
+
let plugin = mergePlugins({}, descriptor);
|
|
217
|
+
const descriptorMetadata = getPluginDescriptorMetadata(plugin);
|
|
218
|
+
setPluginDescriptorMetadata(plugin, {
|
|
219
|
+
...descriptorMetadata,
|
|
220
|
+
resolved: true
|
|
221
|
+
});
|
|
222
|
+
const layers = [...descriptorMetadata.configurationLayers];
|
|
223
|
+
const configurations = [];
|
|
224
|
+
for (const layer of layers) {
|
|
225
|
+
const value = layer.kind === "context" ? withResolvingPlatePlugin(editor, plugin, () => Reflect.apply(layer.value, void 0, [createPluginContext(editor, plugin)])) : layer.value;
|
|
226
|
+
if (!isObjectRecord(value)) throw new Error(`Plate plugin "${plugin.name}" configuration must resolve to an object.`);
|
|
227
|
+
assertNoPrepareDocument(value);
|
|
228
|
+
if (Object.hasOwn(value, "inputRules")) assertConfiguredInputRules(value.inputRules);
|
|
229
|
+
const snapshot = { ...value };
|
|
230
|
+
plugin = mergePlugins(plugin, snapshot);
|
|
231
|
+
configurations.push(snapshot);
|
|
232
|
+
}
|
|
233
|
+
const stages = [...getPluginDescriptorMetadata(plugin).stages];
|
|
234
|
+
for (const stage of stages) plugin = withResolvingPlatePlugin(editor, plugin, () => {
|
|
235
|
+
const context = createPluginContext(editor, plugin);
|
|
236
|
+
const contribution = Reflect.apply(stage, void 0, [context]);
|
|
237
|
+
if (!isObjectRecord(contribution)) throw new Error(`Plate plugin "${plugin.name}" stage must return an object.`);
|
|
238
|
+
return applyStage(editor, plugin, contribution, context);
|
|
239
|
+
});
|
|
240
|
+
plugin = reapplyResolvedPluginConfigurations(editor, plugin, configurations);
|
|
241
|
+
return Object.freeze({
|
|
242
|
+
configurations: Object.freeze(configurations),
|
|
243
|
+
plugin
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
const validatePlugin = (editor, plugin) => {
|
|
247
|
+
if (!isNominalPluginDescriptor(plugin)) createPluginContext(editor, DebugPlugin).api.error(`Invalid plugin '${plugin.name}', use definePlugin.`, "INVALID_PLUGIN");
|
|
248
|
+
};
|
|
249
|
+
//#endregion
|
|
250
|
+
export { getResolvedPluginCapabilities, inheritResolvedPluginCapabilities, reapplyResolvedPluginConfigurations, resolvePluginWithConfigurations, validatePlugin };
|