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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createServerApiClient } from "../../lib/api-client-server.js";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { createServer, isRunnableDevEnvironment } from "vite";
|
|
3
|
+
import { createServer, isRunnableDevEnvironment } from "vite-plus";
|
|
4
4
|
|
|
5
5
|
//#region src/features/vite/definitionsSync.ts
|
|
6
6
|
const SYNC_DEBOUNCE_DELAY_MS = 100;
|
|
@@ -199,7 +199,7 @@ async function syncDefinitions(server, options) {
|
|
|
199
199
|
try {
|
|
200
200
|
await performInitialSync();
|
|
201
201
|
} catch (error) {
|
|
202
|
-
server.config.logger.error(`[camox] Failed to sync block definitions: ${error}`, { timestamp: true });
|
|
202
|
+
server.config.logger.error(`[camox] Failed to sync block definitions: ${String(error)}`, { timestamp: true });
|
|
203
203
|
}
|
|
204
204
|
const debounceTimers = /* @__PURE__ */ new Map();
|
|
205
205
|
const layoutsDir = path.resolve(server.config.root, "src/camox/layouts");
|
|
@@ -218,7 +218,7 @@ async function syncDefinitions(server, options) {
|
|
|
218
218
|
try {
|
|
219
219
|
await upsertBlock(filePath);
|
|
220
220
|
} catch (error) {
|
|
221
|
-
server.config.logger.error(`[camox] Failed to sync block: ${error}`, { timestamp: true });
|
|
221
|
+
server.config.logger.error(`[camox] Failed to sync block: ${String(error)}`, { timestamp: true });
|
|
222
222
|
}
|
|
223
223
|
}, SYNC_DEBOUNCE_DELAY_MS));
|
|
224
224
|
};
|
|
@@ -233,7 +233,7 @@ async function syncDefinitions(server, options) {
|
|
|
233
233
|
try {
|
|
234
234
|
await deleteBlock(filePath);
|
|
235
235
|
} catch (error) {
|
|
236
|
-
server.config.logger.error(`[camox] Failed to delete block: ${error}`, { timestamp: true });
|
|
236
|
+
server.config.logger.error(`[camox] Failed to delete block: ${String(error)}`, { timestamp: true });
|
|
237
237
|
}
|
|
238
238
|
}, SYNC_DEBOUNCE_DELAY_MS);
|
|
239
239
|
};
|
|
@@ -249,7 +249,7 @@ async function syncDefinitions(server, options) {
|
|
|
249
249
|
try {
|
|
250
250
|
await performInitialSync();
|
|
251
251
|
} catch (error) {
|
|
252
|
-
server.config.logger.error(`[camox] Failed to sync layouts: ${error}`, { timestamp: true });
|
|
252
|
+
server.config.logger.error(`[camox] Failed to sync layouts: ${String(error)}`, { timestamp: true });
|
|
253
253
|
}
|
|
254
254
|
}, SYNC_DEBOUNCE_DELAY_MS);
|
|
255
255
|
};
|
|
@@ -1,26 +1,61 @@
|
|
|
1
1
|
import { writeIfChanged } from "./utils.js";
|
|
2
|
-
import { lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, symlinkSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, symlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
6
|
//#region src/features/vite/skillGeneration.ts
|
|
7
|
-
const
|
|
7
|
+
const NOTICE = `<!-- AUTO-GENERATED BY CAMOX — DO NOT EDIT
|
|
8
8
|
This file is managed by the Camox Vite plugin.
|
|
9
|
-
Any manual edits will be automatically reverted by the dev server.
|
|
10
|
-
|
|
11
|
-
`;
|
|
9
|
+
Any manual edits will be automatically reverted by the dev server. -->`;
|
|
10
|
+
function injectNoticeAfterFrontmatter(source) {
|
|
11
|
+
if (!source.startsWith("---\n")) return `${NOTICE}\n\n${source}`;
|
|
12
|
+
const closeIdx = source.indexOf("\n---\n", 4);
|
|
13
|
+
if (closeIdx === -1) return `${NOTICE}\n\n${source}`;
|
|
14
|
+
const endOfClose = closeIdx + 5;
|
|
15
|
+
return `${source.slice(0, endOfClose)}\n${NOTICE}\n${source.slice(endOfClose)}`;
|
|
16
|
+
}
|
|
12
17
|
const sdkRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
|
|
18
|
+
const camoxCmdByPm = {
|
|
19
|
+
pnpm: "pnpm camox",
|
|
20
|
+
yarn: "yarn camox",
|
|
21
|
+
bun: "bunx camox",
|
|
22
|
+
npm: "npx camox"
|
|
23
|
+
};
|
|
24
|
+
function detectPackageManagerInDir(dir) {
|
|
25
|
+
const packageJsonPath = resolve(dir, "package.json");
|
|
26
|
+
if (existsSync(packageJsonPath)) try {
|
|
27
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
28
|
+
const name = (typeof pkg.packageManager === "string" ? pkg.packageManager : "").split("@", 1)[0];
|
|
29
|
+
if (name === "pnpm" || name === "yarn" || name === "bun" || name === "npm") return name;
|
|
30
|
+
} catch {}
|
|
31
|
+
if (existsSync(resolve(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
32
|
+
if (existsSync(resolve(dir, "bun.lock")) || existsSync(resolve(dir, "bun.lockb"))) return "bun";
|
|
33
|
+
if (existsSync(resolve(dir, "yarn.lock"))) return "yarn";
|
|
34
|
+
if (existsSync(resolve(dir, "package-lock.json"))) return "npm";
|
|
35
|
+
}
|
|
36
|
+
function detectPackageManager(appRoot) {
|
|
37
|
+
let dir = resolve(appRoot);
|
|
38
|
+
while (true) {
|
|
39
|
+
const found = detectPackageManagerInDir(dir);
|
|
40
|
+
if (found) return found;
|
|
41
|
+
const parent = dirname(dir);
|
|
42
|
+
if (parent === dir) return "npm";
|
|
43
|
+
dir = parent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
13
46
|
function getSkillNames() {
|
|
14
47
|
const skillsDir = resolve(sdkRoot, "skills");
|
|
15
48
|
return readdirSync(skillsDir).filter((name) => lstatSync(resolve(skillsDir, name)).isDirectory());
|
|
16
49
|
}
|
|
17
|
-
function generateSkillContent(skillName) {
|
|
18
|
-
|
|
50
|
+
function generateSkillContent(skillName, appRoot) {
|
|
51
|
+
const raw = readFileSync(resolve(sdkRoot, `skills/${skillName}/SKILL.md`), "utf-8");
|
|
52
|
+
const pm = detectPackageManager(appRoot);
|
|
53
|
+
return injectNoticeAfterFrontmatter(raw.replaceAll("{{PM_NAME}}", pm).replaceAll("{{CAMOX_CMD}}", camoxCmdByPm[pm]));
|
|
19
54
|
}
|
|
20
55
|
function getSkillFileEntries(appRoot) {
|
|
21
56
|
return getSkillNames().map((name) => ({
|
|
22
57
|
path: resolve(appRoot, `.agents/skills/${name}/SKILL.md`),
|
|
23
|
-
content: generateSkillContent(name)
|
|
58
|
+
content: generateSkillContent(name, appRoot)
|
|
24
59
|
}));
|
|
25
60
|
}
|
|
26
61
|
function generateSkillFiles(appRoot) {
|
|
@@ -3,11 +3,11 @@ import { watchNewBlockFiles } from "./blockBoilerplate.js";
|
|
|
3
3
|
import { syncDefinitions, syncDefinitionsToApi } from "./definitionsSync.js";
|
|
4
4
|
import { generateRouteFiles, watchRouteFiles } from "./routeGeneration.js";
|
|
5
5
|
import { generateSkillFiles, watchSkillFiles } from "./skillGeneration.js";
|
|
6
|
-
import { readFileSync } from "node:fs";
|
|
6
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import { dirname, join, resolve } from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
-
import { createServer } from "vite";
|
|
10
|
+
import { createServer } from "vite-plus";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
//#region src/features/vite/vite.ts
|
|
@@ -35,6 +35,18 @@ function readAuthEmail(authenticationUrl) {
|
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Drop a sidecar at `<root>/node_modules/.camox/runtime.json` so the `camox`
|
|
40
|
+
* CLI can pick up the same projectSlug / apiUrl / authenticationUrl /
|
|
41
|
+
* environmentName the plugin actually used. The CLI treats the vite config
|
|
42
|
+
* as the source of truth — there is no other reliable way to recover these
|
|
43
|
+
* values from outside vite.
|
|
44
|
+
*/
|
|
45
|
+
function writeRuntimeSidecar(root, data) {
|
|
46
|
+
const dir = join(root, "node_modules", ".camox");
|
|
47
|
+
mkdirSync(dir, { recursive: true });
|
|
48
|
+
writeFileSync(join(dir, "runtime.json"), `${JSON.stringify(data, null, 2)}\n`);
|
|
49
|
+
}
|
|
38
50
|
function resolveEnvironmentName(command, authenticationUrl) {
|
|
39
51
|
if (command === "serve") {
|
|
40
52
|
const email = readAuthEmail(authenticationUrl);
|
|
@@ -144,6 +156,12 @@ function camox(options) {
|
|
|
144
156
|
configResolved(config) {
|
|
145
157
|
resolvedConfig = config;
|
|
146
158
|
const routesDir = resolve(config.root, "src/routes");
|
|
159
|
+
writeRuntimeSidecar(config.root, {
|
|
160
|
+
projectSlug: options.projectSlug,
|
|
161
|
+
apiUrl,
|
|
162
|
+
authenticationUrl,
|
|
163
|
+
environmentName
|
|
164
|
+
});
|
|
147
165
|
if (!disableCodeGen) {
|
|
148
166
|
generateAppFile(config.root);
|
|
149
167
|
generateRouteFiles({
|
|
@@ -4,12 +4,16 @@ import { useRef, useState } from "react";
|
|
|
4
4
|
//#region src/hooks/use-marquee-selection.ts
|
|
5
5
|
const DRAG_THRESHOLD = 5;
|
|
6
6
|
function useMarqueeSelection(containerRef, onSelectionChange) {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(18);
|
|
8
|
+
if ($[0] !== "d6476ded33fc0bb3f0404905feeb866445a4281802c5c1350a0c10252b9e0e06") {
|
|
9
|
+
for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
10
|
+
$[0] = "d6476ded33fc0bb3f0404905feeb866445a4281802c5c1350a0c10252b9e0e06";
|
|
11
|
+
}
|
|
8
12
|
const [selectionRect, setSelectionRect] = useState(null);
|
|
9
13
|
const startPoint = useRef(null);
|
|
10
14
|
const isDragging = useRef(false);
|
|
11
15
|
let t0;
|
|
12
|
-
if ($[
|
|
16
|
+
if ($[1] !== containerRef) {
|
|
13
17
|
t0 = (e) => {
|
|
14
18
|
const container = containerRef.current;
|
|
15
19
|
if (!container) return null;
|
|
@@ -19,13 +23,13 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
|
|
|
19
23
|
y: e.clientY - bounds.top + container.scrollTop
|
|
20
24
|
};
|
|
21
25
|
};
|
|
22
|
-
$[
|
|
23
|
-
$[
|
|
24
|
-
} else t0 = $[
|
|
26
|
+
$[1] = containerRef;
|
|
27
|
+
$[2] = t0;
|
|
28
|
+
} else t0 = $[2];
|
|
25
29
|
const getContainerRelativePoint = t0;
|
|
26
30
|
const computeRect = _temp;
|
|
27
31
|
let t1;
|
|
28
|
-
if ($[
|
|
32
|
+
if ($[3] !== containerRef) {
|
|
29
33
|
t1 = (rect) => {
|
|
30
34
|
const container_0 = containerRef.current;
|
|
31
35
|
if (!container_0) return /* @__PURE__ */ new Set();
|
|
@@ -46,12 +50,12 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
|
|
|
46
50
|
}
|
|
47
51
|
return ids;
|
|
48
52
|
};
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
} else t1 = $[
|
|
53
|
+
$[3] = containerRef;
|
|
54
|
+
$[4] = t1;
|
|
55
|
+
} else t1 = $[4];
|
|
52
56
|
const findIntersectingIds = t1;
|
|
53
57
|
let t2;
|
|
54
|
-
if ($[
|
|
58
|
+
if ($[5] !== getContainerRelativePoint) {
|
|
55
59
|
t2 = (e_0) => {
|
|
56
60
|
if (e_0.button !== 0) return;
|
|
57
61
|
if (e_0.target.closest("[data-asset-id]")) return;
|
|
@@ -61,12 +65,12 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
|
|
|
61
65
|
isDragging.current = false;
|
|
62
66
|
e_0.currentTarget.setPointerCapture(e_0.pointerId);
|
|
63
67
|
};
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
} else t2 = $[
|
|
68
|
+
$[5] = getContainerRelativePoint;
|
|
69
|
+
$[6] = t2;
|
|
70
|
+
} else t2 = $[6];
|
|
67
71
|
const onPointerDown = t2;
|
|
68
72
|
let t3;
|
|
69
|
-
if ($[
|
|
73
|
+
if ($[7] !== findIntersectingIds || $[8] !== getContainerRelativePoint || $[9] !== onSelectionChange) {
|
|
70
74
|
t3 = (e_1) => {
|
|
71
75
|
if (!startPoint.current) return;
|
|
72
76
|
const point_0 = getContainerRelativePoint(e_1);
|
|
@@ -81,15 +85,15 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
|
|
|
81
85
|
setSelectionRect(rect_0);
|
|
82
86
|
onSelectionChange(findIntersectingIds(rect_0));
|
|
83
87
|
};
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
} else t3 = $[
|
|
88
|
+
$[7] = findIntersectingIds;
|
|
89
|
+
$[8] = getContainerRelativePoint;
|
|
90
|
+
$[9] = onSelectionChange;
|
|
91
|
+
$[10] = t3;
|
|
92
|
+
} else t3 = $[10];
|
|
89
93
|
const onPointerMove = t3;
|
|
90
94
|
const didDrag = useRef(false);
|
|
91
95
|
let t4;
|
|
92
|
-
if ($[
|
|
96
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
93
97
|
t4 = (e_2) => {
|
|
94
98
|
if (!startPoint.current) return;
|
|
95
99
|
e_2.currentTarget.releasePointerCapture(e_2.pointerId);
|
|
@@ -98,31 +102,31 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
|
|
|
98
102
|
isDragging.current = false;
|
|
99
103
|
setSelectionRect(null);
|
|
100
104
|
};
|
|
101
|
-
$[
|
|
102
|
-
} else t4 = $[
|
|
105
|
+
$[11] = t4;
|
|
106
|
+
} else t4 = $[11];
|
|
103
107
|
const onPointerUp = t4;
|
|
104
108
|
let t5;
|
|
105
|
-
if ($[
|
|
109
|
+
if ($[12] !== onPointerDown || $[13] !== onPointerMove) {
|
|
106
110
|
t5 = {
|
|
107
111
|
onPointerDown,
|
|
108
112
|
onPointerMove,
|
|
109
113
|
onPointerUp
|
|
110
114
|
};
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
} else t5 = $[
|
|
115
|
+
$[12] = onPointerDown;
|
|
116
|
+
$[13] = onPointerMove;
|
|
117
|
+
$[14] = t5;
|
|
118
|
+
} else t5 = $[14];
|
|
115
119
|
let t6;
|
|
116
|
-
if ($[
|
|
120
|
+
if ($[15] !== selectionRect || $[16] !== t5) {
|
|
117
121
|
t6 = {
|
|
118
122
|
selectionRect,
|
|
119
123
|
didDragRef: didDrag,
|
|
120
124
|
handlers: t5
|
|
121
125
|
};
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
} else t6 = $[
|
|
126
|
+
$[15] = selectionRect;
|
|
127
|
+
$[16] = t5;
|
|
128
|
+
$[17] = t6;
|
|
129
|
+
} else t6 = $[17];
|
|
126
130
|
return t6;
|
|
127
131
|
}
|
|
128
132
|
function _temp(a, b) {
|
package/dist/lib/auth.js
CHANGED
|
@@ -163,11 +163,15 @@ function createCamoxAuthClient(apiUrl) {
|
|
|
163
163
|
* Returns `true` once processing is complete (or if there was no OTT).
|
|
164
164
|
*/
|
|
165
165
|
function useProcessOtt(authClient) {
|
|
166
|
-
const $ = c(
|
|
166
|
+
const $ = c(5);
|
|
167
|
+
if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
|
|
168
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
169
|
+
$[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
|
|
170
|
+
}
|
|
167
171
|
const [ready, setReady] = React.useState(_temp);
|
|
168
172
|
let t0;
|
|
169
173
|
let t1;
|
|
170
|
-
if ($[
|
|
174
|
+
if ($[1] !== authClient || $[2] !== ready) {
|
|
171
175
|
t0 = () => {
|
|
172
176
|
if (ready) return;
|
|
173
177
|
const url = new URL(window.location.href);
|
|
@@ -181,19 +185,19 @@ function useProcessOtt(authClient) {
|
|
|
181
185
|
(async () => {
|
|
182
186
|
try {
|
|
183
187
|
await authClient.oneTimeToken.verify({ token: ott });
|
|
184
|
-
authClient.updateSession();
|
|
188
|
+
await authClient.updateSession();
|
|
185
189
|
} catch {}
|
|
186
190
|
setReady(true);
|
|
187
191
|
})();
|
|
188
192
|
};
|
|
189
193
|
t1 = [authClient, ready];
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
+
$[1] = authClient;
|
|
195
|
+
$[2] = ready;
|
|
196
|
+
$[3] = t0;
|
|
197
|
+
$[4] = t1;
|
|
194
198
|
} else {
|
|
195
|
-
t0 = $[
|
|
196
|
-
t1 = $[
|
|
199
|
+
t0 = $[3];
|
|
200
|
+
t1 = $[4];
|
|
197
201
|
}
|
|
198
202
|
React.useEffect(t0, t1);
|
|
199
203
|
return ready;
|
|
@@ -204,11 +208,21 @@ function _temp() {
|
|
|
204
208
|
}
|
|
205
209
|
const AuthContext = React.createContext(null);
|
|
206
210
|
function useAuthContext() {
|
|
211
|
+
const $ = c(1);
|
|
212
|
+
if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
|
|
213
|
+
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
214
|
+
$[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
|
|
215
|
+
}
|
|
207
216
|
const ctx = React.useContext(AuthContext);
|
|
208
217
|
if (!ctx) throw new Error("Missing CamoxProvider");
|
|
209
218
|
return ctx;
|
|
210
219
|
}
|
|
211
220
|
function useProjectSlug() {
|
|
221
|
+
const $ = c(1);
|
|
222
|
+
if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
|
|
223
|
+
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
224
|
+
$[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
|
|
225
|
+
}
|
|
212
226
|
return useAuthContext().projectSlug;
|
|
213
227
|
}
|
|
214
228
|
function useAuthState() {
|
|
@@ -220,34 +234,47 @@ function useAuthState() {
|
|
|
220
234
|
};
|
|
221
235
|
}
|
|
222
236
|
function useIsAuthenticated() {
|
|
237
|
+
const $ = c(1);
|
|
238
|
+
if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
|
|
239
|
+
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
240
|
+
$[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
|
|
241
|
+
}
|
|
223
242
|
const { isAuthenticated } = useAuthState();
|
|
224
243
|
return isAuthenticated;
|
|
225
244
|
}
|
|
226
245
|
function useSignInRedirect() {
|
|
227
|
-
const $ = c(
|
|
246
|
+
const $ = c(3);
|
|
247
|
+
if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
|
|
248
|
+
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
249
|
+
$[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
|
|
250
|
+
}
|
|
228
251
|
const { authenticationUrl } = useAuthContext();
|
|
229
252
|
let t0;
|
|
230
|
-
if ($[
|
|
253
|
+
if ($[1] !== authenticationUrl) {
|
|
231
254
|
t0 = () => {
|
|
232
255
|
if (typeof window !== "undefined") {
|
|
233
256
|
const callback = encodeURIComponent(window.location.href);
|
|
234
257
|
window.location.href = `${authenticationUrl}/studio-authorize?callback=${callback}`;
|
|
235
258
|
}
|
|
236
259
|
};
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
} else t0 = $[
|
|
260
|
+
$[1] = authenticationUrl;
|
|
261
|
+
$[2] = t0;
|
|
262
|
+
} else t0 = $[2];
|
|
240
263
|
return t0;
|
|
241
264
|
}
|
|
242
265
|
/**
|
|
243
266
|
* Registers sign-out and manage-account actions in the command palette.
|
|
244
267
|
*/
|
|
245
268
|
function useAuthActions() {
|
|
246
|
-
const $ = c(
|
|
269
|
+
const $ = c(5);
|
|
270
|
+
if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
|
|
271
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
272
|
+
$[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
|
|
273
|
+
}
|
|
247
274
|
const { authClient, authenticationUrl } = useAuthContext();
|
|
248
275
|
let t0;
|
|
249
276
|
let t1;
|
|
250
|
-
if ($[
|
|
277
|
+
if ($[1] !== authClient || $[2] !== authenticationUrl) {
|
|
251
278
|
t0 = () => {
|
|
252
279
|
actionsStore.send({
|
|
253
280
|
type: "registerManyActions",
|
|
@@ -270,13 +297,13 @@ function useAuthActions() {
|
|
|
270
297
|
return _temp4;
|
|
271
298
|
};
|
|
272
299
|
t1 = [authClient, authenticationUrl];
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
300
|
+
$[1] = authClient;
|
|
301
|
+
$[2] = authenticationUrl;
|
|
302
|
+
$[3] = t0;
|
|
303
|
+
$[4] = t1;
|
|
277
304
|
} else {
|
|
278
|
-
t0 = $[
|
|
279
|
-
t1 = $[
|
|
305
|
+
t0 = $[3];
|
|
306
|
+
t1 = $[4];
|
|
280
307
|
}
|
|
281
308
|
React.useEffect(t0, t1);
|
|
282
309
|
}
|
|
@@ -10,44 +10,48 @@ const NormalizedDataContext = React.createContext({
|
|
|
10
10
|
itemsMap: /* @__PURE__ */ new Map()
|
|
11
11
|
});
|
|
12
12
|
const NormalizedDataProvider = (t0) => {
|
|
13
|
-
const $ = c(
|
|
13
|
+
const $ = c(13);
|
|
14
|
+
if ($[0] !== "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58") {
|
|
15
|
+
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
|
+
$[0] = "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58";
|
|
17
|
+
}
|
|
14
18
|
const { files, repeatableItems, children } = t0;
|
|
15
19
|
let t1;
|
|
16
|
-
if ($[
|
|
20
|
+
if ($[1] !== files) {
|
|
17
21
|
t1 = new Map(files.map(_temp));
|
|
18
|
-
$[
|
|
19
|
-
$[
|
|
20
|
-
} else t1 = $[
|
|
22
|
+
$[1] = files;
|
|
23
|
+
$[2] = t1;
|
|
24
|
+
} else t1 = $[2];
|
|
21
25
|
let t2;
|
|
22
|
-
if ($[
|
|
26
|
+
if ($[3] !== repeatableItems) {
|
|
23
27
|
t2 = new Map(repeatableItems.map(_temp2));
|
|
24
|
-
$[
|
|
25
|
-
$[
|
|
26
|
-
} else t2 = $[
|
|
28
|
+
$[3] = repeatableItems;
|
|
29
|
+
$[4] = t2;
|
|
30
|
+
} else t2 = $[4];
|
|
27
31
|
let t3;
|
|
28
|
-
if ($[
|
|
32
|
+
if ($[5] !== t1 || $[6] !== t2) {
|
|
29
33
|
t3 = {
|
|
30
34
|
filesMap: t1,
|
|
31
35
|
itemsMap: t2
|
|
32
36
|
};
|
|
33
|
-
$[
|
|
34
|
-
$[
|
|
35
|
-
$[
|
|
36
|
-
} else t3 = $[
|
|
37
|
+
$[5] = t1;
|
|
38
|
+
$[6] = t2;
|
|
39
|
+
$[7] = t3;
|
|
40
|
+
} else t3 = $[7];
|
|
37
41
|
const value = t3;
|
|
38
42
|
let t4;
|
|
39
|
-
if ($[
|
|
43
|
+
if ($[8] !== children || $[9] !== value) {
|
|
40
44
|
let t5;
|
|
41
|
-
if ($[
|
|
45
|
+
if ($[11] !== value) {
|
|
42
46
|
t5 = { value };
|
|
43
|
-
$[
|
|
44
|
-
$[
|
|
45
|
-
} else t5 = $[
|
|
47
|
+
$[11] = value;
|
|
48
|
+
$[12] = t5;
|
|
49
|
+
} else t5 = $[12];
|
|
46
50
|
t4 = React.createElement(NormalizedDataContext.Provider, t5, children);
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
} else t4 = $[
|
|
51
|
+
$[8] = children;
|
|
52
|
+
$[9] = value;
|
|
53
|
+
$[10] = t4;
|
|
54
|
+
} else t4 = $[10];
|
|
51
55
|
return t4;
|
|
52
56
|
};
|
|
53
57
|
function useNormalizedData() {
|
|
@@ -55,32 +59,36 @@ function useNormalizedData() {
|
|
|
55
59
|
}
|
|
56
60
|
const EMPTY_IDS = [];
|
|
57
61
|
function usePageBlocks(pageStructure) {
|
|
58
|
-
const $ = c(
|
|
62
|
+
const $ = c(16);
|
|
63
|
+
if ($[0] !== "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58") {
|
|
64
|
+
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
65
|
+
$[0] = "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58";
|
|
66
|
+
}
|
|
59
67
|
const blockIds = pageStructure.page.blockIds;
|
|
60
68
|
const beforeIds = pageStructure.layout?.beforeBlockIds ?? EMPTY_IDS;
|
|
61
69
|
const afterIds = pageStructure.layout?.afterBlockIds ?? EMPTY_IDS;
|
|
62
70
|
let t0;
|
|
63
|
-
if ($[
|
|
71
|
+
if ($[1] !== afterIds || $[2] !== beforeIds || $[3] !== blockIds) {
|
|
64
72
|
t0 = [
|
|
65
73
|
...blockIds,
|
|
66
74
|
...beforeIds,
|
|
67
75
|
...afterIds
|
|
68
76
|
];
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
} else t0 = $[
|
|
77
|
+
$[1] = afterIds;
|
|
78
|
+
$[2] = beforeIds;
|
|
79
|
+
$[3] = blockIds;
|
|
80
|
+
$[4] = t0;
|
|
81
|
+
} else t0 = $[4];
|
|
74
82
|
const allIds = t0;
|
|
75
83
|
let t1;
|
|
76
|
-
if ($[
|
|
84
|
+
if ($[5] !== allIds) {
|
|
77
85
|
t1 = { queries: allIds.map(_temp3) };
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
} else t1 = $[
|
|
86
|
+
$[5] = allIds;
|
|
87
|
+
$[6] = t1;
|
|
88
|
+
} else t1 = $[6];
|
|
81
89
|
const results = useQueries(t1);
|
|
82
90
|
let t2;
|
|
83
|
-
if ($[
|
|
91
|
+
if ($[7] !== afterIds || $[8] !== allIds || $[9] !== beforeIds || $[10] !== blockIds || $[11] !== results) {
|
|
84
92
|
const bundleMap = /* @__PURE__ */ new Map();
|
|
85
93
|
for (let i = 0; i < allIds.length; i++) {
|
|
86
94
|
const data = results[i]?.data;
|
|
@@ -89,12 +97,12 @@ function usePageBlocks(pageStructure) {
|
|
|
89
97
|
const layoutFiles = [];
|
|
90
98
|
const layoutItems = [];
|
|
91
99
|
let t3;
|
|
92
|
-
if ($[
|
|
100
|
+
if ($[13] !== afterIds || $[14] !== beforeIds) {
|
|
93
101
|
t3 = [...beforeIds, ...afterIds];
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
} else t3 = $[
|
|
102
|
+
$[13] = afterIds;
|
|
103
|
+
$[14] = beforeIds;
|
|
104
|
+
$[15] = t3;
|
|
105
|
+
} else t3 = $[15];
|
|
98
106
|
for (const id_0 of t3) {
|
|
99
107
|
const bundle = bundleMap.get(id_0);
|
|
100
108
|
if (bundle) {
|
|
@@ -109,13 +117,13 @@ function usePageBlocks(pageStructure) {
|
|
|
109
117
|
layoutFiles,
|
|
110
118
|
layoutItems
|
|
111
119
|
};
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
} else t2 = $[
|
|
120
|
+
$[7] = afterIds;
|
|
121
|
+
$[8] = allIds;
|
|
122
|
+
$[9] = beforeIds;
|
|
123
|
+
$[10] = blockIds;
|
|
124
|
+
$[11] = results;
|
|
125
|
+
$[12] = t2;
|
|
126
|
+
} else t2 = $[12];
|
|
119
127
|
return t2;
|
|
120
128
|
}
|
|
121
129
|
/** Check if a value is a { _fileId } marker */
|
|
@@ -7,31 +7,35 @@ import { usePartySocket } from "partysocket/react";
|
|
|
7
7
|
//#region src/lib/use-project-room.ts
|
|
8
8
|
const DEBOUNCE_MS = 300;
|
|
9
9
|
function useProjectRoom(apiUrl, projectId) {
|
|
10
|
-
const $ = c(
|
|
10
|
+
const $ = c(10);
|
|
11
|
+
if ($[0] !== "c94fdacdaeb446d7db77b7fee7efa4a24c7433c9c1f518f586565506a52bbbd7") {
|
|
12
|
+
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
13
|
+
$[0] = "c94fdacdaeb446d7db77b7fee7efa4a24c7433c9c1f518f586565506a52bbbd7";
|
|
14
|
+
}
|
|
11
15
|
const queryClient = useQueryClient();
|
|
12
16
|
const timerRef = useRef(void 0);
|
|
13
17
|
let t0;
|
|
14
|
-
if ($[
|
|
18
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15
19
|
t0 = [];
|
|
16
|
-
$[
|
|
17
|
-
} else t0 = $[
|
|
20
|
+
$[1] = t0;
|
|
21
|
+
} else t0 = $[1];
|
|
18
22
|
const pendingRef = useRef(t0);
|
|
19
23
|
let t1;
|
|
20
|
-
if ($[
|
|
24
|
+
if ($[2] !== apiUrl) {
|
|
21
25
|
let t2;
|
|
22
|
-
if ($[
|
|
26
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
27
|
t2 = /\/+$/;
|
|
24
|
-
$[
|
|
25
|
-
} else t2 = $[
|
|
28
|
+
$[4] = t2;
|
|
29
|
+
} else t2 = $[4];
|
|
26
30
|
t1 = apiUrl.replace(/^https?:\/\//, "").replace(t2, "");
|
|
27
|
-
$[
|
|
28
|
-
$[
|
|
29
|
-
} else t1 = $[
|
|
31
|
+
$[2] = apiUrl;
|
|
32
|
+
$[3] = t1;
|
|
33
|
+
} else t1 = $[3];
|
|
30
34
|
const host = t1;
|
|
31
35
|
const t2 = String(projectId ?? "");
|
|
32
36
|
const t3 = !!projectId;
|
|
33
37
|
let t4;
|
|
34
|
-
if ($[
|
|
38
|
+
if ($[5] !== host || $[6] !== queryClient || $[7] !== t2 || $[8] !== t3) {
|
|
35
39
|
t4 = {
|
|
36
40
|
host,
|
|
37
41
|
party: "project-room",
|
|
@@ -65,12 +69,12 @@ function useProjectRoom(apiUrl, projectId) {
|
|
|
65
69
|
}, DEBOUNCE_MS);
|
|
66
70
|
}
|
|
67
71
|
};
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
} else t4 = $[
|
|
72
|
+
$[5] = host;
|
|
73
|
+
$[6] = queryClient;
|
|
74
|
+
$[7] = t2;
|
|
75
|
+
$[8] = t3;
|
|
76
|
+
$[9] = t4;
|
|
77
|
+
} else t4 = $[9];
|
|
74
78
|
usePartySocket(t4);
|
|
75
79
|
}
|
|
76
80
|
function _temp() {
|