@tmagic/editor 1.8.5 → 1.8.7
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/es/{Editor.vue_vue_type_script_setup_true_lang.js → Editor.vue.js} +9 -9
- package/dist/es/{Editor.js → Editor2.vue.js} +1 -1
- package/dist/es/components/{CodeBlockEditor.vue_vue_type_script_setup_true_lang.js → CodeBlockEditor.vue.js} +5 -5
- package/dist/es/components/{CodeBlockEditor.js → CodeBlockEditor2.vue.js} +1 -1
- package/dist/es/components/{CodeParams.js → CodeParams2.vue.js} +1 -1
- package/dist/es/components/{CompareForm.js → CompareForm2.vue.js} +1 -1
- package/dist/es/components/{ContentMenu.vue_vue_type_script_setup_true_lang.js → ContentMenu.vue.js} +2 -2
- package/dist/es/components/{ContentMenu.js → ContentMenu2.vue.js} +1 -1
- package/dist/es/components/{FloatingBox.vue_vue_type_script_setup_true_lang.js → FloatingBox.vue.js} +2 -2
- package/dist/es/components/{FloatingBox.js → FloatingBox2.vue.js} +1 -1
- package/dist/es/components/{Icon.js → Icon2.vue.js} +1 -1
- package/dist/es/components/{Resizer.js → Resizer2.vue.js} +1 -1
- package/dist/es/components/{ScrollBar.js → ScrollBar2.vue.js} +1 -1
- package/dist/es/components/{ScrollViewer.vue_vue_type_script_setup_true_lang.js → ScrollViewer.vue.js} +3 -3
- package/dist/es/components/{ScrollViewer.js → ScrollViewer2.vue.js} +1 -1
- package/dist/es/components/{SearchInput.js → SearchInput2.vue.js} +1 -1
- package/dist/es/components/{SplitView.vue_vue_type_script_setup_true_lang.js → SplitView.vue.js} +1 -1
- package/dist/es/components/{SplitView.js → SplitView2.vue.js} +1 -1
- package/dist/es/components/{ToolButton.vue_vue_type_script_setup_true_lang.js → ToolButton.vue.js} +3 -3
- package/dist/es/components/{ToolButton.js → ToolButton2.vue.js} +1 -1
- package/dist/es/components/{Tree.vue_vue_type_script_setup_true_lang.js → Tree.vue.js} +1 -1
- package/dist/es/components/{Tree.js → Tree2.vue.js} +1 -1
- package/dist/es/components/{TreeNode.vue_vue_type_script_setup_true_lang.js → TreeNode.vue.js} +2 -2
- package/dist/es/components/{TreeNode.js → TreeNode2.vue.js} +1 -1
- package/dist/es/components/{ViewForm.js → ViewForm2.vue.js} +1 -1
- package/dist/es/fields/{Code.vue_vue_type_script_setup_true_lang.js → Code.vue.js} +1 -1
- package/dist/es/fields/{Code.js → Code2.vue.js} +1 -1
- package/dist/es/fields/{CodeLink.js → CodeLink2.vue.js} +1 -1
- package/dist/es/fields/{CodeSelect.js → CodeSelect2.vue.js} +1 -1
- package/dist/es/fields/{CodeSelectCol.vue_vue_type_script_setup_true_lang.js → CodeSelectCol.vue.js} +7 -7
- package/dist/es/fields/{CodeSelectCol.js → CodeSelectCol2.vue.js} +1 -1
- package/dist/es/fields/{CondOpSelect.js → CondOpSelect2.vue.js} +1 -1
- package/dist/es/fields/DataSourceFieldSelect/{FieldSelect.vue_vue_type_script_setup_true_lang.js → FieldSelect.vue.js} +55 -14
- package/dist/es/fields/DataSourceFieldSelect/{FieldSelect.js → FieldSelect2.vue.js} +1 -1
- package/dist/es/fields/DataSourceFieldSelect/{Index.vue_vue_type_script_setup_true_lang.js → Index.vue.js} +7 -7
- package/dist/es/fields/DataSourceFieldSelect/{Index.js → Index2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceFields.vue_vue_type_script_setup_true_lang.js → DataSourceFields.vue.js} +50 -17
- package/dist/es/fields/{DataSourceFields.js → DataSourceFields2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceInput.vue_vue_type_script_setup_true_lang.js → DataSourceInput.vue.js} +5 -5
- package/dist/es/fields/{DataSourceInput.js → DataSourceInput2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js → DataSourceMethodSelect.vue.js} +7 -7
- package/dist/es/fields/{DataSourceMethodSelect.js → DataSourceMethodSelect2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMethods.vue_vue_type_script_setup_true_lang.js → DataSourceMethods.vue.js} +3 -3
- package/dist/es/fields/{DataSourceMethods.js → DataSourceMethods2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMocks.vue_vue_type_script_setup_true_lang.js → DataSourceMocks.vue.js} +8 -8
- package/dist/es/fields/{DataSourceMocks.js → DataSourceMocks2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceSelect.vue_vue_type_script_setup_true_lang.js → DataSourceSelect.vue.js} +5 -5
- package/dist/es/fields/{DataSourceSelect.js → DataSourceSelect2.vue.js} +1 -1
- package/dist/es/fields/{DisplayConds.js → DisplayConds2.vue.js} +1 -1
- package/dist/es/fields/{EventSelect.js → EventSelect2.vue.js} +1 -1
- package/dist/es/fields/{KeyValue.vue_vue_type_script_setup_true_lang.js → KeyValue.vue.js} +3 -3
- package/dist/es/fields/{KeyValue.js → KeyValue2.vue.js} +1 -1
- package/dist/es/fields/{PageFragmentSelect.vue_vue_type_script_setup_true_lang.js → PageFragmentSelect.vue.js} +4 -4
- package/dist/es/fields/{PageFragmentSelect.js → PageFragmentSelect2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/{Index.vue_vue_type_script_setup_true_lang.js → Index.vue.js} +7 -7
- package/dist/es/fields/StyleSetter/{Index.js → Index2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{BackgroundPosition.js → BackgroundPosition2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Border.js → Border2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Box.js → Box2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/configs.js +43 -43
- package/dist/es/fields/StyleSetter/pro/{Background.js → Background2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Border.vue_vue_type_script_setup_true_lang.js → Border.vue.js} +3 -3
- package/dist/es/fields/StyleSetter/pro/{Border.js → Border2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Font.js → Font2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Layout.vue_vue_type_script_setup_true_lang.js → Layout.vue.js} +4 -4
- package/dist/es/fields/StyleSetter/pro/{Layout.js → Layout2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Position.js → Position2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Transform.js → Transform2.vue.js} +1 -1
- package/dist/es/fields/{UISelect.js → UISelect2.vue.js} +1 -1
- package/dist/es/fields/configs/codeSelect.js +2 -2
- package/dist/es/fields/configs/displayConds.js +1 -1
- package/dist/es/fields/configs/eventSelect.js +3 -3
- package/dist/es/fields/headless-validation.js +1 -1
- package/dist/es/hooks/use-code-block-edit.js +1 -1
- package/dist/es/hooks/use-compare-form.js +1 -1
- package/dist/es/hooks/use-editor-content-height.js +1 -1
- package/dist/es/hooks/use-filter.js +2 -2
- package/dist/es/hooks/use-float-box.js +1 -1
- package/dist/es/hooks/use-form-context.js +1 -1
- package/dist/es/hooks/use-node-status.js +1 -1
- package/dist/es/hooks/use-stage.js +28 -3
- package/dist/es/icons/{CenterIcon.js → CenterIcon2.vue.js} +1 -1
- package/dist/es/icons/{CodeIcon.js → CodeIcon2.vue.js} +1 -1
- package/dist/es/icons/{FolderMinusIcon.js → FolderMinusIcon2.vue.js} +1 -1
- package/dist/es/index.js +47 -47
- package/dist/es/initService.js +9 -9
- package/dist/es/layouts/{AddPageBox.vue_vue_type_script_setup_true_lang.js → AddPageBox.vue.js} +4 -4
- package/dist/es/layouts/{AddPageBox.js → AddPageBox2.vue.js} +1 -1
- package/dist/es/layouts/{CodeEditor.vue_vue_type_script_setup_true_lang.js → CodeEditor.vue.js} +5 -5
- package/dist/es/layouts/{CodeEditor.js → CodeEditor2.vue.js} +1 -1
- package/dist/es/layouts/{Framework.vue_vue_type_script_setup_true_lang.js → Framework.vue.js} +5 -5
- package/dist/es/layouts/{Framework.js → Framework2.vue.js} +1 -1
- package/dist/es/layouts/{NavMenu.vue_vue_type_script_setup_true_lang.js → NavMenu.vue.js} +5 -5
- package/dist/es/layouts/{NavMenu.js → NavMenu2.vue.js} +1 -1
- package/dist/es/layouts/{NavMenuColumn.vue_vue_type_script_setup_true_lang.js → NavMenuColumn.vue.js} +14 -6
- package/dist/es/layouts/{NavMenuColumn.js → NavMenuColumn2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{Bucket.vue_vue_type_script_setup_true_lang.js → Bucket.vue.js} +23 -7
- package/dist/es/layouts/history-list/{Bucket.js → Bucket2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{BucketTab.vue_vue_type_script_setup_true_lang.js → BucketTab.vue.js} +9 -4
- package/dist/es/layouts/history-list/{BucketTab.js → BucketTab2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{GroupRow.js → GroupRow2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js → HistoryDiffDialog.vue.js} +3 -3
- package/dist/es/layouts/history-list/{HistoryDiffDialog.js → HistoryDiffDialog2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{HistoryListPanel.vue_vue_type_script_setup_true_lang.js → HistoryListPanel.vue.js} +24 -6
- package/dist/es/layouts/history-list/{HistoryListPanel.js → HistoryListPanel2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{InitialRow.vue_vue_type_script_setup_true_lang.js → InitialRow.vue.js} +16 -5
- package/dist/es/layouts/history-list/{InitialRow.js → InitialRow2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{PageTab.vue_vue_type_script_setup_true_lang.js → PageTab.vue.js} +20 -8
- package/dist/es/layouts/history-list/{PageTab.js → PageTab2.vue.js} +1 -1
- package/dist/es/layouts/history-list/composables.js +1 -1
- package/dist/es/layouts/history-list/useHistoryList.js +1 -1
- package/dist/es/layouts/history-list/useHistoryRevert.js +3 -3
- package/dist/es/layouts/page-bar/{AddButton.vue_vue_type_script_setup_true_lang.js → AddButton.vue.js} +6 -6
- package/dist/es/layouts/page-bar/{AddButton.js → AddButton2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageBar.vue_vue_type_script_setup_true_lang.js → PageBar.vue.js} +8 -8
- package/dist/es/layouts/page-bar/{PageBar.js → PageBar2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js → PageBarScrollContainer.vue.js} +2 -2
- package/dist/es/layouts/page-bar/{PageBarScrollContainer.js → PageBarScrollContainer2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageList.vue_vue_type_script_setup_true_lang.js → PageList.vue.js} +3 -3
- package/dist/es/layouts/page-bar/{PageList.js → PageList2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{Search.vue_vue_type_script_setup_true_lang.js → Search.vue.js} +3 -3
- package/dist/es/layouts/page-bar/{Search.js → Search2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/{FormPanel.vue_vue_type_script_setup_true_lang.js → FormPanel.vue.js} +7 -7
- package/dist/es/layouts/props-panel/{FormPanel.js → FormPanel2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/{PropsPanel.vue_vue_type_script_setup_true_lang.js → PropsPanel.vue.js} +7 -7
- package/dist/es/layouts/props-panel/{PropsPanel.js → PropsPanel2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/use-style-panel.js +1 -1
- package/dist/es/layouts/sidebar/{ComponentListPanel.vue_vue_type_script_setup_true_lang.js → ComponentListPanel.vue.js} +7 -7
- package/dist/es/layouts/sidebar/{ComponentListPanel.js → ComponentListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/{Sidebar.vue_vue_type_script_setup_true_lang.js → Sidebar.vue.js} +8 -8
- package/dist/es/layouts/sidebar/{Sidebar.js → Sidebar2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/{CodeBlockList.vue_vue_type_script_setup_true_lang.js → CodeBlockList.vue.js} +5 -5
- package/dist/es/layouts/sidebar/code-block/{CodeBlockList.js → CodeBlockList2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/{CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js → CodeBlockListPanel.vue.js} +6 -6
- package/dist/es/layouts/sidebar/code-block/{CodeBlockListPanel.js → CodeBlockListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceAddButton.vue_vue_type_script_setup_true_lang.js → DataSourceAddButton.vue.js} +2 -2
- package/dist/es/layouts/sidebar/data-source/{DataSourceAddButton.js → DataSourceAddButton2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js → DataSourceConfigPanel.vue.js} +4 -4
- package/dist/es/layouts/sidebar/data-source/{DataSourceConfigPanel.js → DataSourceConfigPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceList.vue_vue_type_script_setup_true_lang.js → DataSourceList.vue.js} +5 -5
- package/dist/es/layouts/sidebar/data-source/{DataSourceList.js → DataSourceList2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceListPanel.vue_vue_type_script_setup_true_lang.js → DataSourceListPanel.vue.js} +8 -8
- package/dist/es/layouts/sidebar/data-source/{DataSourceListPanel.js → DataSourceListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerMenu.vue_vue_type_script_setup_true_lang.js → LayerMenu.vue.js} +5 -5
- package/dist/es/layouts/sidebar/layer/{LayerMenu.js → LayerMenu2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeContent.vue_vue_type_script_setup_true_lang.js → LayerNodeContent.vue.js} +3 -3
- package/dist/es/layouts/sidebar/layer/{LayerNodeContent.js → LayerNodeContent2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeTool.js → LayerNodeTool2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerPanel.vue_vue_type_script_setup_true_lang.js → LayerPanel.vue.js} +7 -7
- package/dist/es/layouts/sidebar/layer/{LayerPanel.js → LayerPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/use-click.js +3 -3
- package/dist/es/layouts/sidebar/layer/use-drag.js +1 -1
- package/dist/es/layouts/sidebar/layer/use-keybinding.js +1 -1
- package/dist/es/layouts/sidebar/layer/use-node-status.js +2 -2
- package/dist/es/layouts/workspace/{Breadcrumb.js → Breadcrumb2.vue.js} +1 -1
- package/dist/es/layouts/workspace/{Workspace.vue_vue_type_script_setup_true_lang.js → Workspace.vue.js} +3 -3
- package/dist/es/layouts/workspace/{Workspace.js → Workspace2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{NodeListMenu.vue_vue_type_script_setup_true_lang.js → NodeListMenu.vue.js} +5 -5
- package/dist/es/layouts/workspace/viewer/{NodeListMenu.js → NodeListMenu2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{Stage.vue_vue_type_script_setup_true_lang.js → Stage.vue.js} +70 -55
- package/dist/es/layouts/workspace/viewer/{Stage.js → Stage2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{StageOverlay.vue_vue_type_script_setup_true_lang.js → StageOverlay.vue.js} +3 -3
- package/dist/es/layouts/workspace/viewer/{StageOverlay.js → StageOverlay2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{ViewerMenu.vue_vue_type_script_setup_true_lang.js → ViewerMenu.vue.js} +6 -6
- package/dist/es/layouts/workspace/viewer/{ViewerMenu.js → ViewerMenu2.vue.js} +1 -1
- package/dist/es/plugin.js +24 -24
- package/dist/es/sdk/index.js +2 -2
- package/dist/es/sdk/services/CodeBlock.js +18 -18
- package/dist/es/sdk/services/DataSource.js +17 -17
- package/dist/es/sdk/services/Dep.js +3 -3
- package/dist/es/sdk/services/Editor.js +116 -81
- package/dist/es/sdk/services/Events.js +2 -2
- package/dist/es/sdk/services/History.js +45 -7
- package/dist/es/sdk/services/Props.js +6 -6
- package/dist/es/sdk/services/WebStorage.js +1 -1
- package/dist/es/sdk/utils/dep.js +2 -2
- package/dist/es/sdk/utils/operator.js +3 -3
- package/dist/es/sdk/validate/index.js +4 -4
- package/dist/es/sdk/wiring.js +2 -2
- package/dist/es/services/keybinding.js +2 -2
- package/dist/es/services/stageOverlay.js +2 -2
- package/dist/es/services/ui.js +2 -2
- package/dist/es/utils/code-block.js +2 -2
- package/dist/es/utils/content-menu.js +3 -3
- package/dist/es/utils/data-source/index.js +88 -5
- package/dist/es/utils/dep/collect-worker-client.js +1 -1
- package/dist/es/utils/dep/idle-task.js +1 -1
- package/dist/es/utils/editor.js +7 -6
- package/dist/es/utils/event.js +1 -1
- package/dist/es/utils/history.js +29 -10
- package/dist/es/utils/operator.js +1 -1
- package/dist/es/utils/page.js +21 -0
- package/dist/es/utils/props.js +1 -1
- package/dist/es/utils/type-match-rules.js +4 -4
- package/dist/es/utils/undo-redo.js +57 -9
- package/dist/tmagic-editor-headless.umd.cjs +257 -87
- package/dist/tmagic-editor-sdk.umd.cjs +225 -84
- package/dist/tmagic-editor.umd.cjs +814 -241
- package/package.json +8 -8
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +68 -9
- package/src/fields/DataSourceFields.vue +53 -10
- package/src/fields/DataSourceMocks.vue +2 -2
- package/src/hooks/use-stage.ts +26 -1
- package/src/layouts/NavMenuColumn.vue +8 -1
- package/src/layouts/history-list/Bucket.vue +30 -16
- package/src/layouts/history-list/BucketTab.vue +8 -1
- package/src/layouts/history-list/HistoryListPanel.vue +27 -0
- package/src/layouts/history-list/InitialRow.vue +17 -5
- package/src/layouts/history-list/PageTab.vue +32 -18
- package/src/layouts/workspace/viewer/Stage.vue +77 -57
- package/src/sdk/services/Editor.ts +56 -26
- package/src/sdk/services/History.ts +58 -11
- package/src/type.ts +19 -3
- package/src/utils/data-source/index.ts +151 -6
- package/src/utils/editor.ts +4 -0
- package/src/utils/history.ts +35 -10
- package/src/utils/page.ts +32 -0
- package/src/utils/undo-redo.ts +76 -12
- package/types/headless.d.ts +14 -3
- package/types/index.d.ts +234 -314
- package/types/sdk.d.ts +79 -59
- package/dist/es/components/{CodeParams.vue_vue_type_script_setup_true_lang.js → CodeParams.vue.js} +2 -2
- package/dist/es/components/{CompareForm.vue_vue_type_script_setup_true_lang.js → CompareForm.vue.js} +3 -3
- package/dist/es/components/{Icon.vue_vue_type_script_setup_true_lang.js → Icon.vue.js} +1 -1
- package/dist/es/components/{Resizer.vue_vue_type_script_setup_true_lang.js → Resizer.vue.js} +1 -1
- package/dist/es/components/{ScrollBar.vue_vue_type_script_setup_true_lang.js → ScrollBar.vue.js} +0 -0
- package/dist/es/components/{SearchInput.vue_vue_type_script_setup_true_lang.js → SearchInput.vue.js} +1 -1
- package/dist/es/components/{ViewForm.vue_vue_type_script_setup_true_lang.js → ViewForm.vue.js} +2 -2
- package/dist/es/fields/{CodeLink.vue_vue_type_script_setup_true_lang.js → CodeLink.vue.js} +1 -1
- package/dist/es/fields/{CodeSelect.vue_vue_type_script_setup_true_lang.js → CodeSelect.vue.js} +2 -2
- package/dist/es/fields/{CondOpSelect.vue_vue_type_script_setup_true_lang.js → CondOpSelect.vue.js} +3 -3
- package/dist/es/fields/{DisplayConds.vue_vue_type_script_setup_true_lang.js → DisplayConds.vue.js} +2 -2
- package/dist/es/fields/{EventSelect.vue_vue_type_script_setup_true_lang.js → EventSelect.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/components/{BackgroundPosition.vue_vue_type_script_setup_true_lang.js → BackgroundPosition.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Border.vue_vue_type_script_setup_true_lang.js → Border.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/components/{Box.vue_vue_type_script_setup_true_lang.js → Box.vue.js} +0 -0
- package/dist/es/fields/StyleSetter/icons/align-items/{Baseline.js → Baseline.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{End.js → End.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{FlexEnd.js → FlexEnd.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{FlexStart.js → FlexStart.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Normal.js → Normal.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{SpaceAround.js → SpaceAround.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{SpaceBetween.js → SpaceBetween.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Start.js → Start.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Stretch.js → Stretch.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{NoRepeat.js → NoRepeat.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Repeat.js → Repeat.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{RepeatX.js → RepeatX.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{RepeatY.js → RepeatY.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Round.js → Round.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Space.js → Space.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Block.js → Block.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Flex.js → Flex.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Grid.js → Grid.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Inline.js → Inline.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineBlock.js → InlineBlock.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineFlex.js → InlineFlex.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineGrid.js → InlineGrid.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{None.js → None.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{Column.js → Column.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{ColumnReverse.js → ColumnReverse.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{Row.js → Row.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{RowReverse.js → RowReverse.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{FlexEnd.js → FlexEnd.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{FlexStart.js → FlexStart.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceAround.js → SpaceAround.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceBetween.js → SpaceBetween.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceEvenly.js → SpaceEvenly.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{End.js → End.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Justify.js → Justify.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Left.js → Left.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{MatchParent.js → MatchParent.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Right.js → Right.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Start.js → Start.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Background.vue_vue_type_script_setup_true_lang.js → Background.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Font.vue_vue_type_script_setup_true_lang.js → Font.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Position.vue_vue_type_script_setup_true_lang.js → Position.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Transform.vue_vue_type_script_setup_true_lang.js → Transform.vue.js} +2 -2
- package/dist/es/fields/{UISelect.vue_vue_type_script_setup_true_lang.js → UISelect.vue.js} +5 -5
- package/dist/es/icons/{CenterIcon.vue_vue_type_script_setup_true_lang.js → CenterIcon.vue.js} +0 -0
- package/dist/es/icons/{CodeIcon.vue_vue_type_script_setup_true_lang.js → CodeIcon.vue.js} +0 -0
- package/dist/es/icons/{DatasourceIcon.js → DatasourceIcon.vue.js} +1 -1
- package/dist/es/icons/{FolderMinusIcon.vue_vue_type_script_setup_true_lang.js → FolderMinusIcon.vue.js} +0 -0
- package/dist/es/layouts/history-list/{GroupRow.vue_vue_type_script_setup_true_lang.js → GroupRow.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeTool.vue_vue_type_script_setup_true_lang.js → LayerNodeTool.vue.js} +2 -2
- package/dist/es/layouts/workspace/{Breadcrumb.vue_vue_type_script_setup_true_lang.js → Breadcrumb.vue.js} +2 -2
|
@@ -19,12 +19,14 @@
|
|
|
19
19
|
var __getProtoOf = Object.getPrototypeOf;
|
|
20
20
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21
21
|
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
23
|
-
key
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
24
|
+
desc = __getOwnPropDesc(from, key);
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
27
|
+
enumerable: !desc || desc.enumerable
|
|
28
|
+
});
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
return to;
|
|
30
32
|
};
|
|
@@ -278,7 +280,7 @@
|
|
|
278
280
|
* _.isObject(null);
|
|
279
281
|
* // => false
|
|
280
282
|
*/
|
|
281
|
-
function isObject(value) {
|
|
283
|
+
function isObject$1(value) {
|
|
282
284
|
var type = typeof value;
|
|
283
285
|
return value != null && (type == "object" || type == "function");
|
|
284
286
|
}
|
|
@@ -319,9 +321,9 @@
|
|
|
319
321
|
function toNumber(value) {
|
|
320
322
|
if (typeof value == "number") return value;
|
|
321
323
|
if (isSymbol(value)) return NAN;
|
|
322
|
-
if (isObject(value)) {
|
|
324
|
+
if (isObject$1(value)) {
|
|
323
325
|
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
324
|
-
value = isObject(other) ? other + "" : other;
|
|
326
|
+
value = isObject$1(other) ? other + "" : other;
|
|
325
327
|
}
|
|
326
328
|
if (typeof value != "string") return value === 0 ? value : +value;
|
|
327
329
|
value = baseTrim(value);
|
|
@@ -372,7 +374,7 @@
|
|
|
372
374
|
* // => false
|
|
373
375
|
*/
|
|
374
376
|
function isFunction(value) {
|
|
375
|
-
if (!isObject(value)) return false;
|
|
377
|
+
if (!isObject$1(value)) return false;
|
|
376
378
|
var tag = baseGetTag(value);
|
|
377
379
|
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
378
380
|
}
|
|
@@ -442,7 +444,7 @@
|
|
|
442
444
|
* else `false`.
|
|
443
445
|
*/
|
|
444
446
|
function baseIsNative(value) {
|
|
445
|
-
if (!isObject(value) || isMasked(value)) return false;
|
|
447
|
+
if (!isObject$1(value) || isMasked(value)) return false;
|
|
446
448
|
return (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
|
|
447
449
|
}
|
|
448
450
|
// node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js
|
|
@@ -486,7 +488,7 @@
|
|
|
486
488
|
var baseCreate = function() {
|
|
487
489
|
function object() {}
|
|
488
490
|
return function(proto) {
|
|
489
|
-
if (!isObject(proto)) return {};
|
|
491
|
+
if (!isObject$1(proto)) return {};
|
|
490
492
|
if (objectCreate) return objectCreate(proto);
|
|
491
493
|
object.prototype = proto;
|
|
492
494
|
var result = new object();
|
|
@@ -705,7 +707,7 @@
|
|
|
705
707
|
}
|
|
706
708
|
// node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js
|
|
707
709
|
/** Used as references for various `Number` constants. */
|
|
708
|
-
var MAX_SAFE_INTEGER$1 =
|
|
710
|
+
var MAX_SAFE_INTEGER$1 = 0x1fffffffffffff;
|
|
709
711
|
/** Used to detect unsigned integer values. */
|
|
710
712
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
711
713
|
/**
|
|
@@ -854,7 +856,7 @@
|
|
|
854
856
|
}
|
|
855
857
|
// node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isLength.js
|
|
856
858
|
/** Used as references for various `Number` constants. */
|
|
857
|
-
var MAX_SAFE_INTEGER =
|
|
859
|
+
var MAX_SAFE_INTEGER = 0x1fffffffffffff;
|
|
858
860
|
/**
|
|
859
861
|
* Checks if `value` is a valid array-like length.
|
|
860
862
|
*
|
|
@@ -925,7 +927,7 @@
|
|
|
925
927
|
* else `false`.
|
|
926
928
|
*/
|
|
927
929
|
function isIterateeCall(value, index, object) {
|
|
928
|
-
if (!isObject(object)) return false;
|
|
930
|
+
if (!isObject$1(object)) return false;
|
|
929
931
|
var type = typeof index;
|
|
930
932
|
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
|
|
931
933
|
return false;
|
|
@@ -1262,7 +1264,7 @@
|
|
|
1262
1264
|
* @returns {Array} Returns the array of property names.
|
|
1263
1265
|
*/
|
|
1264
1266
|
function baseKeysIn(object) {
|
|
1265
|
-
if (!isObject(object)) return nativeKeysIn(object);
|
|
1267
|
+
if (!isObject$1(object)) return nativeKeysIn(object);
|
|
1266
1268
|
var isProto = isPrototype(object), result = [];
|
|
1267
1269
|
for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty$7.call(object, key)))) result.push(key);
|
|
1268
1270
|
return result;
|
|
@@ -2585,7 +2587,7 @@
|
|
|
2585
2587
|
var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
|
|
2586
2588
|
if (customizer) result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
2587
2589
|
if (result !== void 0) return result;
|
|
2588
|
-
if (!isObject(value)) return value;
|
|
2590
|
+
if (!isObject$1(value)) return value;
|
|
2589
2591
|
var isArr = isArray(value);
|
|
2590
2592
|
if (isArr) {
|
|
2591
2593
|
result = initCloneArray(value);
|
|
@@ -3165,7 +3167,7 @@
|
|
|
3165
3167
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
3166
3168
|
if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT$1);
|
|
3167
3169
|
wait = toNumber(wait) || 0;
|
|
3168
|
-
if (isObject(options)) {
|
|
3170
|
+
if (isObject$1(options)) {
|
|
3169
3171
|
leading = !!options.leading;
|
|
3170
3172
|
maxing = "maxWait" in options;
|
|
3171
3173
|
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
@@ -3354,7 +3356,7 @@
|
|
|
3354
3356
|
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
3355
3357
|
newValue = objValue;
|
|
3356
3358
|
if (isArguments(objValue)) newValue = toPlainObject(objValue);
|
|
3357
|
-
else if (!isObject(objValue) || isFunction(objValue)) newValue = initCloneObject(srcValue);
|
|
3359
|
+
else if (!isObject$1(objValue) || isFunction(objValue)) newValue = initCloneObject(srcValue);
|
|
3358
3360
|
} else isCommon = false;
|
|
3359
3361
|
}
|
|
3360
3362
|
if (isCommon) {
|
|
@@ -3380,7 +3382,7 @@
|
|
|
3380
3382
|
if (object === source) return;
|
|
3381
3383
|
baseFor(source, function(srcValue, key) {
|
|
3382
3384
|
stack || (stack = new Stack());
|
|
3383
|
-
if (isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
3385
|
+
if (isObject$1(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
3384
3386
|
else {
|
|
3385
3387
|
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
|
3386
3388
|
if (newValue === void 0) newValue = srcValue;
|
|
@@ -3530,7 +3532,7 @@
|
|
|
3530
3532
|
* @returns {Object} Returns `object`.
|
|
3531
3533
|
*/
|
|
3532
3534
|
function baseSet(object, path, value, customizer) {
|
|
3533
|
-
if (!isObject(object)) return object;
|
|
3535
|
+
if (!isObject$1(object)) return object;
|
|
3534
3536
|
path = castPath(path, object);
|
|
3535
3537
|
var index = -1, length = path.length, lastIndex = length - 1, nested = object;
|
|
3536
3538
|
while (nested != null && ++index < length) {
|
|
@@ -3539,7 +3541,7 @@
|
|
|
3539
3541
|
if (index != lastIndex) {
|
|
3540
3542
|
var objValue = nested[key];
|
|
3541
3543
|
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
3542
|
-
if (newValue === void 0) newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
|
|
3544
|
+
if (newValue === void 0) newValue = isObject$1(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
|
|
3543
3545
|
}
|
|
3544
3546
|
assignValue(nested, key, newValue);
|
|
3545
3547
|
nested = nested[key];
|
|
@@ -3650,7 +3652,7 @@
|
|
|
3650
3652
|
function throttle(func, wait, options) {
|
|
3651
3653
|
var leading = true, trailing = true;
|
|
3652
3654
|
if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
|
|
3653
|
-
if (isObject(options)) {
|
|
3655
|
+
if (isObject$1(options)) {
|
|
3654
3656
|
leading = "leading" in options ? !!options.leading : leading;
|
|
3655
3657
|
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
3656
3658
|
}
|
|
@@ -3967,6 +3969,7 @@
|
|
|
3967
3969
|
if (el && parentEl) {
|
|
3968
3970
|
const calcParentOffsetWidth = (0, _tmagic_utils.calcValueByFontsize)(doc, parentEl.offsetWidth);
|
|
3969
3971
|
const calcElOffsetWidth = (0, _tmagic_utils.calcValueByFontsize)(doc, el.offsetWidth);
|
|
3972
|
+
if (calcElOffsetWidth > calcParentOffsetWidth) return config.style.left;
|
|
3970
3973
|
if (calcElOffsetWidth + left > calcParentOffsetWidth) return calcParentOffsetWidth - calcElOffsetWidth;
|
|
3971
3974
|
}
|
|
3972
3975
|
return config.style.left;
|
|
@@ -3992,7 +3995,7 @@
|
|
|
3992
3995
|
var isIncludeDataSourceByDiffAddResult = (diffResult) => {
|
|
3993
3996
|
for (const value of Object.values(diffResult)) {
|
|
3994
3997
|
if ((0, _tmagic_utils.isValueIncludeDataSource)(value)) return true;
|
|
3995
|
-
if (isObject(value)) return isIncludeDataSourceByDiffAddResult(value);
|
|
3998
|
+
if (isObject$1(value)) return isIncludeDataSourceByDiffAddResult(value);
|
|
3996
3999
|
}
|
|
3997
4000
|
return false;
|
|
3998
4001
|
};
|
|
@@ -4000,7 +4003,7 @@
|
|
|
4000
4003
|
for (const [key, value] of Object.entries(diffResult)) {
|
|
4001
4004
|
if ((0, _tmagic_utils.isValueIncludeDataSource)(value)) return true;
|
|
4002
4005
|
if ((0, _tmagic_utils.isValueIncludeDataSource)(oldNode[key])) return true;
|
|
4003
|
-
if (isObject(value)) return isIncludeDataSourceByDiffUpdatedResult(value, oldNode[key]);
|
|
4006
|
+
if (isObject$1(value)) return isIncludeDataSourceByDiffUpdatedResult(value, oldNode[key]);
|
|
4004
4007
|
}
|
|
4005
4008
|
return false;
|
|
4006
4009
|
};
|
|
@@ -4138,7 +4141,7 @@
|
|
|
4138
4141
|
*/
|
|
4139
4142
|
var editorNodeMergeCustomizer = (objValue, srcValue, key, _object, source) => {
|
|
4140
4143
|
if (typeof srcValue === "undefined" && Object.hasOwn(source, key)) return "";
|
|
4141
|
-
if (isObject(srcValue) && Array.isArray(objValue)) return srcValue;
|
|
4144
|
+
if (isObject$1(srcValue) && Array.isArray(objValue)) return srcValue;
|
|
4142
4145
|
if (Array.isArray(srcValue)) return srcValue;
|
|
4143
4146
|
};
|
|
4144
4147
|
/**
|
|
@@ -4232,6 +4235,13 @@
|
|
|
4232
4235
|
}
|
|
4233
4236
|
};
|
|
4234
4237
|
// packages/editor/src/utils/undo-redo.ts
|
|
4238
|
+
/** 各历史栈 index 0 的 initial 是撤销下限(见 utils/history.ts 的 undoFloor),裁剪时不能把它挤掉。 */
|
|
4239
|
+
var isInitialStep = (step) => step?.opType === "initial";
|
|
4240
|
+
/**
|
|
4241
|
+
* 容量按「真实步骤数」计算:index 0 的 initial 基线额外占一个位置,不挤掉真实记录。
|
|
4242
|
+
* 只要真实步骤没超限,最老一条的 oldSchema 仍指向加载时的 DSL,「回到初始」就是可达的。
|
|
4243
|
+
*/
|
|
4244
|
+
var maxLength = (list, listMaxSize) => listMaxSize + (isInitialStep(list[0]) ? 1 : 0);
|
|
4235
4245
|
var UndoRedo = class UndoRedo {
|
|
4236
4246
|
/**
|
|
4237
4247
|
* 由 {@link UndoRedo.serialize} 产出的快照重建一个 UndoRedo 实例。
|
|
@@ -4242,13 +4252,9 @@
|
|
|
4242
4252
|
*/
|
|
4243
4253
|
static fromSerialized(data, options = {}) {
|
|
4244
4254
|
const undoRedo = new UndoRedo(data.listMaxSize);
|
|
4255
|
+
undoRedo.initialReachable = data.initialReachable !== false;
|
|
4245
4256
|
const list = Array.isArray(data.elementList) ? data.elementList.map((item) => cloneDeep(item)) : [];
|
|
4246
4257
|
let cursor = Number.isFinite(data.listCursor) ? data.listCursor : list.length;
|
|
4247
|
-
const overflow = list.length - undoRedo.listMaxSize;
|
|
4248
|
-
if (overflow > 0) {
|
|
4249
|
-
list.splice(0, overflow);
|
|
4250
|
-
cursor -= overflow;
|
|
4251
|
-
}
|
|
4252
4258
|
if (options.isSavedStep) {
|
|
4253
4259
|
for (let i = list.length - 1; i >= 0; i--) if (options.isSavedStep(list[i])) {
|
|
4254
4260
|
cursor = i + 1;
|
|
@@ -4262,7 +4268,9 @@
|
|
|
4262
4268
|
elementList;
|
|
4263
4269
|
listCursor;
|
|
4264
4270
|
listMaxSize;
|
|
4265
|
-
|
|
4271
|
+
/** 容量裁剪是否删掉过已应用的真实步骤(撤销链已断,「回到初始」不可达)。 */
|
|
4272
|
+
initialReachable = true;
|
|
4273
|
+
constructor(listMaxSize = 1e3) {
|
|
4266
4274
|
const minListMaxSize = 2;
|
|
4267
4275
|
this.elementList = [];
|
|
4268
4276
|
this.listCursor = 0;
|
|
@@ -4276,16 +4284,55 @@
|
|
|
4276
4284
|
return {
|
|
4277
4285
|
elementList: this.elementList.map((item) => cloneDeep(item)),
|
|
4278
4286
|
listCursor: this.listCursor,
|
|
4279
|
-
listMaxSize: this.listMaxSize
|
|
4287
|
+
listMaxSize: this.listMaxSize,
|
|
4288
|
+
initialReachable: this.initialReachable
|
|
4280
4289
|
};
|
|
4281
4290
|
}
|
|
4282
4291
|
pushElement(element) {
|
|
4283
4292
|
this.elementList.splice(this.listCursor, this.elementList.length - this.listCursor, cloneDeep(element));
|
|
4284
4293
|
this.listCursor += 1;
|
|
4285
|
-
|
|
4286
|
-
|
|
4294
|
+
}
|
|
4295
|
+
/**
|
|
4296
|
+
* 把栈裁剪到容量上限(`listMaxSize` 条真实步骤,index 0 的 initial 基线额外占一个位置)。
|
|
4297
|
+
*
|
|
4298
|
+
* 只在保存后调用(见 historyService.markSaved):保存前不裁剪,避免用户还没落库就丢掉可撤销的历史。
|
|
4299
|
+
* **永不删除** initial 基线与「整体设置 root」产生的记录(`rootStep`);
|
|
4300
|
+
* 受保护记录本身占满容量时栈保持超限。
|
|
4301
|
+
*
|
|
4302
|
+
* 分两个阶段删除,保证撤销链与重做链各自连续:
|
|
4303
|
+
* 1. 先从最旧的记录开始删**已应用**区(游标之前)的可删记录,撤销链仍然连续;
|
|
4304
|
+
* 2. 已应用区删无可删仍超限时,溢出量落在重做区。重做链必须连续——后一条是按前一条的 DSL 打的补丁,
|
|
4305
|
+
* 只删掉开头几条会让留下的步骤叠在缺失的基线上,因此整段丢弃游标之后的步骤。
|
|
4306
|
+
* (不从重做区末尾往前删:重做区里可能有受保护的 `rootStep`,跳过它去删它前面的步骤同样会留空洞。)
|
|
4307
|
+
*
|
|
4308
|
+
* 「回到初始」是否仍可达,取决于被删的已应用步骤相对最早一条 `rootStep` 的位置:
|
|
4309
|
+
* - 位于其**之后**:撤销链完整——一直撤销会退到这条整页快照,再撤销它即回到加载时的 DSL,仍可达;
|
|
4310
|
+
* - 位于其**之前**(或栈内没有 `rootStep`):撤到底只能停在中途版本,标记为不可达。
|
|
4311
|
+
* 只删掉重做区记录时不影响可达性。
|
|
4312
|
+
*/
|
|
4313
|
+
trim() {
|
|
4314
|
+
let overflow = this.elementList.length - maxLength(this.elementList, this.listMaxSize);
|
|
4315
|
+
if (overflow <= 0) return;
|
|
4316
|
+
let seenRootStep = false;
|
|
4317
|
+
let brokenChain = false;
|
|
4318
|
+
for (let index = 0; index < this.listCursor && overflow > 0;) {
|
|
4319
|
+
const step = this.elementList[index];
|
|
4320
|
+
if (isInitialStep(step)) {
|
|
4321
|
+
index += 1;
|
|
4322
|
+
continue;
|
|
4323
|
+
}
|
|
4324
|
+
if (step?.rootStep === true) {
|
|
4325
|
+
seenRootStep = true;
|
|
4326
|
+
index += 1;
|
|
4327
|
+
continue;
|
|
4328
|
+
}
|
|
4329
|
+
this.elementList.splice(index, 1);
|
|
4330
|
+
overflow -= 1;
|
|
4287
4331
|
this.listCursor -= 1;
|
|
4332
|
+
if (!seenRootStep) brokenChain = true;
|
|
4288
4333
|
}
|
|
4334
|
+
if (overflow > 0 && this.elementList.length > this.listCursor) this.elementList.length = this.listCursor;
|
|
4335
|
+
if (brokenChain) this.initialReachable = false;
|
|
4289
4336
|
}
|
|
4290
4337
|
canUndo() {
|
|
4291
4338
|
return this.listCursor > 0;
|
|
@@ -4352,6 +4399,10 @@
|
|
|
4352
4399
|
getLength() {
|
|
4353
4400
|
return this.elementList.length;
|
|
4354
4401
|
}
|
|
4402
|
+
/** 「回到初始」是否可达:容量裁剪删掉已应用的真实步骤后撤销链断开,返回 false。 */
|
|
4403
|
+
isInitialReachable() {
|
|
4404
|
+
return this.initialReachable;
|
|
4405
|
+
}
|
|
4355
4406
|
};
|
|
4356
4407
|
// packages/editor/src/utils/history.ts
|
|
4357
4408
|
/**
|
|
@@ -4415,6 +4466,11 @@
|
|
|
4415
4466
|
extra: payload.extra
|
|
4416
4467
|
};
|
|
4417
4468
|
};
|
|
4469
|
+
/**
|
|
4470
|
+
* 把栈当前游标所在的记录标记为「已保存」,随后把栈裁剪到容量上限(见 {@link UndoRedo.trim})。
|
|
4471
|
+
* 入栈与还原都不裁剪,只有保存后才收敛,避免用户在落库前丢掉可撤销的历史;
|
|
4472
|
+
* initial 基线与「整体设置 root」产生的记录(`rootStep`)不会被裁掉。
|
|
4473
|
+
*/
|
|
4418
4474
|
var markStackSaved = (undoRedo) => {
|
|
4419
4475
|
if (!undoRedo) return;
|
|
4420
4476
|
undoRedo.updateElements((element) => {
|
|
@@ -4423,6 +4479,7 @@
|
|
|
4423
4479
|
undoRedo.updateCurrentElement((element) => {
|
|
4424
4480
|
element.saved = true;
|
|
4425
4481
|
});
|
|
4482
|
+
undoRedo.trim();
|
|
4426
4483
|
};
|
|
4427
4484
|
/**
|
|
4428
4485
|
* 把单个历史栈(页面 / 代码块 / 数据源 / 扩展类型)的步骤列表按"目标"做相邻合并:
|
|
@@ -4534,20 +4591,33 @@
|
|
|
4534
4591
|
*
|
|
4535
4592
|
* 与 {@link serializeStacks} 相反:当传入 `parse`(parseDSL)时,把每条 step 中以字符串形式存储的 `diff`
|
|
4536
4593
|
* 解析回真实对象(含函数);不含 `diff` 的元素(如通用栈)原样透传。
|
|
4594
|
+
*
|
|
4595
|
+
* 单个栈解析失败只丢弃该栈,其余栈照常还原:一条损坏的快照不应该让整份本地历史都不可用。
|
|
4596
|
+
* 结构性损坏(`elementList` 不是数组)同样按空栈处理,交给 {@link UndoRedo.fromSerialized} 兜底。
|
|
4597
|
+
* 全部栈都失败时抛出首个错误,避免调用方把「什么都没恢复」当成一次成功的还原。
|
|
4537
4598
|
*/
|
|
4538
4599
|
var deserializeStacks = (stacks = {}, parse) => {
|
|
4539
4600
|
const result = {};
|
|
4601
|
+
let firstError;
|
|
4602
|
+
let failedCount = 0;
|
|
4540
4603
|
Object.entries(stacks).forEach(([id, serialized]) => {
|
|
4541
4604
|
if (!serialized) return;
|
|
4542
|
-
const
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4605
|
+
const source = Array.isArray(serialized.elementList) ? serialized.elementList : [];
|
|
4606
|
+
try {
|
|
4607
|
+
const elementList = parse ? source.map((step) => {
|
|
4608
|
+
const { diff } = step;
|
|
4609
|
+
return typeof diff === "string" ? Object.assign({}, step, { diff: parse(`(${diff})`) }) : step;
|
|
4610
|
+
}) : source;
|
|
4611
|
+
result[id] = UndoRedo.fromSerialized({
|
|
4612
|
+
...serialized,
|
|
4613
|
+
elementList
|
|
4614
|
+
}, { isSavedStep: (element) => element.saved === true });
|
|
4615
|
+
} catch (error) {
|
|
4616
|
+
failedCount += 1;
|
|
4617
|
+
firstError ??= error;
|
|
4618
|
+
}
|
|
4550
4619
|
});
|
|
4620
|
+
if (failedCount > 0 && Object.keys(result).length === 0) throw firstError;
|
|
4551
4621
|
return result;
|
|
4552
4622
|
};
|
|
4553
4623
|
/**
|
|
@@ -6509,6 +6579,14 @@
|
|
|
6509
6579
|
return parentNode;
|
|
6510
6580
|
};
|
|
6511
6581
|
// packages/editor/src/sdk/services/Editor.ts
|
|
6582
|
+
/**
|
|
6583
|
+
* 撤销 / 重做回放的内部标记键:不导出,也不出现在公开的 {@link HistoryOpOptions} 里。
|
|
6584
|
+
* 回放链路用它把 `isHistoryOp` 带进 `change` 事件;外部调用方即使传同名字符串字段也不会被读取,
|
|
6585
|
+
* 避免一次真实编辑被误标成历史回放,从而绕过业务侧的加锁 / 埋点 / 自动保存。
|
|
6586
|
+
*/
|
|
6587
|
+
var HISTORY_OP = Symbol("isHistoryOp");
|
|
6588
|
+
/** 读取仅供编辑器内部使用的回放标记。 */
|
|
6589
|
+
var isReplay = (options) => options[HISTORY_OP] === true;
|
|
6512
6590
|
/** 把插入下标收敛到 [0, length]:非整数取整,非法 / 越界(含未记录)一律追加到末尾 */
|
|
6513
6591
|
var clampIndex = (index, length) => {
|
|
6514
6592
|
const normalized = typeof index === "number" ? Math.trunc(index) : length;
|
|
@@ -6585,7 +6663,7 @@
|
|
|
6585
6663
|
if (name === "nodes" && Array.isArray(value)) this.set("node", value[0]);
|
|
6586
6664
|
if (name === "root") {
|
|
6587
6665
|
if (Array.isArray(value)) throw new Error("root 不能为数组");
|
|
6588
|
-
if (value && isObject(value)) {
|
|
6666
|
+
if (value && isObject$1(value)) {
|
|
6589
6667
|
const app = value;
|
|
6590
6668
|
this.state.pageLength = getPageList(app).length || 0;
|
|
6591
6669
|
this.state.pageFragmentLength = getPageFragmentList(app).length || 0;
|
|
@@ -6799,14 +6877,16 @@
|
|
|
6799
6877
|
root: cloneDeep(root),
|
|
6800
6878
|
index: insertIndex
|
|
6801
6879
|
});
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
node.style
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6880
|
+
if (!options.doNotFixPosition) {
|
|
6881
|
+
const newStyle = fixNodePosition(node, parent, stage);
|
|
6882
|
+
if (newStyle && (newStyle.top !== node.style.top || newStyle.left !== node.style.left)) {
|
|
6883
|
+
node.style = newStyle;
|
|
6884
|
+
await stage?.update({
|
|
6885
|
+
config: cloneDeep(node),
|
|
6886
|
+
parentId: parent.id,
|
|
6887
|
+
root: cloneDeep(root)
|
|
6888
|
+
});
|
|
6889
|
+
}
|
|
6810
6890
|
}
|
|
6811
6891
|
this.addModifiedNodeId(node.id);
|
|
6812
6892
|
return node;
|
|
@@ -6821,6 +6901,7 @@
|
|
|
6821
6901
|
async add(addNode, parent, options = {}) {
|
|
6822
6902
|
this.captureSelectionBeforeOp();
|
|
6823
6903
|
const { doNotSelect = false, doNotSwitchPage = false, doNotPushHistory = false, historyDescription, historySource } = options;
|
|
6904
|
+
const isHistoryOp = isReplay(options);
|
|
6824
6905
|
const stage = this.get("stage");
|
|
6825
6906
|
const addNodes = [];
|
|
6826
6907
|
if (!Array.isArray(addNode)) {
|
|
@@ -6898,7 +6979,8 @@
|
|
|
6898
6979
|
page: this.getPageOfNode(node.id)
|
|
6899
6980
|
})),
|
|
6900
6981
|
historySource,
|
|
6901
|
-
doNotPushHistory
|
|
6982
|
+
doNotPushHistory,
|
|
6983
|
+
isHistoryOp
|
|
6902
6984
|
});
|
|
6903
6985
|
const addedPages = newNodes.filter((node) => (0, _tmagic_utils.isPageOrFragment)(node));
|
|
6904
6986
|
if (addedPages.length) this.ctx.history.notifyPageStructureChange({
|
|
@@ -6969,6 +7051,7 @@
|
|
|
6969
7051
|
*/
|
|
6970
7052
|
async remove(nodeOrNodeList, options = {}) {
|
|
6971
7053
|
const { doNotPushHistory = false, historyDescription, historySource } = options;
|
|
7054
|
+
const isHistoryOp = isReplay(options);
|
|
6972
7055
|
this.captureSelectionBeforeOp();
|
|
6973
7056
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
6974
7057
|
const changeItems = nodes.map((node) => ({
|
|
@@ -7008,7 +7091,8 @@
|
|
|
7008
7091
|
type: "remove",
|
|
7009
7092
|
data: changeItems,
|
|
7010
7093
|
historySource,
|
|
7011
|
-
doNotPushHistory
|
|
7094
|
+
doNotPushHistory,
|
|
7095
|
+
isHistoryOp
|
|
7012
7096
|
});
|
|
7013
7097
|
const removedPages = nodes.filter((node) => (0, _tmagic_utils.isPageOrFragment)(node));
|
|
7014
7098
|
if (removedPages.length) this.ctx.history.notifyPageStructureChange({
|
|
@@ -7072,6 +7156,7 @@
|
|
|
7072
7156
|
async update(config, data = {}) {
|
|
7073
7157
|
this.captureSelectionBeforeOp();
|
|
7074
7158
|
const { doNotPushHistory = false, changeRecordList, changeRecords, historyDescription, historySource, invalidInfo } = data;
|
|
7159
|
+
const isHistoryOp = isReplay(data);
|
|
7075
7160
|
const nodes = Array.isArray(config) ? config : [config];
|
|
7076
7161
|
const commitInvalid = await this.runGuard(() => this.ctx.validator.guardUpdate(nodes, { replace: data.replace }));
|
|
7077
7162
|
const updateData = await Promise.all(nodes.map((node, index) => {
|
|
@@ -7111,7 +7196,8 @@
|
|
|
7111
7196
|
page: this.getPageOfNode(node.newNode.id)
|
|
7112
7197
|
})),
|
|
7113
7198
|
historySource,
|
|
7114
|
-
doNotPushHistory
|
|
7199
|
+
doNotPushHistory,
|
|
7200
|
+
isHistoryOp
|
|
7115
7201
|
});
|
|
7116
7202
|
return Array.isArray(config) ? updateData.map((item) => item.newNode) : updateData[0].newNode;
|
|
7117
7203
|
}
|
|
@@ -7204,9 +7290,7 @@
|
|
|
7204
7290
|
const parent = this.getParentById(config.id);
|
|
7205
7291
|
if (!parent) throw new Error("找不到父节点");
|
|
7206
7292
|
const node = cloneDeep(this.toRaw(config));
|
|
7207
|
-
const
|
|
7208
|
-
const doc = this.get("stage")?.renderer?.contentWindow?.document;
|
|
7209
|
-
const newStyle = calcAlignCenterStyle(node, parent, layout, doc);
|
|
7293
|
+
const newStyle = calcAlignCenterStyle(node, parent, await this.getLayout(parent, node), this.get("stage")?.renderer?.contentWindow?.document);
|
|
7210
7294
|
if (!newStyle) return config;
|
|
7211
7295
|
node.style = newStyle;
|
|
7212
7296
|
return node;
|
|
@@ -7241,7 +7325,9 @@
|
|
|
7241
7325
|
* @param options 可选配置
|
|
7242
7326
|
* @param options.doNotPushHistory 是否不写入历史记录(默认 false)
|
|
7243
7327
|
*/
|
|
7244
|
-
async moveLayer(offset,
|
|
7328
|
+
async moveLayer(offset, options = {}) {
|
|
7329
|
+
const { doNotPushHistory = false, historyDescription, historySource } = options;
|
|
7330
|
+
const isHistoryOp = isReplay(options);
|
|
7245
7331
|
this.captureSelectionBeforeOp();
|
|
7246
7332
|
const root = this.get("root");
|
|
7247
7333
|
if (!root) throw new Error("root为空");
|
|
@@ -7288,7 +7374,8 @@
|
|
|
7288
7374
|
}],
|
|
7289
7375
|
offset,
|
|
7290
7376
|
historySource,
|
|
7291
|
-
doNotPushHistory
|
|
7377
|
+
doNotPushHistory,
|
|
7378
|
+
isHistoryOp
|
|
7292
7379
|
});
|
|
7293
7380
|
}
|
|
7294
7381
|
/**
|
|
@@ -7361,7 +7448,9 @@
|
|
|
7361
7448
|
} else this.selectionBeforeOp = null;
|
|
7362
7449
|
return isBatch ? newConfigs : newConfigs[0];
|
|
7363
7450
|
}
|
|
7364
|
-
async dragTo(config, targetParent, targetIndex,
|
|
7451
|
+
async dragTo(config, targetParent, targetIndex, options = {}) {
|
|
7452
|
+
const { doNotPushHistory = false, historyDescription, historySource } = options;
|
|
7453
|
+
const isHistoryOp = isReplay(options);
|
|
7365
7454
|
this.captureSelectionBeforeOp();
|
|
7366
7455
|
if (!targetParent || !Array.isArray(targetParent.items)) return;
|
|
7367
7456
|
const configs = Array.isArray(config) ? config : [config];
|
|
@@ -7428,7 +7517,8 @@
|
|
|
7428
7517
|
targetIndex,
|
|
7429
7518
|
targetParent,
|
|
7430
7519
|
historySource,
|
|
7431
|
-
doNotPushHistory
|
|
7520
|
+
doNotPushHistory,
|
|
7521
|
+
isHistoryOp
|
|
7432
7522
|
});
|
|
7433
7523
|
}
|
|
7434
7524
|
/**
|
|
@@ -7528,7 +7618,8 @@
|
|
|
7528
7618
|
* @returns 反向后产生的新 step;目标不存在 / 未应用 / 反向失败时返回 null
|
|
7529
7619
|
*/
|
|
7530
7620
|
async revertPageStep(index) {
|
|
7531
|
-
const
|
|
7621
|
+
const pageId = this.get("page")?.id;
|
|
7622
|
+
const entry = this.ctx.history.getStepList("page", pageId)[index];
|
|
7532
7623
|
if (!entry?.applied) return null;
|
|
7533
7624
|
const { step } = entry;
|
|
7534
7625
|
if (step.opType === "initial") return null;
|
|
@@ -7538,10 +7629,10 @@
|
|
|
7538
7629
|
if (!items.length || !items.every((item) => item.changeRecords?.length)) return null;
|
|
7539
7630
|
}
|
|
7540
7631
|
let revertedStep = null;
|
|
7541
|
-
const captureRevert = (
|
|
7542
|
-
revertedStep = s;
|
|
7632
|
+
const captureRevert = (s, type, id) => {
|
|
7633
|
+
if (type === "page" && id === pageId && !revertedStep) revertedStep = s;
|
|
7543
7634
|
};
|
|
7544
|
-
this.ctx.history.
|
|
7635
|
+
this.ctx.history.on("change", captureRevert);
|
|
7545
7636
|
const historyDescription = `回滚 #${index + 1}: ${describeStepForRevert(step)}`;
|
|
7546
7637
|
const opts = {
|
|
7547
7638
|
doNotSelect: true,
|
|
@@ -7851,9 +7942,11 @@
|
|
|
7851
7942
|
/**
|
|
7852
7943
|
* 构造一条页面级「set root」历史记录(不携带选区 / modifiedNodeIds 上下文)并落到该页面自己的栈。
|
|
7853
7944
|
*
|
|
7854
|
-
* 连续 set root
|
|
7855
|
-
*
|
|
7856
|
-
*
|
|
7945
|
+
* 连续 set root 替换:若该页栈最新一条已是**同来源、同为整页 update**的 set root 记录
|
|
7946
|
+
* ({@link StepValue.rootStep} 且 `source` 相同),则用本次记录**替换**它而非新增,避免源码反复保存时堆积记录。
|
|
7947
|
+
* 替换时必须把 `oldSchema` 追溯到最早那一跳,并沿用原 uuid:否则只剩「上一版 → 本版」,
|
|
7948
|
+
* 撤销到基线时 DSL 会停在中途版本且无法继续回退,已发出的 historyId 也会失效。
|
|
7949
|
+
* 其余情况(来源不同 / 页面增删)照常新增,保留完整变更链条。
|
|
7857
7950
|
*/
|
|
7858
7951
|
pushPageDiffStep(opType, page, diffItem, source) {
|
|
7859
7952
|
const step = {
|
|
@@ -7873,8 +7966,19 @@
|
|
|
7873
7966
|
};
|
|
7874
7967
|
if (source) step.source = source;
|
|
7875
7968
|
const top = this.ctx.history.getCurrentPageStep(page.id);
|
|
7876
|
-
|
|
7877
|
-
|
|
7969
|
+
const earliestOldSchema = top?.diff?.[0]?.oldSchema;
|
|
7970
|
+
if (top?.rootStep && top.source === source && opType === "update" && top.opType === "update" && earliestOldSchema) {
|
|
7971
|
+
this.ctx.history.replaceCurrentStep("page", {
|
|
7972
|
+
...step,
|
|
7973
|
+
uuid: top.uuid,
|
|
7974
|
+
diff: [{
|
|
7975
|
+
...diffItem,
|
|
7976
|
+
oldSchema: earliestOldSchema
|
|
7977
|
+
}]
|
|
7978
|
+
}, page.id);
|
|
7979
|
+
return;
|
|
7980
|
+
}
|
|
7981
|
+
this.ctx.history.push("page", step, page.id);
|
|
7878
7982
|
}
|
|
7879
7983
|
pushOpHistory(opType, { diff, pageData, historyDescription, source }) {
|
|
7880
7984
|
const step = {
|
|
@@ -7906,8 +8010,8 @@
|
|
|
7906
8010
|
* 「重新插回节点」(撤销 remove / 重做 add)需按 step 记录的 parentId / index 精确还原,
|
|
7907
8011
|
* 不走 this.add,由手工 splice + stage.add 完成后补发等价的 add / change 事件(见 emitHistoryInsertEvents)。
|
|
7908
8012
|
*
|
|
7909
|
-
* 注意:这些路径都会发出 add / remove / update / change
|
|
7910
|
-
*
|
|
8013
|
+
* 注意:这些路径都会发出 add / remove / update / change 事件,且 `change` 事件带 `isHistoryOp: true`,
|
|
8014
|
+
* 业务侧可据此跳过仅针对「用户主动编辑」的副作用(加锁 / 埋点 / 自动保存等)。
|
|
7911
8015
|
*
|
|
7912
8016
|
* @param step 操作记录
|
|
7913
8017
|
* @param reverse true = 撤销,false = 重做
|
|
@@ -7921,6 +8025,7 @@
|
|
|
7921
8025
|
doNotSelect: true,
|
|
7922
8026
|
doNotSwitchPage: true,
|
|
7923
8027
|
doNotPushHistory: true,
|
|
8028
|
+
[HISTORY_OP]: true,
|
|
7924
8029
|
historySource: step.source
|
|
7925
8030
|
};
|
|
7926
8031
|
switch (step.opType) {
|
|
@@ -8004,10 +8109,7 @@
|
|
|
8004
8109
|
}
|
|
8005
8110
|
return cloneDeep(reverse ? oldNode : newNode);
|
|
8006
8111
|
});
|
|
8007
|
-
if (configs.length) await this.update(configs,
|
|
8008
|
-
doNotPushHistory: true,
|
|
8009
|
-
historySource: step.source
|
|
8010
|
-
});
|
|
8112
|
+
if (configs.length) await this.update(configs, commonOpts);
|
|
8011
8113
|
break;
|
|
8012
8114
|
}
|
|
8013
8115
|
}
|
|
@@ -8045,7 +8147,8 @@
|
|
|
8045
8147
|
page: this.getPageOfNode(node.id)
|
|
8046
8148
|
})),
|
|
8047
8149
|
historySource: source,
|
|
8048
|
-
doNotPushHistory: true
|
|
8150
|
+
doNotPushHistory: true,
|
|
8151
|
+
isHistoryOp: true
|
|
8049
8152
|
});
|
|
8050
8153
|
}
|
|
8051
8154
|
/** 经由 reactivity 注入的 toRaw(默认是 Vue 的 toRaw) */
|
|
@@ -8192,8 +8295,9 @@
|
|
|
8192
8295
|
* 注册一个扩展历史类型,使其可与内置 `page` / `codeBlock` / `dataSource` 一样走统一的
|
|
8193
8296
|
* {@link push} / {@link undo} / {@link redo}(按 id 分栈、独立 undo/redo)。
|
|
8194
8297
|
*
|
|
8298
|
+
* 扩展类型与内置类型一样统一派发 `change` 事件,无需(也不支持)单独指定事件名。
|
|
8299
|
+
*
|
|
8195
8300
|
* @param stepType 自定义历史类型标识(勿与内置类型重名)
|
|
8196
|
-
* @param options.event push/undo/redo 后派发的事件名,缺省为 `${stepType}-history-change`
|
|
8197
8301
|
* @param options.name 历史面板中的展示名称(tab / 分组标题等),缺省回退到 stepType 本身
|
|
8198
8302
|
*/
|
|
8199
8303
|
registerStepType(stepType, options = {}) {
|
|
@@ -8277,11 +8381,20 @@
|
|
|
8277
8381
|
const first = this.state.steps[stepType]?.[id]?.getElementList()[0];
|
|
8278
8382
|
return first?.opType === "initial" ? first : void 0;
|
|
8279
8383
|
}
|
|
8384
|
+
/**
|
|
8385
|
+
* 目标栈「回到初始」是否可达:容量裁剪删掉已应用的真实步骤后撤销链断开,返回 false。
|
|
8386
|
+
* 与是否存在 {@link getMarker} 基线无关——没有基线的栈同样可能因裁剪回不到加载时的 DSL,
|
|
8387
|
+
* 历史面板的各 tab 统一用它判断初始行是否可高亮 / 可点击。
|
|
8388
|
+
*/
|
|
8389
|
+
isInitialReachable(stepType, id) {
|
|
8390
|
+
if (!this.isValidStackId(id)) return true;
|
|
8391
|
+
return this.state.steps[stepType]?.[id]?.isInitialReachable() ?? true;
|
|
8392
|
+
}
|
|
8280
8393
|
push(stepType, step, id) {
|
|
8281
8394
|
if (!this.isValidStackId(id)) return null;
|
|
8282
8395
|
this.fillStepMeta(step);
|
|
8283
8396
|
getOrCreateStack(this.getStepBucket(stepType), id).pushElement(step);
|
|
8284
|
-
this.
|
|
8397
|
+
this.emitStepChange(step, stepType, id);
|
|
8285
8398
|
return step;
|
|
8286
8399
|
}
|
|
8287
8400
|
undo(stepType, id) {
|
|
@@ -8290,7 +8403,7 @@
|
|
|
8290
8403
|
if (!undoRedo) return null;
|
|
8291
8404
|
if (undoRedo.getCursor() <= undoFloor(undoRedo)) return null;
|
|
8292
8405
|
const step = undoRedo.undo();
|
|
8293
|
-
if (step) this.
|
|
8406
|
+
if (step) this.emitStepChange(step, stepType, id, true);
|
|
8294
8407
|
return step;
|
|
8295
8408
|
}
|
|
8296
8409
|
redo(stepType, id) {
|
|
@@ -8298,7 +8411,7 @@
|
|
|
8298
8411
|
const undoRedo = this.state.steps[stepType]?.[id];
|
|
8299
8412
|
if (!undoRedo) return null;
|
|
8300
8413
|
const step = undoRedo.redo();
|
|
8301
|
-
if (step) this.
|
|
8414
|
+
if (step) this.emitStepChange(step, stepType, id, true);
|
|
8302
8415
|
return step;
|
|
8303
8416
|
}
|
|
8304
8417
|
/**
|
|
@@ -8334,7 +8447,7 @@
|
|
|
8334
8447
|
const undoRedo = getOrCreateStack(this.getStepBucket(stepType), id);
|
|
8335
8448
|
this.fillStepMeta(state);
|
|
8336
8449
|
if (!undoRedo.replaceCurrentElement(state)) return null;
|
|
8337
|
-
this.
|
|
8450
|
+
this.emitStepChange(state, stepType, id);
|
|
8338
8451
|
return state;
|
|
8339
8452
|
}
|
|
8340
8453
|
destroy() {
|
|
@@ -8371,6 +8484,9 @@
|
|
|
8371
8484
|
*
|
|
8372
8485
|
* 同一栈内任意时刻最多只有一条记录为 `saved`;从 IndexedDB 恢复时游标会被定位到最近一条已保存记录之后。
|
|
8373
8486
|
*
|
|
8487
|
+
* 标记后把对应栈裁剪到容量上限({@link markStackSaved} → {@link UndoRedo.trim}):入栈与还原都不裁剪,
|
|
8488
|
+
* 只有保存后才收敛,避免用户在落库前丢掉可撤销的历史;initial 基线与 set root 产生的记录不会被裁掉。
|
|
8489
|
+
*
|
|
8374
8490
|
* @param stepType 历史类型
|
|
8375
8491
|
* @param id 目标栈 id;缺省表示标记全部类型 / 全部栈
|
|
8376
8492
|
*/
|
|
@@ -8441,6 +8557,10 @@
|
|
|
8441
8557
|
}
|
|
8442
8558
|
/**
|
|
8443
8559
|
* 用 {@link serialize} 导出的快照重建全部撤销/重做栈,会整体覆盖当前内存中的历史状态。
|
|
8560
|
+
*
|
|
8561
|
+
* 单个栈 / 单个类型的快照损坏只丢弃该部分,其余照常还原;
|
|
8562
|
+
* 快照里的栈全部还原失败时抛出首个错误,此时内存中的历史状态保持不变
|
|
8563
|
+
* (不会把「什么都没恢复」当成一次成功的还原)。
|
|
8444
8564
|
*/
|
|
8445
8565
|
restore(snapshot) {
|
|
8446
8566
|
const steps = {
|
|
@@ -8448,9 +8568,20 @@
|
|
|
8448
8568
|
codeBlock: {},
|
|
8449
8569
|
dataSource: {}
|
|
8450
8570
|
};
|
|
8571
|
+
let firstError;
|
|
8572
|
+
let stackCount = 0;
|
|
8573
|
+
let restoredStackCount = 0;
|
|
8451
8574
|
Object.entries(snapshot.steps).forEach(([stepType, bucket]) => {
|
|
8452
|
-
|
|
8575
|
+
try {
|
|
8576
|
+
const restored = deserializeStacks(convertExtraMaps(bucket, true), this.ctx.parseDSL);
|
|
8577
|
+
steps[stepType] = restored;
|
|
8578
|
+
restoredStackCount += Object.keys(restored).length;
|
|
8579
|
+
} catch (error) {
|
|
8580
|
+
firstError ??= error;
|
|
8581
|
+
}
|
|
8582
|
+
stackCount += Object.keys(bucket ?? {}).length;
|
|
8453
8583
|
});
|
|
8584
|
+
if (firstError && stackCount > 0 && restoredStackCount === 0) throw firstError;
|
|
8454
8585
|
this.state.steps = steps;
|
|
8455
8586
|
return snapshot;
|
|
8456
8587
|
}
|
|
@@ -8546,6 +8677,16 @@
|
|
|
8546
8677
|
return super.emit(eventName, ...args);
|
|
8547
8678
|
}
|
|
8548
8679
|
/**
|
|
8680
|
+
* 所有历史类型统一派发 `change`(签名 `(step, stepType, id, isHistoryOp)`);
|
|
8681
|
+
* 代码块 / 数据源额外派发文档约定的同构事件(签名 `(id, step, isHistoryOp)`)。
|
|
8682
|
+
* `isHistoryOp` 仅在 `undo` / `redo` 时为 true,供业务侧跳过历史回放触发的副作用。
|
|
8683
|
+
*/
|
|
8684
|
+
emitStepChange(step, stepType, id, isHistoryOp = false) {
|
|
8685
|
+
this.emit("change", step, stepType, id, isHistoryOp);
|
|
8686
|
+
if (stepType === "codeBlock") this.emit("code-block-history-change", id, step, isHistoryOp);
|
|
8687
|
+
else if (stepType === "dataSource") this.emit("data-source-history-change", id, step, isHistoryOp);
|
|
8688
|
+
}
|
|
8689
|
+
/**
|
|
8549
8690
|
* 取出指定历史类型的栈桶(`Record<id, UndoRedo>`);不存在时按需创建空桶,
|
|
8550
8691
|
* 从而支持通过 {@link registerStepType} 或首次 push 动态扩展历史类型。
|
|
8551
8692
|
*/
|