unframer 3.0.1 → 3.0.4
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/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/cli.test.js +14 -6
- package/dist/cli.test.js.map +1 -1
- package/dist/example-code.test.js +1 -1
- package/dist/exporter.d.ts +0 -14
- package/dist/exporter.d.ts.map +1 -1
- package/dist/exporter.js +23 -192
- package/dist/exporter.js.map +1 -1
- package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts +115 -0
- package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts.map +1 -0
- package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js +8 -0
- package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js.map +1 -0
- package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts +781 -0
- package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts.map +1 -0
- package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.js +8 -0
- package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.js.map +1 -0
- package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts +634 -0
- package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts.map +1 -0
- package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js +8 -0
- package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js.map +1 -0
- package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts +1561 -0
- package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts.map +1 -0
- package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.js +8 -0
- package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.js.map +1 -0
- package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts +3546 -0
- package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts.map +1 -0
- package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.js +8 -0
- package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.js.map +1 -0
- package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts +10258 -0
- package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts.map +1 -0
- package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js +8 -0
- package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js.map +1 -0
- package/dist/framer.js +1230 -223
- package/dist/generated/api-client.js.map +1 -1
- package/dist/typescript.d.ts +20 -0
- package/dist/typescript.d.ts.map +1 -0
- package/dist/typescript.js +169 -0
- package/dist/typescript.js.map +1 -0
- package/dist/unframer-loader.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/cli.js +1 -0
- package/esm/cli.js.map +1 -1
- package/esm/cli.test.js +9 -1
- package/esm/cli.test.js.map +1 -1
- package/esm/example-code.test.js +1 -1
- package/esm/exporter.d.ts +0 -14
- package/esm/exporter.d.ts.map +1 -1
- package/esm/exporter.js +20 -187
- package/esm/exporter.js.map +1 -1
- package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts +115 -0
- package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts.map +1 -0
- package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js +5 -0
- package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js.map +1 -0
- package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts +781 -0
- package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts.map +1 -0
- package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.js +5 -0
- package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.js.map +1 -0
- package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts +634 -0
- package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts.map +1 -0
- package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js +5 -0
- package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js.map +1 -0
- package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts +1561 -0
- package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts.map +1 -0
- package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.js +5 -0
- package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.js.map +1 -0
- package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts +3546 -0
- package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts.map +1 -0
- package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.js +5 -0
- package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.js.map +1 -0
- package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts +10258 -0
- package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts.map +1 -0
- package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js +5 -0
- package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js.map +1 -0
- package/esm/framer.js +1230 -224
- package/esm/generated/api-client.js.map +1 -1
- package/esm/typescript.d.ts +20 -0
- package/esm/typescript.d.ts.map +1 -0
- package/esm/typescript.js +165 -0
- package/esm/typescript.js.map +1 -0
- package/esm/unframer-loader.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +6 -3
- package/src/cli.test.ts +8 -1
- package/src/cli.ts +1 -1
- package/src/example-code.test.ts +1 -1
- package/src/exporter.ts +25 -211
- package/src/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js +7 -0
- package/src/framer-chunks/fontshare-622CVMZZ-HFPH543A.js +7 -0
- package/src/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js +7 -0
- package/src/framer-chunks/google-3ASCFEEO-3R47BR2A.js +7 -0
- package/src/framer-chunks/google-C62SNV32-LCI4F7VO.js +7 -0
- package/src/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js +7 -0
- package/src/framer.js +1170 -215
- package/src/generated/api-client.d.ts +790 -1042
- package/src/generated/api-client.js +5 -5
- package/src/styles/framer.css +1963 -0
- package/src/styles/reset.css +33 -0
- package/src/typescript.ts +196 -0
- package/src/unframer-loader.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/generated/api-client.test.d.ts +0 -2
- package/dist/generated/api-client.test.d.ts.map +0 -1
- package/dist/generated/api-client.test.js +0 -3
- package/dist/generated/api-client.test.js.map +0 -1
- package/esm/generated/api-client.test.d.ts +0 -1
- package/esm/generated/api-client.test.d.ts.map +0 -1
- package/esm/generated/api-client.test.js +0 -2
- package/esm/generated/api-client.test.js.map +0 -1
- package/src/generated/api-client.d.ts.map +0 -1
- package/src/generated/api-client.js.map +0 -1
- package/src/generated/api-client.test.d.ts +0 -1
- package/src/generated/api-client.test.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/generated/api-client.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,GAAG,EAAE;IACtC,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/generated/api-client.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,GAAG,EAAE;IACtC,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE;QACtC,oCAAoC;QACpC,kDAAkD;QAClD,qBAAqB;QACrB,4CAA4C;QAC5C,QAAQ;QACR,iBAAiB;QACjB,KAAK;QACL,+BAA+B;QAC/B,0BAA0B;QAC1B,iDAAiD;QACjD,QAAQ;QACR,sBAAsB;QACtB,KAAK;QACL,OAAO;YACH,OAAO;YACP,yFAAyF;aACxF,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,iFAAiF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropertyControls } from './framer.js';
|
|
2
|
+
export declare function componentCamelCase(str: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Generates TypeDoc comments that will be injected into JSX files
|
|
5
|
+
* instead of generating separate .d.ts files
|
|
6
|
+
*/
|
|
7
|
+
export declare function propControlsToTypedocComments({ locales, componentImportedName, propertyControls, logger, includeLocaleTypes, }: {
|
|
8
|
+
propertyControls: PropertyControls;
|
|
9
|
+
componentImportedName: string;
|
|
10
|
+
locales?: Array<{
|
|
11
|
+
slug: string;
|
|
12
|
+
}>;
|
|
13
|
+
logger: any;
|
|
14
|
+
includeLocaleTypes?: boolean;
|
|
15
|
+
}): {
|
|
16
|
+
headerComment: string;
|
|
17
|
+
responsiveComment: string;
|
|
18
|
+
defaultExportComment: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../src/typescript.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE/E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,UAoC7C;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,EAC1C,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,MAAM,EACN,kBAA0B,GAC7B,EAAE;IACC,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,qBAAqB,EAAE,MAAM,CAAA;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACjC,MAAM,EAAE,GAAG,CAAA;IACX,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC/B;;;;EA0IA"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { propCamelCaseJustLikeFramer } from './compat.js';
|
|
2
|
+
import { ControlType } from './framer.js';
|
|
3
|
+
export function componentCamelCase(str) {
|
|
4
|
+
str = str?.replace(/\.jsx?$/, '');
|
|
5
|
+
if (!str) {
|
|
6
|
+
return 'FramerComponent';
|
|
7
|
+
}
|
|
8
|
+
// Take last part after slashes
|
|
9
|
+
str = str.split('/').filter(Boolean).pop() || '';
|
|
10
|
+
// Replace all non-alphanumeric characters with space
|
|
11
|
+
// This handles spaces, special chars, underscores, hyphens, etc.
|
|
12
|
+
str = str.replace(/[^a-zA-Z0-9]+/g, ' ');
|
|
13
|
+
// Convert to camelCase: split by spaces, capitalize each word except first
|
|
14
|
+
const words = str.trim().split(/\s+/).filter(Boolean);
|
|
15
|
+
if (words.length === 0) {
|
|
16
|
+
return 'FramerComponent';
|
|
17
|
+
}
|
|
18
|
+
str = words
|
|
19
|
+
.map((word, index) => {
|
|
20
|
+
// First word: capitalize only if it starts with lowercase
|
|
21
|
+
if (index === 0) {
|
|
22
|
+
return word[0].toUpperCase() + word.slice(1);
|
|
23
|
+
}
|
|
24
|
+
// Other words: always capitalize first letter
|
|
25
|
+
return word[0].toUpperCase() + word.slice(1);
|
|
26
|
+
})
|
|
27
|
+
.join('');
|
|
28
|
+
// If component name starts with a number, add prefix 'Framer'
|
|
29
|
+
if (/^[0-9]/.test(str)) {
|
|
30
|
+
str = 'Framer' + str;
|
|
31
|
+
}
|
|
32
|
+
str = str + 'FramerComponent';
|
|
33
|
+
return str;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generates TypeDoc comments that will be injected into JSX files
|
|
37
|
+
* instead of generating separate .d.ts files
|
|
38
|
+
*/
|
|
39
|
+
export function propControlsToTypedocComments({ locales, componentImportedName, propertyControls, logger, includeLocaleTypes = false, }) {
|
|
40
|
+
try {
|
|
41
|
+
const types = Object.entries(propertyControls || {})
|
|
42
|
+
.map(([key, value]) => {
|
|
43
|
+
if (!value) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const typescriptType = (value) => {
|
|
47
|
+
value.type;
|
|
48
|
+
switch (value.type) {
|
|
49
|
+
case ControlType.Color:
|
|
50
|
+
return 'string';
|
|
51
|
+
case ControlType.Boolean:
|
|
52
|
+
return 'boolean';
|
|
53
|
+
case ControlType.Number:
|
|
54
|
+
return 'number';
|
|
55
|
+
case ControlType.String:
|
|
56
|
+
return 'string';
|
|
57
|
+
case ControlType.Enum: {
|
|
58
|
+
// @ts-expect-error
|
|
59
|
+
const options = value.optionTitles || value.options;
|
|
60
|
+
return options.map((x) => `'${x}'`).join(' | ');
|
|
61
|
+
}
|
|
62
|
+
case ControlType.File:
|
|
63
|
+
return 'string';
|
|
64
|
+
case ControlType.Image:
|
|
65
|
+
return 'string';
|
|
66
|
+
case ControlType.ComponentInstance:
|
|
67
|
+
return 'React.ReactNode';
|
|
68
|
+
case ControlType.Array:
|
|
69
|
+
// @ts-expect-error
|
|
70
|
+
return `${typescriptType(value.control)}[]`;
|
|
71
|
+
case ControlType.Object:
|
|
72
|
+
// @ts-expect-error
|
|
73
|
+
return `{${Object.entries(value.controls)
|
|
74
|
+
.map(([k, v]) => {
|
|
75
|
+
// @ts-expect-error
|
|
76
|
+
return `${k}: ${typescriptType(v)}`;
|
|
77
|
+
})
|
|
78
|
+
.join(', ')}`;
|
|
79
|
+
case ControlType.Date:
|
|
80
|
+
return 'string | Date';
|
|
81
|
+
case ControlType.Link:
|
|
82
|
+
return 'string';
|
|
83
|
+
case ControlType.ResponsiveImage:
|
|
84
|
+
return `{src: string, srcSet?: string, alt?: string}`;
|
|
85
|
+
case ControlType.FusedNumber:
|
|
86
|
+
return 'number';
|
|
87
|
+
case ControlType.Transition:
|
|
88
|
+
return 'any';
|
|
89
|
+
case ControlType.EventHandler:
|
|
90
|
+
return 'Function';
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
let name = propCamelCaseJustLikeFramer(value.title || key || '');
|
|
94
|
+
if (!name) {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
return ` * ${name}?: ${typescriptType(value)} // ${value.title || name}`;
|
|
98
|
+
})
|
|
99
|
+
.filter(Boolean)
|
|
100
|
+
.join('\n');
|
|
101
|
+
const componentName = componentImportedName;
|
|
102
|
+
const defaultPropsJsDoc = [
|
|
103
|
+
' * children?: React.ReactNode',
|
|
104
|
+
includeLocaleTypes ? ' * locale?: Locale' : null,
|
|
105
|
+
' * style?: React.CSSProperties',
|
|
106
|
+
' * className?: string',
|
|
107
|
+
' * id?: string',
|
|
108
|
+
' * ref?: any',
|
|
109
|
+
' * width?: any',
|
|
110
|
+
' * height?: any',
|
|
111
|
+
' * layoutId?: string',
|
|
112
|
+
].filter(Boolean).join('\n');
|
|
113
|
+
// Generate header comment with type definitions
|
|
114
|
+
let headerComment = '';
|
|
115
|
+
if (includeLocaleTypes) {
|
|
116
|
+
headerComment += '/**\n';
|
|
117
|
+
headerComment += ' * @typedef Locale\n';
|
|
118
|
+
// Generate union type from locales if available
|
|
119
|
+
const localeType = (() => {
|
|
120
|
+
if (locales && Array.isArray(locales) && locales.length > 0) {
|
|
121
|
+
return locales.map((locale) => `'${locale.slug}'`).join(' | ');
|
|
122
|
+
}
|
|
123
|
+
return 'string';
|
|
124
|
+
})();
|
|
125
|
+
headerComment += ` * ${localeType}\n`;
|
|
126
|
+
headerComment += ' */\n\n';
|
|
127
|
+
}
|
|
128
|
+
headerComment += '/**\n';
|
|
129
|
+
headerComment += ' * @typedef {{\n';
|
|
130
|
+
headerComment += defaultPropsJsDoc;
|
|
131
|
+
if (types) {
|
|
132
|
+
headerComment += '\n' + types;
|
|
133
|
+
}
|
|
134
|
+
headerComment += `\n}} Props\n`;
|
|
135
|
+
headerComment += '\n */';
|
|
136
|
+
// Generate responsive comment
|
|
137
|
+
let responsiveComment = '/**\n';
|
|
138
|
+
responsiveComment += ' * @type {import("unframer").UnframerBreakpoint}\n';
|
|
139
|
+
responsiveComment += ' * Represents a responsive breakpoint for unframer.\n';
|
|
140
|
+
responsiveComment += ' */\n\n';
|
|
141
|
+
responsiveComment += '/**\n';
|
|
142
|
+
responsiveComment += ' * @typedef VariantsMap\n';
|
|
143
|
+
responsiveComment += " * Partial record of UnframerBreakpoint to Props.variant, with a mandatory 'base' key.\n";
|
|
144
|
+
responsiveComment += " * { [key in UnframerBreakpoint]?: Props['variant'] } & { base: Props['variant'] }\n";
|
|
145
|
+
responsiveComment += ' */\n\n';
|
|
146
|
+
responsiveComment += `/**\n * Renders ${componentName} for all breakpoints with a variants map. Variant prop is inferred per breakpoint.\n * @function\n * @param {Omit<Props, 'variant'> & {variants?: VariantsMap}} props\n * @returns {any}\n */`;
|
|
147
|
+
// Generate default export comment - use inline function type instead of referencing undefined type
|
|
148
|
+
const defaultExportComment = `/** @type {function(Props): any} */`;
|
|
149
|
+
return {
|
|
150
|
+
headerComment,
|
|
151
|
+
responsiveComment,
|
|
152
|
+
defaultExportComment,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
logger.error(e.message);
|
|
157
|
+
logger.error('cannot generate typedoc comments', e.stack);
|
|
158
|
+
return {
|
|
159
|
+
headerComment: '',
|
|
160
|
+
responsiveComment: '',
|
|
161
|
+
defaultExportComment: '',
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../src/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAsB,WAAW,EAAoB,MAAM,aAAa,CAAA;AAE/E,MAAM,UAA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,OAAO,CAAA;QAC5B,iBAAiB,IAAI,2BAA2B,CAAA;QAChD,iBAAiB,IAAI,0FAA0F,CAAA;QAC/G,iBAAiB,IAAI,sFAAsF,CAAA;QAC3G,iBAAiB,IAAI,SAAS,CAAA;QAC9B,iBAAiB,IAAI,mBAAmB,aAAa,+LAA+L,CAAA;QAEpP,mGAAmG;QACnG,MAAM,oBAAoB,GAAG,qCAAqC,CAAA;QAElE,OAAO;YACH,aAAa;YACb,iBAAiB;YACjB,oBAAoB;SACvB,CAAA;IACL,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QACvB,MAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;QACzD,OAAO;YACH,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,EAAE;YACrB,oBAAoB,EAAE,EAAE;SAC3B,CAAA;IACL,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unframer-loader.js","sourceRoot":"","sources":["../src/unframer-loader.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,IAAI,CAAC,CAAA;AAEzE,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"unframer-loader.js","sourceRoot":"","sources":["../src/unframer-loader.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,IAAI,CAAC,CAAA;AAEzE,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc;IAE5D,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QACzB,OAAO;YACH,GAAG,EAAE,WAAW,CAAC,SAAS,CAAC;YAC3B,6DAA6D;YAC7D,YAAY,EAAE,IAAI,EAAE,wDAAwD;SAC/E,CAAA;IACL,CAAC;IAED,OAAO,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;AAC7D,CAAC"}
|
package/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "3.0.
|
|
1
|
+
export declare const version = "3.0.4";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '3.0.
|
|
1
|
+
export const version = '3.0.4';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unframer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
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",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"module": "./esm/exporter.js",
|
|
30
30
|
"default": "./dist/exporter.js"
|
|
31
31
|
},
|
|
32
|
+
"./styles/*": {
|
|
33
|
+
"default": "./src/styles/*"
|
|
34
|
+
},
|
|
32
35
|
"./src/*": {
|
|
33
36
|
"default": "./src/*.ts"
|
|
34
37
|
},
|
|
@@ -51,11 +54,11 @@
|
|
|
51
54
|
"@biomejs/wasm-nodejs": "^1.9.4",
|
|
52
55
|
"async-sema": "^3.1.1",
|
|
53
56
|
"cac": "^6.7.14",
|
|
54
|
-
"esbuild": "^0.25.
|
|
57
|
+
"esbuild": "^0.25.8",
|
|
55
58
|
"esbuild-plugins-node-modules-polyfill": "^1.6.8",
|
|
56
59
|
"nanospinner": "^1.2.2",
|
|
57
60
|
"picocolors": "^1.1.1",
|
|
58
|
-
"real-framer-motion": "npm:framer-motion@^12.
|
|
61
|
+
"real-framer-motion": "npm:framer-motion@^12.23.12",
|
|
59
62
|
"spiceflow": "^1.13.2",
|
|
60
63
|
"string-dedent": "^3.0.1",
|
|
61
64
|
"undici": "^7.10.0"
|
package/src/cli.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { expect, test } from 'vitest'
|
|
2
2
|
import {
|
|
3
|
-
componentCamelCase,
|
|
4
3
|
extractTokenInfo,
|
|
5
4
|
findRelativeLinks,
|
|
6
5
|
} from './exporter.js'
|
|
6
|
+
import { componentCamelCase } from './typescript.js'
|
|
7
7
|
|
|
8
8
|
import { componentNameToPath } from './utils.js'
|
|
9
9
|
|
|
@@ -38,6 +38,13 @@ test('componentCamelCase', () => {
|
|
|
38
38
|
expect(componentCamelCase('shared/nav/framer-nav')).toMatchInlineSnapshot(
|
|
39
39
|
`"FramerNavFramerComponent"`,
|
|
40
40
|
)
|
|
41
|
+
// Test cases with spaces and special characters
|
|
42
|
+
expect(componentCamelCase('hero section')).toMatchInlineSnapshot(`"HeroSectionFramerComponent"`)
|
|
43
|
+
expect(componentCamelCase('hero-section with spaces')).toMatchInlineSnapshot(`"HeroSectionWithSpacesFramerComponent"`)
|
|
44
|
+
expect(componentCamelCase('component@#$name')).toMatchInlineSnapshot(`"ComponentNameFramerComponent"`)
|
|
45
|
+
expect(componentCamelCase('123-component')).toMatchInlineSnapshot(`"Framer123ComponentFramerComponent"`)
|
|
46
|
+
expect(componentCamelCase('component!!name??test')).toMatchInlineSnapshot(`"ComponentNameTestFramerComponent"`)
|
|
47
|
+
expect(componentCamelCase(' multiple spaces ')).toMatchInlineSnapshot(`"MultipleSpacesFramerComponent"`)
|
|
41
48
|
})
|
|
42
49
|
test('findRelativeLinks', () => {
|
|
43
50
|
expect(
|
package/src/cli.ts
CHANGED
package/src/example-code.test.ts
CHANGED
|
@@ -28,7 +28,7 @@ describe('createExampleComponentCode', () => {
|
|
|
28
28
|
|
|
29
29
|
export default function App() {
|
|
30
30
|
return (
|
|
31
|
-
<div className='flex flex-col items-center gap-3 '>
|
|
31
|
+
<div className='flex flex-col items-center gap-3 bg-[rgb(8,_8, 7)]'>
|
|
32
32
|
<NavigationFramerComponent.Responsive
|
|
33
33
|
ctaVariant={"Primary"}
|
|
34
34
|
/>
|
package/src/exporter.ts
CHANGED
|
@@ -30,6 +30,10 @@ import {
|
|
|
30
30
|
groupBy,
|
|
31
31
|
logFontsUsage,
|
|
32
32
|
} from './css.js'
|
|
33
|
+
import {
|
|
34
|
+
propControlsToTypedocComments,
|
|
35
|
+
componentCamelCase,
|
|
36
|
+
} from './typescript.js'
|
|
33
37
|
import {
|
|
34
38
|
defaultExternalPackages,
|
|
35
39
|
esbuildPluginBundleDependencies,
|
|
@@ -88,17 +92,25 @@ export async function bundle({
|
|
|
88
92
|
function getFilePaths(filePath: string, outDir: string) {
|
|
89
93
|
const baseName = path.basename(filePath)
|
|
90
94
|
const dirName = path.dirname(filePath)
|
|
95
|
+
const relativeDirname = path.relative(outDir, dirName)
|
|
96
|
+
// chunks are imported, which means they should not have the temp_ prefix or imports will fail
|
|
97
|
+
if (relativeDirname === 'chunks') {
|
|
98
|
+
return {
|
|
99
|
+
tempJsPath: path.resolve(outDir, filePath),
|
|
100
|
+
finalJsPath: path.resolve(outDir, filePath),
|
|
101
|
+
jsxPath: path.resolve(
|
|
102
|
+
outDir,
|
|
103
|
+
filePath.replace(/\.js$/, '.jsx'),
|
|
104
|
+
),
|
|
105
|
+
}
|
|
106
|
+
}
|
|
91
107
|
const tempFileName = tempJsPrefix + baseName
|
|
92
108
|
const tempFilePath = path.join(dirName, tempFileName)
|
|
93
109
|
|
|
94
110
|
return {
|
|
95
|
-
originalPath: filePath,
|
|
96
111
|
tempJsPath: path.resolve(outDir, tempFilePath),
|
|
97
112
|
finalJsPath: path.resolve(outDir, filePath),
|
|
98
113
|
jsxPath: path.resolve(outDir, filePath.replace(/\.js$/, '.jsx')),
|
|
99
|
-
tempFilePath,
|
|
100
|
-
baseName,
|
|
101
|
-
dirName,
|
|
102
114
|
}
|
|
103
115
|
}
|
|
104
116
|
|
|
@@ -363,10 +375,7 @@ export async function bundle({
|
|
|
363
375
|
`// @ts-nocheck\n` + `/* eslint-disable */\n` + doNotEditComment
|
|
364
376
|
const codeJs = prefix + file.text
|
|
365
377
|
|
|
366
|
-
logger.log(
|
|
367
|
-
`writing temp JS`,
|
|
368
|
-
path.relative(out, paths.tempFilePath),
|
|
369
|
-
)
|
|
378
|
+
logger.log(`writing temp JS`, path.relative(out, paths.tempJsPath))
|
|
370
379
|
await fs.promises.mkdir(path.dirname(paths.tempJsPath), {
|
|
371
380
|
recursive: true,
|
|
372
381
|
})
|
|
@@ -420,10 +429,13 @@ export async function bundle({
|
|
|
420
429
|
fileName: path.basename(file.path),
|
|
421
430
|
})),
|
|
422
431
|
)
|
|
432
|
+
const componentImportedName = componentCamelCase(name)
|
|
423
433
|
const typedocComments = propControlsToTypedocComments({
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
434
|
+
propertyControls: propertyControls!,
|
|
435
|
+
logger,
|
|
436
|
+
componentImportedName,
|
|
437
|
+
locales: config.locales,
|
|
438
|
+
includeLocaleTypes: true,
|
|
427
439
|
})
|
|
428
440
|
logger.log(
|
|
429
441
|
`Generated TypeDoc comments for ${name}: ${!!typedocComments.headerComment}`,
|
|
@@ -453,14 +465,11 @@ export async function bundle({
|
|
|
453
465
|
const cssString =
|
|
454
466
|
doNotEditComment +
|
|
455
467
|
'/* This css file has all the necessary styles to run all your components */\n' +
|
|
456
|
-
'
|
|
457
|
-
|
|
468
|
+
'@import "unframer/styles/reset.css";\n' +
|
|
469
|
+
'@import "unframer/styles/framer.css";\n' +
|
|
458
470
|
getStyleTokensCss(tokens || []) +
|
|
459
471
|
breakpointsStyles(breakpoints) +
|
|
460
472
|
'\n\n' +
|
|
461
|
-
combinedCSSRules
|
|
462
|
-
.map((x) => (x?.startsWith(' ') ? dedent(x) : x))
|
|
463
|
-
.join('\n') +
|
|
464
473
|
getFontsStyles(allFonts)
|
|
465
474
|
await fs.promises.writeFile(
|
|
466
475
|
path.resolve(out, 'styles.css'),
|
|
@@ -1139,160 +1148,6 @@ function safeJsonParse(text) {
|
|
|
1139
1148
|
}
|
|
1140
1149
|
}
|
|
1141
1150
|
|
|
1142
|
-
/**
|
|
1143
|
-
* Generates TypeDoc comments that will be injected into JSX files
|
|
1144
|
-
* instead of generating separate .d.ts files
|
|
1145
|
-
*/
|
|
1146
|
-
export function propControlsToTypedocComments({
|
|
1147
|
-
config,
|
|
1148
|
-
fileName,
|
|
1149
|
-
controls,
|
|
1150
|
-
}: {
|
|
1151
|
-
controls: PropertyControls
|
|
1152
|
-
fileName: string
|
|
1153
|
-
config: Config
|
|
1154
|
-
}) {
|
|
1155
|
-
try {
|
|
1156
|
-
const types = Object.entries(controls || ({} as PropertyControls))
|
|
1157
|
-
.map(([key, value]) => {
|
|
1158
|
-
if (!value) {
|
|
1159
|
-
return
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
const typescriptType = (value: ControlDescription<any>) => {
|
|
1163
|
-
value.type
|
|
1164
|
-
switch (value.type) {
|
|
1165
|
-
case ControlType.Color:
|
|
1166
|
-
return 'string'
|
|
1167
|
-
case ControlType.Boolean:
|
|
1168
|
-
return 'boolean'
|
|
1169
|
-
case ControlType.Number:
|
|
1170
|
-
return 'number'
|
|
1171
|
-
case ControlType.String:
|
|
1172
|
-
return 'string'
|
|
1173
|
-
case ControlType.Enum: {
|
|
1174
|
-
// @ts-expect-error
|
|
1175
|
-
const options = value.optionTitles || value.options
|
|
1176
|
-
return options.map((x) => `'${x}'`).join(' | ')
|
|
1177
|
-
}
|
|
1178
|
-
case ControlType.File:
|
|
1179
|
-
return 'string'
|
|
1180
|
-
case ControlType.Image:
|
|
1181
|
-
return 'string'
|
|
1182
|
-
case ControlType.ComponentInstance:
|
|
1183
|
-
return 'React.ReactNode'
|
|
1184
|
-
case ControlType.Array:
|
|
1185
|
-
// @ts-expect-error
|
|
1186
|
-
return `${typescriptType(value.control)}[]`
|
|
1187
|
-
case ControlType.Object:
|
|
1188
|
-
// @ts-expect-error
|
|
1189
|
-
return `{${Object.entries(value.controls)
|
|
1190
|
-
.map(([k, v]) => {
|
|
1191
|
-
// @ts-expect-error
|
|
1192
|
-
return `${k}: ${typescriptType(v)}`
|
|
1193
|
-
})
|
|
1194
|
-
.join(', ')}`
|
|
1195
|
-
case ControlType.Date:
|
|
1196
|
-
return 'string | Date'
|
|
1197
|
-
case ControlType.Link:
|
|
1198
|
-
return 'string'
|
|
1199
|
-
case ControlType.ResponsiveImage:
|
|
1200
|
-
return `{src: string, srcSet?: string, alt?: string}`
|
|
1201
|
-
case ControlType.FusedNumber:
|
|
1202
|
-
return 'number'
|
|
1203
|
-
case ControlType.Transition:
|
|
1204
|
-
return 'any'
|
|
1205
|
-
case ControlType.EventHandler:
|
|
1206
|
-
return 'Function'
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
let name = propCamelCaseJustLikeFramer(value.title || key || '')
|
|
1210
|
-
if (!name) {
|
|
1211
|
-
return ''
|
|
1212
|
-
}
|
|
1213
|
-
return ` * ${name}?: ${typescriptType(value)} // ${value.title || name}`
|
|
1214
|
-
})
|
|
1215
|
-
.filter(Boolean)
|
|
1216
|
-
.join('\n')
|
|
1217
|
-
|
|
1218
|
-
const componentName = componentCamelCase(fileName)
|
|
1219
|
-
|
|
1220
|
-
const defaultPropsJsDoc = [
|
|
1221
|
-
' * children?: React.ReactNode',
|
|
1222
|
-
' * locale?: Locale',
|
|
1223
|
-
' * style?: React.CSSProperties',
|
|
1224
|
-
' * className?: string',
|
|
1225
|
-
' * id?: string',
|
|
1226
|
-
' * ref?: any',
|
|
1227
|
-
' * width?: any',
|
|
1228
|
-
' * height?: any',
|
|
1229
|
-
' * layoutId?: string',
|
|
1230
|
-
].join('\n')
|
|
1231
|
-
|
|
1232
|
-
// Generate header comment with type definitions
|
|
1233
|
-
let headerComment = '/**\n'
|
|
1234
|
-
headerComment += ' * @typedef Locale\n'
|
|
1235
|
-
|
|
1236
|
-
// Generate union type from config.locales if available
|
|
1237
|
-
const localeType = (() => {
|
|
1238
|
-
if (
|
|
1239
|
-
config?.locales &&
|
|
1240
|
-
Array.isArray(config.locales) &&
|
|
1241
|
-
config.locales.length > 0
|
|
1242
|
-
) {
|
|
1243
|
-
return config.locales
|
|
1244
|
-
.map((locale) => `'${locale.slug}'`)
|
|
1245
|
-
.join(' | ')
|
|
1246
|
-
}
|
|
1247
|
-
return 'string'
|
|
1248
|
-
})()
|
|
1249
|
-
|
|
1250
|
-
headerComment += ` * ${localeType}\n`
|
|
1251
|
-
headerComment += ' */\n\n'
|
|
1252
|
-
headerComment += '/**\n'
|
|
1253
|
-
headerComment +=
|
|
1254
|
-
' * @typedef {{\n'
|
|
1255
|
-
headerComment += defaultPropsJsDoc
|
|
1256
|
-
|
|
1257
|
-
if (types) {
|
|
1258
|
-
headerComment += '\n' + types
|
|
1259
|
-
}
|
|
1260
|
-
headerComment += `\n}} Props\n`
|
|
1261
|
-
headerComment += '\n */\n\n'
|
|
1262
|
-
headerComment += '/**\n'
|
|
1263
|
-
headerComment += ' * @type {import("unframer").UnframerBreakpoint}\n'
|
|
1264
|
-
headerComment += ' * Represents a responsive breakpoint for unframer.\n'
|
|
1265
|
-
headerComment += ' */\n\n'
|
|
1266
|
-
headerComment += '/**\n'
|
|
1267
|
-
headerComment += ' * @typedef VariantsMap\n'
|
|
1268
|
-
headerComment +=
|
|
1269
|
-
" * Partial record of UnframerBreakpoint to Props.variant, with a mandatory 'base' key.\n"
|
|
1270
|
-
headerComment +=
|
|
1271
|
-
" * { [key in UnframerBreakpoint]?: Props['variant'] } & { base: Props['variant'] }\n"
|
|
1272
|
-
headerComment += ' */'
|
|
1273
|
-
|
|
1274
|
-
// Generate responsive comment
|
|
1275
|
-
const responsiveComment = `/**\n * Renders ${componentName} for all breakpoints with a variants map. Variant prop is inferred per breakpoint.\n * @function\n * @param {Omit<Props, 'variant'> & {variants?: VariantsMap}} props\n * @returns {any}\n */`
|
|
1276
|
-
|
|
1277
|
-
// Generate default export comment - use inline function type instead of referencing undefined type
|
|
1278
|
-
const defaultExportComment = `/** @type {function(Props): any} */`
|
|
1279
|
-
|
|
1280
|
-
return {
|
|
1281
|
-
headerComment,
|
|
1282
|
-
responsiveComment,
|
|
1283
|
-
defaultExportComment,
|
|
1284
|
-
}
|
|
1285
|
-
} catch (e: any) {
|
|
1286
|
-
logger.error(e.message)
|
|
1287
|
-
logger.error('cannot generate typedoc comments', e.stack)
|
|
1288
|
-
return {
|
|
1289
|
-
headerComment: '',
|
|
1290
|
-
responsiveComment: '',
|
|
1291
|
-
defaultExportComment: '',
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
1151
|
export function parsePropertyControls(code: string) {
|
|
1297
1152
|
const start = code.indexOf('addPropertyControls(')
|
|
1298
1153
|
if (start === -1) {
|
|
@@ -1407,20 +1262,6 @@ function splitOnce(str: string, separator: string) {
|
|
|
1407
1262
|
return [str.slice(0, index), str.slice(index + 1)]
|
|
1408
1263
|
}
|
|
1409
1264
|
|
|
1410
|
-
export function componentCamelCase(str: string) {
|
|
1411
|
-
str = str?.replace(/\.jsx?$/, '')
|
|
1412
|
-
if (!str) {
|
|
1413
|
-
return 'FramerComponent'
|
|
1414
|
-
}
|
|
1415
|
-
// Take last part after slashes
|
|
1416
|
-
str = str.split('/').filter(Boolean).pop() || ''
|
|
1417
|
-
str = str.replace(/-([\w])/g, (g) => g[1].toUpperCase())
|
|
1418
|
-
str = str.replace(/_([a-z])/g, (g) => g[1].toUpperCase())
|
|
1419
|
-
str = str[0].toUpperCase() + str.slice(1)
|
|
1420
|
-
str = str + 'FramerComponent'
|
|
1421
|
-
return str
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
1265
|
const breakpointVariants = ['mobile', 'tablet', 'desktop']
|
|
1425
1266
|
|
|
1426
1267
|
function getVariantsFromPropControls(propControls?: PropertyControls) {
|
|
@@ -1460,33 +1301,6 @@ function findExampleProperty(propertyControls?: PropertyControls) {
|
|
|
1460
1301
|
return propCamelCaseJustLikeFramer(stringProp[1]?.title || '')
|
|
1461
1302
|
}
|
|
1462
1303
|
|
|
1463
|
-
// these styles are global styles injected by Framer in the generated websites, without them things like icons can look weird
|
|
1464
|
-
const resetCssStyles = `
|
|
1465
|
-
|
|
1466
|
-
:root {
|
|
1467
|
-
-webkit-font-smoothing: antialiased;
|
|
1468
|
-
-moz-osx-font-smoothing: grayscale;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
* {
|
|
1472
|
-
box-sizing: border-box;
|
|
1473
|
-
-webkit-font-smoothing: inherit;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
.unframer h1, .unframer h2, .unframer h3, .unframer h4, .unframer h5, .unframer h6, .unframer p, .unframer figure {
|
|
1477
|
-
margin: 0;
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
.unframer {
|
|
1481
|
-
line-height: normal;
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
.unframer, .unframer input, .unframer textarea, .unframer select, .unframer button {
|
|
1485
|
-
font-size: 12px;
|
|
1486
|
-
font-family: sans-serif;
|
|
1487
|
-
}
|
|
1488
|
-
`
|
|
1489
|
-
|
|
1490
1304
|
async function recursiveReaddir(dir: string): Promise<string[]> {
|
|
1491
1305
|
const dirents = await fs.promises.readdir(dir, { withFileTypes: true })
|
|
1492
1306
|
const files = await Promise.all(
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./chunk-A2PMVMFI.js";
|
|
2
|
+
|
|
3
|
+
// /:https://app.framerstatic.com/fontshare-4J2ZFRBB.mjs
|
|
4
|
+
var fontshare_default = { "FS;Spline Sans": true, "FS;Satoshi": true, "FS;Epilogue": true, "FS;JetBrains Mono": true, "FS;Nippo": true, "FS;Boxing": true, "FS;Cabinet Grotesk": true, "FS;Bespoke Serif": true, "FS;Panchang": true, "FS;Sora": true, "FS;Familjen Grotesk": true, "FS;Sharpie": true, "FS;Chillax": true, "FS;Array": true, "FS;Boska": true, "FS;Clash Grotesk": true, "FS;Plus Jakarta Sans": true, "FS;Pally": true, "FS;Space Grotesk": true, "FS;Khand": true, "FS;Comico": true, "FS;Sentient": true, "FS;Plein": true, "FS;Rowan": true, "FS;Kalam": true, "FS;Stardom": true, "FS;Clash Display": true, "FS;Britney": true, "FS;Fira Sans": true, "FS;Quilon": true, "FS;Literata": true, "FS;Archivo": true, "FS;Manrope": true, "FS;Rosaline": true, "FS;Dancing Script": true, "FS;Syne": true, "FS;Outfit": true, "FS;Hind": true, "FS;Gambarino": true, "FS;Pilcrow Rounded": true, "FS;Bevellier": true, "FS;Telma": true, "FS;Supreme": true, "FS;Bespoke Slab": true, "FS;Aktura": true, "FS;Montserrat": true, "FS;Erode": true, "FS;Be Vietnam Pro": true, "FS;Melodrama": true, "FS;Pramukh Rounded": true, "FS;Bespoke Sans": true, "FS;Teko": true, "FS;Striper": true, "FS;General Sans": true, "FS;Lobster": true, "FS;Karma": true, "FS;Tabular": true, "FS;Karla": true, "FS;Tanker": true, "FS;Paquito": true, "FS;Kohinoor Zerone": true, "FS;Bespoke Stencil": true, "FS;Bebas Neue": true, "FS;Gambetta": true, "FS;Asap": true, "FS;Lora": true, "FS;Zina": true, "FS;Pencerio": true, "FS;Bonny": true, "FS;Author": true, "FS;Kola": true, "FS;Rajdhani": true, "FS;Switzer": true, "FS;Roundo": true, "FS;Red Hat Display": true, "FS;Zodiak": true, "FS;Styro": true, "FS;RX100": true, "FS;Quicksand": true, "FS;Urbanist": true, "FS;Oswald": true, "FS;Azeret Mono": true, "FS;Crimson Pro": true, "FS;Work Sans": true, "FS;Expose": true, "FS;Ranade": true, "FS;Merriweather Sans": true, "FS;Excon": true, "FS;Nunito": true, "FS;Synonym": true, "FS;Anton": true, "FS;Ballet": true, "FS;Trench Slab": true, "FS;New Title": true, "FS;Alpino": true, "FS;Halant": true, "FS;Recia": true, "FS;Kihim": true, "FS;Amulya": true, "FS;Raleway": true, "FS;Poppins": true, "FS;Stick No Bills": true, "FS;Technor": true, "FS;Chubbo": true, "FS;Segment": true, "FS;Public Sans": true, "FS;Neco": true, "FS;Rozha One": true, "FS;Tillana": true, "FS;Laila": true, "FS;Hoover": true };
|
|
5
|
+
export {
|
|
6
|
+
fontshare_default as default
|
|
7
|
+
};
|