unframer 2.6.4 → 2.6.5
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 +1 -1
- package/dist/css.js +4 -4
- package/dist/css.js.map +1 -1
- package/dist/esbuild.d.ts.map +1 -1
- package/dist/esbuild.js +5 -5
- package/dist/esbuild.js.map +1 -1
- package/dist/exporter.d.ts +9 -1
- package/dist/exporter.d.ts.map +1 -1
- package/dist/exporter.js +54 -41
- package/dist/exporter.js.map +1 -1
- package/dist/framer.d.ts.map +1 -1
- package/dist/framer.js +11515 -7193
- package/dist/framer.js.map +1 -1
- package/dist/react.d.ts +2 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/esm/esbuild.d.ts.map +1 -1
- package/esm/exporter.d.ts +9 -1
- package/esm/exporter.d.ts.map +1 -1
- package/esm/exporter.js +46 -32
- package/esm/exporter.js.map +1 -1
- package/esm/framer.d.ts.map +1 -1
- package/esm/framer.js +7717 -3396
- package/esm/framer.js.map +1 -1
- package/esm/react.d.ts +2 -2
- package/esm/react.d.ts.map +1 -1
- package/package.json +16 -9
- package/src/exporter.ts +58 -45
- package/src/framer.js +10927 -6494
package/esm/react.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ export declare function FramerStyles({ Components }: {
|
|
|
10
10
|
export declare const WithFramerBreakpoints: import("react").ForwardRefExoticComponent<{
|
|
11
11
|
Component: ComponentType<{
|
|
12
12
|
variant?: any;
|
|
13
|
-
className?: string
|
|
13
|
+
className?: string;
|
|
14
14
|
}>;
|
|
15
15
|
variants: Record<"2xl" | "base" | "sm" | "md" | "lg" | "xl", any>;
|
|
16
16
|
} & Omit<{
|
|
17
17
|
variant?: any;
|
|
18
|
-
className?: string
|
|
18
|
+
className?: string;
|
|
19
19
|
}, "variant"> & import("react").RefAttributes<unknown>>;
|
|
20
20
|
//# sourceMappingURL=react.d.ts.map
|
package/esm/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,aAAa,EAKhB,MAAM,OAAO,CAAA;AACd,OAAO,EAEH,sBAAsB,EAEzB,MAAM,UAAU,CAAA;AAWjB,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,sBAAsB,CAAA;AA8BpE;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,UAAwB,EAAE;;CAAA,GAAG,GAAG,CAmD9D;AAED,eAAO,MAAM,qBAAqB;;kBACM,GAAG
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,aAAa,EAKhB,MAAM,OAAO,CAAA;AACd,OAAO,EAEH,sBAAsB,EAEzB,MAAM,UAAU,CAAA;AAWjB,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,sBAAsB,CAAA;AA8BpE;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,UAAwB,EAAE;;CAAA,GAAG,GAAG,CAmD9D;AAED,eAAO,MAAM,qBAAqB;;kBACM,GAAG;oBAAc,MAAM;;;;cAAvB,GAAG;gBAAc,MAAM;uDA2E7D,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unframer",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"description": "Import Framer components directly in your React app, type safe and customizable",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"repository": "https://github.com/remorses/unframer",
|
|
@@ -21,8 +21,14 @@
|
|
|
21
21
|
"default": "./dist/index.js"
|
|
22
22
|
},
|
|
23
23
|
"./src/framer.js": {
|
|
24
|
+
"types": "./dist/framer.d.ts",
|
|
24
25
|
"default": "./src/framer.js"
|
|
25
26
|
},
|
|
27
|
+
"./dist/exporter": {
|
|
28
|
+
"types": "./dist/exporter.d.ts",
|
|
29
|
+
"module": "./esm/exporter.js",
|
|
30
|
+
"default": "./dist/exporter.js"
|
|
31
|
+
},
|
|
26
32
|
"./package.json": "./package.json"
|
|
27
33
|
},
|
|
28
34
|
"keywords": [],
|
|
@@ -61,19 +67,20 @@
|
|
|
61
67
|
"@types/babel__traverse": "^7.20.6",
|
|
62
68
|
"@types/bun": "^1.1.6",
|
|
63
69
|
"@types/fs-extra": "^11.0.4",
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"@types/react": "^18.3.
|
|
66
|
-
"@xmorse/deployment-utils": "^0.2.
|
|
70
|
+
"@types/node": "^22.7.4",
|
|
71
|
+
"@types/react": "^18.3.5",
|
|
72
|
+
"@xmorse/deployment-utils": "^0.2.14",
|
|
67
73
|
"concurrently": "^8.2.2",
|
|
68
74
|
"openai": "^4.52.7",
|
|
69
75
|
"posthtml": "^0.16.6",
|
|
70
|
-
"react": "
|
|
71
|
-
"react-dom": "
|
|
72
|
-
"tiktoken": "^1.0.15"
|
|
76
|
+
"react": "19.0.0-rc-e4953922-20240919",
|
|
77
|
+
"react-dom": "19.0.0-rc-e4953922-20240919",
|
|
78
|
+
"tiktoken": "^1.0.15",
|
|
79
|
+
"typescript": "^5.6.2"
|
|
73
80
|
},
|
|
74
81
|
"scripts": {
|
|
75
|
-
"build": "rm -rf dist && concurrently 'tsc -m esnext --outDir esm' 'tsc' && echo copying && cp ../README.md ./README.md && cp ./src/framer.d.ts ./dist/framer.d.ts && cp ./src/framer.d.ts ./esm/framer.d.ts",
|
|
82
|
+
"build": "rm -rf dist && concurrently 'pnpm tsc -m esnext --outDir esm' 'pnpm tsc' && echo copying && cp ../README.md ./README.md && cp ./src/framer.d.ts ./dist/framer.d.ts && cp ./src/framer.d.ts ./esm/framer.d.ts",
|
|
76
83
|
"download-framer": "tsx scripts/download.ts",
|
|
77
|
-
"watch": "rm -rf dist esm && concurrently 'tsc -w' 'tsc -m esnext -w --outDir esm'"
|
|
84
|
+
"watch": "rm -rf dist esm && concurrently 'pnpm tsc -w' 'pnpm tsc -m esnext -w --outDir esm'"
|
|
78
85
|
}
|
|
79
86
|
}
|
package/src/exporter.ts
CHANGED
|
@@ -176,50 +176,45 @@ export async function bundle({
|
|
|
176
176
|
JSON.stringify({ type: 'module' }),
|
|
177
177
|
'utf-8',
|
|
178
178
|
)
|
|
179
|
-
try {
|
|
180
|
-
await Promise.all(
|
|
181
|
-
result.outputFiles.map(async (file) => {
|
|
182
|
-
try {
|
|
183
|
-
await sema.acquire()
|
|
184
|
-
const name = path
|
|
185
|
-
.basename(file.path)
|
|
186
|
-
.replace(/\.js$/, '')
|
|
187
|
-
const resultPathAbs = path.resolve(out, file.path)
|
|
188
|
-
if (!components[name]) {
|
|
189
|
-
return
|
|
190
|
-
}
|
|
191
|
-
logger.log(`extracting types for ${name}`)
|
|
192
|
-
const { propertyControls, fonts } =
|
|
193
|
-
await extractPropControlsUnsafe(resultPathAbs, name)
|
|
194
|
-
if (!propertyControls) {
|
|
195
|
-
logger.log(`no property controls found for ${name}`)
|
|
196
|
-
}
|
|
197
179
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
180
|
+
const propControlsData = await Promise.all(
|
|
181
|
+
result.outputFiles.map(async (file) => {
|
|
182
|
+
try {
|
|
183
|
+
await sema.acquire()
|
|
184
|
+
const name = path.basename(file.path).replace(/\.js$/, '')
|
|
185
|
+
const resultPathAbs = path.resolve(out, file.path)
|
|
186
|
+
if (!components[name]) {
|
|
187
|
+
return
|
|
188
|
+
}
|
|
189
|
+
logger.log(`extracting types for ${name}`)
|
|
190
|
+
const { propertyControls, fonts } =
|
|
191
|
+
await extractPropControlsUnsafe(resultPathAbs, name)
|
|
192
|
+
if (!propertyControls) {
|
|
193
|
+
logger.log(`no property controls found for ${name}`)
|
|
194
|
+
}
|
|
210
195
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
196
|
+
allFonts.push(
|
|
197
|
+
...(fonts || []).map((x) => ({
|
|
198
|
+
...x,
|
|
199
|
+
fileName: path.basename(file.path),
|
|
200
|
+
})),
|
|
201
|
+
)
|
|
202
|
+
const types = propControlsToType(propertyControls!, name)
|
|
203
|
+
// name = 'framer-' + name
|
|
204
|
+
// logger.log('name', name)
|
|
205
|
+
|
|
206
|
+
fs.writeFileSync(path.resolve(out, `${name}.d.ts`), types)
|
|
207
|
+
return {
|
|
208
|
+
propertyControls,
|
|
209
|
+
fonts,
|
|
210
|
+
name,
|
|
211
|
+
// componentPath: file.path,
|
|
217
212
|
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
213
|
+
} finally {
|
|
214
|
+
sema.release()
|
|
215
|
+
}
|
|
216
|
+
}),
|
|
217
|
+
).finally(() => fs.rmSync(packageJson))
|
|
223
218
|
|
|
224
219
|
const cssString =
|
|
225
220
|
'/* This css file has all the necessary styles to run all your components */\n' +
|
|
@@ -274,12 +269,28 @@ export async function bundle({
|
|
|
274
269
|
'/* Bug: https://www.framer.community/c/bugs/color-style-unlinks-when-copying-component-between-projects-resulting-in-potential-value-discrepancy */\n' +
|
|
275
270
|
getTokensCss({ out, result })
|
|
276
271
|
fs.writeFileSync(path.resolve(out, 'tokens.css'), tokensCss, 'utf-8')
|
|
272
|
+
const res = {
|
|
273
|
+
components: Object.entries(components).map(([name, v]) => {
|
|
274
|
+
const propControls = propControlsData.find(
|
|
275
|
+
(x) => x?.name === name,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
return {
|
|
279
|
+
path: name,
|
|
280
|
+
url: v,
|
|
281
|
+
name,
|
|
282
|
+
componentName: componentCamelCase(name),
|
|
283
|
+
propertyControls: propControls?.propertyControls,
|
|
284
|
+
}
|
|
285
|
+
}),
|
|
286
|
+
}
|
|
287
|
+
return res
|
|
277
288
|
}
|
|
278
289
|
|
|
279
290
|
if (!watch) {
|
|
280
|
-
await rebuild()
|
|
291
|
+
const result = await rebuild()
|
|
281
292
|
await buildContext.dispose()
|
|
282
|
-
return
|
|
293
|
+
return result
|
|
283
294
|
}
|
|
284
295
|
|
|
285
296
|
// when user press ctrl+c dispose
|
|
@@ -296,7 +307,7 @@ export async function bundle({
|
|
|
296
307
|
buildContext.dispose()
|
|
297
308
|
})
|
|
298
309
|
|
|
299
|
-
await rebuild()
|
|
310
|
+
const res = await rebuild()
|
|
300
311
|
|
|
301
312
|
/**
|
|
302
313
|
* Get resolved URLs for all components and also wait for 1 second if it took less time than that
|
|
@@ -326,6 +337,7 @@ export async function bundle({
|
|
|
326
337
|
prevUrls = urls
|
|
327
338
|
await rebuild()
|
|
328
339
|
}
|
|
340
|
+
return res
|
|
329
341
|
}
|
|
330
342
|
|
|
331
343
|
function decapitalize(str: string) {
|
|
@@ -588,7 +600,7 @@ export function propControlsToType(controls: PropertyControls, fileName) {
|
|
|
588
600
|
.filter(Boolean)
|
|
589
601
|
.join('\n')
|
|
590
602
|
|
|
591
|
-
const componentName = componentCamelCase(fileName
|
|
603
|
+
const componentName = componentCamelCase(fileName)
|
|
592
604
|
|
|
593
605
|
const defaultPropsTypes =
|
|
594
606
|
[
|
|
@@ -733,6 +745,7 @@ function splitOnce(str: string, separator: string) {
|
|
|
733
745
|
}
|
|
734
746
|
|
|
735
747
|
export function componentCamelCase(str: string) {
|
|
748
|
+
str = str?.replace(/\.js$/, '')
|
|
736
749
|
if (!str) {
|
|
737
750
|
return 'FramerComponent'
|
|
738
751
|
}
|