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

Component manager (2/3) #161

Merged
merged 74 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
461d593
enable colordecorator to monaco
softmarshmallow Sep 8, 2021
06890cc
update language sorting order for syntax highlight select
softmarshmallow Sep 9, 2021
b2f7fd0
disable response logging
softmarshmallow Sep 9, 2021
59ad620
Merge branch 'staging' of https://github.com/gridaco/assistant into a…
softmarshmallow Sep 9, 2021
3d290fe
add theme
softmarshmallow Sep 9, 2021
ebb5976
add empty selection view
softmarshmallow Sep 9, 2021
1c118c7
move code/preview to @app/design-to-code
softmarshmallow Sep 9, 2021
542dace
extract controlled code view from code screen for reuse
softmarshmallow Sep 9, 2021
7c45959
update invalid selection screen
softmarshmallow Sep 9, 2021
bff9cfa
update invalid selection optimized
softmarshmallow Sep 9, 2021
28fa697
add placeholder views fro master / instance component
softmarshmallow Sep 9, 2021
3b90e07
add data view for instance selection
softmarshmallow Sep 9, 2021
71b488d
add layer selection case
softmarshmallow Sep 9, 2021
5c3a90f
update configurable layer targetting & add notify to invalid selection
softmarshmallow Sep 9, 2021
e650882
single layer property saving with suggestion on root reference
softmarshmallow Sep 9, 2021
fc84887
update plugin-sdk meta storage
softmarshmallow Sep 10, 2021
8685db1
update single layer property shape & add index path finder, store it …
softmarshmallow Sep 10, 2021
da635f4
extract sibling finder to figma-xpath
softmarshmallow Sep 10, 2021
c81d773
add master property loading on instance
softmarshmallow Sep 10, 2021
578fab8
add mapped properties loading to variant master and instance
softmarshmallow Sep 10, 2021
150918d
add style: selection invalid
You-J Sep 10, 2021
ccc9841
add warning icon in package
You-J Sep 10, 2021
560278b
temp fix style: code wrapper opacity
You-J Sep 10, 2021
c13b672
bump design sdk with numeric variant type support
softmarshmallow Sep 10, 2021
515d294
Merge branch 'app/component-manage' of https://github.com/gridaco/ass…
softmarshmallow Sep 10, 2021
fc2814e
bump design sdk with figma api version up
softmarshmallow Sep 10, 2021
222d291
yarn
softmarshmallow Sep 10, 2021
ca1a0d9
stash fix style: selection code boxs
You-J Sep 10, 2021
29cf8f6
Merge branch 'app/component-manage' of https://github.com/gridaco/ass…
You-J Sep 10, 2021
bf5aa60
fix style selection none
You-J Sep 10, 2021
6b20a4f
fix style: pre
You-J Sep 10, 2021
1a56068
update configurablle layer to use pure coli for dynamic interface bui…
softmarshmallow Sep 10, 2021
a13793c
update all selection view to show coli based code ui
softmarshmallow Sep 10, 2021
645bb9c
update wrapper style
softmarshmallow Sep 10, 2021
6d61e2c
add cache to invalid code previewer
softmarshmallow Sep 10, 2021
2686fac
bump with design sdk - main component's deep layer selection error fi…
softmarshmallow Sep 10, 2021
da80b82
add general session caching for non cached-only type
softmarshmallow Sep 10, 2021
2ae5341
update node conversion short lived memory cache
softmarshmallow Sep 10, 2021
4b89073
update deselection cache timeout reset
softmarshmallow Sep 10, 2021
f2a6202
add visual store page manager
softmarshmallow Sep 10, 2021
3c27184
add more coli interface builder features with native formatting
softmarshmallow Sep 11, 2021
2eef165
add divider core component
softmarshmallow Sep 11, 2021
4a5f95c
move accessor type
softmarshmallow Sep 11, 2021
523b73a
fix style syntax error
softmarshmallow Sep 11, 2021
b946e4d
rm material ui, replaced with native
softmarshmallow Sep 11, 2021
9bea38e
update scoped react namer to follow & to be based on master component…
softmarshmallow Sep 11, 2021
e766226
add property suggestions to rect, ellipse and frame
softmarshmallow Sep 11, 2021
8207d01
update namer
softmarshmallow Sep 11, 2021
244449f
fix coli typo
softmarshmallow Sep 11, 2021
de26c91
bump coli & design to code
softmarshmallow Sep 11, 2021
12d7ef0
fix ci build
softmarshmallow Sep 11, 2021
b737d3b
add property hover with mock data based on @code-ui/hover
softmarshmallow Sep 12, 2021
9d16f48
bump with fixed design to code pkg
softmarshmallow Sep 12, 2021
b57e7f1
bump dtc
softmarshmallow Sep 12, 2021
4a717d3
update preview component & plugin sdk to get the targeet node's preview
softmarshmallow Sep 12, 2021
64501c7
add temp fields viewer to all selection type
softmarshmallow Sep 12, 2021
b7fdbaa
fix hover-view content style
You-J Sep 12, 2021
816be02
fix preview style to temp
You-J Sep 12, 2021
004055f
fix ci build with updated coli
softmarshmallow Sep 13, 2021
eee3721
Merge branch 'app/component-manage' of https://github.com/gridaco/ass…
You-J Sep 14, 2021
28c49f0
Change single propert to using code-ui package
You-J Sep 14, 2021
67a611c
stash add suggestions
You-J Sep 14, 2021
f637ab8
update package
You-J Sep 14, 2021
efab340
ci fix - explicit import figma type
softmarshmallow Sep 14, 2021
1fc49fc
Merge branch 'app/component-manage' of https://github.com/gridaco/ass…
softmarshmallow Sep 14, 2021
18a0f22
update button style
softmarshmallow Sep 14, 2021
b19c031
init app preference
softmarshmallow Sep 14, 2021
2662f95
add prefered framework preferences;
softmarshmallow Sep 14, 2021
707ed9c
add framework option persistance
softmarshmallow Sep 14, 2021
3db64dc
bump designtocode
softmarshmallow Sep 14, 2021
2d27693
add preview cache storage i/o
softmarshmallow Sep 14, 2021
87008b8
upate code-ui/token
You-J Sep 15, 2021
1077794
fix input attr
You-J Sep 15, 2021
b7ab2cc
Merge branch 'app/component-manage' of https://github.com/gridaco/ass…
You-J Sep 15, 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
2 changes: 1 addition & 1 deletion app/__plugin__init__/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT REMOVE THIS LINE
import "../lib/pages/code/__plugin";
import "@app/design-to-code/__plugin";
import "@app/data-mapper/__plugin";
import "@app/design-lint/__plugin";
import "@app/design-text-code-syntax-highlight/__plugin";
6 changes: 1 addition & 5 deletions app/lib/components/storybook-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ export class BoxTab extends React.Component {
componentDidMount() {
window.addEventListener("message", function (ev: MessageEvent) {
const msg = ev.data.pluginMessage;
switch (
msg.type
// case EK_GENERATED_CODE_PLAIN:
// case EK_PREVIEW_SOURCE:
) {
switch (msg.type) {
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/lib/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { DataMapperScreen } from "@app/data-mapper";
import { GlobalizationScreen } from "@app/i18n";
import { ToolboxScreen } from "../pages/tool-box";
import { FontReplacerScreen } from "@toolbox/font-replacer";
import { CodeScreen } from "../pages/code/code-screen";
import { CodeScreen } from "@app/design-to-code";
import { AboutScreen } from "../pages/about";
import { SigninScreen } from "@app/auth";
import { DesignTextCdoeSyntaxHighligherScreen } from "@app/design-text-code-syntax-highlight";
Expand Down
210 changes: 0 additions & 210 deletions app/lib/pages/code/code-screen.tsx

This file was deleted.

36 changes: 19 additions & 17 deletions figma-core/code-thread/broadcast-selection-preview.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import { EK_PREVIEW_SOURCE } from "@core/constant/ek.constant";
import { EK_CURRENT_SELECTION_PREVIEW_SOURCE_CHANGED } from "@core/constant/ek.constant";
import { preset, QuickImageExportPreset } from "@plugin-sdk/core";

/**
* extracts the png image of selection, broadcasts to listeners.
* @todo - only broadcast when required.
* @param selection
*/
export function broadcastSelectionPreview(selection: SceneNode) {
selection
.exportAsync({
format: "PNG",
contentsOnly: true,
constraint: {
type: "HEIGHT",
value: 250,
exportImage(selection).then((d) => {
figma.ui.postMessage({
type: EK_CURRENT_SELECTION_PREVIEW_SOURCE_CHANGED,
data: {
source: d,
name: selection.name,
},
})
.then((d) => {
figma.ui.postMessage({
type: EK_PREVIEW_SOURCE,
data: {
source: d,
name: selection.name,
},
});
});
});
}

export async function exportImage(
target: SceneNode,
options?: {
preset?: QuickImageExportPreset;
}
): Promise<Uint8Array> {
const config = preset(options?.preset ?? "small");
return await target.exportAsync(config);
}
17 changes: 12 additions & 5 deletions figma-core/code-thread/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ export function onfigmaselectionchange() {

// TODO: this will not trigger unless user deselects and re select the same node. currently node cache does not have expiry control.
let rnode;
const _cached = FigmaNodeCache.getLastConverted();
const _cached = FigmaNodeCache.getConverted(singleFigmaNodeSelection.id);
if (_cached) {
console.info("using cached", _cached.name);
rnode = _cached;
} else {
rnode = convert.intoReflectNode(
Expand All @@ -70,10 +71,16 @@ export function onfigmaselectionchange() {
// Logger.debug("reflect-converted-selection", rnode);

// region sync selection event (search "selectionchange" for references)
figma.ui.postMessage({
type: "selectionchange",
data: light.makeReference(rnode),
});
try {
const data = light.makeReference(rnode);
figma.ui.postMessage({
type: "selectionchange",
data: data,
});
} catch (_) {
figma.notify(`Oops. we don't support "${target.type}" yet.`);
console.error(_);
}
// endregion
FigmaNodeCache.setConverted(rnode);
runon(rnode);
Expand Down
4 changes: 4 additions & 0 deletions figma-core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ figma.on("currentpagechange", () => {
// MAIN INITIALIZATION
import { showUI } from "./code-thread/show-ui";
import { provideFigma } from "@design-sdk/figma";
import { createPrimaryVisualStorePageIfNonExists } from "./physical-visual-store/page-manager/craete-page-if-non-exist";
function main() {
MainImageRepository.instance = new ImageRepositories();
provideFigma(figma);
showUI();

// create primary visual store
createPrimaryVisualStorePageIfNonExists();
}

main();
Expand Down
Loading