@notectl/core 2.3.3 → 2.3.4
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/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +1 -0
- package/dist/chunks/{AttrRegistry-B3zB02z9.mjs → AttrRegistry-CtNhf2EF.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-B3zB02z9.mjs.map → AttrRegistry-CtNhf2EF.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs +2 -0
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs.map +1 -0
- package/dist/chunks/{BidiIsolationPlugin-Cw2KMk-H.mjs → BidiIsolationPlugin-cOLlL3Y9.mjs} +2 -2
- package/dist/chunks/{BidiIsolationPlugin-Cw2KMk-H.mjs.map → BidiIsolationPlugin-cOLlL3Y9.mjs.map} +1 -1
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs +2 -0
- package/dist/chunks/{BlockInsertion-CYH2gRkY.mjs.map → BlockInsertion-O5pAFKid.mjs.map} +1 -1
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +2 -0
- package/dist/chunks/{BlockquotePlugin-0bZSbkyo.mjs.map → BlockquotePlugin-D-jRWLQB.mjs.map} +1 -1
- package/dist/chunks/CaretNavigationPlugin-Clv8dzR5.mjs +2 -0
- package/dist/chunks/CaretNavigationPlugin-Clv8dzR5.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +2 -0
- package/dist/chunks/{CodeBlockPlugin-BCJ3faXx.mjs.map → CodeBlockPlugin-BandNM3t.mjs.map} +1 -1
- package/dist/chunks/ColorGrid-D0vLHsG6.mjs +2 -0
- package/dist/chunks/{ColorGrid-DQEkJ-0y.mjs.map → ColorGrid-D0vLHsG6.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-_C5JZhki.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-CyF26zIU.mjs.map → ColorPickerPopup-_C5JZhki.mjs.map} +1 -1
- package/dist/chunks/ColorValidation-B9d_umnf.mjs +2 -0
- package/dist/chunks/{ColorValidation-DAijTjG9.mjs.map → ColorValidation-B9d_umnf.mjs.map} +1 -1
- package/dist/chunks/Commands-D-0UXYvo.mjs +2 -0
- package/dist/chunks/Commands-D-0UXYvo.mjs.map +1 -0
- package/dist/chunks/ContentModel-Bzmzeqwg.mjs +2 -0
- package/dist/chunks/{ContentModel-NpAj7vGW.mjs.map → ContentModel-Bzmzeqwg.mjs.map} +1 -1
- package/dist/chunks/CursorMarks-dx51OGBf.mjs +2 -0
- package/dist/chunks/CursorMarks-dx51OGBf.mjs.map +1 -0
- package/dist/chunks/Decoration-BwhoA4MU.mjs +3 -0
- package/dist/chunks/Decoration-BwhoA4MU.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs → DirectionDetection-ZrkMhyaL.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs.map → DirectionDetection-ZrkMhyaL.mjs.map} +1 -1
- package/dist/chunks/Document-D_2cIBJG.mjs +2 -0
- package/dist/chunks/Document-D_2cIBJG.mjs.map +1 -0
- package/dist/chunks/DocumentParser-i-CreJ48.mjs +2 -0
- package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +1 -0
- package/dist/chunks/{FontPlugin-D041tiLe.mjs → FontPlugin-B4Ouhmpe.mjs} +2 -2
- package/dist/chunks/{FontPlugin-D041tiLe.mjs.map → FontPlugin-B4Ouhmpe.mjs.map} +1 -1
- package/dist/chunks/FontSizePlugin-CZB-AwZQ.mjs +2 -0
- package/dist/chunks/{FontSizePlugin-8CAvj1RD.mjs.map → FontSizePlugin-CZB-AwZQ.mjs.map} +1 -1
- package/dist/chunks/FormulaPlugin-C7N3QXDx.mjs +2 -0
- package/dist/chunks/{FormulaPlugin-DJ39BtqV.mjs.map → FormulaPlugin-C7N3QXDx.mjs.map} +1 -1
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +1 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +2 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +2 -0
- package/dist/chunks/{HTMLUtils-Bhg3_P8B.mjs.map → HTMLUtils-B0nGyFLb.mjs.map} +1 -1
- package/dist/chunks/HardBreakPlugin-CC4rntSX.mjs +2 -0
- package/dist/chunks/{HardBreakPlugin-vniSvTgq.mjs.map → HardBreakPlugin-CC4rntSX.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-hubN_Ebt.mjs +2 -0
- package/dist/chunks/{HeadingPlugin-DUKsLuMd.mjs.map → HeadingPlugin-hubN_Ebt.mjs.map} +1 -1
- package/dist/chunks/{HighlightPlugin-DRTAE1N5.mjs → HighlightPlugin-CE_MgFNz.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-DRTAE1N5.mjs.map → HighlightPlugin-CE_MgFNz.mjs.map} +1 -1
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs +2 -0
- package/dist/chunks/{HorizontalRulePlugin-B9OvwrKB.mjs.map → HorizontalRulePlugin-CxmUMM34.mjs.map} +1 -1
- package/dist/chunks/{ImagePlugin-CwxTRr6d.mjs → ImagePlugin-B_y4STEr.mjs} +2 -2
- package/dist/chunks/{ImagePlugin-CwxTRr6d.mjs.map → ImagePlugin-B_y4STEr.mjs.map} +1 -1
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +2 -0
- package/dist/chunks/{InlineCodePlugin-uxgMUX_E.mjs.map → InlineCodePlugin-C1SqGfv5.mjs.map} +1 -1
- package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs → InlineStyleMarkSpec-Cx3goc3W.mjs} +2 -2
- package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs.map → InlineStyleMarkSpec-Cx3goc3W.mjs.map} +1 -1
- package/dist/chunks/{LinkPlugin-CvWHbSkb.mjs → LinkPlugin-BwXDGHPe.mjs} +2 -2
- package/dist/chunks/{LinkPlugin-CvWHbSkb.mjs.map → LinkPlugin-BwXDGHPe.mjs.map} +1 -1
- package/dist/chunks/ListPlugin-DSFPSWQC.mjs +2 -0
- package/dist/chunks/ListPlugin-DSFPSWQC.mjs.map +1 -0
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs +2 -0
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +1 -0
- package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs → MarkInputRule-DNneF2gp.mjs} +2 -2
- package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs.map → MarkInputRule-DNneF2gp.mjs.map} +1 -1
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +2 -0
- package/dist/chunks/{MarkdownHTMLRegistry-Q7l0d6Ma.mjs.map → MarkdownHTMLRegistry-CISsC0lH.mjs.map} +1 -1
- package/dist/chunks/MarkdownParser-D1d9zB0R.mjs +2 -0
- package/dist/chunks/{MarkdownParser-Dp62mfUq.mjs.map → MarkdownParser-D1d9zB0R.mjs.map} +1 -1
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +2 -0
- package/dist/chunks/{MarkdownSerializer-DBELFAeo.mjs.map → MarkdownSerializer-Oex2RzNw.mjs.map} +1 -1
- package/dist/chunks/{NodeResolver-Dleih-8R.mjs → NodeResolver-BtIknXqD.mjs} +2 -2
- package/dist/chunks/{NodeResolver-Dleih-8R.mjs.map → NodeResolver-BtIknXqD.mjs.map} +1 -1
- package/dist/chunks/NodeSelectionCommands-DK3iEh18.mjs +2 -0
- package/dist/chunks/{NodeSelectionCommands-WH5snxr_.mjs.map → NodeSelectionCommands-DK3iEh18.mjs.map} +1 -1
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs +2 -0
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -0
- package/dist/chunks/{PluginHelpers-KDuTlmXm.mjs → PluginHelpers-WG1Lzzh3.mjs} +2 -2
- package/dist/chunks/{PluginHelpers-KDuTlmXm.mjs.map → PluginHelpers-WG1Lzzh3.mjs.map} +1 -1
- package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs +2 -0
- package/dist/chunks/{PopupKeyboardPatterns-tUrT9TyV.mjs.map → PopupKeyboardPatterns-BcwdDxRq.mjs.map} +1 -1
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs +2 -0
- package/dist/chunks/{PopupManager-Cj86uDEB.mjs.map → PopupManager-Jz5JrUdC.mjs.map} +1 -1
- package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs → PopupPositioning-CIqgpqlW.mjs} +2 -2
- package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs.map → PopupPositioning-CIqgpqlW.mjs.map} +1 -1
- package/dist/chunks/PrintPlugin-1m54b2-Y.mjs +2 -0
- package/dist/chunks/PrintPlugin-1m54b2-Y.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs → RangeIterator-DDOxTQIf.mjs} +2 -2
- package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs.map → RangeIterator-DDOxTQIf.mjs.map} +1 -1
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +2 -0
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +1 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs +2 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -0
- package/dist/chunks/{SelectionSync-BSHIw1EE.mjs → SelectionSync-CcvoRrNd.mjs} +2 -2
- package/dist/chunks/{SelectionSync-BSHIw1EE.mjs.map → SelectionSync-CcvoRrNd.mjs.map} +1 -1
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs +2 -0
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs.map +1 -0
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs +2 -0
- package/dist/chunks/{SimpleMark-gTQaSJcO.mjs.map → SimpleMark-CTDtEIMV.mjs.map} +1 -1
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs +2 -0
- package/dist/chunks/{SmartPastePlugin-BvJQ-fOz.mjs.map → SmartPastePlugin-CjExbE9Q.mjs.map} +1 -1
- package/dist/chunks/{StrikethroughPlugin-BdrG1TTY.mjs → StrikethroughPlugin-d-EW2YYx.mjs} +2 -2
- package/dist/chunks/{StrikethroughPlugin-BdrG1TTY.mjs.map → StrikethroughPlugin-d-EW2YYx.mjs.map} +1 -1
- package/dist/chunks/StyleRuntime-C0RSqKzG.mjs +2 -0
- package/dist/chunks/{StyleRuntime-DW6omotc.mjs.map → StyleRuntime-C0RSqKzG.mjs.map} +1 -1
- package/dist/chunks/SuperSubPlugin-C-kvFQyx.mjs +2 -0
- package/dist/chunks/{SuperSubPlugin-DTZB0Y3D.mjs.map → SuperSubPlugin-C-kvFQyx.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BcARMxQB.mjs +2 -0
- package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +1 -0
- package/dist/chunks/TablePlugin-B894cIXW.mjs +2 -0
- package/dist/chunks/{TablePlugin-CPvg9YZS.mjs.map → TablePlugin-B894cIXW.mjs.map} +1 -1
- package/dist/chunks/{TextColorPlugin-Ckg3KWvb.mjs → TextColorPlugin-B6YoN9mR.mjs} +2 -2
- package/dist/chunks/{TextColorPlugin-Ckg3KWvb.mjs.map → TextColorPlugin-B6YoN9mR.mjs.map} +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-LVDkKdDX.mjs +2 -0
- package/dist/chunks/{TextDirectionAutoPlugin-DRGbgTlx.mjs.map → TextDirectionAutoPlugin-LVDkKdDX.mjs.map} +1 -1
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs +2 -0
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs.map +1 -0
- package/dist/chunks/TextFormattingPlugin-DlS0SeW7.mjs +2 -0
- package/dist/chunks/{TextFormattingPlugin-BhRxSC8q.mjs.map → TextFormattingPlugin-DlS0SeW7.mjs.map} +1 -1
- package/dist/chunks/ThemeEngine-D4W6Y80e.mjs +3 -0
- package/dist/chunks/{ThemeEngine-BUVo_zaT.mjs.map → ThemeEngine-D4W6Y80e.mjs.map} +1 -1
- package/dist/chunks/{ToolbarPlugin-dmTj1jIz.mjs → ToolbarPlugin-ClKY-LiT.mjs} +2 -2
- package/dist/chunks/{ToolbarPlugin-dmTj1jIz.mjs.map → ToolbarPlugin-ClKY-LiT.mjs.map} +1 -1
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +2 -0
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +1 -0
- package/dist/chunks/{XmlSupport-DIXH5on9.mjs → XmlSupport-3Za6SIqF.mjs} +2 -2
- package/dist/chunks/{XmlSupport-DIXH5on9.mjs.map → XmlSupport-3Za6SIqF.mjs.map} +1 -1
- package/dist/chunks/full-CNi2CaF3.mjs +2 -0
- package/dist/chunks/{full-JM0-SwWy.mjs.map → full-CNi2CaF3.mjs.map} +1 -1
- package/dist/chunks/minimal-Bykbo9So.mjs +2 -0
- package/dist/chunks/{minimal-DSlR2A27.mjs.map → minimal-Bykbo9So.mjs.map} +1 -1
- package/dist/chunks/register-CF80zDgl.mjs +3 -0
- package/dist/chunks/register-CF80zDgl.mjs.map +1 -0
- package/dist/decorations/Decoration.d.ts +9 -0
- package/dist/decorations/Decoration.d.ts.map +1 -1
- package/dist/editor/ContentSerializer.d.ts +2 -7
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorEventEmitter.d.ts +10 -2
- package/dist/editor/EditorEventEmitter.d.ts.map +1 -1
- package/dist/editor/EditorInitializer.d.ts +2 -4
- package/dist/editor/EditorInitializer.d.ts.map +1 -1
- package/dist/editor/EditorLifecycleCoordinator.d.ts +16 -1
- package/dist/editor/EditorLifecycleCoordinator.d.ts.map +1 -1
- package/dist/editor/EditorStyleCoordinator.d.ts +11 -3
- package/dist/editor/EditorStyleCoordinator.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +15 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +4 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +5 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts +4 -0
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts +7 -4
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +33 -6
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +3 -2
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/Document.d.ts +42 -0
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/DocumentNormalization.d.ts +10 -0
- package/dist/model/DocumentNormalization.d.ts.map +1 -0
- package/dist/model/FileHandlerDispatcher.d.ts +27 -0
- package/dist/model/FileHandlerDispatcher.d.ts.map +1 -0
- package/dist/model/FileHandlerRegistry.d.ts +6 -1
- package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
- package/dist/model/InputRuleRegistry.d.ts +9 -1
- package/dist/model/InputRuleRegistry.d.ts.map +1 -1
- package/dist/model/KeymapRegistry.d.ts +14 -1
- package/dist/model/KeymapRegistry.d.ts.map +1 -1
- package/dist/model/MarkdownSyntaxRegistry.d.ts +2 -0
- package/dist/model/MarkdownSyntaxRegistry.d.ts.map +1 -1
- package/dist/model/PluginCallbackExecutor.d.ts +44 -0
- package/dist/model/PluginCallbackExecutor.d.ts.map +1 -0
- package/dist/model/SanitizeConfig.d.ts +8 -0
- package/dist/model/SanitizeConfig.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +24 -0
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/Selection.d.ts +4 -0
- package/dist/model/Selection.d.ts.map +1 -1
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +3 -1
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +9 -2
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/PluginLifecycle.d.ts +6 -0
- package/dist/plugins/PluginLifecycle.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +9 -2
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/RegistrationTracker.d.ts +2 -0
- package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockSchema.d.ts +6 -2
- package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/FormulaPasteInterceptor.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/language.mjs +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListCommands.d.ts.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +9 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/NodeSpecPatching.d.ts +2 -2
- package/dist/plugins/shared/NodeSpecPatching.d.ts.map +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-direction-auto.mjs +1 -1
- package/dist/plugins/text-direction.mjs +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video/VideoNodeSpec.d.ts.map +1 -1
- package/dist/plugins/video/VideoPlugin.d.ts.map +1 -1
- package/dist/plugins/video/VideoProviders.d.ts +3 -3
- package/dist/plugins/video/VideoSanitizeHook.d.ts +4 -20
- package/dist/plugins/video/VideoSanitizeHook.d.ts.map +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.mjs +1 -1
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/HTMLSanitization.d.ts +12 -0
- package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/Mapping.d.ts +2 -0
- package/dist/state/Mapping.d.ts.map +1 -1
- package/dist/state/StepHandlers.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +2 -0
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/state/TransactionFinalizer.d.ts +10 -0
- package/dist/state/TransactionFinalizer.d.ts.map +1 -0
- package/dist/state/TransactionSnapshot.d.ts +32 -0
- package/dist/state/TransactionSnapshot.d.ts.map +1 -0
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/BlockRendering.d.ts +13 -2
- package/dist/view/BlockRendering.d.ts.map +1 -1
- package/dist/view/DecorationRendering.d.ts +19 -8
- package/dist/view/DecorationRendering.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +4 -0
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts +8 -0
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/NodeViewCallbackBoundary.d.ts +12 -0
- package/dist/view/NodeViewCallbackBoundary.d.ts.map +1 -0
- package/dist/view/NodeViewOwnership.d.ts +12 -0
- package/dist/view/NodeViewOwnership.d.ts.map +1 -0
- package/dist/view/NodeViewRegistry.d.ts +7 -1
- package/dist/view/NodeViewRegistry.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts +6 -0
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/chunks/AlignmentPlugin-C9Rr_R-g.mjs +0 -2
- package/dist/chunks/AlignmentPlugin-C9Rr_R-g.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-BCvmqeFZ.mjs +0 -2
- package/dist/chunks/AttributedMarkCommands-BCvmqeFZ.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-CYH2gRkY.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-0bZSbkyo.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-BCJ3faXx.mjs +0 -2
- package/dist/chunks/ColorGrid-DQEkJ-0y.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-CyF26zIU.mjs +0 -2
- package/dist/chunks/ColorValidation-DAijTjG9.mjs +0 -2
- package/dist/chunks/Commands-D5ND50PQ.mjs +0 -2
- package/dist/chunks/Commands-D5ND50PQ.mjs.map +0 -1
- package/dist/chunks/ContentModel-NpAj7vGW.mjs +0 -2
- package/dist/chunks/Decoration-BOP1TAUd.mjs +0 -2
- package/dist/chunks/Decoration-BOP1TAUd.mjs.map +0 -1
- package/dist/chunks/Document-827l3P80.mjs +0 -2
- package/dist/chunks/Document-827l3P80.mjs.map +0 -1
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs +0 -2
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-8CAvj1RD.mjs +0 -2
- package/dist/chunks/FormulaPlugin-DJ39BtqV.mjs +0 -2
- package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs +0 -2
- package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-2iR6506y.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-2iR6506y.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +0 -2
- package/dist/chunks/HardBreakPlugin-vniSvTgq.mjs +0 -2
- package/dist/chunks/HeadingPlugin-DUKsLuMd.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-B9OvwrKB.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-uxgMUX_E.mjs +0 -2
- package/dist/chunks/ListPlugin-BchSFWVn.mjs +0 -2
- package/dist/chunks/ListPlugin-BchSFWVn.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-Q7l0d6Ma.mjs +0 -2
- package/dist/chunks/MarkdownParser-Dp62mfUq.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-DBELFAeo.mjs +0 -2
- package/dist/chunks/NodeSelectionCommands-WH5snxr_.mjs +0 -2
- package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs +0 -2
- package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs.map +0 -1
- package/dist/chunks/PopupKeyboardPatterns-tUrT9TyV.mjs +0 -2
- package/dist/chunks/PopupManager-Cj86uDEB.mjs +0 -2
- package/dist/chunks/PrintPlugin-D2javl_d.mjs +0 -2
- package/dist/chunks/PrintPlugin-D2javl_d.mjs.map +0 -1
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs +0 -2
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs.map +0 -1
- package/dist/chunks/Selection-HYoVFpAx.mjs +0 -2
- package/dist/chunks/Selection-HYoVFpAx.mjs.map +0 -1
- package/dist/chunks/SimpleMark-gTQaSJcO.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-BvJQ-fOz.mjs +0 -2
- package/dist/chunks/StyleRuntime-DW6omotc.mjs +0 -2
- package/dist/chunks/SuperSubPlugin-DTZB0Y3D.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +0 -1
- package/dist/chunks/TablePlugin-CPvg9YZS.mjs +0 -2
- package/dist/chunks/TextDirectionAutoPlugin-DRGbgTlx.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs.map +0 -1
- package/dist/chunks/TextFormattingPlugin-BhRxSC8q.mjs +0 -2
- package/dist/chunks/ThemeEngine-BUVo_zaT.mjs +0 -3
- package/dist/chunks/VideoPlugin-BugkI7-m.mjs +0 -2
- package/dist/chunks/VideoPlugin-BugkI7-m.mjs.map +0 -1
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs +0 -2
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs.map +0 -1
- package/dist/chunks/full-JM0-SwWy.mjs +0 -2
- package/dist/chunks/minimal-DSlR2A27.mjs +0 -2
- package/dist/chunks/register-BjsdJ3Aq.mjs +0 -2
- package/dist/chunks/register-BjsdJ3Aq.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrintPlugin-D2javl_d.mjs","names":[],"sources":["../../src/plugins/print/PrintLocale.ts","../../src/plugins/print/PrintContentPreparer.ts","../../src/plugins/print/PrintDestinationBridge.ts","../../src/plugins/print/PrintHostStyles.ts","../../src/plugins/print/PrintStyleCollector.ts","../../src/plugins/print/PrintServiceImpl.ts","../../src/plugins/print/PrintPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the PrintPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface PrintLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly printingAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const PRINT_LOCALE_EN: PrintLocale = {\n\tlabel: 'Print',\n\ttooltip: (shortcut: string) => `Print (${shortcut})`,\n\tprintingAnnouncement: 'Printing',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<PrintLocale> = import.meta.glob<{\n\tdefault: PrintLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadPrintLocale(lang: string): Promise<PrintLocale> {\n\treturn loadLocaleModule(localeModules, lang, PRINT_LOCALE_EN);\n}\n","/**\n * Prepares editor content for print output.\n * Clones the DOM, sanitizes interactive attributes, applies block filters,\n * and inserts header/footer elements.\n */\n\nimport DOMPurify from 'dompurify';\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Deep-clones the .notectl-content element from the editor container. */\nexport function cloneContent(container: HTMLElement): HTMLElement {\n\tconst content: HTMLElement | null = container.querySelector('.notectl-content');\n\tconst source: HTMLElement = content ?? container;\n\treturn source.cloneNode(true) as HTMLElement;\n}\n\n/** Sanitizes the cloned content for print: removes interactive attributes and selection styling. */\nexport function sanitize(clone: HTMLElement): void {\n\t// Remove contenteditable from the root\n\tclone.removeAttribute('contenteditable');\n\n\t// Remove selection-related CSS classes\n\tconst selectionClasses: readonly string[] = [\n\t\t'notectl-node-selected',\n\t\t'notectl-content--empty',\n\t\t'notectl-table-cell--selected',\n\t];\n\tfor (const cls of selectionClasses) {\n\t\tclone.classList.remove(cls);\n\t\tfor (const el of clone.querySelectorAll(`.${cls}`)) {\n\t\t\tel.classList.remove(cls);\n\t\t}\n\t}\n\n\t// Remove data-placeholder to avoid showing placeholder in print\n\tclone.removeAttribute('data-placeholder');\n}\n\n/** Removes excluded block types and applies page-break-before to configured block types. */\nexport function applyBlockFilters(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.excludeBlockTypes) {\n\t\tfor (const type of options.excludeBlockTypes) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tel.remove();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (options.pageBreakBefore) {\n\t\tfor (const type of options.pageBreakBefore) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tsetStyleProperties(el as HTMLElement, {\n\t\t\t\t\tbreakBefore: 'page',\n\t\t\t\t\tpageBreakBefore: 'always',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Tags allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_TAGS: readonly string[] = [\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'p',\n\t'div',\n\t'span',\n\t'br',\n\t'hr',\n\t'strong',\n\t'b',\n\t'em',\n\t'i',\n\t'u',\n\t's',\n\t'sub',\n\t'sup',\n\t'small',\n\t'ul',\n\t'ol',\n\t'li',\n\t'table',\n\t'thead',\n\t'tbody',\n\t'tr',\n\t'th',\n\t'td',\n\t'img',\n];\n\n/** Attributes allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_ATTRS: readonly string[] = [\n\t'style',\n\t'class',\n\t'src',\n\t'alt',\n\t'width',\n\t'height',\n\t'colspan',\n\t'rowspan',\n];\n\n/** Resolves a header/footer value to a sanitized HTML string. */\nfunction resolveContent(value: string | (() => string)): string {\n\tconst raw: string = typeof value === 'function' ? value() : value;\n\treturn DOMPurify.sanitize(raw, {\n\t\tALLOWED_TAGS: [...HEADER_FOOTER_ALLOWED_TAGS],\n\t\tALLOWED_ATTR: [...HEADER_FOOTER_ALLOWED_ATTRS],\n\t});\n}\n\n/** Inserts header and footer elements into the cloned content. */\nexport function insertHeaderFooter(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.header) {\n\t\tconst headerEl: HTMLDivElement = document.createElement('div');\n\t\theaderEl.className = 'notectl-print-header';\n\t\theaderEl.innerHTML = resolveContent(options.header);\n\t\tclone.insertBefore(headerEl, clone.firstChild);\n\t}\n\n\tif (options.footer) {\n\t\tconst footerEl: HTMLDivElement = document.createElement('div');\n\t\tfooterEl.className = 'notectl-print-footer';\n\t\tfooterEl.innerHTML = resolveContent(options.footer);\n\t\tclone.appendChild(footerEl);\n\t}\n}\n\n/** Orchestrates all content preparation steps. Returns a ready-to-print DOM element. */\nexport function prepare(container: HTMLElement, options: PrintOptions): HTMLElement {\n\tconst clone: HTMLElement = cloneContent(container);\n\tsanitize(clone);\n\tapplyBlockFilters(clone, options);\n\tinsertHeaderFooter(clone, options);\n\treturn clone;\n}\n","/**\n * Projects fragment targets from the print shadow tree into the document tree.\n * Browser fragment navigation and PDF named destinations cannot resolve IDs\n * whose root is a ShadowRoot, so each linked block target gets a slotted\n * light-DOM marker at the same rendered position.\n */\n\nimport { fragmentIdentifiers } from '../../model/HTMLUtils.js';\n\nexport const PRINT_DESTINATION_ATTRIBUTE = 'data-notectl-print-destination';\nexport const PRINT_DESTINATION_SLOT_ATTRIBUTE = 'data-notectl-print-destination-slot';\n\nexport interface PrintDestinationProjection {\n\treadonly markers: readonly HTMLAnchorElement[];\n}\n\ninterface Destination {\n\treadonly id: string;\n\treadonly marker: HTMLAnchorElement;\n}\n\nconst VOID_ELEMENTS: ReadonlySet<string> = new Set([\n\t'AREA',\n\t'BASE',\n\t'BR',\n\t'COL',\n\t'EMBED',\n\t'HR',\n\t'IMG',\n\t'INPUT',\n\t'LINK',\n\t'META',\n\t'PARAM',\n\t'SOURCE',\n\t'TRACK',\n\t'WBR',\n]);\n\nconst TABLE_STRUCTURAL_ELEMENTS: ReadonlySet<string> = new Set([\n\t'TABLE',\n\t'THEAD',\n\t'TBODY',\n\t'TFOOT',\n\t'TR',\n]);\n\n/** Elements whose rendered replacement/fallback UI does not lay out DOM children. */\nconst REPLACED_ELEMENTS: ReadonlySet<string> = new Set([\n\t'AUDIO',\n\t'CANVAS',\n\t'EMBED',\n\t'IFRAME',\n\t'IMG',\n\t'INPUT',\n\t'METER',\n\t'OBJECT',\n\t'PROGRESS',\n\t'SELECT',\n\t'TEXTAREA',\n\t'VIDEO',\n]);\n\nfunction uniqueToken(prefix: string, used: Set<string>): string {\n\tlet value: string;\n\tdo {\n\t\tvalue = `${prefix}-${crypto.randomUUID()}`;\n\t} while (used.has(value));\n\tused.add(value);\n\treturn value;\n}\n\nfunction firstBlockTargets(content: HTMLElement): ReadonlyMap<string, HTMLElement> {\n\tconst targets = new Map<string, HTMLElement>();\n\tif (content.matches('[data-block-id][id]') && content.id !== '') {\n\t\ttargets.set(content.id, content);\n\t}\n\tfor (const target of content.querySelectorAll<HTMLElement>('[data-block-id][id]')) {\n\t\tconst id: string = target.id;\n\t\tif (id !== '' && !targets.has(id)) targets.set(id, target);\n\t}\n\treturn targets;\n}\n\nfunction blockTargets(content: HTMLElement): HTMLElement[] {\n\tconst targets: HTMLElement[] = [];\n\tif (content.matches('[data-block-id][id]') && content.id !== '') targets.push(content);\n\ttargets.push(...content.querySelectorAll<HTMLElement>('[data-block-id][id]'));\n\treturn targets;\n}\n\nfunction resolveTarget(\n\ttargets: ReadonlyMap<string, HTMLElement>,\n\thref: string,\n): HTMLElement | undefined {\n\tfor (const identifier of fragmentIdentifiers(href)) {\n\t\tconst target: HTMLElement | undefined = targets.get(identifier);\n\t\tif (target) return target;\n\t}\n\treturn undefined;\n}\n\n/** Inserts a slot at the target without emitting invalid children for void or table elements. */\nfunction insertTargetSlot(target: HTMLElement, slot: HTMLSlotElement): void {\n\tif (VOID_ELEMENTS.has(target.tagName) || REPLACED_ELEMENTS.has(target.tagName)) {\n\t\ttarget.before(slot);\n\t\treturn;\n\t}\n\n\tif (TABLE_STRUCTURAL_ELEMENTS.has(target.tagName)) {\n\t\tconst cell: HTMLElement | null = target.querySelector<HTMLElement>('th, td');\n\t\tif (cell) {\n\t\t\tcell.insertBefore(slot, cell.firstChild);\n\t\t\treturn;\n\t\t}\n\t\tconst table: HTMLElement | null = target.closest<HTMLElement>('table');\n\t\tif (table?.parentNode) {\n\t\t\ttable.before(slot);\n\t\t\treturn;\n\t\t}\n\t}\n\n\ttarget.insertBefore(slot, target.firstChild);\n}\n\n/** Makes a zero-area PDF destination resistant to host/custom anchor styling. */\nfunction resetDestinationMarker(marker: HTMLAnchorElement): void {\n\tconst styles: Readonly<Record<string, string>> = {\n\t\tall: 'initial',\n\t\tdisplay: 'block',\n\t\tposition: 'absolute',\n\t\twidth: '0',\n\t\theight: '0',\n\t\tmargin: '0',\n\t\tpadding: '0',\n\t\tborder: '0',\n\t\toverflow: 'hidden',\n\t\t'pointer-events': 'none',\n\t\t'font-size': '0',\n\t\t'line-height': '0',\n\t\tcolor: 'transparent',\n\t\tbackground: 'transparent',\n\t};\n\tfor (const [property, value] of Object.entries(styles)) {\n\t\tmarker.style.setProperty(property, value, 'important');\n\t}\n}\n\nfunction createDestination(\n\ttarget: HTMLElement,\n\tdocument: Document,\n\tusedIds: Set<string>,\n\tusedSlotNames: Set<string>,\n): Destination {\n\tconst id: string = uniqueToken('notectl-print-destination', usedIds);\n\tconst slotName: string = uniqueToken('notectl-print-destination-slot', usedSlotNames);\n\n\tconst slot: HTMLSlotElement = document.createElement('slot');\n\tslot.name = slotName;\n\tslot.setAttribute(PRINT_DESTINATION_SLOT_ATTRIBUTE, '');\n\tinsertTargetSlot(target, slot);\n\n\tconst marker: HTMLAnchorElement = document.createElement('a');\n\tmarker.id = id;\n\tmarker.setAttribute('href', `#${id}`);\n\tmarker.slot = slotName;\n\tmarker.tabIndex = -1;\n\tmarker.setAttribute('aria-hidden', 'true');\n\tmarker.setAttribute(PRINT_DESTINATION_ATTRIBUTE, '');\n\tresetDestinationMarker(marker);\n\n\treturn { id, marker };\n}\n\n/**\n * Namespaces modeled IDs in the no-Shadow-DOM fallback so embedding the print\n * export cannot redirect its links to an earlier same-named consumer element.\n */\nexport function namespacePrintFallbackTargets(content: HTMLElement): void {\n\tconst targetsByOriginal: ReadonlyMap<string, HTMLElement> = firstBlockTargets(content);\n\tif (targetsByOriginal.size === 0) return;\n\n\tconst usedIds = new Set<string>();\n\tif (content.id !== '') usedIds.add(content.id);\n\tfor (const element of content.querySelectorAll<HTMLElement>('[id]')) usedIds.add(element.id);\n\n\tconst projectedIds = new Map<HTMLElement, string>();\n\tfor (const target of blockTargets(content)) {\n\t\tconst id: string = uniqueToken('notectl-print-fallback-destination', usedIds);\n\t\tprojectedIds.set(target, id);\n\t\ttarget.id = id;\n\t}\n\n\tfor (const link of content.querySelectorAll<HTMLAnchorElement>('a[href]')) {\n\t\tconst target: HTMLElement | undefined = resolveTarget(\n\t\t\ttargetsByOriginal,\n\t\t\tlink.getAttribute('href') ?? '',\n\t\t);\n\t\tconst id: string | undefined = target ? projectedIds.get(target) : undefined;\n\t\tif (id) link.setAttribute('href', `#${id}`);\n\t}\n}\n\n/**\n * Mutates only the supplied print shadow clone. Resolvable fragment-only links\n * are redirected to generated document-tree markers; all other links remain\n * byte-for-byte unchanged.\n */\nexport function projectPrintDestinations(content: HTMLElement): PrintDestinationProjection {\n\tconst targets: ReadonlyMap<string, HTMLElement> = firstBlockTargets(content);\n\tif (targets.size === 0) return { markers: [] };\n\n\tconst document: Document = content.ownerDocument;\n\tconst usedIds = new Set<string>();\n\tif (content.id !== '') usedIds.add(content.id);\n\tfor (const element of content.querySelectorAll<HTMLElement>('[id]')) {\n\t\tusedIds.add(element.id);\n\t}\n\tconst usedSlotNames = new Set<string>();\n\tfor (const slot of content.querySelectorAll<HTMLSlotElement>('slot[name]')) {\n\t\tusedSlotNames.add(slot.name);\n\t}\n\n\tconst destinations = new Map<HTMLElement, Destination>();\n\tconst markers: HTMLAnchorElement[] = [];\n\tfor (const link of content.querySelectorAll<HTMLAnchorElement>('a[href]')) {\n\t\tconst href: string = link.getAttribute('href') ?? '';\n\t\tif (!href.startsWith('#')) continue;\n\t\tconst target: HTMLElement | undefined = resolveTarget(targets, href);\n\t\tif (!target) continue;\n\n\t\tlet destination: Destination | undefined = destinations.get(target);\n\t\tif (!destination) {\n\t\t\tdestination = createDestination(target, document, usedIds, usedSlotNames);\n\t\t\tdestinations.set(target, destination);\n\t\t\tmarkers.push(destination.marker);\n\t\t}\n\t\tlink.setAttribute('href', `#${destination.id}`);\n\t}\n\n\treturn { markers };\n}\n","/**\n * Copies the host page's stylesheets verbatim into the print document.\n *\n * The print document preserves the editor's shadow boundary (declarative\n * shadow DOM), so host-authored rules — `::part()`, element selectors, custom\n * properties, `@media`, `@layer`, `@supports`, CSS nesting — apply natively\n * and need no translation or rewriting.\n *\n * All copied CSS is wrapped in the `notectl-host` cascade layer. Layering does\n * not weaken it against the editor's shadow styles, because the cascade\n * compares tree context before layers (an outer normal declaration beats a\n * shadow-tree one regardless). It does keep the print document's own rules in\n * control: its unlayered rules (page setup, body typography, customCSS) win\n * over the copy for normal declarations regardless of specificity, and the\n * print guards (host-element reset, forced light theme) — `!important` inside\n * the earlier-declared `notectl-print` layer — win even against `!important`\n * host rules.\n *\n * Stylesheets whose rules are not readable (cross-origin) are re-referenced\n * via hoisted `@import ... layer(notectl-host)` statements so the print\n * document loads them itself. The copy is produced as an ordered segment list\n * (rule chunks and `@import` statements interleaved in source order) so\n * equal-specificity cascade ties resolve exactly as on the live page.\n * Disabled stylesheets are skipped and stylesheet-level media conditions are\n * preserved as `@media` wrappers.\n */\n\n/** Cascade layer that holds the copied host-page styles in print output. */\nexport const HOST_STYLE_LAYER = 'notectl-host';\n\nconst IMPORT_RULE_TYPE = 3;\n\n/**\n * One source-ordered piece of the host-page CSS copy. `rules` segments hold\n * verbatim rule text destined for the `notectl-host` layer; `import` segments\n * hold hoisted `@import` statements for unreadable (cross-origin) sheets.\n * `@import` must precede every other rule of its stylesheet, so each segment\n * is emitted as its own `<style>` element — keeping the live source order,\n * which decides equal-specificity ties within the layer.\n */\nexport type HostStyleSegment =\n\t| { readonly kind: 'rules'; readonly css: string }\n\t| { readonly kind: 'import'; readonly statement: string };\n\ninterface CopyState {\n\treadonly segments: HostStyleSegment[];\n\treadonly seen: Set<CSSStyleSheet>;\n\t/** Base URL for rules from sheets without an own URL (inline styles). */\n\treadonly baseURL: string;\n\t/** Counter for naming hoisted anonymous import layers uniquely. */\n\tanonymousLayerCount: number;\n}\n\n/**\n * Collects the style roots that can hold rules targeting this editor: the\n * document plus any shadow roots the editor is nested in (outermost first, so\n * later, closer scopes win source-order ties after flattening).\n */\nfunction styleRootsOf(host: HTMLElement): readonly (Document | ShadowRoot)[] {\n\tconst roots: (Document | ShadowRoot)[] = [];\n\tlet node: Node = host.getRootNode();\n\twhile (node instanceof ShadowRoot) {\n\t\troots.push(node);\n\t\tnode = node.host.getRootNode();\n\t}\n\troots.push(host.ownerDocument);\n\treturn roots.reverse();\n}\n\nfunction sheetsOfRoot(root: Document | ShadowRoot): readonly CSSStyleSheet[] {\n\tconst sheets: CSSStyleSheet[] = Array.from(root.styleSheets);\n\tconst adopted: readonly CSSStyleSheet[] | undefined = root.adoptedStyleSheets;\n\tif (adopted) sheets.push(...adopted);\n\treturn sheets;\n}\n\n/** Escapes a URL for embedding in `@import url(\"...\")`. */\nfunction escapeImportURL(url: string): string {\n\treturn url.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n}\n\n/**\n * URLs that must not be rebased: fragment-only references stay document-local\n * (SVG paint servers like `fill: url(#gradient)`), and URLs that already have\n * a scheme or are protocol-relative resolve identically everywhere.\n */\nfunction isRebasableURL(url: string): boolean {\n\tif (url.startsWith('#') || url.startsWith('//')) return false;\n\treturn !/^[a-z][a-z0-9+.-]*:/i.test(url);\n}\n\n/** Returns the index just past the closing quote of the string opening at `start`. */\nfunction skipString(cssText: string, start: number): number {\n\tconst quote: string = cssText[start] ?? '\"';\n\tlet i: number = start + 1;\n\twhile (i < cssText.length) {\n\t\tconst ch: string = cssText[i] ?? '';\n\t\tif (ch === '\\\\') {\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ch === quote) return i + 1;\n\t\ti++;\n\t}\n\treturn cssText.length;\n}\n\n/**\n * Resolves CSS escape sequences (`\\\"`, `\\2f `, …) in a `url()` argument so the\n * actual URL is rebased, not its escaped serialization.\n */\nfunction unescapeCSSValue(value: string): string {\n\treturn value.replace(\n\t\t/\\\\([0-9a-f]{1,6}\\s?|[\\s\\S])/gi,\n\t\t(_match: string, escaped: string): string => {\n\t\t\tconst hex: string = escaped.trim();\n\t\t\tif (/^[0-9a-f]{1,6}$/i.test(hex)) {\n\t\t\t\tconst code: number = Number.parseInt(hex, 16);\n\t\t\t\treturn code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : '�';\n\t\t\t}\n\t\t\treturn escaped;\n\t\t},\n\t);\n}\n\n/** True when a `url(` function token starts at `index` (not part of a longer identifier). */\nfunction isURLTokenStart(cssText: string, index: number): boolean {\n\tif (cssText.slice(index, index + 4).toLowerCase() !== 'url(') return false;\n\tconst before: string = index > 0 ? (cssText[index - 1] ?? '') : '';\n\treturn !/[\\w-]/.test(before);\n}\n\ninterface URLToken {\n\t/** Index just past the closing `)`. */\n\treadonly end: number;\n\t/** The unescaped URL argument. */\n\treadonly url: string;\n}\n\n/** Parses the `url(...)` token starting at `start`; null when malformed. */\nfunction parseURLToken(cssText: string, start: number): URLToken | null {\n\tlet i: number = start + 4;\n\twhile (i < cssText.length && /\\s/.test(cssText[i] ?? '')) i++;\n\tconst ch: string = cssText[i] ?? '';\n\tlet raw: string;\n\tif (ch === '\"' || ch === \"'\") {\n\t\tconst end: number = skipString(cssText, i);\n\t\traw = cssText.slice(i + 1, end - 1);\n\t\ti = end;\n\t} else {\n\t\tconst close: number = cssText.indexOf(')', i);\n\t\tif (close === -1) return null;\n\t\traw = cssText.slice(i, close).trim();\n\t\ti = close;\n\t}\n\twhile (i < cssText.length && /\\s/.test(cssText[i] ?? '')) i++;\n\tif (cssText[i] !== ')') return null;\n\treturn { end: i + 1, url: unescapeCSSValue(raw) };\n}\n\n/** Rewrites one parsed `url()` token, keeping it verbatim when not rebasable. */\nfunction rebaseURLToken(original: string, url: string, baseURL: string): string {\n\tif (!url || !isRebasableURL(url)) return original;\n\ttry {\n\t\treturn `url(\"${new URL(url, baseURL).href}\")`;\n\t} catch {\n\t\treturn original;\n\t}\n}\n\n/**\n * Rewrites relative `url()` references to absolute URLs against the source\n * stylesheet's URL. Copied `cssText` keeps URLs as authored; in the print\n * document they would re-resolve against the page URL instead of the\n * stylesheet's location, breaking fonts and images from stylesheets that live\n * in another directory. The scan is string-aware: a value that merely mentions\n * `url(...)` inside a CSS string (`content: \"url(info)\"`) is left untouched —\n * rewriting inside it would inject quotes and invalidate the declaration.\n */\nfunction rebaseCSSURLs(cssText: string, baseURL: string): string {\n\tif (!cssText.toLowerCase().includes('url(')) return cssText;\n\tlet result = '';\n\tlet i = 0;\n\twhile (i < cssText.length) {\n\t\tconst ch: string = cssText[i] ?? '';\n\t\tif (ch === '\"' || ch === \"'\") {\n\t\t\tconst end: number = skipString(cssText, i);\n\t\t\tresult += cssText.slice(i, end);\n\t\t\ti = end;\n\t\t\tcontinue;\n\t\t}\n\t\tif (isURLTokenStart(cssText, i)) {\n\t\t\tconst token: URLToken | null = parseURLToken(cssText, i);\n\t\t\tif (token) {\n\t\t\t\tresult += rebaseURLToken(cssText.slice(i, token.end), token.url, baseURL);\n\t\t\t\ti = token.end;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tresult += ch;\n\t\ti++;\n\t}\n\treturn result;\n}\n\n/** Returns a unique sublayer name for a hoisted anonymous import layer. */\nfunction anonymousLayerName(state: CopyState): string {\n\tstate.anonymousLayerCount += 1;\n\treturn `notectl-anonymous-${state.anonymousLayerCount}`;\n}\n\n/** Appends rule text, coalescing with a preceding rules segment. */\nfunction pushRules(state: CopyState, css: string): void {\n\tconst last: HostStyleSegment | undefined = state.segments[state.segments.length - 1];\n\tif (last?.kind === 'rules') {\n\t\tstate.segments[state.segments.length - 1] = { kind: 'rules', css: `${last.css}\\n${css}` };\n\t\treturn;\n\t}\n\tstate.segments.push({ kind: 'rules', css });\n}\n\n/**\n * Accumulated cascade context enclosing a hoisted cross-origin `@import`: the\n * media, cascade-layer, and `supports()` conditions of every stylesheet and\n * import rule between the `notectl-host` layer and the re-referenced sheet. A\n * hoisted `@import` is emitted at the top level, outside the `@layer`/`@media`/\n * `@supports` wrappers its inlined siblings receive, so it must carry this\n * context on the statement itself or the re-referenced sheet lands in the wrong\n * cascade layer and ignores the enclosing conditions.\n */\ninterface ImportContext {\n\t/** Media conditions, outermost first; ANDed on emit. */\n\treadonly media: readonly string[];\n\t/** Layer chain under `notectl-host`, outermost first; `null` = anonymous. */\n\treadonly layers: readonly (string | null)[];\n\t/** `supports()` conditions, outermost first; ANDed on emit. */\n\treadonly supports: readonly string[];\n}\n\nconst EMPTY_IMPORT_CONTEXT: ImportContext = { media: [], layers: [], supports: [] };\n\n/**\n * Extends a context with one nesting level's own media/layer/supports. `all`\n * and empty media impose no condition and are dropped; anonymous layers are\n * kept as `null` placeholders and only named at emit time, so the shared\n * anonymous-layer counter advances solely on real hoists, not on readable\n * imports that are inlined.\n */\nfunction extendImportContext(\n\tparent: ImportContext,\n\tmediaText: string,\n\tlayerName: string | null,\n\tsupportsText: string | null,\n): ImportContext {\n\tconst media: string = mediaText.trim();\n\tconst supports: string = supportsText?.trim() ?? '';\n\treturn {\n\t\tmedia: media && media !== 'all' ? [...parent.media, media] : parent.media,\n\t\tlayers:\n\t\t\tlayerName === null ? parent.layers : [...parent.layers, layerName === '' ? null : layerName],\n\t\tsupports: supports ? [...parent.supports, supports] : parent.supports,\n\t};\n}\n\n/**\n * Combines accumulated `supports()` conditions into one `@import` supports\n * clause. A single condition stays bare (`supports(display: grid)`); multiple\n * conditions are each parenthesized and ANDed, since the `supports()` grammar\n * only permits `and` between parenthesized conditions.\n */\nfunction combineSupports(conditions: readonly string[]): string {\n\tif (conditions.length === 0) return '';\n\tif (conditions.length === 1) return ` supports(${conditions[0]})`;\n\treturn ` supports(${conditions.map((condition: string): string => `(${condition})`).join(' and ')})`;\n}\n\n/**\n * Re-references a stylesheet whose rules are not readable, carrying the\n * enclosing cascade context (media, layer chain, `supports()`) on the hoisted\n * statement so the re-referenced sheet keeps the same layer, media, and feature\n * gating it had live — nested layers order before the parent's direct rules,\n * mirroring how layered import content loses to unlayered page rules. Media\n * conditions are ANDed with `and`; a comma-separated media list at one level is\n * not distributed across the `and` (a rare edge that would need a cartesian\n * expansion). The statement is pushed as an ordered segment so the sheet keeps\n * its live source-order position.\n */\nfunction hoistImport(state: CopyState, href: string, context: ImportContext): void {\n\tconst layerChain: string[] = [HOST_STYLE_LAYER];\n\tfor (const layer of context.layers) {\n\t\tlayerChain.push(layer ?? anonymousLayerName(state));\n\t}\n\tconst supports: string = combineSupports(context.supports);\n\tconst media: string = context.media.length ? ` ${context.media.join(' and ')}` : '';\n\tstate.segments.push({\n\t\tkind: 'import',\n\t\tstatement: `@import url(\"${escapeImportURL(href)}\") layer(${layerChain.join('.')})${supports}${media};`,\n\t});\n}\n\n/** Wraps serialized sheet text in the sheet's own media condition, if any. */\nfunction wrapInSheetMedia(text: string, mediaText: string): string {\n\tconst media: string = mediaText.trim();\n\tif (!media || media === 'all') return text;\n\treturn `@media ${media} {\\n${text}\\n}`;\n}\n\nfunction serializeSheet(sheet: CSSStyleSheet, state: CopyState): void {\n\tif (state.seen.has(sheet)) return;\n\tstate.seen.add(sheet);\n\tif (sheet.disabled) return;\n\n\t// The sheet's own media (from its <link>/@import) is the enclosing context\n\t// for any cross-origin import it holds: its readable rules are wrapped in the\n\t// same @media below, so a hoisted import must carry it too.\n\tconst sheetContext: ImportContext = extendImportContext(\n\t\tEMPTY_IMPORT_CONTEXT,\n\t\tsheet.media.mediaText,\n\t\tnull,\n\t\tnull,\n\t);\n\n\tlet cssRules: CSSRuleList;\n\ttry {\n\t\tcssRules = sheet.cssRules;\n\t} catch {\n\t\t// Cross-origin — rules are not readable. Re-reference so the print\n\t\t// document loads the stylesheet itself.\n\t\tif (sheet.href) hoistImport(state, sheet.href, sheetContext);\n\t\treturn;\n\t}\n\n\tconst base: string = sheet.href ?? state.baseURL;\n\tconst body: string[] = [];\n\tfor (const rule of cssRules) {\n\t\tif (rule.type === IMPORT_RULE_TYPE) {\n\t\t\t// `@import` precedes every other rule of its sheet, so hoisted\n\t\t\t// statements emitted now stay ahead of this sheet's rule chunk.\n\t\t\tserializeImportRule(rule as CSSImportRule, state, body, sheetContext);\n\t\t\tcontinue;\n\t\t}\n\t\tbody.push(rebaseCSSURLs(rule.cssText, base));\n\t}\n\n\tconst text: string = body.join('\\n');\n\tif (text) pushRules(state, wrapInSheetMedia(text, sheet.media.mediaText));\n}\n\n/**\n * Inlines a readable `@import` target in place; unreadable targets are hoisted\n * as layered `@import` statements (`@import` is not valid inside a layer\n * block, so it cannot be copied verbatim). The import's own cascade-layer\n * assignment and `supports()` condition survive inlining as nested `@layer`\n * and `@supports` blocks — without them, layered import content would compete\n * on specificity against page rules it loses to live.\n */\nfunction serializeImportRule(\n\trule: CSSImportRule,\n\tstate: CopyState,\n\tbody: string[],\n\tparentContext: ImportContext,\n): void {\n\tconst layerName: string | null = rule.layerName ?? null;\n\tconst supportsText: string | null = rule.supportsText ?? null;\n\t// This import's own media/layer/supports extend the parent context. Readable\n\t// targets pass it to their nested imports; an unreadable target is hoisted\n\t// under it.\n\tconst context: ImportContext = extendImportContext(\n\t\tparentContext,\n\t\trule.media.mediaText,\n\t\tlayerName,\n\t\tsupportsText,\n\t);\n\tconst imported: CSSStyleSheet | null = rule.styleSheet;\n\tif (imported && !state.seen.has(imported)) {\n\t\tlet importedRules: CSSRuleList | null;\n\t\ttry {\n\t\t\timportedRules = imported.cssRules;\n\t\t} catch {\n\t\t\timportedRules = null;\n\t\t}\n\t\tif (importedRules) {\n\t\t\tstate.seen.add(imported);\n\t\t\tconst base: string = imported.href ?? state.baseURL;\n\t\t\tconst inner: string[] = [];\n\t\t\tfor (const importedRule of importedRules) {\n\t\t\t\tif (importedRule.type === IMPORT_RULE_TYPE) {\n\t\t\t\t\tserializeImportRule(importedRule as CSSImportRule, state, inner, context);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tinner.push(rebaseCSSURLs(importedRule.cssText, base));\n\t\t\t}\n\t\t\tlet text: string = inner.join('\\n');\n\t\t\tif (text) {\n\t\t\t\tif (layerName !== null) {\n\t\t\t\t\t// Anonymous import layers stay anonymous via a nameless block.\n\t\t\t\t\ttext = layerName === '' ? `@layer {\\n${text}\\n}` : `@layer ${layerName} {\\n${text}\\n}`;\n\t\t\t\t}\n\t\t\t\tif (supportsText?.trim()) {\n\t\t\t\t\t// supports(display: grid) allows a bare declaration; the @supports\n\t\t\t\t\t// rule grammar does not, so the condition is parenthesized.\n\t\t\t\t\ttext = `@supports (${supportsText.trim()}) {\\n${text}\\n}`;\n\t\t\t\t}\n\t\t\t\tbody.push(wrapInSheetMedia(text, rule.media.mediaText));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\tconst href: string | null = imported?.href ?? rule.href;\n\tif (href) hoistImport(state, href, context);\n}\n\n/**\n * Copies all stylesheets that can target this editor (document-level plus any\n * enclosing shadow roots, including adopted sheets) into an ordered list of\n * verbatim CSS segments for the print document.\n */\nexport function collectHostStyleSegments(host: HTMLElement): readonly HostStyleSegment[] {\n\tconst state: CopyState = {\n\t\tsegments: [],\n\t\tseen: new Set(),\n\t\tbaseURL: host.ownerDocument.baseURI ?? '',\n\t\tanonymousLayerCount: 0,\n\t};\n\tfor (const root of styleRootsOf(host)) {\n\t\tfor (const sheet of sheetsOfRoot(root)) {\n\t\t\tserializeSheet(sheet, state);\n\t\t}\n\t}\n\treturn state.segments;\n}\n","/**\n * Collects and aggregates CSS for print output.\n *\n * The print document preserves the editor's shadow boundary (declarative\n * shadow DOM), so styles split into two scopes:\n *\n * - Shadow scope (inside the template): the editor's own adopted styles\n * (base styles behind a cascade layer, runtime style-token rules\n * unlayered), print content rules, and `customCSS` as the final same-tree\n * override.\n * - Document scope: print guards (host-element reset, `html`/`body` page\n * reset, and forced light theme — `!important` inside the `notectl-print`\n * layer so they hold even against `!important` host rules such as\n * `@media print { body * { visibility: hidden } }`), the carried\n * theme-token snapshot (unlayered, so it beats the layered host copy), body\n * typography snapshot, `@page` setup, and two `customCSS` copies: unlayered\n * for normal-strength page-level rules (`@page`, `body`) and inside the\n * earliest `notectl-custom` layer so consumer `!important` rules outrank\n * the print guards.\n *\n * Document layer order is `notectl-custom, notectl-print, notectl-host`\n * (declared in {@link buildHTMLDocument}). For normal declarations unlayered\n * rules win over all layers; for `!important` declarations the layer order\n * reverses, so earlier layers win: customCSS > print guards > host copy.\n *\n * Two document-scope builders exist: {@link buildDocumentCSS} for the\n * internal print iframe (full page fidelity — `html`/`body` reset, body\n * typography, `@page`) and {@link buildExportDocumentCSS} for the export\n * variant, whose inline rules are all qualified with the replica marker\n * attribute so embedding the export into a live page (documented\n * innerHTML/setHTMLUnsafe flow) cannot restyle the consumer's document. The\n * export regains full page fidelity in standalone documents through the\n * script-hoisted standalone style bundle (see PrintServiceImpl).\n */\n\nimport { generateThemeCSS } from '../../editor/theme/ThemeEngine.js';\nimport { LIGHT_THEME } from '../../editor/theme/ThemeTokens.js';\nimport {\n\tPAPER_MARGIN_HORIZONTAL_PX,\n\tPAPER_MARGIN_TOP_PX,\n\tgetPaperCSSSize,\n} from '../../model/PaperSize.js';\nimport { isRuntimeStyleSheet } from '../../style/StyleRuntime.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Cascade layer that holds the editor's own base styles in print output. */\nconst BASE_STYLE_LAYER = 'notectl-base';\n\n/**\n * Document-level cascade layer holding the print guards (host reset, forced\n * light theme). Declared before the host-copy layer, so its `!important`\n * declarations beat `!important` host rules.\n */\nexport const PRINT_STYLE_LAYER = 'notectl-print';\n\n/**\n * Earliest document-level cascade layer, holding a `customCSS` copy. Its\n * `!important` declarations are the strongest in the print document — the\n * consumer's escape hatch over the print guards and host rules.\n */\nexport const CUSTOM_STYLE_LAYER = 'notectl-custom';\n\n/**\n * Appends `!important` to every declaration of generated CSS. Only safe for\n * CSS this module generates itself (one declaration per line, no semicolons\n * inside values).\n */\nfunction markDeclarationsImportant(css: string): string {\n\treturn css.replace(/;$/gm, ' !important;');\n}\n\n/** Adopted shadow styles split by role for print emission. */\nexport interface AdoptedStylePartition {\n\t/** Editor base styles — emitted inside the print cascade layer. */\n\treadonly base: string;\n\t/**\n\t * Runtime style-token rules (strict-CSP mode) carrying user-applied content\n\t * formatting — emitted unlayered so they keep their cascade strength.\n\t */\n\treadonly runtime: string;\n}\n\n/**\n * Extracts CSS text from all adopted stylesheets on a ShadowRoot, separating\n * editor base styles from runtime style-token sheets. The distinction matters\n * for print: base styles go into a cascade layer so consumer overrides win\n * (the documented #202 semantic: `customCSS` overrides built-in element\n * styling regardless of selector specificity — the flip side, also\n * documented, is that broad customCSS resets such as `* { padding: 0 }`\n * override base styling too), but token rules represent user content\n * formatting (inline styles in non-CSP mode) and must not be demoted with\n * them.\n */\nexport function partitionAdoptedStyles(shadowRoot: ShadowRoot): AdoptedStylePartition {\n\tconst base: string[] = [];\n\tconst runtime: string[] = [];\n\tfor (const sheet of shadowRoot.adoptedStyleSheets) {\n\t\tconst target: string[] = isRuntimeStyleSheet(sheet) ? runtime : base;\n\t\tfor (const rule of sheet.cssRules) {\n\t\t\ttarget.push(rule.cssText);\n\t\t}\n\t}\n\treturn { base: base.join('\\n'), runtime: runtime.join('\\n') };\n}\n\n/**\n * Generates light theme custom properties targeting `selector` (a full\n * selector list). The internal print iframe passes `:root` plus the host\n * element, so page-level `customCSS` rules\n * (`body { background: var(--notectl-bg) }`) keep resolving while the host\n * element re-pins the tokens closer than the shadow theme sheet's `:host`\n * defaults; the export variant passes only the marker-qualified replica so\n * nothing can leak into an embedding page. Every declaration is `!important`;\n * emitted inside the `notectl-print` layer, it beats copied host-page token\n * overrides (even `!important` ones) and the shadow theme sheet (tree\n * context), guaranteeing readable print output regardless of the active\n * editor theme.\n */\nexport function generateLightThemeTokens(selector: string): string {\n\tconst css: string = generateThemeCSS(LIGHT_THEME).replace(':host {', `${selector} {`);\n\treturn markDeclarationsImportant(css);\n}\n\n/**\n * Serializes an element's inline `--notectl-*` declarations. Tokens set via\n * the `style` attribute or JS `setProperty` (runtime theme switchers) cannot\n * travel through the stylesheet copy; re-emitting them as inline style on the\n * print document's corresponding element preserves their live cascade\n * strength — inline declarations beat every copied stylesheet rule, exactly\n * as on the live page.\n */\nexport function collectInlineThemeTokens(el: Element | null): string {\n\tif (!(el instanceof HTMLElement)) return '';\n\tconst declarations: string[] = [];\n\tfor (let i = 0; i < el.style.length; i++) {\n\t\tconst prop: string = el.style[i] ?? '';\n\t\tif (!prop.startsWith('--notectl-')) continue;\n\t\tconst value: string = el.style.getPropertyValue(prop).trim();\n\t\tif (value) declarations.push(`${prop}: ${value}`);\n\t}\n\treturn declarations.join('; ');\n}\n\n/**\n * Snapshots all computed `--notectl-*` tokens from the host element when\n * carrying the live theme (`forceLightTheme: false`). The computed values are\n * the ground truth of what the user saw: tokens set via the host's inline\n * `style` attribute (stripped from the print replica), via JS `setProperty`,\n * or via rules scoped to wrapper elements that do not exist in the print\n * document cannot travel through the stylesheet copy. Targeted at `selector`\n * (a full selector list: the host element, plus `:root` in the internal\n * variant so page-level `customCSS` keeps resolving the tokens) and emitted\n * unlayered: unlayered normal declarations beat the layered host copy, so a\n * host-page rule that matches differently in the print document (its wrapper\n * ancestors are not replicated) cannot override the live values.\n * Print-specific token overrides therefore need `!important` in the host\n * page or `customCSS`.\n */\nexport function snapshotThemeTokens(host: HTMLElement, selector: string): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst tokens: string[] = [];\n\n\tfor (let i = 0; i < computed.length; i++) {\n\t\tconst prop: string = computed[i] ?? '';\n\t\tif (prop.startsWith('--notectl-')) {\n\t\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\t\tif (value) {\n\t\t\t\ttokens.push(` ${prop}: ${value};`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tokens.length === 0) return '';\n\treturn `${selector} {\\n${tokens.join('\\n')}\\n}`;\n}\n\n/** Computed background-color values that mean \"no own background\". */\nconst TRANSPARENT_BACKGROUNDS: readonly string[] = ['', 'transparent', 'rgba(0, 0, 0, 0)'];\n\n/**\n * Resolves the background the editor content visually sits on, for carrying\n * the live theme into print (`forceLightTheme: false`). Walks up from the\n * content container (crossing shadow boundaries) through the page body up to\n * the root element — dark themes commonly paint `html` and leave `body`\n * transparent — returning the first non-transparent computed\n * background-color. Falls back to white so print output never inherits an\n * undefined background.\n */\nexport function resolveCarriedBackground(container: HTMLElement): string {\n\tlet el: HTMLElement | null = container;\n\twhile (el) {\n\t\tconst background: string = getComputedStyle(el).getPropertyValue('background-color').trim();\n\t\tif (!TRANSPARENT_BACKGROUNDS.includes(background)) return background;\n\t\tconst root: Node = el.getRootNode();\n\t\tel = el.parentElement ?? (root instanceof ShadowRoot ? (root.host as HTMLElement) : null);\n\t}\n\treturn '#ffffff';\n}\n\n/**\n * Snapshots computed typography from the host element into a rule for\n * `selector` (the page body in the print iframe, the replica host in the\n * export variant). Copied host-page styles are layered and `body` rules from\n * the host page are meant for the host application, so print pins typography\n * explicitly to what the editor computed live. The background is pinned to\n * `background` — white when the light theme is forced, the carried theme\n * background otherwise — so dark-theme output never renders light text on\n * white paper.\n */\nexport function snapshotTypography(\n\thost: HTMLElement,\n\tcolorOverride?: string,\n\tbackground = '#ffffff',\n\tselector = 'body',\n): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst props: string[] = [\n\t\t'font-family',\n\t\t'font-size',\n\t\t'font-weight',\n\t\t'line-height',\n\t\t'letter-spacing',\n\t\t'word-spacing',\n\t\t'color',\n\t];\n\tconst rules: string[] = [' margin: 0;', ` background: ${background};`];\n\tfor (const prop of props) {\n\t\tif (prop === 'color' && colorOverride) {\n\t\t\trules.push(` color: ${colorOverride};`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\tif (value) {\n\t\t\trules.push(` ${prop}: ${value};`);\n\t\t}\n\t}\n\treturn `${selector} {\\n${rules.join('\\n')}\\n}`;\n}\n\n/** Declarations that neutralize screen-widget chrome on the print host. */\nconst HOST_RESET_DECLARATIONS: readonly string[] = [\n\t'display: block',\n\t'position: static',\n\t'inset: auto',\n\t'width: auto',\n\t'height: auto',\n\t'min-width: 0',\n\t'min-height: 0',\n\t'max-width: none',\n\t'max-height: none',\n\t'margin: 0',\n\t'padding: 0',\n\t'border: none',\n\t'border-radius: 0',\n\t'outline: none',\n\t'box-shadow: none',\n\t'background: transparent',\n\t'overflow: visible',\n\t'transform: none',\n\t'filter: none',\n\t'opacity: 1',\n\t'contain: none',\n\t'float: none',\n\t'visibility: visible',\n\t'clip: auto',\n\t'clip-path: none',\n\t'content-visibility: visible',\n];\n\n/**\n * Declarations that keep the print page itself visible and unclipped. Host\n * pages commonly hide or clip at the page level — the classic\n * `@media print { body * { visibility: hidden } }` trick or app-shell\n * `html, body { height: 100%; overflow: hidden }` — and those rules are\n * copied verbatim into the host layer. Only hide/clip-capable properties are\n * guarded; box properties like `margin` stay overridable via plain customCSS.\n */\nconst PAGE_RESET_DECLARATIONS: readonly string[] = [\n\t'display: block',\n\t'visibility: visible',\n\t'opacity: 1',\n\t'position: static',\n\t'height: auto',\n\t'min-height: 0',\n\t'max-height: none',\n\t'overflow: visible',\n\t'transform: none',\n\t'filter: none',\n\t'contain: none',\n\t'clip: auto',\n\t'clip-path: none',\n\t'content-visibility: visible',\n];\n\n/**\n * Neutralizes page-level hiding and clipping from copied host rules on\n * `html`/`body`. Every declaration is `!important`; emitted inside the\n * `notectl-print` layer it beats the host copy even against `!important`\n * host rules, while `customCSS` (earlier `notectl-custom` layer) still wins.\n */\nexport function generatePageResetCSS(): string {\n\treturn [\n\t\t'html, body {',\n\t\t...PAGE_RESET_DECLARATIONS.map((declaration: string): string => ` ${declaration} !important;`),\n\t\t'}',\n\t].join('\\n');\n}\n\n/**\n * Neutralizes screen-widget chrome on the print host element. Copied\n * host-page rules like `notectl-editor { height: 400px; border: … }` style\n * the live widget but must not constrain the paginated print flow. Every\n * declaration is `!important`; emitted inside the `notectl-print` layer, the\n * reset beats the host copy even against `!important` host rules. Inherited\n * properties (fonts, color) are deliberately not touched; `customCSS` can\n * reclaim any of these via `!important` (earlier `notectl-custom` layer).\n */\nexport function generateHostResetCSS(hostSelector: string): string {\n\treturn [\n\t\t`${hostSelector} {`,\n\t\t...HOST_RESET_DECLARATIONS.map((declaration: string): string => ` ${declaration} !important;`),\n\t\t'}',\n\t].join('\\n');\n}\n\n/** Generates the `@page` rule based on PrintOptions. */\nexport function generatePageCSS(options: PrintOptions): string {\n\tconst pageProps: string[] = [];\n\tif (options.margin) {\n\t\tpageProps.push(` margin: ${options.margin};`);\n\t} else if (options.paperSize) {\n\t\t// WYSIWYG: zero @page margin so body = full paper width;\n\t\t// document margins are applied as content padding below.\n\t\tpageProps.push(' margin: 0;');\n\t}\n\tif (options.paperSize || options.orientation) {\n\t\tconst sizeKeyword: string = options.paperSize ? getPaperCSSSize(options.paperSize) : 'A4';\n\t\tconst sizeParts: string[] = [sizeKeyword];\n\t\tif (options.orientation) {\n\t\t\tsizeParts.push(options.orientation);\n\t\t}\n\t\tpageProps.push(` size: ${sizeParts.join(' ')};`);\n\t}\n\tif (pageProps.length === 0) return '';\n\treturn `@page {\\n${pageProps.join('\\n')}\\n}`;\n}\n\n/** Generates print-specific content rules; emitted inside the shadow scope. */\nexport function generateContentPrintCSS(options: PrintOptions): string {\n\tconst parts: string[] = [];\n\n\t// Print flows the full document: screen scroll constraints on the content\n\t// area (the --notectl-content-max-height token or host ::part(content)\n\t// height rules) must not clip it to one scroll fold. Shadow-tree\n\t// `!important` beats document-tree `!important`, so this holds even\n\t// against host `::part()` rules; the shadow customCSS copy is emitted\n\t// later in source order and can still override.\n\tparts.push(\n\t\t'.notectl-content { height: auto !important; max-height: none !important; ' +\n\t\t\t'min-height: 0 !important; overflow: visible !important; }',\n\t);\n\n\t// WYSIWYG: apply paper-mode document margins to print content\n\tif (options.paperSize) {\n\t\tparts.push(\n\t\t\t`.notectl-content { padding: ${PAPER_MARGIN_TOP_PX}px ${PAPER_MARGIN_HORIZONTAL_PX}px !important; }`,\n\t\t);\n\t}\n\n\t// Print media rules\n\tconst printRules: string[] = [];\n\n\t// Hide non-printable elements\n\tprintRules.push('[data-notectl-no-print] { display: none !important; }');\n\n\t// Code blocks: preserve background, force wrapping\n\tprintRules.push(\n\t\t'.notectl-code-block { white-space: pre-wrap !important; ' +\n\t\t\t'word-break: break-all !important; page-break-inside: avoid; }',\n\t);\n\n\t// Images: avoid page breaks\n\tprintRules.push('img { page-break-inside: avoid; }');\n\n\t// Tables: avoid page breaks\n\tprintRules.push('.notectl-table { break-inside: avoid; }');\n\n\t// Preserve background colors and images in print output (WYSIWYG default).\n\t// Only omitted when the consumer explicitly opts out via printBackground: false.\n\tif (options.printBackground !== false) {\n\t\tprintRules.push(\n\t\t\t'* { -webkit-print-color-adjust: exact !important; ' +\n\t\t\t\t'print-color-adjust: exact !important; }',\n\t\t);\n\t}\n\n\tparts.push(`@media print {\\n ${printRules.join('\\n ')}\\n}`);\n\n\treturn parts.join('\\n\\n');\n}\n\n/**\n * Builds the CSS placed inside the print document's declarative shadow root:\n * editor base styles behind a cascade layer (so consumer overrides win),\n * runtime style-token rules unlayered, print content rules, and customCSS as\n * the final same-tree override.\n */\nexport function buildShadowCSS(shadowRoot: ShadowRoot, options: PrintOptions): string {\n\tconst parts: string[] = [];\n\n\tconst adopted: AdoptedStylePartition = partitionAdoptedStyles(shadowRoot);\n\tif (adopted.base) parts.push(`@layer ${BASE_STYLE_LAYER} {\\n${adopted.base}\\n}`);\n\tif (adopted.runtime) parts.push(adopted.runtime);\n\n\tconst contentCSS: string = generateContentPrintCSS(options);\n\tif (contentCSS) parts.push(contentCSS);\n\n\tif (options.customCSS) {\n\t\tparts.push(options.customCSS);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n\n/** The print-color-adjust guard; document-level, because the shadow-scope copy cannot reach document-tree elements. */\nconst COLOR_ADJUST_GUARD: string =\n\t'* {\\n -webkit-print-color-adjust: exact !important;\\n print-color-adjust: exact !important;\\n}';\n\n/**\n * Builds the document-level CSS of the internal print iframe: the print\n * guards (host reset, `html`/`body` page reset, and forced light theme —\n * `!important` inside the `notectl-print` layer), the unlayered theme-token\n * snapshot, body typography, `@page`, and two copies of customCSS. The\n * unlayered copy carries page-level custom rules (`@page`, `body` — they\n * cannot live inside the shadow scope) at normal strength; the\n * `notectl-custom` layer copy makes consumer `!important` rules outrank the\n * print guards and `!important` host rules.\n */\nexport function buildDocumentCSS(\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\toptions: PrintOptions,\n): string {\n\tconst hostSelector: string = host.tagName.toLowerCase();\n\tconst parts: string[] = [];\n\n\tconst forceLightTheme: boolean = options.forceLightTheme !== false;\n\tconst guards: string[] = [generateHostResetCSS(hostSelector), generatePageResetCSS()];\n\tif (forceLightTheme) {\n\t\tguards.push(generateLightThemeTokens(`:root, ${hostSelector}`));\n\t}\n\t// Without the document-level copy of this guard, the pinned body background\n\t// (the carried theme background for forceLightTheme: false) is stripped by\n\t// the browser's default \"no background graphics\" print behavior.\n\tif (options.printBackground !== false) {\n\t\tguards.push(COLOR_ADJUST_GUARD);\n\t}\n\tparts.push(`@layer ${PRINT_STYLE_LAYER} {\\n${guards.join('\\n\\n')}\\n}`);\n\n\tif (!forceLightTheme) {\n\t\tconst themeTokens: string = snapshotThemeTokens(host, `:root, ${hostSelector}`);\n\t\tif (themeTokens) parts.push(themeTokens);\n\t}\n\n\tconst colorOverride: string | undefined = forceLightTheme\n\t\t? LIGHT_THEME.primitives.foreground\n\t\t: undefined;\n\tconst background: string = forceLightTheme ? '#ffffff' : resolveCarriedBackground(container);\n\tparts.push(snapshotTypography(host, colorOverride, background));\n\n\tconst pageCSS: string = generatePageCSS(options);\n\tif (pageCSS) parts.push(pageCSS);\n\n\tif (options.customCSS) {\n\t\tparts.push(options.customCSS);\n\t\tparts.push(`@layer ${CUSTOM_STYLE_LAYER} {\\n${options.customCSS}\\n}`);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n\n/**\n * Builds the inline document-level CSS of the export variant (`toHTML()`,\n * `AFTER_PRINT`). Every selector is qualified with `markerSelector` (the\n * static-replica marker attribute), so the rules can only ever match a\n * replica: embedding the export into a live page via the documented\n * innerHTML/setHTMLUnsafe flow cannot restyle the consumer's document, hide\n * its live editors, or force them light. (`@scope` cannot express this: its\n * implicit `:where(:scope)` descendant prefix excludes the scoping root\n * itself, and shadow content — every `::part()` subject — is outside the\n * scope.) Page-level rules (`html`/`body` reset, `body` typography, `@page`,\n * `:root` tokens, the customCSS document copies) are not emitted here; they\n * ship in the script-gated standalone style bundle and otherwise apply in the\n * `print()` iframe. Instead the typography and background snapshot is emitted\n * `!important` after the host reset in the same layer, so the replica paints\n * its own canvas even without scripts.\n */\nexport function buildExportDocumentCSS(\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\toptions: PrintOptions,\n\tmarkerAttribute: string,\n): string {\n\tconst markedSelector: string = `${host.tagName.toLowerCase()}[${markerAttribute}]`;\n\tconst forceLightTheme: boolean = options.forceLightTheme !== false;\n\n\tconst guards: string[] = [generateHostResetCSS(markedSelector)];\n\tif (forceLightTheme) {\n\t\t// No `:root` copy here: `!important` tokens on the embedding page's root\n\t\t// would force every live editor light (they beat the shadow `:host`\n\t\t// theme sheet). The `:root` copy for page-level customCSS var() support\n\t\t// lives in the standalone bundle.\n\t\tguards.push(generateLightThemeTokens(markedSelector));\n\t}\n\tif (options.printBackground !== false) {\n\t\tguards.push(\n\t\t\t`${markedSelector}, ${markedSelector} * {\\n -webkit-print-color-adjust: exact !important;\\n print-color-adjust: exact !important;\\n}`,\n\t\t);\n\t}\n\tconst colorOverride: string | undefined = forceLightTheme\n\t\t? LIGHT_THEME.primitives.foreground\n\t\t: undefined;\n\tconst background: string = forceLightTheme ? '#ffffff' : resolveCarriedBackground(container);\n\t// Emitted after the host reset in the same layer: the source-order tie\n\t// lets the snapshot's background beat the reset's `background: transparent`.\n\tguards.push(\n\t\tmarkDeclarationsImportant(snapshotTypography(host, colorOverride, background, markedSelector)),\n\t);\n\n\tconst parts: string[] = [`@layer ${PRINT_STYLE_LAYER} {\\n${guards.join('\\n\\n')}\\n}`];\n\n\tif (!forceLightTheme) {\n\t\tconst themeTokens: string = snapshotThemeTokens(host, markedSelector);\n\t\tif (themeTokens) parts.push(themeTokens);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n","/**\n * PrintService implementation.\n *\n * Builds a print document that preserves the editor's shadow boundary via\n * declarative shadow DOM: the host page's stylesheets are copied verbatim\n * (layered), the editor's own styles live inside the shadow template, and the\n * cloned content keeps its `part` attributes. Host `::part()` rules,\n * specificity, custom properties, and conditional rules therefore behave\n * exactly as in the live editor — nothing is translated or re-emulated.\n *\n * Two document variants are built from the same inputs:\n *\n * - The export variant (returned by `toHTML()`, broadcast via `AFTER_PRINT`)\n * is embed-safe: its inline document-level CSS is qualified with the static\n * replica marker, while everything page-level (host-CSS copy, hoisted\n * `@import`s, `html`/`body`/`@page` rules) ships inside an inert\n * `<template>` bundle that the fallback script activates only when the\n * export is rendered as its own document — so injecting the output into a\n * live page (documented innerHTML/setHTMLUnsafe flow) cannot restyle or\n * break the consumer's document. It carries a static light-DOM fallback for\n * parsers without declarative shadow DOM, and never carries the page's CSP\n * nonce, which is a secret that must not be persisted into serialized HTML.\n * - The internal variant (written into the transient print iframe) inlines\n * the full page-fidelity CSS (`html`/`body` reset, body typography,\n * `@page`, unscoped host-CSS copy, hoisted imports) and carries the style\n * nonce so it renders under the inherited CSP. It omits fallback, bundle,\n * and script: the iframe is parsed by the same modern browser, where DSD is\n * guaranteed.\n */\n\nimport { escapeAttr, escapeHTML } from '../../model/HTMLUtils.js';\nimport { getStyleNonceForNode, setStyleText } from '../../style/StyleRuntime.js';\nimport type { PluginEventBus } from '../Plugin.js';\nimport { prepare } from './PrintContentPreparer.js';\nimport {\n\ttype PrintDestinationProjection,\n\tnamespacePrintFallbackTargets,\n\tprojectPrintDestinations,\n} from './PrintDestinationBridge.js';\nimport {\n\tHOST_STYLE_LAYER,\n\ttype HostStyleSegment,\n\tcollectHostStyleSegments,\n} from './PrintHostStyles.js';\nimport {\n\tCUSTOM_STYLE_LAYER,\n\tPRINT_STYLE_LAYER,\n\tbuildDocumentCSS,\n\tbuildExportDocumentCSS,\n\tbuildShadowCSS,\n\tcollectInlineThemeTokens,\n} from './PrintStyleCollector.js';\nimport {\n\tAFTER_PRINT,\n\ttype AfterPrintEvent,\n\tBEFORE_PRINT,\n\ttype BeforePrintEvent,\n\ttype PrintOptions,\n\ttype PrintService,\n} from './PrintTypes.js';\nimport { STATIC_HOST_ATTRIBUTE } from './StaticHostMarker.js';\n\n/**\n * Upper bound for waiting on the print iframe's load event. Referenced host\n * stylesheets (hoisted cross-origin `@import`) load asynchronously and are\n * worth a short wait so the first printed paint is styled, but a hanging\n * stylesheet must never block the print dialog indefinitely.\n */\nconst PRINT_LOAD_TIMEOUT_MS = 4000;\n\n/** Marker attribute on the static light-DOM fallback of the export variant. */\nexport const PRINT_FALLBACK_ATTRIBUTE = 'data-notectl-print-fallback';\n\n/**\n * Marker attribute on the inert `<template>` carrying the export variant's\n * standalone style bundle (page-level CSS and the verbatim host-CSS copy).\n */\nexport const PRINT_STYLE_BUNDLE_ATTRIBUTE = 'data-notectl-print-styles';\n\n/**\n * `<meta name>` marking the export document itself. The fallback script only\n * activates the standalone style bundle when this meta sits in\n * `document.head` — true when the export is the document being rendered\n * (file, iframe `srcdoc`, `document.write`, HTML-to-PDF engines), never when\n * it was inlined into a consumer page (fragment parsing keeps the meta inside\n * the injected subtree, outside `document.head`).\n */\nexport const PRINT_EXPORT_META_NAME = 'notectl-print-export';\n\n/**\n * Fallback for consumers that render the export variant with a parser that\n * does not attach declarative shadow roots but does execute scripts (older\n * WebViews, headless HTML-to-PDF engines). When the export is the document\n * itself (its marker meta sits in `document.head`), the inert standalone\n * style bundle (page-level CSS, verbatim host-CSS copy, hoisted imports) is\n * moved into the head, restoring full page fidelity; inlined into a consumer\n * page the meta never reaches the head, so the bundle stays inert and cannot\n * restyle the page. The shadow-attach step is strictly scoped to marked\n * replicas: only a `template[shadowrootmode]` that is a direct child of a\n * `[data-notectl-static]` host is attached — a document-wide sweep would\n * consume declarative templates belonging to the consumer's own components\n * when the export is inlined into a live page. Once a shadow root exists the\n * static light-DOM fallback is removed so extracted text is not doubled;\n * engines without Shadow DOM keep the rendered fallback. Native DSD parsing\n * leaves no template behind, making the attach branch a no-op. Kept ES5-safe\n * for legacy engines; must not contain a literal `</`. Deliberately emitted\n * without a nonce: the export variant never embeds the page's CSP secrets,\n * and if a consumer's CSP blocks the script the static fallback still\n * renders.\n */\nconst DSD_FALLBACK_SCRIPT: string = [\n\t'(function () {',\n\t' var head = document.head;',\n\t' if (head && head.querySelector(\\'meta[name=\"notectl-print-export\"]\\')) {',\n\t\" var bundles = document.querySelectorAll('template[data-notectl-print-styles]');\",\n\t' for (var b = 0; b < bundles.length; b++) {',\n\t' if (bundles[b].content) head.appendChild(bundles[b].content);',\n\t' bundles[b].parentNode.removeChild(bundles[b]);',\n\t' }',\n\t' }',\n\t\" var statics = document.querySelectorAll('[data-notectl-static]');\",\n\t' for (var i = 0; i < statics.length; i++) {',\n\t' var host = statics[i];',\n\t' if (!host.shadowRoot && host.attachShadow) {',\n\t' for (var j = 0; j < host.children.length; j++) {',\n\t' var child = host.children[j];',\n\t\" if (child.tagName !== 'TEMPLATE') continue;\",\n\t\" if (!child.getAttribute('shadowrootmode') || !child.content) continue;\",\n\t\" host.attachShadow({ mode: 'open' }).appendChild(child.content);\",\n\t' host.removeChild(child);',\n\t' break;',\n\t' }',\n\t' }',\n\t' if (!host.shadowRoot) continue;',\n\t\" var fallbacks = host.querySelectorAll('[data-notectl-print-fallback]');\",\n\t' for (var k = 0; k < fallbacks.length; k++) {',\n\t' fallbacks[k].parentNode.removeChild(fallbacks[k]);',\n\t' }',\n\t' }',\n\t'})();',\n].join('\\n');\n\n/**\n * Escapes `</` in CSS embedded into a `<style>` element. The HTML parser ends\n * the element at any literal `</style`, even inside a CSS string such as\n * `content: \"</style>\"`, which would break the print document. `\\/` is a\n * valid CSS escape for `/`, so the stylesheet semantics are unchanged.\n */\nfunction escapeStyleText(css: string): string {\n\treturn css.replace(/<\\//g, '<\\\\/');\n}\n\n/** Serializes an element's attributes matched by `include`, with a leading space. */\nfunction serializeFilteredAttributes(el: Element, include: (name: string) => boolean): string {\n\tconst parts: string[] = [];\n\tfor (const attribute of Array.from(el.attributes)) {\n\t\tif (!include(attribute.name)) continue;\n\t\tparts.push(\n\t\t\tattribute.value === ''\n\t\t\t\t? attribute.name\n\t\t\t\t: `${attribute.name}=\"${escapeAttr(attribute.value)}\"`,\n\t\t);\n\t}\n\treturn parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\n/**\n * Serializes an element's attributes for the print document. The `style`\n * attribute is stripped from the host element: element-attached declarations\n * would beat every stylesheet rule, defeating the print host reset.\n */\nfunction serializeAttributes(el: Element, skip: readonly string[]): string {\n\treturn serializeFilteredAttributes(el, (name: string): boolean => !skip.includes(name));\n}\n\n/**\n * Serializes theme-context attributes (`class` and `data-*`) so selectors\n * like `html.dark notectl-editor::part(x)` keep matching when the live theme\n * is carried into print (`forceLightTheme: false`).\n */\nfunction serializeThemeContextAttributes(el: Element | null): string {\n\tif (!el) return '';\n\treturn serializeFilteredAttributes(\n\t\tel,\n\t\t(name: string): boolean => name === 'class' || name.startsWith('data-'),\n\t);\n}\n\n/**\n * Serializes an element's inline `--notectl-*` tokens as a `style` attribute\n * (empty string when the element carries none). Used when the live theme is\n * carried: inline tokens beat every copied stylesheet rule, exactly as live.\n */\nfunction serializeInlineTokenStyle(el: Element | null): string {\n\tconst declarations: string = collectInlineThemeTokens(el);\n\treturn declarations ? ` style=\"${escapeAttr(declarations)}\"` : '';\n}\n\n/** Everything needed to assemble the print document. */\nexport interface PrintDocumentInput {\n\t/**\n\t * Document-level CSS matching the variant: full page fidelity for\n\t * `internal` ({@link buildDocumentCSS}), marker-qualified inline baseline\n\t * for `export` ({@link buildExportDocumentCSS}).\n\t */\n\treadonly documentCSS: string;\n\t/**\n\t * Full-fidelity page CSS ({@link buildDocumentCSS}) shipped by the export\n\t * variant inside the inert standalone style bundle; the fallback script\n\t * activates it only when the export is rendered as its own document.\n\t */\n\treadonly standaloneCSS: string;\n\t/** Source-ordered host-page CSS copy (rule chunks and hoisted `@import`s). */\n\treadonly hostSegments: readonly HostStyleSegment[];\n\t/** CSS placed inside the declarative shadow root. */\n\treadonly shadowCSS: string;\n\t/** The live editor host element; its tag and attributes are replicated. */\n\treadonly host: HTMLElement;\n\t/** Serialized print content projected into the declarative shadow root. */\n\treadonly contentHTML: string;\n\t/** Unmodified prepared content used by the export's no-DSD light-DOM fallback. */\n\treadonly fallbackContentHTML: string;\n\t/** Slotted document-tree markers for fragment navigation and PDF destinations. */\n\treadonly destinationMarkersHTML: string;\n\treadonly title: string;\n\treadonly lang: string;\n\t/** Copy html/body theme-context attributes (only when the live theme is carried). */\n\treadonly carryThemeContext: boolean;\n\t/**\n\t * `export` (`toHTML()`, `AFTER_PRINT`) is embed-safe: its inline styles are\n\t * marker-qualified, and everything page-level — the host-CSS copy, hoisted\n\t * `@import`s, and `standaloneCSS` — ships inside an inert `<template>`\n\t * bundle that the replica-scoped fallback script activates only when the\n\t * export is rendered as its own document. A consumer page embedding the\n\t * output can neither load foreign stylesheets nor have its own elements\n\t * restyled. `internal` (the transient print iframe) inlines the unscoped\n\t * copy and the imports directly and omits fallback, bundle, and script: the\n\t * iframe is parsed by the same modern browser, where declarative shadow DOM\n\t * is guaranteed.\n\t */\n\treadonly variant: 'export' | 'internal';\n\t/**\n\t * CSP nonce applied to every embedded `<style>` element so the internal\n\t * print iframe renders under an inherited `style-src` nonce policy. Never\n\t * set on the export variant: serialized HTML must not persist the page's\n\t * live nonce.\n\t */\n\treadonly styleNonce?: string;\n}\n\n/** Builds the complete print document as an HTML string. */\nexport function buildHTMLDocument(input: PrintDocumentInput): string {\n\tconst doc: Document = input.host.ownerDocument;\n\tconst hostTag: string = input.host.tagName.toLowerCase();\n\tconst isExport: boolean = input.variant === 'export';\n\t// The static marker keeps the replica from booting a live editor when the\n\t// document is injected into a page where the component is registered. The\n\t// export variant also drops the id: embedded next to the live editor it\n\t// would be a duplicate, and getElementById would resolve to the replica.\n\t// The internal iframe is its own document, so it keeps the id and host\n\t// rules like `#editor::part(cell)` stay matching.\n\tconst skippedHostAttributes: readonly string[] = isExport\n\t\t? ['style', 'id', STATIC_HOST_ATTRIBUTE]\n\t\t: ['style', STATIC_HOST_ATTRIBUTE];\n\tconst hostAttributes: string = serializeAttributes(input.host, skippedHostAttributes);\n\tconst hostTokens: string = input.carryThemeContext ? serializeInlineTokenStyle(input.host) : '';\n\n\tconst htmlContext: string = input.carryThemeContext\n\t\t? serializeThemeContextAttributes(doc.documentElement) +\n\t\t\tserializeInlineTokenStyle(doc.documentElement)\n\t\t: '';\n\tconst bodyContext: string = input.carryThemeContext\n\t\t? serializeThemeContextAttributes(doc.body) + serializeInlineTokenStyle(doc.body)\n\t\t: '';\n\n\tconst nonceAttribute: string = input.styleNonce ? ` nonce=\"${escapeAttr(input.styleNonce)}\"` : '';\n\tconst head: string[] = ['<meta charset=\"utf-8\">', `<title>${escapeHTML(input.title)}</title>`];\n\tif (isExport) {\n\t\t// Standalone marker: only reachable inside document.head when this\n\t\t// export IS the rendered document (see PRINT_EXPORT_META_NAME).\n\t\thead.push(`<meta name=\"${PRINT_EXPORT_META_NAME}\">`);\n\t}\n\t// The layer-order statement must be the document's first style rule: layer\n\t// order is fixed by first appearance, and for `!important` declarations\n\t// earlier layers win — customCSS > print guards > host copy. It stays\n\t// inline even in the export variant; on an embedding page it merely pins\n\t// the relative order of these notectl-prefixed layers, which only ever\n\t// hold marker-qualified rules there.\n\thead.push(\n\t\t`<style${nonceAttribute}>@layer ${CUSTOM_STYLE_LAYER}, ${PRINT_STYLE_LAYER}, ${HOST_STYLE_LAYER};</style>`,\n\t);\n\thead.push(`<style${nonceAttribute}>${escapeStyleText(input.documentCSS)}</style>`);\n\t// One `<style>` per segment: `@import` must precede every other rule of its\n\t// stylesheet, so interleaving imports and rule chunks as separate elements\n\t// is the only way to keep the live source order — which decides\n\t// equal-specificity cascade ties inside the `notectl-host` layer. The\n\t// export variant ships all segments (and the page-level standaloneCSS)\n\t// inside the inert style bundle instead: copied host selectors and hoisted\n\t// imports must never act on a page that merely embeds the export.\n\tconst segmentStyles: string[] = input.hostSegments.map((segment: HostStyleSegment): string => {\n\t\tconst css: string =\n\t\t\tsegment.kind === 'import'\n\t\t\t\t? segment.statement\n\t\t\t\t: `@layer ${HOST_STYLE_LAYER} {\\n${segment.css}\\n}`;\n\t\treturn `<style${nonceAttribute}>${escapeStyleText(css)}</style>`;\n\t});\n\tif (!isExport) head.push(...segmentStyles);\n\n\tconst styleBundle: string = isExport\n\t\t? `<template ${PRINT_STYLE_BUNDLE_ATTRIBUTE}><style>${escapeStyleText(input.standaloneCSS)}</style>${segmentStyles.join('')}</template>`\n\t\t: '';\n\n\t// The static fallback renders only when no shadow root is attached (a\n\t// shadow host's unslotted light DOM is never rendered): consumers that\n\t// inject via innerHTML — no DSD parsing, no script execution — get\n\t// readable, statically styled output instead of a blank page. Its style\n\t// copy is wrapped in @scope: a <style> element applies document-wide even\n\t// while its subtree is not rendered, and without the scope the shadow CSS\n\t// (including customCSS body rules) would leak onto a consumer page that\n\t// embeds this document via setHTMLUnsafe. Engines without @scope drop the\n\t// block and render the fallback unstyled but readable.\n\tconst fallback: string = isExport\n\t\t? `<div ${PRINT_FALLBACK_ATTRIBUTE}><style>@scope ([${PRINT_FALLBACK_ATTRIBUTE}]) {\\n${escapeStyleText(input.shadowCSS)}\\n}</style>${input.fallbackContentHTML}</div>`\n\t\t: '';\n\tconst fallbackScript: string = isExport ? `<script>${DSD_FALLBACK_SCRIPT}</script>` : '';\n\n\tconst body: string[] = [\n\t\t`<${hostTag}${hostAttributes}${hostTokens} ${STATIC_HOST_ATTRIBUTE}>`,\n\t\t'<template shadowrootmode=\"open\">',\n\t\t`<style${nonceAttribute}>${escapeStyleText(input.shadowCSS)}</style>`,\n\t\tinput.contentHTML,\n\t\t'</template>',\n\t\t...(fallback ? [fallback] : []),\n\t\t...(input.destinationMarkersHTML ? [input.destinationMarkersHTML] : []),\n\t\t`</${hostTag}>`,\n\t\t...(styleBundle ? [styleBundle] : []),\n\t\t...(fallbackScript ? [fallbackScript] : []),\n\t];\n\n\treturn [\n\t\t'<!DOCTYPE html>',\n\t\t`<html lang=\"${escapeAttr(input.lang)}\"${htmlContext}>`,\n\t\t'<head>',\n\t\t...head,\n\t\t'</head>',\n\t\t`<body${bodyContext}>`,\n\t\t...body,\n\t\t'</body>',\n\t\t'</html>',\n\t].join('\\n');\n}\n\n/** PrintService plus internal lifecycle hooks (not part of the public service API). */\nexport interface ManagedPrintService extends PrintService {\n\t/** Cancels pending print triggers and removes parked print iframes. */\n\tdispose(): void;\n}\n\n/** Creates and returns the PrintService implementation. */\nexport function createPrintService(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\teventBus: PluginEventBus,\n): ManagedPrintService {\n\t/** Cancel callbacks for prints still waiting on their iframe's load event. */\n\tconst pendingPrints = new Set<() => void>();\n\n\tfunction mergeOptions(options?: PrintOptions): PrintOptions {\n\t\treturn options ?? {};\n\t}\n\n\t/** The export document plus the inputs to rebuild the internal variant. */\n\tinterface PrintDocumentBuild {\n\t\treadonly html: string;\n\t\treadonly input: PrintDocumentInput;\n\t}\n\n\tfunction executePrint(options: PrintOptions): PrintDocumentBuild | null {\n\t\t// 1. Emit BEFORE_PRINT — listeners can mutate options or cancel\n\t\tconst beforeEvent: BeforePrintEvent = {\n\t\t\toptions,\n\t\t\tcancelled: false,\n\t\t};\n\t\teventBus.emit(BEFORE_PRINT, beforeEvent);\n\n\t\tif (beforeEvent.cancelled) return null;\n\n\t\tconst finalOptions: PrintOptions = beforeEvent.options;\n\n\t\t// 2. Collect styles for both scopes\n\t\tconst shadowCSS: string = buildShadowCSS(shadowRoot, finalOptions);\n\t\tconst hostSegments: readonly HostStyleSegment[] = collectHostStyleSegments(host);\n\n\t\t// 3. Prepare content\n\t\tconst clone: HTMLElement = prepare(container, finalOptions);\n\t\tconst fallbackClone: HTMLElement = clone.cloneNode(true) as HTMLElement;\n\t\tnamespacePrintFallbackTargets(fallbackClone);\n\t\tconst fallbackContentHTML: string = fallbackClone.outerHTML;\n\t\tconst projection: PrintDestinationProjection = projectPrintDestinations(clone);\n\t\tconst contentHTML: string = clone.outerHTML;\n\t\tconst destinationMarkersHTML: string = projection.markers\n\t\t\t.map((marker: HTMLAnchorElement): string => marker.outerHTML)\n\t\t\t.join('');\n\n\t\t// 4. Build the export document (no nonce — serialized output must not\n\t\t// persist the page's CSP secret; inline document CSS marker-qualified,\n\t\t// page-level CSS in the inert standalone bundle — embedding the output\n\t\t// must not restyle the consumer's page)\n\t\tconst title: string = finalOptions.title ?? '';\n\t\tconst ownerDocument: Document = host.ownerDocument;\n\t\tconst lang: string =\n\t\t\thost.closest('[lang]')?.getAttribute('lang') ?? (ownerDocument.documentElement.lang || 'en');\n\t\tconst input: PrintDocumentInput = {\n\t\t\tdocumentCSS: buildExportDocumentCSS(host, container, finalOptions, STATIC_HOST_ATTRIBUTE),\n\t\t\tstandaloneCSS: buildDocumentCSS(host, container, finalOptions),\n\t\t\thostSegments,\n\t\t\tshadowCSS,\n\t\t\thost,\n\t\t\tcontentHTML,\n\t\t\tfallbackContentHTML,\n\t\t\tdestinationMarkersHTML,\n\t\t\ttitle,\n\t\t\tlang,\n\t\t\tcarryThemeContext: finalOptions.forceLightTheme === false,\n\t\t\tvariant: 'export',\n\t\t};\n\t\tconst html: string = buildHTMLDocument(input);\n\n\t\t// 5. Emit AFTER_PRINT\n\t\tconst afterEvent: AfterPrintEvent = { html };\n\t\teventBus.emit(AFTER_PRINT, afterEvent);\n\n\t\treturn { html, input };\n\t}\n\n\treturn {\n\t\tprint(options?: PrintOptions): void {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\tconst build: PrintDocumentBuild | null = executePrint(resolved);\n\t\t\tif (!build) return;\n\n\t\t\t// The iframe is parsed by the same browser, so the fallback is dead\n\t\t\t// weight there; the nonce keeps the styles alive under a CSP\n\t\t\t// inherited by the about:blank iframe. The internal variant inlines\n\t\t\t// the full-fidelity page CSS (html/body reset, body typography,\n\t\t\t// @page) that the embed-safe export ships only in its inert bundle.\n\t\t\tconst printHTML: string = buildHTMLDocument({\n\t\t\t\t...build.input,\n\t\t\t\tdocumentCSS: build.input.standaloneCSS,\n\t\t\t\tvariant: 'internal',\n\t\t\t\tstyleNonce: getStyleNonceForNode(container),\n\t\t\t});\n\n\t\t\t// Create hidden iframe\n\t\t\tconst iframe: HTMLIFrameElement = document.createElement('iframe');\n\t\t\tsetStyleText(iframe, 'position:fixed;left:-9999px;width:0;height:0;border:none');\n\t\t\tdocument.body.appendChild(iframe);\n\n\t\t\tconst iframeDoc: Document | null = iframe.contentDocument;\n\t\t\tconst iframeWindow: Window | null = iframe.contentWindow;\n\t\t\tif (!iframeDoc || !iframeWindow) {\n\t\t\t\tdocument.body.removeChild(iframe);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tiframeDoc.open();\n\t\t\tiframeDoc.write(printHTML);\n\t\t\tiframeDoc.close();\n\n\t\t\tconst cleanup = (): void => {\n\t\t\t\tiframe.remove();\n\t\t\t};\n\n\t\t\tconst triggerPrint = (): void => {\n\t\t\t\tiframeWindow.addEventListener('afterprint', cleanup, { once: true });\n\t\t\t\tiframeWindow.print();\n\t\t\t};\n\n\t\t\t// Referenced host stylesheets (cross-origin @import) load\n\t\t\t// asynchronously; wait for them so the first paint printed is styled.\n\t\t\t// A hanging stylesheet must not block the dialog forever, so the wait\n\t\t\t// is bounded — on timeout, printing proceeds with the styles loaded\n\t\t\t// so far. The pending trigger is cancellable: after the editor is\n\t\t\t// destroyed the dialog must not pop up over an unrelated view.\n\t\t\tif (iframeDoc.readyState === 'complete') {\n\t\t\t\ttriggerPrint();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet triggered = false;\n\t\t\tconst triggerOnce = (): void => {\n\t\t\t\tif (triggered) return;\n\t\t\t\ttriggered = true;\n\t\t\t\tpendingPrints.delete(cancelPending);\n\t\t\t\twindow.clearTimeout(timeoutId);\n\t\t\t\ttriggerPrint();\n\t\t\t};\n\t\t\tconst cancelPending = (): void => {\n\t\t\t\ttriggered = true;\n\t\t\t\twindow.clearTimeout(timeoutId);\n\t\t\t\tiframeWindow.removeEventListener('load', triggerOnce);\n\t\t\t\tiframe.remove();\n\t\t\t};\n\t\t\tconst timeoutId: number = window.setTimeout(triggerOnce, PRINT_LOAD_TIMEOUT_MS);\n\t\t\tpendingPrints.add(cancelPending);\n\t\t\tiframeWindow.addEventListener('load', triggerOnce, { once: true });\n\t\t},\n\n\t\ttoHTML(options?: PrintOptions): string {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\treturn executePrint(resolved)?.html ?? '';\n\t\t},\n\n\t\tdispose(): void {\n\t\t\tfor (const cancel of pendingPrints) {\n\t\t\t\tcancel();\n\t\t\t}\n\t\t\tpendingPrints.clear();\n\t\t},\n\t};\n}\n","/**\n * PrintPlugin: provides print functionality for the notectl editor.\n * Registers a command, keymap, toolbar item, and exposes a PrintService.\n * Orchestrator only — delegates all logic to PrintServiceImpl, PrintStyleCollector,\n * and PrintContentPreparer.\n */\n\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { PRINT_LOCALE_EN, type PrintLocale, loadPrintLocale } from './PrintLocale.js';\nimport { type ManagedPrintService, createPrintService } from './PrintServiceImpl.js';\nimport type { PrintOptions, PrintPluginConfig, PrintService } from './PrintTypes.js';\nimport { PRINT_SERVICE_KEY } from './PrintTypes.js';\n\nconst PRINT_ICON: string =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">' +\n\t'<path d=\"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3' +\n\t' 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z\"/>' +\n\t'</svg>';\n\n/** No-op fallback service for environments without ShadowRoot. */\nconst NOOP_SERVICE: ManagedPrintService = {\n\tprint(): void {},\n\ttoHTML(): string {\n\t\treturn '';\n\t},\n\tdispose(): void {},\n};\n\nexport class PrintPlugin implements Plugin {\n\treadonly id = 'print';\n\treadonly name = 'Print';\n\n\tprivate readonly config: PrintPluginConfig;\n\tprivate service: ManagedPrintService | null = null;\n\tprivate locale!: PrintLocale;\n\n\tconstructor(config?: PrintPluginConfig) {\n\t\tthis.config = config ?? {};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tPRINT_LOCALE_EN,\n\t\t\tloadPrintLocale,\n\t\t);\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tconst rootNode: Node = container.getRootNode();\n\n\t\tif (rootNode instanceof ShadowRoot) {\n\t\t\tconst host: HTMLElement = rootNode.host as HTMLElement;\n\t\t\tconst eventBus = context.getEventBus();\n\t\t\tthis.service = createPrintService(rootNode, host, container, eventBus);\n\t\t} else {\n\t\t\tthis.service = NOOP_SERVICE;\n\t\t}\n\n\t\tcontext.registerService(PRINT_SERVICE_KEY, this.service);\n\n\t\tconst defaults: PrintOptions = this.config.defaults ?? {};\n\t\tconst service: PrintService = this.service;\n\n\t\tconst printLocale = this.locale;\n\t\tcontext.registerCommand('print', () => {\n\t\t\tcontext.announce(printLocale.printingAnnouncement);\n\t\t\tservice.print(defaults);\n\t\t\treturn true;\n\t\t});\n\n\t\tconst keyBinding: string = this.config.keyBinding ?? 'Mod-P';\n\t\tcontext.registerKeymap({\n\t\t\t[keyBinding]: () => {\n\t\t\t\tcontext.executeCommand('print');\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\n\t\tif (this.config.showToolbarItem !== false) {\n\t\t\tconst shortcut: string = formatShortcut(keyBinding);\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: 'print',\n\t\t\t\tgroup: 'actions',\n\t\t\t\tlabel: this.locale.label,\n\t\t\t\ttooltip: this.locale.tooltip(shortcut),\n\t\t\t\ticon: PRINT_ICON,\n\t\t\t\tcommand: 'print',\n\t\t\t});\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\t// A print still waiting on its iframe's load event must not pop the\n\t\t// dialog after the editor is gone (e.g. after an SPA navigation).\n\t\tthis.service?.dispose();\n\t\tthis.service = null;\n\t}\n}\n"],"mappings":"8WAcA,IAAa,EAA+B,CAC3C,MAAO,QACP,QAAU,GAAqB,UAAU,KACzC,qBAAsB,YAKjB,iBAA8C,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IA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zB,EAAQ,gBAAgB,QAAA,KACvB,EAAQ,SAAS,EAAY,sBAC7B,EAAQ,MAAM,IACP,IAGR,MAAM,EAAqB,KAAK,OAAO,YAAc,QAQrD,GAPA,EAAQ,eAAe,CAAA,CACrB,GAAA,KACA,EAAQ,eAAe,UAChB,MAI2B,IAAhC,KAAK,OAAO,gBAA2B,CAC1C,MAAM,EAAmB,EAAe,GACxC,EAAQ,oBAAoB,CAC3B,GAAI,QACJ,MAAO,UACP,MAAO,KAAK,OAAO,MACnB,QAAS,KAAK,OAAO,QAAQ,GAC7B,KAvEH,sPAwEG,QAAS,SAEX,CACD,CAEA,OAAA,GAGC,KAAK,SAAS,UACd,KAAK,QAAU,IAChB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=class{_nodeSpecs=/* @__PURE__ */new Map;_markSpecs=/* @__PURE__ */new Map;_inlineNodeSpecs=/* @__PURE__ */new Map;registerNodeSpec(e){if(this._nodeSpecs.has(e.type))throw new Error(`NodeSpec for type "${e.type}" is already registered.`);this._nodeSpecs.set(e.type,e)}getNodeSpec(e){return this._nodeSpecs.get(e)}removeNodeSpec(e){this._nodeSpecs.delete(e)}getNodeTypes(){return[...this._nodeSpecs.keys()]}registerMarkSpec(e){if(this._markSpecs.has(e.type))throw new Error(`MarkSpec for type "${e.type}" is already registered.`);this._markSpecs.set(e.type,e)}getMarkSpec(e){return this._markSpecs.get(e)}removeMarkSpec(e){this._markSpecs.delete(e)}getMarkTypes(){return[...this._markSpecs.keys()]}registerInlineNodeSpec(e){if(this._inlineNodeSpecs.has(e.type))throw new Error(`InlineNodeSpec for type "${e.type}" is already registered.`);this._inlineNodeSpecs.set(e.type,e)}getInlineNodeSpec(e){return this._inlineNodeSpecs.get(e)}removeInlineNodeSpec(e){this._inlineNodeSpecs.delete(e)}getInlineNodeTypes(){return[...this._inlineNodeSpecs.keys()]}getBlockParseRules(){return this.collectParseRules(this._nodeSpecs)}getInlineParseRules(){return this.collectParseRules(this._inlineNodeSpecs)}getMarkParseRules(){return this.collectParseRules(this._markSpecs)}getAllowedTags(){return[...this.collectSanitizeValues(new Set(["p","br","div","span"]),e=>e.sanitize?.tags)]}getAllowedAttrs(){return[...this.collectSanitizeValues(new Set(["style","dir","id"]),e=>e.sanitize?.attrs)]}collectParseRules(e){const s=[];for(const[t,r]of e)if(r.parseHTML)for(const e of r.parseHTML)s.push({rule:e,type:t});return s.sort((e,s)=>(s.rule.priority??50)-(e.rule.priority??50))}collectSanitizeValues(e,s){const t=[this._nodeSpecs,this._inlineNodeSpecs,this._markSpecs];for(const r of t)for(const t of r.values()){const r=s(t);if(r)for(const s of r)e.add(s)}return e}clear(){this._nodeSpecs.clear(),this._markSpecs.clear(),this._inlineNodeSpecs.clear()}};export{e as t};
|
|
2
|
-
//# sourceMappingURL=SchemaRegistry-CkBN-1yW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaRegistry-CkBN-1yW.mjs","names":[],"sources":["../../src/model/SchemaRegistry.ts"],"sourcesContent":["/**\n * SchemaRegistry: central registry for node specs, mark specs,\n * and inline node specs registered by plugins.\n *\n * Model-only — no imports from input/, plugins/, or view/ layers.\n */\n\nimport type { InlineNodeSpec } from './InlineNodeSpec.js';\nimport type { MarkSpec } from './MarkSpec.js';\nimport type { NodeSpec } from './NodeSpec.js';\nimport type { ParseRule } from './ParseRule.js';\n\n/** Priority assigned to parse rules that do not declare an explicit `priority`. */\nconst DEFAULT_PARSE_PRIORITY = 50;\n\nexport class SchemaRegistry {\n\tprivate readonly _nodeSpecs = new Map<string, NodeSpec>();\n\tprivate readonly _markSpecs = new Map<string, MarkSpec>();\n\tprivate readonly _inlineNodeSpecs = new Map<string, InlineNodeSpec>();\n\n\t// --- NodeSpec ---\n\n\tregisterNodeSpec<T extends string>(spec: NodeSpec<T>): void {\n\t\tif (this._nodeSpecs.has(spec.type)) {\n\t\t\tthrow new Error(`NodeSpec for type \"${spec.type}\" is already registered.`);\n\t\t}\n\t\tthis._nodeSpecs.set(spec.type, spec);\n\t}\n\n\tgetNodeSpec(type: string): NodeSpec | undefined {\n\t\treturn this._nodeSpecs.get(type);\n\t}\n\n\tremoveNodeSpec(type: string): void {\n\t\tthis._nodeSpecs.delete(type);\n\t}\n\n\tgetNodeTypes(): string[] {\n\t\treturn [...this._nodeSpecs.keys()];\n\t}\n\n\t// --- MarkSpec ---\n\n\tregisterMarkSpec<T extends string>(spec: MarkSpec<T>): void {\n\t\tif (this._markSpecs.has(spec.type)) {\n\t\t\tthrow new Error(`MarkSpec for type \"${spec.type}\" is already registered.`);\n\t\t}\n\t\tthis._markSpecs.set(spec.type, spec);\n\t}\n\n\tgetMarkSpec(type: string): MarkSpec | undefined {\n\t\treturn this._markSpecs.get(type);\n\t}\n\n\tremoveMarkSpec(type: string): void {\n\t\tthis._markSpecs.delete(type);\n\t}\n\n\tgetMarkTypes(): string[] {\n\t\treturn [...this._markSpecs.keys()];\n\t}\n\n\t// --- InlineNodeSpec ---\n\n\tregisterInlineNodeSpec<T extends string>(spec: InlineNodeSpec<T>): void {\n\t\tif (this._inlineNodeSpecs.has(spec.type)) {\n\t\t\tthrow new Error(`InlineNodeSpec for type \"${spec.type}\" is already registered.`);\n\t\t}\n\t\tthis._inlineNodeSpecs.set(spec.type, spec);\n\t}\n\n\tgetInlineNodeSpec(type: string): InlineNodeSpec | undefined {\n\t\treturn this._inlineNodeSpecs.get(type);\n\t}\n\n\tremoveInlineNodeSpec(type: string): void {\n\t\tthis._inlineNodeSpecs.delete(type);\n\t}\n\n\tgetInlineNodeTypes(): string[] {\n\t\treturn [...this._inlineNodeSpecs.keys()];\n\t}\n\n\t// --- Parse Rules & Sanitize Config ---\n\n\t/** Returns all NodeSpec parseHTML rules, sorted by priority descending. */\n\tgetBlockParseRules(): readonly { readonly rule: ParseRule; readonly type: string }[] {\n\t\treturn this.collectParseRules(this._nodeSpecs);\n\t}\n\n\t/** Returns all InlineNodeSpec parseHTML rules, sorted by priority descending. */\n\tgetInlineParseRules(): readonly { readonly rule: ParseRule; readonly type: string }[] {\n\t\treturn this.collectParseRules(this._inlineNodeSpecs);\n\t}\n\n\t/** Returns all MarkSpec parseHTML rules, sorted by priority descending. */\n\tgetMarkParseRules(): readonly { readonly rule: ParseRule; readonly type: string }[] {\n\t\treturn this.collectParseRules(this._markSpecs);\n\t}\n\n\t/** Returns all allowed HTML tags from base defaults + all spec sanitize configs. */\n\tgetAllowedTags(): string[] {\n\t\treturn [\n\t\t\t...this.collectSanitizeValues(\n\t\t\t\tnew Set(['p', 'br', 'div', 'span']),\n\t\t\t\t(spec) => spec.sanitize?.tags,\n\t\t\t),\n\t\t];\n\t}\n\n\t/** Returns all allowed HTML attributes from base defaults + all spec sanitize configs. */\n\tgetAllowedAttrs(): string[] {\n\t\treturn [\n\t\t\t...this.collectSanitizeValues(\n\t\t\t\tnew Set(['style', 'dir', 'id']),\n\t\t\t\t(spec) => spec.sanitize?.attrs,\n\t\t\t),\n\t\t];\n\t}\n\n\tprivate collectParseRules(\n\t\tspecs: ReadonlyMap<string, { readonly parseHTML?: readonly ParseRule[] }>,\n\t): { readonly rule: ParseRule; readonly type: string }[] {\n\t\tconst results: { readonly rule: ParseRule; readonly type: string }[] = [];\n\t\tfor (const [type, spec] of specs) {\n\t\t\tif (spec.parseHTML) {\n\t\t\t\tfor (const rule of spec.parseHTML) {\n\t\t\t\t\tresults.push({ rule, type });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results.sort(\n\t\t\t(a, b) =>\n\t\t\t\t(b.rule.priority ?? DEFAULT_PARSE_PRIORITY) - (a.rule.priority ?? DEFAULT_PARSE_PRIORITY),\n\t\t);\n\t}\n\n\tprivate collectSanitizeValues(\n\t\tinitial: Set<string>,\n\t\textractor: (spec: {\n\t\t\treadonly sanitize?: { readonly tags?: readonly string[]; readonly attrs?: readonly string[] };\n\t\t}) => readonly string[] | undefined,\n\t): Set<string> {\n\t\tconst allSpecs: ReadonlyMap<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\treadonly sanitize?: {\n\t\t\t\t\treadonly tags?: readonly string[];\n\t\t\t\t\treadonly attrs?: readonly string[];\n\t\t\t\t};\n\t\t\t}\n\t\t>[] = [this._nodeSpecs, this._inlineNodeSpecs, this._markSpecs];\n\t\tfor (const specMap of allSpecs) {\n\t\t\tfor (const spec of specMap.values()) {\n\t\t\t\tconst values: readonly string[] | undefined = extractor(spec);\n\t\t\t\tif (values) {\n\t\t\t\t\tfor (const value of values) initial.add(value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn initial;\n\t}\n\n\t// --- Bulk ---\n\n\tclear(): void {\n\t\tthis._nodeSpecs.clear();\n\t\tthis._markSpecs.clear();\n\t\tthis._inlineNodeSpecs.clear();\n\t}\n}\n"],"mappings":"AAaA,IAEa,EAAb,MACC,0BAA8B,IAAI,IAClC,0BAA8B,IAAI,IAClC,gCAAoC,IAAI,IAIxC,gBAAA,CAAmC,GAClC,GAAI,KAAK,WAAW,IAAI,EAAK,MAC5B,MAAM,IAAI,MAAM,sBAAsB,EAAK,gCAE5C,KAAK,WAAW,IAAI,EAAK,KAAM,EAChC,CAEA,WAAA,CAAY,GACX,OAAO,KAAK,WAAW,IAAI,EAC5B,CAEA,cAAA,CAAe,GACd,KAAK,WAAW,OAAO,EACxB,CAEA,YAAA,GACC,MAAO,IAAI,KAAK,WAAW,OAC5B,CAIA,gBAAA,CAAmC,GAClC,GAAI,KAAK,WAAW,IAAI,EAAK,MAC5B,MAAM,IAAI,MAAM,sBAAsB,EAAK,gCAE5C,KAAK,WAAW,IAAI,EAAK,KAAM,EAChC,CAEA,WAAA,CAAY,GACX,OAAO,KAAK,WAAW,IAAI,EAC5B,CAEA,cAAA,CAAe,GACd,KAAK,WAAW,OAAO,EACxB,CAEA,YAAA,GACC,MAAO,IAAI,KAAK,WAAW,OAC5B,CAIA,sBAAA,CAAyC,GACxC,GAAI,KAAK,iBAAiB,IAAI,EAAK,MAClC,MAAM,IAAI,MAAM,4BA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return{type:"gap",side:n,blockId:o,path:e}}function e(o){return"type"in o&&"node"===o.type}function t(o){return"type"in o&&"gap"===o.type}function a(o){return!("type"in o)}function c(o,n){return e(o)&&e(n)?o.nodeId===n.nodeId:t(o)&&t(n)?o.blockId===n.blockId&&o.side===n.side:!(!a(o)||!a(n))&&o.anchor.blockId===n.anchor.blockId&&o.anchor.offset===n.anchor.offset&&o.head.blockId===n.head.blockId&&o.head.offset===n.head.offset}function d(o,n,e){return e?{blockId:o,offset:n,path:e}:{blockId:o,offset:n}}function r(o,n){return{anchor:o,head:n}}function f(o,n){const e={blockId:o,offset:n};return{anchor:e,head:e}}function h(o){return!!a(o)&&o.anchor.blockId===o.head.blockId&&o.anchor.offset===o.head.offset}function s(o,n){return!a(o)||(o.anchor.blockId===o.head.blockId?o.anchor.offset<=o.head.offset:!n||n.indexOf(o.anchor.blockId)<=n.indexOf(o.head.blockId))}function u(o,n){return s(o,n)?{from:o.anchor,to:o.head}:{from:o.head,to:o.anchor}}export{r as a,t as c,u as d,c as f,d as i,e as l,n,h as o,o as r,s,f as t,a as u};
|
|
2
|
-
//# sourceMappingURL=Selection-HYoVFpAx.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Selection-HYoVFpAx.mjs","names":[],"sources":["../../src/model/Selection.ts"],"sourcesContent":["/**\n * Selection model for the Notectl editor.\n * A selection is defined by an anchor and head position within the document.\n */\n\nimport type { BlockId } from './TypeBrands.js';\n\nexport interface Position {\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n\t/** Path from root block to leaf block (optional, for nested structures). */\n\treadonly path?: readonly BlockId[];\n}\n\nexport interface Selection {\n\treadonly anchor: Position;\n\treadonly head: Position;\n}\n\nexport interface SelectionRange {\n\treadonly from: Position;\n\treadonly to: Position;\n}\n\n/** A selection that selects an entire node (e.g. void blocks, table selection). */\nexport interface NodeSelection {\n\treadonly type: 'node';\n\treadonly nodeId: BlockId;\n\treadonly path: readonly BlockId[];\n}\n\n/** A virtual cursor at the boundary of a void block where no native caret can exist. */\nexport interface GapCursorSelection {\n\treadonly type: 'gap';\n\treadonly side: 'before' | 'after';\n\treadonly blockId: BlockId;\n\treadonly path: readonly BlockId[];\n}\n\n/** Union type representing a text selection, node selection, or gap cursor. */\nexport type EditorSelection = Selection | NodeSelection | GapCursorSelection;\n\n/** Creates a NodeSelection for the given block. */\nexport function createNodeSelection(nodeId: BlockId, path: readonly BlockId[]): NodeSelection {\n\treturn { type: 'node', nodeId, path };\n}\n\n/** Creates a GapCursorSelection at the boundary of a void block. */\nexport function createGapCursor(\n\tblockId: BlockId,\n\tside: 'before' | 'after',\n\tpath: readonly BlockId[],\n): GapCursorSelection {\n\treturn { type: 'gap', side, blockId, path };\n}\n\n/** Type guard: returns true if the selection is a NodeSelection. */\nexport function isNodeSelection(sel: EditorSelection): sel is NodeSelection {\n\treturn 'type' in sel && sel.type === 'node';\n}\n\n/** Type guard: returns true if the selection is a GapCursorSelection. */\nexport function isGapCursor(sel: EditorSelection): sel is GapCursorSelection {\n\treturn 'type' in sel && sel.type === 'gap';\n}\n\n/** Type guard: returns true if the selection is a text Selection. */\nexport function isTextSelection(sel: EditorSelection): sel is Selection {\n\treturn !('type' in sel);\n}\n\n/** Compares two EditorSelections for equality. */\nexport function selectionsEqual(a: EditorSelection, b: EditorSelection): boolean {\n\tif (isNodeSelection(a) && isNodeSelection(b)) {\n\t\treturn a.nodeId === b.nodeId;\n\t}\n\tif (isGapCursor(a) && isGapCursor(b)) {\n\t\treturn a.blockId === b.blockId && a.side === b.side;\n\t}\n\tif (isTextSelection(a) && isTextSelection(b)) {\n\t\treturn (\n\t\t\ta.anchor.blockId === b.anchor.blockId &&\n\t\t\ta.anchor.offset === b.anchor.offset &&\n\t\t\ta.head.blockId === b.head.blockId &&\n\t\t\ta.head.offset === b.head.offset\n\t\t);\n\t}\n\treturn false;\n}\n\n/** Creates a Position, optionally with a path. */\nexport function createPosition(\n\tblockId: BlockId,\n\toffset: number,\n\tpath?: readonly BlockId[],\n): Position {\n\treturn path ? { blockId, offset, path } : { blockId, offset };\n}\n\n/** Creates a selection with distinct anchor and head. */\nexport function createSelection(anchor: Position, head: Position): Selection {\n\treturn { anchor, head };\n}\n\n/** Creates a collapsed selection (cursor) at the given position. */\nexport function createCollapsedSelection(blockId: BlockId, offset: number): Selection {\n\tconst pos: Position = { blockId, offset };\n\treturn { anchor: pos, head: pos };\n}\n\n/** Returns true if the selection is collapsed (cursor with no range). NodeSelection and GapCursor are never collapsed. */\nexport function isCollapsed(sel: EditorSelection): boolean {\n\tif (!isTextSelection(sel)) return false;\n\treturn sel.anchor.blockId === sel.head.blockId && sel.anchor.offset === sel.head.offset;\n}\n\n/**\n * Returns true if the selection direction is forward (anchor before head).\n * When anchor and head are in the same block, compares offsets.\n * Cross-block ordering uses document order (not determinable here — caller provides block order).\n * For NodeSelection, always returns true.\n */\nexport function isForward(sel: EditorSelection, blockOrder?: readonly BlockId[]): boolean {\n\tif (!isTextSelection(sel)) return true;\n\tif (sel.anchor.blockId === sel.head.blockId) {\n\t\treturn sel.anchor.offset <= sel.head.offset;\n\t}\n\tif (blockOrder) {\n\t\tconst anchorIdx = blockOrder.indexOf(sel.anchor.blockId);\n\t\tconst headIdx = blockOrder.indexOf(sel.head.blockId);\n\t\treturn anchorIdx <= headIdx;\n\t}\n\treturn true;\n}\n\n/**\n * Returns a normalized range where `from` is always before `to`.\n * Throws for NodeSelection — use isNodeSelection() guard first.\n */\nexport function selectionRange(sel: Selection, blockOrder?: readonly BlockId[]): SelectionRange {\n\tif (isForward(sel, blockOrder)) {\n\t\treturn { from: sel.anchor, to: sel.head };\n\t}\n\treturn { from: sel.head, to: sel.anchor };\n}\n"],"mappings":"AA2CA,SAAgB,EAAoB,EAAiB,GACpD,MAAO,CAAE,KAAM,OAAQ,SAAQ,OAChC,CAGA,SAAgB,EACf,EACA,EACA,GAEA,MAAO,CAAE,KAAM,MAAO,OAAM,UAAS,OACtC,CAGA,SAAgB,EAAgB,GAC/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|
1
|
-
import{i as o}from"./TypeBrands-Ch9856Gb.mjs";import{_ as m,m as r}from"./Commands-D5ND50PQ.mjs";import{n as e}from"./PluginHelpers-KDuTlmXm.mjs";function t(t,a){const i=o(a.markSpec.type);t.registerMarkSpec(a.markSpec),t.registerCommand(a.command,()=>e(t,m(t.getState(),i))),a.keyBinding&&t.registerKeymap({[a.keyBinding]:()=>t.executeCommand(a.command)}),a.toolbar&&t.registerToolbarItem({id:a.toolbar.id,group:a.toolbar.group,icon:a.toolbar.icon,label:a.toolbar.label,tooltip:a.toolbar.tooltip,command:a.command,isActive:o=>r(o,i)})}export{t};
|
|
2
|
-
//# sourceMappingURL=SimpleMark-gTQaSJcO.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as t,o as e,u as o}from"./Document-827l3P80.mjs";import{c as n,o as s,t as c,u as r}from"./Selection-HYoVFpAx.mjs";import{a as i}from"./TypeBrands-Ch9856Gb.mjs";import{a,d as l,o as d,p as u,u as h}from"./BlockInsertion-CYH2gRkY.mjs";import{t as m}from"./Commands-D5ND50PQ.mjs";import{n as g}from"./TypedKeys-CA4bfw9O.mjs";import{c as f,o as p}from"./PluginHelpers-KDuTlmXm.mjs";import{o as x}from"./xml-BsV44TrJ.mjs";import{i as k,o as C,r as b,t as j}from"./XmlSupport-DIXH5on9.mjs";var B=/\n(?:[ \t]*\n)+/;function y(t,e){return!t.detection&&!e.detection||!(!t.detection||!e.detection)&&t.detection.language===e.detection.language}function T(t,e){const o=`${t.text}\n\n${e.text}`;if(!t.detection&&!e.detection)return{text:o,detection:null};const n=t.detection,s=e.detection;return{text:o,detection:{language:n.language,formattedText:`${n.formattedText}\n\n${s.formattedText}`,confidence:Math.max(n.confidence,s.confidence)}}}var P={detectedAsCodeBlock:t=>`Pasted as ${t} code block with syntax highlighting.`,detectedMixedContent:(t,e,o)=>{const n=[];if(t>0&&n.push(`${t} paragraph${t>1?"s":""}`),e>0){const t=o.join(", ");n.push(`${e} code block${e>1?"s":""} (${t})`)}return`Pasted as ${n.join(" and ")}.`}},I=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BWOue6jG.mjs"),"./locales/de.ts":()=>import("./de-CTzAMkXC.mjs"),"./locales/es.ts":()=>import("./es-DDoqchUq.mjs"),"./locales/fr.ts":()=>import("./fr-eC0UdAPu.mjs"),"./locales/hi.ts":()=>import("./hi-DY55FuDK.mjs"),"./locales/pt.ts":()=>import("./pt-Bu7Mbz67.mjs"),"./locales/ru.ts":()=>import("./ru-DyCTlhjg.mjs"),"./locales/zh.ts":()=>import("./zh-D1HSmSOf.mjs")});async function S(t){return f(I,t,P)}var $=new g("smartPaste"),M=[C,k,b,j],v=class{id="smart-paste";name="Smart Paste";dependencies=["code-block"];config;detectors=[];context=null;locale=P;constructor(t){this.config={...t}}async init(t){this.context=t,this.locale=await p(t,this.config.locale,P,S);const e=t.getService(x);if(e){for(const t of M){const o=e.get(t.id);e.register(o?{...o,detection:t.detection}:t)}e.onRegister(t=>{t.detection&&this.detectors.push(t.detection)})}if(this.config.detectors)for(const o of this.config.detectors)this.detectors.push(o);t.registerPasteInterceptor(this.handlePaste,{name:"smart-paste",priority:50}),t.registerService($,{registerDetector:t=>{this.detectors.push(t)}})}destroy(){this.context=null,this.detectors.length=0}handlePaste=(t,e,o)=>{if(this.isCursorInCodeBlock(o))return null;const n=function(t,e){const o=t.split(B).map(t=>t.trim()).filter(t=>t.length>0);if(0===o.length)return null;let n=!1;const s=o.map(t=>{const o=function(t,e){let o=null;for(const n of e){const e=n.detect(t);e&&(null===o||e.confidence>o.confidence||e.confidence===o.confidence&&e.language<o.language)&&(o=e)}return o}(t,e);return o&&(n=!0),{text:t,detection:o}});return n?function(t){if(t.length<=1)return t;const e=[t[0]];for(let o=1;o<t.length;o++){const n=t[o],s=e[e.length-1];y(s,n)?e[e.length-1]=T(s,n):e.push(n)}return e}(s):null}(t,this.detectors);return n?1===n.length&&n[0]?.detection?this.handleSingleCodeBlock(o,n[0].detection):this.handleMixedContent(o,n):null};isCursorInCodeBlock(t){const e=t.selection;return!!r(e)&&"code_block"===t.getBlock(e.anchor.blockId)?.type}handleSingleCodeBlock(t,e){const o=this.buildCodeBlockTransaction(t,e);return o&&this.context&&this.context.announce(this.locale.detectedAsCodeBlock(e.language)),o}buildCodeBlockTransaction(n,a){const l=n.selection,u=n.transaction("paste");let g;g=r(l)&&!s(l)?m(n,u)??l.anchor.blockId:h(l);const f=t(),p=e(i("code_block"),[o(a.formattedText)],f,{language:a.language,backgroundColor:""});return d(n,u,g,p,l,this.context?.getSchemaRegistry())?(u.setSelection(c(f,a.formattedText.length)),u.build()):null}handleMixedContent(t,e){const o=this.buildMultiBlockTransaction(t,e);return o&&this.context&&this.announceMixedContent(e),o}buildMultiBlockTransaction(t,e){const o=t.selection,i=t.transaction("paste");let d;d=r(o)&&!s(o)?m(t,i)??o.anchor.blockId:h(o);const g=a(t,d),f=this.context?.getSchemaRegistry(),p=g?l(t,d,g,f):u(t,d,f);if(!p)return null;const x=!g&&n(o)&&"before"===o.side?0:1;let k,C=p.anchorIndex+x,b=0;for(const n of e){const t=n.detection?this.createCodeBlockNode(n.detection):this.createParagraphNode(n.text);i.insertNode(p.parentPath,C,t),C++,k=t.id,b=n.detection?n.detection.formattedText.length:n.text.length}return(g?p.isAnchorEmpty&&p.anchorIndex>=0:p.isAnchorEmpty&&!n(o))&&i.removeNode(p.parentPath,p.anchorIndex),k&&i.setSelection(c(k,b)),i.build()}createCodeBlockNode(n){return e(i("code_block"),[o(n.formattedText)],t(),{language:n.language,backgroundColor:""})}createParagraphNode(n){return e(i("paragraph"),[o(n)],t())}announceMixedContent(t){let e=0,o=0;const n=[];for(const s of t)s.detection?(o++,n.includes(s.detection.language)||n.push(s.detection.language)):e++;this.context?.announce(this.locale.detectedMixedContent(e,o,n))}};export{S as i,$ as n,P as r,v as t};
|
|
2
|
-
//# sourceMappingURL=SmartPastePlugin-BvJQ-fOz.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e="data-notectl-style-token",t=/* @__PURE__ */new WeakMap,n=/* @__PURE__ */new WeakMap,s=/* @__PURE__ */new WeakSet;function o(e){return s.has(e)}function i(){if("undefined"==typeof CSSStyleSheet)return null;try{const e=new CSSStyleSheet;return s.add(e),e}catch{return null}}function r(e,o){const i=n.get(e);i&&(i.destroy(),n.delete(e)),o.sheet&&s.add(o.sheet),t.set(e,{nonce:o.nonce,sheet:o.sheet??null})}function l(e){const s=n.get(e);s&&(s.destroy(),n.delete(e)),t.delete(e)}function c(e,t,n){const s=S(e);s?k(s.root,s.settings).setProperty(e,t,n):f(e,t,n)}function a(e,t){c(e,t,"")}function h(e,t){const n=S(e);if(n)k(n.root,n.settings).setProperties(e,t);else for(const[s,o]of Object.entries(t))f(e,s,o??"")}function u(e,t){const n=S(e);n?k(n.root,n.settings).setStyleText(e,t):e.style.cssText=t}function d(e,t){const n=S(e);if(!n){const n=e.style.cssText;return void(e.style.cssText=n?`${n}; ${t}`:t)}k(n.root,n.settings).appendStyleText(e,t)}function y(e){const n=g(e);if(n)return t.get(n)?.nonce}function f(e,t,n){t.startsWith("--")||t.includes("-")?n?e.style.setProperty(t,n):e.style.removeProperty(t):e.style[t]=n}function S(e){const n=function(e){return g(e)}(e);if(!n)return null;const s=t.get(n);return s?{root:n,settings:s}:null}function k(e,t){const s=n.get(e);if(s)return s;const o=new E(e,t);return n.set(e,o),o}function m(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function p(e){return"undefined"!=typeof Document&&e instanceof Document}function g(e){const t=m(e)||p(e)?e:e.getRootNode();return m(t)||p(t)?t:"undefined"!=typeof document?document:null}var E=class{declarationByElement=/* @__PURE__ */new WeakMap;tokenByDeclaration=/* @__PURE__ */new Map;declarationByToken=/* @__PURE__ */new Map;tokenRefCount=/* @__PURE__ */new Map;tokenByElement=/* @__PURE__ */new WeakMap;tokenCounter=0;root;nonce;sheet;fallbackStyleElement=null;ownsAdoptedSheet=!1;constructor(e,t){this.root=e,this.nonce=t.nonce,this.sheet=t.sheet??null}destroy(){this.clearRuntimeRules(),this.ownsAdoptedSheet&&this.sheet&&"adoptedStyleSheets"in this.root&&(this.root.adoptedStyleSheets=this.root.adoptedStyleSheets.filter(e=>e!==this.sheet)),this.fallbackStyleElement?.remove(),this.fallbackStyleElement=null,this.sheet=null,this.ownsAdoptedSheet=!1,this.tokenByDeclaration.clear(),this.declarationByToken.clear(),this.tokenRefCount.clear(),this.tokenCounter=0}setProperty(e,t,n){const s=this.getOrCreateDeclarations(e),o=T(t);w(e,o),n?s.set(o,n):s.delete(o),this.syncElementToken(e,s)}setProperties(e,t){const n=this.getOrCreateDeclarations(e);for(const[s,o]of Object.entries(t)){const t=T(s);w(e,t),o?n.set(t,o):n.delete(t)}this.syncElementToken(e,n)}setStyleText(e,t){const n=R(t);e.removeAttribute("style"),0!==n.size?(this.declarationByElement.set(e,n),this.syncElementToken(e,n)):this.clearElementStyles(e)}appendStyleText(e,t){const n=R(t);if(0===n.size)return;const s=this.getOrCreateDeclarations(e);for(const[o,i]of n)w(e,o),s.set(o,i);this.syncElementToken(e,s)}getStyleText(e){const t=this.declarationByElement.get(e);return t&&0!==t.size?C(t):""}getOrCreateDeclarations(e){const t=this.declarationByElement.get(e);if(t)return t;const n=/* @__PURE__ */new Map;return this.declarationByElement.set(e,n),n}syncElementToken(t,n){const s=this.tokenByElement.get(t);if(0===n.size)return void this.clearElementStyles(t);const o=C(n);let i=this.tokenByDeclaration.get(o);i||(i=`s${this.tokenCounter.toString(36)}`,this.tokenCounter+=1,this.tokenByDeclaration.set(o,i),this.declarationByToken.set(i,o),this.insertRule(i,o)),s!==i&&(this.retainToken(i),s&&this.releaseToken(s),this.tokenByElement.set(t,i)),t.setAttribute(e,i)}insertRule(e,t){const n=`${B(e)} { ${t}; }`,s=this.ensureSheet();if(s)try{s.insertRule(n,s.cssRules.length)}catch{}}ensureSheet(){if(this.sheet)return this.sheet;if("undefined"!=typeof CSSStyleSheet)try{const e=new CSSStyleSheet;if("adoptedStyleSheets"in this.root){const t=this.root.adoptedStyleSheets;return this.root.adoptedStyleSheets=[...t,e],s.add(e),this.sheet=e,this.ownsAdoptedSheet=!0,e}}catch{}const e=this.ensureFallbackStyleElement();return this.sheet=e.sheet??null,this.sheet&&s.add(this.sheet),this.sheet}clearElementStyles(t){this.declarationByElement.delete(t);const n=this.tokenByElement.get(t);n&&(this.tokenByElement.delete(t),this.releaseToken(n)),t.removeAttribute(e)}retainToken(e){const t=this.tokenRefCount.get(e)??0;this.tokenRefCount.set(e,t+1)}releaseToken(e){const t=this.tokenRefCount.get(e);if(!t)return;if(t>1)return void this.tokenRefCount.set(e,t-1);this.tokenRefCount.delete(e);const n=this.declarationByToken.get(e);n&&(this.declarationByToken.delete(e),this.tokenByDeclaration.delete(n)),this.deleteRule(e)}deleteRule(e){const t=this.sheet;if(!t)return;const n=B(e);for(let s=t.cssRules.length-1;s>=0;s-=1){const e=t.cssRules[s];if(e&&b(e,n)){try{t.deleteRule(s)}catch{}return}}}clearRuntimeRules(){const t=this.sheet;if(t)for(let n=t.cssRules.length-1;n>=0;n-=1){const s=t.cssRules[n];if(s&&s.cssText.includes(`[${e}="`))try{t.deleteRule(n)}catch{}}}ensureFallbackStyleElement(){if(this.fallbackStyleElement)return this.fallbackStyleElement;const e=document.createElement("style");return e.setAttribute("data-notectl-runtime-styles",""),this.nonce&&e.setAttribute("nonce",this.nonce),m(this.root)?this.root.appendChild(e):(this.root.head??this.root.documentElement).appendChild(e),this.fallbackStyleElement=e,e}};function R(e){const t=/* @__PURE__ */new Map;for(const n of e.split(";")){const e=n.trim();if(!e)continue;const s=e.indexOf(":");if(s<=0)continue;const o=T(e.slice(0,s)),i=e.slice(s+1).trim();i?t.set(o,i):t.delete(o)}return t}function C(e){return Array.from(e.entries()).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}: ${t}`).join("; ")}function T(e){const t=e.trim();return t?t.startsWith("--")?t:t.includes("-")?t.toLowerCase():t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`).toLowerCase():""}function w(e,t){t&&(e.style.removeProperty(t),""===e.getAttribute("style")&&e.removeAttribute("style"))}function B(t){return`[${e}="${t}"]`}function b(e,t){return"undefined"!=typeof CSSStyleRule&&e instanceof CSSStyleRule?e.selectorText===t:e.cssText.includes(t)}export{r as a,c,o as i,u as l,i as n,a as o,y as r,h as s,d as t,l as u};
|
|
2
|
-
//# sourceMappingURL=StyleRuntime-DW6omotc.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as s}from"./TypeBrands-Ch9856Gb.mjs";import{_ as t,m as e}from"./Commands-D5ND50PQ.mjs";import{c as i,n as r,o,s as p}from"./PluginHelpers-KDuTlmXm.mjs";import{t as c}from"./ShortcutFormatting-TwiufqeV.mjs";var a={superscriptLabel:"Superscript",superscriptTooltip:s=>`Superscript (${s})`,subscriptLabel:"Subscript",subscriptTooltip:s=>`Subscript (${s})`},n=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-NV_puwI2.mjs"),"./locales/de.ts":()=>import("./de-BX4y4PlH.mjs"),"./locales/es.ts":()=>import("./es-BdpTTRuX.mjs"),"./locales/fr.ts":()=>import("./fr-CKjH6tJI.mjs"),"./locales/hi.ts":()=>import("./hi-DsdXcOB6.mjs"),"./locales/pt.ts":()=>import("./pt-OXa_IR4Q.mjs"),"./locales/ru.ts":()=>import("./ru-d68SZpEe.mjs"),"./locales/zh.ts":()=>import("./zh-BP97XjlS.mjs")});async function l(s){return i(n,s,a)}var u={superscript:!0,subscript:!0},m=[{type:"superscript",opposite:"subscript",configKey:"superscript",rank:4,tag:"sup",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z"',' fill="none"/>','<path d="M9.64 7.64c.23-.5.36-1.05.36-1.64'," 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9"," 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83"," 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83",' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" fill="none"/>','<path d="M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-.",toHTMLString:s=>`<sup>${s}</sup>`,parseHTML:[{tag:"sup"}],sanitize:{tags:["sup"]}},{type:"subscript",opposite:"superscript",configKey:"subscript",rank:4,tag:"sub",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-,",toHTMLString:s=>`<sub>${s}</sub>`,parseHTML:[{tag:"sub"}],sanitize:{tags:["sub"]}}],g=class{id="super-sub";name="Superscript & Subscript";priority=23;config;locale;constructor(s){this.config={...u,...s}}async init(s){this.locale=await o(s,this.config.locale,a,l);const t=m.filter(s=>this.config[s.configKey]);for(const e of t)this.registerMark(s,e);this.registerKeymaps(s,t),this.registerExclusivityMiddleware(s,t),this.registerDisabledToolbarItems(s)}registerMark(i,o){const a=p(o.type),n=this.isToolbarVisible(o.configKey);if(i.registerMarkSpec({type:o.type,rank:o.rank,toDOM:()=>document.createElement(o.tag),toHTMLString:(s,t)=>o.toHTMLString(t),parseHTML:o.parseHTML,sanitize:o.sanitize}),i.registerCommand(a,()=>r(i,t(i.getState(),s(o.type)))),n){const t="superscript"===o.type?this.locale.superscriptLabel:this.locale.subscriptLabel,r="superscript"===o.type?this.locale.superscriptTooltip(c(o.keyBinding)):this.locale.subscriptTooltip(c(o.keyBinding));i.registerToolbarItem({id:o.type,group:"format",icon:o.icon,label:t,tooltip:r,command:a,isActive:t=>e(t,s(o.type))})}}registerKeymaps(s,t){const e={};for(const i of t){const t=p(i.type);e[i.keyBinding]=()=>s.executeCommand(t)}Object.keys(e).length>0&&s.registerKeymap(e)}registerExclusivityMiddleware(t,e){e.some(s=>"superscript"===s.type)&&e.some(s=>"subscript"===s.type)&&t.registerMiddleware((t,e,i)=>{let r=!1;const o=[];for(const c of t.steps){if("addMark"!==c.type){o.push(c);continue}const t=c.mark.type,e=m.find(s=>s.type===t);if(!e){o.push(c);continue}r=!0;const i={type:"removeMark",blockId:c.blockId,from:c.from,to:c.to,mark:{type:s(e.opposite)},...c.path?{path:c.path}:{}};o.push(i,c)}let p=t.storedMarksAfter;if(p){const s=p.some(s=>"superscript"===s.type),t=p.some(s=>"subscript"===s.type);if(s&&t){const s=p.findLastIndex(s=>"superscript"===s.type)>p.findLastIndex(s=>"subscript"===s.type)?"subscript":"superscript";p=p.filter(t=>t.type!==s),r=!0}}i(r?{...t,steps:o,storedMarksAfter:p}:t)},{name:"super-sub:exclusivity"})}registerDisabledToolbarItems(s){if(this.config.toolbar)for(const t of m){const e=this.config[t.configKey],i=this.config.toolbar[t.configKey]??!0;if(!e&&i){const e="superscript"===t.type?this.locale.superscriptLabel:this.locale.subscriptLabel;s.registerToolbarItem({id:t.type,group:"format",icon:t.icon,label:e,command:p(t.type),isEnabled:()=>!1})}}}isToolbarVisible(s){return!this.config.toolbar||(this.config.toolbar[s]??!0)}};export{a as n,l as r,g as t};
|
|
2
|
-
//# sourceMappingURL=SuperSubPlugin-DTZB0Y3D.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as t,o as e,r as n,t as s}from"./HTMLUtils-Bhg3_P8B.mjs";import{D as r,E as i,O as o,T as c,b as l,p as a}from"./Document-827l3P80.mjs";import{t as u}from"./TypeBrands-Ch9856Gb.mjs";import{r as f}from"./AttrRegistry-B3zB02z9.mjs";import d from"dompurify";var p=/^[A-Za-z0-9_-]{1,64}$/;function g(t){return p.test(t)}function h(t,e){const n=t.getAttribute("data-block-id");if(n&&g(n)&&!e.has(n))return e.add(n),u(n)}function m(t){return t.split(";").map(t=>t.trim()).filter(t=>t.length>0).sort().join("; ")}function $(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36).padStart(6,"0")}var y=class{classMap=/* @__PURE__ */new Map;usedHashes=/* @__PURE__ */new Set;getClassName(t){const e=m(t),n=this.classMap.get(e);if(n)return n;let s=$(e),r=0;for(;this.usedHashes.has(s);)r++,s=$(e+String(r));const i=`notectl-s-${s}`;return this.usedHashes.add(s),this.classMap.set(e,i),i}getAlignmentClassName(t){const e=m(`text-align: ${t}`),n=this.classMap.get(e);if(n)return n;const s=`notectl-align-${t}`;return this.classMap.set(e,s),s}toCSS(){if(0===this.classMap.size)return"";const t=[];for(const[e,n]of this.classMap)t.push(`.${n} { ${e}; }`);return t.join("\n")}toStyleMap(){const t=/* @__PURE__ */new Map;for(const[e,n]of this.classMap)t.set(n,e);return t}};function x(...t){return t.length>0?{SANITIZE_DOM:!1,FORBID_ATTR:[...t]}:{SANITIZE_DOM:!1}}function A(t){const e=t.getMarkTypes(),n=/* @__PURE__ */new Map;for(const s of e){const e=t.getMarkSpec(s);e&&n.set(s,e.rank??99)}return n}function M(t,e,n,s,r,i){if(0===e.length)return t;const o=s??A(n),c=[...e].sort((t,e)=>(o.get(t.type)??99)-(o.get(e.type)??99)),l=[],a=[];for(const f of c){const t=n.getMarkSpec(f.type);if(t?.toHTMLStyle){const e=t.toHTMLStyle(f);e&&l.push(e)}else a.push(f)}let u=t;l.length>0&&(u=i(u,l.join("; ")));for(const f of a){const t=n.getMarkSpec(f.type);t?.toHTMLString&&(u=t.toHTMLString(f,u,r))}return u}function S(t,e,s,r,i,o){return""===t?"":M(n(t),e,s,r,i,o)}function k(t){return(e,n)=>{const s=t?t.styleAttr(n):` style="${n}"`;return s?`<span${s}>${e}</span>`:e}}function b(t){return(e,n)=>`<span class="${t.getClassName(n)}">${e}</span>`}function T(t,e,n,s,r){return S(t,e,n,s,r,k(r))}function L(t,e,n,s,r){return M(t,e,n,s,r,k(r))}function v(t,e,n,s,r,i){return S(t,e,n,r,i,b(s))}function C(t,e,n,s,r,i){return M(t,e,n,r,i,b(s))}var w=new Set(["start","center","end","justify"]),I={left:"start",right:"end"},N=new Set(["ltr","rtl"]);function _(t){return{styleAttr:e=>e?` class="${t.getClassName(e)}"`:""}}function E(t,e,n){const s=j(t);if(!s)return t;const r=t.slice(s.start,s.end+1),i=new RegExp(`\\s${e}\\s*=\\s*("([^"]*)"|'([^']*)')`),o=r.match(i);if(o){const c=o[2]??o[3]??"";if("style"===e&&/(?:^|;)\s*text-align\s*:/i.test(c))return t;const l=` ${e}="${c}${"style"===e?"; ":" "}${n}"`,a=r.replace(i,l);return`${t.slice(0,s.start)}${a}${t.slice(s.end+1)}`}const c=r.endsWith("/>")?`${r.slice(0,-2)} ${e}="${n}"/>`:`${r.slice(0,-1)} ${e}="${n}">`;return`${t.slice(0,s.start)}${c}${t.slice(s.end+1)}`}function H(t){return" "===t||"\t"===t||"\n"===t||"\f"===t||"\r"===t}function O(n,s){const r=e(s);return r?function(t,e,n){const s=j(t);if(!s)return t;const r=` ${e}="${n}"`,i=function(t,e){const n=[];let s=1;for(;s<t.length&&!H(t[s]??"")&&">"!==t[s]&&"/"!==t[s];)s++;for(;s<t.length;){for(;H(t[s]??"");)s++;if(">"===t[s]||void 0===t[s])break;if("/"===t[s]&&">"===t[s+1])break;const r=s;for(;s<t.length&&!H(t[s]??"")&&"="!==t[s]&&">"!==t[s]&&"/"!==t[s];)s++;const i=t.slice(r,s);if(""!==i){for(;H(t[s]??"");)s++;if("="===t[s]){for(s++;H(t[s]??"");)s++;const e=t[s];if('"'===e||"'"===e){for(s++;s<t.length&&t[s]!==e;)s++;t[s]===e&&s++}else for(;s<t.length&&!H(t[s]??"")&&">"!==t[s]&&("/"!==t[s]||">"!==t[s+1]);)s++}i.toLowerCase()===e.toLowerCase()&&n.push({start:r,end:s})}else s++}let r=t;for(let i=n.length-1;i>=0;i--){const t=n[i];t&&(r=`${r.slice(0,t.start)}${r.slice(t.end)}`)}return r}(t.slice(s.start,s.end+1),e),o=i.endsWith("/>")?`${i.slice(0,-2)}${r}/>`:`${i.slice(0,-1)}${r}>`;return`${t.slice(0,s.start)}${o}${t.slice(s.end+1)}`}(n,"id",t(r)):n}function j(t){let e=t.indexOf("<");for(;e>=0;){const n=t[e+1];if(n&&/[A-Za-z]/.test(n)){let n;for(let s=e+2;s<t.length;s++){const r=t[s]??"";if(n)r===n&&(n=void 0);else if('"'!==r&&"'"!==r){if(">"===r)return{start:e,end:s}}else n=r}return}e=t.indexOf("<",e+1)}}function D(t){const e=j(t);return e?t.slice(e.start,e.end+1):""}function R(t){return x(...t?[]:["data-block-id"])}function W(t,e,n){const r=!1!==n?.includeBlockIds,i={registry:e,exportCtx:{styleAttr:t=>t?` style="${t}"`:""},includeBlockIds:r},o=z(t.children,i),c=e?e.getAllowedTags():["p","br","div","span"],l=e?e.getAllowedAttrs():["style","dir","id"];return d.sanitize(o,{ALLOWED_TAGS:c,ALLOWED_ATTR:l,ALLOWED_URI_REGEXP:s,...R(r)})}function B(t,e,n){const r=!1!==n?.includeBlockIds,i=new y,o={registry:e,collector:i,exportCtx:_(i),includeBlockIds:r},c=z(t.children,o),l=e?e.getAllowedTags():["p","br","div","span"],a=e?e.getAllowedAttrs():["style","class","dir","id"],u=(a.includes("class")?[...a]:[...a,"class"]).filter(t=>"style"!==t);return{html:d.sanitize(c,{ALLOWED_TAGS:l,ALLOWED_ATTR:u,ALLOWED_URI_REGEXP:s,...R(r)}),css:i.toCSS(),styleMap:i.toStyleMap()}}function z(t,e){const n=[];let s=0;for(;s<t.length;){const r=t[s];if(r)if(f(r,"list_item")){const r=[];for(;s<t.length;){const e=t[s];if(!e||!f(e,"list_item"))break;r.push(e),s++}n.push(F(r,e))}else n.push(Z(r,e)),s++;else s++}return n.join("")}function F(t,e){const n=[],s=[];for(let r=0;r<t.length;r++){const i=t[r];if(!i)continue;const o=i.attrs?.listType??"bullet",c=i.attrs?.indent??0,l="ordered"===o?"ol":"ul";for(;s.length>0;){const t=s[s.length-1];if(!t)break;if(t.indent>c)n.push(`</${t.tag}></li>`),s.pop();else{if(t.indent!==c||t.tag===l)break;n.push(`</${t.tag}></li>`),s.pop()}}if(0===s.length)n.push(`<${l}>`),s.push({tag:l,indent:c});else{const t=s[s.length-1];t&&c>t.indent&&(n.push(`<${l}>`),s.push({tag:l,indent:c}))}const a=Z(i,e),u=t[r+1],f=u?u.attrs?.indent??0:void 0;void 0!==f&&f>c?n.push(G(a)):n.push(a)}for(;s.length>0;){const t=s.pop();if(!t)break;n.push(`</${t.tag}>`),s.length>0&&n.push("</li>")}return n.join("")}function G(t){return t.endsWith("</li>")?t.slice(0,-5):t}function Z(e,s){const u=i(e)?function(t,e){const s=function(t){if(t.length<=1)return t;const e=[];for(const n of t){if(c(n)){e.push(n);continue}const t=e[e.length-1];t&&r(t)&&o(t.marks,n.marks)?e[e.length-1]={type:"text",text:t.text+n.text,marks:t.marks}:e.push(n)}return e}(l(t)),i=[],a=e.registry?A(e.registry):void 0;for(const r of s)if(c(r)){const t=e.registry?.getInlineNodeSpec(r.inlineType);if(t?.toHTMLString){const n=t.toHTMLString(r);e.registry&&r.marks.length>0?i.push(e.collector?C(n,r.marks,e.registry,e.collector,a,e.exportCtx):L(n,r.marks,e.registry,a,e.exportCtx)):i.push(n)}}else e.registry&&e.collector?i.push(v(r.text,r.marks,e.registry,e.collector,a,e.exportCtx)):e.registry?i.push(T(r.text,r.marks,e.registry,a,e.exportCtx)):""!==r.text&&i.push(n(r.text));return i.join("")}(e,s):z(a(e),s),f=s.registry?.getNodeSpec(e.type);let d;d=f?.toHTML?f.toHTML(e,u,s.exportCtx):`<p>${u||"<br>"}</p>`,s.includeBlockIds&&g(e.id)&&(D(d).includes(" data-block-id=")||(d=E(d,"data-block-id",t(e.id)))),d=O(d,e.htmlId);const p=e.attrs?.align,h=p?I[p]??p:void 0;if(h&&"start"!==h&&w.has(h)){const e=t(h);if(s.collector){const e=s.collector.getAlignmentClassName(h);d=E(d,"class",t(e))}else d=E(d,"style",`text-align: ${e}`)}const m=e.attrs?.dir;return m&&N.has(m)&&(D(d).includes(" dir=")||(d=E(d,"dir",t(m)))),d}var P=1e4;function U(t,e=1,n=1e4){if("number"!=typeof t||!Number.isFinite(t))return null;const s=X(e,1),r=Math.max(s,X(n,P));return Math.min(r,Math.max(s,t))}function X(t,e){return Number.isFinite(t)?Math.min(P,Math.max(1,t)):e}var V="data-notectl-width-px",q="data-notectl-min-height-px",J=1e3,K=/^\d+(?:\.\d+)?$/,Q=/^(\d+(?:\.\d+)?)px$/i,Y=/^\d+$/;function tt(t){if("number"==typeof t&&Number.isFinite(t)&&!(t<1||t>1e4))return U(t)??void 0}function et(t){if(null===t)return;const e=t.trim().match(Q);return e?.[1]?lt(e[1]):void 0}function nt(t,e,n,s){const r=ct(t.getAttribute(e),!1);if(void 0!==r)return r;for(const i of n){const e=et(t.style.getPropertyValue(i));if(void 0!==e)return e}return ct(t.getAttribute(s),!0)}function st(t){if(null===t)return 1;const e=t.trim();if(!Y.test(e))return 1;const n=Number(e);return!Number.isSafeInteger(n)||n<1||n>1e3?1:n}function rt(t){if(!Array.isArray(t))return;const e=Array.from(t.slice(0,1e3),t=>tt(t)??null);return e.some(t=>null!==t)?e:void 0}function it(t){return void 0!==rt(t)}function ot(t,e,n,s){const r=tt(n);if(void 0===r)return"";const i=`${e}: ${String(r)}px`,o=s?.styleAttr(i)??` style="${i}"`;return` ${t}="${String(r)}"${o}`}function ct(t,e){if(null===t)return;const n=t.trim();if(K.test(n))return lt(n);if(!e)return;const s=n.match(Q);return s?.[1]?lt(s[1]):void 0}function lt(t){return tt(Number(t))}export{A as _,tt as a,h as b,nt as c,U as d,w as f,O as g,W as h,it as i,ot as l,B as m,V as n,rt as o,N as p,q as r,st as s,J as t,P as u,T as v,x as y};
|
|
2
|
-
//# sourceMappingURL=TableDimensions-BBhjHNjQ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableDimensions-BBhjHNjQ.mjs","names":[],"sources":["../../src/serialization/BlockIdHTML.ts","../../src/serialization/CSSClassCollector.ts","../../src/serialization/HTMLSanitization.ts","../../src/serialization/MarkSerializer.ts","../../src/serialization/DocumentSerializer.ts","../../src/model/TableDimensions.ts","../../src/serialization/TableDimensions.ts"],"sourcesContent":["/**\n * Shared rules for the `data-block-id` HTML wire format.\n *\n * Block identity round-trips through `getContentHTML` → `setContentHTML` so the\n * caret-preserving `EditorView.replaceState()` keeps the cursor on the same block\n * across content sync (Angular signal forms, RxJS pipes — see ARCHITECTURE §9.2).\n * Both serializer and parser must agree on the same shape; this module is the\n * single source of truth.\n */\n\nimport { type BlockId, blockId } from '../model/TypeBrands.js';\n\n/**\n * Conservative pattern for `data-block-id` values: alphanumeric, underscore,\n * hyphen, max 64 chars. Defense-in-depth — IDs flow in-memory only, but we keep\n * the wire shape narrow to rule out attribute-injection vectors and to allow\n * `escapeAttr` to be a no-op for valid IDs.\n */\nexport const SAFE_BLOCK_ID_PATTERN: RegExp = /^[A-Za-z0-9_-]{1,64}$/;\n\n/** True if `value` is shaped like a safe `data-block-id`. */\nexport function isSafeBlockId(value: string): boolean {\n\treturn SAFE_BLOCK_ID_PATTERN.test(value);\n}\n\n/**\n * Adopts the `data-block-id` attribute from a parsed element so that block\n * identity survives an HTML round-trip. Returns `undefined` (caller generates\n * a fresh ID) when:\n * - the attribute is missing (e.g. user-pasted external HTML),\n * - the value is malformed,\n * - or the value collides with an already-adopted ID in this parse pass\n * (e.g. concatenated HTML from two documents).\n */\nexport function adoptBlockId(el: Element, used: Set<string>): BlockId | undefined {\n\tconst raw: string | null = el.getAttribute('data-block-id');\n\tif (!raw) return undefined;\n\tif (!isSafeBlockId(raw)) return undefined;\n\tif (used.has(raw)) return undefined;\n\tused.add(raw);\n\treturn blockId(raw);\n}\n","/**\n * CSSClassCollector: maps CSS declarations to unique class names during serialization.\n * Deduplicates identical declaration sets and produces a minimal stylesheet.\n * Uses content-hash (FNV-1a) for deterministic, document-order-independent class names.\n */\n\n/** Prefix for generated style class names (avoids collisions with user classes). */\nconst CLASS_PREFIX = 'notectl-s-';\n\n/** Base for hash encoding output. */\nconst HASH_BASE = 36;\n/** Pad length for consistent 6-char hashes. */\nconst HASH_PAD_LENGTH = 6;\n\n/**\n * Normalizes a CSS declarations string by sorting individual declarations alphabetically.\n * This ensures `\"color: red; font-size: 14px\"` and `\"font-size: 14px; color: red\"` map\n * to the same class name.\n */\nfunction normalizeDeclarations(declarations: string): string {\n\treturn declarations\n\t\t.split(';')\n\t\t.map((d) => d.trim())\n\t\t.filter((d) => d.length > 0)\n\t\t.sort()\n\t\t.join('; ');\n}\n\n/** FNV-1a 32-bit offset basis. */\nconst FNV_OFFSET_BASIS = 0x811c9dc5;\n/** FNV-1a 32-bit prime. */\nconst FNV_PRIME = 0x01000193;\n\n/**\n * FNV-1a 32-bit hash function.\n * Fast, no crypto dependency, excellent distribution for short strings.\n */\nfunction fnv1aHash(input: string): string {\n\tlet hash: number = FNV_OFFSET_BASIS;\n\tfor (let i = 0; i < input.length; i++) {\n\t\thash ^= input.charCodeAt(i);\n\t\thash = Math.imul(hash, FNV_PRIME);\n\t}\n\t// Convert to unsigned 32-bit, then to base-36, padded to 6 chars\n\tconst unsigned: number = hash >>> 0;\n\treturn unsigned.toString(HASH_BASE).padStart(HASH_PAD_LENGTH, '0');\n}\n\n/**\n * Stateful collector that assigns CSS class names to unique declaration sets.\n * Used during a single serialization pass, then produces the collected stylesheet.\n *\n * Class names are deterministic: the same declarations always produce the same\n * class name, regardless of encounter order across documents.\n */\nexport class CSSClassCollector {\n\t/** Maps normalized declarations → class name. */\n\tprivate readonly classMap: Map<string, string> = new Map();\n\t/** Tracks used hashes to handle the (extremely rare) collision case. */\n\tprivate readonly usedHashes: Set<string> = new Set();\n\n\t/**\n\t * Returns the class name for the given CSS declarations.\n\t * If the same (normalized) declarations were seen before, returns the existing class.\n\t */\n\tgetClassName(declarations: string): string {\n\t\tconst normalized: string = normalizeDeclarations(declarations);\n\t\tconst existing: string | undefined = this.classMap.get(normalized);\n\t\tif (existing) return existing;\n\n\t\tlet hash: string = fnv1aHash(normalized);\n\t\tlet suffix = 0;\n\t\t// Collision handling: append suffix counter if the hash is already in use\n\t\t// for a different declarations string\n\t\twhile (this.usedHashes.has(hash)) {\n\t\t\tsuffix++;\n\t\t\thash = fnv1aHash(normalized + String(suffix));\n\t\t}\n\n\t\tconst className: string = `${CLASS_PREFIX}${hash}`;\n\t\tthis.usedHashes.add(hash);\n\t\tthis.classMap.set(normalized, className);\n\t\treturn className;\n\t}\n\n\t/**\n\t * Returns the semantic alignment class name for a given alignment value.\n\t * Unlike style classes, alignment classes use descriptive names.\n\t */\n\tgetAlignmentClassName(alignment: string): string {\n\t\t// Key by the normalized declaration so the \"one declaration → one class\"\n\t\t// invariant is shared with getClassName(); if a style class for the same\n\t\t// declaration already exists, reuse it rather than minting a second name.\n\t\tconst normalized: string = normalizeDeclarations(`text-align: ${alignment}`);\n\t\tconst existing: string | undefined = this.classMap.get(normalized);\n\t\tif (existing) return existing;\n\n\t\tconst className = `notectl-align-${alignment}`;\n\t\tthis.classMap.set(normalized, className);\n\t\treturn className;\n\t}\n\n\t/** Produces CSS rules for all collected classes. Returns empty string if none collected. */\n\ttoCSS(): string {\n\t\tif (this.classMap.size === 0) return '';\n\n\t\tconst rules: string[] = [];\n\t\tfor (const [declarations, className] of this.classMap) {\n\t\t\trules.push(`.${className} { ${declarations}; }`);\n\t\t}\n\t\treturn rules.join('\\n');\n\t}\n\n\t/**\n\t * Returns a map from class name → CSS declarations for round-trip support.\n\t * Used by `setContentHTML` to rehydrate class-based HTML.\n\t */\n\ttoStyleMap(): ReadonlyMap<string, string> {\n\t\tconst map = new Map<string, string>();\n\t\tfor (const [declarations, className] of this.classMap) {\n\t\t\tmap.set(className, declarations);\n\t\t}\n\t\treturn map;\n\t}\n}\n","/** DOMPurify options required to preserve semantic HTML IDs. */\nexport interface HTMLIdSanitizeConfig {\n\treadonly SANITIZE_DOM: false;\n\treadonly FORBID_ATTR?: string[];\n}\n\n/**\n * Builds the shared DOMPurify policy for HTML carrying document-local targets.\n *\n * DOMPurify's `SANITIZE_DOM` option removes otherwise valid IDs such as `target`\n * when their value matches a property on `document` or a form. Those removals\n * break the fragment-link contract. Callers may add attributes that a broad\n * sanitizer pass must always reject; schema-driven allowlists remain authoritative.\n */\nexport function preserveHTMLIdSanitizeConfig(\n\t...additionalForbiddenAttrs: readonly string[]\n): HTMLIdSanitizeConfig {\n\treturn additionalForbiddenAttrs.length > 0\n\t\t? { SANITIZE_DOM: false, FORBID_ATTR: [...additionalForbiddenAttrs] }\n\t\t: { SANITIZE_DOM: false };\n}\n","/**\n * MarkSerializer: shared mark serialization logic for DocumentSerializer and ClipboardHandler.\n * Separates style-based marks (merged into a single `<span style>`) from tag-based marks\n * (nested wrappers in rank order).\n */\n\nimport type { Mark } from '../model/Document.js';\nimport { escapeHTML } from '../model/HTMLUtils.js';\nimport type { MarkSpec } from '../model/MarkSpec.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport type { CSSClassCollector } from './CSSClassCollector.js';\n\n/** Rank assigned to marks whose spec does not declare an explicit `rank`. */\nconst DEFAULT_MARK_RANK = 99;\n\n/** Builds a map of mark type name to rank from the registry (compute once per pass). */\nexport function buildMarkOrder(registry: SchemaRegistry): Map<string, number> {\n\tconst types: readonly string[] = registry.getMarkTypes();\n\tconst order = new Map<string, number>();\n\tfor (const t of types) {\n\t\tconst spec: MarkSpec | undefined = registry.getMarkSpec(t);\n\t\tif (spec) order.set(t, spec.rank ?? DEFAULT_MARK_RANK);\n\t}\n\treturn order;\n}\n\n/**\n * Wraps already-rendered inner HTML in its marks. Style-based marks\n * (`toHTMLStyle`) are merged into a single span via `wrapStyleSpan`; tag-based\n * marks (`toHTMLString`) then wrap the result in rank order. The inner HTML is\n * emitted verbatim (callers pre-escape text; rendered inline-node HTML must not\n * be re-escaped).\n */\nfunction wrapMarks(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder: Map<string, number> | undefined,\n\texportCtx: HTMLExportContext | undefined,\n\twrapStyleSpan: (html: string, declarations: string) => string,\n): string {\n\tif (marks.length === 0) return innerHTML;\n\n\tconst order: Map<string, number> = markOrder ?? buildMarkOrder(registry);\n\tconst sortedMarks: Mark[] = [...marks].sort(\n\t\t(a, b) => (order.get(a.type) ?? DEFAULT_MARK_RANK) - (order.get(b.type) ?? DEFAULT_MARK_RANK),\n\t);\n\n\tconst styleParts: string[] = [];\n\tconst tagMarks: Mark[] = [];\n\n\tfor (const mark of sortedMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLStyle) {\n\t\t\tconst style: string | null = markSpec.toHTMLStyle(mark);\n\t\t\tif (style) {\n\t\t\t\tstyleParts.push(style);\n\t\t\t}\n\t\t} else {\n\t\t\ttagMarks.push(mark);\n\t\t}\n\t}\n\n\t// Wrap with the merged style span first (closest to content).\n\tlet html: string = innerHTML;\n\tif (styleParts.length > 0) {\n\t\thtml = wrapStyleSpan(html, styleParts.join('; '));\n\t}\n\n\t// Then wrap with tag-based marks in rank order.\n\tfor (const mark of tagMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLString) {\n\t\t\thtml = markSpec.toHTMLString(mark, html, exportCtx);\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/**\n * Shared text mark-serialization core: escapes `text`, then delegates to\n * {@link wrapMarks}. The two public entry points differ only in how the merged\n * style declarations become a `<span>`.\n */\nfunction serializeMarks(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder: Map<string, number> | undefined,\n\texportCtx: HTMLExportContext | undefined,\n\twrapStyleSpan: (html: string, declarations: string) => string,\n): string {\n\tif (text === '') return '';\n\treturn wrapMarks(escapeHTML(text), marks, registry, markOrder, exportCtx, wrapStyleSpan);\n}\n\n/** Builds the inline-style `<span style>` wrapper used by the style-attribute mode. */\nfunction inlineStyleSpanWrapper(\n\texportCtx: HTMLExportContext | undefined,\n): (html: string, declarations: string) => string {\n\treturn (html, declarations) => {\n\t\tconst attr: string = exportCtx ? exportCtx.styleAttr(declarations) : ` style=\"${declarations}\"`;\n\t\treturn attr ? `<span${attr}>${html}</span>` : html;\n\t};\n}\n\n/** Builds the `<span class>` wrapper used by the CSS-class mode. */\nfunction classSpanWrapper(\n\tcollector: CSSClassCollector,\n): (html: string, declarations: string) => string {\n\treturn (html, declarations) =>\n\t\t`<span class=\"${collector.getClassName(declarations)}\">${html}</span>`;\n}\n\n/**\n * Serializes text with marks to HTML.\n * Style-based marks (`toHTMLStyle`) are merged into a single `<span style=\"...\">`.\n * Tag-based marks (`toHTMLString`) wrap the content in rank order.\n */\nexport function serializeMarksToHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn serializeMarks(\n\t\ttext,\n\t\tmarks,\n\t\tregistry,\n\t\tmarkOrder,\n\t\texportCtx,\n\t\tinlineStyleSpanWrapper(exportCtx),\n\t);\n}\n\n/**\n * Wraps an already-rendered inline-node HTML fragment (e.g. `<img>`) in its marks\n * using inline-style spans, mirroring {@link serializeMarksToHTML} but without\n * escaping the fragment. Lets a linked inline image export as `<a …><img …></a>`.\n */\nexport function serializeInlineNodeMarksToHTML(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn wrapMarks(\n\t\tinnerHTML,\n\t\tmarks,\n\t\tregistry,\n\t\tmarkOrder,\n\t\texportCtx,\n\t\tinlineStyleSpanWrapper(exportCtx),\n\t);\n}\n\n/**\n * Serializes text with marks to HTML using CSS class names instead of inline styles.\n * Style-based marks (`toHTMLStyle`) are collected into a `CSSClassCollector` and emitted\n * as `<span class=\"...\">`. Tag-based marks (`toHTMLString`) wrap identically to the inline path.\n */\nexport function serializeMarksToClassHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn serializeMarks(text, marks, registry, markOrder, exportCtx, classSpanWrapper(collector));\n}\n\n/**\n * Wraps an already-rendered inline-node HTML fragment in its marks using\n * CSS-class spans, mirroring {@link serializeMarksToClassHTML} but without\n * escaping the fragment.\n */\nexport function serializeInlineNodeMarksToClassHTML(\n\tinnerHTML: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\treturn wrapMarks(innerHTML, marks, registry, markOrder, exportCtx, classSpanWrapper(collector));\n}\n","/**\n * DocumentSerializer: converts an immutable Document into sanitized HTML.\n * Pure functions — operates on Document/SchemaRegistry, no class state.\n */\n\nimport DOMPurify from 'dompurify';\nimport { isNodeOfType } from '../model/AttrRegistry.js';\nimport type { BlockNode, Document, InlineNode, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockChildren,\n\tgetInlineChildren,\n\tisInlineNode,\n\tisLeafBlock,\n\tisTextNode,\n\tmarkSetsEqual,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP, escapeAttr, escapeHTML, normalizeHTMLId } from '../model/HTMLUtils.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { isSafeBlockId } from './BlockIdHTML.js';\nimport { CSSClassCollector } from './CSSClassCollector.js';\nimport type { ContentCSSResult, SerializeOptions } from './ContentHTMLTypes.js';\nimport { preserveHTMLIdSanitizeConfig } from './HTMLSanitization.js';\nimport {\n\tbuildMarkOrder,\n\tserializeInlineNodeMarksToClassHTML,\n\tserializeInlineNodeMarksToHTML,\n\tserializeMarksToClassHTML,\n\tserializeMarksToHTML,\n} from './MarkSerializer.js';\n\n/** Internal context threaded through all serialization helpers. */\ninterface SerializerContext {\n\treadonly registry?: SchemaRegistry;\n\treadonly collector?: CSSClassCollector;\n\treadonly exportCtx?: HTMLExportContext;\n\t/** Resolved from {@link SerializeOptions.includeBlockIds}; defaults to `true`. */\n\treadonly includeBlockIds: boolean;\n}\n\n/** Known-safe alignment values accepted by the serializer (defense-in-depth). */\nexport const VALID_ALIGNMENTS: ReadonlySet<string> = new Set(['start', 'center', 'end', 'justify']);\n\n/** Legacy physical → logical alignment mapping (mirrors DocumentParser). */\nconst LEGACY_ALIGNMENT_MAP: Readonly<Record<string, string>> = { left: 'start', right: 'end' };\n\n/** Known-safe direction values (defense-in-depth). `auto` is excluded — it's the default. */\nexport const VALID_DIRECTIONS: ReadonlySet<string> = new Set(['ltr', 'rtl']);\n\n/** Creates an HTMLExportContext for inline style mode. */\nfunction createInlineExportContext(): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tif (!declarations) return '';\n\t\t\treturn ` style=\"${declarations}\"`;\n\t\t},\n\t};\n}\n\n/** Creates an HTMLExportContext for CSS class mode. */\nfunction createClassExportContext(collector: CSSClassCollector): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tif (!declarations) return '';\n\t\t\tconst className: string = collector.getClassName(declarations);\n\t\t\treturn ` class=\"${className}\"`;\n\t\t},\n\t};\n}\n\n/**\n * Injects or merges an attribute into the first opening tag of an HTML fragment.\n * Values are expected to be pre-escaped by the caller.\n */\nfunction injectAttrIntoFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst pattern: RegExp = new RegExp(`\\\\s${attr}\\\\s*=\\\\s*(\\\"([^\\\"]*)\\\"|'([^']*)')`);\n\tconst existing: RegExpMatchArray | null = firstTag.match(pattern);\n\tif (existing) {\n\t\tconst existingValue: string = existing[2] ?? existing[3] ?? '';\n\t\tif (attr === 'style' && /(?:^|;)\\s*text-align\\s*:/i.test(existingValue)) {\n\t\t\treturn html;\n\t\t}\n\t\tconst sep: string = attr === 'style' ? '; ' : ' ';\n\t\tconst mergedAttr: string = ` ${attr}=\"${existingValue}${sep}${value}\"`;\n\t\tconst nextFirstTag: string = firstTag.replace(pattern, mergedAttr);\n\t\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n\t}\n\tconst isSelfClosing: boolean = firstTag.endsWith('/>');\n\tconst injectedFirstTag: string = isSelfClosing\n\t\t? `${firstTag.slice(0, -2)} ${attr}=\"${value}\"/>`\n\t\t: `${firstTag.slice(0, -1)} ${attr}=\"${value}\">`;\n\treturn `${html.slice(0, firstTagRange.start)}${injectedFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Replaces an attribute on the first opening tag, or adds it when absent. */\nfunction setAttrOnFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst replacement: string = ` ${attr}=\"${value}\"`;\n\tconst withoutExisting: string = removeAttributes(firstTag, attr);\n\tconst isSelfClosing: boolean = withoutExisting.endsWith('/>');\n\tconst nextFirstTag: string = isSelfClosing\n\t\t? `${withoutExisting.slice(0, -2)}${replacement}/>`\n\t\t: `${withoutExisting.slice(0, -1)}${replacement}>`;\n\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Removes real attributes by name without matching attribute-like text inside quoted values. */\nfunction removeAttributes(openingTag: string, attr: string): string {\n\tconst ranges: { readonly start: number; readonly end: number }[] = [];\n\tlet index = 1;\n\n\t// Skip the tag name.\n\twhile (\n\t\tindex < openingTag.length &&\n\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\topeningTag[index] !== '>' &&\n\t\topeningTag[index] !== '/'\n\t) {\n\t\tindex++;\n\t}\n\n\twhile (index < openingTag.length) {\n\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\tif (openingTag[index] === '>' || openingTag[index] === undefined) break;\n\t\tif (openingTag[index] === '/' && openingTag[index + 1] === '>') break;\n\n\t\tconst start: number = index;\n\t\twhile (\n\t\t\tindex < openingTag.length &&\n\t\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\t\topeningTag[index] !== '=' &&\n\t\t\topeningTag[index] !== '>' &&\n\t\t\topeningTag[index] !== '/'\n\t\t) {\n\t\t\tindex++;\n\t\t}\n\t\tconst name: string = openingTag.slice(start, index);\n\t\tif (name === '') {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\tif (openingTag[index] === '=') {\n\t\t\tindex++;\n\t\t\twhile (isTagWhitespace(openingTag[index] ?? '')) index++;\n\t\t\tconst quote: string | undefined = openingTag[index];\n\t\t\tif (quote === '\"' || quote === \"'\") {\n\t\t\t\tindex++;\n\t\t\t\twhile (index < openingTag.length && openingTag[index] !== quote) index++;\n\t\t\t\tif (openingTag[index] === quote) index++;\n\t\t\t} else {\n\t\t\t\twhile (\n\t\t\t\t\tindex < openingTag.length &&\n\t\t\t\t\t!isTagWhitespace(openingTag[index] ?? '') &&\n\t\t\t\t\topeningTag[index] !== '>' &&\n\t\t\t\t\t!(openingTag[index] === '/' && openingTag[index + 1] === '>')\n\t\t\t\t) {\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (name.toLowerCase() === attr.toLowerCase()) ranges.push({ start, end: index });\n\t}\n\n\tlet result: string = openingTag;\n\tfor (let rangeIndex = ranges.length - 1; rangeIndex >= 0; rangeIndex--) {\n\t\tconst range = ranges[rangeIndex];\n\t\tif (range) result = `${result.slice(0, range.start)}${result.slice(range.end)}`;\n\t}\n\treturn result;\n}\n\nfunction isTagWhitespace(character: string): boolean {\n\treturn (\n\t\tcharacter === ' ' ||\n\t\tcharacter === '\\t' ||\n\t\tcharacter === '\\n' ||\n\t\tcharacter === '\\f' ||\n\t\tcharacter === '\\r'\n\t);\n}\n\n/** Applies a validated semantic HTML ID to the first element emitted for a block. */\nexport function setHTMLIdOnFirstTag(html: string, value: unknown): string {\n\tconst htmlId: string | undefined = normalizeHTMLId(value);\n\treturn htmlId ? setAttrOnFirstTag(html, 'id', escapeAttr(htmlId)) : html;\n}\n\n/** Finds the first opening tag range, treating `>` inside quotes as attribute text. */\nfunction findFirstOpeningTagRange(html: string): { start: number; end: number } | undefined {\n\tlet start: number = html.indexOf('<');\n\twhile (start >= 0) {\n\t\tconst nextChar: string | undefined = html[start + 1];\n\t\tif (nextChar && /[A-Za-z]/.test(nextChar)) {\n\t\t\tlet quote: '\"' | \"'\" | undefined;\n\t\t\tfor (let i = start + 2; i < html.length; i++) {\n\t\t\t\tconst char: string = html[i] ?? '';\n\t\t\t\tif (quote) {\n\t\t\t\t\tif (char === quote) quote = undefined;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '\"' || char === \"'\") {\n\t\t\t\t\tquote = char;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '>') {\n\t\t\t\t\treturn { start, end: i };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tstart = html.indexOf('<', start + 1);\n\t}\n\treturn undefined;\n}\n\n/** Returns the first opening tag of `html` (quote-aware), or `''` if none exists. */\nfunction firstOpeningTag(html: string): string {\n\tconst range: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!range) return '';\n\treturn html.slice(range.start, range.end + 1);\n}\n\n/**\n * DOMPurify config fragment that controls `data-block-id` in the output.\n *\n * `data-block-id` is a `data-*` attribute, which DOMPurify permits by default\n * (`ALLOW_DATA_ATTR`) regardless of `ALLOWED_ATTR`. Excluding it therefore\n * requires `FORBID_ATTR` — this is the load-bearing strip that guarantees clean\n * output even when a third-party `NodeSpec.toHTML` emits its own id (the central\n * injection in `serializeBlock` is merely skipped). Including it needs no special\n * config; the centrally injected attribute passes as a data-* attribute.\n */\nfunction blockIdSanitizeConfig(includeBlockIds: boolean): {\n\treadonly SANITIZE_DOM: false;\n\treadonly FORBID_ATTR?: string[];\n} {\n\treturn preserveHTMLIdSanitizeConfig(...(includeBlockIds ? [] : ['data-block-id']));\n}\n\n/** Serializes a full document to sanitized HTML, wrapping list items in `<ul>`/`<ol>`. */\nexport function serializeDocumentToHTML(\n\tdoc: Document,\n\tregistry?: SchemaRegistry,\n\toptions?: SerializeOptions,\n): string {\n\tconst includeBlockIds: boolean = options?.includeBlockIds !== false;\n\tconst exportCtx: HTMLExportContext = createInlineExportContext();\n\tconst ctx: SerializerContext = { registry, exportCtx, includeBlockIds };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir', 'id'];\n\n\treturn DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: allowedAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t...blockIdSanitizeConfig(includeBlockIds),\n\t});\n}\n\n/**\n * Serializes a document to HTML with CSS class names instead of inline styles.\n * Returns the HTML and a collected stylesheet with only the rules actually used.\n */\nexport function serializeDocumentToCSS(\n\tdoc: Document,\n\tregistry?: SchemaRegistry,\n\toptions?: SerializeOptions,\n): ContentCSSResult {\n\tconst includeBlockIds: boolean = options?.includeBlockIds !== false;\n\tconst collector = new CSSClassCollector();\n\tconst exportCtx: HTMLExportContext = createClassExportContext(collector);\n\tconst ctx: SerializerContext = { registry, collector, exportCtx, includeBlockIds };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst baseAttrs: string[] = registry\n\t\t? registry.getAllowedAttrs()\n\t\t: ['style', 'class', 'dir', 'id'];\n\n\t// In class mode, allow `class` through DOMPurify (it is not a data-* attr, so\n\t// it must be in ALLOWED_ATTR).\n\tconst withClass: string[] = baseAttrs.includes('class')\n\t\t? [...baseAttrs]\n\t\t: [...baseAttrs, 'class'];\n\n\t// Defense-in-depth: strip `style` attribute in class mode to guarantee\n\t// zero inline styles — even from third-party plugins that forgot to use ctx.styleAttr().\n\tconst filteredAttrs: string[] = withClass.filter((attr) => attr !== 'style');\n\n\tconst sanitizedHTML: string = DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: filteredAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t...blockIdSanitizeConfig(includeBlockIds),\n\t});\n\n\treturn { html: sanitizedHTML, css: collector.toCSS(), styleMap: collector.toStyleMap() };\n}\n\n/** Serializes a sequence of blocks to HTML, grouping consecutive list items into wrappers. */\nfunction serializeBlocks(blocks: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tlet i = 0;\n\n\twhile (i < blocks.length) {\n\t\tconst block: BlockNode | undefined = blocks[i];\n\t\tif (!block) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isNodeOfType(block, 'list_item')) {\n\t\t\t// Collect consecutive list items\n\t\t\tconst listItems: BlockNode[] = [];\n\t\t\twhile (i < blocks.length) {\n\t\t\t\tconst item: BlockNode | undefined = blocks[i];\n\t\t\t\tif (!item || !isNodeOfType(item, 'list_item')) break;\n\t\t\t\tlistItems.push(item);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tparts.push(serializeListGroup(listItems, ctx));\n\t\t} else {\n\t\t\tparts.push(serializeBlock(block, ctx));\n\t\t\ti++;\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Serializes a group of consecutive list items into properly nested `<ul>`/`<ol>` wrappers.\n * Uses a stack-based algorithm to handle indent-based nesting.\n * Produces valid HTML5: nested lists open *inside* the parent `<li>`.\n */\nfunction serializeListGroup(items: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tconst stack: { tag: string; indent: number }[] = [];\n\n\tfor (let idx = 0; idx < items.length; idx++) {\n\t\tconst item: BlockNode | undefined = items[idx];\n\t\tif (!item) continue;\n\n\t\tconst listType: string = (item.attrs?.listType as string) ?? 'bullet';\n\t\tconst indent: number = (item.attrs?.indent as number) ?? 0;\n\t\tconst tag: string = listType === 'ordered' ? 'ol' : 'ul';\n\t\t// Pop wrapper levels that are deeper than current indent,\n\t\t// or at the same level when the tag type changes\n\t\twhile (stack.length > 0) {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (!top) break;\n\n\t\t\tif (top.indent > indent) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else if (top.indent === indent && top.tag !== tag) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (stack.length === 0) {\n\t\t\tparts.push(`<${tag}>`);\n\t\t\tstack.push({ tag, indent });\n\t\t} else {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (top && indent > top.indent) {\n\t\t\t\tparts.push(`<${tag}>`);\n\t\t\t\tstack.push({ tag, indent });\n\t\t\t}\n\t\t}\n\n\t\tconst content: string = serializeBlock(item, ctx);\n\n\t\t// Look ahead: if the next item is deeper, strip </li> so the nested\n\t\t// list opens inside this <li> (valid HTML5 nesting).\n\t\tconst nextItem: BlockNode | undefined = items[idx + 1];\n\t\tconst nextIndent: number | undefined = nextItem\n\t\t\t? ((nextItem.attrs?.indent as number) ?? 0)\n\t\t\t: undefined;\n\n\t\tif (nextIndent !== undefined && nextIndent > indent) {\n\t\t\tparts.push(stripTrailingLiClose(content));\n\t\t} else {\n\t\t\tparts.push(content);\n\t\t}\n\t}\n\n\t// Close all remaining open wrappers\n\twhile (stack.length > 0) {\n\t\tconst top = stack.pop();\n\t\tif (!top) break;\n\t\tparts.push(`</${top.tag}>`);\n\t\tif (stack.length > 0) {\n\t\t\tparts.push('</li>');\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/** Removes the trailing `</li>` from serialized list item HTML. */\nfunction stripTrailingLiClose(html: string): string {\n\tconst suffix = '</li>';\n\tif (html.endsWith(suffix)) {\n\t\treturn html.slice(0, -suffix.length);\n\t}\n\treturn html;\n}\n\n/** Serializes a single block to HTML using its NodeSpec. */\nfunction serializeBlock(block: BlockNode, ctx: SerializerContext): string {\n\tconst content: string = isLeafBlock(block)\n\t\t? serializeInlineContent(block, ctx)\n\t\t: serializeBlocks(getBlockChildren(block), ctx);\n\tconst spec = ctx.registry?.getNodeSpec(block.type);\n\n\tlet html: string;\n\tif (spec?.toHTML) {\n\t\thtml = spec.toHTML(block, content, ctx.exportCtx);\n\t} else {\n\t\thtml = `<p>${content || '<br>'}</p>`;\n\t}\n\n\t// Centrally inject `data-block-id` so each `NodeSpec.toHTML` is relieved of\n\t// the responsibility — and the round-trip identity contract holds for every\n\t// block type, including ones added by future plugins. The serializer's\n\t// allowlist passes `data-block-id` through DOMPurify. Skip if the spec\n\t// already emits one (mirrors the existing `dir` defense-in-depth pattern).\n\t// `escapeAttr` is defense-in-depth — `isSafeBlockId` already excludes any\n\t// character that would need escaping. Skipped entirely when the caller opted\n\t// out via `includeBlockIds: false`; the allowlist strip is the guarantee.\n\tif (ctx.includeBlockIds && isSafeBlockId(block.id)) {\n\t\tif (!firstOpeningTag(html).includes(' data-block-id=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'data-block-id', escapeAttr(block.id));\n\t\t}\n\t}\n\n\t// HTML IDs are semantic, document-local targets and therefore independent of\n\t// the editor's internal `data-block-id` wire identity. The model value wins\n\t// over a NodeSpec-provided `id` so serialization can never emit duplicates.\n\thtml = setHTMLIdOnFirstTag(html, block.htmlId);\n\n\t// Inject alignment into the first opening tag (validated against allowlist).\n\tconst rawAlign: string | undefined = (block.attrs as Record<string, unknown>)?.align as\n\t\t| string\n\t\t| undefined;\n\tconst align: string | undefined = rawAlign\n\t\t? (LEGACY_ALIGNMENT_MAP[rawAlign] ?? rawAlign)\n\t\t: undefined;\n\tif (align && align !== 'start' && VALID_ALIGNMENTS.has(align)) {\n\t\tconst safeAlign: string = escapeAttr(align);\n\t\tif (ctx.collector) {\n\t\t\tconst className: string = ctx.collector.getAlignmentClassName(align);\n\t\t\thtml = injectAttrIntoFirstTag(html, 'class', escapeAttr(className));\n\t\t} else {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'style', `text-align: ${safeAlign}`);\n\t\t}\n\t}\n\n\t// Defense-in-depth: inject dir into the first opening tag if not already present.\n\t// NodeSpec toHTML may already inject it; this ensures it survives even without a plugin.\n\tconst dir: string | undefined = (block.attrs as Record<string, unknown>)?.dir as\n\t\t| string\n\t\t| undefined;\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tif (!firstOpeningTag(html).includes(' dir=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'dir', escapeAttr(dir));\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/** Serializes inline children (TextNode + InlineNode) of a block. */\nfunction serializeInlineContent(block: BlockNode, ctx: SerializerContext): string {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tconst merged: readonly (TextNode | InlineNode)[] = mergeAdjacentTextNodes(children);\n\tconst parts: string[] = [];\n\tconst markOrder: Map<string, number> | undefined = ctx.registry\n\t\t? buildMarkOrder(ctx.registry)\n\t\t: undefined;\n\n\tfor (const child of merged) {\n\t\tif (isInlineNode(child)) {\n\t\t\tconst inlineSpec = ctx.registry?.getInlineNodeSpec(child.inlineType);\n\t\t\tif (inlineSpec?.toHTMLString) {\n\t\t\t\tconst inlineHTML: string = inlineSpec.toHTMLString(child);\n\t\t\t\t// Wrap the atomic node in its marks (e.g. a linked inline image → <a><img></a>).\n\t\t\t\tif (ctx.registry && child.marks.length > 0) {\n\t\t\t\t\tparts.push(\n\t\t\t\t\t\tctx.collector\n\t\t\t\t\t\t\t? serializeInlineNodeMarksToClassHTML(\n\t\t\t\t\t\t\t\t\tinlineHTML,\n\t\t\t\t\t\t\t\t\tchild.marks,\n\t\t\t\t\t\t\t\t\tctx.registry,\n\t\t\t\t\t\t\t\t\tctx.collector,\n\t\t\t\t\t\t\t\t\tmarkOrder,\n\t\t\t\t\t\t\t\t\tctx.exportCtx,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: serializeInlineNodeMarksToHTML(\n\t\t\t\t\t\t\t\t\tinlineHTML,\n\t\t\t\t\t\t\t\t\tchild.marks,\n\t\t\t\t\t\t\t\t\tctx.registry,\n\t\t\t\t\t\t\t\t\tmarkOrder,\n\t\t\t\t\t\t\t\t\tctx.exportCtx,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tparts.push(inlineHTML);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ctx.registry && ctx.collector) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToClassHTML(\n\t\t\t\t\tchild.text,\n\t\t\t\t\tchild.marks,\n\t\t\t\t\tctx.registry,\n\t\t\t\t\tctx.collector,\n\t\t\t\t\tmarkOrder,\n\t\t\t\t\tctx.exportCtx,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (ctx.registry) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToHTML(child.text, child.marks, ctx.registry, markOrder, ctx.exportCtx),\n\t\t\t);\n\t\t} else if (child.text !== '') {\n\t\t\tparts.push(escapeHTML(child.text));\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Merges adjacent TextNodes that share identical mark sets.\n * InlineNodes act as merge boundaries.\n */\nfunction mergeAdjacentTextNodes(\n\tchildren: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (children.length <= 1) return children;\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const child of children) {\n\t\tif (isInlineNode(child)) {\n\t\t\tresult.push(child);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, child.marks)) {\n\t\t\tresult[result.length - 1] = {\n\t\t\t\ttype: 'text',\n\t\t\t\ttext: prev.text + child.text,\n\t\t\t\tmarks: prev.marks,\n\t\t\t};\n\t\t} else {\n\t\t\tresult.push(child);\n\t\t}\n\t}\n\n\treturn result;\n}\n","/** Shared, DOM-free table-dimension bounds and normalization. */\n\n/** Smallest supported table column width or row minimum height, in CSS pixels. */\nexport const MIN_TABLE_DIMENSION_PX = 1;\n\n/** Largest supported table column width or row minimum height, in CSS pixels. */\nexport const MAX_TABLE_DIMENSION_PX = 10_000;\n\n/**\n * Normalizes a finite numeric table dimension into the requested bounded range.\n * Non-numeric and non-finite input is rejected with `null`.\n */\nexport function normalizeTableDimensionPx(\n\tvalue: unknown,\n\tminimum = MIN_TABLE_DIMENSION_PX,\n\tmaximum = MAX_TABLE_DIMENSION_PX,\n): number | null {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return null;\n\n\tconst normalizedMinimum: number = normalizeBound(minimum, MIN_TABLE_DIMENSION_PX);\n\tconst normalizedMaximum: number = Math.max(\n\t\tnormalizedMinimum,\n\t\tnormalizeBound(maximum, MAX_TABLE_DIMENSION_PX),\n\t);\n\treturn Math.min(normalizedMaximum, Math.max(normalizedMinimum, value));\n}\n\nfunction normalizeBound(value: number, fallback: number): number {\n\tif (!Number.isFinite(value)) return fallback;\n\treturn Math.min(MAX_TABLE_DIMENSION_PX, Math.max(MIN_TABLE_DIMENSION_PX, value));\n}\n","/**\n * Safe table-dimension parsing and HTML serialization helpers.\n *\n * Table dimensions are stored as finite CSS-pixel numbers. HTML import accepts\n * notectl's numeric wire attributes and a deliberately small conventional\n * subset: unitless numeric presentation attributes and exact `px` CSS values.\n * Arbitrary CSS expressions never cross into document attributes.\n */\n\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport {\n\tMAX_TABLE_DIMENSION_PX,\n\tMIN_TABLE_DIMENSION_PX,\n\tnormalizeTableDimensionPx,\n} from '../model/TableDimensions.js';\n\n/** Canonical HTML metadata carrying one logical column's width in CSS pixels. */\nexport const TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE = 'data-notectl-width-px';\n\n/** Canonical HTML metadata carrying one logical row's minimum height in CSS pixels. */\nexport const TABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE = 'data-notectl-min-height-px';\n\n/** Defensive upper bound for a serialized `<col>` vector. */\nexport const MAX_SERIALIZED_TABLE_COLUMNS = 1_000;\n\n/** HTML's upper bound for a `<col span>` value. */\nexport const MAX_TABLE_COLUMN_SPAN = 1_000;\n\nconst DECIMAL_NUMBER_RE = /^\\d+(?:\\.\\d+)?$/;\nconst CSS_PX_RE = /^(\\d+(?:\\.\\d+)?)px$/i;\nconst POSITIVE_INTEGER_RE = /^\\d+$/;\n\n/** Returns a bounded, finite CSS-pixel value without clamping untrusted serialized input. */\nexport function normalizeSerializedTableDimensionPx(value: unknown): number | undefined {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return undefined;\n\tif (value < MIN_TABLE_DIMENSION_PX || value > MAX_TABLE_DIMENSION_PX) return undefined;\n\treturn normalizeTableDimensionPx(value) ?? undefined;\n}\n\n/** Parses notectl's canonical numeric `data-notectl-*-px` value. */\nexport function parseTableDimensionMetadata(raw: string | null): number | undefined {\n\treturn parseDecimal(raw, false);\n}\n\n/** Parses a conventional numeric or `px` presentation attribute. */\nexport function parseConventionalTableDimension(raw: string | null): number | undefined {\n\treturn parseDecimal(raw, true);\n}\n\n/** Parses an exact CSS `<length>` in pixels. Other units and expressions are rejected. */\nexport function parseCSSTableDimension(raw: string | null): number | undefined {\n\tif (raw === null) return undefined;\n\tconst match: RegExpMatchArray | null = raw.trim().match(CSS_PX_RE);\n\treturn match?.[1] ? parseBoundedNumber(match[1]) : undefined;\n}\n\n/**\n * Reads a dimension from an element using deterministic precedence:\n * notectl metadata, exact CSS properties, then a conventional HTML attribute.\n */\nexport function readTableDimensionPx(\n\telement: HTMLElement,\n\tmetadataAttribute: string,\n\tcssProperties: readonly string[],\n\tconventionalAttribute: string,\n): number | undefined {\n\tconst metadata: number | undefined = parseTableDimensionMetadata(\n\t\telement.getAttribute(metadataAttribute),\n\t);\n\tif (metadata !== undefined) return metadata;\n\n\tfor (const property of cssProperties) {\n\t\tconst cssValue: number | undefined = parseCSSTableDimension(\n\t\t\telement.style.getPropertyValue(property),\n\t\t);\n\t\tif (cssValue !== undefined) return cssValue;\n\t}\n\n\treturn parseConventionalTableDimension(element.getAttribute(conventionalAttribute));\n}\n\n/** Parses a bounded positive integer HTML span, falling back to one when malformed. */\nexport function parseTableColumnSpan(raw: string | null): number {\n\tif (raw === null) return 1;\n\tconst normalized: string = raw.trim();\n\tif (!POSITIVE_INTEGER_RE.test(normalized)) return 1;\n\tconst value: number = Number(normalized);\n\tif (!Number.isSafeInteger(value) || value < 1 || value > MAX_TABLE_COLUMN_SPAN) return 1;\n\treturn value;\n}\n\n/**\n * Normalizes an untrusted logical column-width vector. Invalid entries become\n * automatic (`null`); a vector with no explicit width is omitted.\n */\nexport function normalizeTableColumnWidthsPx(\n\tvalue: unknown,\n): readonly (number | null)[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst widths: (number | null)[] = Array.from(\n\t\tvalue.slice(0, MAX_SERIALIZED_TABLE_COLUMNS),\n\t\t(entry: unknown): number | null => normalizeSerializedTableDimensionPx(entry) ?? null,\n\t);\n\treturn widths.some((width: number | null): boolean => width !== null) ? widths : undefined;\n}\n\n/** True when a table column-width vector contains at least one safe explicit value. */\nexport function hasExplicitTableColumnWidth(value: unknown): boolean {\n\treturn normalizeTableColumnWidthsPx(value) !== undefined;\n}\n\n/**\n * Emits canonical metadata plus mode-aware visual CSS for one safe dimension.\n * `ctx.styleAttr()` remains the sole generated-style path in class/CSP mode.\n */\nexport function serializeTableDimensionAttrs(\n\tmetadataAttribute: string,\n\tcssProperty: 'width' | 'height',\n\tvalue: unknown,\n\tctx?: HTMLExportContext,\n): string {\n\tconst dimension: number | undefined = normalizeSerializedTableDimensionPx(value);\n\tif (dimension === undefined) return '';\n\tconst declarations = `${cssProperty}: ${String(dimension)}px`;\n\tconst styleAttribute: string = ctx?.styleAttr(declarations) ?? ` style=\"${declarations}\"`;\n\treturn ` ${metadataAttribute}=\"${String(dimension)}\"${styleAttribute}`;\n}\n\nfunction parseDecimal(raw: string | null, allowPx: boolean): number | undefined {\n\tif (raw === null) return undefined;\n\tconst normalized: string = raw.trim();\n\tif (DECIMAL_NUMBER_RE.test(normalized)) return parseBoundedNumber(normalized);\n\tif (!allowPx) return undefined;\n\tconst match: RegExpMatchArray | null = normalized.match(CSS_PX_RE);\n\treturn match?.[1] ? parseBoundedNumber(match[1]) : undefined;\n}\n\nfunction parseBoundedNumber(raw: string): number | undefined {\n\tconst value: number = Number(raw);\n\treturn normalizeSerializedTableDimensionPx(value);\n}\n"],"mappings":"wQAkBA,IAAa,EAAgC,wBAG7C,SAAgB,EAAc,GAC7B,OAAO,EAAsB,KAAK,EACnC,CAWA,SAAgB,EAAa,EAAa,GACzC,MAAM,EAAqB,EAAG,aAAa,iBAC3C,GAAK,GACA,EAAc,KACf,EAAK,IAAI,GAEb,OADA,EAAK,IAAI,GACF,EAAQ,EAChB,CCtBA,SAAS,EAAsB,GAC9B,OAAO,EACL,MAAM,KAC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