Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin host optimization #153

Draft
wants to merge 40 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4ac0048
Merge pull request #144 from gridaco/staging
softmarshmallow Aug 23, 2021
085d9e4
Merge pull request #145 from gridaco/staging
softmarshmallow Aug 23, 2021
d62a6eb
Merge pull request #146 from gridaco/staging
softmarshmallow Aug 24, 2021
93b9c0a
add .gitignore on figma-lite (prod)
softmarshmallow Aug 24, 2021
f8bc7da
hide page "component" for production
softmarshmallow Aug 24, 2021
f8e6bb7
add "editorType" for figma production
softmarshmallow Aug 24, 2021
5d19e4e
update metadata
softmarshmallow Aug 24, 2021
bd056e2
add empty state notifier for run-lint
softmarshmallow Aug 24, 2021
0efb652
fix style footer wrapper
You-J Aug 24, 2021
70eba2c
Merge pull request #148 from gridaco/hotfix/layout-resolution
softmarshmallow Aug 24, 2021
5ae0594
Merge pull request #149 from gridaco/staging
softmarshmallow Aug 25, 2021
0dae85f
add branding resource & update readme
softmarshmallow Aug 25, 2021
1f37bfe
Merge pull request #150 from gridaco/staging
softmarshmallow Aug 25, 2021
020b7bc
Add Product hunt button to README
softmarshmallow Aug 26, 2021
30a92f3
Merge branch 'main' of https://github.com/gridaco/assistant into main
softmarshmallow Aug 26, 2021
64e9ce1
Update README.md
softmarshmallow Aug 26, 2021
c053fae
rename assistant-icons to ui-icons
softmarshmallow Aug 26, 2021
74a2c5f
rename assistant-lint-icons to ui-lint-icons
softmarshmallow Aug 26, 2021
f5ebb8d
move auth & analytics under _firstparty directory under packages
softmarshmallow Aug 26, 2021
aa1f1da
update gitignore to ignore .log files
softmarshmallow Aug 26, 2021
637a124
move check icon under ui-icons; move scene-view under @app/scene-view
softmarshmallow Aug 26, 2021
8743947
move draggable util under plugin-sdk-draggable
softmarshmallow Aug 26, 2021
987f571
update button style variable name from `a-zButton` to `a-zButtonStyle…
softmarshmallow Aug 26, 2021
4771205
update next.config.js for build
softmarshmallow Aug 26, 2021
b74656e
update plugin init & plugin target platform set; move init plugin und…
softmarshmallow Aug 26, 2021
8b5a2cd
fix figma native build
softmarshmallow Aug 26, 2021
80c1962
rename /figma to /figma-native
softmarshmallow Aug 26, 2021
8f4dee6
rename /figma-lite to /figma
softmarshmallow Aug 26, 2021
d6e11a0
swap workspace commands & update README
softmarshmallow Aug 26, 2021
93a6394
move `__plugin__init__` move meta data
softmarshmallow Aug 27, 2021
79d573e
move meta editor; component manager; schema editor; ui-codebox; ui-pr…
softmarshmallow Aug 27, 2021
2bd3b7f
move toolbox features; move g11n to i18n (with rename) & more
softmarshmallow Aug 27, 2021
0ed1f0a
move figma related docs
softmarshmallow Aug 27, 2021
90490b4
update packge docs
softmarshmallow Aug 27, 2021
80db25f
update docs
softmarshmallow Aug 27, 2021
f67ea01
Merge pull request #151 from gridaco/organization
softmarshmallow Aug 27, 2021
727d7ae
Enabled terser plugin back. optimized ui build
softmarshmallow Aug 27, 2021
7724f03
optimization with vanilla html
softmarshmallow Aug 28, 2021
d43237c
stash add loading html
You-J Nov 5, 2021
b861729
stash loading style in ui html
You-J Nov 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ webdev/.eslintcache


# we use yarn
package-lock.json
package-lock.json

# log including yarn error log
.log
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ title: Grida assistant for figma, sketch, xd

<meta name="description" content="figma to flutter code exporter, lint your design. generate human level quality code from figma">
<meta name="title" content="Grida assistant">

![Grida assistant](./branding/assistant-cover-v2021.8.0.png)

![Grida assistant](./branding/assistant-cover-v2021.2.0.png)
<div style="text-align:center"><a href="https://www.producthunt.com/posts/grida-assistant-figma-2-flutter-react?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-grida-assistant-figma-2-flutter-react" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=310028&theme=light" alt="Grida Assistant - Figma 2 Flutter &React - Free & Opensource Design2Code Plugin with lot more features. | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a></div>

# Grdia Assistant plugin (figma to flutter)

Expand Down Expand Up @@ -43,9 +45,12 @@ cd assistant
# [REQUIRED] yarn will install dependencies, link packages, and generate compiled code of packages, so it can be referenced by root projects.
yarn

# [OPTIONAL 1] run figma plugin in dev mode
# [OPTIONAL 1] run figma plugin in dev mode (use localhost server) (recommanded)
yarn figma

# [OPTIONAL 1-2] run figma plugin in dev mode (native)
yarn figma-native

# [OPTIONAL 2]run sketch plugin in dev mode
yarn sketch

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions app/__plugin__init__/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// DO NOT REMOVE THIS LINE
import "../lib/pages/code/__plugin";
import "@app/data-mapper/__plugin";
import "@app/design-lint/__plugin";
2 changes: 1 addition & 1 deletion app/lib/components/animation/animated-check-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import styled from "@emotion/styled";

import { motion } from "framer-motion";
import { CheckIcon } from "../Icon/check-icon";
import CheckIcon from "@assistant/icons/check";

const variants = {
"make-active": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface IProgressBar {
contorl?: () => void;
}

export function ProgressBar(props: IProgressBar) {
export function AnimatedProgressBar(props: IProgressBar) {
return (
<Background>
<AnimatePresence>
Expand Down
4 changes: 2 additions & 2 deletions app/lib/components/comming-soon-template.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from "@emotion/styled";
import React, { ReactNode } from "react";
import { BlackButton } from "./style/global-style";
import { BlackButtonStyle } from "@ui/core/button-style";

interface Props {
coverImage?: string;
Expand Down Expand Up @@ -50,6 +50,6 @@ const ButtonWrapper = styled.div`
`;

const Button = styled.button`
${BlackButton}
${BlackButtonStyle}
width: calc(100vw - 32px);
`;
3 changes: 2 additions & 1 deletion app/lib/components/navigation/secondary-workmode-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled from "@emotion/styled";
import React from "react";
import { Column, Row } from "../style/global-style";
import { Column, Row } from "@ui/core";
import { SecondaryWorkmodeChoice } from "./secondary-workmode-choice";

export function SecondaryWorkmodeMenu<T extends string>(props: {
menus: {
id: T;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Button from "@material-ui/core/Button";
import * as React from "react";
import { BoxDirectoryInput } from "./box-directory-input";
// import { BoxDirectoryInput } from "./box-directory-input";

const TEST_STORYBOOK_ROOT =
"https://5f7d1f04988db70022c94c9a-bxsgusmnlc.chromatic.com";
Expand Down Expand Up @@ -39,7 +39,7 @@ export class BoxTab extends React.Component {
<div />
<Button onClick={this.onClickOpenStorybook}>open in storybook</Button>
<Button onClick={this.onClickOpenGithub}>open in github</Button>
<BoxDirectoryInput />
{/* <BoxDirectoryInput /> */}
<div />
<h6>Box section end</h6>
</div>
Expand Down
17 changes: 10 additions & 7 deletions app/lib/components/upload-steps.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React, { useEffect, useState } from "react";
import styled from "@emotion/styled";
import { BlackButton, TransparencyButton } from "./style/global-style";
import {
BlackButtonStyle,
TransparentButtonStyle,
} from "@ui/core/button-style";
import { Button } from "@material-ui/core";
import { ProgressBar } from "./animation/progress-bar";
import { AnimatedProgressBar } from "./animation/animated-progress-bar";
import { AnimatedCheckIcon } from "./animation/animated-check-icon";
import { motion } from "framer-motion";
import { Preview } from ".";
import { CheckIcon } from "./Icon/check-icon";
import { Preview } from "@ui/previewer";
import CheckIcon from "@assistant/icons/check";

const step = [
"converting design to universal format",
Expand Down Expand Up @@ -40,7 +43,7 @@ export function UploadSteps() {
return (
<>
<Preview auto />
{isLoading && <ProgressBar contorl={animateHandle} />}
{isLoading && <AnimatedProgressBar contorl={animateHandle} />}
<InnerWrapper variants={fieldVariants} animate="make-active">
{isLoading ? (
<Loading>
Expand Down Expand Up @@ -148,11 +151,11 @@ const IconBox = styled.div`
`;

const CheckButton = styled(Button)`
${BlackButton};
${BlackButtonStyle};
width: 100%;
`;
const UncheckButton = styled(Button)`
${TransparencyButton}
${TransparentButtonStyle}
width: 100%;
cursor: pointer;
text-transform: initial;
Expand Down
3 changes: 1 addition & 2 deletions app/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from "./components";
export * from "./main"
export * from "./main";
2 changes: 0 additions & 2 deletions app/lib/lint/index.ts

This file was deleted.

40 changes: 21 additions & 19 deletions app/lib/main/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import React, { useState, useEffect } from "react";
import "../app.css"; /** TODO: remove raw css usage. */
import { initialize } from "../analytics";
import { initialize as analytics_initialize } from "@assistant-fp/analytics";

// UI COMPS
import { EK_SET_APP_MODE } from "../constants/ek.constant";
import { EK_SET_APP_MODE } from "@core/constant/ek.constant";
import { PluginApp } from "plugin-app";
import BatchMetaEditor from "../pages/tool-box/batch-meta-editor";
import { useHistory, Switch, Route } from "react-router-dom";
import type { TargetPlatform } from "@plugin-sdk/core";

//
// region screens import
import { FontReplacerScreen } from "../pages/tool-box/font-replacer";
import { ButtonMakerScreen } from "../pages/design/button-maker-screen";
import { ComponentViewScreen } from "../pages/component-view";
import { ButtonMakerScreen } from "@app/button-maker";
import { LayoutViewScreen } from "../pages/layout-view";
import { LintScreen } from "../pages/lint/lint-screen";
import { GlobalizationScreen } from "../pages/g11n-screen";
import { IconsScreen } from "../pages/icons-screen";
import { CodeScreen } from "../pages/code/code-screen";
import { ComponentViewScreen } from "@app/component-manage";
import { LintScreen } from "@app/design-lint";
import { IconsScreen } from "@app/icons-loader";
import { MetaEditorScreen, BatchMetaEditor } from "@app/meta-editor";
import { ExporterScreen } from "@app/export-scene-as-json";
import { DataMapperScreen } from "@app/data-mapper";
import { GlobalizationScreen } from "@app/i18n";
import { ToolboxScreen } from "../pages/tool-box";
import { MetaEditorScreen } from "../pages/tool-box/meta-editor";
import { ExporterScreen } from "../pages/tool-box/exporter";
import { DataMapperScreen } from "../pages/tool-box/data-mapper/data-mapper-screen";
import { TargetPlatform } from "../utils/plugin-init/init-target-platform";
import { FontReplacerScreen } from "@toolbox/font-replacer";
import { CodeScreen } from "../pages/code/code-screen";
import { AboutScreen } from "../pages/about";
import Signin from "../pages/signin";
import { SigninScreen } from "@app/auth";
// endregion screens import
//

Expand All @@ -50,7 +49,7 @@ import {
SecondaryMenuDropdown,
} from "../components/navigation";
import styled from "@emotion/styled";
import { Column, Row } from "../components/style/global-style";
import { Column, Row } from "@ui/core";
import { UploadSteps } from "../components/upload-steps";

function Screen(props: { screen: WorkScreen }) {
Expand Down Expand Up @@ -86,7 +85,7 @@ function Screen(props: { screen: WorkScreen }) {
case WorkScreen.scene_upload_steps_final:
return <UploadSteps />;
case WorkScreen.signin:
return <Signin />;
return <SigninScreen />;
default:
return <div>Not found</div>;
}
Expand Down Expand Up @@ -260,16 +259,19 @@ export default function App(props: { platform: TargetPlatform }) {

// region init analytics
try {
initialize();
analytics_initialize();
} catch (e) {
console.warn("Analytics disabled", e);
}
// endregion init GA
}, []);

const Router = getDedicatedRouter();

const Loading = <></>;

return (
<PluginApp platform={props.platform}>
<PluginApp loading={Loading} platform={props.platform}>
{/* @ts-ignore */}
<Router>
<Switch>
Expand Down
1 change: 0 additions & 1 deletion app/lib/mock/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion app/lib/navigation/release-visibility-preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ReleaseVisibilityPreference {
const SCREEN_VISIBILITY_PREFERENCE: Map<WorkScreen, ReleaseChannel> = new Map([
[WorkScreen.code, "release"],
[WorkScreen.about, "release"],
[WorkScreen.component, "release"],
[WorkScreen.component, "beta"],
[WorkScreen.layout, "beta"],
[WorkScreen.icon, "release"],
[WorkScreen.lint, "release"],
Expand Down
42 changes: 21 additions & 21 deletions app/lib/pages/about/index.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import React from "react";
import styled from "@emotion/styled";
import * as about from "../../about";
import * as about from "./manifest";
import { __auth_proxy, ProxyAuthenticationMode } from "@base-sdk-fp/auth";
import { useHistory } from "react-router-dom";
import BackArrowIcon from "@assistant/icons/back-arrow";
import { PluginSdk } from "@plugin-sdk/app";
const URLS = {
logo_256:
"https://bridged-service-static.s3-us-west-1.amazonaws.com/branding/logo/256.png",
github_assitant: "https://github.com/bridgedxyz/assistant",
github_bridged: "https://github.com/bridgedxyz",
homepage_bridged: "https://bridged.xyz/",
github_assitant: "https://github.com/gridaco/assistant",
github_grida: "https://github.com/gridaco",
homepage_grida: "https://grida.co/",
/**
* @todo
*/
homepage_assitant: "N/A",
report_issue:
"https://github.com/bridgedxyz/assistant/issues/new?assignees=&labels=&template=bug_report.md&title=%5BBug%5D",
"https://github.com/gridaco/assistant/issues/new?assignees=&labels=&template=bug_report.md&title=%5BBug%5D",
feature_request:
"https://github.com/bridgedxyz/assistant/issues/new?assignees=&labels=&template=feature_request.md&title=FeatureRequest",
signup: "https://accounts.bridged.xyz/signup",
blog: "https://blog.bridged.xyz",
twitter: "https://twitter.com/bridgedxyz",
facebook: "https://www.facebook.com/bridged.xyz/",
"https://github.com/gridaco/assistant/issues/new?assignees=&labels=&template=feature_request.md&title=FeatureRequest",
signup: "https://accounts.grida.co/signup",
blog: "https://blog.grida.co",
twitter: "https://twitter.com/grida_co",
facebook: "https://www.facebook.com/grida.co/",
youtube: "https://www.youtube.com/channel/UCgJO5apXl_pXRfTxNrkbEBw",
slack:
"https://join.slack.com/t/bridgedxyz/shared_invite/zt-nmf59381-prFEqq032K~aWe_zOekUmQ",
instagram: "https://www.instagram.com/bridged.xyz/",
"https://join.slack.com/t/gridaco/shared_invite/zt-nmf59381-prFEqq032K~aWe_zOekUmQ",
instagram: "https://www.instagram.com/grida.co/",
};

export function AboutScreen() {
Expand Down Expand Up @@ -63,42 +63,42 @@ export function AboutScreen() {
</MenuItem>
</MenuSection>
<MenuSection>
<MenuSectionTitleItem>More from Bridged</MenuSectionTitleItem>
<MenuSectionTitleItem>More from Grida</MenuSectionTitleItem>
<MenuItem onClick={signIntoAssistant}>Signup / Signin</MenuItem>
<MenuItem onClick={linkTo(URLS.blog)}>Medium</MenuItem>
<MenuItem onClick={linkTo(URLS.homepage_bridged)}>Homepage</MenuItem>
<MenuItem onClick={linkTo(URLS.homepage_grida)}>Homepage</MenuItem>
</MenuSection>
</MenuContainer>
<FooterSocialContainer>
<SocialIconButton
src={_social_icon("antd-twitter-outlined")}
alt="bridged on twitter"
alt="Grida on twitter"
onClick={linkTo(URLS.twitter)}
/>
<SocialIconButton
src={_social_icon("antd-youtube-default")}
alt="bridged on youtube"
alt="Grida on youtube"
onClick={linkTo(URLS.youtube)}
/>
<SocialIconButton
src={_social_icon("antd-slack-circle-default")}
alt="bridged on slack"
alt="Grida on slack"
onClick={linkTo(URLS.slack)}
/>
<SocialIconButton
src={_social_icon("mdi_facebook")}
alt="bridged on facebook"
alt="Grida on facebook"
onClick={linkTo(URLS.facebook)}
/>
<SocialIconButton
src={_social_icon("antd-instagram-default")}
alt="bridged on instagram"
alt="Grida on instagram"
onClick={linkTo(URLS.instagram)}
/>
<SocialIconButton
src={_social_icon("antd-github-default")}
alt="bridged on github"
onClick={linkTo(URLS.github_bridged)}
alt="Grida on github"
onClick={linkTo(URLS.github_grida)}
/>
</FooterSocialContainer>
</>
Expand Down
2 changes: 1 addition & 1 deletion app/lib/about.ts → app/lib/pages/about/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// const _package = require("../package.jsonn");
export const name = "Grida Assistant";
export const version = "2021.2.2f0"; /*_package.version*/
export const version = "2021.8.1f0"; /*_package.version*/
export const versionText = `v${version}`;
2 changes: 1 addition & 1 deletion app/lib/pages/code/__plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
EK_GENERATED_CODE_PLAIN,
EK_IMAGE_ASSET_REPOSITORY_MAP,
} from "app/lib/constants/ek.constant";
} from "@core/constant/ek.constant";
import {
onService,
_Code_Event,
Expand Down
8 changes: 4 additions & 4 deletions app/lib/pages/code/code-screen.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useState } from "react";
import CodeBox, { SourceInput } from "../../components/codebox";
import { Preview } from "../../components/preview";
import { CodeBox, SourceInput } from "@ui/codebox";
import { Preview } from "@ui/previewer";
import {
EK_GENERATED_CODE_PLAIN,
EK_IMAGE_ASSET_REPOSITORY_MAP,
} from "../../constants/ek.constant";
} from "@core/constant/ek.constant";
import { repo_assets } from "@design-sdk/core";
import { assistant as analytics } from "@analytics.bridged.xyz/internal";
import {
Expand All @@ -19,7 +19,7 @@ import { PluginSdk } from "@plugin-sdk/app";
import { CodeScreenFooter } from "./footer-action/code-screen-footer";
import { CodeOptionsControl } from "./code-options-control";
import { fromApp, CodeGenRequest } from "./__plugin/events";
import { useSingleSelection } from "../../utils/plugin-hooks";
import { useSingleSelection } from "plugin-app";

type DesigntoCodeUserOptions = FrameworkOption;

Expand Down
Loading