unframer 4.1.8 → 4.1.9
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 +4 -4
- package/dist/babel-jsx.d.ts +9 -0
- package/dist/babel-jsx.d.ts.map +1 -1
- package/dist/babel-jsx.js +72 -0
- package/dist/babel-jsx.js.map +1 -1
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +24 -27
- package/dist/cli.js.map +1 -1
- package/dist/css-core.d.ts +50 -0
- package/dist/css-core.d.ts.map +1 -0
- package/dist/css-core.js +231 -0
- package/dist/css-core.js.map +1 -0
- package/dist/css.d.ts +9 -43
- package/dist/css.d.ts.map +1 -1
- package/dist/css.js +9 -232
- package/dist/css.js.map +1 -1
- package/dist/exporter.d.ts +1 -1
- package/dist/exporter.d.ts.map +1 -1
- package/dist/exporter.js +43 -6
- package/dist/exporter.js.map +1 -1
- package/dist/exporter.test.js +78 -0
- package/dist/exporter.test.js.map +1 -1
- package/dist/framer-chunks/{SqliteDatabase-VAKIICSG-R7ZS6CHH.js → SqliteDatabase-VAKIICSG-W43ZSXBO.js} +4 -4
- package/dist/framer-chunks/{chunk-2DZGP7C2.js → chunk-WYG6DFEF.js} +1 -1
- package/dist/framer-chunks/{default-blog-sqlite-7ZHEY3GT-27R5KAAW.js → default-blog-sqlite-7ZHEY3GT-DXFOTMBP.js} +1 -1
- package/dist/framer-chunks/{fontshare-4THNDPMZ-BJQGNHXN.js → fontshare-4THNDPMZ-L3NZDIOE.js} +1 -1
- package/dist/framer-chunks/{fontshare-B2QLD7YB-4BZEAA37.js → fontshare-B2QLD7YB-ZLNQ44LW.js} +1 -1
- package/dist/framer-chunks/{fontshare-O22OBJ3D-ALBQLFE5.js → fontshare-O22OBJ3D-VY7WF3BB.js} +1 -1
- package/dist/framer-chunks/{framer-font-45AI7UCZ-LU7DEIDM.js → framer-font-45AI7UCZ-Z3XHDH5K.js} +1 -1
- package/dist/framer-chunks/{google-3FCAKCAC-P5EL6KGL.js → google-3FCAKCAC-K2ZVMKHN.js} +1 -1
- package/dist/framer-chunks/{google-3SZHWBC6-OBXS3UIH.js → google-3SZHWBC6-MIC5SCB4.js} +1 -1
- package/dist/framer-chunks/{google-GXDJLGJB-HHIXFE4M.js → google-GXDJLGJB-356NWSZ7.js} +1 -1
- package/dist/framer-chunks/{sqlite-wasm-FGP37EAY-HR6PIAJQ.js → sqlite-wasm-FGP37EAY-MBPG3MPB.js} +23 -23
- package/dist/framer-chunks/{sqlite3-SISQ6ENZ-KMXYXSSV.js → sqlite3-SISQ6ENZ-RRHGROT5.js} +1 -1
- package/dist/framer.js +435 -45
- package/dist/plugin-mcp-dist/lib/framer.d.ts +1 -7
- package/dist/plugin-mcp-dist/lib/framer.d.ts.map +1 -1
- package/dist/plugin-mcp-dist/lib/framer.js +60 -9
- package/dist/plugin-mcp-dist/lib/framer.js.map +1 -1
- package/dist/plugin-mcp-dist/lib/framer.test.d.ts +2 -0
- package/dist/plugin-mcp-dist/lib/framer.test.d.ts.map +1 -0
- package/dist/plugin-mcp-dist/lib/framer.test.js +244 -0
- package/dist/plugin-mcp-dist/lib/framer.test.js.map +1 -0
- package/dist/plugin-mcp-dist/lib/mcp-handlers.d.ts.map +1 -1
- package/dist/plugin-mcp-dist/lib/mcp-handlers.js +10 -11
- package/dist/plugin-mcp-dist/lib/mcp-handlers.js.map +1 -1
- package/dist/plugin-mcp-dist/lib/mcp.test.js +340 -364
- package/dist/plugin-mcp-dist/lib/mcp.test.js.map +1 -1
- package/dist/plugin-mcp-dist/lib/plugin-websocket.d.ts.map +1 -1
- package/dist/plugin-mcp-dist/lib/plugin-websocket.js +0 -3
- package/dist/plugin-mcp-dist/lib/plugin-websocket.js.map +1 -1
- package/dist/plugin-mcp-dist/lib/tunnel-integration.test.d.ts +2 -0
- package/dist/plugin-mcp-dist/lib/tunnel-integration.test.d.ts.map +1 -0
- package/dist/plugin-mcp-dist/lib/tunnel-integration.test.js +147 -0
- package/dist/plugin-mcp-dist/lib/tunnel-integration.test.js.map +1 -0
- package/dist/plugin-mcp-dist/lib/tunnel.d.ts +46 -0
- package/dist/plugin-mcp-dist/lib/tunnel.d.ts.map +1 -0
- package/dist/plugin-mcp-dist/lib/tunnel.js +117 -0
- package/dist/plugin-mcp-dist/lib/tunnel.js.map +1 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.d.ts +13 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.d.ts.map +1 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.js +56 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.js.map +1 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.test.d.ts +2 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.test.d.ts.map +1 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.test.js +212 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.test.js.map +1 -0
- package/dist/plugin-mcp-dist/lib/utils.d.ts +1 -9
- package/dist/plugin-mcp-dist/lib/utils.d.ts.map +1 -1
- package/dist/plugin-mcp-dist/lib/utils.js +2 -2
- package/dist/plugin-mcp-dist/lib/utils.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -11
- package/dist/react.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/src/babel-jsx.ts +99 -0
- package/src/cli.ts +30 -28
- package/src/css-core.ts +277 -0
- package/src/css.tsx +10 -276
- package/src/exporter.test.ts +82 -0
- package/src/exporter.ts +53 -5
- package/src/framer.js +435 -45
- package/src/plugin-mcp-dist/lib/framer.d.ts +2 -5
- package/src/plugin-mcp-dist/lib/framer.d.ts.map +1 -1
- package/src/plugin-mcp-dist/lib/framer.js +60 -9
- package/src/plugin-mcp-dist/lib/framer.js.map +1 -1
- package/src/plugin-mcp-dist/lib/framer.test.d.ts +2 -0
- package/src/plugin-mcp-dist/lib/framer.test.d.ts.map +1 -0
- package/src/plugin-mcp-dist/lib/framer.test.js +243 -0
- package/src/plugin-mcp-dist/lib/framer.test.js.map +1 -0
- package/src/plugin-mcp-dist/lib/mcp-handlers.d.ts +1 -1
- package/src/plugin-mcp-dist/lib/mcp-handlers.d.ts.map +1 -1
- package/src/plugin-mcp-dist/lib/mcp-handlers.js +10 -11
- package/src/plugin-mcp-dist/lib/mcp-handlers.js.map +1 -1
- package/src/plugin-mcp-dist/lib/mcp.test.js +340 -364
- package/src/plugin-mcp-dist/lib/mcp.test.js.map +1 -1
- package/src/plugin-mcp-dist/lib/plugin-websocket.d.ts.map +1 -1
- package/src/plugin-mcp-dist/lib/plugin-websocket.js +0 -3
- package/src/plugin-mcp-dist/lib/plugin-websocket.js.map +1 -1
- package/src/plugin-mcp-dist/lib/tunnel-integration.test.d.ts +2 -0
- package/src/plugin-mcp-dist/lib/tunnel-integration.test.d.ts.map +1 -0
- package/src/plugin-mcp-dist/lib/tunnel-integration.test.js +146 -0
- package/src/plugin-mcp-dist/lib/tunnel-integration.test.js.map +1 -0
- package/src/plugin-mcp-dist/lib/tunnel.d.ts +55 -0
- package/src/plugin-mcp-dist/lib/tunnel.d.ts.map +1 -0
- package/src/plugin-mcp-dist/lib/tunnel.js +116 -0
- package/src/plugin-mcp-dist/lib/tunnel.js.map +1 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.d.ts +28 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.d.ts.map +1 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.js +55 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.js.map +1 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.test.d.ts +5 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.test.d.ts.map +1 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.test.js +211 -0
- package/src/plugin-mcp-dist/lib/upstream-socket.test.js.map +1 -0
- package/src/plugin-mcp-dist/lib/utils.d.ts +2 -2
- package/src/plugin-mcp-dist/lib/utils.d.ts.map +1 -1
- package/src/plugin-mcp-dist/lib/utils.js +2 -2
- package/src/plugin-mcp-dist/lib/utils.js.map +1 -1
- package/src/react.tsx +7 -16
- package/src/version.ts +1 -1
- package/dist/generated/api-client.d.ts +0 -21
- package/dist/generated/api-client.d.ts.map +0 -1
- package/dist/generated/api-client.js +0 -27
- package/dist/generated/api-client.js.map +0 -1
- package/src/generated/api-client.d.ts +0 -1238
- package/src/generated/api-client.js +0 -26
package/dist/css-core.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure CSS generation helpers for exported Framer components.
|
|
3
|
+
* This file must not import React or framer.js so server-only tools can use it
|
|
4
|
+
* without loading the generated Framer runtime in React Server Components.
|
|
5
|
+
*/
|
|
6
|
+
import dedent from 'string-dedent';
|
|
7
|
+
function getFontFamilyName(font) {
|
|
8
|
+
return font.cssFamilyName || font.family;
|
|
9
|
+
}
|
|
10
|
+
function deduplicateByKey(arr, key) {
|
|
11
|
+
const map = new Map();
|
|
12
|
+
for (const item of arr) {
|
|
13
|
+
const value = key(item);
|
|
14
|
+
if (map.has(value)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
map.set(value, item);
|
|
18
|
+
}
|
|
19
|
+
return Array.from(map.values());
|
|
20
|
+
}
|
|
21
|
+
export function logFontsUsage(fontsBundles) {
|
|
22
|
+
if (!fontsBundles.length) {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
const familyToFilenames = new Map();
|
|
26
|
+
for (const fontDefBundle of fontsBundles) {
|
|
27
|
+
const filename = fontDefBundle.fileName;
|
|
28
|
+
for (const font of fontDefBundle.fonts) {
|
|
29
|
+
const familyName = getFontFamilyName(font);
|
|
30
|
+
if (!familyName)
|
|
31
|
+
continue;
|
|
32
|
+
if (familyToFilenames.has(familyName)) {
|
|
33
|
+
familyToFilenames.get(familyName).add(filename);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
familyToFilenames.set(familyName, new Set([filename]));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
let str = `There are ${familyToFilenames.size} fonts used:\n`;
|
|
41
|
+
for (const [family, filenames] of familyToFilenames.entries()) {
|
|
42
|
+
str += `${JSON.stringify(family)}, used by\n`;
|
|
43
|
+
for (const filename of filenames) {
|
|
44
|
+
str += ` - ${filename}\n`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return str;
|
|
48
|
+
}
|
|
49
|
+
export function getFontsStyles(_fontsDefs) {
|
|
50
|
+
if (!_fontsDefs.length) {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
const urlToFilenames = new Map();
|
|
54
|
+
for (const fontDefBundle of _fontsDefs) {
|
|
55
|
+
const filename = fontDefBundle.fileName;
|
|
56
|
+
for (const font of fontDefBundle.fonts) {
|
|
57
|
+
if (urlToFilenames.has(font.url)) {
|
|
58
|
+
urlToFilenames.get(font.url).add(filename);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
urlToFilenames.set(font.url, new Set([filename]));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const allFonts = deduplicateByKey(_fontsDefs.flatMap((x) => x.fonts), (x) => x?.url)
|
|
66
|
+
.filter((x) => {
|
|
67
|
+
if (!x.url)
|
|
68
|
+
return false;
|
|
69
|
+
const familyName = getFontFamilyName(x);
|
|
70
|
+
if (!familyName) {
|
|
71
|
+
console.log('Font missing family field:', JSON.stringify(x, null, 2));
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
})
|
|
76
|
+
.sort((a, b) => a.url.localeCompare(b.url));
|
|
77
|
+
const grouped = groupBy(allFonts, (x) => {
|
|
78
|
+
return [...(urlToFilenames.get(x.url) || [])].sort().join(', ');
|
|
79
|
+
});
|
|
80
|
+
let str = '\n\n';
|
|
81
|
+
for (let [groupComment, fonts] of grouped.entries()) {
|
|
82
|
+
fonts = sortByKey(fonts, (x) => x.url);
|
|
83
|
+
str += `/* used by ${groupComment} */\n`;
|
|
84
|
+
str +=
|
|
85
|
+
'\n' +
|
|
86
|
+
fonts
|
|
87
|
+
.map((x) => {
|
|
88
|
+
let str = '';
|
|
89
|
+
const familyName = getFontFamilyName(x);
|
|
90
|
+
str += dedent `
|
|
91
|
+
@font-face {
|
|
92
|
+
font-family: "${familyName}";
|
|
93
|
+
src: url('${x.url}');\n
|
|
94
|
+
`;
|
|
95
|
+
if (x.style) {
|
|
96
|
+
str += ` font-style: ${x.style};\n`;
|
|
97
|
+
}
|
|
98
|
+
if (x.weight) {
|
|
99
|
+
str += ` font-weight: ${x.weight};\n`;
|
|
100
|
+
}
|
|
101
|
+
if (x.unicodeRange) {
|
|
102
|
+
str += ` unicode-range: ${x.unicodeRange};\n`;
|
|
103
|
+
}
|
|
104
|
+
str += `}\n`;
|
|
105
|
+
return str;
|
|
106
|
+
})
|
|
107
|
+
.join('\n') +
|
|
108
|
+
'\n';
|
|
109
|
+
}
|
|
110
|
+
return str;
|
|
111
|
+
}
|
|
112
|
+
export const defaultBreakpointSizes = {
|
|
113
|
+
base: 0,
|
|
114
|
+
sm: 320,
|
|
115
|
+
md: 768,
|
|
116
|
+
lg: 960,
|
|
117
|
+
xl: 1200,
|
|
118
|
+
'2xl': 1536,
|
|
119
|
+
};
|
|
120
|
+
export const breakpointsStylesLegacy = (breakpointSizes) => {
|
|
121
|
+
breakpointSizes = { ...defaultBreakpointSizes, ...breakpointSizes };
|
|
122
|
+
return /* css */ `
|
|
123
|
+
/* Base */
|
|
124
|
+
@media (min-width: ${breakpointSizes.base}px) and (max-width: ${breakpointSizes.sm - 1}px) {
|
|
125
|
+
.unframer-hidden.unframer-base {
|
|
126
|
+
display: contents;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Small */
|
|
131
|
+
@media (min-width: ${breakpointSizes.sm}px) and (max-width: ${breakpointSizes.md - 1}px) {
|
|
132
|
+
.unframer-hidden.unframer-sm {
|
|
133
|
+
display: contents;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Medium */
|
|
138
|
+
@media (min-width: ${breakpointSizes.md}px) and (max-width: ${breakpointSizes.lg - 1}px) {
|
|
139
|
+
.unframer-hidden.unframer-md {
|
|
140
|
+
display: contents;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Large */
|
|
145
|
+
@media (min-width: ${breakpointSizes.lg}px) and (max-width: ${breakpointSizes.xl - 1}px) {
|
|
146
|
+
.unframer-hidden.unframer-lg {
|
|
147
|
+
display: contents;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Extra Large */
|
|
152
|
+
@media (min-width: ${breakpointSizes.xl}px) and (max-width: ${breakpointSizes['2xl'] - 1}px) {
|
|
153
|
+
.unframer-hidden.unframer-xl {
|
|
154
|
+
display: contents;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* 2 Extra Large */
|
|
159
|
+
@media (min-width: ${breakpointSizes['2xl']}px) {
|
|
160
|
+
.unframer-hidden.unframer-2xl {
|
|
161
|
+
display: contents;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.unframer-hidden {
|
|
166
|
+
display: none;
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
};
|
|
170
|
+
export const breakpointsStyles = (breakpointSizes) => {
|
|
171
|
+
breakpointSizes = { ...defaultBreakpointSizes, ...breakpointSizes };
|
|
172
|
+
return /* css */ `
|
|
173
|
+
|
|
174
|
+
/* Base */
|
|
175
|
+
@media (min-width: ${breakpointSizes.base}px) and (max-width: ${breakpointSizes.sm - 1}px) {
|
|
176
|
+
.unframer-hidden:not(.unframer-base) {
|
|
177
|
+
display: none !important;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Small */
|
|
182
|
+
@media (min-width: ${breakpointSizes.sm}px) and (max-width: ${breakpointSizes.md - 1}px) {
|
|
183
|
+
.unframer-hidden:not(.unframer-sm) {
|
|
184
|
+
display: none !important;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* Medium */
|
|
189
|
+
@media (min-width: ${breakpointSizes.md}px) and (max-width: ${breakpointSizes.lg - 1}px) {
|
|
190
|
+
.unframer-hidden:not(.unframer-md) {
|
|
191
|
+
display: none !important;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Large */
|
|
196
|
+
@media (min-width: ${breakpointSizes.lg}px) and (max-width: ${breakpointSizes.xl - 1}px) {
|
|
197
|
+
.unframer-hidden:not(.unframer-lg) {
|
|
198
|
+
display: none !important;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Extra Large */
|
|
203
|
+
@media (min-width: ${breakpointSizes.xl}px) and (max-width: ${breakpointSizes['2xl'] - 1}px) {
|
|
204
|
+
.unframer-hidden:not(.unframer-xl) {
|
|
205
|
+
display: none !important;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* 2 Extra Large */
|
|
210
|
+
@media (min-width: ${breakpointSizes['2xl']}px) {
|
|
211
|
+
.unframer-hidden:not(.unframer-2xl) {
|
|
212
|
+
display: none !important;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
`;
|
|
216
|
+
};
|
|
217
|
+
export function groupBy(arr, key) {
|
|
218
|
+
const map = new Map();
|
|
219
|
+
for (const item of arr) {
|
|
220
|
+
const k = key(item);
|
|
221
|
+
if (!map.has(k)) {
|
|
222
|
+
map.set(k, []);
|
|
223
|
+
}
|
|
224
|
+
map.get(k)?.push(item);
|
|
225
|
+
}
|
|
226
|
+
return map;
|
|
227
|
+
}
|
|
228
|
+
function sortByKey(arr, key) {
|
|
229
|
+
return arr.slice().sort((a, b) => key(a).localeCompare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,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACd,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAClB,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,GAAG,CAAA;AAAA,CACb;AAED,SAAS,SAAS,CAAI,GAAQ,EAAE,GAAqB,EAAE;IACnD,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAAA,CAClE"}
|
package/dist/css.d.ts
CHANGED
|
@@ -1,49 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export type ComponentFontBundle = {
|
|
4
|
-
/**
|
|
5
|
-
* This flag specifies whether the font bundle includes the specific font
|
|
6
|
-
* weights of Framer’s Inter font that the component uses. New smart
|
|
7
|
-
* components do that (which means we can emit CSS only for Inter fonts that
|
|
8
|
-
* are actually used); older smart components don’t (which means some places
|
|
9
|
-
* will emit CSS for all Inter fonts if this flag is not set).
|
|
10
|
-
* https://www.notion.so/framer/RFC-ComponentFont-v2-d5fd3e822fb049ffb6971554ab0e4e42
|
|
11
|
-
*/
|
|
12
|
-
explicitInter: boolean;
|
|
13
|
-
fileName?: string;
|
|
14
|
-
fonts: ComponentFont[];
|
|
15
|
-
};
|
|
16
|
-
export declare function logFontsUsage(fontsBundles: ComponentFontBundle[]): string;
|
|
17
|
-
export declare function getFontsStyles(_fontsDefs: ComponentFontBundle[]): string;
|
|
18
|
-
export declare const defaultBreakpointSizes: {
|
|
19
|
-
readonly base: 0;
|
|
20
|
-
readonly sm: 320;
|
|
21
|
-
readonly md: 768;
|
|
22
|
-
readonly lg: 960;
|
|
23
|
-
readonly xl: 1200;
|
|
24
|
-
readonly '2xl': 1536;
|
|
25
|
-
};
|
|
26
|
-
export type BreakpointSizes = typeof defaultBreakpointSizes;
|
|
27
|
-
export declare const breakpointsStylesLegacy: (breakpointSizes?: {
|
|
28
|
-
readonly base: 0;
|
|
29
|
-
readonly sm: 320;
|
|
30
|
-
readonly md: 768;
|
|
31
|
-
readonly lg: 960;
|
|
32
|
-
readonly xl: 1200;
|
|
33
|
-
readonly '2xl': 1536;
|
|
34
|
-
} | undefined) => string;
|
|
35
|
-
export declare const breakpointsStyles: (breakpointSizes?: {
|
|
36
|
-
readonly base: 0;
|
|
37
|
-
readonly sm: 320;
|
|
38
|
-
readonly md: 768;
|
|
39
|
-
readonly lg: 960;
|
|
40
|
-
readonly xl: 1200;
|
|
41
|
-
readonly '2xl': 1536;
|
|
42
|
-
} | undefined) => string;
|
|
43
|
-
export declare function groupBy<T>(arr: T[], key: (x: T) => string): Map<string, T[]>;
|
|
2
|
+
export * from './css-core.js';
|
|
44
3
|
/**
|
|
45
4
|
* Custom withCSS function that restores the previous behavior
|
|
46
|
-
* of rendering inline style tags instead of using cssCollector
|
|
5
|
+
* of rendering inline style tags instead of using cssCollector.
|
|
6
|
+
*
|
|
7
|
+
* On the client we return withCSSOriginal so the component tree structure
|
|
8
|
+
* matches what framer.js internal components produce (just <Component/>,
|
|
9
|
+
* no Fragment wrapper). On the server we render <style> + <Component>
|
|
10
|
+
* inside a Fragment to inject CSS into the SSR HTML. The tree differs
|
|
11
|
+
* between server and client but suppressHydrationWarning on the Component
|
|
12
|
+
* handles the mismatch.
|
|
47
13
|
*/
|
|
48
14
|
export declare function withCSS(Component: any, escapedCSS: any, componentSerializationId?: string): React.ForwardRefExoticComponent<object & React.RefAttributes<unknown>> | ((props: any) => import("react/jsx-runtime").JSX.Element);
|
|
49
15
|
//# sourceMappingURL=css.d.ts.map
|
package/dist/css.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,cAAc,eAAe,CAAA;AAE7B;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACnB,SAAS,EAAE,GAAG,EACd,UAAU,EAAE,GAAG,EACf,wBAAwB,CAAC,EAAE,MAAM,sIAmCpC"}
|
package/dist/css.js
CHANGED
|
@@ -1,247 +1,25 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import dedent from 'string-dedent';
|
|
3
2
|
import { withCSS as withCSSOriginal } from './framer.js';
|
|
4
|
-
|
|
5
|
-
// New fonts have cssFamilyName, old fonts have family
|
|
6
|
-
return font.cssFamilyName || font.family;
|
|
7
|
-
}
|
|
8
|
-
function deduplicateByKey(arr, key) {
|
|
9
|
-
let map = new Map();
|
|
10
|
-
for (let item of arr) {
|
|
11
|
-
let value = key(item);
|
|
12
|
-
if (map.has(value)) {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
map.set(value, item);
|
|
16
|
-
}
|
|
17
|
-
return Array.from(map.values());
|
|
18
|
-
}
|
|
19
|
-
export function logFontsUsage(fontsBundles) {
|
|
20
|
-
if (!fontsBundles.length) {
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
let familyToFilenames = new Map();
|
|
24
|
-
for (let fontDefBundle of fontsBundles) {
|
|
25
|
-
let filename = fontDefBundle.fileName;
|
|
26
|
-
for (let font of fontDefBundle.fonts) {
|
|
27
|
-
const familyName = getFontFamilyName(font);
|
|
28
|
-
if (!familyName)
|
|
29
|
-
continue;
|
|
30
|
-
if (familyToFilenames.has(familyName)) {
|
|
31
|
-
familyToFilenames.get(familyName).add(filename);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
familyToFilenames.set(familyName, new Set([filename]));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
let str = `There are ${familyToFilenames.size} fonts used:\n`;
|
|
39
|
-
for (let [family, filenames] of familyToFilenames.entries()) {
|
|
40
|
-
str += `${JSON.stringify(family)}, used by\n`;
|
|
41
|
-
for (let filename of filenames) {
|
|
42
|
-
str += ` - ${filename}\n`;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return str;
|
|
46
|
-
}
|
|
47
|
-
export function getFontsStyles(_fontsDefs) {
|
|
48
|
-
if (!_fontsDefs.length) {
|
|
49
|
-
return '';
|
|
50
|
-
}
|
|
51
|
-
let urlToFilenames = new Map();
|
|
52
|
-
for (let fontDefBundle of _fontsDefs) {
|
|
53
|
-
let filename = fontDefBundle.fileName;
|
|
54
|
-
for (let font of fontDefBundle.fonts) {
|
|
55
|
-
if (urlToFilenames.has(font.url)) {
|
|
56
|
-
urlToFilenames.get(font.url).add(filename);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
urlToFilenames.set(font.url, new Set([filename]));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const allFonts = deduplicateByKey(_fontsDefs.flatMap((x) => x.fonts), (x) => x?.url)
|
|
64
|
-
.filter((x) => {
|
|
65
|
-
if (!x.url)
|
|
66
|
-
return false;
|
|
67
|
-
const familyName = getFontFamilyName(x);
|
|
68
|
-
if (!familyName) {
|
|
69
|
-
console.log('Font missing family field:', JSON.stringify(x, null, 2));
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
return true;
|
|
73
|
-
})
|
|
74
|
-
.sort((a, b) => a.url.localeCompare(b.url));
|
|
75
|
-
// group fonts by the filenames users
|
|
76
|
-
const grouped = groupBy(allFonts, (x) => {
|
|
77
|
-
return [...(urlToFilenames.get(x.url) || [])].sort().join(', ');
|
|
78
|
-
});
|
|
79
|
-
let str = '\n\n';
|
|
80
|
-
for (let [groupComment, fonts] of grouped.entries()) {
|
|
81
|
-
fonts = sortByKey(fonts, (x) => x.url);
|
|
82
|
-
str += `/* used by ${groupComment} */\n`;
|
|
83
|
-
str +=
|
|
84
|
-
'\n' +
|
|
85
|
-
fonts
|
|
86
|
-
.map((x) => {
|
|
87
|
-
let str = '';
|
|
88
|
-
const familyName = getFontFamilyName(x);
|
|
89
|
-
str += dedent `
|
|
90
|
-
@font-face {
|
|
91
|
-
font-family: "${familyName}";
|
|
92
|
-
src: url('${x.url}');\n
|
|
93
|
-
`;
|
|
94
|
-
if (x.style) {
|
|
95
|
-
str += ` font-style: ${x.style};\n`;
|
|
96
|
-
}
|
|
97
|
-
if (x.weight) {
|
|
98
|
-
str += ` font-weight: ${x.weight};\n`;
|
|
99
|
-
}
|
|
100
|
-
if (x.unicodeRange) {
|
|
101
|
-
str += ` unicode-range: ${x.unicodeRange};\n`;
|
|
102
|
-
}
|
|
103
|
-
str += `}\n`;
|
|
104
|
-
return str;
|
|
105
|
-
})
|
|
106
|
-
.join('\n') +
|
|
107
|
-
'\n';
|
|
108
|
-
}
|
|
109
|
-
return str;
|
|
110
|
-
}
|
|
111
|
-
export const defaultBreakpointSizes = {
|
|
112
|
-
base: 0,
|
|
113
|
-
sm: 320,
|
|
114
|
-
md: 768,
|
|
115
|
-
lg: 960,
|
|
116
|
-
xl: 1200,
|
|
117
|
-
'2xl': 1536,
|
|
118
|
-
};
|
|
119
|
-
// @deprecated TODO remove this in future releases
|
|
120
|
-
export const breakpointsStylesLegacy = (breakpointSizes) => {
|
|
121
|
-
breakpointSizes = { ...defaultBreakpointSizes, ...breakpointSizes };
|
|
122
|
-
return /* css */ `
|
|
123
|
-
/* Base */
|
|
124
|
-
@media (min-width: ${breakpointSizes.base}px) and (max-width: ${breakpointSizes.sm - 1}px) {
|
|
125
|
-
.unframer-hidden.unframer-base {
|
|
126
|
-
display: contents;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/* Small */
|
|
131
|
-
@media (min-width: ${breakpointSizes.sm}px) and (max-width: ${breakpointSizes.md - 1}px) {
|
|
132
|
-
.unframer-hidden.unframer-sm {
|
|
133
|
-
display: contents;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/* Medium */
|
|
138
|
-
@media (min-width: ${breakpointSizes.md}px) and (max-width: ${breakpointSizes.lg - 1}px) {
|
|
139
|
-
.unframer-hidden.unframer-md {
|
|
140
|
-
display: contents;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/* Large */
|
|
145
|
-
@media (min-width: ${breakpointSizes.lg}px) and (max-width: ${breakpointSizes.xl - 1}px) {
|
|
146
|
-
.unframer-hidden.unframer-lg {
|
|
147
|
-
display: contents;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/* Extra Large */
|
|
152
|
-
@media (min-width: ${breakpointSizes.xl}px) and (max-width: ${breakpointSizes['2xl'] - 1}px) {
|
|
153
|
-
.unframer-hidden.unframer-xl {
|
|
154
|
-
display: contents;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/* 2 Extra Large */
|
|
159
|
-
@media (min-width: ${breakpointSizes['2xl']}px) {
|
|
160
|
-
.unframer-hidden.unframer-2xl {
|
|
161
|
-
display: contents;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.unframer-hidden {
|
|
166
|
-
display: none;
|
|
167
|
-
}
|
|
168
|
-
`;
|
|
169
|
-
};
|
|
170
|
-
export const breakpointsStyles = (breakpointSizes) => {
|
|
171
|
-
breakpointSizes = { ...defaultBreakpointSizes, ...breakpointSizes };
|
|
172
|
-
return /* css */ `
|
|
173
|
-
|
|
174
|
-
/* Base */
|
|
175
|
-
@media (min-width: ${breakpointSizes.base}px) and (max-width: ${breakpointSizes.sm - 1}px) {
|
|
176
|
-
.unframer-hidden:not(.unframer-base) {
|
|
177
|
-
display: none !important;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/* Small */
|
|
182
|
-
@media (min-width: ${breakpointSizes.sm}px) and (max-width: ${breakpointSizes.md - 1}px) {
|
|
183
|
-
.unframer-hidden:not(.unframer-sm) {
|
|
184
|
-
display: none !important;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/* Medium */
|
|
189
|
-
@media (min-width: ${breakpointSizes.md}px) and (max-width: ${breakpointSizes.lg - 1}px) {
|
|
190
|
-
.unframer-hidden:not(.unframer-md) {
|
|
191
|
-
display: none !important;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/* Large */
|
|
196
|
-
@media (min-width: ${breakpointSizes.lg}px) and (max-width: ${breakpointSizes.xl - 1}px) {
|
|
197
|
-
.unframer-hidden:not(.unframer-lg) {
|
|
198
|
-
display: none !important;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/* Extra Large */
|
|
203
|
-
@media (min-width: ${breakpointSizes.xl}px) and (max-width: ${breakpointSizes['2xl'] - 1}px) {
|
|
204
|
-
.unframer-hidden:not(.unframer-xl) {
|
|
205
|
-
display: none !important;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/* 2 Extra Large */
|
|
210
|
-
@media (min-width: ${breakpointSizes['2xl']}px) {
|
|
211
|
-
.unframer-hidden:not(.unframer-2xl) {
|
|
212
|
-
display: none !important;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
`;
|
|
216
|
-
};
|
|
217
|
-
export function groupBy(arr, key) {
|
|
218
|
-
const map = new Map();
|
|
219
|
-
for (let item of arr) {
|
|
220
|
-
const k = key(item);
|
|
221
|
-
if (!map.has(k)) {
|
|
222
|
-
map.set(k, []);
|
|
223
|
-
}
|
|
224
|
-
map.get(k)?.push(item);
|
|
225
|
-
}
|
|
226
|
-
return map;
|
|
227
|
-
}
|
|
228
|
-
function sortByKey(arr, key) {
|
|
229
|
-
return arr.slice().sort((a, b) => key(a).localeCompare(key(b)));
|
|
230
|
-
}
|
|
3
|
+
export * from './css-core.js';
|
|
231
4
|
/**
|
|
232
5
|
* Custom withCSS function that restores the previous behavior
|
|
233
|
-
* of rendering inline style tags instead of using cssCollector
|
|
6
|
+
* of rendering inline style tags instead of using cssCollector.
|
|
7
|
+
*
|
|
8
|
+
* On the client we return withCSSOriginal so the component tree structure
|
|
9
|
+
* matches what framer.js internal components produce (just <Component/>,
|
|
10
|
+
* no Fragment wrapper). On the server we render <style> + <Component>
|
|
11
|
+
* inside a Fragment to inject CSS into the SSR HTML. The tree differs
|
|
12
|
+
* between server and client but suppressHydrationWarning on the Component
|
|
13
|
+
* handles the mismatch.
|
|
234
14
|
*/
|
|
235
15
|
export function withCSS(Component, escapedCSS, componentSerializationId) {
|
|
236
16
|
const framerCSSMarker = 'data-framer-css-ssr';
|
|
237
17
|
if (typeof window !== 'undefined' && typeof window.document !== 'undefined')
|
|
238
18
|
return withCSSOriginal(Component, escapedCSS, componentSerializationId || '');
|
|
239
19
|
return (props) => {
|
|
240
|
-
// Check if we're in SSR mode
|
|
241
20
|
const isBrowser = typeof window !== 'undefined' &&
|
|
242
21
|
typeof window.document !== 'undefined';
|
|
243
22
|
if (!isBrowser) {
|
|
244
|
-
// Server-side: render style tags like the old behavior
|
|
245
23
|
const id = componentSerializationId;
|
|
246
24
|
const cssContent = typeof escapedCSS === 'function'
|
|
247
25
|
? escapedCSS('EXPORT')
|
|
@@ -252,7 +30,6 @@ export function withCSS(Component, escapedCSS, componentSerializationId) {
|
|
|
252
30
|
_jsx("style", { [framerCSSMarker]: true, "data-framer-component": id, dangerouslySetInnerHTML: { __html: cssContent } }), _jsx(Component, { ...props })
|
|
253
31
|
] }));
|
|
254
32
|
}
|
|
255
|
-
// Client-side: just render the component
|
|
256
33
|
return _jsx(Component, { ...props });
|
|
257
34
|
};
|
|
258
35
|
}
|
package/dist/css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","sourceRoot":"","sources":["../src/css.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../src/css.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,aAAa,CAAA;AAExD,cAAc,eAAe,CAAA;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CACnB,SAAc,EACd,UAAe,EACf,wBAAiC,EACnC;IACE,MAAM,eAAe,GAAG,qBAAqB,CAAA;IAE7C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW;QACvE,OAAO,eAAe,CAAC,SAAS,EAAE,UAAU,EAAE,wBAAwB,IAAI,EAAE,CAAC,CAAA;IAEjF,OAAO,CAAC,KAAU,EAAE,EAAE,CAAC;QACnB,MAAM,SAAS,GACX,OAAO,MAAM,KAAK,WAAW;YAC7B,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAA;QAE1C,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,EAAE,GAAG,wBAAwB,CAAA;YACnC,MAAM,UAAU,GACZ,OAAO,UAAU,KAAK,UAAU;gBAC5B,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;gBACtB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;oBACzB,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;oBACvB,CAAC,CAAC,UAAU,CAAA;YAEtB,OAAO,CACH;oBACI,gBACU,CAAC,eAAe,CAAC,EAAE,IAAI,2BACN,EAAE,EACzB,uBAAuB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,GACjD,EACF,KAAC,SAAS,OAAK,KAAK,GAAI;oBACzB,CACN,CAAA;QACL,CAAC;QAED,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAA;IAAA,CAClC,CAAA;AAAA,CACJ"}
|
package/dist/exporter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuildResult, type BuildOptions } from 'esbuild';
|
|
2
2
|
import { Config } from './cli.js';
|
|
3
|
-
import { ComponentFontBundle } from './css.js';
|
|
3
|
+
import { ComponentFontBundle } from './css-core.js';
|
|
4
4
|
import type { PropertyControls } from './framer-types.js';
|
|
5
5
|
export type StyleToken = {
|
|
6
6
|
id: string;
|
package/dist/exporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../src/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAIxE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../src/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAIxE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAsBjC,OAAO,EACH,mBAAmB,EAOtB,MAAM,eAAe,CAAA;AAUtB,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AA6C7E,MAAM,MAAM,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAkBD,wBAAsB,MAAM,CAAC,EACzB,MAAM,EACN,GAAG,EAAE,GAAQ,EACb,KAAa,EACb,MAA6C,EAC7C,QAAgB,EACnB,EAAE;IACC,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IAC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