Skip to content

Commit ac58880

Browse files
committed
revert: unwated changes after rebase
1 parent 8720d09 commit ac58880

File tree

10 files changed

+20
-61
lines changed

10 files changed

+20
-61
lines changed

libs/frontend/abstract/application/src/component/component.service.interface.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ import type {
2323
export interface IComponentService
2424
extends Overwrite<
2525
ICrudService<IRef, ICreateComponentData, IUpdateComponentData>,
26-
{
27-
/** *********** ✨ Codeium Command ⭐ ************ */
28-
/**
29-
* Create a component with the given data. If `createRootElement` is true, creates
30-
* a root element for the component. If `createRootElement` is false, returns
31-
* `undefined`.
32-
*
33-
* @param data The component data.
34-
* @param createRootElement Whether to create a root element for the component.
35-
* @returns The created component model.
36-
*/
37-
/** **** 3e0bb368-082d-46da-ac3c-c93c386f0bf7 ****** */
38-
create(
39-
data: ICreateComponentData,
40-
createRootElement?: boolean,
41-
): Promise<IComponentModel>
42-
}
26+
{ create(data: ICreateComponentData): Promise<IComponentModel> }
4327
>,
4428
IQueryService<IComponentModel, ComponentWhere, ComponentOptions>,
4529
IPaginateable<IComponentModel> {

libs/frontend/abstract/application/src/renderer/runtime-element/runtime.element.service.interface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export interface IRuntimeElementService {
1717
parentElement: Nullable<IRuntimeElementModel>,
1818
propKey?: string,
1919
): IRuntimeElementModel
20-
delete(runtimeElement: IRuntimeElementModel): void
2120
getExpandedCompositeKeys(): Array<string>
2221
maybeRuntimeElement(compositeKey: string): Maybe<IRuntimeElementModel>
2322
remove(runtimeElement: IRuntimeElementModel): void

libs/frontend/abstract/domain/src/component/component.domain.service.interface.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type {
22
RenderTypeSelectOption,
33
SelectOption,
44
} from '@codelab/frontend/abstract/types'
5-
import type { IComponentDto, ICreateComponentData } from '@codelab/shared/abstract/core'
5+
import type { IComponentDto } from '@codelab/shared/abstract/core'
66
import type { ObjectMap } from 'mobx-keystone'
77

88
import type { IHydrateable } from '../shared'
@@ -13,8 +13,6 @@ export interface IComponentDomainService
1313
componentList: Array<IComponentModel>
1414
components: ObjectMap<IComponentModel>
1515
sortedComponentsList: Array<IComponentModel>
16-
17-
add(data: ICreateComponentData): IComponentModel
1816
component(id: string): IComponentModel
1917
findById(id: string): IComponentModel
2018
getRenderTypeOptions(

libs/frontend/abstract/domain/src/shared/constant.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*
66
* node.dataset.componentId
77
*/
8-
98
export const DATASET_COMPONENT_ID = 'componentId'
109

1110
export const DATA_COMPONENT_ID = 'data-component-id'

libs/frontend/application/builder/src/sections/explorer-pane/BuilderPrimarySidebar.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
import type { CuiSidebarView } from '@codelab/frontend/presentation/codelab-ui'
88

99
import PlusOutlined from '@ant-design/icons/PlusOutlined'
10-
import { isRuntimeElement } from '@codelab/frontend/abstract/application'
1110
import { isComponent, isPage } from '@codelab/frontend/abstract/domain'
1211
import { UiKey } from '@codelab/frontend/abstract/types'
1312
import { CuiSidebar } from '@codelab/frontend/presentation/codelab-ui'
@@ -33,11 +32,10 @@ export const BuilderPrimarySidebar = observer<{
3332
}>(({ containerNode, isLoading = false }) => {
3433
const router = useRouter()
3534
const { appId, componentId, pageId } = useUrlPathParams()
36-
const { rendererService,builderService } = useApplicationStore()
35+
const { rendererService } = useApplicationStore()
3736
const { createPopover: createElementPopover } = useElementService()
3837
const { createPopover: createFieldPopover } = useFieldService()
3938
const { createPopover: createActionPopover } = useActionService()
40-
const selectedNode = builderService.selectedNode?.current
4139
const store = containerNode.store.maybeCurrent
4240
const renderer = rendererService.activeRenderer?.current
4341
const runtimeContainerNode = renderer?.runtimeContainerNode

libs/frontend/application/builder/src/sections/explorer-pane/ElementContextMenu.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { IElementTreeViewDataNode } from '@codelab/frontend/abstract/applic
44
import type { Nullable } from '@codelab/shared/abstract/types'
55

66
import { isComponent } from '@codelab/frontend/abstract/domain'
7+
import { PageType } from '@codelab/frontend/abstract/types'
78
import { useComponentService } from '@codelab/frontend-application-component/services'
89
import {
910
useCloneElementService,
@@ -20,7 +21,6 @@ import { Dropdown } from 'antd'
2021
import { observer } from 'mobx-react-lite'
2122
import { useRouter } from 'next/navigation'
2223
import { useState } from 'react'
23-
import { PageType } from '@codelab/frontend/abstract/types'
2424

2525
export interface ContextMenuProps {
2626
onBlur?(): unknown
@@ -43,6 +43,7 @@ export const ElementContextMenu = observer<
4343
const { createPopover, deletePopover } = useElementService()
4444
const router = useRouter()
4545
const { appId, componentId, pageId } = useUrlPathParams()
46+
4647
const cloneElementService = useCloneElementService({
4748
builderService,
4849
componentService,
@@ -97,25 +98,14 @@ export const ElementContextMenu = observer<
9798
await cloneElementService.convertElementToComponent(runtimeElement)
9899
}
99100

100-
const onEditComponent = async () => {
101+
const onEditComponent = () => {
101102
if (!isComponent(element.renderType.current)) {
102103
return
103104
}
104105

105-
await router.push(
106+
router.push(
106107
PageType.ComponentBuilder({ componentId: element.renderType.current.id }),
107108
)
108-
109-
// const runtimeElement = runtimeElementService.runtimeElement(treeNode.key)
110-
111-
// const runtimeComponent = runtimeElement.children.find(
112-
// (child): child is IRuntimeComponentModel =>
113-
// isRuntimeComponent(child) &&
114-
// child.component.id === element.renderType.id,
115-
// )
116-
117-
// runtimeComponent &&
118-
// builderService.setSelectedNode(runtimeComponentRef(runtimeComponent))
119109
}
120110

121111
const menuItems = [

libs/frontend/application/builder/src/sections/explorer-pane/builder-tree/ElementTreeView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ export const ElementTreeView = observer<{
4343
event.stopPropagation()
4444
}}
4545
onDrop={handleDrop}
46-
onExpand={(newExpandedKeys) => {
46+
onExpand={(expandedKeys) => {
4747
runtimeElementService.elementsList.forEach((runtimeElement) => {
4848
// element will be marked modified automatically
4949
runtimeElement.element.current.setExpanded(
50-
newExpandedKeys.includes(runtimeElement.compositeKey),
50+
expandedKeys.includes(runtimeElement.compositeKey),
5151
)
5252
})
5353

libs/frontend/application/builder/src/sections/explorer-pane/tab-contents/CustomComponents.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const CustomComponents = observer(() => {
2424
})
2525

2626
const editComponent = (componentId: string) => {
27-
// sidebar should be explorer
2827
router.push(PageType.ComponentBuilder({ componentId }))
2928
}
3029

libs/frontend/application/renderer/src/store/runtime-element-style.model.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { Ref } from 'mobx-keystone'
1111
import {
1212
ElementStylePseudoClass,
1313
getRendererService,
14+
RendererType,
1415
} from '@codelab/frontend/abstract/application'
1516
import { getPreferenceDomainService } from '@codelab/frontend/abstract/domain'
1617
import { IBreakpointType } from '@codelab/shared/abstract/core'
@@ -23,7 +24,7 @@ import { jsonStringToCss, parseCssStringIntoObject } from './style.utils'
2324
@model('@codelab/RuntimeElementStyle')
2425
export class RuntimeElementStyle
2526
extends Model({
26-
builderStyle: prop<string>().withSetter(),
27+
builderStyle: prop<Maybe<string>>().withSetter(),
2728
element: prop<Ref<IElementModel>>(),
2829
})
2930
implements IRuntimeElementStyleModel
@@ -88,6 +89,12 @@ export class RuntimeElementStyle
8889

8990
@computed
9091
get styleStringWithBreakpoints(): string {
92+
const rendererType = this.renderer.rendererType
93+
94+
const isProduction =
95+
rendererType === RendererType.Production ||
96+
rendererType === RendererType.Preview
97+
9198
const breakpointStyles = []
9299

93100
for (const breakpoint of this.breakpointsByPrecedence) {
@@ -125,7 +132,9 @@ export class RuntimeElementStyle
125132

126133
const styleWithBreakPoints = breakpointStyles.join('\n')
127134

128-
return styleWithBreakPoints
135+
return isProduction || !this.builderStyle
136+
? styleWithBreakPoints
137+
: [styleWithBreakPoints, this.builderStyle].join('\n')
129138
}
130139

131140
@computed

libs/frontend/infra/mobx/store/src/stores/test.store.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {
33
IRendererDto,
44
IRootStore,
55
} from '@codelab/frontend/abstract/application'
6-
import type { IDomainStore } from '@codelab/frontend/abstract/domain'
76
import type {
87
IApiActionDto,
98
IAppDto,
@@ -495,22 +494,6 @@ export const createTestStore = () => {
495494
}
496495

497496
@modelAction
498-
/** *********** ✨ Codeium Command ⭐ ************ */
499-
/**
500-
* Sets up a runtime component within a page.
501-
*
502-
* This function initializes a runtime component by configuring the page,
503-
* renderer, and root element. It creates and associates a component with
504-
* the root element, writes it to the cache, and returns relevant elements
505-
* and their states for further operations.
506-
*
507-
* @param rendererType - The type of renderer to use (default: RendererType.Preview).
508-
* @param pageKind - The kind of page to set up (default: IPageKind.Regular).
509-
* @returns An object containing the component, page, rendered output,
510-
* renderer, root element, and runtime root element.
511-
*/
512-
513-
/** **** b4fd35ed-bbb7-44a7-8c7e-9081a4518bd8 ****** */
514497
setupRuntimeComponent() {
515498
const { page, renderer, runtimePage } = this.setupPage()
516499
const rootElement = page.rootElement.current

0 commit comments

Comments
 (0)