@reframejs/unframer 4.2.0-reframe.0
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/README.md +389 -0
- package/bin.js +5 -0
- package/dist/babel-jsx.d.ts +24 -0
- package/dist/babel-jsx.js +299 -0
- package/dist/babel-plugin-imports.d.ts +15 -0
- package/dist/babel-plugin-imports.js +211 -0
- package/dist/babel-typedoc.d.ts +39 -0
- package/dist/babel-typedoc.js +76 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +3 -0
- package/dist/cli.d.ts +59 -0
- package/dist/cli.js +821 -0
- package/dist/compat.d.ts +2 -0
- package/dist/compat.js +23 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.js +27 -0
- package/dist/css-core.d.ts +50 -0
- package/dist/css-core.js +231 -0
- package/dist/css.d.ts +15 -0
- package/dist/css.js +36 -0
- package/dist/esbuild.d.ts +31 -0
- package/dist/esbuild.js +317 -0
- package/dist/exporter.d.ts +96 -0
- package/dist/exporter.js +1151 -0
- package/dist/flat-cache-interceptor.d.ts +24 -0
- package/dist/flat-cache-interceptor.js +87 -0
- package/dist/framer-chunks/chunk-IKQSD2QC.js +10 -0
- package/dist/framer-chunks/fontshare-PZLWRK4B-MHMZIGTX.js +7 -0
- package/dist/framer-chunks/fontshare-SXU5BGFE-OWTMMPGS.js +7 -0
- package/dist/framer-chunks/fontshare-TIA7QUPT-PUDLUTQ7.js +7 -0
- package/dist/framer-chunks/framer-font-RD2SUPQH-Q4MS7WS6.js +7 -0
- package/dist/framer-chunks/google-EGNT223R-P4DUHBW2.js +7 -0
- package/dist/framer-chunks/google-H6SFY4F5-5JSJCGDR.js +7 -0
- package/dist/framer-chunks/google-YSYBFRE6-L7YAHH7V.js +7 -0
- package/dist/framer-client.server.d.ts +4 -0
- package/dist/framer-client.server.js +45 -0
- package/dist/framer-package-versions.d.ts +781 -0
- package/dist/framer-package-versions.js +782 -0
- package/dist/framer-types.d.ts +30 -0
- package/dist/framer-types.js +35 -0
- package/dist/framer.d.ts +4990 -0
- package/dist/framer.js +64296 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +13 -0
- package/dist/package-manager.d.ts +10 -0
- package/dist/package-manager.js +138 -0
- package/dist/plugin-mcp-dist/lib/client-websocket.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/client-websocket.js +103 -0
- package/dist/plugin-mcp-dist/lib/cms.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/cms.js +58 -0
- package/dist/plugin-mcp-dist/lib/errors.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/errors.js +48 -0
- package/dist/plugin-mcp-dist/lib/framer-client.d.ts +2 -0
- package/dist/plugin-mcp-dist/lib/framer-client.js +4 -0
- package/dist/plugin-mcp-dist/lib/framer-client.server.d.ts +3 -0
- package/dist/plugin-mcp-dist/lib/framer-client.server.js +46 -0
- package/dist/plugin-mcp-dist/lib/framer.d.ts +30 -0
- package/dist/plugin-mcp-dist/lib/framer.js +1084 -0
- package/dist/plugin-mcp-dist/lib/hooks.d.ts +6 -0
- package/dist/plugin-mcp-dist/lib/hooks.js +46 -0
- package/dist/plugin-mcp-dist/lib/mcp-client.d.ts +142 -0
- package/dist/plugin-mcp-dist/lib/mcp-client.js +40 -0
- package/dist/plugin-mcp-dist/lib/mcp-handlers.d.ts +385 -0
- package/dist/plugin-mcp-dist/lib/mcp-handlers.js +1924 -0
- package/dist/plugin-mcp-dist/lib/mcp-tools.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/mcp-tools.js +5 -0
- package/dist/plugin-mcp-dist/lib/mcp-websocket.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/mcp-websocket.js +88 -0
- package/dist/plugin-mcp-dist/lib/plugin-websocket.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/plugin-websocket.js +170 -0
- package/dist/plugin-mcp-dist/lib/react-export.d.ts +51 -0
- package/dist/plugin-mcp-dist/lib/react-export.js +358 -0
- package/dist/plugin-mcp-dist/lib/schema.d.ts +276 -0
- package/dist/plugin-mcp-dist/lib/schema.js +907 -0
- package/dist/plugin-mcp-dist/lib/store.d.ts +2 -0
- package/dist/plugin-mcp-dist/lib/store.js +10 -0
- package/dist/plugin-mcp-dist/lib/tree-utils.d.ts +6 -0
- package/dist/plugin-mcp-dist/lib/tree-utils.js +141 -0
- package/dist/plugin-mcp-dist/lib/tunnel.d.ts +46 -0
- package/dist/plugin-mcp-dist/lib/tunnel.js +117 -0
- package/dist/plugin-mcp-dist/lib/types.d.ts +110 -0
- package/dist/plugin-mcp-dist/lib/types.js +188 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.d.ts +13 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.js +56 -0
- package/dist/plugin-mcp-dist/lib/utils.d.ts +13 -0
- package/dist/plugin-mcp-dist/lib/utils.js +57 -0
- package/dist/plugin-mcp-dist/lib/websocket-server.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/websocket-server.js +88 -0
- package/dist/plugin-mcp-dist/lib/xml.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/xml.js +395 -0
- package/dist/react.d.ts +76 -0
- package/dist/react.js +280 -0
- package/dist/renamer.d.ts +11 -0
- package/dist/renamer.js +139 -0
- package/dist/sentry.d.ts +2 -0
- package/dist/sentry.js +5 -0
- package/dist/stackblitz.d.ts +9 -0
- package/dist/stackblitz.js +179 -0
- package/dist/styles/framer.css +920 -0
- package/dist/styles/reset.css +37 -0
- package/dist/typescript.d.ts +24 -0
- package/dist/typescript.js +197 -0
- package/dist/undici-dispatcher.d.ts +2 -0
- package/dist/undici-dispatcher.js +10 -0
- package/dist/unframer-loader.d.ts +2 -0
- package/dist/unframer-loader.js +12 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +81 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +131 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { framer, isFrameNode, isWebPageNode, } from '#framer-client';
|
|
2
|
+
import { getComponentPropertyControls, getInstanceComponentId, getParentNodesArray, replaceEnumIdsForControls, } from './framer.js';
|
|
3
|
+
function isTruthy(val) {
|
|
4
|
+
return Boolean(val);
|
|
5
|
+
}
|
|
6
|
+
import { Sema } from 'sema4';
|
|
7
|
+
async function getParentNodesWithOrdering(node) {
|
|
8
|
+
if (typeof node === 'string') {
|
|
9
|
+
node = await framer.getNode(node);
|
|
10
|
+
}
|
|
11
|
+
if (!node) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const result = [];
|
|
15
|
+
let parent = await node.getParent();
|
|
16
|
+
if (!parent) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
let currentChild = node;
|
|
20
|
+
while (parent) {
|
|
21
|
+
const siblings = await parent.getChildren();
|
|
22
|
+
const ordering = siblings.findIndex((x) => x.id === currentChild.id);
|
|
23
|
+
result.push({ node: parent, ordering });
|
|
24
|
+
currentChild = parent;
|
|
25
|
+
// if (isComponentNode(parent) || isComponentNode(parent)) {
|
|
26
|
+
// break
|
|
27
|
+
// }
|
|
28
|
+
const newParent = await parent.getParent();
|
|
29
|
+
if (!newParent) {
|
|
30
|
+
// console.log('no parent found, last one was', parent)
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
parent = newParent;
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function deduplicateByKey(items, getKey) {
|
|
38
|
+
const seen = new Map();
|
|
39
|
+
for (const item of items) {
|
|
40
|
+
const key = getKey(item);
|
|
41
|
+
if (!seen.has(key)) {
|
|
42
|
+
seen.set(key, item);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return Array.from(seen.values());
|
|
46
|
+
}
|
|
47
|
+
function groupBy(items, keyFn) {
|
|
48
|
+
const map = new Map();
|
|
49
|
+
for (const item of items) {
|
|
50
|
+
const key = keyFn(item);
|
|
51
|
+
const collection = map.get(key) || [];
|
|
52
|
+
collection.push(item);
|
|
53
|
+
map.set(key, collection);
|
|
54
|
+
}
|
|
55
|
+
return map;
|
|
56
|
+
}
|
|
57
|
+
// Main export functions
|
|
58
|
+
export async function getInstancesWithOrderAndDepth({ allInstances, webPageIds, components, projectId, }) {
|
|
59
|
+
const componentIds = new Set(components.map((x) => x?.id));
|
|
60
|
+
const componentsAlreadyProcessed = new Set();
|
|
61
|
+
// Limit concurrency to avoid hammering the Framer API with hundreds of
|
|
62
|
+
// parallel getParent/getChildren calls and dynamic import() fetches.
|
|
63
|
+
const semaphore = new Sema(6);
|
|
64
|
+
const rawComponentInstances = await Promise.all(allInstances.map(async (x) => {
|
|
65
|
+
const componentId = getInstanceComponentId(x);
|
|
66
|
+
if (!componentId) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!componentIds.has(componentId) ||
|
|
70
|
+
componentsAlreadyProcessed.has(componentId)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
await semaphore.acquire();
|
|
74
|
+
try {
|
|
75
|
+
// Re-check after acquiring: another task may have processed
|
|
76
|
+
// this componentId while we were waiting on the semaphore.
|
|
77
|
+
if (componentsAlreadyProcessed.has(componentId)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Claim immediately so other tasks in this batch skip it
|
|
81
|
+
componentsAlreadyProcessed.add(componentId);
|
|
82
|
+
const parents = await getParentNodesWithOrdering(x);
|
|
83
|
+
const parentsOrderings = parents.map((x) => x.ordering);
|
|
84
|
+
const pageParent = parents.find((x) => isWebPageNode(x.node));
|
|
85
|
+
const webPageId = pageParent?.node?.id || '';
|
|
86
|
+
const { propertyControls } = await getComponentPropertyControls(components.find((x) => x.id === componentId)
|
|
87
|
+
?.insertURL);
|
|
88
|
+
const styles = {
|
|
89
|
+
position: x.position ?? null,
|
|
90
|
+
top: x.top ?? null,
|
|
91
|
+
right: x.right ?? null,
|
|
92
|
+
bottom: x.bottom ?? null,
|
|
93
|
+
left: x.left ?? null,
|
|
94
|
+
centerX: x.centerX ?? null,
|
|
95
|
+
centerY: x.centerY ?? null,
|
|
96
|
+
width: x.width ?? null,
|
|
97
|
+
height: x.height ?? null,
|
|
98
|
+
minWidth: x.minWidth ?? null,
|
|
99
|
+
maxWidth: x.maxWidth ?? null,
|
|
100
|
+
minHeight: x.minHeight ?? null,
|
|
101
|
+
maxHeight: x.maxHeight ?? null,
|
|
102
|
+
aspectRatio: x.aspectRatio ?? null,
|
|
103
|
+
rotation: x.rotation ?? null,
|
|
104
|
+
opacity: x.opacity ?? null,
|
|
105
|
+
};
|
|
106
|
+
const instance = {
|
|
107
|
+
componentId,
|
|
108
|
+
controls: replaceEnumIdsForControls(x.controls, propertyControls),
|
|
109
|
+
parentsOrderings,
|
|
110
|
+
webPageId,
|
|
111
|
+
projectId,
|
|
112
|
+
nodeDepth: parents.length - 1,
|
|
113
|
+
styles,
|
|
114
|
+
};
|
|
115
|
+
return instance;
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
semaphore.release();
|
|
119
|
+
}
|
|
120
|
+
}));
|
|
121
|
+
const instancesGroups = Array.from(groupBy(rawComponentInstances.filter(isTruthy), (x) => x.webPageId).values());
|
|
122
|
+
let componentInstances = instancesGroups.flatMap((group) => {
|
|
123
|
+
return group
|
|
124
|
+
.sort((a, b) => {
|
|
125
|
+
const minParentLength = Math.min(a.parentsOrderings?.length, b.parentsOrderings?.length);
|
|
126
|
+
for (let i = 0; i < minParentLength; i++) {
|
|
127
|
+
if (a.parentsOrderings[i] < b.parentsOrderings[i]) {
|
|
128
|
+
return -1;
|
|
129
|
+
}
|
|
130
|
+
if (a.parentsOrderings[i] > b.parentsOrderings[i]) {
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// If all parent orderings are the same up to the minimum length,
|
|
135
|
+
// the shorter array should come first
|
|
136
|
+
return a.parentsOrderings.length - b.parentsOrderings.length;
|
|
137
|
+
})
|
|
138
|
+
.map((x, pageOrdering) => {
|
|
139
|
+
const { parentsOrderings, ...rest } = x;
|
|
140
|
+
const instance = {
|
|
141
|
+
...rest,
|
|
142
|
+
controls: JSON.parse(JSON.stringify(x.controls || {})) || {},
|
|
143
|
+
pageOrdering,
|
|
144
|
+
};
|
|
145
|
+
return instance;
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
componentInstances = deduplicateByKey(componentInstances, (x) => x.webPageId + x.componentId);
|
|
149
|
+
return componentInstances;
|
|
150
|
+
}
|
|
151
|
+
export async function getComponentsWithBreakpoints({ selectedComponentIds, components, allInstances, }) {
|
|
152
|
+
const filteredComponents = components.filter((component) => component.id &&
|
|
153
|
+
component.insertURL &&
|
|
154
|
+
selectedComponentIds.has(component.id));
|
|
155
|
+
if (!filteredComponents.length) {
|
|
156
|
+
console.warn(`[react export] no components selected with insertUrl`);
|
|
157
|
+
}
|
|
158
|
+
// Limit concurrency for breakpoint detection since each instance
|
|
159
|
+
// calls getParentNodesArray which walks the tree sequentially.
|
|
160
|
+
const bpSemaphore = new Sema(6);
|
|
161
|
+
const componentsWithBreakpoints = await Promise.all(filteredComponents.map(async (component) => {
|
|
162
|
+
try {
|
|
163
|
+
const instances = allInstances.filter((instance) => {
|
|
164
|
+
const id = getInstanceComponentId(instance);
|
|
165
|
+
return id === component.id;
|
|
166
|
+
});
|
|
167
|
+
if (!instances.length) {
|
|
168
|
+
console.warn(`no component instances found for ${component.name}`);
|
|
169
|
+
}
|
|
170
|
+
let breakpoints = await Promise.all(instances.map(async (instance) => {
|
|
171
|
+
const variantId = String(instance.controls?.variant || '');
|
|
172
|
+
if (!variantId) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
await bpSemaphore.acquire();
|
|
176
|
+
try {
|
|
177
|
+
const parents = (await getParentNodesArray(instance)).reverse();
|
|
178
|
+
let [root, breakpointNode] = parents;
|
|
179
|
+
if (!isFrameNode(breakpointNode)) {
|
|
180
|
+
breakpointNode = root;
|
|
181
|
+
}
|
|
182
|
+
if (!isFrameNode(breakpointNode)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const breakpointName = breakpointNode?.name;
|
|
186
|
+
let rect = await breakpointNode?.getRect();
|
|
187
|
+
return {
|
|
188
|
+
variantId,
|
|
189
|
+
width: rect?.width || 0,
|
|
190
|
+
breakpointName: breakpointName || '',
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
bpSemaphore.release();
|
|
195
|
+
}
|
|
196
|
+
}));
|
|
197
|
+
const filteredBreakpoints = breakpoints.filter((x) => Boolean(x?.breakpointName && x?.width && x?.variantId));
|
|
198
|
+
const deduplicatedBreakpoints = deduplicateByKey(filteredBreakpoints, (x) => x.variantId);
|
|
199
|
+
return { component, breakpoints: deduplicatedBreakpoints };
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
console.error('error getting component breakpoints', err);
|
|
203
|
+
return { component };
|
|
204
|
+
}
|
|
205
|
+
}));
|
|
206
|
+
const allBreakpointsCount = componentsWithBreakpoints.reduce((acc, curr) => acc + (curr.breakpoints?.length || 0), 0);
|
|
207
|
+
console.log(`[react export] found ${allBreakpointsCount} breakpoints in ${componentsWithBreakpoints.length} components`);
|
|
208
|
+
if (!allBreakpointsCount) {
|
|
209
|
+
console.warn(`[react export] found 0 breakpoints for ${componentsWithBreakpoints.length} components`);
|
|
210
|
+
}
|
|
211
|
+
return componentsWithBreakpoints;
|
|
212
|
+
}
|
|
213
|
+
export async function processReactExportData({ selectedComponentIds, }) {
|
|
214
|
+
let [publishInfo, components, pages, styles, projectInfo, locales, allInstances, { id: framerUserId }, codeFiles,] = await Promise.all([
|
|
215
|
+
framer.getPublishInfo().catch((e) => null),
|
|
216
|
+
framer.getNodesWithType('ComponentNode'),
|
|
217
|
+
framer.getNodesWithType('WebPageNode'),
|
|
218
|
+
framer.getColorStyles(),
|
|
219
|
+
framer.getProjectInfo(),
|
|
220
|
+
framer.getLocales?.()?.catch((err) => {
|
|
221
|
+
console.error('Error getting locales', err);
|
|
222
|
+
return [];
|
|
223
|
+
}),
|
|
224
|
+
framer.getNodesWithType('ComponentInstanceNode'),
|
|
225
|
+
framer.getCurrentUser(),
|
|
226
|
+
framer.getCodeFiles(),
|
|
227
|
+
]);
|
|
228
|
+
const { id: fullFramerProjectId, name: projectName } = projectInfo;
|
|
229
|
+
if (!fullFramerProjectId) {
|
|
230
|
+
throw new Error('No project id found');
|
|
231
|
+
}
|
|
232
|
+
// Separate code file IDs from component node IDs
|
|
233
|
+
const codeFileIds = new Set();
|
|
234
|
+
const componentNodeIds = new Set();
|
|
235
|
+
for (const id of selectedComponentIds) {
|
|
236
|
+
// Check if it's a code file
|
|
237
|
+
const isCodeFile = codeFiles.some((file) => file.id === id);
|
|
238
|
+
if (isCodeFile) {
|
|
239
|
+
codeFileIds.add(id);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
componentNodeIds.add(id);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const componentsWithBreakpoints = await getComponentsWithBreakpoints({
|
|
246
|
+
selectedComponentIds: componentNodeIds,
|
|
247
|
+
components,
|
|
248
|
+
allInstances,
|
|
249
|
+
});
|
|
250
|
+
let websiteUrl = publishInfo?.staging?.currentPageUrl ||
|
|
251
|
+
publishInfo?.staging?.url ||
|
|
252
|
+
publishInfo?.production?.currentPageUrl ||
|
|
253
|
+
publishInfo?.production?.url;
|
|
254
|
+
pages = pages.sort((a, b) => (a.path?.length || 0) - (b.path?.length || 0));
|
|
255
|
+
const indexPage = pages.find((x) => x);
|
|
256
|
+
const [pageContainer] = (await indexPage.getChildren()) || [];
|
|
257
|
+
let pageBackgroundColor = '';
|
|
258
|
+
if (isFrameNode(pageContainer) && pageContainer.backgroundColor) {
|
|
259
|
+
if (typeof pageContainer.backgroundColor === 'string') {
|
|
260
|
+
pageBackgroundColor = pageContainer.backgroundColor;
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
pageBackgroundColor = pageContainer.backgroundColor?.light;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const componentInstances = await getInstancesWithOrderAndDepth({
|
|
267
|
+
allInstances,
|
|
268
|
+
webPageIds: new Set(pages.slice(1).map((x) => x.id)),
|
|
269
|
+
components,
|
|
270
|
+
projectId: projectInfo.id,
|
|
271
|
+
}).catch((e) => {
|
|
272
|
+
console.error('error getting component instances', e);
|
|
273
|
+
return [];
|
|
274
|
+
});
|
|
275
|
+
return {
|
|
276
|
+
projectId: fullFramerProjectId,
|
|
277
|
+
projectName,
|
|
278
|
+
fullFramerProjectId,
|
|
279
|
+
framerUserId,
|
|
280
|
+
websiteUrl,
|
|
281
|
+
pageBackgroundColor,
|
|
282
|
+
colorStyles: styles.map((x) => {
|
|
283
|
+
const { dark, light, name, id } = x;
|
|
284
|
+
return {
|
|
285
|
+
name,
|
|
286
|
+
id,
|
|
287
|
+
projectId: fullFramerProjectId,
|
|
288
|
+
lightColor: light,
|
|
289
|
+
darkColor: dark ?? light,
|
|
290
|
+
};
|
|
291
|
+
}),
|
|
292
|
+
components: [
|
|
293
|
+
// Regular component nodes
|
|
294
|
+
...componentsWithBreakpoints.map(({ component }) => {
|
|
295
|
+
const { name, id, insertURL, componentName, componentIdentifier, } = component;
|
|
296
|
+
return {
|
|
297
|
+
name: name ?? '',
|
|
298
|
+
id,
|
|
299
|
+
url: insertURL ?? '',
|
|
300
|
+
projectId: fullFramerProjectId,
|
|
301
|
+
componentIdentifier,
|
|
302
|
+
componentType: 'component',
|
|
303
|
+
};
|
|
304
|
+
}),
|
|
305
|
+
// Code file components (only default exports)
|
|
306
|
+
...codeFiles
|
|
307
|
+
.filter((file) => codeFileIds.has(file.id))
|
|
308
|
+
.filter((file) => file.exports.some((exp) => exp.type === 'component' && exp.isDefaultExport))
|
|
309
|
+
.map((file) => {
|
|
310
|
+
const componentExport = file.exports.find((exp) => exp.type === 'component' && exp.isDefaultExport);
|
|
311
|
+
const name = file.name.replace(/\.(jsx?|tsx?)$/, '');
|
|
312
|
+
return {
|
|
313
|
+
name,
|
|
314
|
+
id: file.id,
|
|
315
|
+
url: componentExport && 'insertURL' in componentExport
|
|
316
|
+
? componentExport.insertURL
|
|
317
|
+
: '',
|
|
318
|
+
projectId: fullFramerProjectId,
|
|
319
|
+
componentIdentifier: '',
|
|
320
|
+
componentType: 'codeFile',
|
|
321
|
+
};
|
|
322
|
+
}),
|
|
323
|
+
],
|
|
324
|
+
breakpoints: componentsWithBreakpoints.flatMap(({ breakpoints, component }) => {
|
|
325
|
+
return (breakpoints?.map((breakpoint) => {
|
|
326
|
+
const { variantId, width, breakpointName } = breakpoint;
|
|
327
|
+
return {
|
|
328
|
+
variantId: variantId,
|
|
329
|
+
width: width || 0,
|
|
330
|
+
breakpointName: breakpointName || '',
|
|
331
|
+
componentId: component.id,
|
|
332
|
+
projectId: fullFramerProjectId,
|
|
333
|
+
};
|
|
334
|
+
}) || []);
|
|
335
|
+
}),
|
|
336
|
+
pages: pages.map((page) => {
|
|
337
|
+
const { id, collectionId, path } = page;
|
|
338
|
+
return {
|
|
339
|
+
path: path ?? '',
|
|
340
|
+
webPageId: id,
|
|
341
|
+
projectId: fullFramerProjectId,
|
|
342
|
+
};
|
|
343
|
+
}),
|
|
344
|
+
locales: locales?.map((locale) => {
|
|
345
|
+
const { id, name, slug, code } = locale;
|
|
346
|
+
return {
|
|
347
|
+
id,
|
|
348
|
+
name,
|
|
349
|
+
slug,
|
|
350
|
+
code,
|
|
351
|
+
projectId: fullFramerProjectId,
|
|
352
|
+
};
|
|
353
|
+
}),
|
|
354
|
+
componentInstances,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
//# sourceMappingURL=react-export.js.map
|
|
358
|
+
//# sourceMappingURL=react-export.js.map
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const codeComponentsResourceUri = "mcp://mcp.unframer.co/prompts/how-to-write-framer-code-files.md";
|
|
3
|
+
export declare const mcpTools: {
|
|
4
|
+
getProjectXml: {
|
|
5
|
+
description: string;
|
|
6
|
+
input: z.ZodObject<{}, z.core.$strip>;
|
|
7
|
+
output: z.ZodAny;
|
|
8
|
+
outputPrefix: string;
|
|
9
|
+
};
|
|
10
|
+
getSelectedNodesXml: {
|
|
11
|
+
description: string;
|
|
12
|
+
input: z.ZodObject<{}, z.core.$strip>;
|
|
13
|
+
output: z.ZodAny;
|
|
14
|
+
};
|
|
15
|
+
zoomIntoView: {
|
|
16
|
+
description: string;
|
|
17
|
+
input: z.ZodObject<{
|
|
18
|
+
nodeId: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
output: z.ZodAny;
|
|
21
|
+
};
|
|
22
|
+
getNodeXml: {
|
|
23
|
+
description: string;
|
|
24
|
+
input: z.ZodObject<{
|
|
25
|
+
nodeId: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
output: z.ZodAny;
|
|
28
|
+
};
|
|
29
|
+
updateXmlForNode: {
|
|
30
|
+
description: string;
|
|
31
|
+
input: z.ZodObject<{
|
|
32
|
+
nodeId: z.ZodString;
|
|
33
|
+
xml: z.ZodString;
|
|
34
|
+
zoomIntoView: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
output: z.ZodAny;
|
|
37
|
+
};
|
|
38
|
+
manageColorStyle: {
|
|
39
|
+
description: string;
|
|
40
|
+
input: z.ZodObject<{
|
|
41
|
+
type: z.ZodEnum<{
|
|
42
|
+
create: "create";
|
|
43
|
+
update: "update";
|
|
44
|
+
}>;
|
|
45
|
+
stylePath: z.ZodString;
|
|
46
|
+
properties: z.ZodObject<{
|
|
47
|
+
name: z.ZodOptional<z.ZodString>;
|
|
48
|
+
light: z.ZodOptional<z.ZodString>;
|
|
49
|
+
dark: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
output: z.ZodAny;
|
|
53
|
+
};
|
|
54
|
+
manageTextStyle: {
|
|
55
|
+
description: string;
|
|
56
|
+
input: z.ZodObject<{
|
|
57
|
+
type: z.ZodEnum<{
|
|
58
|
+
create: "create";
|
|
59
|
+
update: "update";
|
|
60
|
+
}>;
|
|
61
|
+
stylePath: z.ZodString;
|
|
62
|
+
properties: z.ZodObject<{
|
|
63
|
+
tag: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
h1: "h1";
|
|
65
|
+
h2: "h2";
|
|
66
|
+
h3: "h3";
|
|
67
|
+
h4: "h4";
|
|
68
|
+
h5: "h5";
|
|
69
|
+
h6: "h6";
|
|
70
|
+
p: "p";
|
|
71
|
+
}>>;
|
|
72
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
73
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
74
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
75
|
+
paragraphSpacing: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
transform: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
capitalize: "capitalize";
|
|
78
|
+
lowercase: "lowercase";
|
|
79
|
+
none: "none";
|
|
80
|
+
uppercase: "uppercase";
|
|
81
|
+
}>>;
|
|
82
|
+
alignment: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
center: "center";
|
|
84
|
+
justify: "justify";
|
|
85
|
+
left: "left";
|
|
86
|
+
right: "right";
|
|
87
|
+
}>>;
|
|
88
|
+
decoration: z.ZodOptional<z.ZodEnum<{
|
|
89
|
+
"line-through": "line-through";
|
|
90
|
+
none: "none";
|
|
91
|
+
underline: "underline";
|
|
92
|
+
}>>;
|
|
93
|
+
balance: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
color: z.ZodOptional<z.ZodString>;
|
|
95
|
+
font: z.ZodOptional<z.ZodString>;
|
|
96
|
+
boldFont: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
+
italicFont: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
boldItalicFont: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
decorationColor: z.ZodOptional<z.ZodString>;
|
|
100
|
+
decorationThickness: z.ZodOptional<z.ZodString>;
|
|
101
|
+
decorationStyle: z.ZodOptional<z.ZodEnum<{
|
|
102
|
+
dashed: "dashed";
|
|
103
|
+
dotted: "dotted";
|
|
104
|
+
double: "double";
|
|
105
|
+
solid: "solid";
|
|
106
|
+
wavy: "wavy";
|
|
107
|
+
}>>;
|
|
108
|
+
decorationSkipInk: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
all: "all";
|
|
110
|
+
auto: "auto";
|
|
111
|
+
none: "none";
|
|
112
|
+
}>>;
|
|
113
|
+
decorationOffset: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
output: z.ZodAny;
|
|
117
|
+
};
|
|
118
|
+
searchFonts: {
|
|
119
|
+
description: string;
|
|
120
|
+
input: z.ZodObject<{
|
|
121
|
+
query: z.ZodString;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
output: z.ZodAny;
|
|
124
|
+
};
|
|
125
|
+
deleteNode: {
|
|
126
|
+
description: string;
|
|
127
|
+
input: z.ZodObject<{
|
|
128
|
+
nodeId: z.ZodString;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
output: z.ZodAny;
|
|
131
|
+
};
|
|
132
|
+
duplicateNode: {
|
|
133
|
+
description: string;
|
|
134
|
+
input: z.ZodObject<{
|
|
135
|
+
nodeId: z.ZodString;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
output: z.ZodAny;
|
|
138
|
+
};
|
|
139
|
+
exportReactComponents: {
|
|
140
|
+
description: string;
|
|
141
|
+
input: z.ZodObject<{}, z.core.$strip>;
|
|
142
|
+
output: z.ZodAny;
|
|
143
|
+
};
|
|
144
|
+
createCodeFile: {
|
|
145
|
+
description: string;
|
|
146
|
+
input: z.ZodObject<{
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
content: z.ZodString;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
output: z.ZodAny;
|
|
151
|
+
};
|
|
152
|
+
readCodeFile: {
|
|
153
|
+
description: string;
|
|
154
|
+
input: z.ZodObject<{
|
|
155
|
+
codeFileId: z.ZodString;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
output: z.ZodAny;
|
|
158
|
+
};
|
|
159
|
+
updateCodeFile: {
|
|
160
|
+
description: string;
|
|
161
|
+
input: z.ZodObject<{
|
|
162
|
+
codeFileId: z.ZodString;
|
|
163
|
+
content: z.ZodString;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
output: z.ZodAny;
|
|
166
|
+
};
|
|
167
|
+
getComponentInsertUrlAndTypes: {
|
|
168
|
+
description: string;
|
|
169
|
+
input: z.ZodObject<{
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
output: z.ZodString;
|
|
173
|
+
};
|
|
174
|
+
getProjectWebsiteUrl: {
|
|
175
|
+
description: string;
|
|
176
|
+
input: z.ZodObject<{}, z.core.$strip>;
|
|
177
|
+
output: z.ZodAny;
|
|
178
|
+
};
|
|
179
|
+
getCMSCollections: {
|
|
180
|
+
description: string;
|
|
181
|
+
input: z.ZodObject<{}, z.core.$strip>;
|
|
182
|
+
output: z.ZodAny;
|
|
183
|
+
outputPrefix: string;
|
|
184
|
+
};
|
|
185
|
+
getCMSItems: {
|
|
186
|
+
description: string;
|
|
187
|
+
input: z.ZodObject<{
|
|
188
|
+
collectionId: z.ZodString;
|
|
189
|
+
skip: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
filter: z.ZodOptional<z.ZodObject<{
|
|
192
|
+
query: z.ZodOptional<z.ZodString>;
|
|
193
|
+
fieldName: z.ZodOptional<z.ZodString>;
|
|
194
|
+
}, z.core.$strip>>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
output: z.ZodAny;
|
|
197
|
+
};
|
|
198
|
+
upsertCMSItem: {
|
|
199
|
+
description: string;
|
|
200
|
+
input: z.ZodObject<{
|
|
201
|
+
collectionId: z.ZodString;
|
|
202
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
203
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
204
|
+
fieldData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
205
|
+
type: z.ZodString;
|
|
206
|
+
value: z.ZodUnknown;
|
|
207
|
+
contentType: z.ZodOptional<z.ZodEnum<{
|
|
208
|
+
html: "html";
|
|
209
|
+
markdown: "markdown";
|
|
210
|
+
}>>;
|
|
211
|
+
}, z.core.$loose>>>;
|
|
212
|
+
draft: z.ZodOptional<z.ZodBoolean>;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
output: z.ZodAny;
|
|
215
|
+
};
|
|
216
|
+
deleteCMSItem: {
|
|
217
|
+
description: string;
|
|
218
|
+
input: z.ZodObject<{
|
|
219
|
+
collectionId: z.ZodString;
|
|
220
|
+
itemId: z.ZodString;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
output: z.ZodAny;
|
|
223
|
+
};
|
|
224
|
+
createCMSCollection: {
|
|
225
|
+
description: string;
|
|
226
|
+
input: z.ZodObject<{
|
|
227
|
+
name: z.ZodString;
|
|
228
|
+
fields: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
229
|
+
id: z.ZodString;
|
|
230
|
+
name: z.ZodString;
|
|
231
|
+
type: z.ZodEnum<{
|
|
232
|
+
boolean: "boolean";
|
|
233
|
+
collectionReference: "collectionReference";
|
|
234
|
+
color: "color";
|
|
235
|
+
date: "date";
|
|
236
|
+
enum: "enum";
|
|
237
|
+
file: "file";
|
|
238
|
+
formattedText: "formattedText";
|
|
239
|
+
image: "image";
|
|
240
|
+
link: "link";
|
|
241
|
+
multiCollectionReference: "multiCollectionReference";
|
|
242
|
+
number: "number";
|
|
243
|
+
string: "string";
|
|
244
|
+
}>;
|
|
245
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
246
|
+
allowedFileTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
247
|
+
cases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
248
|
+
id: z.ZodString;
|
|
249
|
+
name: z.ZodString;
|
|
250
|
+
}, z.core.$strip>>>;
|
|
251
|
+
collectionId: z.ZodOptional<z.ZodString>;
|
|
252
|
+
}, z.core.$strip>>>>;
|
|
253
|
+
}, z.core.$strip>;
|
|
254
|
+
output: z.ZodAny;
|
|
255
|
+
};
|
|
256
|
+
createComponent: {
|
|
257
|
+
description: string;
|
|
258
|
+
input: z.ZodObject<{
|
|
259
|
+
name: z.ZodString;
|
|
260
|
+
nodeIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
output: z.ZodAny;
|
|
263
|
+
};
|
|
264
|
+
createPage: {
|
|
265
|
+
description: string;
|
|
266
|
+
input: z.ZodObject<{
|
|
267
|
+
name: z.ZodString;
|
|
268
|
+
type: z.ZodEnum<{
|
|
269
|
+
design: "design";
|
|
270
|
+
web: "web";
|
|
271
|
+
}>;
|
|
272
|
+
}, z.core.$strip>;
|
|
273
|
+
output: z.ZodAny;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
//# sourceMappingURL=schema.d.ts.map
|