camox 0.77.0 → 0.78.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/features/canvas/CamoxCanvas.js +187 -197
- package/dist/features/canvas/canvasCameraController.js +1 -1
- package/dist/features/canvas/canvasItems.js +40 -9
- package/dist/features/canvas/sidebar/ContentSidebarFrame.js +15 -11
- package/dist/features/canvas/useCanvasLayout.js +34 -0
- package/dist/features/memory/CamoxMemory.js +747 -0
- package/dist/features/preview/EditablePageExperience.js +2 -0
- package/dist/features/runtime/publicCache.d.ts +2 -0
- package/dist/features/runtime/publicCache.js +27 -4
- package/dist/features/runtime/runtime.d.ts +1 -1
- package/dist/features/runtime/runtime.js +34 -15
- package/dist/features/studio/FollowAgentProvider.js +1 -1
- package/dist/features/studio/components/AgentSidebar.js +22 -16
- package/dist/features/studio/components/DraftBar.js +167 -103
- package/dist/features/studio/components/{ReviewDraftDialog.js → DraftReview.js} +191 -218
- package/dist/features/studio/components/DraftsControl.js +174 -202
- package/dist/features/studio/components/DraftsSheet.js +102 -94
- package/dist/features/studio/components/Navbar.js +121 -84
- package/dist/features/studio/components/PublishedTab.js +21 -20
- package/dist/features/studio/routes.js +3 -1
- package/dist/features/studio/studioStore.js +12 -9
- package/dist/features/studio/usePublishDraft.js +116 -0
- package/dist/features/studio/viewSwitch.js +10 -7
- package/dist/lib/queries.js +7 -1
- package/dist/lib/studio-reads.js +6 -0
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +5 -5
- package/LICENSE.md +0 -21
|
@@ -3,6 +3,7 @@ import { CamoxContent } from "../content/CamoxContent.js";
|
|
|
3
3
|
import { AuthenticatedCamoxProvider } from "../provider/AuthenticatedCamoxProvider.js";
|
|
4
4
|
import { CamoxStudio } from "../studio/CamoxStudio.js";
|
|
5
5
|
import { CompleteBlockEditingRuntimeProvider } from "../../core/editing/CompleteBlockEditingRuntime.js";
|
|
6
|
+
import { CamoxMemory } from "../memory/CamoxMemory.js";
|
|
6
7
|
import { CamoxSettings } from "../settings/CamoxSettings.js";
|
|
7
8
|
import { c } from "react/compiler-runtime";
|
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -11,6 +12,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
11
12
|
/** The studio section each studio route shows. */
|
|
12
13
|
const STUDIO_SECTIONS = {
|
|
13
14
|
"studio-content": CamoxContent,
|
|
15
|
+
"studio-memory": CamoxMemory,
|
|
14
16
|
"studio-settings": CamoxSettings
|
|
15
17
|
};
|
|
16
18
|
function EditablePageExperience(t0) {
|
|
@@ -16,6 +16,8 @@ export declare function readLiveCacheKey(apiUrl: string, projectUuid: string): P
|
|
|
16
16
|
/**
|
|
17
17
|
* Answers a public request from the cache, or renders it and keeps the render when it may be
|
|
18
18
|
* shared. Without a Live cache key, it renders without the cache: nothing tells when Live changed.
|
|
19
|
+
* A key slower than `RENDER_HEAD_START_MS` starts the render before it arrives; should the cache
|
|
20
|
+
* have the page after all, that render is dropped.
|
|
19
21
|
*/
|
|
20
22
|
export declare function respondThroughPublicCache(request: Request, publicCache: PublicCache, render: () => Promise<Response | null>): Promise<Response | null>;
|
|
21
23
|
//#endregion
|
|
@@ -9,6 +9,13 @@ const EDGE_MAX_AGE = 86400;
|
|
|
9
9
|
const VISITOR_CACHE_CONTROL = "public, max-age=0, must-revalidate";
|
|
10
10
|
/** The search parameter the cache key adds to a request's URL. */
|
|
11
11
|
const CACHE_KEY_PARAM = "__camox_cache";
|
|
12
|
+
/**
|
|
13
|
+
* How long a render waits for the Live cache key before it starts anyway. The edge answers a key
|
|
14
|
+
* it keeps within a few milliseconds. One it doesn't keep, the API mints, which often takes a
|
|
15
|
+
* second while an API isolate starts, and no render is kept under a key just minted, so the page
|
|
16
|
+
* renders either way: it starts while the key is on its way.
|
|
17
|
+
*/
|
|
18
|
+
const RENDER_HEAD_START_MS = 50;
|
|
12
19
|
/** The project's Live cache key, as the API serves it from its edge cache. */
|
|
13
20
|
async function readLiveCacheKey(apiUrl, projectUuid) {
|
|
14
21
|
try {
|
|
@@ -21,10 +28,26 @@ async function readLiveCacheKey(apiUrl, projectUuid) {
|
|
|
21
28
|
/**
|
|
22
29
|
* Answers a public request from the cache, or renders it and keeps the render when it may be
|
|
23
30
|
* shared. Without a Live cache key, it renders without the cache: nothing tells when Live changed.
|
|
31
|
+
* A key slower than `RENDER_HEAD_START_MS` starts the render before it arrives; should the cache
|
|
32
|
+
* have the page after all, that render is dropped.
|
|
24
33
|
*/
|
|
25
34
|
async function respondThroughPublicCache(request, publicCache, render) {
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
let rendering;
|
|
36
|
+
const renderOnce = () => {
|
|
37
|
+
if (!rendering) {
|
|
38
|
+
rendering = render();
|
|
39
|
+
rendering.catch(() => void 0);
|
|
40
|
+
}
|
|
41
|
+
return rendering;
|
|
42
|
+
};
|
|
43
|
+
const headStart = setTimeout(renderOnce, 50);
|
|
44
|
+
let liveCacheKey;
|
|
45
|
+
try {
|
|
46
|
+
liveCacheKey = await publicCache.liveCacheKey();
|
|
47
|
+
} finally {
|
|
48
|
+
clearTimeout(headStart);
|
|
49
|
+
}
|
|
50
|
+
if (!liveCacheKey) return renderOnce();
|
|
28
51
|
const key = cacheKeyOf(request, `${liveCacheKey}.${publicCache.build}`);
|
|
29
52
|
let cache;
|
|
30
53
|
let cached;
|
|
@@ -33,10 +56,10 @@ async function respondThroughPublicCache(request, publicCache, render) {
|
|
|
33
56
|
cached = await cache.match(withValidators(key, request));
|
|
34
57
|
} catch (error) {
|
|
35
58
|
console.error("The edge cache couldn't be read: the page renders without it", error);
|
|
36
|
-
return
|
|
59
|
+
return renderOnce();
|
|
37
60
|
}
|
|
38
61
|
if (cached) return forVisitors(cached, request);
|
|
39
|
-
const response = await
|
|
62
|
+
const response = await renderOnce();
|
|
40
63
|
if (!response || !mayBeShared(response)) return response;
|
|
41
64
|
publicCache.waitUntil((async () => cache.put(key, forEdge(response.clone())))().catch((error) => {
|
|
42
65
|
console.error("The edge cache couldn't keep a render", error);
|
|
@@ -11,7 +11,7 @@ import { LookPlaceholderHeight } from "@camox/api-contract/drafts";
|
|
|
11
11
|
import { UseHeadInput } from "unhead/types";
|
|
12
12
|
//#region src/features/runtime/runtime.d.ts
|
|
13
13
|
/** The studio's own routes, rather than a page or the Canvas. */
|
|
14
|
-
declare const STUDIO_ROUTE_KINDS: readonly ["studio", "studio-content", "studio-settings", "studio-nested"];
|
|
14
|
+
declare const STUDIO_ROUTE_KINDS: readonly ["studio", "studio-content", "studio-memory", "studio-settings", "studio-nested"];
|
|
15
15
|
export type StudioRouteKind = (typeof STUDIO_ROUTE_KINDS)[number];
|
|
16
16
|
export type RuntimeRouteKind = RuntimeOwnedRouteKind | "canvas" | "page" | StudioRouteKind;
|
|
17
17
|
export interface RuntimeRouteMatch {
|
|
@@ -8,7 +8,7 @@ import { ARTIFACTS_PATH_PREFIX, RUNTIME_ROUTE_PATHS, matchRuntimeOwnedRoute } fr
|
|
|
8
8
|
import { reads } from "../../lib/studio-reads.js";
|
|
9
9
|
import { recordMarkdownTemplate } from "../../core/recordItem.js";
|
|
10
10
|
import { PLATFORM_SCRIPT } from "../../lib/platform.js";
|
|
11
|
-
import { STUDIO_ASSETS_PATH, STUDIO_CANVAS_PATH, STUDIO_CONTENT_PATH, STUDIO_SETTINGS_PATH, matchCollectionContentPath } from "../studio/routes.js";
|
|
11
|
+
import { STUDIO_ASSETS_PATH, STUDIO_CANVAS_PATH, STUDIO_CONTENT_PATH, STUDIO_MEMORY_PATH, STUDIO_SETTINGS_PATH, matchCollectionContentPath } from "../studio/routes.js";
|
|
12
12
|
import { STUDIO_THEME_SCRIPT } from "../studio/studioTheme.js";
|
|
13
13
|
import { DefaultPageImage, renderPageImage } from "../og/pageImage.js";
|
|
14
14
|
import { discoverLayoutPages } from "../../core/derivedRoutes.js";
|
|
@@ -39,6 +39,7 @@ const DEFAULT_RUNTIME_BASE_PATH = "";
|
|
|
39
39
|
const STUDIO_ROUTE_KINDS = [
|
|
40
40
|
"studio",
|
|
41
41
|
"studio-content",
|
|
42
|
+
"studio-memory",
|
|
42
43
|
"studio-settings",
|
|
43
44
|
"studio-nested"
|
|
44
45
|
];
|
|
@@ -122,6 +123,10 @@ function matchRuntimeRoute(pathname) {
|
|
|
122
123
|
kind: "studio-content",
|
|
123
124
|
pathname
|
|
124
125
|
};
|
|
126
|
+
if (pathname === "/camox/memory" || pathname === `${"/camox/memory"}/`) return {
|
|
127
|
+
kind: "studio-memory",
|
|
128
|
+
pathname
|
|
129
|
+
};
|
|
125
130
|
if (pathname === "/camox/settings" || pathname === `${"/camox/settings"}/`) return {
|
|
126
131
|
kind: "studio-settings",
|
|
127
132
|
pathname
|
|
@@ -1687,21 +1692,35 @@ async function handleCamoxRequest(request, options = {}) {
|
|
|
1687
1692
|
if (signedIn) return signedIn;
|
|
1688
1693
|
}
|
|
1689
1694
|
const { apiUrl, projectUuid } = options;
|
|
1695
|
+
if (!apiUrl || !projectUuid) return respondInLocale(options, request, pathname);
|
|
1690
1696
|
const markdownPathname = parseMarkdownPath(pathname);
|
|
1691
|
-
if (
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1697
|
+
if (markdownPathname) return await createPageMarkdownResponse({
|
|
1698
|
+
...options,
|
|
1699
|
+
apiUrl,
|
|
1700
|
+
projectUuid
|
|
1701
|
+
}, {
|
|
1702
|
+
pathname: markdownPathname,
|
|
1703
|
+
request,
|
|
1704
|
+
pagesOnly: false
|
|
1705
|
+
}) ?? new Response("Page not found", { status: 404 });
|
|
1706
|
+
return varyingByAccept((prefersMarkdown(request.headers.get("Accept") ?? "") ? await createPageMarkdownResponse({
|
|
1707
|
+
...options,
|
|
1708
|
+
apiUrl,
|
|
1709
|
+
projectUuid
|
|
1710
|
+
}, {
|
|
1711
|
+
pathname,
|
|
1712
|
+
request,
|
|
1713
|
+
pagesOnly: true
|
|
1714
|
+
}) : null) ?? await respondInLocale(options, request, pathname));
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* A response its URL answers in HTML or Markdown, by what the request accepts: it says so, so no
|
|
1718
|
+
* cache answers one with the other.
|
|
1719
|
+
*/
|
|
1720
|
+
function varyingByAccept(response) {
|
|
1721
|
+
const varying = new Response(response.body, response);
|
|
1722
|
+
varying.headers.append("Vary", "Accept");
|
|
1723
|
+
return varying;
|
|
1705
1724
|
}
|
|
1706
1725
|
/**
|
|
1707
1726
|
* Answers a path under its locale's prefix: the Canvas, a studio route or a page, in that locale.
|
|
@@ -4,9 +4,9 @@ import { useLocation, useNavigate } from "../navigation/navigation.js";
|
|
|
4
4
|
import { useProjectUuid } from "../../lib/auth.js";
|
|
5
5
|
import { reads, useReadQueries, useReadQuery } from "../../lib/studio-reads.js";
|
|
6
6
|
import { useRoutableLayouts } from "../../lib/studio-definitions.js";
|
|
7
|
+
import { canvasPageId, getCanvasPages } from "../canvas/canvasPages.js";
|
|
7
8
|
import { STUDIO_CANVAS_PATH } from "./routes.js";
|
|
8
9
|
import { FollowAgentContext } from "./followAgentContext.js";
|
|
9
|
-
import { canvasPageId, getCanvasPages } from "../canvas/canvasPages.js";
|
|
10
10
|
import { selectedCanvasPage } from "../canvas/canvasSelection.js";
|
|
11
11
|
import { useDiscoveredPreviewPaths } from "../canvas/useDiscoveredPreviewPaths.js";
|
|
12
12
|
import { EditorWhereContext } from "./editorWhereContext.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
2
|
import { SIDEBAR_GUTTER } from "../../preview/components/SidebarStack.js";
|
|
3
|
+
import { useCanvasLayout } from "../../canvas/useCanvasLayout.js";
|
|
3
4
|
import { ChatWidget } from "./ChatWidget.js";
|
|
4
5
|
import { Specialists } from "./Specialists.js";
|
|
5
6
|
import { c } from "react/compiler-runtime";
|
|
@@ -14,30 +15,34 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
15
|
* and the Preview and Studio pages follow the editor's runs too.
|
|
15
16
|
*/
|
|
16
17
|
function AgentSidebar(t0) {
|
|
17
|
-
const $ = c(
|
|
18
|
+
const $ = c(8);
|
|
18
19
|
const { hidden: t1 } = t0;
|
|
19
20
|
const hidden = t1 === void 0 ? false : t1;
|
|
21
|
+
const { sidebarWidth } = useCanvasLayout();
|
|
20
22
|
let t2;
|
|
23
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
24
|
+
t2 = cn("absolute inset-y-0 right-0 z-10 flex flex-col gap-2 py-2 max-md:hidden", SIDEBAR_GUTTER);
|
|
25
|
+
$[0] = t2;
|
|
26
|
+
} else t2 = $[0];
|
|
21
27
|
let t3;
|
|
28
|
+
if ($[1] !== sidebarWidth) {
|
|
29
|
+
t3 = { width: sidebarWidth };
|
|
30
|
+
$[1] = sidebarWidth;
|
|
31
|
+
$[2] = t3;
|
|
32
|
+
} else t3 = $[2];
|
|
22
33
|
let t4;
|
|
23
34
|
let t5;
|
|
24
|
-
if ($[
|
|
25
|
-
t2 = cn("absolute inset-y-0 right-0 z-10 flex flex-col gap-2 py-2 max-md:hidden", SIDEBAR_GUTTER);
|
|
26
|
-
t3 = { width: 265 };
|
|
35
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
27
36
|
t4 = /* @__PURE__ */ jsx(Specialists, { className: "min-h-0 flex-[0_1_auto]" });
|
|
28
37
|
t5 = /* @__PURE__ */ jsx(ChatWidget, { className: "min-h-0 flex-[7_1_0]" });
|
|
29
|
-
$[
|
|
30
|
-
$[
|
|
31
|
-
$[2] = t4;
|
|
32
|
-
$[3] = t5;
|
|
38
|
+
$[3] = t4;
|
|
39
|
+
$[4] = t5;
|
|
33
40
|
} else {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
t4 = $[2];
|
|
37
|
-
t5 = $[3];
|
|
41
|
+
t4 = $[3];
|
|
42
|
+
t5 = $[4];
|
|
38
43
|
}
|
|
39
44
|
let t6;
|
|
40
|
-
if ($[
|
|
45
|
+
if ($[5] !== hidden || $[6] !== t3) {
|
|
41
46
|
t6 = /* @__PURE__ */ jsxs("aside", {
|
|
42
47
|
"aria-label": "Agent",
|
|
43
48
|
"data-agent-sidebar": true,
|
|
@@ -46,9 +51,10 @@ function AgentSidebar(t0) {
|
|
|
46
51
|
style: t3,
|
|
47
52
|
children: [t4, t5]
|
|
48
53
|
});
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
|
|
54
|
+
$[5] = hidden;
|
|
55
|
+
$[6] = t3;
|
|
56
|
+
$[7] = t6;
|
|
57
|
+
} else t6 = $[7];
|
|
52
58
|
return t6;
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -3,6 +3,8 @@ import { studioStore } from "../studioStore.js";
|
|
|
3
3
|
import { plural } from "../draftLabel.js";
|
|
4
4
|
import { useArchiveDraft } from "../useArchiveDraft.js";
|
|
5
5
|
import { useDrafts } from "./DraftsControl.js";
|
|
6
|
+
import { usePublishDraft } from "../usePublishDraft.js";
|
|
7
|
+
import { DraftReview } from "./DraftReview.js";
|
|
6
8
|
import { c } from "react/compiler-runtime";
|
|
7
9
|
import * as React from "react";
|
|
8
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -18,143 +20,205 @@ import { FloatingToolbar } from "@camox/ui/floating-toolbar";
|
|
|
18
20
|
const SETTLE_MS = 1500;
|
|
19
21
|
/**
|
|
20
22
|
* Asks what to do with the draft being viewed, once its edits settle: archive it, unless it's
|
|
21
|
-
* Camox's Catch-up Draft, or publish it.
|
|
22
|
-
*
|
|
23
|
+
* Camox's Catch-up Draft, or publish it right away, which a toast follows. Its count of pending
|
|
24
|
+
* changes opens the draft's review, as does a publish that blockers held or stopped. Publishing
|
|
25
|
+
* waits while Camox's agent is mid-turn in the draft, so half a change never goes live;
|
|
23
26
|
* nothing else Camox does holds it here. `stacked` places it in the Preview toolbar's column, just above the toolbar;
|
|
24
27
|
* otherwise it floats at the bottom of the screen on its own.
|
|
25
28
|
*/
|
|
26
29
|
function DraftBar(t0) {
|
|
27
|
-
const $ = c(
|
|
30
|
+
const $ = c(10);
|
|
28
31
|
const { stacked: t1 } = t0;
|
|
29
32
|
const stacked = t1 === void 0 ? false : t1;
|
|
30
33
|
const { projectId, current } = useDrafts();
|
|
31
34
|
const { archive, archiving } = useArchiveDraft(projectId);
|
|
32
35
|
const settled = useSettled(current?.id ?? null, current?.lastChangedAt ?? null);
|
|
36
|
+
const reviewing = useSelector(studioStore, _temp);
|
|
33
37
|
let t2;
|
|
34
38
|
if ($[0] !== current) {
|
|
35
|
-
t2 = (
|
|
39
|
+
t2 = (state_0) => !!current && state_0.context.agentWorkingIn === current.id;
|
|
36
40
|
$[0] = current;
|
|
37
41
|
$[1] = t2;
|
|
38
42
|
} else t2 = $[1];
|
|
39
43
|
const working = useSelector(studioStore, t2);
|
|
40
|
-
if (!projectId || !current || !settled) return null;
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
if (!projectId || !current || !(settled || reviewing)) return null;
|
|
45
|
+
let t3;
|
|
46
|
+
if ($[2] !== archive || $[3] !== archiving || $[4] !== current || $[5] !== projectId || $[6] !== reviewing || $[7] !== stacked || $[8] !== working) {
|
|
47
|
+
t3 = /* @__PURE__ */ jsx(Bar, {
|
|
48
|
+
projectId,
|
|
49
|
+
draft: current,
|
|
50
|
+
archive,
|
|
51
|
+
archiving,
|
|
52
|
+
working,
|
|
53
|
+
reviewing,
|
|
54
|
+
stacked
|
|
55
|
+
}, current.id);
|
|
56
|
+
$[2] = archive;
|
|
57
|
+
$[3] = archiving;
|
|
58
|
+
$[4] = current;
|
|
59
|
+
$[5] = projectId;
|
|
60
|
+
$[6] = reviewing;
|
|
61
|
+
$[7] = stacked;
|
|
62
|
+
$[8] = working;
|
|
63
|
+
$[9] = t3;
|
|
64
|
+
} else t3 = $[9];
|
|
65
|
+
return t3;
|
|
66
|
+
}
|
|
67
|
+
function _temp(state) {
|
|
68
|
+
return state.context.isDraftReviewOpen;
|
|
69
|
+
}
|
|
70
|
+
function Bar(t0) {
|
|
71
|
+
const $ = c(37);
|
|
72
|
+
const { projectId, draft, archive, archiving, working, reviewing, stacked } = t0;
|
|
73
|
+
const review = _temp2;
|
|
74
|
+
let t1;
|
|
75
|
+
if ($[0] !== draft.id || $[1] !== projectId) {
|
|
76
|
+
t1 = {
|
|
77
|
+
projectId,
|
|
78
|
+
draftId: draft.id,
|
|
79
|
+
onBlocked: review
|
|
80
|
+
};
|
|
81
|
+
$[0] = draft.id;
|
|
82
|
+
$[1] = projectId;
|
|
83
|
+
$[2] = t1;
|
|
84
|
+
} else t1 = $[2];
|
|
85
|
+
const { publish, publishing } = usePublishDraft(t1);
|
|
86
|
+
const empty = draft.changeCount === 0;
|
|
87
|
+
const toolbar = React.useRef(null);
|
|
88
|
+
const t2 = stacked ? "pointer-events-auto relative left-auto translate-x-0" : "fixed bottom-2";
|
|
89
|
+
let t3;
|
|
90
|
+
if ($[3] !== t2) {
|
|
91
|
+
t3 = cn("w-max gap-4", t2);
|
|
92
|
+
$[3] = t2;
|
|
93
|
+
$[4] = t3;
|
|
94
|
+
} else t3 = $[4];
|
|
43
95
|
let t4;
|
|
44
|
-
if ($[
|
|
45
|
-
t4 =
|
|
46
|
-
$[2] = t3;
|
|
47
|
-
$[3] = t4;
|
|
48
|
-
} else t4 = $[3];
|
|
49
|
-
let t5;
|
|
50
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
51
|
-
t5 = /* @__PURE__ */ jsx("span", {
|
|
52
|
-
"aria-hidden": true,
|
|
53
|
-
className: "size-2 shrink-0 rounded-full bg-blue-500"
|
|
54
|
-
});
|
|
55
|
-
$[4] = t5;
|
|
56
|
-
} else t5 = $[4];
|
|
57
|
-
let t6;
|
|
58
|
-
if ($[5] !== current.changeCount || $[6] !== empty) {
|
|
59
|
-
t6 = empty ? "No changes yet" : plural(current.changeCount, "pending change");
|
|
60
|
-
$[5] = current.changeCount;
|
|
61
|
-
$[6] = empty;
|
|
62
|
-
$[7] = t6;
|
|
63
|
-
} else t6 = $[7];
|
|
64
|
-
let t7;
|
|
65
|
-
if ($[8] !== t6) {
|
|
66
|
-
t7 = /* @__PURE__ */ jsxs("span", {
|
|
96
|
+
if ($[5] !== draft.changeCount || $[6] !== draft.id || $[7] !== empty || $[8] !== projectId || $[9] !== reviewing) {
|
|
97
|
+
t4 = empty ? /* @__PURE__ */ jsxs("span", {
|
|
67
98
|
className: "flex items-center gap-2 px-2 text-sm",
|
|
68
|
-
children: [
|
|
99
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
100
|
+
"aria-hidden": true,
|
|
101
|
+
className: "size-2 shrink-0 rounded-full bg-blue-500"
|
|
102
|
+
}), "No changes yet"]
|
|
103
|
+
}) : /* @__PURE__ */ jsx(DraftReview, {
|
|
104
|
+
projectId,
|
|
105
|
+
draftId: draft.id,
|
|
106
|
+
open: reviewing,
|
|
107
|
+
anchor: toolbar,
|
|
108
|
+
onOpenChange: _temp3,
|
|
109
|
+
trigger: /* @__PURE__ */ jsxs(Button, {
|
|
110
|
+
type: "button",
|
|
111
|
+
variant: "ghost",
|
|
112
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
113
|
+
"aria-hidden": true,
|
|
114
|
+
className: "size-2 shrink-0 rounded-full bg-blue-500"
|
|
115
|
+
}), plural(draft.changeCount, "pending change")]
|
|
116
|
+
})
|
|
69
117
|
});
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
118
|
+
$[5] = draft.changeCount;
|
|
119
|
+
$[6] = draft.id;
|
|
120
|
+
$[7] = empty;
|
|
121
|
+
$[8] = projectId;
|
|
122
|
+
$[9] = reviewing;
|
|
123
|
+
$[10] = t4;
|
|
124
|
+
} else t4 = $[10];
|
|
125
|
+
let t5;
|
|
126
|
+
if ($[11] !== archive || $[12] !== archiving || $[13] !== draft.catchUp || $[14] !== publishing) {
|
|
127
|
+
t5 = !draft.catchUp && /* @__PURE__ */ jsx(Button, {
|
|
76
128
|
type: "button",
|
|
77
129
|
variant: "outline",
|
|
78
|
-
disabled: archiving,
|
|
130
|
+
disabled: archiving || publishing,
|
|
79
131
|
onClick: archive,
|
|
80
132
|
children: "Archive"
|
|
81
133
|
});
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
134
|
+
$[11] = archive;
|
|
135
|
+
$[12] = archiving;
|
|
136
|
+
$[13] = draft.catchUp;
|
|
137
|
+
$[14] = publishing;
|
|
138
|
+
$[15] = t5;
|
|
139
|
+
} else t5 = $[15];
|
|
140
|
+
const t6 = !working;
|
|
141
|
+
const t7 = working ? 0 : void 0;
|
|
142
|
+
let t8;
|
|
143
|
+
if ($[16] !== t7) {
|
|
144
|
+
t8 = /* @__PURE__ */ jsx("span", { tabIndex: t7 });
|
|
145
|
+
$[16] = t7;
|
|
146
|
+
$[17] = t8;
|
|
147
|
+
} else t8 = $[17];
|
|
148
|
+
const t9 = empty || working || publishing;
|
|
149
|
+
let t10;
|
|
150
|
+
if ($[18] !== publish) {
|
|
151
|
+
t10 = () => void publish();
|
|
152
|
+
$[18] = publish;
|
|
153
|
+
$[19] = t10;
|
|
154
|
+
} else t10 = $[19];
|
|
89
155
|
let t11;
|
|
90
|
-
if ($[
|
|
91
|
-
t11 = /* @__PURE__ */ jsx(
|
|
92
|
-
$[14] = t10;
|
|
93
|
-
$[15] = t11;
|
|
94
|
-
} else t11 = $[15];
|
|
95
|
-
const t12 = empty || working;
|
|
96
|
-
let t13;
|
|
97
|
-
if ($[16] !== t12) {
|
|
98
|
-
t13 = /* @__PURE__ */ jsx(Button, {
|
|
156
|
+
if ($[20] !== t10 || $[21] !== t9) {
|
|
157
|
+
t11 = /* @__PURE__ */ jsx(Button, {
|
|
99
158
|
type: "button",
|
|
100
|
-
disabled:
|
|
101
|
-
onClick:
|
|
102
|
-
children: "Publish
|
|
159
|
+
disabled: t9,
|
|
160
|
+
onClick: t10,
|
|
161
|
+
children: "Publish"
|
|
162
|
+
});
|
|
163
|
+
$[20] = t10;
|
|
164
|
+
$[21] = t9;
|
|
165
|
+
$[22] = t11;
|
|
166
|
+
} else t11 = $[22];
|
|
167
|
+
let t12;
|
|
168
|
+
if ($[23] !== t11 || $[24] !== t8) {
|
|
169
|
+
t12 = /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
170
|
+
render: t8,
|
|
171
|
+
children: t11
|
|
103
172
|
});
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
|
|
173
|
+
$[23] = t11;
|
|
174
|
+
$[24] = t8;
|
|
175
|
+
$[25] = t12;
|
|
176
|
+
} else t12 = $[25];
|
|
177
|
+
let t13;
|
|
178
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
+
t13 = /* @__PURE__ */ jsx(TooltipContent, { children: "Camox's agent is working" });
|
|
180
|
+
$[26] = t13;
|
|
181
|
+
} else t13 = $[26];
|
|
107
182
|
let t14;
|
|
108
|
-
if ($[
|
|
109
|
-
t14 = /* @__PURE__ */
|
|
110
|
-
|
|
111
|
-
children: t13
|
|
183
|
+
if ($[27] !== t12 || $[28] !== t6) {
|
|
184
|
+
t14 = /* @__PURE__ */ jsxs(Tooltip, {
|
|
185
|
+
disabled: t6,
|
|
186
|
+
children: [t12, t13]
|
|
112
187
|
});
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
} else t14 = $[
|
|
188
|
+
$[27] = t12;
|
|
189
|
+
$[28] = t6;
|
|
190
|
+
$[29] = t14;
|
|
191
|
+
} else t14 = $[29];
|
|
117
192
|
let t15;
|
|
118
|
-
if ($[
|
|
119
|
-
t15 = /* @__PURE__ */
|
|
120
|
-
$[21] = t15;
|
|
121
|
-
} else t15 = $[21];
|
|
122
|
-
let t16;
|
|
123
|
-
if ($[22] !== t14 || $[23] !== t9) {
|
|
124
|
-
t16 = /* @__PURE__ */ jsxs(Tooltip, {
|
|
125
|
-
disabled: t9,
|
|
126
|
-
children: [t14, t15]
|
|
127
|
-
});
|
|
128
|
-
$[22] = t14;
|
|
129
|
-
$[23] = t9;
|
|
130
|
-
$[24] = t16;
|
|
131
|
-
} else t16 = $[24];
|
|
132
|
-
let t17;
|
|
133
|
-
if ($[25] !== t16 || $[26] !== t8) {
|
|
134
|
-
t17 = /* @__PURE__ */ jsxs("div", {
|
|
193
|
+
if ($[30] !== t14 || $[31] !== t5) {
|
|
194
|
+
t15 = /* @__PURE__ */ jsxs("div", {
|
|
135
195
|
className: "flex items-center gap-2",
|
|
136
|
-
children: [
|
|
196
|
+
children: [t5, t14]
|
|
137
197
|
});
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
} else
|
|
142
|
-
let
|
|
143
|
-
if ($[
|
|
144
|
-
|
|
198
|
+
$[30] = t14;
|
|
199
|
+
$[31] = t5;
|
|
200
|
+
$[32] = t15;
|
|
201
|
+
} else t15 = $[32];
|
|
202
|
+
let t16;
|
|
203
|
+
if ($[33] !== t15 || $[34] !== t3 || $[35] !== t4) {
|
|
204
|
+
t16 = /* @__PURE__ */ jsxs(FloatingToolbar, {
|
|
205
|
+
ref: toolbar,
|
|
145
206
|
"aria-label": "Draft",
|
|
146
|
-
className:
|
|
147
|
-
children: [
|
|
207
|
+
className: t3,
|
|
208
|
+
children: [t4, t15]
|
|
148
209
|
});
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
} else
|
|
154
|
-
return
|
|
210
|
+
$[33] = t15;
|
|
211
|
+
$[34] = t3;
|
|
212
|
+
$[35] = t4;
|
|
213
|
+
$[36] = t16;
|
|
214
|
+
} else t16 = $[36];
|
|
215
|
+
return t16;
|
|
216
|
+
}
|
|
217
|
+
function _temp3(open) {
|
|
218
|
+
return studioStore.send({ type: open ? "openDraftReview" : "closeDraftReview" });
|
|
155
219
|
}
|
|
156
|
-
function
|
|
157
|
-
return studioStore.send({ type: "
|
|
220
|
+
function _temp2() {
|
|
221
|
+
return studioStore.send({ type: "openDraftReview" });
|
|
158
222
|
}
|
|
159
223
|
/**
|
|
160
224
|
* Whether the draft went without a change for `SETTLE_MS`. Once settled it stays so for that
|