fix(styles): sync global styles and activate panels when click contextmenu (#1246)

This commit is contained in:
lisong 2025-04-01 18:18:54 -07:00 committed by GitHub
parent 4d9a68b868
commit 17a3b67015
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 36 additions and 17 deletions

View File

@ -145,6 +145,8 @@ export default {
//
const { PLUGIN_NAME, activeSetting } = useLayout()
const operations = {
del() {
removeNodeById(getCurrent().schema?.id)
@ -153,10 +155,10 @@ export default {
copyNode(getCurrent().schema?.id)
},
config() {
useLayout().activeSetting('props')
activeSetting(PLUGIN_NAME.Props)
},
bindEvent() {
useLayout().activeSetting('event')
activeSetting(PLUGIN_NAME.Event)
},
insert({ value }) {
emit('insert', value)

View File

@ -198,7 +198,7 @@ export default {
#tiny-engine-right-panel {
height: calc(100vh - var(--base-top-panel-height));
border-left: 1px solid var(--te-layout-common-border-color);
background: var(--ti-lowcode-common-component-bg);
background: var(--te-layout-common-bg-color);
display: flex;
flex-direction: column;
position: absolute;
@ -340,10 +340,10 @@ export default {
@keyframes glow {
0% {
box-shadow: inset 0px 0px 4px var(--ti-lowcode-canvas-handle-hover-bg);
box-shadow: inset 0px 0px 4px var(--te-layout-panel-active-color);
}
100% {
box-shadow: inset 0px 0px 14px var(--ti-lowcode-canvas-handle-hover-bg);
box-shadow: inset 0px 0px 14px var(--te-layout-panel-active-color);
}
}
</style>

View File

@ -12,5 +12,5 @@
--te-layout-common-icon-color: var(--te-common-icon-secondary);
--te-layout-common-icon-bg-color-hover: var(--te-common-bg-disabled);
--te-layout-setting-bg-color-hover: var(--te-common-bg-primary-checked);
--te-layout-panel-active-color: var(--te-common-bg-primary-checked);
}

View File

@ -17,7 +17,8 @@ export const META_SERVICE = {
Help: 'engine.service.help',
Property: 'engine.service.property',
Properties: 'engine.service.properties',
ThemeSwitch: 'engine.service.themeSwitch'
ThemeSwitch: 'engine.service.themeSwitch',
Style: 'engine.service.style'
}
export const META_APP = {

View File

@ -17,7 +17,8 @@ export const HOOK_NAME = {
useModal: 'modal',
useNotify: 'notify',
useCustom: 'custom',
useMaterial: 'material'
useMaterial: 'material',
useStyle: 'style'
}
const hooksState = {
@ -39,6 +40,7 @@ const hooksState = {
[HOOK_NAME.useNotify]: {},
[HOOK_NAME.useModal]: {},
[HOOK_NAME.useMaterial]: {},
[HOOK_NAME.useStyle]: {},
[HOOK_NAME.useCustom]: {} // 自定义
}
@ -67,6 +69,7 @@ export const useEnv = (...args: any[]) => getHook(HOOK_NAME.useEnv, args)
export const useModal = (...args: any[]) => getHook(HOOK_NAME.useModal, args)
export const useNotify = (...args: any[]) => getHook(HOOK_NAME.useNotify, args)
export const useMaterial = (...args: any[]) => getHook(HOOK_NAME.useMaterial, args)
export const useStyle = (...args: any[]) => getHook(HOOK_NAME.useStyle, args)
export const useCustom = (...args: any[]) => getHook(HOOK_NAME.useCustom, args)
export function initHook(

View File

@ -12,9 +12,13 @@
import entry from './src/Main.vue'
import metaData from './meta'
import { default as StyleService } from './src/js/index'
import './src/styles/vars.less'
export default {
...metaData,
metas: [StyleService],
entry
}
export { StyleService }

View File

@ -167,7 +167,8 @@ watch(
classNameState.curSelector = className
// .test1.test2
classNameState.curSelectorEditable = getCurSelectorEditable(className)
}
},
{ immediate: true }
)
const setSelectorProps = (type, value) => {

View File

@ -0,0 +1,14 @@
import { HOOK_NAME, META_SERVICE, defineService } from '@opentiny/tiny-engine-meta-register'
import useStyle from './useStyle'
export default defineService({
id: META_SERVICE.Style,
type: 'MetaService',
apis: useStyle(),
composable: {
name: HOOK_NAME.useStyle
},
init: () => {
useStyle().initStylePanelWatch()
}
})

View File

@ -338,17 +338,11 @@ const updateStyle = (properties: any) => {
updateRect()
}
let hasWatchInitialized = false
export default () => {
if (!hasWatchInitialized) {
initStylePanelWatch()
hasWatchInitialized = true
}
return {
state,
updateStyle
updateStyle,
initStylePanelWatch
}
}