Skip to content

Commit 1bc2be5

Browse files
Merge pull request #94 from gridaco/staging
Dec release #2 - Stateful Editor
2 parents 4b6112f + 84d0b03 commit 1bc2be5

67 files changed

Lines changed: 2817 additions & 5814 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

editor/babel.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ module.exports = {
1010
components: "./components",
1111
icons: "./icons",
1212
layouts: "./layouts",
13+
scaffolds: "./scaffolds",
1314
utils: "./utils",
15+
core: "./core",
1416
public: "./public",
1517
hooks: "./hooks",
1618
},

editor/components/app-runner/app-runner.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ export function AppRunner(props: {
4949
>
5050
<div
5151
style={{
52+
borderRadius: 4,
53+
overflow: "hidden",
5254
width: viewportsize.width || sceneSize.w || "100%",
5355
height: viewportsize.height || sceneSize.h || "100%",
54-
boxShadow: "0px 0px 48px #63636328",
56+
boxShadow: "0px 0px 48px #00000020",
5557
}}
5658
>
5759
<DedicatedFrameworkRunner
@@ -162,14 +164,7 @@ function ResizableContainer({
162164
};
163165

164166
return (
165-
<Resizable
166-
ref={resizable}
167-
defaultSize={initialSize}
168-
onResize={_onResize}
169-
handleComponent={{
170-
bottomRight: ResizeKnob(),
171-
}}
172-
>
167+
<Resizable ref={resizable} defaultSize={initialSize} onResize={_onResize}>
173168
{children}
174169
</Resizable>
175170
);

editor/components/app-runner/vanilla-app-runner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function VanillaRunner({
1010
source: string;
1111
componentName: string;
1212
}) {
13-
const inlinesource = source || `<p>Hello world</p>`;
13+
const inlinesource = source || `<div></div>`;
1414
return (
1515
<>
1616
<iframe

editor/components/clear-remote-design-session-cache/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import React from "react";
22
import { RemoteDesignSessionCacheStore } from "../../store";
33

4-
export function ClearRemoteDesignSessionCache(props: { url: string }) {
4+
export function ClearRemoteDesignSessionCache(
5+
props:
6+
| { url: string }
7+
| {
8+
file: string;
9+
node: string;
10+
}
11+
) {
512
const clearCache = () => {
6-
new RemoteDesignSessionCacheStore({ url: props.url }).clear();
7-
alert("cleared - " + props.url);
13+
new RemoteDesignSessionCacheStore(props).clear();
14+
alert("cleared - " + JSON.stringify(props));
815
};
916

1017
return (

editor/components/code-editor/monaco.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function MonacoEditor(props: MonacoEditorProps) {
2626
defaultLanguage={
2727
pollyfill_language(props.defaultLanguage) ?? "typescript"
2828
}
29+
loading={<></>}
2930
defaultValue={props.defaultValue ?? "// no content"}
3031
theme="vs-dark"
3132
options={{ ...props.options }}

editor/components/codeui-code-options-control/code-options-control.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export function CodeOptionsControl(props: CodeOptionsControlProps) {
3131
all_preset_options_map__prod[__presetname]
3232
);
3333

34+
useEffect(() => {
35+
// trigger initial value
36+
props.onUseroptionChange(useroption);
37+
}, []);
38+
3439
// FIXME: this should be fixed on https://github.com/gridaco/code-like-ui (view CURSOR)
3540
const __dirty_sort_framework = (): Option<string>[] => {
3641
const presets = [

editor/components/scene-preview/scene-preview.tsx renamed to editor/components/design-preview/design-preview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from "react";
22
import { FigmaEmbedCanvas } from "components/canvas";
33

4-
interface ScenePreviewConfig {
4+
interface DesignPreviewConfig {
55
fileid: string;
66
sceneid: string;
77
origin: "figma" | "sketch" | "xd" | "nothing";
88
displayAs: "embed" | "static" | "nothing";
99
}
1010

11-
export function ScenePreview(props: {
12-
config: ScenePreviewConfig;
11+
export function DesignPreview(props: {
12+
config: DesignPreviewConfig;
1313
width: string;
1414
height: string;
1515
}) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./design-preview";

editor/components/editor/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Primary editor components
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from "react";
2+
import styled from "@emotion/styled";
3+
import { useEditorState } from "core/states";
4+
5+
export function AppbarFragmentForCanvas() {
6+
const [state] = useEditorState();
7+
return (
8+
<RootWrapperAppbarFragmentForCanvas>
9+
<Breadcrumbs>{state.design?.current?.name}</Breadcrumbs>
10+
</RootWrapperAppbarFragmentForCanvas>
11+
);
12+
}
13+
14+
const RootWrapperAppbarFragmentForCanvas = styled.div`
15+
display: flex;
16+
justify-content: center;
17+
flex-direction: row;
18+
align-items: center;
19+
flex: 1;
20+
gap: 10px;
21+
align-self: stretch;
22+
background-color: rgba(37, 37, 38, 1);
23+
box-sizing: border-box;
24+
padding: 10px 24px;
25+
`;
26+
27+
const Breadcrumbs = styled.span`
28+
text-overflow: ellipsis;
29+
font-size: 14px;
30+
color: grey;
31+
font-family: "Helvetica Neue", sans-serif;
32+
font-weight: 400;
33+
text-align: left;
34+
`;

0 commit comments

Comments
 (0)