camox 0.3.0 → 0.3.1

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 (69) hide show
  1. package/dist/components/AuthGate.js +2 -1
  2. package/dist/core/components/AddBlockControlBar.js +117 -44
  3. package/dist/core/components/lexical/InlineContentEditable.js +37 -17
  4. package/dist/core/components/lexical/InlineLexicalEditor.js +84 -25
  5. package/dist/core/components/lexical/SelectionBroadcaster.js +84 -47
  6. package/dist/core/components/lexical/SidebarLexicalEditor.js +54 -19
  7. package/dist/core/createBlock.js +1172 -414
  8. package/dist/core/createLayout.js +48 -16
  9. package/dist/core/hooks/useFieldSelection.js +24 -13
  10. package/dist/core/hooks/useIsEditable.js +8 -2
  11. package/dist/core/hooks/useOverlayMessage.js +51 -20
  12. package/dist/features/content/CamoxContent.js +239 -107
  13. package/dist/features/content/components/AssetCard.js +78 -16
  14. package/dist/features/content/components/AssetCardSkeleton.js +11 -4
  15. package/dist/features/content/components/ContentSidebar.js +15 -8
  16. package/dist/features/content/components/UploadDropZone.js +77 -34
  17. package/dist/features/content/components/UploadProgressDrawer.js +201 -58
  18. package/dist/features/metadata/sitemap.js +15 -0
  19. package/dist/features/preview/CamoxPreview.js +447 -179
  20. package/dist/features/preview/components/AddBlockSheet.js +344 -167
  21. package/dist/features/preview/components/AgentChatSheet.js +32 -10
  22. package/dist/features/preview/components/AssetFieldEditor.js +185 -50
  23. package/dist/features/preview/components/AssetLightbox.js +60 -33
  24. package/dist/features/preview/components/AssetPickerGrid.js +203 -71
  25. package/dist/features/preview/components/BlockActionsPopover.js +295 -218
  26. package/dist/features/preview/components/CreatePageSheet.js +3 -3
  27. package/dist/features/preview/components/DebouncedFieldEditor.js +80 -23
  28. package/dist/features/preview/components/EditPageSheet.js +241 -86
  29. package/dist/features/preview/components/ItemFieldsEditor.js +209 -115
  30. package/dist/features/preview/components/LinkFieldEditor.js +351 -153
  31. package/dist/features/preview/components/MultipleAssetFieldEditor.js +245 -92
  32. package/dist/features/preview/components/OverlayTracker.js +58 -23
  33. package/dist/features/preview/components/Overlays.js +85 -43
  34. package/dist/features/preview/components/PageContentSheet.js +18 -18
  35. package/dist/features/preview/components/PageLocationFieldset.js +229 -63
  36. package/dist/features/preview/components/PagePicker.js +27 -27
  37. package/dist/features/preview/components/PageTree.js +921 -319
  38. package/dist/features/preview/components/PeekedBlock.js +173 -63
  39. package/dist/features/preview/components/PreviewPanel.js +271 -148
  40. package/dist/features/preview/components/PreviewSideSheet.js +44 -11
  41. package/dist/features/preview/components/PreviewToolbar.js +262 -59
  42. package/dist/features/preview/components/RepeatableItemsList.js +187 -78
  43. package/dist/features/preview/components/ShikiMarkdown.js +46 -20
  44. package/dist/features/preview/components/TextFormatToolbar.js +81 -23
  45. package/dist/features/preview/components/UnlinkAssetButton.js +161 -40
  46. package/dist/features/preview/components/useUpdateBlockPosition.js +64 -47
  47. package/dist/features/preview/previewStore.d.ts +2 -2
  48. package/dist/features/provider/CamoxProvider.js +69 -21
  49. package/dist/features/provider/actionsStore.d.ts +2 -2
  50. package/dist/features/provider/components/CamoxAppContext.js +15 -5
  51. package/dist/features/provider/components/CommandPalette.js +199 -92
  52. package/dist/features/provider/useAdminShortcuts.js +80 -64
  53. package/dist/features/routes/pageRoute.js +8 -1
  54. package/dist/features/studio/CamoxStudio.js +45 -9
  55. package/dist/features/studio/components/EnvironmentMenu.js +47 -12
  56. package/dist/features/studio/components/Navbar.js +163 -65
  57. package/dist/features/studio/components/ProjectMenu.js +263 -82
  58. package/dist/features/studio/components/UserButton.js +21 -6
  59. package/dist/features/studio/studioStore.d.ts +2 -2
  60. package/dist/features/studio/useTheme.js +128 -74
  61. package/dist/hooks/use-file-upload.js +11 -11
  62. package/dist/hooks/use-marquee-selection.js +121 -74
  63. package/dist/lib/auth.js +95 -51
  64. package/dist/lib/normalized-data.js +103 -30
  65. package/dist/lib/use-project-room.js +55 -22
  66. package/dist/studio.css +2 -2
  67. package/package.json +29 -26
  68. package/dist/lib/auth.d.ts +0 -2130
  69. package/dist/lib/auth.d.ts.map +0 -1
@@ -9,6 +9,7 @@ import { AuthGate } from "../../components/AuthGate.js";
9
9
  import { useProjectRoom } from "../../lib/use-project-room.js";
10
10
  import { CommandPalette, useCommandPaletteActions } from "./components/CommandPalette.js";
11
11
  import { useAdminShortcuts } from "./useAdminShortcuts.js";
12
+ import { c } from "react/compiler-runtime";
12
13
  import { Toaster } from "@camox/ui/toaster";
13
14
  import { useQuery } from "@tanstack/react-query";
14
15
  import * as React from "react";
@@ -16,7 +17,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
17
  import { ReactQueryDevtools } from "@tanstack/react-query-devtools/production";
17
18
  import studioCssUrl from "virtual:camox-studio-css";
18
19
  //#region src/features/provider/CamoxProvider.tsx
19
- var AuthenticatedCamoxProvider = ({ children }) => {
20
+ var AuthenticatedCamoxProvider = (t0) => {
21
+ const $ = c(8);
22
+ const { children } = t0;
20
23
  useAdminShortcuts();
21
24
  useCommandPaletteActions();
22
25
  useThemeActions();
@@ -24,32 +27,77 @@ var AuthenticatedCamoxProvider = ({ children }) => {
24
27
  useNavbarActions();
25
28
  usePreviewPagesActions();
26
29
  const { apiUrl, projectSlug } = React.useContext(AuthContext);
27
- const { data: project } = useQuery(projectQueries.getBySlug(projectSlug));
30
+ let t1;
31
+ if ($[0] !== projectSlug) {
32
+ t1 = projectQueries.getBySlug(projectSlug);
33
+ $[0] = projectSlug;
34
+ $[1] = t1;
35
+ } else t1 = $[1];
36
+ const { data: project } = useQuery(t1);
28
37
  useProjectRoom(apiUrl, project?.id);
29
38
  const { theme } = useTheme();
30
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31
- children,
32
- /* @__PURE__ */ jsx(Toaster, { theme }),
33
- /* @__PURE__ */ jsx(CommandPalette, {})
34
- ] });
39
+ let t2;
40
+ if ($[2] !== theme) {
41
+ t2 = /* @__PURE__ */ jsx(Toaster, { theme });
42
+ $[2] = theme;
43
+ $[3] = t2;
44
+ } else t2 = $[3];
45
+ let t3;
46
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
47
+ t3 = /* @__PURE__ */ jsx(CommandPalette, {});
48
+ $[4] = t3;
49
+ } else t3 = $[4];
50
+ let t4;
51
+ if ($[5] !== children || $[6] !== t2) {
52
+ t4 = /* @__PURE__ */ jsxs(Fragment, { children: [
53
+ children,
54
+ t2,
55
+ t3
56
+ ] });
57
+ $[5] = children;
58
+ $[6] = t2;
59
+ $[7] = t4;
60
+ } else t4 = $[7];
61
+ return t4;
35
62
  };
36
- var UnauthenticatedCamoxProvider = ({ children }) => {
63
+ var UnauthenticatedCamoxProvider = (t0) => {
64
+ const $ = c(7);
65
+ const { children } = t0;
37
66
  const signInRedirect = useSignInRedirect();
38
67
  const { authenticationUrl } = useAuthContext();
39
- React.useEffect(() => {
40
- const handleKeyDown = (event) => {
41
- if ((event.metaKey || event.ctrlKey) && event.key === "Escape") {
42
- event.preventDefault();
43
- signInRedirect();
44
- }
68
+ let t1;
69
+ if ($[0] !== signInRedirect) {
70
+ t1 = () => {
71
+ const handleKeyDown = (event) => {
72
+ if ((event.metaKey || event.ctrlKey) && event.key === "Escape") {
73
+ event.preventDefault();
74
+ signInRedirect();
75
+ }
76
+ };
77
+ document.addEventListener("keydown", handleKeyDown);
78
+ return () => document.removeEventListener("keydown", handleKeyDown);
45
79
  };
46
- document.addEventListener("keydown", handleKeyDown);
47
- return () => document.removeEventListener("keydown", handleKeyDown);
48
- }, [signInRedirect, authenticationUrl]);
49
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
50
- className: "bg-background min-h-screen",
51
- children
52
- }) });
80
+ $[0] = signInRedirect;
81
+ $[1] = t1;
82
+ } else t1 = $[1];
83
+ let t2;
84
+ if ($[2] !== authenticationUrl || $[3] !== signInRedirect) {
85
+ t2 = [signInRedirect, authenticationUrl];
86
+ $[2] = authenticationUrl;
87
+ $[3] = signInRedirect;
88
+ $[4] = t2;
89
+ } else t2 = $[4];
90
+ React.useEffect(t1, t2);
91
+ let t3;
92
+ if ($[5] !== children) {
93
+ t3 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
94
+ className: "bg-background min-h-screen",
95
+ children
96
+ }) });
97
+ $[5] = children;
98
+ $[6] = t3;
99
+ } else t3 = $[6];
100
+ return t3;
53
101
  };
54
102
  function CamoxProvider({ children, camoxApp, authenticationUrl, apiUrl, projectSlug, environmentName }) {
55
103
  const authClient = React.useMemo(() => createCamoxAuthClient(apiUrl), [apiUrl]);
@@ -16,7 +16,7 @@ export interface Action {
16
16
  }
17
17
  export declare const actionsStore: import('@xstate/store').Store<{
18
18
  actions: Action[];
19
- }, import('@xstate/store').ExtractEvents<{
19
+ }, {
20
20
  registerAction: {
21
21
  action: Action;
22
22
  };
@@ -29,7 +29,7 @@ export declare const actionsStore: import('@xstate/store').Store<{
29
29
  unregisterManyActions: {
30
30
  ids: string[];
31
31
  };
32
- }>, {
32
+ }, {
33
33
  type: string;
34
34
  }>;
35
35
  //# sourceMappingURL=actionsStore.d.ts.map
@@ -1,12 +1,22 @@
1
+ import { c } from "react/compiler-runtime";
1
2
  import * as React from "react";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  //#region src/features/provider/components/CamoxAppContext.tsx
4
5
  var CamoxAppContext = React.createContext(void 0);
5
- var CamoxAppProvider = ({ app, children }) => {
6
- return /* @__PURE__ */ jsx(CamoxAppContext.Provider, {
7
- value: app,
8
- children
9
- });
6
+ var CamoxAppProvider = (t0) => {
7
+ const $ = c(3);
8
+ const { app, children } = t0;
9
+ let t1;
10
+ if ($[0] !== app || $[1] !== children) {
11
+ t1 = /* @__PURE__ */ jsx(CamoxAppContext.Provider, {
12
+ value: app,
13
+ children
14
+ });
15
+ $[0] = app;
16
+ $[1] = children;
17
+ $[2] = t1;
18
+ } else t1 = $[2];
19
+ return t1;
10
20
  };
11
21
  function useCamoxApp() {
12
22
  const context = React.use(CamoxAppContext);
@@ -1,119 +1,226 @@
1
1
  import { actionsStore } from "../actionsStore.js";
2
2
  import { formatShortcut } from "../../../lib/utils.js";
3
3
  import { studioStore } from "../../studio/studioStore.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { useSelector } from "@xstate/store/react";
5
6
  import * as React from "react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
8
  import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@camox/ui/command";
8
9
  //#region src/features/provider/components/CommandPalette.tsx
9
10
  function CommandPalette() {
10
- const isOpen = useSelector(studioStore, (state) => state.context.isCommandPaletteOpen);
11
+ const $ = c(33);
12
+ const isOpen = useSelector(studioStore, _temp);
11
13
  const [search, setSearch] = React.useState("");
12
14
  const [value, setValue] = React.useState("");
13
- const actions = useSelector(actionsStore, (state) => state.context.actions);
14
- const page = useSelector(studioStore, (state) => state.context.commandPalettePages).at(-1);
15
- const groupedActions = React.useMemo(() => {
16
- const availableActions = actions.filter((action) => {
17
- if (!action.checkIfAvailable()) return false;
18
- if (action.groupLabel === "Invisible") return false;
19
- if (page) return action.parentActionId === page;
20
- if (search.length > 0) return true;
21
- return !action.parentActionId;
22
- });
23
- const groups = /* @__PURE__ */ new Map();
24
- for (const action of availableActions) {
25
- const existing = groups.get(action.groupLabel) || [];
26
- groups.set(action.groupLabel, [...existing, action]);
15
+ const actions = useSelector(actionsStore, _temp2);
16
+ const pages = useSelector(studioStore, _temp3);
17
+ let t0;
18
+ if ($[0] !== pages) {
19
+ t0 = pages.at(-1);
20
+ $[0] = pages;
21
+ $[1] = t0;
22
+ } else t0 = $[1];
23
+ const page = t0;
24
+ let groups;
25
+ if ($[2] !== actions || $[3] !== page || $[4] !== search) {
26
+ let t1;
27
+ if ($[6] !== page || $[7] !== search) {
28
+ t1 = (action) => {
29
+ if (!action.checkIfAvailable()) return false;
30
+ if (action.groupLabel === "Invisible") return false;
31
+ if (page) return action.parentActionId === page;
32
+ if (search.length > 0) return true;
33
+ return !action.parentActionId;
34
+ };
35
+ $[6] = page;
36
+ $[7] = search;
37
+ $[8] = t1;
38
+ } else t1 = $[8];
39
+ const availableActions = actions.filter(t1);
40
+ groups = /* @__PURE__ */ new Map();
41
+ for (const action_0 of availableActions) {
42
+ const existing = groups.get(action_0.groupLabel) || [];
43
+ groups.set(action_0.groupLabel, [...existing, action_0]);
27
44
  }
28
- const groupOrder = [
45
+ $[2] = actions;
46
+ $[3] = page;
47
+ $[4] = search;
48
+ $[5] = groups;
49
+ } else groups = $[5];
50
+ let t1;
51
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
52
+ t1 = [
29
53
  "Preview",
30
54
  "Navigation",
31
55
  "Studio"
32
56
  ];
33
- const sortedGroups = /* @__PURE__ */ new Map();
57
+ $[9] = t1;
58
+ } else t1 = $[9];
59
+ const groupOrder = t1;
60
+ let sortedGroups;
61
+ if ($[10] !== groups) {
62
+ sortedGroups = /* @__PURE__ */ new Map();
34
63
  for (const groupLabel of groupOrder) if (groups.has(groupLabel)) sortedGroups.set(groupLabel, groups.get(groupLabel));
35
- return sortedGroups;
36
- }, [
37
- actions,
38
- page,
39
- search
40
- ]);
41
- React.useEffect(() => {
42
- if (page) {
43
- const firstChild = actions.find((a) => a.parentActionId === page && a.checkIfAvailable());
44
- if (firstChild) setValue(firstChild.id);
45
- }
46
- }, [page, actions]);
47
- const handleSelect = (actionId) => {
48
- const action = actions.find((a) => a.id === actionId);
49
- if (!action) return;
50
- action.execute();
51
- setSearch("");
52
- if (action.hasChildren) studioStore.send({
53
- type: "pushCommandPalettePage",
54
- page: action.id
55
- });
56
- else studioStore.send({ type: "closeCommandPalette" });
57
- };
58
- const handleOpenChange = (open) => {
59
- if (open) studioStore.send({ type: "openCommandPalette" });
60
- else {
61
- setValue("");
62
- studioStore.send({ type: "closeCommandPalette" });
63
- }
64
- };
65
- return /* @__PURE__ */ jsxs(CommandDialog, {
66
- open: isOpen,
67
- onOpenChange: handleOpenChange,
68
- value,
69
- onValueChange: setValue,
70
- children: [/* @__PURE__ */ jsx(CommandInput, {
64
+ $[10] = groups;
65
+ $[11] = sortedGroups;
66
+ } else sortedGroups = $[11];
67
+ const groupedActions = sortedGroups;
68
+ let t2;
69
+ let t3;
70
+ if ($[12] !== actions || $[13] !== page) {
71
+ t2 = () => {
72
+ if (page) {
73
+ const firstChild = actions.find((a) => a.parentActionId === page && a.checkIfAvailable());
74
+ if (firstChild) setValue(firstChild.id);
75
+ }
76
+ };
77
+ t3 = [page, actions];
78
+ $[12] = actions;
79
+ $[13] = page;
80
+ $[14] = t2;
81
+ $[15] = t3;
82
+ } else {
83
+ t2 = $[14];
84
+ t3 = $[15];
85
+ }
86
+ React.useEffect(t2, t3);
87
+ let t4;
88
+ if ($[16] !== actions) {
89
+ t4 = (actionId) => {
90
+ const action_1 = actions.find((a_0) => a_0.id === actionId);
91
+ if (!action_1) return;
92
+ action_1.execute();
93
+ setSearch("");
94
+ if (action_1.hasChildren) studioStore.send({
95
+ type: "pushCommandPalettePage",
96
+ page: action_1.id
97
+ });
98
+ else studioStore.send({ type: "closeCommandPalette" });
99
+ };
100
+ $[16] = actions;
101
+ $[17] = t4;
102
+ } else t4 = $[17];
103
+ const handleSelect = t4;
104
+ let t5;
105
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
106
+ t5 = (open) => {
107
+ if (open) studioStore.send({ type: "openCommandPalette" });
108
+ else {
109
+ setValue("");
110
+ studioStore.send({ type: "closeCommandPalette" });
111
+ }
112
+ };
113
+ $[18] = t5;
114
+ } else t5 = $[18];
115
+ const handleOpenChange = t5;
116
+ let t6;
117
+ if ($[19] !== search) {
118
+ t6 = (e) => {
119
+ if (e.key === "Escape" || e.key === "Backspace" && !search) {
120
+ e.preventDefault();
121
+ studioStore.send({ type: "popCommandPalettePage" });
122
+ }
123
+ };
124
+ $[19] = search;
125
+ $[20] = t6;
126
+ } else t6 = $[20];
127
+ let t7;
128
+ if ($[21] !== search || $[22] !== t6) {
129
+ t7 = /* @__PURE__ */ jsx(CommandInput, {
71
130
  value: search,
72
131
  onValueChange: setSearch,
73
132
  placeholder: "Type a command or search...",
74
- onKeyDown: (e) => {
75
- if (e.key === "Escape" || e.key === "Backspace" && !search) {
76
- e.preventDefault();
77
- studioStore.send({ type: "popCommandPalettePage" });
78
- }
79
- }
80
- }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }), Array.from(groupedActions.entries()).map(([groupLabel, groupActions]) => /* @__PURE__ */ jsx(CommandGroup, {
81
- heading: groupLabel,
82
- children: groupActions.map((action) => {
83
- return /* @__PURE__ */ jsxs(CommandItem, {
84
- onSelect: () => handleSelect(action.id),
133
+ onKeyDown: t6
134
+ });
135
+ $[21] = search;
136
+ $[22] = t6;
137
+ $[23] = t7;
138
+ } else t7 = $[23];
139
+ let t8;
140
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
141
+ t8 = /* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." });
142
+ $[24] = t8;
143
+ } else t8 = $[24];
144
+ let t9;
145
+ if ($[25] !== groupedActions || $[26] !== handleSelect) {
146
+ t9 = /* @__PURE__ */ jsxs(CommandList, { children: [t8, Array.from(groupedActions.entries()).map((t10) => {
147
+ const [groupLabel_0, groupActions] = t10;
148
+ return /* @__PURE__ */ jsx(CommandGroup, {
149
+ heading: groupLabel_0,
150
+ children: groupActions.map((action_2) => /* @__PURE__ */ jsxs(CommandItem, {
151
+ onSelect: () => handleSelect(action_2.id),
85
152
  className: "justify-between",
86
- children: [action.label, action.shortcut && formatShortcut(action.shortcut)]
87
- }, action.id);
88
- })
89
- }, groupLabel))] })]
90
- });
153
+ children: [action_2.label, action_2.shortcut && formatShortcut(action_2.shortcut)]
154
+ }, action_2.id))
155
+ }, groupLabel_0);
156
+ })] });
157
+ $[25] = groupedActions;
158
+ $[26] = handleSelect;
159
+ $[27] = t9;
160
+ } else t9 = $[27];
161
+ let t10;
162
+ if ($[28] !== isOpen || $[29] !== t7 || $[30] !== t9 || $[31] !== value) {
163
+ t10 = /* @__PURE__ */ jsxs(CommandDialog, {
164
+ open: isOpen,
165
+ onOpenChange: handleOpenChange,
166
+ value,
167
+ onValueChange: setValue,
168
+ children: [t7, t9]
169
+ });
170
+ $[28] = isOpen;
171
+ $[29] = t7;
172
+ $[30] = t9;
173
+ $[31] = value;
174
+ $[32] = t10;
175
+ } else t10 = $[32];
176
+ return t10;
177
+ }
178
+ function _temp3(state_1) {
179
+ return state_1.context.commandPalettePages;
180
+ }
181
+ function _temp2(state_0) {
182
+ return state_0.context.actions;
183
+ }
184
+ function _temp(state) {
185
+ return state.context.isCommandPaletteOpen;
91
186
  }
92
187
  function useCommandPaletteActions() {
93
- React.useEffect(() => {
94
- actionsStore.send({
95
- type: "registerAction",
96
- action: {
97
- id: "toggle-command-palette",
98
- label: "Toggle command palette",
99
- groupLabel: "Invisible",
100
- checkIfAvailable: () => true,
101
- execute: () => {
102
- studioStore.send({ type: "toggleCommandPalette" });
103
- },
104
- shortcut: {
105
- key: "k",
106
- withMeta: true
107
- }
188
+ const $ = c(1);
189
+ let t0;
190
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
191
+ t0 = [];
192
+ $[0] = t0;
193
+ } else t0 = $[0];
194
+ React.useEffect(_temp7, t0);
195
+ }
196
+ function _temp7() {
197
+ actionsStore.send({
198
+ type: "registerAction",
199
+ action: {
200
+ id: "toggle-command-palette",
201
+ label: "Toggle command palette",
202
+ groupLabel: "Invisible",
203
+ checkIfAvailable: _temp4,
204
+ execute: _temp5,
205
+ shortcut: {
206
+ key: "k",
207
+ withMeta: true
108
208
  }
109
- });
110
- return () => {
111
- actionsStore.send({
112
- type: "unregisterAction",
113
- id: "toggle-command-palette"
114
- });
115
- };
116
- }, []);
209
+ }
210
+ });
211
+ return _temp6;
212
+ }
213
+ function _temp6() {
214
+ actionsStore.send({
215
+ type: "unregisterAction",
216
+ id: "toggle-command-palette"
217
+ });
218
+ }
219
+ function _temp5() {
220
+ studioStore.send({ type: "toggleCommandPalette" });
221
+ }
222
+ function _temp4() {
223
+ return true;
117
224
  }
118
225
  //#endregion
119
226
  export { CommandPalette, useCommandPaletteActions };
@@ -1,6 +1,7 @@
1
1
  import { previewStore } from "../preview/previewStore.js";
2
2
  import { actionsStore } from "./actionsStore.js";
3
3
  import { checkIfInputFocused } from "../../lib/utils.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { useSelector } from "@xstate/store/react";
5
6
  import * as React from "react";
6
7
  //#region src/features/provider/useAdminShortcuts.tsx
@@ -8,76 +9,91 @@ import * as React from "react";
8
9
  * Hook that listens for global keyboard shortcuts defined in the actionsStore
9
10
  */
10
11
  function useAdminShortcuts() {
11
- const actions = useSelector(actionsStore, (state) => state.context.actions);
12
+ const $ = c(3);
13
+ const actions = useSelector(actionsStore, _temp);
12
14
  const previousLockState = React.useRef(null);
13
15
  const lockKeyDownTime = React.useRef(null);
14
- const HOLD_THRESHOLD_MS = 300;
15
- React.useEffect(() => {
16
- const handleKeyDown = (event) => {
17
- if (event.key.toLowerCase() === "l" && !event.metaKey && !event.altKey && !event.shiftKey) {
18
- if (event.repeat) return;
19
- if (checkIfInputFocused()) return;
16
+ let t0;
17
+ let t1;
18
+ if ($[0] !== actions) {
19
+ t0 = () => {
20
+ const handleKeyDown = (event) => {
21
+ if (event.key.toLowerCase() === "l" && !event.metaKey && !event.altKey && !event.shiftKey) {
22
+ if (event.repeat) return;
23
+ if (checkIfInputFocused()) return;
24
+ event.preventDefault();
25
+ if (previousLockState.current === null) {
26
+ lockKeyDownTime.current = Date.now();
27
+ previousLockState.current = previewStore.getSnapshot().context.isContentLocked;
28
+ if (!previousLockState.current) previewStore.send({ type: "toggleLockContent" });
29
+ }
30
+ return;
31
+ }
32
+ const matchingAction = actions.find((action) => {
33
+ if (!action.shortcut) return false;
34
+ if (!action.checkIfAvailable()) return false;
35
+ const { key, withMeta, withAlt, withShift } = action.shortcut;
36
+ return (withAlt && key.length === 1 && /[a-z]/i.test(key) ? event.code === `Key${key.toUpperCase()}` : key.toLowerCase() === event.key.toLowerCase()) && !!withMeta === (event.metaKey || event.ctrlKey) && !!withAlt === event.altKey && !!withShift === event.shiftKey;
37
+ });
38
+ if (!matchingAction) return;
39
+ const shortcut = matchingAction.shortcut;
40
+ if (checkIfInputFocused()) {
41
+ if (!shortcut.withMeta && !shortcut.withAlt) return;
42
+ if (shortcut.key === "Backspace") return;
43
+ }
20
44
  event.preventDefault();
21
- if (previousLockState.current === null) {
22
- lockKeyDownTime.current = Date.now();
23
- previousLockState.current = previewStore.getSnapshot().context.isContentLocked;
24
- if (!previousLockState.current) previewStore.send({ type: "toggleLockContent" });
45
+ matchingAction.execute();
46
+ };
47
+ const handleKeyUp = (event_0) => {
48
+ if (event_0.key.toLowerCase() === "l") releaseLock();
49
+ };
50
+ const releaseLock = () => {
51
+ if (previousLockState.current === null) return;
52
+ const holdDuration = lockKeyDownTime.current !== null ? Date.now() - lockKeyDownTime.current : Infinity;
53
+ lockKeyDownTime.current = null;
54
+ if ((holdDuration < 300 ? !previousLockState.current : previousLockState.current) !== previewStore.getSnapshot().context.isContentLocked) previewStore.send({ type: "toggleLockContent" });
55
+ previousLockState.current = null;
56
+ };
57
+ const handleMessage = (event_1) => {
58
+ if (event_1.data?.type === "holdLockContent") {
59
+ if (previousLockState.current === null) {
60
+ lockKeyDownTime.current = Date.now();
61
+ previousLockState.current = previewStore.getSnapshot().context.isContentLocked;
62
+ if (!previousLockState.current) previewStore.send({ type: "toggleLockContent" });
63
+ }
64
+ return;
25
65
  }
26
- return;
27
- }
28
- const matchingAction = actions.find((action) => {
29
- if (!action.shortcut) return false;
30
- if (!action.checkIfAvailable()) return false;
31
- const { key, withMeta, withAlt, withShift } = action.shortcut;
32
- return (withAlt && key.length === 1 && /[a-z]/i.test(key) ? event.code === `Key${key.toUpperCase()}` : key.toLowerCase() === event.key.toLowerCase()) && !!withMeta === (event.metaKey || event.ctrlKey) && !!withAlt === event.altKey && !!withShift === event.shiftKey;
33
- });
34
- if (!matchingAction) return;
35
- const shortcut = matchingAction.shortcut;
36
- if (checkIfInputFocused()) {
37
- if (!shortcut.withMeta && !shortcut.withAlt) return;
38
- if (shortcut.key === "Backspace") return;
39
- }
40
- event.preventDefault();
41
- matchingAction.execute();
42
- };
43
- const handleKeyUp = (event) => {
44
- if (event.key.toLowerCase() === "l") releaseLock();
45
- };
46
- const releaseLock = () => {
47
- if (previousLockState.current === null) return;
48
- const holdDuration = lockKeyDownTime.current !== null ? Date.now() - lockKeyDownTime.current : Infinity;
49
- lockKeyDownTime.current = null;
50
- if ((holdDuration < HOLD_THRESHOLD_MS ? !previousLockState.current : previousLockState.current) !== previewStore.getSnapshot().context.isContentLocked) previewStore.send({ type: "toggleLockContent" });
51
- previousLockState.current = null;
52
- };
53
- const handleMessage = (event) => {
54
- if (event.data?.type === "holdLockContent") {
55
- if (previousLockState.current === null) {
56
- lockKeyDownTime.current = Date.now();
57
- previousLockState.current = previewStore.getSnapshot().context.isContentLocked;
58
- if (!previousLockState.current) previewStore.send({ type: "toggleLockContent" });
66
+ if (event_1.data?.type === "releaseLockContent") {
67
+ releaseLock();
68
+ return;
59
69
  }
60
- return;
61
- }
62
- if (event.data?.type === "releaseLockContent") {
63
- releaseLock();
64
- return;
65
- }
66
- if (event.data?.type === "executeAction") {
67
- const { actionId } = event.data;
68
- const action = actions.find((a) => a.id === actionId);
69
- if (action) action.execute();
70
- }
71
- };
72
- document.addEventListener("keydown", handleKeyDown);
73
- document.addEventListener("keyup", handleKeyUp);
74
- window.addEventListener("message", handleMessage);
75
- return () => {
76
- document.removeEventListener("keydown", handleKeyDown);
77
- document.removeEventListener("keyup", handleKeyUp);
78
- window.removeEventListener("message", handleMessage);
70
+ if (event_1.data?.type === "executeAction") {
71
+ const { actionId } = event_1.data;
72
+ const action_0 = actions.find((a) => a.id === actionId);
73
+ if (action_0) action_0.execute();
74
+ }
75
+ };
76
+ document.addEventListener("keydown", handleKeyDown);
77
+ document.addEventListener("keyup", handleKeyUp);
78
+ window.addEventListener("message", handleMessage);
79
+ return () => {
80
+ document.removeEventListener("keydown", handleKeyDown);
81
+ document.removeEventListener("keyup", handleKeyUp);
82
+ window.removeEventListener("message", handleMessage);
83
+ };
79
84
  };
80
- }, [actions]);
85
+ t1 = [actions];
86
+ $[0] = actions;
87
+ $[1] = t0;
88
+ $[2] = t1;
89
+ } else {
90
+ t0 = $[1];
91
+ t1 = $[2];
92
+ }
93
+ React.useEffect(t0, t1);
94
+ }
95
+ function _temp(state) {
96
+ return state.context.actions;
81
97
  }
82
98
  //#endregion
83
99
  export { useAdminShortcuts };
@@ -1,6 +1,7 @@
1
1
  import { seedBlockCaches } from "../../lib/normalized-data.js";
2
2
  import { CamoxPreview, PageContent } from "../preview/CamoxPreview.js";
3
3
  import { trackEvent } from "../../lib/analytics.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { queryKeys } from "@camox/api/query-keys";
6
7
  import { createORPCClient } from "@orpc/client";
@@ -139,7 +140,13 @@ function createPageHead(camoxApp) {
139
140
  };
140
141
  }
141
142
  var PageRouteComponent = () => {
142
- return /* @__PURE__ */ jsx(CamoxPreview, { children: /* @__PURE__ */ jsx(PageContent, {}) });
143
+ const $ = c(1);
144
+ let t0;
145
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
146
+ t0 = /* @__PURE__ */ jsx(CamoxPreview, { children: /* @__PURE__ */ jsx(PageContent, {}) });
147
+ $[0] = t0;
148
+ } else t0 = $[0];
149
+ return t0;
143
150
  };
144
151
  //#endregion
145
152
  export { PageRouteComponent, createMarkdownMiddleware, createPageHead, createPageLoader, getOrigin, parseQuality, prefersMarkdown };