camox 0.45.0 → 0.47.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.
Files changed (45) hide show
  1. package/dist/core/hooks/useArtifactHost.js +2 -2
  2. package/dist/features/canvas/CamoxCanvas.js +438 -771
  3. package/dist/features/canvas/CanvasPageFrame.js +1 -3
  4. package/dist/features/canvas/CanvasPreviewPageSlot.js +26 -6
  5. package/dist/features/canvas/canvasCamera.js +24 -9
  6. package/dist/features/canvas/canvasFrameDocument.js +4 -19
  7. package/dist/features/canvas/canvasItems.js +12 -102
  8. package/dist/features/canvas/canvasStore.js +3 -92
  9. package/dist/features/canvas/sidebar/CanvasNavigator.js +81 -183
  10. package/dist/features/canvas/sidebar/CanvasSidebar.js +22 -28
  11. package/dist/features/canvas/sidebar/CuratedPageInspector.js +2 -2
  12. package/dist/features/canvas/useCanvasCamera.js +16 -31
  13. package/dist/features/canvas/useCanvasFrame.js +5 -6
  14. package/dist/features/preview/CamoxPreview.js +137 -120
  15. package/dist/features/preview/components/{AddBlockDialog.js → AddBlockSheet.js} +35 -32
  16. package/dist/features/preview/components/BlockActionsPopover.js +6 -6
  17. package/dist/features/preview/components/BlockThumbnail.js +31 -33
  18. package/dist/features/preview/components/Overlays.js +1 -1
  19. package/dist/features/preview/components/PageTree.js +1 -1
  20. package/dist/features/preview/components/PreviewPanel.js +1 -1
  21. package/dist/features/preview/components/PreviewToolbar.js +74 -85
  22. package/dist/features/preview/previewStore.js +9 -9
  23. package/dist/features/provider/CamoxProvider.js +8 -16
  24. package/dist/features/provider/CoreCamoxProvider.js +10 -12
  25. package/dist/features/provider/signInShortcut.js +60 -0
  26. package/dist/features/routes/pageRuntime.js +8 -8
  27. package/dist/features/runtime/RuntimeChrome.js +1 -1
  28. package/dist/features/runtime/pageApp.js +11 -39
  29. package/dist/features/runtime/runtime.d.ts +2 -7
  30. package/dist/features/runtime/runtime.js +6 -19
  31. package/dist/features/studio/FollowAgentProvider.js +11 -22
  32. package/dist/features/studio/components/FaviconDialog.js +3 -3
  33. package/dist/features/studio/followAgent.js +5 -14
  34. package/dist/features/studio/routes.js +1 -23
  35. package/dist/lib/auth.js +36 -24
  36. package/dist/lib/studio-reads.js +0 -20
  37. package/dist/package.js +1 -1
  38. package/dist/studio.css +1 -1
  39. package/package.json +4 -4
  40. package/skills/camox-expand/SKILL.md +5 -4
  41. package/dist/features/canvas/CanvasBlockFrame.js +0 -353
  42. package/dist/features/canvas/CanvasBlockHeader.js +0 -55
  43. package/dist/features/canvas/CanvasShelfMarker.js +0 -255
  44. package/dist/features/canvas/sidebar/CatalogBlockInspector.js +0 -189
  45. package/dist/features/provider/LocalhostPreviewProvider.js +0 -158
@@ -1,189 +0,0 @@
1
- import { useLocation, useNavigate } from "../../navigation/navigation.js";
2
- import { reads, useReadQuery } from "../../../lib/studio-reads.js";
3
- import { useLocalizedPath } from "../../../lib/view-locale.js";
4
- import { CanvasInspectorBody, CanvasInspectorHeader, CanvasInspectorTitle } from "./CanvasInspector.js";
5
- import { c } from "react/compiler-runtime";
6
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
-
8
- //#region src/features/canvas/sidebar/CatalogBlockInspector.tsx
9
- function PagesMessage(t0) {
10
- const $ = c(3);
11
- const { role, children } = t0;
12
- let t1;
13
- if ($[0] !== children || $[1] !== role) {
14
- t1 = /* @__PURE__ */ jsx("p", {
15
- role,
16
- className: "text-muted-foreground text-sm",
17
- children
18
- });
19
- $[0] = children;
20
- $[1] = role;
21
- $[2] = t1;
22
- } else t1 = $[2];
23
- return t1;
24
- }
25
- /**
26
- * The Pages holding a placement of the block. Picking one selects it through
27
- * regular navigation, so the camera flies to it.
28
- */
29
- function PlacementPages(t0) {
30
- const $ = c(19);
31
- const { block, projectId } = t0;
32
- const { search, hash } = useLocation();
33
- const localized = useLocalizedPath();
34
- const navigate = useNavigate();
35
- let t1;
36
- if ($[0] !== block._internal.id || $[1] !== projectId) {
37
- t1 = reads.pagesUsingBlock({
38
- projectId,
39
- type: block._internal.id
40
- });
41
- $[0] = block._internal.id;
42
- $[1] = projectId;
43
- $[2] = t1;
44
- } else t1 = $[2];
45
- const pages = useReadQuery(t1);
46
- if (pages.isPending) {
47
- let t2;
48
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
49
- t2 = /* @__PURE__ */ jsx(PagesMessage, {
50
- role: "status",
51
- children: "Loading pages…"
52
- });
53
- $[3] = t2;
54
- } else t2 = $[3];
55
- return t2;
56
- }
57
- if (pages.error) {
58
- let t2;
59
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
60
- t2 = /* @__PURE__ */ jsx(PagesMessage, {
61
- role: "alert",
62
- children: "Could not load the pages using this block."
63
- });
64
- $[4] = t2;
65
- } else t2 = $[4];
66
- return t2;
67
- }
68
- if (pages.data.length === 0) {
69
- let t2;
70
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
71
- t2 = /* @__PURE__ */ jsx(PagesMessage, { children: "No pages use this block yet." });
72
- $[5] = t2;
73
- } else t2 = $[5];
74
- return t2;
75
- }
76
- let t2;
77
- if ($[6] !== hash || $[7] !== localized || $[8] !== navigate || $[9] !== pages.data || $[10] !== search) {
78
- let t3;
79
- if ($[12] !== hash || $[13] !== localized || $[14] !== navigate || $[15] !== search) {
80
- t3 = (page) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
81
- type: "button",
82
- className: "hover:bg-accent focus-visible:ring-ring flex w-full min-w-0 items-baseline justify-between gap-3 rounded-md px-2 py-1.5 text-left text-sm outline-none focus-visible:ring-2",
83
- onClick: () => void navigate({ to: `${localized(page.fullPath)}${search}${hash}` }),
84
- children: [/* @__PURE__ */ jsx("span", {
85
- className: "truncate",
86
- children: page.nickname
87
- }), /* @__PURE__ */ jsx("span", {
88
- className: "text-muted-foreground truncate",
89
- children: page.fullPath
90
- })]
91
- }) }, page.id);
92
- $[12] = hash;
93
- $[13] = localized;
94
- $[14] = navigate;
95
- $[15] = search;
96
- $[16] = t3;
97
- } else t3 = $[16];
98
- t2 = pages.data.map(t3);
99
- $[6] = hash;
100
- $[7] = localized;
101
- $[8] = navigate;
102
- $[9] = pages.data;
103
- $[10] = search;
104
- $[11] = t2;
105
- } else t2 = $[11];
106
- let t3;
107
- if ($[17] !== t2) {
108
- t3 = /* @__PURE__ */ jsx("ul", {
109
- className: "-mx-2 flex flex-col gap-0.5",
110
- children: t2
111
- });
112
- $[17] = t2;
113
- $[18] = t3;
114
- } else t3 = $[18];
115
- return t3;
116
- }
117
- /** A block of the Block Catalog: its description and the Pages holding its placements. */
118
- function CatalogBlockInspector(t0) {
119
- const $ = c(17);
120
- const { block, projectId, onBack } = t0;
121
- const { title, description } = block._internal;
122
- let t1;
123
- if ($[0] !== title) {
124
- t1 = /* @__PURE__ */ jsx(CanvasInspectorTitle, { children: title });
125
- $[0] = title;
126
- $[1] = t1;
127
- } else t1 = $[1];
128
- let t2;
129
- if ($[2] !== onBack || $[3] !== t1) {
130
- t2 = /* @__PURE__ */ jsx(CanvasInspectorHeader, {
131
- onBack,
132
- children: t1
133
- });
134
- $[2] = onBack;
135
- $[3] = t1;
136
- $[4] = t2;
137
- } else t2 = $[4];
138
- let t3;
139
- if ($[5] !== description) {
140
- t3 = description && /* @__PURE__ */ jsx("p", {
141
- className: "text-muted-foreground text-sm",
142
- children: description
143
- });
144
- $[5] = description;
145
- $[6] = t3;
146
- } else t3 = $[6];
147
- let t4;
148
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
149
- t4 = /* @__PURE__ */ jsx("p", {
150
- className: "text-sm font-medium",
151
- children: "Used on"
152
- });
153
- $[7] = t4;
154
- } else t4 = $[7];
155
- let t5;
156
- if ($[8] !== block || $[9] !== projectId) {
157
- t5 = /* @__PURE__ */ jsxs("section", {
158
- className: "space-y-2",
159
- children: [t4, /* @__PURE__ */ jsx(PlacementPages, {
160
- block,
161
- projectId
162
- })]
163
- });
164
- $[8] = block;
165
- $[9] = projectId;
166
- $[10] = t5;
167
- } else t5 = $[10];
168
- let t6;
169
- if ($[11] !== t3 || $[12] !== t5) {
170
- t6 = /* @__PURE__ */ jsx(CanvasInspectorBody, { children: /* @__PURE__ */ jsxs("div", {
171
- className: "flex min-h-0 flex-1 flex-col gap-6 overflow-auto p-4",
172
- children: [t3, t5]
173
- }) });
174
- $[11] = t3;
175
- $[12] = t5;
176
- $[13] = t6;
177
- } else t6 = $[13];
178
- let t7;
179
- if ($[14] !== t2 || $[15] !== t6) {
180
- t7 = /* @__PURE__ */ jsxs(Fragment, { children: [t2, t6] });
181
- $[14] = t2;
182
- $[15] = t6;
183
- $[16] = t7;
184
- } else t7 = $[16];
185
- return t7;
186
- }
187
-
188
- //#endregion
189
- export { CatalogBlockInspector };
@@ -1,158 +0,0 @@
1
- import { actionsStore } from "./actionsStore.js";
2
- import { useSignInRedirect } from "../../lib/auth.js";
3
- import { TOGGLE_CANVAS_SHORTCUT } from "../preview/previewConstants.js";
4
- import { useApplyTheme } from "../studio/useTheme.js";
5
- import { PreviewPanel } from "../preview/components/PreviewPanel.js";
6
- import { useAdminShortcuts } from "./useAdminShortcuts.js";
7
- import { PreviewToolbar } from "../preview/components/PreviewToolbar.js";
8
- import { c } from "react/compiler-runtime";
9
- import * as React from "react";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
- import { Toaster } from "@camox/ui/toaster";
12
- import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
13
- import studioCssUrl from "virtual:camox-studio-css";
14
-
15
- //#region src/features/provider/LocalhostPreviewProvider.tsx
16
- function LocalhostPreviewProvider(t0) {
17
- const $ = c(22);
18
- const { children } = t0;
19
- const signInRedirect = useSignInRedirect();
20
- const { resolvedTheme } = useApplyTheme();
21
- const [isSignInOpen, setIsSignInOpen] = React.useState(false);
22
- useAdminShortcuts();
23
- let t1;
24
- let t2;
25
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26
- t1 = () => {
27
- const actions = [{
28
- id: "sign-in-to-edit",
29
- label: "Sign in to edit",
30
- aliases: ["Show canvas", "Edit mode"],
31
- groupLabel: "Website",
32
- checkIfAvailable: _temp,
33
- execute: () => setIsSignInOpen(true),
34
- shortcut: TOGGLE_CANVAS_SHORTCUT
35
- }];
36
- actionsStore.send({
37
- type: "registerManyActions",
38
- actions
39
- });
40
- return () => {
41
- actionsStore.send({
42
- type: "unregisterManyActions",
43
- ids: actions.map(_temp2)
44
- });
45
- };
46
- };
47
- t2 = [];
48
- $[0] = t1;
49
- $[1] = t2;
50
- } else {
51
- t1 = $[0];
52
- t2 = $[1];
53
- }
54
- React.useEffect(t1, t2);
55
- let t3;
56
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
57
- t3 = /* @__PURE__ */ jsx("link", {
58
- rel: "stylesheet",
59
- href: studioCssUrl,
60
- "data-camox-studio": true
61
- });
62
- $[2] = t3;
63
- } else t3 = $[2];
64
- let t4;
65
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
66
- t4 = { bottom: "1rem" };
67
- $[3] = t4;
68
- } else t4 = $[3];
69
- let t5;
70
- if ($[4] !== resolvedTheme) {
71
- t5 = /* @__PURE__ */ jsx(Toaster, {
72
- theme: resolvedTheme,
73
- position: "bottom-right",
74
- offset: t4
75
- });
76
- $[4] = resolvedTheme;
77
- $[5] = t5;
78
- } else t5 = $[5];
79
- let t6;
80
- if ($[6] !== children) {
81
- t6 = /* @__PURE__ */ jsx(PreviewPanel, { children });
82
- $[6] = children;
83
- $[7] = t6;
84
- } else t6 = $[7];
85
- let t7;
86
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
87
- t7 = /* @__PURE__ */ jsx(PreviewToolbar, { onCanvasShownChange: (checked) => {
88
- if (checked) setIsSignInOpen(true);
89
- } });
90
- $[8] = t7;
91
- } else t7 = $[8];
92
- let t8;
93
- if ($[9] !== t6) {
94
- t8 = /* @__PURE__ */ jsxs("div", {
95
- className: "bg-background relative flex h-screen flex-col overflow-hidden",
96
- children: [t6, t7]
97
- });
98
- $[9] = t6;
99
- $[10] = t8;
100
- } else t8 = $[10];
101
- let t9;
102
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
103
- t9 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Sign in to edit" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "You need to sign in before you can show the canvas." })] });
104
- $[11] = t9;
105
- } else t9 = $[11];
106
- let t10;
107
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
108
- t10 = /* @__PURE__ */ jsx(AlertDialogCancel, {
109
- variant: "outline",
110
- size: "default",
111
- children: "Cancel"
112
- });
113
- $[12] = t10;
114
- } else t10 = $[12];
115
- let t11;
116
- if ($[13] !== signInRedirect) {
117
- t11 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t9, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t10, /* @__PURE__ */ jsx(AlertDialogAction, {
118
- onClick: signInRedirect,
119
- children: "Sign in"
120
- })] })] });
121
- $[13] = signInRedirect;
122
- $[14] = t11;
123
- } else t11 = $[14];
124
- let t12;
125
- if ($[15] !== isSignInOpen || $[16] !== t11) {
126
- t12 = /* @__PURE__ */ jsx(AlertDialog, {
127
- open: isSignInOpen,
128
- onOpenChange: setIsSignInOpen,
129
- children: t11
130
- });
131
- $[15] = isSignInOpen;
132
- $[16] = t11;
133
- $[17] = t12;
134
- } else t12 = $[17];
135
- let t13;
136
- if ($[18] !== t12 || $[19] !== t5 || $[20] !== t8) {
137
- t13 = /* @__PURE__ */ jsxs(Fragment, { children: [
138
- t3,
139
- t5,
140
- t8,
141
- t12
142
- ] });
143
- $[18] = t12;
144
- $[19] = t5;
145
- $[20] = t8;
146
- $[21] = t13;
147
- } else t13 = $[21];
148
- return t13;
149
- }
150
- function _temp2(action) {
151
- return action.id;
152
- }
153
- function _temp() {
154
- return true;
155
- }
156
-
157
- //#endregion
158
- export { LocalhostPreviewProvider };