meno-core 1.0.39 → 1.0.40
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/build-astro.ts +195 -68
- package/dist/bin/cli.js +1 -1
- package/dist/build-static.js +6 -6
- package/dist/chunks/{chunk-WK5XLASY.js → chunk-3NOZVNM4.js} +3 -3
- package/dist/chunks/{chunk-W6HDII4T.js → chunk-GKICS7CF.js} +27 -14
- package/dist/chunks/chunk-GKICS7CF.js.map +7 -0
- package/dist/chunks/{chunk-P3FX5HJM.js → chunk-LOJLO2EY.js} +1 -1
- package/dist/chunks/chunk-LOJLO2EY.js.map +7 -0
- package/dist/chunks/{chunk-HNAS6BSS.js → chunk-MOCRENNU.js} +55 -5
- package/dist/chunks/{chunk-HNAS6BSS.js.map → chunk-MOCRENNU.js.map} +3 -3
- package/dist/chunks/{chunk-NV25WXCA.js → chunk-OJ5SROQN.js} +5 -3
- package/dist/chunks/chunk-OJ5SROQN.js.map +7 -0
- package/dist/chunks/{chunk-AIXKUVNG.js → chunk-V4SVSX3X.js} +3 -3
- package/dist/chunks/{chunk-KULPBDC7.js → chunk-Z7SAOCDG.js} +5 -2
- package/dist/chunks/{chunk-KULPBDC7.js.map → chunk-Z7SAOCDG.js.map} +2 -2
- package/dist/chunks/{constants-5CRJRQNR.js → constants-L75FR445.js} +2 -2
- package/dist/entries/server-router.js +6 -6
- package/dist/lib/client/index.js +5 -5
- package/dist/lib/client/index.js.map +2 -2
- package/dist/lib/server/index.js +2007 -197
- package/dist/lib/server/index.js.map +4 -4
- package/dist/lib/shared/index.js +3 -3
- package/dist/lib/test-utils/index.js +1 -1
- package/lib/client/core/builders/embedBuilder.ts +2 -2
- package/lib/server/astro/cmsPageEmitter.ts +417 -0
- package/lib/server/astro/componentEmitter.ts +90 -5
- package/lib/server/astro/nodeToAstro.ts +830 -37
- package/lib/server/astro/pageEmitter.ts +39 -3
- package/lib/server/astro/tailwindMapper.ts +69 -8
- package/lib/server/astro/templateTransformer.ts +107 -0
- package/lib/server/index.ts +9 -0
- package/lib/server/routes/api/components.ts +62 -0
- package/lib/server/routes/api/core-routes.ts +8 -0
- package/lib/server/ssr/ssrRenderer.ts +30 -10
- package/lib/server/webflow/buildWebflow.ts +415 -0
- package/lib/server/webflow/index.ts +22 -0
- package/lib/server/webflow/nodeToWebflow.ts +423 -0
- package/lib/server/webflow/styleMapper.ts +241 -0
- package/lib/server/webflow/types.ts +196 -0
- package/lib/shared/constants.ts +2 -0
- package/lib/shared/types/components.ts +1 -0
- package/lib/shared/validation/schemas.ts +1 -0
- package/package.json +1 -1
- package/dist/chunks/chunk-NV25WXCA.js.map +0 -7
- package/dist/chunks/chunk-P3FX5HJM.js.map +0 -7
- package/dist/chunks/chunk-W6HDII4T.js.map +0 -7
- /package/dist/chunks/{chunk-WK5XLASY.js.map → chunk-3NOZVNM4.js.map} +0 -0
- /package/dist/chunks/{chunk-AIXKUVNG.js.map → chunk-V4SVSX3X.js.map} +0 -0
- /package/dist/chunks/{constants-5CRJRQNR.js.map → constants-L75FR445.js.map} +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webflow Export Types
|
|
3
|
+
* Defines the payload structure for Webflow Designer API consumption.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { CMSFieldType } from '../../shared/types/cms';
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Style Classes
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/** Webflow breakpoint identifiers */
|
|
13
|
+
export type WebflowBreakpoint = 'Desktop' | 'Tablet' | 'MobilePortrait';
|
|
14
|
+
|
|
15
|
+
/** Webflow pseudo-state identifiers */
|
|
16
|
+
export type WebflowPseudoState = 'hover' | 'focus' | 'active' | 'visited' | 'focus-visible';
|
|
17
|
+
|
|
18
|
+
/** CSS properties as a flat record */
|
|
19
|
+
export type CSSProperties = Record<string, string>;
|
|
20
|
+
|
|
21
|
+
/** A named Webflow style class with responsive + pseudo-state overrides */
|
|
22
|
+
export interface WebflowStyleClass {
|
|
23
|
+
/** Unique class name (e.g., "c-navigation-hamburger") */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Base (Desktop) CSS properties */
|
|
26
|
+
base: CSSProperties;
|
|
27
|
+
/** Breakpoint overrides */
|
|
28
|
+
breakpoints?: Partial<Record<WebflowBreakpoint, CSSProperties>>;
|
|
29
|
+
/** Pseudo-state overrides */
|
|
30
|
+
pseudoStates?: Partial<Record<WebflowPseudoState, CSSProperties>>;
|
|
31
|
+
/** Combo class parent (if this is a variant class) */
|
|
32
|
+
comboParent?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Elements
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
/** A Webflow element (DOM node) */
|
|
40
|
+
export interface WebflowElement {
|
|
41
|
+
/** HTML tag (div, section, h1, a, img, etc.) */
|
|
42
|
+
tag: string;
|
|
43
|
+
/** Primary class name applied to this element */
|
|
44
|
+
className?: string;
|
|
45
|
+
/** Additional combo class names (for StyleMapping variants) */
|
|
46
|
+
comboClasses?: string[];
|
|
47
|
+
/** Inline text content (for text nodes) */
|
|
48
|
+
textContent?: string;
|
|
49
|
+
/** Child elements */
|
|
50
|
+
children?: WebflowElement[];
|
|
51
|
+
/** HTML attributes (src, alt, href, target, etc.) */
|
|
52
|
+
attributes?: Record<string, string | number | boolean>;
|
|
53
|
+
/** Raw HTML content (for embed nodes) */
|
|
54
|
+
rawHtml?: string;
|
|
55
|
+
/** Whether this element is conditionally rendered */
|
|
56
|
+
conditional?: {
|
|
57
|
+
prop: string;
|
|
58
|
+
condition: 'truthy' | 'equals';
|
|
59
|
+
value?: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// Pages
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
|
|
67
|
+
/** A Webflow page */
|
|
68
|
+
export interface WebflowPage {
|
|
69
|
+
/** Page title */
|
|
70
|
+
title: string;
|
|
71
|
+
/** URL slug (e.g., "about", "blog/post-1") */
|
|
72
|
+
slug: string;
|
|
73
|
+
/** Meta description */
|
|
74
|
+
metaDescription?: string;
|
|
75
|
+
/** Open Graph title */
|
|
76
|
+
ogTitle?: string;
|
|
77
|
+
/** Open Graph description */
|
|
78
|
+
ogDescription?: string;
|
|
79
|
+
/** Open Graph image URL */
|
|
80
|
+
ogImage?: string;
|
|
81
|
+
/** Root elements of the page body */
|
|
82
|
+
elements: WebflowElement[];
|
|
83
|
+
/** Locale code */
|
|
84
|
+
locale?: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// CMS
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
/** Webflow CMS field type mapping */
|
|
92
|
+
export type WebflowFieldType =
|
|
93
|
+
| 'PlainText'
|
|
94
|
+
| 'RichText'
|
|
95
|
+
| 'Number'
|
|
96
|
+
| 'Switch'
|
|
97
|
+
| 'Image'
|
|
98
|
+
| 'Date'
|
|
99
|
+
| 'Option'
|
|
100
|
+
| 'File'
|
|
101
|
+
| 'Reference';
|
|
102
|
+
|
|
103
|
+
/** A field in a Webflow CMS collection */
|
|
104
|
+
export interface WebflowCMSField {
|
|
105
|
+
/** Field display name */
|
|
106
|
+
name: string;
|
|
107
|
+
/** Field slug (machine name) */
|
|
108
|
+
slug: string;
|
|
109
|
+
/** Webflow field type */
|
|
110
|
+
type: WebflowFieldType;
|
|
111
|
+
/** Whether this field is required */
|
|
112
|
+
required?: boolean;
|
|
113
|
+
/** Options for Option type fields */
|
|
114
|
+
options?: string[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A Webflow CMS collection definition */
|
|
118
|
+
export interface WebflowCMSCollection {
|
|
119
|
+
/** Collection display name */
|
|
120
|
+
name: string;
|
|
121
|
+
/** Collection slug */
|
|
122
|
+
slug: string;
|
|
123
|
+
/** URL pattern for detail pages */
|
|
124
|
+
urlPattern?: string;
|
|
125
|
+
/** Field definitions */
|
|
126
|
+
fields: WebflowCMSField[];
|
|
127
|
+
/** Collection items */
|
|
128
|
+
items: Record<string, unknown>[];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// Assets
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
/** Reference to an asset that needs uploading to Webflow */
|
|
136
|
+
export interface WebflowAssetRef {
|
|
137
|
+
/** Local file path relative to project root */
|
|
138
|
+
localPath: string;
|
|
139
|
+
/** Asset type */
|
|
140
|
+
type: 'image' | 'font' | 'video' | 'file';
|
|
141
|
+
/** File name */
|
|
142
|
+
fileName: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
// Export Payload
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
|
|
149
|
+
/** Complete Webflow export payload */
|
|
150
|
+
export interface WebflowExportPayload {
|
|
151
|
+
/** Export format version */
|
|
152
|
+
version: 1;
|
|
153
|
+
/** Timestamp of export */
|
|
154
|
+
exportedAt: string;
|
|
155
|
+
/** All pages with their element trees */
|
|
156
|
+
pages: WebflowPage[];
|
|
157
|
+
/** All style class definitions */
|
|
158
|
+
styles: WebflowStyleClass[];
|
|
159
|
+
/** CMS collection definitions (if any) */
|
|
160
|
+
cms: WebflowCMSCollection[];
|
|
161
|
+
/** Asset references (images, fonts, etc.) */
|
|
162
|
+
assets: WebflowAssetRef[];
|
|
163
|
+
/** CSS variables used in styles (for global embed) */
|
|
164
|
+
cssVariables?: Record<string, string>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// Helpers
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
/** Map Meno CMS field type → Webflow field type */
|
|
172
|
+
export function mapCMSFieldType(menoType: CMSFieldType): WebflowFieldType {
|
|
173
|
+
switch (menoType) {
|
|
174
|
+
case 'string':
|
|
175
|
+
return 'PlainText';
|
|
176
|
+
case 'text':
|
|
177
|
+
case 'rich-text':
|
|
178
|
+
return 'RichText';
|
|
179
|
+
case 'number':
|
|
180
|
+
return 'Number';
|
|
181
|
+
case 'boolean':
|
|
182
|
+
return 'Switch';
|
|
183
|
+
case 'image':
|
|
184
|
+
return 'Image';
|
|
185
|
+
case 'date':
|
|
186
|
+
return 'Date';
|
|
187
|
+
case 'select':
|
|
188
|
+
return 'Option';
|
|
189
|
+
case 'file':
|
|
190
|
+
return 'File';
|
|
191
|
+
case 'reference':
|
|
192
|
+
return 'Reference';
|
|
193
|
+
default:
|
|
194
|
+
return 'PlainText';
|
|
195
|
+
}
|
|
196
|
+
}
|
package/lib/shared/constants.ts
CHANGED
|
@@ -69,6 +69,8 @@ export const API_ROUTES = {
|
|
|
69
69
|
// Enums API routes
|
|
70
70
|
ENUMS: '/api/enums', // Get enums config
|
|
71
71
|
SAVE_ENUMS: '/api/save-enums', // Save enums config
|
|
72
|
+
// Component usage
|
|
73
|
+
COMPONENT_USAGE: '/api/component-usage', // Get component usage across project
|
|
72
74
|
} as const;
|
|
73
75
|
|
|
74
76
|
export const HMR_ROUTE = '/hmr';
|
|
@@ -69,6 +69,7 @@ export interface BasePropDefinition {
|
|
|
69
69
|
options?: readonly string[]; // Required for "select" type (inline options)
|
|
70
70
|
enumName?: string; // For "select" type: reference to project-level enum
|
|
71
71
|
accept?: string; // For "file" type: MIME pattern like "image/*", "video/*"
|
|
72
|
+
editor?: 'basic' | 'extended'; // For 'rich-text' type: which editor to use
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
/**
|
|
@@ -31,6 +31,7 @@ export const BasePropDefinitionSchema = z.object({
|
|
|
31
31
|
options: z.array(z.string()).readonly().optional(),
|
|
32
32
|
enumName: z.string().optional(), // For 'select' type: reference to project-level enum
|
|
33
33
|
accept: z.string().optional(), // For 'file' type: MIME pattern like "image/*", "video/*"
|
|
34
|
+
editor: z.enum(['basic', 'extended']).optional(), // For 'rich-text' type: which editor to use
|
|
34
35
|
}).passthrough();
|
|
35
36
|
|
|
36
37
|
/**
|