@mission-studio/puck 1.0.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/dist/ResponsiveToggleField-CVhKzDAT.d.mts +183 -0
- package/dist/ResponsiveToggleField-CVhKzDAT.d.ts +183 -0
- package/dist/chunk-OZYZPWP7.mjs +6288 -0
- package/dist/chunk-TTKY3YGP.mjs +262 -0
- package/dist/chunk-UJTTHDZA.mjs +16 -0
- package/dist/chunk-ZZF2BIMW.mjs +1799 -0
- package/dist/config-entry.d.mts +5 -0
- package/dist/config-entry.d.ts +5 -0
- package/dist/config-entry.js +9159 -0
- package/dist/config-entry.mjs +1075 -0
- package/dist/editor.d.mts +135 -0
- package/dist/editor.d.ts +135 -0
- package/dist/editor.js +7046 -0
- package/dist/editor.mjs +509 -0
- package/dist/index.d.mts +287 -0
- package/dist/index.d.ts +287 -0
- package/dist/index.js +2106 -0
- package/dist/index.mjs +82 -0
- package/dist/styles.css +2 -0
- package/package.json +97 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// entries/context.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var EntriesContext = createContext(null);
|
|
5
|
+
function EntriesProvider({
|
|
6
|
+
entries,
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
const entriesMap = new Map(entries.map((e) => [e.name, e]));
|
|
10
|
+
const contextValue = {
|
|
11
|
+
entries,
|
|
12
|
+
entryNames: entries.map((e) => e.name),
|
|
13
|
+
getEntry: (name) => entriesMap.get(name),
|
|
14
|
+
getEntryValue: (entryName, fieldKey) => {
|
|
15
|
+
const entry = entriesMap.get(entryName);
|
|
16
|
+
if (!entry) return void 0;
|
|
17
|
+
return entry.content[fieldKey];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ jsx(EntriesContext.Provider, { value: contextValue, children });
|
|
21
|
+
}
|
|
22
|
+
function useEntries() {
|
|
23
|
+
const context = useContext(EntriesContext);
|
|
24
|
+
if (!context) {
|
|
25
|
+
return {
|
|
26
|
+
entries: [],
|
|
27
|
+
entryNames: [],
|
|
28
|
+
getEntry: () => void 0,
|
|
29
|
+
getEntryValue: () => void 0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// theme/defaults.ts
|
|
36
|
+
var DEFAULT_THEME = {
|
|
37
|
+
id: "default",
|
|
38
|
+
name: "Default Theme",
|
|
39
|
+
colors: {
|
|
40
|
+
primary: { color: "#3B82F6", opacity: 100 },
|
|
41
|
+
secondary: { color: "#8B5CF6", opacity: 100 },
|
|
42
|
+
accent: { color: "#10B981", opacity: 100 },
|
|
43
|
+
background: { color: "#FFFFFF", opacity: 100 },
|
|
44
|
+
foreground: { color: "#111827", opacity: 100 },
|
|
45
|
+
muted: { color: "#F3F4F6", opacity: 100 }
|
|
46
|
+
},
|
|
47
|
+
typography: {
|
|
48
|
+
fontFamily: {
|
|
49
|
+
heading: "system-ui, sans-serif",
|
|
50
|
+
body: "system-ui, sans-serif"
|
|
51
|
+
},
|
|
52
|
+
fontSize: {
|
|
53
|
+
base: "base",
|
|
54
|
+
heading: "4xl"
|
|
55
|
+
},
|
|
56
|
+
fontWeight: {
|
|
57
|
+
normal: 400,
|
|
58
|
+
heading: 700
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
spacing: {
|
|
62
|
+
xs: 8,
|
|
63
|
+
sm: 12,
|
|
64
|
+
md: 16,
|
|
65
|
+
lg: 24,
|
|
66
|
+
xl: 32
|
|
67
|
+
},
|
|
68
|
+
borders: {
|
|
69
|
+
radiusSmall: 4,
|
|
70
|
+
radiusMedium: 8,
|
|
71
|
+
radiusLarge: 16
|
|
72
|
+
},
|
|
73
|
+
shadows: {
|
|
74
|
+
small: "sm",
|
|
75
|
+
medium: "md",
|
|
76
|
+
large: "lg"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// theme/context.tsx
|
|
81
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
82
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
83
|
+
var ThemeContext = createContext2(null);
|
|
84
|
+
function ThemeProvider({
|
|
85
|
+
theme,
|
|
86
|
+
children
|
|
87
|
+
}) {
|
|
88
|
+
const activeTheme = theme ?? DEFAULT_THEME;
|
|
89
|
+
const contextValue = {
|
|
90
|
+
theme: activeTheme,
|
|
91
|
+
resolveColor: (key) => activeTheme.colors[key],
|
|
92
|
+
resolveSpacing: (key) => activeTheme.spacing[key],
|
|
93
|
+
resolveBorderRadius: (key) => activeTheme.borders[key],
|
|
94
|
+
resolveShadow: (key) => activeTheme.shadows[key]
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ jsx2(ThemeContext.Provider, { value: contextValue, children });
|
|
97
|
+
}
|
|
98
|
+
function useTheme() {
|
|
99
|
+
const context = useContext2(ThemeContext);
|
|
100
|
+
if (!context) {
|
|
101
|
+
return {
|
|
102
|
+
theme: DEFAULT_THEME,
|
|
103
|
+
resolveColor: (key) => DEFAULT_THEME.colors[key],
|
|
104
|
+
resolveSpacing: (key) => DEFAULT_THEME.spacing[key],
|
|
105
|
+
resolveBorderRadius: (key) => DEFAULT_THEME.borders[key],
|
|
106
|
+
resolveShadow: (key) => DEFAULT_THEME.shadows[key]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return context;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// design-system/shadows.ts
|
|
113
|
+
var shadowPresets = [
|
|
114
|
+
{ label: "None", value: "none", css: "none" },
|
|
115
|
+
{ label: "XS", value: "xs", css: "0 1px 2px 0 rgb(0 0 0 / 0.05)" },
|
|
116
|
+
{
|
|
117
|
+
label: "SM",
|
|
118
|
+
value: "sm",
|
|
119
|
+
css: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
label: "MD",
|
|
123
|
+
value: "md",
|
|
124
|
+
css: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
label: "LG",
|
|
128
|
+
value: "lg",
|
|
129
|
+
css: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: "XL",
|
|
133
|
+
value: "xl",
|
|
134
|
+
css: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"
|
|
135
|
+
},
|
|
136
|
+
{ label: "2XL", value: "2xl", css: "0 25px 50px -12px rgb(0 0 0 / 0.25)" },
|
|
137
|
+
{
|
|
138
|
+
label: "Inner",
|
|
139
|
+
value: "inner",
|
|
140
|
+
css: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)"
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
var getShadowCSS = (value) => {
|
|
144
|
+
const preset = shadowPresets.find((p) => p.value === value);
|
|
145
|
+
return preset?.css ?? "none";
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// design-system/borders.ts
|
|
149
|
+
var borderRadiusScale = [
|
|
150
|
+
{ label: "None", value: 0 },
|
|
151
|
+
{ label: "XS", value: 2 },
|
|
152
|
+
{ label: "SM", value: 4 },
|
|
153
|
+
{ label: "MD", value: 6 },
|
|
154
|
+
{ label: "LG", value: 8 },
|
|
155
|
+
{ label: "XL", value: 12 },
|
|
156
|
+
{ label: "2XL", value: 16 },
|
|
157
|
+
{ label: "3XL", value: 24 }
|
|
158
|
+
];
|
|
159
|
+
var getClosestBorderRadiusValue = (value) => {
|
|
160
|
+
return borderRadiusScale.reduce(
|
|
161
|
+
(prev, curr) => Math.abs(curr.value - value) < Math.abs(prev.value - value) ? curr : prev
|
|
162
|
+
).value;
|
|
163
|
+
};
|
|
164
|
+
var getBorderRadiusCSS = (value) => {
|
|
165
|
+
return `${value}px`;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// design-system/spacing.ts
|
|
169
|
+
var spacingScale = [
|
|
170
|
+
{ label: "None", value: 0 },
|
|
171
|
+
{ label: "2XS", value: 4 },
|
|
172
|
+
{ label: "XS", value: 8 },
|
|
173
|
+
{ label: "SM", value: 12 },
|
|
174
|
+
{ label: "MD", value: 16 },
|
|
175
|
+
{ label: "LG", value: 24 },
|
|
176
|
+
{ label: "XL", value: 32 },
|
|
177
|
+
{ label: "2XL", value: 48 },
|
|
178
|
+
{ label: "3XL", value: 64 },
|
|
179
|
+
{ label: "4XL", value: 96 }
|
|
180
|
+
];
|
|
181
|
+
var getClosestSpacingValue = (value) => {
|
|
182
|
+
return spacingScale.reduce(
|
|
183
|
+
(prev, curr) => Math.abs(curr.value - value) < Math.abs(prev.value - value) ? curr : prev
|
|
184
|
+
).value;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// design-system/typography.ts
|
|
188
|
+
var fontFamilies = [
|
|
189
|
+
{ label: "System", value: "system-ui, sans-serif" },
|
|
190
|
+
{ label: "Sans", value: "ui-sans-serif, system-ui, sans-serif" },
|
|
191
|
+
{ label: "Serif", value: "ui-serif, Georgia, serif" },
|
|
192
|
+
{ label: "Mono", value: "ui-monospace, monospace" }
|
|
193
|
+
];
|
|
194
|
+
var fontSizes = [
|
|
195
|
+
{ label: "XS", value: "xs", css: "0.75rem" },
|
|
196
|
+
{ label: "SM", value: "sm", css: "0.875rem" },
|
|
197
|
+
{ label: "Base", value: "base", css: "1rem" },
|
|
198
|
+
{ label: "LG", value: "lg", css: "1.125rem" },
|
|
199
|
+
{ label: "XL", value: "xl", css: "1.25rem" },
|
|
200
|
+
{ label: "2XL", value: "2xl", css: "1.5rem" },
|
|
201
|
+
{ label: "3XL", value: "3xl", css: "1.875rem" },
|
|
202
|
+
{ label: "4XL", value: "4xl", css: "2.25rem" },
|
|
203
|
+
{ label: "5XL", value: "5xl", css: "3rem" }
|
|
204
|
+
];
|
|
205
|
+
var fontWeights = [
|
|
206
|
+
{ label: "Light", value: 300 },
|
|
207
|
+
{ label: "Normal", value: 400 },
|
|
208
|
+
{ label: "Medium", value: 500 },
|
|
209
|
+
{ label: "Semibold", value: 600 },
|
|
210
|
+
{ label: "Bold", value: 700 }
|
|
211
|
+
];
|
|
212
|
+
var getFontSizeCSS = (value) => {
|
|
213
|
+
const preset = fontSizes.find((p) => p.value === value);
|
|
214
|
+
return preset?.css ?? "1rem";
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// utils/index.ts
|
|
218
|
+
import { twMerge } from "tailwind-merge";
|
|
219
|
+
import { clsx } from "clsx";
|
|
220
|
+
function isValidHex(color) {
|
|
221
|
+
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(color);
|
|
222
|
+
}
|
|
223
|
+
function hexToRgba(hex, opacity) {
|
|
224
|
+
const sanitized = hex.replace("#", "");
|
|
225
|
+
const r = parseInt(sanitized.slice(0, 2), 16);
|
|
226
|
+
const g = parseInt(sanitized.slice(2, 4), 16);
|
|
227
|
+
const b = parseInt(sanitized.slice(4, 6), 16);
|
|
228
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity / 100})`;
|
|
229
|
+
}
|
|
230
|
+
function normalizeHex(hex) {
|
|
231
|
+
const sanitized = hex.replace("#", "").toUpperCase();
|
|
232
|
+
if (sanitized.length === 3) {
|
|
233
|
+
return `#${sanitized[0]}${sanitized[0]}${sanitized[1]}${sanitized[1]}${sanitized[2]}${sanitized[2]}`;
|
|
234
|
+
}
|
|
235
|
+
return `#${sanitized}`;
|
|
236
|
+
}
|
|
237
|
+
function cn(...inputs) {
|
|
238
|
+
return twMerge(clsx(inputs));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export {
|
|
242
|
+
EntriesProvider,
|
|
243
|
+
useEntries,
|
|
244
|
+
DEFAULT_THEME,
|
|
245
|
+
ThemeProvider,
|
|
246
|
+
useTheme,
|
|
247
|
+
isValidHex,
|
|
248
|
+
hexToRgba,
|
|
249
|
+
normalizeHex,
|
|
250
|
+
cn,
|
|
251
|
+
shadowPresets,
|
|
252
|
+
getShadowCSS,
|
|
253
|
+
borderRadiusScale,
|
|
254
|
+
getClosestBorderRadiusValue,
|
|
255
|
+
getBorderRadiusCSS,
|
|
256
|
+
spacingScale,
|
|
257
|
+
getClosestSpacingValue,
|
|
258
|
+
fontFamilies,
|
|
259
|
+
fontSizes,
|
|
260
|
+
fontWeights,
|
|
261
|
+
getFontSizeCSS
|
|
262
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// design-system/colors.ts
|
|
2
|
+
var neutralColors = [
|
|
3
|
+
{ label: "White", value: "#FFFFFF" },
|
|
4
|
+
{ label: "Gray 100", value: "#F3F4F6" },
|
|
5
|
+
{ label: "Gray 300", value: "#D1D5DB" },
|
|
6
|
+
{ label: "Gray 500", value: "#6B7280" },
|
|
7
|
+
{ label: "Gray 700", value: "#374151" },
|
|
8
|
+
{ label: "Gray 900", value: "#111827" },
|
|
9
|
+
{ label: "Black", value: "#000000" }
|
|
10
|
+
];
|
|
11
|
+
var allColorPresets = [...neutralColors];
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
neutralColors,
|
|
15
|
+
allColorPresets
|
|
16
|
+
};
|