@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.
@@ -0,0 +1,183 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type ColorValue = {
5
+ color: string;
6
+ opacity: number;
7
+ };
8
+ type CustomFieldProps<T> = {
9
+ value: T;
10
+ onChangeAction: (value: T) => void;
11
+ disabled?: boolean;
12
+ label: string;
13
+ };
14
+
15
+ type ThemeColors = {
16
+ primary: ColorValue;
17
+ secondary: ColorValue;
18
+ accent: ColorValue;
19
+ background: ColorValue;
20
+ foreground: ColorValue;
21
+ muted: ColorValue;
22
+ };
23
+ type ThemeTypography = {
24
+ fontFamily: {
25
+ heading: string;
26
+ body: string;
27
+ };
28
+ fontSize: {
29
+ base: string;
30
+ heading: string;
31
+ };
32
+ fontWeight: {
33
+ normal: number;
34
+ heading: number;
35
+ };
36
+ };
37
+ type ThemeSpacing = {
38
+ xs: number;
39
+ sm: number;
40
+ md: number;
41
+ lg: number;
42
+ xl: number;
43
+ };
44
+ type ThemeBorders = {
45
+ radiusSmall: number;
46
+ radiusMedium: number;
47
+ radiusLarge: number;
48
+ };
49
+ type ThemeShadows = {
50
+ small: string;
51
+ medium: string;
52
+ large: string;
53
+ };
54
+ type PageTheme = {
55
+ id: string;
56
+ name: string;
57
+ colors: ThemeColors;
58
+ typography: ThemeTypography;
59
+ spacing: ThemeSpacing;
60
+ borders: ThemeBorders;
61
+ shadows: ThemeShadows;
62
+ };
63
+ type ThemeColorKey = keyof ThemeColors;
64
+ type ThemeSpacingKey = keyof ThemeSpacing;
65
+ type ThemeBorderKey = keyof ThemeBorders;
66
+ type ThemeShadowKey = keyof ThemeShadows;
67
+ type ThemeableColorValue = {
68
+ useTheme: true;
69
+ themeKey: ThemeColorKey;
70
+ } | {
71
+ useTheme: false;
72
+ value: ColorValue;
73
+ };
74
+ type ThemeableSpacingValue = {
75
+ useTheme: true;
76
+ themeKey: ThemeSpacingKey;
77
+ } | {
78
+ useTheme: false;
79
+ value: number;
80
+ };
81
+ type ThemeableBorderRadiusValue = {
82
+ useTheme: true;
83
+ themeKey: ThemeBorderKey;
84
+ } | {
85
+ useTheme: false;
86
+ value: number;
87
+ };
88
+ type ThemeableShadowValue = {
89
+ useTheme: true;
90
+ themeKey: ThemeShadowKey;
91
+ } | {
92
+ useTheme: false;
93
+ value: string;
94
+ };
95
+
96
+ type ThemeContextValue = {
97
+ theme: PageTheme;
98
+ resolveColor: (key: ThemeColorKey) => ColorValue;
99
+ resolveSpacing: (key: ThemeSpacingKey) => number;
100
+ resolveBorderRadius: (key: ThemeBorderKey) => number;
101
+ resolveShadow: (key: ThemeShadowKey) => string;
102
+ };
103
+ declare function ThemeProvider({ theme, children, }: {
104
+ theme: PageTheme | null;
105
+ children: ReactNode;
106
+ }): react_jsx_runtime.JSX.Element;
107
+ declare function useTheme(): ThemeContextValue;
108
+
109
+ declare const DEFAULT_THEME: PageTheme;
110
+
111
+ type BorderRadiusPreset = {
112
+ label: string;
113
+ value: number;
114
+ };
115
+ declare const borderRadiusScale: BorderRadiusPreset[];
116
+ declare const getClosestBorderRadiusValue: (value: number) => number;
117
+ declare const getBorderRadiusCSS: (value: number) => string;
118
+
119
+ type ColorPreset = {
120
+ label: string;
121
+ value: string;
122
+ };
123
+ declare const neutralColors: ColorPreset[];
124
+ declare const allColorPresets: ColorPreset[];
125
+
126
+ type ShadowPreset = {
127
+ label: string;
128
+ value: string;
129
+ css: string;
130
+ };
131
+ declare const shadowPresets: ShadowPreset[];
132
+ declare const getShadowCSS: (value: string) => string;
133
+
134
+ type SpacingPreset = {
135
+ label: string;
136
+ value: number;
137
+ };
138
+ declare const spacingScale: SpacingPreset[];
139
+ declare const getClosestSpacingValue: (value: number) => number;
140
+
141
+ type FontFamilyPreset = {
142
+ label: string;
143
+ value: string;
144
+ };
145
+ type FontSizePreset = {
146
+ label: string;
147
+ value: string;
148
+ css: string;
149
+ };
150
+ type FontWeightPreset = {
151
+ label: string;
152
+ value: number;
153
+ };
154
+ declare const fontFamilies: FontFamilyPreset[];
155
+ declare const fontSizes: FontSizePreset[];
156
+ declare const fontWeights: FontWeightPreset[];
157
+ declare const getFontSizeCSS: (value: string) => string;
158
+
159
+ type EntryContent = Record<string, string | number | boolean | null>;
160
+ type Entry = {
161
+ id: string;
162
+ venture_id: string;
163
+ name: string;
164
+ content: EntryContent;
165
+ created_at: string | null;
166
+ updated_at: string | null;
167
+ };
168
+ type EntryBoundValue<T> = {
169
+ useEntry: true;
170
+ entryName: string;
171
+ fieldKey: string;
172
+ } | {
173
+ useEntry: false;
174
+ value: T;
175
+ };
176
+
177
+ type ResponsiveVisibility = {
178
+ mobile: boolean;
179
+ desktop: boolean;
180
+ };
181
+ declare function ResponsiveToggleField({ value, onChangeAction, disabled, label, }: CustomFieldProps<ResponsiveVisibility>): react_jsx_runtime.JSX.Element;
182
+
183
+ export { getBorderRadiusCSS as A, type BorderRadiusPreset as B, type ColorValue as C, DEFAULT_THEME as D, type Entry as E, type FontFamilyPreset as F, getClosestBorderRadiusValue as G, getClosestSpacingValue as H, getFontSizeCSS as I, getShadowCSS as J, neutralColors as K, shadowPresets as L, spacingScale as M, useTheme as N, type PageTheme as P, type ResponsiveVisibility as R, type ShadowPreset as S, type ThemeableColorValue as T, type EntryBoundValue as a, type ThemeColorKey as b, type CustomFieldProps as c, type ColorPreset as d, type EntryContent as e, type FontSizePreset as f, type FontWeightPreset as g, ResponsiveToggleField as h, type SpacingPreset as i, type ThemeBorderKey as j, type ThemeBorders as k, type ThemeColors as l, ThemeProvider as m, type ThemeShadowKey as n, type ThemeShadows as o, type ThemeSpacing as p, type ThemeSpacingKey as q, type ThemeTypography as r, type ThemeableBorderRadiusValue as s, type ThemeableShadowValue as t, type ThemeableSpacingValue as u, allColorPresets as v, borderRadiusScale as w, fontFamilies as x, fontSizes as y, fontWeights as z };
@@ -0,0 +1,183 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type ColorValue = {
5
+ color: string;
6
+ opacity: number;
7
+ };
8
+ type CustomFieldProps<T> = {
9
+ value: T;
10
+ onChangeAction: (value: T) => void;
11
+ disabled?: boolean;
12
+ label: string;
13
+ };
14
+
15
+ type ThemeColors = {
16
+ primary: ColorValue;
17
+ secondary: ColorValue;
18
+ accent: ColorValue;
19
+ background: ColorValue;
20
+ foreground: ColorValue;
21
+ muted: ColorValue;
22
+ };
23
+ type ThemeTypography = {
24
+ fontFamily: {
25
+ heading: string;
26
+ body: string;
27
+ };
28
+ fontSize: {
29
+ base: string;
30
+ heading: string;
31
+ };
32
+ fontWeight: {
33
+ normal: number;
34
+ heading: number;
35
+ };
36
+ };
37
+ type ThemeSpacing = {
38
+ xs: number;
39
+ sm: number;
40
+ md: number;
41
+ lg: number;
42
+ xl: number;
43
+ };
44
+ type ThemeBorders = {
45
+ radiusSmall: number;
46
+ radiusMedium: number;
47
+ radiusLarge: number;
48
+ };
49
+ type ThemeShadows = {
50
+ small: string;
51
+ medium: string;
52
+ large: string;
53
+ };
54
+ type PageTheme = {
55
+ id: string;
56
+ name: string;
57
+ colors: ThemeColors;
58
+ typography: ThemeTypography;
59
+ spacing: ThemeSpacing;
60
+ borders: ThemeBorders;
61
+ shadows: ThemeShadows;
62
+ };
63
+ type ThemeColorKey = keyof ThemeColors;
64
+ type ThemeSpacingKey = keyof ThemeSpacing;
65
+ type ThemeBorderKey = keyof ThemeBorders;
66
+ type ThemeShadowKey = keyof ThemeShadows;
67
+ type ThemeableColorValue = {
68
+ useTheme: true;
69
+ themeKey: ThemeColorKey;
70
+ } | {
71
+ useTheme: false;
72
+ value: ColorValue;
73
+ };
74
+ type ThemeableSpacingValue = {
75
+ useTheme: true;
76
+ themeKey: ThemeSpacingKey;
77
+ } | {
78
+ useTheme: false;
79
+ value: number;
80
+ };
81
+ type ThemeableBorderRadiusValue = {
82
+ useTheme: true;
83
+ themeKey: ThemeBorderKey;
84
+ } | {
85
+ useTheme: false;
86
+ value: number;
87
+ };
88
+ type ThemeableShadowValue = {
89
+ useTheme: true;
90
+ themeKey: ThemeShadowKey;
91
+ } | {
92
+ useTheme: false;
93
+ value: string;
94
+ };
95
+
96
+ type ThemeContextValue = {
97
+ theme: PageTheme;
98
+ resolveColor: (key: ThemeColorKey) => ColorValue;
99
+ resolveSpacing: (key: ThemeSpacingKey) => number;
100
+ resolveBorderRadius: (key: ThemeBorderKey) => number;
101
+ resolveShadow: (key: ThemeShadowKey) => string;
102
+ };
103
+ declare function ThemeProvider({ theme, children, }: {
104
+ theme: PageTheme | null;
105
+ children: ReactNode;
106
+ }): react_jsx_runtime.JSX.Element;
107
+ declare function useTheme(): ThemeContextValue;
108
+
109
+ declare const DEFAULT_THEME: PageTheme;
110
+
111
+ type BorderRadiusPreset = {
112
+ label: string;
113
+ value: number;
114
+ };
115
+ declare const borderRadiusScale: BorderRadiusPreset[];
116
+ declare const getClosestBorderRadiusValue: (value: number) => number;
117
+ declare const getBorderRadiusCSS: (value: number) => string;
118
+
119
+ type ColorPreset = {
120
+ label: string;
121
+ value: string;
122
+ };
123
+ declare const neutralColors: ColorPreset[];
124
+ declare const allColorPresets: ColorPreset[];
125
+
126
+ type ShadowPreset = {
127
+ label: string;
128
+ value: string;
129
+ css: string;
130
+ };
131
+ declare const shadowPresets: ShadowPreset[];
132
+ declare const getShadowCSS: (value: string) => string;
133
+
134
+ type SpacingPreset = {
135
+ label: string;
136
+ value: number;
137
+ };
138
+ declare const spacingScale: SpacingPreset[];
139
+ declare const getClosestSpacingValue: (value: number) => number;
140
+
141
+ type FontFamilyPreset = {
142
+ label: string;
143
+ value: string;
144
+ };
145
+ type FontSizePreset = {
146
+ label: string;
147
+ value: string;
148
+ css: string;
149
+ };
150
+ type FontWeightPreset = {
151
+ label: string;
152
+ value: number;
153
+ };
154
+ declare const fontFamilies: FontFamilyPreset[];
155
+ declare const fontSizes: FontSizePreset[];
156
+ declare const fontWeights: FontWeightPreset[];
157
+ declare const getFontSizeCSS: (value: string) => string;
158
+
159
+ type EntryContent = Record<string, string | number | boolean | null>;
160
+ type Entry = {
161
+ id: string;
162
+ venture_id: string;
163
+ name: string;
164
+ content: EntryContent;
165
+ created_at: string | null;
166
+ updated_at: string | null;
167
+ };
168
+ type EntryBoundValue<T> = {
169
+ useEntry: true;
170
+ entryName: string;
171
+ fieldKey: string;
172
+ } | {
173
+ useEntry: false;
174
+ value: T;
175
+ };
176
+
177
+ type ResponsiveVisibility = {
178
+ mobile: boolean;
179
+ desktop: boolean;
180
+ };
181
+ declare function ResponsiveToggleField({ value, onChangeAction, disabled, label, }: CustomFieldProps<ResponsiveVisibility>): react_jsx_runtime.JSX.Element;
182
+
183
+ export { getBorderRadiusCSS as A, type BorderRadiusPreset as B, type ColorValue as C, DEFAULT_THEME as D, type Entry as E, type FontFamilyPreset as F, getClosestBorderRadiusValue as G, getClosestSpacingValue as H, getFontSizeCSS as I, getShadowCSS as J, neutralColors as K, shadowPresets as L, spacingScale as M, useTheme as N, type PageTheme as P, type ResponsiveVisibility as R, type ShadowPreset as S, type ThemeableColorValue as T, type EntryBoundValue as a, type ThemeColorKey as b, type CustomFieldProps as c, type ColorPreset as d, type EntryContent as e, type FontSizePreset as f, type FontWeightPreset as g, ResponsiveToggleField as h, type SpacingPreset as i, type ThemeBorderKey as j, type ThemeBorders as k, type ThemeColors as l, ThemeProvider as m, type ThemeShadowKey as n, type ThemeShadows as o, type ThemeSpacing as p, type ThemeSpacingKey as q, type ThemeTypography as r, type ThemeableBorderRadiusValue as s, type ThemeableShadowValue as t, type ThemeableSpacingValue as u, allColorPresets as v, borderRadiusScale as w, fontFamilies as x, fontSizes as y, fontWeights as z };