@toghen/figma 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -2
- package/cli/bin.mjs +19 -0
- package/cli/bridge.ts +243 -0
- package/cli/check.ts +62 -0
- package/cli/figcraft.ts +764 -0
- package/cli/figcraftApply.ts +1067 -0
- package/cli/figcraftFile.ts +476 -0
- package/cli/figcraftLibrary.ts +147 -0
- package/cli/figcraftRecord.ts +121 -0
- package/cli/figcraftScene.ts +661 -0
- package/cli/main.ts +218 -0
- package/cli/members.ts +65 -0
- package/cli/run.ts +756 -0
- package/component-files.md +665 -0
- package/dist/code.js +24161 -0
- package/dist/manifest.json +23 -0
- package/dist/ui.html +6918 -0
- package/guide.md +985 -0
- package/main/code.ts +50 -0
- package/main/components/apply.ts +704 -0
- package/main/components/endOfRun.ts +168 -0
- package/main/components/errors.ts +17 -0
- package/main/components/fieldWriter.ts +497 -0
- package/main/components/file.ts +263 -0
- package/main/components/receipt.ts +228 -0
- package/main/components/resolve.ts +1193 -0
- package/main/components/run.ts +273 -0
- package/main/components/snapshot.ts +341 -0
- package/main/components/stamp.ts +312 -0
- package/main/components/update.ts +465 -0
- package/main/dispatcher.ts +33 -0
- package/main/engines/batchRunner.ts +200 -0
- package/main/engines/ioAdapter.ts +132 -0
- package/main/engines/operationExecutor.ts +512 -0
- package/main/engines/propertyMapper.ts +221 -0
- package/main/engines/queryEngine.ts +45 -0
- package/main/engines/styleSyncEngine.ts +444 -0
- package/main/engines/variableSyncEngine.ts +561 -0
- package/main/handlers/auditSelection.ts +60 -0
- package/main/handlers/boundLayers.ts +51 -0
- package/main/handlers/cancelOperation.ts +18 -0
- package/main/handlers/executeApplyBindings.ts +69 -0
- package/main/handlers/executeScaffold.ts +59 -0
- package/main/handlers/executeStyleSync.ts +121 -0
- package/main/handlers/executeVariableSync.ts +82 -0
- package/main/handlers/exportDocument.ts +114 -0
- package/main/handlers/getSelection.ts +43 -0
- package/main/handlers/index.ts +30 -0
- package/main/handlers/inspectCorrespondence.ts +172 -0
- package/main/handlers/loadConventions.ts +86 -0
- package/main/handlers/loadDocument.ts +253 -0
- package/main/handlers/lock.ts +270 -0
- package/main/handlers/planApply.ts +157 -0
- package/main/handlers/planApplyBindings.ts +79 -0
- package/main/handlers/planScaffold.ts +84 -0
- package/main/handlers/planStyleSync.ts +49 -0
- package/main/handlers/planVariableSync.ts +49 -0
- package/main/handlers/readSelectionBindings.ts +160 -0
- package/main/handlers/resizeUi.ts +105 -0
- package/main/handlers/runComponent.ts +65 -0
- package/main/handlers/templates.ts +462 -0
- package/main/handlers/tokenGraph.ts +122 -0
- package/main/runtimeState.ts +66 -0
- package/main/utils/abortController.ts +11 -0
- package/main/utils/boundVariables.ts +84 -0
- package/main/utils/buildPayloads.ts +85 -0
- package/main/utils/correspondence.ts +658 -0
- package/main/utils/designSource.ts +122 -0
- package/main/utils/figmaCollectionIndex.ts +120 -0
- package/main/utils/figmaStyleAdapter.ts +268 -0
- package/main/utils/figmaTokenAdapter.ts +255 -0
- package/main/utils/flattenDesignSystem.ts +38 -0
- package/main/utils/folds.ts +203 -0
- package/main/utils/fontStack.ts +57 -0
- package/main/utils/lists.ts +4 -0
- package/main/utils/lockStore.ts +72 -0
- package/main/utils/moves.ts +67 -0
- package/main/utils/pageRoots.ts +58 -0
- package/main/utils/planSymbols.ts +96 -0
- package/main/utils/purpose.ts +351 -0
- package/main/utils/recentStore.ts +166 -0
- package/main/utils/resolverModes.ts +271 -0
- package/main/utils/rootRecord.ts +137 -0
- package/main/utils/shardedData.ts +142 -0
- package/main/utils/standing.ts +106 -0
- package/main/utils/styleTarget.ts +51 -0
- package/main/utils/sum.ts +612 -0
- package/main/utils/symbolicIdRegistry.ts +26 -0
- package/main/utils/syncState.ts +133 -0
- package/main/utils/templateStore.ts +73 -0
- package/main/utils/tokenPath.ts +28 -0
- package/main/utils/tokenStamps.ts +91 -0
- package/manifest.json +15 -0
- package/package.json +64 -4
- package/reference.md +1609 -0
- package/shared/components/artboard.ts +126 -0
- package/shared/components/axes.ts +420 -0
- package/shared/components/bindings.ts +64 -0
- package/shared/components/blueprint.ts +248 -0
- package/shared/components/check.ts +705 -0
- package/shared/components/diff.ts +668 -0
- package/shared/components/fields.ts +404 -0
- package/shared/components/groups.ts +306 -0
- package/shared/components/index.ts +140 -0
- package/shared/components/members.ts +280 -0
- package/shared/components/model.ts +273 -0
- package/shared/components/order.ts +53 -0
- package/shared/components/read.ts +480 -0
- package/shared/components/stack.ts +124 -0
- package/shared/components/steps.ts +186 -0
- package/shared/components/validate.ts +565 -0
- package/shared/conventions.ts +28 -0
- package/shared/inputs.ts +40 -0
- package/shared/operations.ts +233 -0
- package/shared/pendingNames.ts +39 -0
- package/shared/protocol.ts +588 -0
- package/shared/tokenTypeMap.ts +21 -0
package/main/code.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { setupDispatcher } from './dispatcher.js';
|
|
2
|
+
import { buildSelectionPayload } from './utils/buildPayloads.js';
|
|
3
|
+
import { DEFAULT_WINDOW_SIZE, loadWindowSizes } from './handlers/resizeUi.js';
|
|
4
|
+
import type { Response } from '../shared/protocol.js';
|
|
5
|
+
|
|
6
|
+
declare const __html__: string;
|
|
7
|
+
|
|
8
|
+
// Shown hidden, then sized, then revealed. `clientStorage` is async, so opening
|
|
9
|
+
// at the default and resizing afterwards would show the restored size arriving
|
|
10
|
+
// as a visible jump.
|
|
11
|
+
figma.showUI(__html__, {
|
|
12
|
+
width: DEFAULT_WINDOW_SIZE.width,
|
|
13
|
+
height: DEFAULT_WINDOW_SIZE.height,
|
|
14
|
+
themeColors: true,
|
|
15
|
+
visible: false,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
setupDispatcher();
|
|
19
|
+
|
|
20
|
+
void loadWindowSizes().then((sizes) => {
|
|
21
|
+
const size = sizes[sizes.mode];
|
|
22
|
+
figma.ui.resize(size.width, size.height);
|
|
23
|
+
figma.ui.show();
|
|
24
|
+
// The status bar's switch says which way it goes. Figma holds a message posted
|
|
25
|
+
// before the window's page has loaded until it has.
|
|
26
|
+
postToUi({ type: 'WINDOW_MODE', payload: { mode: sizes.mode } });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
figma.on('run', () => {
|
|
30
|
+
postToUi({
|
|
31
|
+
type: 'SELECTION_CHANGED',
|
|
32
|
+
payload: buildSelectionPayload(figma.currentPage.selection),
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Selection is reported, and nothing else happens. Discarding the plan here
|
|
37
|
+
// threw away a variable- or style-sync plan — which has no connection to the
|
|
38
|
+
// selection at all — because the user clicked something while reading it. The
|
|
39
|
+
// scaffold and apply-bindings plans do name specific nodes, but they name them
|
|
40
|
+
// by id, so a change of selection does not invalidate them either.
|
|
41
|
+
figma.on('selectionchange', () => {
|
|
42
|
+
postToUi({
|
|
43
|
+
type: 'SELECTION_CHANGED',
|
|
44
|
+
payload: buildSelectionPayload(figma.currentPage.selection),
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function postToUi(response: Response): void {
|
|
49
|
+
figma.ui.postMessage(response);
|
|
50
|
+
}
|