@shijiu/jsview-vue 2.3.151-test.0 → 2.3.728-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/browser/BrowserJsvLatex.vue.mjs +9 -90
- package/bin/jsview-vue.mjs +5964 -1833
- package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +18 -2
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/Const.d.ts +4 -1
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +225 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +225 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetDebugger.d.ts +5 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +25 -2
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/PageUpdater.d.ts +7 -1
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +25 -5
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/TaskManager.d.ts +2 -1
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/Utils.d.ts +2 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.d.ts +1 -1
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue.d.ts +70 -0
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.d.ts +24 -0
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.d.ts +19 -0
- package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.d.ts +42 -0
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +3 -3
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +2 -1
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +12 -4
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +9 -7
- package/bin/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +17 -7
- package/bin/types/utils/JsViewEngineWidget/index.d.ts +3 -1
- package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.d.ts +0 -1
- package/bin/types/utils/JsViewPlugin/JsvLatex/GetVersion.d.ts +14 -0
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +3 -0
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.d.ts +1 -0
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue.d.ts +4 -1
- package/bin/types/utils/JsViewPlugin/JsvLatex/version.d.mts +29 -2
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +107 -4
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.d.ts +62 -0
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue.d.ts +94 -18
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-wasm.vue.d.ts +611 -0
- package/bin/types/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer.vue.d.ts → JsvPlayerBrowser.vue.d.ts} +24 -23
- package/bin/types/utils/JsViewPlugin/JsvPlayer/index-0.9.d.ts +77 -20
- package/bin/types/utils/JsViewPlugin/JsvPlayer/index.d.ts +77 -20
- package/bin/types/utils/JsViewVueTools/BlobApi.d.ts +38 -0
- package/bin/types/utils/JsViewVueTools/FeatureActive.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvInteractionMode.d.ts +6 -0
- package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +10 -3
- package/bin/types/utils/JsViewVueTools/JsvTextTools.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.d.ts +43 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.d.ts +54 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +13 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +2 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +76 -26
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.d.ts +49 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/index.d.ts +2 -0
- package/bin/types/utils/JsViewVueTools/index.d.ts +3 -1
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +12 -22
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +12 -22
- package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/JsViewHtmlToVNodesOptions.d.ts +101 -0
- package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/JsvDomRenderer.d.ts +61 -0
- package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/htmlToVNodes.d.ts +58 -0
- package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/index.d.ts +1 -0
- package/bin/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +1 -0
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +151 -18
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +2 -1
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/CmdTypes.d.ts +16 -0
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +2 -1
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.d.ts +3 -1
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +55 -12
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +178 -35
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +119 -17
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +9 -3
- package/bin/types/utils/JsViewVueWidget/JsvInput/EditViewOperator.d.ts +4 -1
- package/bin/types/utils/JsViewVueWidget/JsvInput/JsvInput.vue.d.ts +22 -1
- package/bin/types/utils/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvPieChart.vue.d.ts +2 -0
- package/bin/types/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue.d.ts +5 -2
- package/bin/types/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +39 -1
- package/bin/types/utils/JsViewVueWidget/JsvSector.vue.d.ts +1 -0
- package/bin/types/utils/JsViewVueWidget/JsvTextBox.vue.d.ts +15 -3
- package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +22 -96
- package/bin/types/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue.d.ts +6 -0
- package/bin/types/utils/JsViewVueWidget/{JsvPosterDiv.vue.d.ts → TypesDiv/JsvPosterDiv.vue.d.ts} +9 -0
- package/bin/types/utils/JsViewVueWidget/{JsvPosterImage.vue.d.ts → TypesDiv/JsvPosterImage.vue.d.ts} +15 -3
- package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue.d.ts +72 -0
- package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue.d.ts +90 -0
- package/bin/types/utils/JsViewVueWidget/index.d.ts +6 -3
- package/dist/types/utils/JsViewEngineWidget/CheckType.d.ts +7 -0
- package/dist/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue.d.ts +106 -0
- package/dist/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +128 -0
- package/dist/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +25 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/Const.d.ts +23 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +12 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +9 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +16 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +412 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +751 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetDebugger.d.ts +9 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +82 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/PageUpdater.d.ts +31 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +80 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/Slide.d.ts +25 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/SlotComponent.vue.d.ts +52 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/TaskManager.d.ts +69 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/TokenGenerator.d.ts +4 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/Utils.d.ts +6 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/VisibleInfo.d.ts +20 -0
- package/dist/types/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.d.ts +21 -0
- package/dist/types/utils/JsViewEngineWidget/RangeModel.d.ts +166 -0
- package/dist/types/utils/JsViewEngineWidget/RectUtils.d.ts +61 -0
- package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue.d.ts +74 -0
- package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.d.ts +28 -0
- package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.d.ts +23 -0
- package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.d.ts +46 -0
- package/dist/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +42 -0
- package/dist/types/utils/JsViewEngineWidget/TemplateParser/Fence.d.ts +62 -0
- package/dist/types/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +21 -0
- package/dist/types/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +103 -0
- package/dist/types/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +28 -0
- package/dist/types/utils/JsViewEngineWidget/TemplateParser/index.d.ts +8 -0
- package/dist/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +160 -0
- package/dist/types/utils/JsViewEngineWidget/index.d.ts +21 -0
- package/dist/types/utils/JsViewPlugin/JsvAccount/JsvAccount.d.ts +46 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/AudioProxy.d.ts +6 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue.d.ts +22 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue.d.ts +212 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/CheckType.d.ts +6 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/Events.d.ts +17 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/JsvAudio.vue.d.ts +22 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.d.ts +12 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/JsvAudioProxy.vue.d.ts +6 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/PluginLoader.d.ts +5 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/ScreenLockManager.d.ts +9 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/index.d.ts +7 -0
- package/dist/types/utils/JsViewPlugin/JsvAudio/version.d.mts +14 -0
- package/{bin/types/utils/JsViewPlugin/JsvLatex → dist/types/utils/JsViewPlugin/JsvAudio}/version.d.ts +5 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.d.ts +0 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +17 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/Color.d.ts +5 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/GetVersion.d.ts +18 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +46 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.d.ts +8 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue.d.ts +9 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/PluginLoader.d.ts +5 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/index.d.ts +8 -0
- package/dist/types/utils/JsViewPlugin/JsvLatex/version.d.mts +40 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/GetVersion.d.ts +13 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +523 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.d.ts +119 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue.d.ts +664 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-0.9.vue.d.ts +45 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-wasm.vue.d.ts +611 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue.d.ts +597 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/index-0.9.d.ts +415 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/index.d.ts +415 -0
- package/dist/types/utils/JsViewPlugin/JsvPlayer/version.d.mts +14 -0
- package/dist/types/utils/JsViewPlugin/index.d.ts +7 -0
- package/dist/types/utils/JsViewVueTools/BlobApi.d.ts +42 -0
- package/dist/types/utils/JsViewVueTools/ConstSymbol.d.ts +6 -0
- package/dist/types/utils/JsViewVueTools/DebugContentShellJBridge.d.ts +10 -0
- package/dist/types/utils/JsViewVueTools/DebugTool.d.ts +12 -0
- package/dist/types/utils/JsViewVueTools/DefaultKeyMap.d.ts +14 -0
- package/dist/types/utils/JsViewVueTools/FeatureActive.d.ts +15 -0
- package/dist/types/utils/JsViewVueTools/ForgeConstDefine.d.ts +15 -0
- package/dist/types/utils/JsViewVueTools/ForgeHandles.d.ts +11 -0
- package/dist/types/utils/JsViewVueTools/JsvDynamicCssStyle.d.ts +33 -0
- package/dist/types/utils/JsViewVueTools/JsvDynamicKeyFrames.d.ts +40 -0
- package/dist/types/utils/JsViewVueTools/JsvFederationTools.d.ts +20 -0
- package/dist/types/utils/JsViewVueTools/JsvHashHistory.d.ts +20 -0
- package/dist/types/utils/JsViewVueTools/JsvImpactTracer.d.ts +44 -0
- package/dist/types/utils/JsViewVueTools/JsvInteractionMode.d.ts +10 -0
- package/dist/types/utils/JsViewVueTools/JsvPerformance.d.ts +9 -0
- package/dist/types/utils/JsViewVueTools/JsvPreDownloader.d.ts +55 -0
- package/dist/types/utils/JsViewVueTools/JsvRefTaker.d.ts +52 -0
- package/dist/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +378 -0
- package/dist/types/utils/JsViewVueTools/JsvStyleClass.d.ts +35 -0
- package/dist/types/utils/JsViewVueTools/JsvStyleSheetsDeclarer.d.ts +35 -0
- package/dist/types/utils/JsViewVueTools/JsvTextTools.d.ts +66 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureDefines.d.ts +10 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureLoadTool.d.ts +67 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.d.ts +47 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.d.ts +99 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.d.ts +20 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.d.ts +58 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +113 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +17 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +170 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/Store.d.ts +16 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/Texture.d.ts +31 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.d.ts +53 -0
- package/dist/types/utils/JsViewVueTools/JsvTextureStore/index.d.ts +6 -0
- package/dist/types/utils/JsViewVueTools/NinePatchHelper.d.ts +25 -0
- package/dist/types/utils/JsViewVueTools/TextureManagerTools.d.ts +11 -0
- package/dist/types/utils/JsViewVueTools/TypeCheckAndSet.d.ts +7 -0
- package/dist/types/utils/JsViewVueTools/index.d.ts +29 -0
- package/dist/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +124 -0
- package/dist/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +148 -0
- package/dist/types/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.d.ts +35 -0
- package/dist/types/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue.d.ts +102 -0
- package/dist/types/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.d.ts +37 -0
- package/dist/types/utils/JsViewVueWidget/JsvActorMove/index.d.ts +8 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +15 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +77 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +54 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +13 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +44 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +17 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.d.ts +13 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/BrowserApicLib.d.ts +3 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/GifData.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/NormalLoopTool.d.ts +7 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/PartLoopTool.d.ts +12 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/SingleLoopTool.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +20 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/WebpData.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvApic/JsvCommonLoopToolBase.d.ts +26 -0
- package/dist/types/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +74 -0
- package/dist/types/utils/JsViewVueWidget/JsvClipDiv/index.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvConnectLine/ArcLineManager.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +34 -0
- package/dist/types/utils/JsViewVueWidget/JsvConnectLine/index.d.ts +6 -0
- package/dist/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +33 -0
- package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/JsViewHtmlToVNodesOptions.d.ts +105 -0
- package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/JsvDomRenderer.d.ts +65 -0
- package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/htmlToVNodes.d.ts +62 -0
- package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/index.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvDragBox/JsvDragBox.vue.d.ts +109 -0
- package/dist/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +108 -0
- package/dist/types/utils/JsViewVueWidget/JsvDriftScope/index.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvEnableRenderBreak.vue.d.ts +61 -0
- package/dist/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +91 -0
- package/dist/types/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue.d.ts +106 -0
- package/dist/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +100 -0
- package/dist/types/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue.d.ts +108 -0
- package/dist/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +7 -0
- package/dist/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +63 -0
- package/dist/types/utils/JsViewVueWidget/JsvFragShaderView/index.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.d.ts +4 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +228 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActorState.d.ts +6 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +16 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/CmdTypes.d.ts +16 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +20 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +106 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvFreeMoveActor.vue.d.ts +107 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/KeepFlags.d.ts +11 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.d.ts +12 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +118 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +244 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +169 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.d.ts +22 -0
- package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +24 -0
- package/dist/types/utils/JsViewVueWidget/JsvGrid.vue.d.ts +241 -0
- package/dist/types/utils/JsViewVueWidget/JsvHole.d.ts +19 -0
- package/dist/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +16 -0
- package/dist/types/utils/JsViewVueWidget/JsvInput/EditViewOperator.d.ts +52 -0
- package/dist/types/utils/JsViewVueWidget/JsvInput/EditVisibleArea.d.ts +30 -0
- package/dist/types/utils/JsViewVueWidget/JsvInput/JsvInput.vue.d.ts +98 -0
- package/dist/types/utils/JsViewVueWidget/JsvInput/SharedDefine.d.ts +17 -0
- package/dist/types/utils/JsViewVueWidget/JsvInput/SystemTextTools.d.ts +20 -0
- package/dist/types/utils/JsViewVueWidget/JsvInput/index.d.ts +8 -0
- package/dist/types/utils/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +32 -0
- package/dist/types/utils/JsViewVueWidget/JsvLine/LineManager.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvLine/index.d.ts +6 -0
- package/dist/types/utils/JsViewVueWidget/JsvMarquee.vue.d.ts +33 -0
- package/dist/types/utils/JsViewVueWidget/JsvMaskClipDiv.vue.d.ts +101 -0
- package/dist/types/utils/JsViewVueWidget/JsvMindMap/CommonType.d.ts +1 -0
- package/dist/types/utils/JsViewVueWidget/JsvMindMap/Constant.d.ts +13 -0
- package/dist/types/utils/JsViewVueWidget/JsvMindMap/DataTree.d.ts +75 -0
- package/dist/types/utils/JsViewVueWidget/JsvMindMap/Geometry.d.ts +72 -0
- package/dist/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +235 -0
- package/dist/types/utils/JsViewVueWidget/JsvMindMap/index.d.ts +5 -0
- package/dist/types/utils/JsViewVueWidget/JsvMindMap/rtree.d.ts +44 -0
- package/dist/types/utils/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +93 -0
- package/dist/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +55 -0
- package/dist/types/utils/JsViewVueWidget/JsvPieChart.vue.d.ts +30 -0
- package/dist/types/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue.d.ts +68 -0
- package/dist/types/utils/JsViewVueWidget/JsvPreload/index.d.ts +6 -0
- package/dist/types/utils/JsViewVueWidget/JsvProgressBar.vue.d.ts +31 -0
- package/dist/types/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue.d.ts +85 -0
- package/dist/types/utils/JsViewVueWidget/JsvRadarChart.vue.d.ts +37 -0
- package/dist/types/utils/JsViewVueWidget/JsvRipple/Constant.d.ts +8 -0
- package/dist/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +129 -0
- package/dist/types/utils/JsViewVueWidget/JsvRipple/index.d.ts +7 -0
- package/dist/types/utils/JsViewVueWidget/JsvScaleTextBox.vue.d.ts +28 -0
- package/dist/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +278 -0
- package/dist/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +157 -0
- package/dist/types/utils/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.d.ts +8 -0
- package/dist/types/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +16 -0
- package/dist/types/utils/JsViewVueWidget/JsvScrollBox/index.d.ts +7 -0
- package/dist/types/utils/JsViewVueWidget/JsvSector.vue.d.ts +30 -0
- package/dist/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +76 -0
- package/dist/types/utils/JsViewVueWidget/JsvSoundPool.d.ts +114 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +58 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/FrameBuidler.d.ts +18 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +70 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue.d.ts +85 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteTools.d.ts +15 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.d.ts +21 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/index.d.ts +9 -0
- package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/sAnimationToken.d.ts +6 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper/Indicator.vue.d.ts +16 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +141 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +248 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +181 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper/index.d.ts +8 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue.d.ts +16 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +121 -0
- package/dist/types/utils/JsViewVueWidget/JsvSwiper3D/index.d.ts +6 -0
- package/dist/types/utils/JsViewVueWidget/JsvTextBox.vue.d.ts +121 -0
- package/dist/types/utils/JsViewVueWidget/JsvTextureAnim/CommonType.d.ts +6 -0
- package/dist/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +38 -0
- package/dist/types/utils/JsViewVueWidget/JsvTextureAnim/index.d.ts +8 -0
- package/dist/types/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue.d.ts +109 -0
- package/dist/types/utils/JsViewVueWidget/JsvVideo.vue.d.ts +23 -0
- package/dist/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +109 -0
- package/dist/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +88 -0
- package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvPosterDiv.vue.d.ts +94 -0
- package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvPosterImage.vue.d.ts +115 -0
- package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue.d.ts +94 -0
- package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue.d.ts +115 -0
- package/dist/types/utils/JsViewVueWidget/index.d.ts +53 -0
- package/dist/types/utils/index.d.ts +8 -0
- package/dist/utils/browser/BrowserAudio.vue.mjs +258 -0
- package/dist/utils/browser/BrowserJsvLatex.vue.mjs +64 -0
- package/dist/utils/export-sfc.mjs +12 -0
- package/dist/utils/index.mjs +29000 -0
- package/dist/utils/jsview-vue-common.mjs +39 -0
- package/package.json +1 -1
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +32 -16
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.ts +24 -2
- package/utils/JsViewEngineWidget/MetroWidget/Const.ts +5 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +193 -89
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +325 -155
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetDebugger.ts +15 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +1035 -370
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +41 -23
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +138 -41
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +1 -0
- package/utils/JsViewEngineWidget/MetroWidget/Utils.ts +6 -0
- package/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.ts +2 -1
- package/utils/JsViewEngineWidget/RectUtils.js +1 -1
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue +62 -0
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.ts +260 -0
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.ts +32 -0
- package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.ts +236 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +329 -230
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +101 -27
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +54 -5
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +109 -41
- package/utils/JsViewEngineWidget/WidgetCommon.ts +17 -7
- package/utils/JsViewEngineWidget/index.ts +7 -2
- package/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.js +46 -46
- package/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue +54 -41
- package/utils/JsViewPlugin/JsvLatex/Color.ts +104 -39
- package/utils/JsViewPlugin/JsvLatex/GetVersion.js +65 -0
- package/utils/JsViewPlugin/JsvLatex/JsvLatex.vue +71 -17
- package/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.js +10 -0
- package/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue +14 -2
- package/utils/JsViewPlugin/JsvLatex/PluginLoader.js +63 -31
- package/utils/JsViewPlugin/JsvLatex/version.mjs +26 -13
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +2 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +402 -23
- package/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.js +100 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +363 -468
- package/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer.vue → JsvPlayerBrowser-wasm.vue} +60 -10
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +511 -0
- package/utils/JsViewPlugin/JsvPlayer/index-0.9.js +52 -10
- package/utils/JsViewPlugin/JsvPlayer/index.js +58 -9
- package/utils/JsViewPlugin/JsvPlayer/package.json +8 -0
- package/utils/JsViewVueTools/BlobApi.ts +55 -0
- package/utils/JsViewVueTools/FeatureActive.ts +3 -0
- package/utils/JsViewVueTools/ForgeHandles.ts +3 -0
- package/utils/JsViewVueTools/JsvInteractionMode.js +16 -0
- package/utils/JsViewVueTools/JsvPreDownloader.ts +2 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +40 -19
- package/utils/JsViewVueTools/JsvTextTools.ts +9 -1
- package/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.ts +180 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +1 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.ts +304 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -0
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +16 -1
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +154 -69
- package/utils/JsViewVueTools/JsvTextureStore/Store.ts +1 -1
- package/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.ts +92 -0
- package/utils/JsViewVueTools/JsvTextureStore/index.js +2 -0
- package/utils/JsViewVueTools/index.js +3 -1
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +111 -86
- package/utils/JsViewVueWidget/JsvDomRenderer/JsViewHtmlToVNodesOptions.ts +212 -0
- package/utils/JsViewVueWidget/JsvDomRenderer/JsvDomRenderer.ts +146 -0
- package/utils/JsViewVueWidget/JsvDomRenderer/htmlToVNodes.ts +748 -0
- package/utils/JsViewVueWidget/JsvDomRenderer/index.ts +1 -0
- package/utils/JsViewVueWidget/JsvDragBox/JsvDragBox.vue +10 -1
- package/utils/JsViewVueWidget/JsvEnableRenderBreak.vue +6 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +11 -5
- package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +3 -1
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +23 -11
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +269 -26
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +2 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CmdTypes.ts +24 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +3 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/{FreeMoveActor.vue → JsvFreeMoveActor.vue} +5 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.ts +10 -2
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +223 -100
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +245 -64
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +95 -29
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +27 -5
- package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +11 -2
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +29 -2
- package/utils/JsViewVueWidget/JsvLine/JsvLine.vue +24 -7
- package/utils/JsViewVueWidget/JsvMarquee.vue +1 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +12 -10
- package/utils/JsViewVueWidget/JsvNinePatch.vue +22 -12
- package/utils/JsViewVueWidget/JsvPieChart.vue +93 -70
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +32 -29
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +2 -1
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +56 -25
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +11 -11
- package/utils/JsViewVueWidget/JsvSector.vue +66 -28
- package/utils/JsViewVueWidget/JsvTextBox.vue +30 -1
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +315 -305
- package/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue +56 -14
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +8 -6
- package/utils/JsViewVueWidget/TypesDiv/JsvPosterDiv.vue +54 -0
- package/utils/JsViewVueWidget/TypesDiv/JsvPosterImage.vue +88 -0
- package/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue +177 -0
- package/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue +267 -0
- package/utils/JsViewVueWidget/index.js +7 -2
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.d.ts +0 -7
- package/utils/JsViewPlugin/JsvLatex/version.js +0 -24
- package/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.ts +0 -36
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +0 -56
- package/utils/JsViewVueWidget/JsvPosterImage.vue +0 -105
- /package/bin/types/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer-0.9.vue.d.ts → JsvPlayerBrowser-0.9.vue.d.ts} +0 -0
- /package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/{FreeMoveActor.vue.d.ts → JsvFreeMoveActor.vue.d.ts} +0 -0
- /package/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer-0.9.vue → JsvPlayerBrowser-0.9.vue} +0 -0
|
@@ -0,0 +1,748 @@
|
|
|
1
|
+
import { h, isVNode, type Component, type VNodeChild } from "vue";
|
|
2
|
+
import { JsvLatex, processLatexStr } from "../../JsViewPlugin/JsvLatex";
|
|
3
|
+
import { JsvFlexDiv } from "../JsvFlexCell";
|
|
4
|
+
|
|
5
|
+
export type DomJsonNode = DomJsonElement | DomJsonText;
|
|
6
|
+
|
|
7
|
+
export interface DomJsonElement {
|
|
8
|
+
type: "element";
|
|
9
|
+
tag: string;
|
|
10
|
+
attrs: Record<string, string>;
|
|
11
|
+
children: DomJsonNode[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface DomJsonText {
|
|
15
|
+
type: "text";
|
|
16
|
+
content: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface TagHookContext {
|
|
20
|
+
// 当前节点的标签名(已转为小写)
|
|
21
|
+
tag: string;
|
|
22
|
+
// 当前节点原始属性(来自 HTML)
|
|
23
|
+
attrs: Record<string, string>;
|
|
24
|
+
// 当前节点子树提取出的纯文本(用于上标/下标等语义转换)
|
|
25
|
+
childrenText: string;
|
|
26
|
+
// 父节点标签名(已转为小写)
|
|
27
|
+
parentTag?: string;
|
|
28
|
+
// 在父节点 children 中的位置(从 0 开始)
|
|
29
|
+
indexInParent?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface TagHookResult {
|
|
33
|
+
// 替换标签名(如把 span 替换成 div)
|
|
34
|
+
tag?: string;
|
|
35
|
+
// 直接替换为组件(如 JsvFlexDiv)
|
|
36
|
+
component?: Component;
|
|
37
|
+
// 直接覆盖/补充渲染 props(如给组件传 style 对象)
|
|
38
|
+
props?: Record<string, unknown>;
|
|
39
|
+
// 是否在 children 前插入项目符号(内部布局标记,不下发为属性)
|
|
40
|
+
prependBullet?: boolean;
|
|
41
|
+
// 覆盖当前节点属性
|
|
42
|
+
attrs?: Record<string, string>;
|
|
43
|
+
// 为 true 时直接丢弃该节点
|
|
44
|
+
drop?: boolean;
|
|
45
|
+
// 返回文本节点内容(如把 br 转成 "\n")
|
|
46
|
+
text?: string;
|
|
47
|
+
// 给替换后的标签设置文本子内容(如 div + "\n")
|
|
48
|
+
childrenText?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface StyleHookContext {
|
|
52
|
+
// 当前 style 属性名(单条)
|
|
53
|
+
property: string;
|
|
54
|
+
// 当前 style 属性值(单条)
|
|
55
|
+
value: string;
|
|
56
|
+
// 该 style 所属的标签名
|
|
57
|
+
tag: string;
|
|
58
|
+
// 该标签的原始属性
|
|
59
|
+
attrs: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface StyleHookResult {
|
|
63
|
+
// 替换 style 属性名
|
|
64
|
+
property?: string;
|
|
65
|
+
// 替换 style 属性值
|
|
66
|
+
value?: string;
|
|
67
|
+
// 为 true 时删除这条 style
|
|
68
|
+
drop?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface TextHookContext {
|
|
72
|
+
text: string;
|
|
73
|
+
key?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface HtmlToVNodesOptions {
|
|
77
|
+
// 标签级别 hook:可改标签、改属性、删节点或改成文本节点
|
|
78
|
+
onTag?: (ctx: TagHookContext) => TagHookResult | string | void;
|
|
79
|
+
// 样式级别 hook:逐条处理 style
|
|
80
|
+
onStyle?: (ctx: StyleHookContext) => StyleHookResult | void;
|
|
81
|
+
// 文本级别 hook:可把文本改写成任意 VNodeChild(如 JsvLatex)
|
|
82
|
+
onText?: (ctx: TextHookContext) => VNodeChild | void;
|
|
83
|
+
// 文本转 JsvLatex 的渲染参数
|
|
84
|
+
latex?: {
|
|
85
|
+
enabled?: boolean;
|
|
86
|
+
width?: number;
|
|
87
|
+
fontSize?: number;
|
|
88
|
+
lineSpace?: number;
|
|
89
|
+
color?: string;
|
|
90
|
+
instantLoad?: boolean;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function parseStyleText(styleText: string): Array<{ property: string; value: string }> {
|
|
95
|
+
return styleText
|
|
96
|
+
.split(";")
|
|
97
|
+
.map((part) => part.trim())
|
|
98
|
+
.filter(Boolean)
|
|
99
|
+
.map((part) => {
|
|
100
|
+
const idx = part.indexOf(":");
|
|
101
|
+
if (idx < 0) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const property = part.slice(0, idx).trim();
|
|
105
|
+
const value = part.slice(idx + 1).trim();
|
|
106
|
+
if (!property) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return { property, value };
|
|
110
|
+
})
|
|
111
|
+
.filter((item): item is { property: string; value: string } => item !== null);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function serializeStyle(styleEntries: Array<{ property: string; value: string }>): string {
|
|
115
|
+
return styleEntries.map((entry) => `${entry.property}: ${entry.value}`).join("; ");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function applyTagHook(
|
|
119
|
+
tag: string,
|
|
120
|
+
attrs: Record<string, string>,
|
|
121
|
+
childrenText: string,
|
|
122
|
+
parentTag: string | undefined,
|
|
123
|
+
indexInParent: number | undefined,
|
|
124
|
+
options?: HtmlToVNodesOptions
|
|
125
|
+
): {
|
|
126
|
+
tag: string;
|
|
127
|
+
component?: Component;
|
|
128
|
+
props?: Record<string, unknown>;
|
|
129
|
+
prependBullet?: boolean;
|
|
130
|
+
attrs: Record<string, string>;
|
|
131
|
+
drop: boolean;
|
|
132
|
+
text?: string;
|
|
133
|
+
childrenText?: string;
|
|
134
|
+
} {
|
|
135
|
+
const lowerTag = tag.toLowerCase();
|
|
136
|
+
|
|
137
|
+
if (!options?.onTag) {
|
|
138
|
+
return { tag: lowerTag, attrs, drop: false };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const result = options.onTag({
|
|
142
|
+
tag: lowerTag,
|
|
143
|
+
attrs: { ...attrs },
|
|
144
|
+
childrenText,
|
|
145
|
+
parentTag,
|
|
146
|
+
indexInParent,
|
|
147
|
+
});
|
|
148
|
+
if (!result) {
|
|
149
|
+
return { tag: lowerTag, attrs, drop: false };
|
|
150
|
+
}
|
|
151
|
+
if (typeof result === "string") {
|
|
152
|
+
return { tag: result.toLowerCase(), attrs, drop: false };
|
|
153
|
+
}
|
|
154
|
+
if (result.drop) {
|
|
155
|
+
return { tag: lowerTag, attrs, drop: true };
|
|
156
|
+
}
|
|
157
|
+
if (result.text !== undefined) {
|
|
158
|
+
return { tag: lowerTag, attrs, drop: false, text: result.text };
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
tag: (result.tag ?? lowerTag).toLowerCase(),
|
|
162
|
+
component: result.component,
|
|
163
|
+
props: result.props,
|
|
164
|
+
prependBullet: result.prependBullet,
|
|
165
|
+
attrs: result.attrs ?? attrs,
|
|
166
|
+
drop: false,
|
|
167
|
+
childrenText: result.childrenText,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function applyStyleHook(
|
|
172
|
+
tag: string,
|
|
173
|
+
attrs: Record<string, string>,
|
|
174
|
+
options?: HtmlToVNodesOptions
|
|
175
|
+
): Record<string, string> {
|
|
176
|
+
const styleText = attrs.style;
|
|
177
|
+
if (!styleText) {
|
|
178
|
+
return attrs;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const entries = parseStyleText(styleText);
|
|
182
|
+
const nextEntries: Array<{ property: string; value: string }> = [];
|
|
183
|
+
|
|
184
|
+
for (const entry of entries) {
|
|
185
|
+
if (!options?.onStyle) {
|
|
186
|
+
nextEntries.push(entry);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const result = options.onStyle({
|
|
191
|
+
property: entry.property,
|
|
192
|
+
value: entry.value,
|
|
193
|
+
tag,
|
|
194
|
+
attrs: { ...attrs },
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (!result) {
|
|
198
|
+
nextEntries.push(entry);
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (result.drop) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
nextEntries.push({
|
|
205
|
+
property: result.property ?? entry.property,
|
|
206
|
+
value: result.value ?? entry.value,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const nextAttrs = { ...attrs };
|
|
211
|
+
if (nextEntries.length === 0) {
|
|
212
|
+
delete nextAttrs.style;
|
|
213
|
+
} else {
|
|
214
|
+
nextAttrs.style = serializeStyle(nextEntries);
|
|
215
|
+
}
|
|
216
|
+
return nextAttrs;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function applyTextHook(text: string, key?: string, options?: HtmlToVNodesOptions): VNodeChild {
|
|
220
|
+
if (!options?.onText) {
|
|
221
|
+
return text;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const result = options.onText({ text, key });
|
|
225
|
+
if (result === undefined) {
|
|
226
|
+
return text;
|
|
227
|
+
}
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function domNodeToJson(node: Node): DomJsonNode | null {
|
|
232
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
233
|
+
const content = node.textContent ?? "";
|
|
234
|
+
if (content.trim() === "") {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
type: "text",
|
|
239
|
+
content,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const element = node as Element;
|
|
248
|
+
const attrs: Record<string, string> = {};
|
|
249
|
+
|
|
250
|
+
for (const attr of Array.from(element.attributes)) {
|
|
251
|
+
attrs[attr.name] = attr.value;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const children = Array.from(element.childNodes)
|
|
255
|
+
.map((child) => domNodeToJson(child))
|
|
256
|
+
.filter((item): item is DomJsonNode => item !== null);
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
type: "element",
|
|
260
|
+
tag: element.tagName.toLowerCase(),
|
|
261
|
+
attrs,
|
|
262
|
+
children,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function normalizeAttrs(attrs: Record<string, string>): Record<string, unknown> {
|
|
267
|
+
const result: Record<string, unknown> = {};
|
|
268
|
+
|
|
269
|
+
for (const [name, value] of Object.entries(attrs)) {
|
|
270
|
+
if (name.toLowerCase() === "class") {
|
|
271
|
+
result.class = value;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (name.toLowerCase() === "style") {
|
|
275
|
+
result.style = value;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
result[name] = value;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return result;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function decodeHtmlEntities(text: string): string {
|
|
285
|
+
return text
|
|
286
|
+
.replace(/ /g, " ")
|
|
287
|
+
.replace(/</g, "<")
|
|
288
|
+
.replace(/>/g, ">")
|
|
289
|
+
.replace(/&/g, "&")
|
|
290
|
+
.replace(/"/g, '"')
|
|
291
|
+
.replace(/'/g, "'")
|
|
292
|
+
.replace(/&#(\d+);/g, (_, code) => String.fromCharCode(Number(code)));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function parseAttributes(raw: string): Record<string, string> {
|
|
296
|
+
const attrs: Record<string, string> = {};
|
|
297
|
+
const attrRegex =
|
|
298
|
+
/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;
|
|
299
|
+
let match: RegExpExecArray | null = null;
|
|
300
|
+
|
|
301
|
+
while ((match = attrRegex.exec(raw)) !== null) {
|
|
302
|
+
const name = match[1];
|
|
303
|
+
const value = match[2] ?? match[3] ?? match[4] ?? "";
|
|
304
|
+
attrs[name] = decodeHtmlEntities(value);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return attrs;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function findTagEnd(html: string, start: number): number {
|
|
311
|
+
let inSingleQuote = false;
|
|
312
|
+
let inDoubleQuote = false;
|
|
313
|
+
|
|
314
|
+
for (let i = start; i < html.length; i++) {
|
|
315
|
+
const ch = html[i];
|
|
316
|
+
if (ch === "'" && !inDoubleQuote) {
|
|
317
|
+
inSingleQuote = !inSingleQuote;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (ch === '"' && !inSingleQuote) {
|
|
321
|
+
inDoubleQuote = !inDoubleQuote;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (ch === ">" && !inSingleQuote && !inDoubleQuote) {
|
|
325
|
+
return i;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return -1;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function parseHtmlWithSimpleParser(html: string): DomJsonNode[] {
|
|
333
|
+
const root: DomJsonElement = {
|
|
334
|
+
type: "element",
|
|
335
|
+
tag: "__root__",
|
|
336
|
+
attrs: {},
|
|
337
|
+
children: [],
|
|
338
|
+
};
|
|
339
|
+
const stack: DomJsonElement[] = [root];
|
|
340
|
+
const voidTags = new Set([
|
|
341
|
+
"br",
|
|
342
|
+
"img",
|
|
343
|
+
"hr",
|
|
344
|
+
"input",
|
|
345
|
+
"meta",
|
|
346
|
+
"link",
|
|
347
|
+
"source",
|
|
348
|
+
"track",
|
|
349
|
+
"wbr",
|
|
350
|
+
]);
|
|
351
|
+
|
|
352
|
+
let i = 0;
|
|
353
|
+
while (i < html.length) {
|
|
354
|
+
if (html.startsWith("<!--", i)) {
|
|
355
|
+
const commentEnd = html.indexOf("-->", i + 4);
|
|
356
|
+
i = commentEnd >= 0 ? commentEnd + 3 : html.length;
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (html[i] === "<") {
|
|
361
|
+
const tagEnd = findTagEnd(html, i + 1);
|
|
362
|
+
if (tagEnd < 0) {
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const rawTag = html.slice(i + 1, tagEnd).trim();
|
|
367
|
+
i = tagEnd + 1;
|
|
368
|
+
if (!rawTag) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (rawTag.startsWith("/")) {
|
|
373
|
+
const closeTag = rawTag.slice(1).trim().toLowerCase();
|
|
374
|
+
while (stack.length > 1) {
|
|
375
|
+
const top = stack.pop();
|
|
376
|
+
if (top?.tag === closeTag) {
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const selfClosing = rawTag.endsWith("/");
|
|
384
|
+
const tagBody = selfClosing ? rawTag.slice(0, -1).trim() : rawTag;
|
|
385
|
+
const firstSpaceIdx = tagBody.search(/\s/);
|
|
386
|
+
const tagName =
|
|
387
|
+
(firstSpaceIdx >= 0 ? tagBody.slice(0, firstSpaceIdx) : tagBody).toLowerCase();
|
|
388
|
+
const attrText = firstSpaceIdx >= 0 ? tagBody.slice(firstSpaceIdx + 1) : "";
|
|
389
|
+
|
|
390
|
+
if (!tagName) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const elementNode: DomJsonElement = {
|
|
395
|
+
type: "element",
|
|
396
|
+
tag: tagName,
|
|
397
|
+
attrs: parseAttributes(attrText),
|
|
398
|
+
children: [],
|
|
399
|
+
};
|
|
400
|
+
stack[stack.length - 1].children.push(elementNode);
|
|
401
|
+
|
|
402
|
+
if (!selfClosing && !voidTags.has(tagName)) {
|
|
403
|
+
stack.push(elementNode);
|
|
404
|
+
}
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
const nextTag = html.indexOf("<", i);
|
|
409
|
+
const textEnd = nextTag < 0 ? html.length : nextTag;
|
|
410
|
+
const rawText = html.slice(i, textEnd);
|
|
411
|
+
i = textEnd;
|
|
412
|
+
|
|
413
|
+
const decoded = decodeHtmlEntities(rawText);
|
|
414
|
+
if (decoded.trim() === "") {
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
stack[stack.length - 1].children.push({
|
|
419
|
+
type: "text",
|
|
420
|
+
content: decoded,
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return root.children;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function htmlToDomJson(html: string): DomJsonNode[] {
|
|
428
|
+
// 固定使用轻量解析器,避免 JsView 环境下 DOMParser 兼容性问题
|
|
429
|
+
return parseHtmlWithSimpleParser(html);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function mergeAdjacentTextVNodes(nodes: VNodeChild[], options?: HtmlToVNodesOptions): VNodeChild[] {
|
|
433
|
+
const merged: VNodeChild[] = [];
|
|
434
|
+
|
|
435
|
+
for (const node of nodes) {
|
|
436
|
+
const prev = merged[merged.length - 1];
|
|
437
|
+
if (typeof node === "string" && typeof prev === "string") {
|
|
438
|
+
merged[merged.length - 1] = prev + node;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
merged.push(node);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const latexOptions = options?.latex ?? {};
|
|
445
|
+
const renderAsLatex = latexOptions.enabled ?? true;
|
|
446
|
+
let latexKey = 0;
|
|
447
|
+
return merged.map((node) => {
|
|
448
|
+
if (typeof node !== "string") {
|
|
449
|
+
return node;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const latexStr = processLatexStr(node) ?? node;
|
|
453
|
+
const key = `latex-${latexKey++}`;
|
|
454
|
+
if (renderAsLatex) {
|
|
455
|
+
const width = latexOptions.width ?? 1000;
|
|
456
|
+
const fontSize = latexOptions.fontSize ?? 16;
|
|
457
|
+
const lineSpace = latexOptions.lineSpace ?? 2;
|
|
458
|
+
const color = latexOptions.color ?? "#000000";
|
|
459
|
+
const forceRefreshKey = `${key}-${width}-${fontSize}-${lineSpace}-${color}`;
|
|
460
|
+
return h(JsvLatex, {
|
|
461
|
+
key: forceRefreshKey,
|
|
462
|
+
latexStr,
|
|
463
|
+
width,
|
|
464
|
+
fontSize,
|
|
465
|
+
lineSpace,
|
|
466
|
+
color,
|
|
467
|
+
instantLoad: latexOptions.instantLoad,
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
return h(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
key,
|
|
474
|
+
style: {
|
|
475
|
+
width: latexOptions.width ?? 1000,
|
|
476
|
+
fontSize: latexOptions.fontSize ?? 16,
|
|
477
|
+
color: latexOptions.color ?? "#000000",
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
node
|
|
481
|
+
);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function filterOutBrNodes(nodes: VNodeChild[]): VNodeChild[] {
|
|
486
|
+
return nodes.filter((node) => !(isVNode(node) && node.type === "br"));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function renderNodeWithChildren(
|
|
490
|
+
renderTarget: any,
|
|
491
|
+
props: Record<string, unknown>,
|
|
492
|
+
children: VNodeChild | VNodeChild[] | undefined
|
|
493
|
+
): VNodeChild {
|
|
494
|
+
if (renderTarget === JsvFlexDiv) {
|
|
495
|
+
return h(renderTarget, props, {
|
|
496
|
+
default: () => children as any,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
return h(renderTarget, props, children as any);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function hasFloatRightStyle(node: VNodeChild): boolean {
|
|
503
|
+
if (!isVNode(node) || !node.props) {
|
|
504
|
+
return false;
|
|
505
|
+
}
|
|
506
|
+
const style = (node.props as Record<string, unknown>).style;
|
|
507
|
+
if (typeof style === "string") {
|
|
508
|
+
return /(?:^|;)\s*float\s*:\s*right\s*(?:;|$)/i.test(style);
|
|
509
|
+
}
|
|
510
|
+
if (style && typeof style === "object") {
|
|
511
|
+
const styleObj = style as Record<string, unknown>;
|
|
512
|
+
const floatValue = styleObj.float ?? styleObj.FLOAT;
|
|
513
|
+
return typeof floatValue === "string" && floatValue.trim().toLowerCase() === "right";
|
|
514
|
+
}
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function pickLayoutWidthFromVNode(node: VNodeChild): number | undefined {
|
|
519
|
+
if (!isVNode(node) || !node.props) {
|
|
520
|
+
return undefined;
|
|
521
|
+
}
|
|
522
|
+
const width = (node.props as Record<string, unknown>).width;
|
|
523
|
+
if (typeof width === "number" && Number.isFinite(width)) {
|
|
524
|
+
return width;
|
|
525
|
+
}
|
|
526
|
+
return undefined;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
function mergeImageSizeStyle(
|
|
530
|
+
baseStyle: unknown,
|
|
531
|
+
imageWidth: number,
|
|
532
|
+
imageHeight: number
|
|
533
|
+
): Record<string, unknown> {
|
|
534
|
+
const styleObj =
|
|
535
|
+
baseStyle && typeof baseStyle === "object" ? (baseStyle as Record<string, unknown>) : {};
|
|
536
|
+
return {
|
|
537
|
+
...styleObj,
|
|
538
|
+
width: imageWidth,
|
|
539
|
+
height: imageHeight,
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function pickLatexFontSize(node: VNodeChild): number {
|
|
544
|
+
if (!isVNode(node) || !node.props) {
|
|
545
|
+
return 16;
|
|
546
|
+
}
|
|
547
|
+
const fontSize = (node.props as Record<string, unknown>).fontSize;
|
|
548
|
+
if (typeof fontSize === "number" && Number.isFinite(fontSize)) {
|
|
549
|
+
return fontSize;
|
|
550
|
+
}
|
|
551
|
+
return 16;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
function wrapFloatRightImageWithNextLatex(nodes: VNodeChild[]): VNodeChild[] {
|
|
555
|
+
const result: VNodeChild[] = [];
|
|
556
|
+
|
|
557
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
558
|
+
const current = nodes[i];
|
|
559
|
+
const canStartWrap =
|
|
560
|
+
isVNode(current) && current.type === "img" && hasFloatRightStyle(current);
|
|
561
|
+
|
|
562
|
+
if (!canStartWrap) {
|
|
563
|
+
result.push(current);
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
const componentWidth = pickLayoutWidthFromVNode(current) ?? 1000;
|
|
568
|
+
const imageSize = componentWidth / 6;
|
|
569
|
+
const latexGroup: VNodeChild[] = [];
|
|
570
|
+
let j = i + 1;
|
|
571
|
+
while (j < nodes.length) {
|
|
572
|
+
const candidate = nodes[j];
|
|
573
|
+
if (!(isVNode(candidate) && candidate.type === JsvLatex)) {
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
const fontSize = pickLatexFontSize(candidate);
|
|
577
|
+
if ((latexGroup.length + 1) * fontSize > imageSize) {
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
latexGroup.push(candidate);
|
|
581
|
+
j++;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (latexGroup.length === 0) {
|
|
585
|
+
result.push(current);
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
const resolvedComponentWidth = pickLayoutWidthFromVNode(latexGroup[0]) ?? componentWidth;
|
|
590
|
+
const resolvedImageSize = resolvedComponentWidth / 6;
|
|
591
|
+
const latexColumnWidth = (resolvedComponentWidth * 5) / 6;
|
|
592
|
+
const currentProps = (isVNode(current) ? (current.props as Record<string, unknown> | null) : null) ?? {};
|
|
593
|
+
const resizedImageVNode = h("img", {
|
|
594
|
+
...currentProps,
|
|
595
|
+
style: mergeImageSizeStyle(currentProps.style, resolvedImageSize, resolvedImageSize),
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
result.push(
|
|
599
|
+
h(
|
|
600
|
+
JsvFlexDiv,
|
|
601
|
+
{
|
|
602
|
+
key: `float-right-row-${i}`,
|
|
603
|
+
style: {
|
|
604
|
+
flexDirection: "row",
|
|
605
|
+
alignItems: "flex-start",
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
default: () => [
|
|
610
|
+
h(
|
|
611
|
+
JsvFlexDiv,
|
|
612
|
+
{
|
|
613
|
+
key: `float-right-col-${i}`,
|
|
614
|
+
style: {
|
|
615
|
+
flexDirection: "column",
|
|
616
|
+
alignItems: "flex-start",
|
|
617
|
+
width: latexColumnWidth,
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
default: () => latexGroup,
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
resizedImageVNode,
|
|
625
|
+
],
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
);
|
|
629
|
+
i = j - 1;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
return result;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function domJsonToVNode(
|
|
636
|
+
node: DomJsonNode,
|
|
637
|
+
key?: string,
|
|
638
|
+
options?: HtmlToVNodesOptions,
|
|
639
|
+
parentTag?: string,
|
|
640
|
+
indexInParent?: number
|
|
641
|
+
): VNodeChild | null {
|
|
642
|
+
if (node.type === "text") {
|
|
643
|
+
return applyTextHook(node.content, key, options);
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const extractChildrenText = (children: DomJsonNode[]): string =>
|
|
647
|
+
children
|
|
648
|
+
.map((child) => {
|
|
649
|
+
if (child.type === "text") {
|
|
650
|
+
return child.content;
|
|
651
|
+
}
|
|
652
|
+
return extractChildrenText(child.children);
|
|
653
|
+
})
|
|
654
|
+
.join("");
|
|
655
|
+
|
|
656
|
+
const tagHandled = applyTagHook(
|
|
657
|
+
node.tag,
|
|
658
|
+
node.attrs,
|
|
659
|
+
extractChildrenText(node.children),
|
|
660
|
+
parentTag,
|
|
661
|
+
indexInParent,
|
|
662
|
+
options
|
|
663
|
+
);
|
|
664
|
+
if (tagHandled.drop) {
|
|
665
|
+
return null;
|
|
666
|
+
}
|
|
667
|
+
if (tagHandled.text !== undefined) {
|
|
668
|
+
return applyTextHook(tagHandled.text, key, options);
|
|
669
|
+
}
|
|
670
|
+
const attrsWithStyleHook = applyStyleHook(tagHandled.tag, tagHandled.attrs, options);
|
|
671
|
+
const props = normalizeAttrs(attrsWithStyleHook);
|
|
672
|
+
const finalProps: Record<string, unknown> = {
|
|
673
|
+
...props,
|
|
674
|
+
...(tagHandled.props ?? {}),
|
|
675
|
+
};
|
|
676
|
+
if (
|
|
677
|
+
typeof props.style === "object" &&
|
|
678
|
+
props.style !== null &&
|
|
679
|
+
typeof tagHandled.props?.style === "object" &&
|
|
680
|
+
tagHandled.props.style !== null
|
|
681
|
+
) {
|
|
682
|
+
finalProps.style = {
|
|
683
|
+
...(props.style as Record<string, unknown>),
|
|
684
|
+
...(tagHandled.props.style as Record<string, unknown>),
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
const renderTarget = (tagHandled.component ?? tagHandled.tag) as any;
|
|
688
|
+
if (key) {
|
|
689
|
+
finalProps.key = key;
|
|
690
|
+
}
|
|
691
|
+
if (tagHandled.childrenText !== undefined) {
|
|
692
|
+
return renderNodeWithChildren(
|
|
693
|
+
renderTarget,
|
|
694
|
+
finalProps,
|
|
695
|
+
applyTextHook(tagHandled.childrenText, key, options) as any
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
const children = mergeAdjacentTextVNodes(
|
|
700
|
+
node.children
|
|
701
|
+
.map((child, idx) => domJsonToVNode(child, `${key ?? "node"}-${idx}`, options, node.tag, idx))
|
|
702
|
+
.filter((child): child is VNodeChild => child !== null),
|
|
703
|
+
options
|
|
704
|
+
);
|
|
705
|
+
const filteredChildren = filterOutBrNodes(children);
|
|
706
|
+
const bulletFontSize = options?.latex?.fontSize;
|
|
707
|
+
const finalChildren =
|
|
708
|
+
tagHandled.prependBullet
|
|
709
|
+
? [
|
|
710
|
+
h(
|
|
711
|
+
"div",
|
|
712
|
+
{
|
|
713
|
+
key: `${key ?? "node"}-dot`,
|
|
714
|
+
...(bulletFontSize !== undefined ? { style: { fontSize: bulletFontSize } } : {}),
|
|
715
|
+
},
|
|
716
|
+
" ●"
|
|
717
|
+
),
|
|
718
|
+
...filteredChildren,
|
|
719
|
+
]
|
|
720
|
+
: filteredChildren;
|
|
721
|
+
|
|
722
|
+
return renderNodeWithChildren(
|
|
723
|
+
renderTarget,
|
|
724
|
+
finalProps,
|
|
725
|
+
finalChildren.length > 0 ? finalChildren : undefined
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export function htmlToVNodes(html: string, options?: HtmlToVNodesOptions): VNodeChild[] {
|
|
730
|
+
// 1) 先把原始 html 文本解析成轻量 JSON 结构树。
|
|
731
|
+
const jsonTree = htmlToDomJson(html);
|
|
732
|
+
console.log("[htmlToVNodes][jsonTree]", jsonTree);
|
|
733
|
+
// const vnodeTree = jsonTree.map((node, idx) => domJsonToVNode(node, `root-${idx}`, options));
|
|
734
|
+
// 2) 把 JSON 节点递归转换为 VNode,并在该阶段合并相邻文本节点。
|
|
735
|
+
const mergedVnodeTree = mergeAdjacentTextVNodes(
|
|
736
|
+
jsonTree
|
|
737
|
+
.map((node, idx) => domJsonToVNode(node, `root-${idx}`, options, undefined, idx))
|
|
738
|
+
.filter((node): node is VNodeChild => node !== null),
|
|
739
|
+
options
|
|
740
|
+
);
|
|
741
|
+
// 3) 过滤掉 br 节点(当前策略是直接移除而不是渲染换行节点)。
|
|
742
|
+
const filteredVnodeTree = filterOutBrNodes(mergedVnodeTree);
|
|
743
|
+
// 4) 对特殊布局做二次处理:把 float-right 图片与后续 Latex 节点按规则重新包裹。
|
|
744
|
+
const vnodeTree = wrapFloatRightImageWithNextLatex(filteredVnodeTree);
|
|
745
|
+
console.log("[htmlToVNodes][vnodeTree]", vnodeTree);
|
|
746
|
+
// 5) 返回最终可直接用于渲染的 VNode 列表。
|
|
747
|
+
return vnodeTree;
|
|
748
|
+
}
|