@wireweave/core 4.0.0-beta.13 → 4.0.0-beta.15
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/dist/app.cjs +16 -15
- package/dist/app.d.cts +4 -144
- package/dist/app.d.ts +4 -144
- package/dist/app.js +2 -1
- package/dist/chunk-24W2GEKO.js +2342 -0
- package/dist/{chunk-IMUVIIJR.cjs → chunk-H2SWIUMU.cjs} +9 -3
- package/dist/chunk-KMZXXIM2.cjs +396 -0
- package/dist/chunk-NPDSIAWT.js +389 -0
- package/dist/{chunk-FS6A6EJ4.js → chunk-NZGEUVB4.js} +75 -1330
- package/dist/{chunk-3RWGG5EC.js → chunk-UGMDBW46.js} +9 -4
- package/dist/chunk-VCHXMPZL.cjs +2356 -0
- package/dist/{chunk-4UZBGIGJ.cjs → chunk-XODYFTKU.cjs} +136 -1392
- package/dist/index-CIfur9e3.d.cts +1031 -0
- package/dist/{index-DyXaMSgd.d.cts → index-DdQv4Bu5.d.cts} +149 -1
- package/dist/index-DwGsnD0n.d.ts +1031 -0
- package/dist/{index-BGU_4N4W.d.ts → index-c4FTW7XA.d.ts} +149 -1
- package/dist/index.cjs +245 -54
- package/dist/index.d.cts +11 -188
- package/dist/index.d.ts +11 -188
- package/dist/index.js +205 -18
- package/dist/parser.cjs +9 -9
- package/dist/parser.js +1 -1
- package/dist/renderer.cjs +8 -8
- package/dist/renderer.d.cts +4 -756
- package/dist/renderer.d.ts +4 -756
- package/dist/renderer.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4TMDPWPR.cjs +0 -186
- package/dist/chunk-5DGRIQDU.cjs +0 -824
- package/dist/chunk-JJWAFHSV.js +0 -821
- package/dist/chunk-R5WBZWBC.js +0 -180
|
@@ -1,5 +1,153 @@
|
|
|
1
|
+
import { J as JsonObject, V as V4SourceSpan, P as ParsedDocument, c as CanonicalModule } from './v4-types-2ORUg6To.js';
|
|
1
2
|
import { W as WireframeDocument } from './types-CGRi1k2N.js';
|
|
2
3
|
|
|
4
|
+
interface Diagnostic {
|
|
5
|
+
severity: 'error';
|
|
6
|
+
code: string;
|
|
7
|
+
phase: 'parse' | 'schema' | 'link' | 'semantic' | 'compile' | 'runtime';
|
|
8
|
+
sourceId: string;
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
path: string;
|
|
12
|
+
messageKey: string;
|
|
13
|
+
details: JsonObject;
|
|
14
|
+
related: {
|
|
15
|
+
sourceId: string;
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
type AppResult<T> = {
|
|
21
|
+
ok: true;
|
|
22
|
+
value: T;
|
|
23
|
+
diagnostics: readonly [];
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
value: null;
|
|
27
|
+
html: null;
|
|
28
|
+
diagnostics: readonly Diagnostic[];
|
|
29
|
+
};
|
|
30
|
+
interface ScreenReference {
|
|
31
|
+
namespace: string;
|
|
32
|
+
id: string;
|
|
33
|
+
variant?: string;
|
|
34
|
+
}
|
|
35
|
+
interface CreateAppBundleOptions {
|
|
36
|
+
id: string;
|
|
37
|
+
entry: ScreenReference;
|
|
38
|
+
profile: JsonObject;
|
|
39
|
+
states: JsonObject[];
|
|
40
|
+
registry: ParsedDocument['registry'];
|
|
41
|
+
fixtures: JsonObject[];
|
|
42
|
+
/** Exact original module bytes. Source maps address these bytes as moduleId.wf. */
|
|
43
|
+
moduleSources: Readonly<Record<string, string>>;
|
|
44
|
+
}
|
|
45
|
+
declare const bundleBrand: unique symbol;
|
|
46
|
+
declare const linkedBrand: unique symbol;
|
|
47
|
+
interface AppBundle {
|
|
48
|
+
readonly [bundleBrand]: true;
|
|
49
|
+
readonly schemaVersion: '1.0.0';
|
|
50
|
+
readonly languageVersion: '4.0.0';
|
|
51
|
+
readonly id: string;
|
|
52
|
+
readonly entry: Readonly<ScreenReference>;
|
|
53
|
+
readonly profile: Readonly<JsonObject>;
|
|
54
|
+
readonly states: readonly JsonObject[];
|
|
55
|
+
readonly registry: Readonly<ParsedDocument['registry']>;
|
|
56
|
+
readonly fixtures: readonly JsonObject[];
|
|
57
|
+
readonly modules: readonly CanonicalModule[];
|
|
58
|
+
}
|
|
59
|
+
type InstanceStep = {
|
|
60
|
+
kind: 'use';
|
|
61
|
+
id: string;
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'repeat';
|
|
64
|
+
id: string;
|
|
65
|
+
index: number;
|
|
66
|
+
};
|
|
67
|
+
interface LinkedIdentity {
|
|
68
|
+
namespace: string;
|
|
69
|
+
definitionKind: 'page' | 'layout' | 'component';
|
|
70
|
+
definitionId: string;
|
|
71
|
+
instanceRoot: {
|
|
72
|
+
kind: 'screen';
|
|
73
|
+
namespace: string;
|
|
74
|
+
id: string;
|
|
75
|
+
} | {
|
|
76
|
+
kind: 'shell';
|
|
77
|
+
namespace: string;
|
|
78
|
+
id: string;
|
|
79
|
+
profileDigest: string;
|
|
80
|
+
};
|
|
81
|
+
instancePath: InstanceStep[];
|
|
82
|
+
localId: string;
|
|
83
|
+
}
|
|
84
|
+
interface SourceMapEntry {
|
|
85
|
+
renderedId: string;
|
|
86
|
+
identity: LinkedIdentity;
|
|
87
|
+
moduleId: string;
|
|
88
|
+
source: Readonly<V4SourceSpan>;
|
|
89
|
+
invocationSources: readonly Readonly<V4SourceSpan>[];
|
|
90
|
+
requirementRefs: readonly string[];
|
|
91
|
+
obligationRefs: readonly string[];
|
|
92
|
+
operationIds: readonly string[];
|
|
93
|
+
}
|
|
94
|
+
interface LinkedApp {
|
|
95
|
+
readonly [linkedBrand]: true;
|
|
96
|
+
readonly kind: 'LinkedApp';
|
|
97
|
+
readonly languageVersion: '4.0.0';
|
|
98
|
+
readonly id: string;
|
|
99
|
+
readonly digest: string;
|
|
100
|
+
readonly sourceMap: readonly SourceMapEntry[];
|
|
101
|
+
}
|
|
102
|
+
interface AppArtifact {
|
|
103
|
+
readonly kind: 'AppArtifact';
|
|
104
|
+
readonly schemaVersion: '1.0.0';
|
|
105
|
+
readonly languageVersion: '4.0.0';
|
|
106
|
+
readonly html: string;
|
|
107
|
+
readonly mediaType: 'text/html';
|
|
108
|
+
readonly byteLength: number;
|
|
109
|
+
readonly digest: string;
|
|
110
|
+
readonly modelDigest: string;
|
|
111
|
+
readonly profileDigest: string;
|
|
112
|
+
readonly runtimeDigest: string;
|
|
113
|
+
readonly registryDigest: string;
|
|
114
|
+
readonly entry: Readonly<ScreenReference>;
|
|
115
|
+
readonly screenIndex: readonly {
|
|
116
|
+
route: ScreenReference;
|
|
117
|
+
renderedId: string;
|
|
118
|
+
}[];
|
|
119
|
+
readonly operationIndex: readonly {
|
|
120
|
+
renderedId: string;
|
|
121
|
+
handlerId: string;
|
|
122
|
+
operationId: string;
|
|
123
|
+
executionClass: string;
|
|
124
|
+
operation: JsonObject;
|
|
125
|
+
}[];
|
|
126
|
+
readonly diagnostics: readonly [];
|
|
127
|
+
readonly sourceMap: readonly SourceMapEntry[];
|
|
128
|
+
readonly manifest: {
|
|
129
|
+
readonly appId: string;
|
|
130
|
+
readonly modelDigest: string;
|
|
131
|
+
readonly profileDigest: string;
|
|
132
|
+
readonly registryDigest: string;
|
|
133
|
+
readonly htmlDigest: string;
|
|
134
|
+
readonly runtimeDigest: string;
|
|
135
|
+
readonly executionScope: 'standard-1';
|
|
136
|
+
readonly assets: readonly {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly mediaType: string;
|
|
139
|
+
readonly digest: string;
|
|
140
|
+
readonly byteLength: number;
|
|
141
|
+
}[];
|
|
142
|
+
readonly unsupportedOperations: readonly {
|
|
143
|
+
renderedId: string;
|
|
144
|
+
handlerId: string;
|
|
145
|
+
operationId: string;
|
|
146
|
+
}[];
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
declare function createAppBundle(documents: readonly ParsedDocument[], options: CreateAppBundleOptions): AppResult<AppBundle>;
|
|
150
|
+
|
|
3
151
|
/**
|
|
4
152
|
* Renderer type definitions for wireweave
|
|
5
153
|
*
|
|
@@ -237,4 +385,4 @@ interface SiteOptions extends Pick<RenderOptions, 'theme' | 'classPrefix' | 'bac
|
|
|
237
385
|
*/
|
|
238
386
|
declare function renderSite(document: WireframeDocument, options?: SiteOptions): string;
|
|
239
387
|
|
|
240
|
-
export { type
|
|
388
|
+
export { type AppResult as A, type CanvasOptions as C, type Diagnostic as D, type InstanceStep as I, type LinkedIdentity as L, type PageRenderResult as P, type RenderContext as R, type SourceMapEntry as S, type ThemeConfig as T, type ScreenReference as a, type LinkedApp as b, type RenderOptions as c, type RenderResult as d, type AnnotationStyle as e, type CanvasRenderResult as f, type SvgRenderOptions as g, type SvgRenderResult as h, type SiteOptions as i, type ThemeColors as j, darkTheme as k, defaultTheme as l, getTheme as m, type AppArtifact as n, type AppBundle as o, type CreateAppBundleOptions as p, createAppBundle as q, renderSite as r };
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkKMZXXIM2_cjs = require('./chunk-KMZXXIM2.cjs');
|
|
4
|
+
var chunkXODYFTKU_cjs = require('./chunk-XODYFTKU.cjs');
|
|
5
|
+
var chunkVCHXMPZL_cjs = require('./chunk-VCHXMPZL.cjs');
|
|
6
|
+
var chunkH2SWIUMU_cjs = require('./chunk-H2SWIUMU.cjs');
|
|
7
7
|
var chunkZPHNXJRY_cjs = require('./chunk-ZPHNXJRY.cjs');
|
|
8
8
|
var chunkMD6MNOEQ_cjs = require('./chunk-MD6MNOEQ.cjs');
|
|
9
9
|
|
|
@@ -516,7 +516,7 @@ function printWireframe(doc) {
|
|
|
516
516
|
`;
|
|
517
517
|
}
|
|
518
518
|
function formatWireframeCode(source) {
|
|
519
|
-
return printWireframe(
|
|
519
|
+
return printWireframe(chunkH2SWIUMU_cjs.parse(source));
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
// src/validation/index.ts
|
|
@@ -755,7 +755,7 @@ function checkComponentContracts(ast, addError) {
|
|
|
755
755
|
const child = definition.children[childIndex];
|
|
756
756
|
if (child && !inspect(child, `pages[${index}].children[${childIndex}]`)) return false;
|
|
757
757
|
}
|
|
758
|
-
for (const reference of
|
|
758
|
+
for (const reference of chunkXODYFTKU_cjs.collectParameterReferences(definition.children)) {
|
|
759
759
|
if (parameters.has(reference.name)) continue;
|
|
760
760
|
if (!report(
|
|
761
761
|
reference.node,
|
|
@@ -1347,6 +1347,189 @@ function importFromJson(json) {
|
|
|
1347
1347
|
return json.pages;
|
|
1348
1348
|
}
|
|
1349
1349
|
|
|
1350
|
+
// src/export/v4-figma.ts
|
|
1351
|
+
function routeKey(route) {
|
|
1352
|
+
var _a;
|
|
1353
|
+
return `${route.namespace}/${route.id}/${(_a = route.variant) != null ? _a : ""}`;
|
|
1354
|
+
}
|
|
1355
|
+
function scalar(value) {
|
|
1356
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
1357
|
+
return String(value);
|
|
1358
|
+
return "";
|
|
1359
|
+
}
|
|
1360
|
+
function validateProfile(profile) {
|
|
1361
|
+
if (profile === null || typeof profile !== "object") return null;
|
|
1362
|
+
const value = profile;
|
|
1363
|
+
if (value.id !== "wireweave-figma-mapping-v1" || value.target !== "figma-plugin-json-v1")
|
|
1364
|
+
return null;
|
|
1365
|
+
const screens = value.screens === void 0 ? "selected" : value.screens;
|
|
1366
|
+
if (screens !== "selected" && screens !== "all") return null;
|
|
1367
|
+
const board = value.board;
|
|
1368
|
+
if (board !== void 0 && (board === null || typeof board !== "object" || typeof board.namespace !== "string" || typeof board.id !== "string" || board.variant !== void 0 && typeof board.variant !== "string"))
|
|
1369
|
+
return null;
|
|
1370
|
+
return {
|
|
1371
|
+
id: "wireweave-figma-mapping-v1",
|
|
1372
|
+
target: "figma-plugin-json-v1",
|
|
1373
|
+
...board === void 0 ? {} : { board },
|
|
1374
|
+
screens
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
function figmaType(kind) {
|
|
1378
|
+
if (["text", "title", "link", "badge", "marker"].includes(kind)) return "TEXT";
|
|
1379
|
+
if (["image", "placeholder", "divider", "icon", "avatar"].includes(kind)) return "RECTANGLE";
|
|
1380
|
+
return "FRAME";
|
|
1381
|
+
}
|
|
1382
|
+
function metadata(source) {
|
|
1383
|
+
return {
|
|
1384
|
+
identity: source.identity,
|
|
1385
|
+
moduleId: source.moduleId,
|
|
1386
|
+
source: source.source,
|
|
1387
|
+
invocationSources: source.invocationSources,
|
|
1388
|
+
requirementRefs: source.requirementRefs,
|
|
1389
|
+
obligationRefs: source.obligationRefs,
|
|
1390
|
+
operationIds: source.operationIds
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
function semanticId(renderedId) {
|
|
1394
|
+
return `wf-${chunkH2SWIUMU_cjs.digestV4(renderedId).slice("sha256:".length)}`;
|
|
1395
|
+
}
|
|
1396
|
+
function nodeLabel(node) {
|
|
1397
|
+
var _a, _b;
|
|
1398
|
+
return scalar((_b = (_a = node.node.label) != null ? _a : node.node.attributes.label) != null ? _b : node.node.attributes.aria) || node.node.kind;
|
|
1399
|
+
}
|
|
1400
|
+
function nodeToFigma(node, sources, mappings) {
|
|
1401
|
+
const source = sources.get(node.renderedId);
|
|
1402
|
+
if (source === void 0) throw new TypeError(`Missing linked source map for ${node.renderedId}`);
|
|
1403
|
+
const id = semanticId(node.renderedId);
|
|
1404
|
+
mappings.push({ renderedId: node.renderedId, figmaId: id, identity: source.identity, source });
|
|
1405
|
+
const type = figmaType(node.node.kind);
|
|
1406
|
+
const attributes = node.node.attributes;
|
|
1407
|
+
const result = {
|
|
1408
|
+
id,
|
|
1409
|
+
name: nodeLabel(node),
|
|
1410
|
+
type,
|
|
1411
|
+
visible: true,
|
|
1412
|
+
wireweaveType: node.node.kind,
|
|
1413
|
+
wireweaveMetadata: metadata(source),
|
|
1414
|
+
...Object.keys(attributes).length === 0 ? {} : { wireweaveAttributes: attributes }
|
|
1415
|
+
};
|
|
1416
|
+
if (type === "TEXT") {
|
|
1417
|
+
result.textStyle = {
|
|
1418
|
+
fontSize: 16,
|
|
1419
|
+
fontWeight: node.node.kind === "title" ? 600 : 400,
|
|
1420
|
+
textAlignHorizontal: "LEFT",
|
|
1421
|
+
characters: nodeLabel(node)
|
|
1422
|
+
};
|
|
1423
|
+
} else if (type === "RECTANGLE") {
|
|
1424
|
+
result.size = { width: 200, height: node.node.kind === "divider" ? 1 : 120 };
|
|
1425
|
+
result.fills = [{ type: "SOLID", color: { r: 0.96, g: 0.96, b: 0.96, a: 1 } }];
|
|
1426
|
+
} else {
|
|
1427
|
+
result.autoLayout = {
|
|
1428
|
+
layoutMode: node.node.kind === "row" ? "HORIZONTAL" : "VERTICAL",
|
|
1429
|
+
layoutSizingHorizontal: "FILL",
|
|
1430
|
+
layoutSizingVertical: "HUG",
|
|
1431
|
+
primaryAxisAlignItems: "MIN",
|
|
1432
|
+
counterAxisAlignItems: "STRETCH",
|
|
1433
|
+
paddingTop: 8,
|
|
1434
|
+
paddingRight: 8,
|
|
1435
|
+
paddingBottom: 8,
|
|
1436
|
+
paddingLeft: 8,
|
|
1437
|
+
itemSpacing: 8,
|
|
1438
|
+
layoutWrap: "NO_WRAP"
|
|
1439
|
+
};
|
|
1440
|
+
result.size = { width: 1440, height: 1 };
|
|
1441
|
+
}
|
|
1442
|
+
if (node.children.length > 0)
|
|
1443
|
+
result.children = node.children.map((child) => nodeToFigma(child, sources, mappings));
|
|
1444
|
+
return result;
|
|
1445
|
+
}
|
|
1446
|
+
function screenRoots(data, screen) {
|
|
1447
|
+
var _a;
|
|
1448
|
+
const shell = screen.shell === void 0 ? void 0 : data.shells.find((item) => item.owner.key === screen.shell);
|
|
1449
|
+
return [...(_a = shell == null ? void 0 : shell.children) != null ? _a : [], ...screen.children];
|
|
1450
|
+
}
|
|
1451
|
+
function interactionLosses(sources) {
|
|
1452
|
+
return sources.flatMap(
|
|
1453
|
+
(source) => source.operationIds.map((operationId) => ({
|
|
1454
|
+
code: "WW_EXPORT_FIGMA_INTERACTION",
|
|
1455
|
+
kind: "interaction",
|
|
1456
|
+
message: "Figma mapping preserves operation identity but cannot execute runtime semantics.",
|
|
1457
|
+
renderedId: source.renderedId,
|
|
1458
|
+
operationId,
|
|
1459
|
+
source,
|
|
1460
|
+
details: { target: "figma-plugin-json-v1" }
|
|
1461
|
+
}))
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
function exportLinkedAppToFigma(linked, profile) {
|
|
1465
|
+
var _a;
|
|
1466
|
+
const data = chunkVCHXMPZL_cjs.getLinkedAppData(linked);
|
|
1467
|
+
if (data === void 0)
|
|
1468
|
+
return chunkVCHXMPZL_cjs.failed([chunkVCHXMPZL_cjs.diagnostic("WW_SCHEMA", "app.untrusted-linked-model", void 0, {}, "compile")]);
|
|
1469
|
+
const valid = validateProfile(profile);
|
|
1470
|
+
if (valid === null)
|
|
1471
|
+
return chunkVCHXMPZL_cjs.failed([
|
|
1472
|
+
chunkVCHXMPZL_cjs.diagnostic("WW_EXPORT_PROFILE", "export.invalid-figma-profile", void 0, {}, "compile")
|
|
1473
|
+
]);
|
|
1474
|
+
const screens = data.screens.slice().sort((a, b) => routeKey(a.route).localeCompare(routeKey(b.route)));
|
|
1475
|
+
const target = (_a = valid.board) != null ? _a : data.bundle.entry;
|
|
1476
|
+
const selected = valid.screens === "all" ? screens : screens.filter((screen) => routeKey(screen.route) === routeKey(target));
|
|
1477
|
+
if (selected.length === 0)
|
|
1478
|
+
return chunkVCHXMPZL_cjs.failed([
|
|
1479
|
+
chunkVCHXMPZL_cjs.diagnostic("WW_EXPORT_BOARD", "export.board-not-found", void 0, {}, "compile")
|
|
1480
|
+
]);
|
|
1481
|
+
const renderedIds = /* @__PURE__ */ new Set();
|
|
1482
|
+
for (const screen of selected) {
|
|
1483
|
+
const pending = screenRoots(data, screen);
|
|
1484
|
+
while (pending.length > 0) {
|
|
1485
|
+
const node = pending.shift();
|
|
1486
|
+
renderedIds.add(node.renderedId);
|
|
1487
|
+
pending.unshift(...node.children);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
const sourceMap = data.sourceMap.filter((entry) => renderedIds.has(entry.renderedId)).slice().sort((a, b) => a.renderedId.localeCompare(b.renderedId));
|
|
1491
|
+
const sourceById = new Map(sourceMap.map((entry) => [entry.renderedId, entry]));
|
|
1492
|
+
const mappings = [];
|
|
1493
|
+
const document = {
|
|
1494
|
+
id: `document-${chunkH2SWIUMU_cjs.digestV4(linked.digest).slice("sha256:".length)}`,
|
|
1495
|
+
name: data.bundle.id,
|
|
1496
|
+
type: "DOCUMENT",
|
|
1497
|
+
visible: true,
|
|
1498
|
+
children: selected.map((screen) => ({
|
|
1499
|
+
id: `canvas-${chunkH2SWIUMU_cjs.digestV4(routeKey(screen.route)).slice("sha256:".length)}`,
|
|
1500
|
+
name: routeKey(screen.route),
|
|
1501
|
+
type: "CANVAS",
|
|
1502
|
+
visible: true,
|
|
1503
|
+
children: screenRoots(data, screen).map((node) => nodeToFigma(node, sourceById, mappings))
|
|
1504
|
+
}))
|
|
1505
|
+
};
|
|
1506
|
+
mappings.sort((a, b) => a.renderedId.localeCompare(b.renderedId));
|
|
1507
|
+
const lossReport = interactionLosses(sourceMap);
|
|
1508
|
+
const diagnostics = lossReport.length ? [
|
|
1509
|
+
{
|
|
1510
|
+
severity: "warning",
|
|
1511
|
+
code: "WW_EXPORT_FIGMA_INTERACTION",
|
|
1512
|
+
message: "Runtime operations are preserved as metadata and recorded in lossReport.",
|
|
1513
|
+
details: { count: lossReport.length }
|
|
1514
|
+
}
|
|
1515
|
+
] : [];
|
|
1516
|
+
const artifact = chunkVCHXMPZL_cjs.freeze({
|
|
1517
|
+
kind: "FigmaMappingArtifact",
|
|
1518
|
+
version: "4.0.0",
|
|
1519
|
+
format: "figma",
|
|
1520
|
+
target: valid.target,
|
|
1521
|
+
appId: data.bundle.id,
|
|
1522
|
+
linkedDigest: linked.digest,
|
|
1523
|
+
profileDigest: chunkH2SWIUMU_cjs.digestV4(chunkVCHXMPZL_cjs.jcs(valid)),
|
|
1524
|
+
document,
|
|
1525
|
+
mappings,
|
|
1526
|
+
sourceMap,
|
|
1527
|
+
lossReport,
|
|
1528
|
+
diagnostics
|
|
1529
|
+
});
|
|
1530
|
+
return { ok: true, value: artifact, diagnostics: [] };
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1350
1533
|
// src/export/figma.ts
|
|
1351
1534
|
var SPACING_SCALE = {
|
|
1352
1535
|
0: 0,
|
|
@@ -1570,13 +1753,13 @@ function extractStrokes(node) {
|
|
|
1570
1753
|
strokeWeight: 1
|
|
1571
1754
|
};
|
|
1572
1755
|
}
|
|
1573
|
-
function
|
|
1574
|
-
const
|
|
1756
|
+
function nodeToFigma2(node) {
|
|
1757
|
+
const figmaType2 = mapToFigmaType(node.type);
|
|
1575
1758
|
const content = getNodeContent(node);
|
|
1576
1759
|
const figmaNode = {
|
|
1577
1760
|
id: generateFigmaId(),
|
|
1578
1761
|
name: content || node.type,
|
|
1579
|
-
type:
|
|
1762
|
+
type: figmaType2,
|
|
1580
1763
|
visible: true,
|
|
1581
1764
|
wireweaveType: node.type.toLowerCase()
|
|
1582
1765
|
};
|
|
@@ -1584,7 +1767,7 @@ function nodeToFigma(node) {
|
|
|
1584
1767
|
if (Object.keys(attrs).length > 0) {
|
|
1585
1768
|
figmaNode.wireweaveAttributes = attrs;
|
|
1586
1769
|
}
|
|
1587
|
-
if (
|
|
1770
|
+
if (figmaType2 === "FRAME") {
|
|
1588
1771
|
figmaNode.autoLayout = extractAutoLayout(node);
|
|
1589
1772
|
figmaNode.size = extractSize(node);
|
|
1590
1773
|
const fills = extractFills(node);
|
|
@@ -1597,12 +1780,12 @@ function nodeToFigma(node) {
|
|
|
1597
1780
|
if (node.type.toLowerCase() === "card") {
|
|
1598
1781
|
figmaNode.cornerRadius = 8;
|
|
1599
1782
|
}
|
|
1600
|
-
} else if (
|
|
1783
|
+
} else if (figmaType2 === "TEXT") {
|
|
1601
1784
|
figmaNode.textStyle = extractTextStyle(node);
|
|
1602
1785
|
if (getAttr(node, "muted")) {
|
|
1603
1786
|
figmaNode.fills = [{ type: "SOLID", color: COLORS.textMuted }];
|
|
1604
1787
|
}
|
|
1605
|
-
} else if (
|
|
1788
|
+
} else if (figmaType2 === "RECTANGLE") {
|
|
1606
1789
|
figmaNode.size = extractSize(node, 200, 150);
|
|
1607
1790
|
const fills = extractFills(node);
|
|
1608
1791
|
if (fills) {
|
|
@@ -1615,7 +1798,7 @@ function nodeToFigma(node) {
|
|
|
1615
1798
|
const children = [];
|
|
1616
1799
|
for (const child of node.children) {
|
|
1617
1800
|
if (child && typeof child === "object" && "type" in child) {
|
|
1618
|
-
children.push(
|
|
1801
|
+
children.push(nodeToFigma2(child));
|
|
1619
1802
|
}
|
|
1620
1803
|
}
|
|
1621
1804
|
if (children.length > 0) {
|
|
@@ -1624,7 +1807,10 @@ function nodeToFigma(node) {
|
|
|
1624
1807
|
}
|
|
1625
1808
|
return figmaNode;
|
|
1626
1809
|
}
|
|
1627
|
-
function exportToFigma(doc) {
|
|
1810
|
+
function exportToFigma(doc, profile) {
|
|
1811
|
+
if ("kind" in doc && doc.kind === "LinkedApp")
|
|
1812
|
+
return exportLinkedAppToFigma(doc, profile);
|
|
1813
|
+
const legacyDocument = doc;
|
|
1628
1814
|
resetFigmaIdCounter();
|
|
1629
1815
|
const documentNode = {
|
|
1630
1816
|
id: generateFigmaId(),
|
|
@@ -1633,11 +1819,11 @@ function exportToFigma(doc) {
|
|
|
1633
1819
|
visible: true,
|
|
1634
1820
|
children: []
|
|
1635
1821
|
};
|
|
1636
|
-
for (const page of chunkZPHNXJRY_cjs.documentPages(
|
|
1637
|
-
documentNode.children.push(
|
|
1822
|
+
for (const page of chunkZPHNXJRY_cjs.documentPages(legacyDocument)) {
|
|
1823
|
+
documentNode.children.push(nodeToFigma2(page));
|
|
1638
1824
|
}
|
|
1639
1825
|
const componentMappings = {};
|
|
1640
|
-
const types = getComponentTypes(
|
|
1826
|
+
const types = getComponentTypes(legacyDocument);
|
|
1641
1827
|
for (const type of types) {
|
|
1642
1828
|
componentMappings[type] = mapToFigmaType(type);
|
|
1643
1829
|
}
|
|
@@ -2357,117 +2543,121 @@ function buildDomTreeNode(node, path) {
|
|
|
2357
2543
|
return treeNode;
|
|
2358
2544
|
}
|
|
2359
2545
|
|
|
2546
|
+
Object.defineProperty(exports, "exportLinkedAppToSvg", {
|
|
2547
|
+
enumerable: true,
|
|
2548
|
+
get: function () { return chunkKMZXXIM2_cjs.exportLinkedAppToSvg; }
|
|
2549
|
+
});
|
|
2360
2550
|
Object.defineProperty(exports, "layoutCanvas", {
|
|
2361
2551
|
enumerable: true,
|
|
2362
|
-
get: function () { return
|
|
2552
|
+
get: function () { return chunkKMZXXIM2_cjs.layoutCanvas; }
|
|
2363
2553
|
});
|
|
2364
2554
|
Object.defineProperty(exports, "render", {
|
|
2365
2555
|
enumerable: true,
|
|
2366
|
-
get: function () { return
|
|
2556
|
+
get: function () { return chunkKMZXXIM2_cjs.render; }
|
|
2367
2557
|
});
|
|
2368
2558
|
Object.defineProperty(exports, "renderCanvas", {
|
|
2369
2559
|
enumerable: true,
|
|
2370
|
-
get: function () { return
|
|
2560
|
+
get: function () { return chunkKMZXXIM2_cjs.renderCanvas; }
|
|
2371
2561
|
});
|
|
2372
2562
|
Object.defineProperty(exports, "renderToHtml", {
|
|
2373
2563
|
enumerable: true,
|
|
2374
|
-
get: function () { return
|
|
2564
|
+
get: function () { return chunkKMZXXIM2_cjs.renderToHtml; }
|
|
2375
2565
|
});
|
|
2376
2566
|
Object.defineProperty(exports, "renderToSvg", {
|
|
2377
2567
|
enumerable: true,
|
|
2378
|
-
get: function () { return
|
|
2568
|
+
get: function () { return chunkKMZXXIM2_cjs.renderToSvg; }
|
|
2379
2569
|
});
|
|
2380
2570
|
Object.defineProperty(exports, "advanceClock", {
|
|
2381
2571
|
enumerable: true,
|
|
2382
|
-
get: function () { return
|
|
2572
|
+
get: function () { return chunkXODYFTKU_cjs.advanceClock; }
|
|
2383
2573
|
});
|
|
2384
2574
|
Object.defineProperty(exports, "collectParameterReferences", {
|
|
2385
2575
|
enumerable: true,
|
|
2386
|
-
get: function () { return
|
|
2576
|
+
get: function () { return chunkXODYFTKU_cjs.collectParameterReferences; }
|
|
2387
2577
|
});
|
|
2388
2578
|
Object.defineProperty(exports, "compileApp", {
|
|
2389
2579
|
enumerable: true,
|
|
2390
|
-
get: function () { return
|
|
2391
|
-
});
|
|
2392
|
-
Object.defineProperty(exports, "createAppBundle", {
|
|
2393
|
-
enumerable: true,
|
|
2394
|
-
get: function () { return chunk4UZBGIGJ_cjs.createAppBundle; }
|
|
2580
|
+
get: function () { return chunkXODYFTKU_cjs.compileApp; }
|
|
2395
2581
|
});
|
|
2396
2582
|
Object.defineProperty(exports, "createAppComponentInstanceId", {
|
|
2397
2583
|
enumerable: true,
|
|
2398
|
-
get: function () { return
|
|
2584
|
+
get: function () { return chunkXODYFTKU_cjs.createAppComponentInstanceId; }
|
|
2399
2585
|
});
|
|
2400
2586
|
Object.defineProperty(exports, "createAppNodeId", {
|
|
2401
2587
|
enumerable: true,
|
|
2402
|
-
get: function () { return
|
|
2588
|
+
get: function () { return chunkXODYFTKU_cjs.createAppNodeId; }
|
|
2403
2589
|
});
|
|
2404
2590
|
Object.defineProperty(exports, "createRuntime", {
|
|
2405
2591
|
enumerable: true,
|
|
2406
|
-
get: function () { return
|
|
2592
|
+
get: function () { return chunkXODYFTKU_cjs.createRuntime; }
|
|
2407
2593
|
});
|
|
2408
2594
|
Object.defineProperty(exports, "linkAndCompileApp", {
|
|
2409
2595
|
enumerable: true,
|
|
2410
|
-
get: function () { return
|
|
2596
|
+
get: function () { return chunkXODYFTKU_cjs.linkAndCompileApp; }
|
|
2411
2597
|
});
|
|
2412
2598
|
Object.defineProperty(exports, "linkApp", {
|
|
2413
2599
|
enumerable: true,
|
|
2414
|
-
get: function () { return
|
|
2600
|
+
get: function () { return chunkXODYFTKU_cjs.linkApp; }
|
|
2415
2601
|
});
|
|
2416
2602
|
Object.defineProperty(exports, "parameterReferenceName", {
|
|
2417
2603
|
enumerable: true,
|
|
2418
|
-
get: function () { return
|
|
2604
|
+
get: function () { return chunkXODYFTKU_cjs.parameterReferenceName; }
|
|
2419
2605
|
});
|
|
2420
2606
|
Object.defineProperty(exports, "reduceEvent", {
|
|
2421
2607
|
enumerable: true,
|
|
2422
|
-
get: function () { return
|
|
2608
|
+
get: function () { return chunkXODYFTKU_cjs.reduceEvent; }
|
|
2423
2609
|
});
|
|
2424
2610
|
Object.defineProperty(exports, "renderAppSite", {
|
|
2425
2611
|
enumerable: true,
|
|
2426
|
-
get: function () { return
|
|
2612
|
+
get: function () { return chunkXODYFTKU_cjs.renderSite; }
|
|
2427
2613
|
});
|
|
2428
2614
|
Object.defineProperty(exports, "resetRuntime", {
|
|
2429
2615
|
enumerable: true,
|
|
2430
|
-
get: function () { return
|
|
2616
|
+
get: function () { return chunkXODYFTKU_cjs.resetRuntime; }
|
|
2617
|
+
});
|
|
2618
|
+
Object.defineProperty(exports, "createAppBundle", {
|
|
2619
|
+
enumerable: true,
|
|
2620
|
+
get: function () { return chunkVCHXMPZL_cjs.createAppBundle; }
|
|
2621
|
+
});
|
|
2622
|
+
Object.defineProperty(exports, "expandVariants", {
|
|
2623
|
+
enumerable: true,
|
|
2624
|
+
get: function () { return chunkVCHXMPZL_cjs.expandVariants; }
|
|
2625
|
+
});
|
|
2626
|
+
Object.defineProperty(exports, "renderSite", {
|
|
2627
|
+
enumerable: true,
|
|
2628
|
+
get: function () { return chunkVCHXMPZL_cjs.renderSite; }
|
|
2431
2629
|
});
|
|
2432
2630
|
Object.defineProperty(exports, "V4ParseError", {
|
|
2433
2631
|
enumerable: true,
|
|
2434
|
-
get: function () { return
|
|
2632
|
+
get: function () { return chunkH2SWIUMU_cjs.V4ParseError; }
|
|
2435
2633
|
});
|
|
2436
2634
|
Object.defineProperty(exports, "getErrors", {
|
|
2437
2635
|
enumerable: true,
|
|
2438
|
-
get: function () { return
|
|
2636
|
+
get: function () { return chunkH2SWIUMU_cjs.getErrors; }
|
|
2439
2637
|
});
|
|
2440
2638
|
Object.defineProperty(exports, "getV4SourceSpan", {
|
|
2441
2639
|
enumerable: true,
|
|
2442
|
-
get: function () { return
|
|
2640
|
+
get: function () { return chunkH2SWIUMU_cjs.getV4SourceSpan; }
|
|
2443
2641
|
});
|
|
2444
2642
|
Object.defineProperty(exports, "isValid", {
|
|
2445
2643
|
enumerable: true,
|
|
2446
|
-
get: function () { return
|
|
2644
|
+
get: function () { return chunkH2SWIUMU_cjs.isValid; }
|
|
2447
2645
|
});
|
|
2448
2646
|
Object.defineProperty(exports, "parse", {
|
|
2449
2647
|
enumerable: true,
|
|
2450
|
-
get: function () { return
|
|
2648
|
+
get: function () { return chunkH2SWIUMU_cjs.parse; }
|
|
2451
2649
|
});
|
|
2452
2650
|
Object.defineProperty(exports, "parseV4", {
|
|
2453
2651
|
enumerable: true,
|
|
2454
|
-
get: function () { return
|
|
2652
|
+
get: function () { return chunkH2SWIUMU_cjs.parseV4; }
|
|
2455
2653
|
});
|
|
2456
2654
|
Object.defineProperty(exports, "tryParse", {
|
|
2457
2655
|
enumerable: true,
|
|
2458
|
-
get: function () { return
|
|
2656
|
+
get: function () { return chunkH2SWIUMU_cjs.tryParse; }
|
|
2459
2657
|
});
|
|
2460
2658
|
Object.defineProperty(exports, "tryParseV4", {
|
|
2461
2659
|
enumerable: true,
|
|
2462
|
-
get: function () { return
|
|
2463
|
-
});
|
|
2464
|
-
Object.defineProperty(exports, "expandVariants", {
|
|
2465
|
-
enumerable: true,
|
|
2466
|
-
get: function () { return chunk5DGRIQDU_cjs.expandVariants; }
|
|
2467
|
-
});
|
|
2468
|
-
Object.defineProperty(exports, "renderSite", {
|
|
2469
|
-
enumerable: true,
|
|
2470
|
-
get: function () { return chunk5DGRIQDU_cjs.renderSite; }
|
|
2660
|
+
get: function () { return chunkH2SWIUMU_cjs.tryParseV4; }
|
|
2471
2661
|
});
|
|
2472
2662
|
Object.defineProperty(exports, "ANCHOR_LOC_ATTR", {
|
|
2473
2663
|
enumerable: true,
|
|
@@ -3034,6 +3224,7 @@ exports.areIdentical = areIdentical;
|
|
|
3034
3224
|
exports.buildAnchorIndex = buildAnchorIndex;
|
|
3035
3225
|
exports.buildDomTree = buildDomTree;
|
|
3036
3226
|
exports.diff = diff;
|
|
3227
|
+
exports.exportLinkedAppToFigma = exportLinkedAppToFigma;
|
|
3037
3228
|
exports.exportToFigma = exportToFigma;
|
|
3038
3229
|
exports.exportToFigmaString = exportToFigmaString;
|
|
3039
3230
|
exports.exportToJson = exportToJson;
|