camox 0.14.2 → 0.16.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/components/AuthGate.js +6 -0
- package/dist/core/components/AddBlockControlBar.js +30 -26
- package/dist/core/components/lexical/InlineContentEditable.js +19 -15
- package/dist/core/components/lexical/InlineLexicalEditor.js +62 -42
- package/dist/core/components/lexical/SelectionBroadcaster.js +25 -21
- package/dist/core/components/lexical/SidebarLexicalEditor.js +33 -21
- package/dist/core/createBlock.js +524 -488
- package/dist/core/createLayout.js +40 -28
- package/dist/core/hooks/useFieldSelection.js +12 -8
- package/dist/core/hooks/useIsEditable.js +6 -0
- package/dist/core/hooks/useOverlayMessage.js +19 -15
- package/dist/core/lib/contentType.d.ts +8 -8
- package/dist/core/lib/contentType.js +63 -0
- package/dist/features/content/CamoxContent.js +92 -88
- package/dist/features/content/components/AssetCard.js +46 -42
- package/dist/features/content/components/AssetCardSkeleton.js +8 -4
- package/dist/features/content/components/ContentSidebar.js +8 -4
- package/dist/features/content/components/UploadDropZone.js +31 -27
- package/dist/features/content/components/UploadProgressDrawer.js +98 -90
- package/dist/features/preview/CamoxPreview.js +162 -146
- package/dist/features/preview/components/AddBlockSheet.js +105 -101
- package/dist/features/preview/components/AgentChatSheet.js +74 -21
- package/dist/features/preview/components/AssetFieldEditor.js +98 -90
- package/dist/features/preview/components/AssetLightbox.js +21 -17
- package/dist/features/preview/components/AssetPickerGrid.js +84 -80
- package/dist/features/preview/components/BlockActionsPopover.js +35 -31
- package/dist/features/preview/components/BlockErrorBoundary.js +12 -8
- package/dist/features/preview/components/CreatePageModal.js +1 -1
- package/dist/features/preview/components/DebouncedFieldEditor.js +41 -37
- package/dist/features/preview/components/EditPageModal.js +114 -98
- package/dist/features/preview/components/FieldOverlayStyles.js +8 -4
- package/dist/features/preview/components/FieldToolbar.js +95 -54
- package/dist/features/preview/components/Frame.js +50 -46
- package/dist/features/preview/components/ItemFieldsEditor.js +81 -79
- package/dist/features/preview/components/LinkFieldEditor.js +138 -134
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +105 -97
- package/dist/features/preview/components/OverlayTracker.js +19 -15
- package/dist/features/preview/components/Overlays.js +27 -23
- package/dist/features/preview/components/PageContentSheet.js +54 -4
- package/dist/features/preview/components/PageLocationFieldset.js +113 -109
- package/dist/features/preview/components/PagePicker.js +1 -1
- package/dist/features/preview/components/PageTree.js +443 -399
- package/dist/features/preview/components/PeekedBlock.js +69 -65
- package/dist/features/preview/components/PreviewPanel.js +64 -52
- package/dist/features/preview/components/PreviewSideSheet.js +25 -16
- package/dist/features/preview/components/PreviewToolbar.js +127 -123
- package/dist/features/preview/components/RepeatableItemsList.js +176 -171
- package/dist/features/preview/components/ShikiMarkdown.js +18 -14
- package/dist/features/preview/components/UnlinkAssetButton.js +74 -70
- package/dist/features/preview/components/useRepeatableItemActions.js +266 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +13 -9
- package/dist/features/provider/CamoxProvider.js +60 -52
- package/dist/features/provider/components/CamoxAppContext.js +10 -6
- package/dist/features/provider/components/CommandPalette.js +77 -69
- package/dist/features/provider/useAdminShortcuts.js +11 -7
- package/dist/features/routes/pageRoute.js +8 -4
- package/dist/features/studio/CamoxStudio.js +23 -19
- package/dist/features/studio/components/EnvironmentMenu.js +32 -28
- package/dist/features/studio/components/Navbar.js +62 -54
- package/dist/features/studio/components/ProjectMenu.js +131 -123
- package/dist/features/studio/components/UserButton.js +15 -11
- package/dist/features/studio/useTheme.js +82 -42
- package/dist/features/vite/definitionsSync.js +5 -5
- package/dist/features/vite/skillGeneration.js +43 -8
- package/dist/features/vite/vite.d.ts +1 -1
- package/dist/features/vite/vite.js +20 -2
- package/dist/hooks/use-marquee-selection.js +36 -32
- package/dist/lib/auth.js +49 -22
- package/dist/lib/normalized-data.js +55 -47
- package/dist/lib/use-project-room.js +22 -18
- package/dist/studio.css +1 -1
- package/package.json +10 -11
- package/skills/camox-block/SKILL.md +4 -0
- package/skills/camox-cli/SKILL.md +142 -0
- package/skills/camox-layout/SKILL.md +4 -0
|
@@ -12,39 +12,43 @@ import { Skeleton } from "@camox/ui/skeleton";
|
|
|
12
12
|
|
|
13
13
|
//#region src/features/studio/components/ProjectMenu.tsx
|
|
14
14
|
const Favicon = (t0) => {
|
|
15
|
-
const $ = c(
|
|
15
|
+
const $ = c(19);
|
|
16
|
+
if ($[0] !== "40bfae178d4420104da32b869316c5a2f7a1b383b1d8724af7281134abe451e3") {
|
|
17
|
+
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
18
|
+
$[0] = "40bfae178d4420104da32b869316c5a2f7a1b383b1d8724af7281134abe451e3";
|
|
19
|
+
}
|
|
16
20
|
const { size: t1 } = t0;
|
|
17
21
|
const size = t1 === void 0 ? 16 : t1;
|
|
18
22
|
const [faviconUrl, setFaviconUrl] = React.useState(null);
|
|
19
23
|
const [hasError, setHasError] = React.useState(false);
|
|
20
24
|
let t2;
|
|
21
25
|
let t3;
|
|
22
|
-
if ($[
|
|
26
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
27
|
t2 = () => {
|
|
24
28
|
setFaviconUrl(_temp());
|
|
25
29
|
};
|
|
26
30
|
t3 = [];
|
|
27
|
-
$[
|
|
28
|
-
$[
|
|
31
|
+
$[1] = t2;
|
|
32
|
+
$[2] = t3;
|
|
29
33
|
} else {
|
|
30
|
-
t2 = $[
|
|
31
|
-
t3 = $[
|
|
34
|
+
t2 = $[1];
|
|
35
|
+
t3 = $[2];
|
|
32
36
|
}
|
|
33
37
|
React.useEffect(t2, t3);
|
|
34
38
|
if (!faviconUrl || hasError) {
|
|
35
39
|
let t4;
|
|
36
|
-
if ($[
|
|
40
|
+
if ($[3] !== size) {
|
|
37
41
|
t4 = {
|
|
38
42
|
height: size,
|
|
39
43
|
width: size
|
|
40
44
|
};
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
} else t4 = $[
|
|
45
|
+
$[3] = size;
|
|
46
|
+
$[4] = t4;
|
|
47
|
+
} else t4 = $[4];
|
|
44
48
|
const t5 = size * .6;
|
|
45
49
|
const t6 = size * .6;
|
|
46
50
|
let t7;
|
|
47
|
-
if ($[
|
|
51
|
+
if ($[5] !== t5 || $[6] !== t6) {
|
|
48
52
|
t7 = /* @__PURE__ */ jsx(Globe, {
|
|
49
53
|
className: "text-muted-foreground",
|
|
50
54
|
style: {
|
|
@@ -52,94 +56,98 @@ const Favicon = (t0) => {
|
|
|
52
56
|
width: t6
|
|
53
57
|
}
|
|
54
58
|
});
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
} else t7 = $[
|
|
59
|
+
$[5] = t5;
|
|
60
|
+
$[6] = t6;
|
|
61
|
+
$[7] = t7;
|
|
62
|
+
} else t7 = $[7];
|
|
59
63
|
let t8;
|
|
60
|
-
if ($[
|
|
64
|
+
if ($[8] !== t4 || $[9] !== t7) {
|
|
61
65
|
t8 = /* @__PURE__ */ jsx("div", {
|
|
62
66
|
className: "bg-muted flex items-center justify-center rounded-full",
|
|
63
67
|
style: t4,
|
|
64
68
|
children: t7
|
|
65
69
|
});
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
} else t8 = $[
|
|
70
|
+
$[8] = t4;
|
|
71
|
+
$[9] = t7;
|
|
72
|
+
$[10] = t8;
|
|
73
|
+
} else t8 = $[10];
|
|
70
74
|
return t8;
|
|
71
75
|
}
|
|
72
76
|
let t4;
|
|
73
|
-
if ($[
|
|
77
|
+
if ($[11] !== size) {
|
|
74
78
|
t4 = {
|
|
75
79
|
height: size,
|
|
76
80
|
width: size
|
|
77
81
|
};
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
} else t4 = $[
|
|
82
|
+
$[11] = size;
|
|
83
|
+
$[12] = t4;
|
|
84
|
+
} else t4 = $[12];
|
|
81
85
|
let t5;
|
|
82
|
-
if ($[
|
|
86
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
83
87
|
t5 = () => setHasError(true);
|
|
84
|
-
$[
|
|
85
|
-
} else t5 = $[
|
|
88
|
+
$[13] = t5;
|
|
89
|
+
} else t5 = $[13];
|
|
86
90
|
let t6;
|
|
87
|
-
if ($[
|
|
91
|
+
if ($[14] !== faviconUrl) {
|
|
88
92
|
t6 = /* @__PURE__ */ jsx("img", {
|
|
89
93
|
src: faviconUrl,
|
|
90
94
|
alt: "Favicon",
|
|
91
95
|
className: "h-full w-full object-cover",
|
|
92
96
|
onError: t5
|
|
93
97
|
});
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
} else t6 = $[
|
|
98
|
+
$[14] = faviconUrl;
|
|
99
|
+
$[15] = t6;
|
|
100
|
+
} else t6 = $[15];
|
|
97
101
|
let t7;
|
|
98
|
-
if ($[
|
|
102
|
+
if ($[16] !== t4 || $[17] !== t6) {
|
|
99
103
|
t7 = /* @__PURE__ */ jsx("div", {
|
|
100
104
|
className: "bg-muted flex items-center justify-center overflow-hidden rounded-full",
|
|
101
105
|
style: t4,
|
|
102
106
|
children: t6
|
|
103
107
|
});
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
} else t7 = $[
|
|
108
|
+
$[16] = t4;
|
|
109
|
+
$[17] = t6;
|
|
110
|
+
$[18] = t7;
|
|
111
|
+
} else t7 = $[18];
|
|
108
112
|
return t7;
|
|
109
113
|
};
|
|
110
114
|
const ProjectMenu = () => {
|
|
111
|
-
const $ = c(
|
|
115
|
+
const $ = c(41);
|
|
116
|
+
if ($[0] !== "40bfae178d4420104da32b869316c5a2f7a1b383b1d8724af7281134abe451e3") {
|
|
117
|
+
for (let $i = 0; $i < 41; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
118
|
+
$[0] = "40bfae178d4420104da32b869316c5a2f7a1b383b1d8724af7281134abe451e3";
|
|
119
|
+
}
|
|
112
120
|
const authCtx = React.useContext(AuthContext);
|
|
113
121
|
let t0;
|
|
114
|
-
if ($[
|
|
122
|
+
if ($[1] !== authCtx.projectSlug) {
|
|
115
123
|
t0 = projectQueries.getBySlug(authCtx.projectSlug);
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
} else t0 = $[
|
|
124
|
+
$[1] = authCtx.projectSlug;
|
|
125
|
+
$[2] = t0;
|
|
126
|
+
} else t0 = $[2];
|
|
119
127
|
const { data: project } = useQuery(t0);
|
|
120
128
|
if (!project) {
|
|
121
129
|
let t1;
|
|
122
|
-
if ($[
|
|
130
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
131
|
t1 = /* @__PURE__ */ jsxs("div", {
|
|
124
132
|
className: "flex h-9 min-w-[150px] items-center gap-2 px-4",
|
|
125
133
|
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4 rounded-full" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3 flex-1" })]
|
|
126
134
|
});
|
|
127
|
-
$[
|
|
128
|
-
} else t1 = $[
|
|
135
|
+
$[3] = t1;
|
|
136
|
+
} else t1 = $[3];
|
|
129
137
|
return t1;
|
|
130
138
|
}
|
|
131
139
|
let t1;
|
|
132
|
-
if ($[
|
|
140
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
133
141
|
t1 = /* @__PURE__ */ jsx(Button, { variant: "ghost" });
|
|
134
|
-
$[
|
|
135
|
-
} else t1 = $[
|
|
142
|
+
$[4] = t1;
|
|
143
|
+
} else t1 = $[4];
|
|
136
144
|
let t2;
|
|
137
|
-
if ($[
|
|
145
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
138
146
|
t2 = /* @__PURE__ */ jsx(Favicon, { size: 16 });
|
|
139
|
-
$[
|
|
140
|
-
} else t2 = $[
|
|
147
|
+
$[5] = t2;
|
|
148
|
+
} else t2 = $[5];
|
|
141
149
|
let t3;
|
|
142
|
-
if ($[
|
|
150
|
+
if ($[6] !== project.name) {
|
|
143
151
|
t3 = /* @__PURE__ */ jsxs("div", {
|
|
144
152
|
className: "flex items-center gap-2",
|
|
145
153
|
children: [t2, /* @__PURE__ */ jsx("span", {
|
|
@@ -147,131 +155,131 @@ const ProjectMenu = () => {
|
|
|
147
155
|
children: project.name
|
|
148
156
|
})]
|
|
149
157
|
});
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
} else t3 = $[
|
|
158
|
+
$[6] = project.name;
|
|
159
|
+
$[7] = t3;
|
|
160
|
+
} else t3 = $[7];
|
|
153
161
|
let t4;
|
|
154
|
-
if ($[
|
|
162
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
155
163
|
t4 = /* @__PURE__ */ jsx(ChevronDown, { className: "shrink-0 opacity-50" });
|
|
156
|
-
$[
|
|
157
|
-
} else t4 = $[
|
|
164
|
+
$[8] = t4;
|
|
165
|
+
} else t4 = $[8];
|
|
158
166
|
let t5;
|
|
159
|
-
if ($[
|
|
167
|
+
if ($[9] !== t3) {
|
|
160
168
|
t5 = /* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
161
169
|
render: t1,
|
|
162
170
|
children: [t3, t4]
|
|
163
171
|
});
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
} else t5 = $[
|
|
172
|
+
$[9] = t3;
|
|
173
|
+
$[10] = t5;
|
|
174
|
+
} else t5 = $[10];
|
|
167
175
|
const t6 = authCtx ? `${authCtx.authenticationUrl}/dashboard/${project.organizationSlug}/${project.slug}/overview` : "#";
|
|
168
176
|
let t7;
|
|
169
|
-
if ($[
|
|
177
|
+
if ($[11] !== t6) {
|
|
170
178
|
t7 = /* @__PURE__ */ jsx("a", {
|
|
171
179
|
href: t6,
|
|
172
180
|
target: "_blank",
|
|
173
181
|
rel: "noopener noreferrer"
|
|
174
182
|
});
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
} else t7 = $[
|
|
183
|
+
$[11] = t6;
|
|
184
|
+
$[12] = t7;
|
|
185
|
+
} else t7 = $[12];
|
|
178
186
|
let t8;
|
|
179
|
-
if ($[
|
|
187
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
180
188
|
t8 = /* @__PURE__ */ jsx(Settings, {});
|
|
181
|
-
$[
|
|
182
|
-
} else t8 = $[
|
|
189
|
+
$[13] = t8;
|
|
190
|
+
} else t8 = $[13];
|
|
183
191
|
let t9;
|
|
184
|
-
if ($[
|
|
192
|
+
if ($[14] !== t7) {
|
|
185
193
|
t9 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
186
194
|
render: t7,
|
|
187
195
|
children: [t8, "Project settings"]
|
|
188
196
|
});
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
} else t9 = $[
|
|
197
|
+
$[14] = t7;
|
|
198
|
+
$[15] = t9;
|
|
199
|
+
} else t9 = $[15];
|
|
192
200
|
let t10;
|
|
193
|
-
if ($[
|
|
201
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
194
202
|
t10 = /* @__PURE__ */ jsx(DropdownMenuSeparator, {});
|
|
195
|
-
$[
|
|
196
|
-
} else t10 = $[
|
|
203
|
+
$[16] = t10;
|
|
204
|
+
} else t10 = $[16];
|
|
197
205
|
let t11;
|
|
198
|
-
if ($[
|
|
206
|
+
if ($[17] !== project.organizationSlug) {
|
|
199
207
|
t11 = /* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
200
208
|
className: "text-muted-foreground text-xs font-normal",
|
|
201
209
|
children: project.organizationSlug
|
|
202
210
|
});
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
} else t11 = $[
|
|
211
|
+
$[17] = project.organizationSlug;
|
|
212
|
+
$[18] = t11;
|
|
213
|
+
} else t11 = $[18];
|
|
206
214
|
const t12 = authCtx ? `${authCtx.authenticationUrl}/dashboard/${project.organizationSlug}/team` : "#";
|
|
207
215
|
let t13;
|
|
208
|
-
if ($[
|
|
216
|
+
if ($[19] !== t12) {
|
|
209
217
|
t13 = /* @__PURE__ */ jsx("a", {
|
|
210
218
|
href: t12,
|
|
211
219
|
target: "_blank",
|
|
212
220
|
rel: "noopener noreferrer"
|
|
213
221
|
});
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
} else t13 = $[
|
|
222
|
+
$[19] = t12;
|
|
223
|
+
$[20] = t13;
|
|
224
|
+
} else t13 = $[20];
|
|
217
225
|
let t14;
|
|
218
|
-
if ($[
|
|
226
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
219
227
|
t14 = /* @__PURE__ */ jsx(Users, {});
|
|
220
|
-
$[
|
|
221
|
-
} else t14 = $[
|
|
228
|
+
$[21] = t14;
|
|
229
|
+
} else t14 = $[21];
|
|
222
230
|
let t15;
|
|
223
|
-
if ($[
|
|
231
|
+
if ($[22] !== t13) {
|
|
224
232
|
t15 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
225
233
|
render: t13,
|
|
226
234
|
children: [t14, "Team members"]
|
|
227
235
|
});
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
} else t15 = $[
|
|
236
|
+
$[22] = t13;
|
|
237
|
+
$[23] = t15;
|
|
238
|
+
} else t15 = $[23];
|
|
231
239
|
const t16 = authCtx ? `${authCtx.authenticationUrl}/dashboard/${project.organizationSlug}/settings` : "#";
|
|
232
240
|
let t17;
|
|
233
|
-
if ($[
|
|
241
|
+
if ($[24] !== t16) {
|
|
234
242
|
t17 = /* @__PURE__ */ jsx("a", {
|
|
235
243
|
href: t16,
|
|
236
244
|
target: "_blank",
|
|
237
245
|
rel: "noopener noreferrer"
|
|
238
246
|
});
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
} else t17 = $[
|
|
247
|
+
$[24] = t16;
|
|
248
|
+
$[25] = t17;
|
|
249
|
+
} else t17 = $[25];
|
|
242
250
|
let t18;
|
|
243
|
-
if ($[
|
|
251
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
244
252
|
t18 = /* @__PURE__ */ jsx(Settings, { className: "h-4 w-4" });
|
|
245
|
-
$[
|
|
246
|
-
} else t18 = $[
|
|
253
|
+
$[26] = t18;
|
|
254
|
+
} else t18 = $[26];
|
|
247
255
|
let t19;
|
|
248
|
-
if ($[
|
|
256
|
+
if ($[27] !== t17) {
|
|
249
257
|
t19 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
250
258
|
render: t17,
|
|
251
259
|
children: [t18, "Team settings"]
|
|
252
260
|
});
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
} else t19 = $[
|
|
261
|
+
$[27] = t17;
|
|
262
|
+
$[28] = t19;
|
|
263
|
+
} else t19 = $[28];
|
|
256
264
|
let t20;
|
|
257
|
-
if ($[
|
|
265
|
+
if ($[29] !== t11 || $[30] !== t15 || $[31] !== t19) {
|
|
258
266
|
t20 = /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
|
|
259
267
|
t11,
|
|
260
268
|
t15,
|
|
261
269
|
t19
|
|
262
270
|
] });
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
} else t20 = $[
|
|
271
|
+
$[29] = t11;
|
|
272
|
+
$[30] = t15;
|
|
273
|
+
$[31] = t19;
|
|
274
|
+
$[32] = t20;
|
|
275
|
+
} else t20 = $[32];
|
|
268
276
|
let t21;
|
|
269
|
-
if ($[
|
|
277
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
270
278
|
t21 = /* @__PURE__ */ jsx(DropdownMenuSeparator, {});
|
|
271
|
-
$[
|
|
272
|
-
} else t21 = $[
|
|
279
|
+
$[33] = t21;
|
|
280
|
+
} else t21 = $[33];
|
|
273
281
|
let t22;
|
|
274
|
-
if ($[
|
|
282
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
275
283
|
t22 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
276
284
|
render: /* @__PURE__ */ jsx(Link, {
|
|
277
285
|
to: "https://camox.ai",
|
|
@@ -279,10 +287,10 @@ const ProjectMenu = () => {
|
|
|
279
287
|
}),
|
|
280
288
|
children: [/* @__PURE__ */ jsx(Info, { className: "h-4 w-4" }), "Powered by Camox"]
|
|
281
289
|
});
|
|
282
|
-
$[
|
|
283
|
-
} else t22 = $[
|
|
290
|
+
$[34] = t22;
|
|
291
|
+
} else t22 = $[34];
|
|
284
292
|
let t23;
|
|
285
|
-
if ($[
|
|
293
|
+
if ($[35] !== t20 || $[36] !== t9) {
|
|
286
294
|
t23 = /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
287
295
|
className: "w-72",
|
|
288
296
|
align: "start",
|
|
@@ -295,17 +303,17 @@ const ProjectMenu = () => {
|
|
|
295
303
|
t22
|
|
296
304
|
]
|
|
297
305
|
});
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
} else t23 = $[
|
|
306
|
+
$[35] = t20;
|
|
307
|
+
$[36] = t9;
|
|
308
|
+
$[37] = t23;
|
|
309
|
+
} else t23 = $[37];
|
|
302
310
|
let t24;
|
|
303
|
-
if ($[
|
|
311
|
+
if ($[38] !== t23 || $[39] !== t5) {
|
|
304
312
|
t24 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t5, t23] });
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
} else t24 = $[
|
|
313
|
+
$[38] = t23;
|
|
314
|
+
$[39] = t5;
|
|
315
|
+
$[40] = t24;
|
|
316
|
+
} else t24 = $[40];
|
|
309
317
|
return t24;
|
|
310
318
|
};
|
|
311
319
|
function _temp() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useAuthContext, useAuthState } from "../../../lib/auth.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useApplyTheme } from "../useTheme.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Button } from "@camox/ui/button";
|
|
@@ -9,31 +9,35 @@ import { Avatar, AvatarFallback, AvatarImage } from "@camox/ui/avatar";
|
|
|
9
9
|
|
|
10
10
|
//#region src/features/studio/components/UserButton.tsx
|
|
11
11
|
const UserButton = () => {
|
|
12
|
-
const $ = c(
|
|
12
|
+
const $ = c(5);
|
|
13
|
+
if ($[0] !== "97ed2ef8d3be381ca1619f023223f59b7d963b94f2c1afa998b161358220d4af") {
|
|
14
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
15
|
+
$[0] = "97ed2ef8d3be381ca1619f023223f59b7d963b94f2c1afa998b161358220d4af";
|
|
16
|
+
}
|
|
13
17
|
const { isAuthenticated, isLoading } = useAuthState();
|
|
14
|
-
const { theme, setTheme } =
|
|
18
|
+
const { theme, setTheme } = useApplyTheme();
|
|
15
19
|
if (!isAuthenticated || isLoading) {
|
|
16
20
|
let t0;
|
|
17
|
-
if ($[
|
|
21
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18
22
|
t0 = /* @__PURE__ */ jsx(Button, {
|
|
19
23
|
variant: "outline",
|
|
20
24
|
size: "icon",
|
|
21
25
|
children: /* @__PURE__ */ jsx(User, { className: "h-4 w-4" })
|
|
22
26
|
});
|
|
23
|
-
$[
|
|
24
|
-
} else t0 = $[
|
|
27
|
+
$[1] = t0;
|
|
28
|
+
} else t0 = $[1];
|
|
25
29
|
return t0;
|
|
26
30
|
}
|
|
27
31
|
let t0;
|
|
28
|
-
if ($[
|
|
32
|
+
if ($[2] !== setTheme || $[3] !== theme) {
|
|
29
33
|
t0 = /* @__PURE__ */ jsx(AuthenticatedUserButton, {
|
|
30
34
|
theme,
|
|
31
35
|
setTheme
|
|
32
36
|
});
|
|
33
|
-
$[
|
|
34
|
-
$[
|
|
35
|
-
$[
|
|
36
|
-
} else t0 = $[
|
|
37
|
+
$[2] = setTheme;
|
|
38
|
+
$[3] = theme;
|
|
39
|
+
$[4] = t0;
|
|
40
|
+
} else t0 = $[4];
|
|
37
41
|
return t0;
|
|
38
42
|
};
|
|
39
43
|
function AuthenticatedUserButton({ theme, setTheme }) {
|
|
@@ -3,13 +3,47 @@ import { c } from "react/compiler-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/features/studio/useTheme.ts
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
function readStoredTheme() {
|
|
7
|
+
if (typeof window === "undefined") return "system";
|
|
8
|
+
return localStorage.getItem("theme") || "system";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Read-only access to the studio theme. Does not mutate `<html>` or localStorage.
|
|
12
|
+
* Use this when you need the current theme value (e.g. to pass to a Toaster) but
|
|
13
|
+
* are not the owner of the studio chrome — applying the theme would bleed onto
|
|
14
|
+
* the host site.
|
|
15
|
+
*/
|
|
16
|
+
function useThemeValue() {
|
|
17
|
+
const $ = c(3);
|
|
18
|
+
if ($[0] !== "ae0cc1c225b74076fa89c4e5926593d41740805053ad02469bbe3a3cacd4b93a") {
|
|
19
|
+
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
20
|
+
$[0] = "ae0cc1c225b74076fa89c4e5926593d41740805053ad02469bbe3a3cacd4b93a";
|
|
21
|
+
}
|
|
22
|
+
const [theme] = React.useState(readStoredTheme);
|
|
23
|
+
let t0;
|
|
24
|
+
if ($[1] !== theme) {
|
|
25
|
+
t0 = { theme };
|
|
26
|
+
$[1] = theme;
|
|
27
|
+
$[2] = t0;
|
|
28
|
+
} else t0 = $[2];
|
|
29
|
+
return t0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Owns the studio theme: writes the active class onto `<html>` and persists
|
|
33
|
+
* changes to localStorage. Should only be mounted from the studio chrome —
|
|
34
|
+
* never from contexts that share `<html>` with the user's site.
|
|
35
|
+
*/
|
|
36
|
+
function useApplyTheme() {
|
|
37
|
+
const $ = c(9);
|
|
38
|
+
if ($[0] !== "ae0cc1c225b74076fa89c4e5926593d41740805053ad02469bbe3a3cacd4b93a") {
|
|
39
|
+
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
40
|
+
$[0] = "ae0cc1c225b74076fa89c4e5926593d41740805053ad02469bbe3a3cacd4b93a";
|
|
41
|
+
}
|
|
42
|
+
const [theme, setTheme] = React.useState(readStoredTheme);
|
|
43
|
+
const applyTheme = _temp;
|
|
10
44
|
let t0;
|
|
11
45
|
let t1;
|
|
12
|
-
if ($[
|
|
46
|
+
if ($[1] !== theme) {
|
|
13
47
|
t0 = () => {
|
|
14
48
|
const root_0 = window.document.documentElement;
|
|
15
49
|
root_0.classList.remove("light", "dark");
|
|
@@ -20,69 +54,75 @@ function useTheme() {
|
|
|
20
54
|
};
|
|
21
55
|
updateSystemTheme();
|
|
22
56
|
mediaQuery.addEventListener("change", updateSystemTheme);
|
|
23
|
-
return () =>
|
|
57
|
+
return () => {
|
|
58
|
+
mediaQuery.removeEventListener("change", updateSystemTheme);
|
|
59
|
+
root_0.classList.remove("light", "dark");
|
|
60
|
+
};
|
|
24
61
|
}
|
|
25
62
|
root_0.classList.add(theme);
|
|
63
|
+
return () => {
|
|
64
|
+
root_0.classList.remove("light", "dark");
|
|
65
|
+
};
|
|
26
66
|
};
|
|
27
67
|
t1 = [theme];
|
|
28
|
-
$[
|
|
29
|
-
$[
|
|
30
|
-
$[
|
|
68
|
+
$[1] = theme;
|
|
69
|
+
$[2] = t0;
|
|
70
|
+
$[3] = t1;
|
|
31
71
|
} else {
|
|
32
|
-
t0 = $[
|
|
33
|
-
t1 = $[
|
|
72
|
+
t0 = $[2];
|
|
73
|
+
t1 = $[3];
|
|
34
74
|
}
|
|
35
75
|
React.useEffect(t0, t1);
|
|
36
76
|
let t2;
|
|
37
77
|
let t3;
|
|
38
|
-
if ($[
|
|
78
|
+
if ($[4] !== theme) {
|
|
39
79
|
t2 = () => {
|
|
40
80
|
localStorage.setItem("theme", theme);
|
|
41
81
|
};
|
|
42
82
|
t3 = [theme];
|
|
43
|
-
$[
|
|
44
|
-
$[
|
|
45
|
-
$[
|
|
83
|
+
$[4] = theme;
|
|
84
|
+
$[5] = t2;
|
|
85
|
+
$[6] = t3;
|
|
46
86
|
} else {
|
|
47
|
-
t2 = $[
|
|
48
|
-
t3 = $[
|
|
87
|
+
t2 = $[5];
|
|
88
|
+
t3 = $[6];
|
|
49
89
|
}
|
|
50
90
|
React.useEffect(t2, t3);
|
|
51
91
|
let t4;
|
|
52
|
-
if ($[
|
|
92
|
+
if ($[7] !== theme) {
|
|
53
93
|
t4 = {
|
|
54
94
|
theme,
|
|
55
95
|
setTheme
|
|
56
96
|
};
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
} else t4 = $[
|
|
97
|
+
$[7] = theme;
|
|
98
|
+
$[8] = t4;
|
|
99
|
+
} else t4 = $[8];
|
|
60
100
|
return t4;
|
|
61
101
|
}
|
|
62
|
-
function
|
|
102
|
+
function _temp(themeToApply) {
|
|
63
103
|
const root = window.document.documentElement;
|
|
64
104
|
root.classList.remove("light", "dark");
|
|
65
105
|
root.classList.add(themeToApply);
|
|
66
106
|
}
|
|
67
|
-
function _temp() {
|
|
68
|
-
if (typeof window !== "undefined") return localStorage.getItem("theme") || "system";
|
|
69
|
-
return "system";
|
|
70
|
-
}
|
|
71
107
|
function useThemeActions() {
|
|
72
|
-
const $ = c(
|
|
73
|
-
|
|
108
|
+
const $ = c(5);
|
|
109
|
+
if ($[0] !== "ae0cc1c225b74076fa89c4e5926593d41740805053ad02469bbe3a3cacd4b93a") {
|
|
110
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
111
|
+
$[0] = "ae0cc1c225b74076fa89c4e5926593d41740805053ad02469bbe3a3cacd4b93a";
|
|
112
|
+
}
|
|
113
|
+
const { theme, setTheme } = useApplyTheme();
|
|
74
114
|
let t0;
|
|
75
115
|
let t1;
|
|
76
|
-
if ($[
|
|
116
|
+
if ($[1] !== setTheme || $[2] !== theme) {
|
|
77
117
|
t0 = () => {
|
|
78
118
|
const actions = [
|
|
79
119
|
{
|
|
80
120
|
id: "change-theme",
|
|
81
121
|
label: "Change theme",
|
|
82
122
|
groupLabel: "Studio",
|
|
83
|
-
checkIfAvailable:
|
|
123
|
+
checkIfAvailable: _temp2,
|
|
84
124
|
hasChildren: true,
|
|
85
|
-
execute:
|
|
125
|
+
execute: _temp3
|
|
86
126
|
},
|
|
87
127
|
{
|
|
88
128
|
id: "switch-to-light-theme",
|
|
@@ -116,28 +156,28 @@ function useThemeActions() {
|
|
|
116
156
|
return () => {
|
|
117
157
|
actionsStore.send({
|
|
118
158
|
type: "unregisterManyActions",
|
|
119
|
-
ids: actions.map(
|
|
159
|
+
ids: actions.map(_temp4)
|
|
120
160
|
});
|
|
121
161
|
};
|
|
122
162
|
};
|
|
123
163
|
t1 = [theme, setTheme];
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
164
|
+
$[1] = setTheme;
|
|
165
|
+
$[2] = theme;
|
|
166
|
+
$[3] = t0;
|
|
167
|
+
$[4] = t1;
|
|
128
168
|
} else {
|
|
129
|
-
t0 = $[
|
|
130
|
-
t1 = $[
|
|
169
|
+
t0 = $[3];
|
|
170
|
+
t1 = $[4];
|
|
131
171
|
}
|
|
132
172
|
React.useEffect(t0, t1);
|
|
133
173
|
}
|
|
134
|
-
function
|
|
174
|
+
function _temp4(a) {
|
|
135
175
|
return a.id;
|
|
136
176
|
}
|
|
137
|
-
function
|
|
138
|
-
function
|
|
177
|
+
function _temp3() {}
|
|
178
|
+
function _temp2() {
|
|
139
179
|
return true;
|
|
140
180
|
}
|
|
141
181
|
|
|
142
182
|
//#endregion
|
|
143
|
-
export {
|
|
183
|
+
export { useApplyTheme, useThemeActions, useThemeValue };
|