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
|
@@ -10,11 +10,15 @@ function createLayout(options) {
|
|
|
10
10
|
const afterBlocks = options.blocks.after;
|
|
11
11
|
const initialBlocks = options.blocks.initial;
|
|
12
12
|
const BeforeBlocks = () => {
|
|
13
|
-
const $ = c(
|
|
13
|
+
const $ = c(5);
|
|
14
|
+
if ($[0] !== "99dd6e9ddef926bf72f275b7b443f91fba96158235831bafcf7d30a6ba3692d8") {
|
|
15
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
|
+
$[0] = "99dd6e9ddef926bf72f275b7b443f91fba96158235831bafcf7d30a6ba3692d8";
|
|
17
|
+
}
|
|
14
18
|
const ctx = React.use(LayoutContext);
|
|
15
19
|
if (!ctx) throw new Error(`Layout "${options.id}" BeforeBlocks must be rendered inside its Provider`);
|
|
16
20
|
let t0;
|
|
17
|
-
if ($[
|
|
21
|
+
if ($[1] !== ctx) {
|
|
18
22
|
t0 = beforeBlocks.map((block, i) => {
|
|
19
23
|
const blockData = ctx.layoutBlocks[block._internal.id];
|
|
20
24
|
if (!blockData) return null;
|
|
@@ -30,24 +34,28 @@ function createLayout(options) {
|
|
|
30
34
|
})
|
|
31
35
|
}, block._internal.id);
|
|
32
36
|
});
|
|
33
|
-
$[
|
|
34
|
-
$[
|
|
35
|
-
} else t0 = $[
|
|
37
|
+
$[1] = ctx;
|
|
38
|
+
$[2] = t0;
|
|
39
|
+
} else t0 = $[2];
|
|
36
40
|
let t1;
|
|
37
|
-
if ($[
|
|
41
|
+
if ($[3] !== t0) {
|
|
38
42
|
t1 = /* @__PURE__ */ jsx(Fragment, { children: t0 });
|
|
39
|
-
$[
|
|
40
|
-
$[
|
|
41
|
-
} else t1 = $[
|
|
43
|
+
$[3] = t0;
|
|
44
|
+
$[4] = t1;
|
|
45
|
+
} else t1 = $[4];
|
|
42
46
|
return t1;
|
|
43
47
|
};
|
|
44
48
|
BeforeBlocks.displayName = `LayoutBeforeBlocks(${options.id})`;
|
|
45
49
|
const AfterBlocks = () => {
|
|
46
|
-
const $ = c(
|
|
50
|
+
const $ = c(5);
|
|
51
|
+
if ($[0] !== "99dd6e9ddef926bf72f275b7b443f91fba96158235831bafcf7d30a6ba3692d8") {
|
|
52
|
+
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
53
|
+
$[0] = "99dd6e9ddef926bf72f275b7b443f91fba96158235831bafcf7d30a6ba3692d8";
|
|
54
|
+
}
|
|
47
55
|
const ctx = React.use(LayoutContext);
|
|
48
56
|
if (!ctx) throw new Error(`Layout "${options.id}" AfterBlocks must be rendered inside its Provider`);
|
|
49
57
|
let t0;
|
|
50
|
-
if ($[
|
|
58
|
+
if ($[1] !== ctx) {
|
|
51
59
|
t0 = afterBlocks.map((block, i) => {
|
|
52
60
|
const blockData = ctx.layoutBlocks[block._internal.id];
|
|
53
61
|
if (!blockData) return null;
|
|
@@ -63,38 +71,42 @@ function createLayout(options) {
|
|
|
63
71
|
})
|
|
64
72
|
}, block._internal.id);
|
|
65
73
|
});
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
} else t0 = $[
|
|
74
|
+
$[1] = ctx;
|
|
75
|
+
$[2] = t0;
|
|
76
|
+
} else t0 = $[2];
|
|
69
77
|
let t1;
|
|
70
|
-
if ($[
|
|
78
|
+
if ($[3] !== t0) {
|
|
71
79
|
t1 = /* @__PURE__ */ jsx(Fragment, { children: t0 });
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
} else t1 = $[
|
|
80
|
+
$[3] = t0;
|
|
81
|
+
$[4] = t1;
|
|
82
|
+
} else t1 = $[4];
|
|
75
83
|
return t1;
|
|
76
84
|
};
|
|
77
85
|
AfterBlocks.displayName = `LayoutAfterBlocks(${options.id})`;
|
|
78
86
|
const Provider = (t0) => {
|
|
79
|
-
const $ = c(
|
|
87
|
+
const $ = c(6);
|
|
88
|
+
if ($[0] !== "99dd6e9ddef926bf72f275b7b443f91fba96158235831bafcf7d30a6ba3692d8") {
|
|
89
|
+
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
90
|
+
$[0] = "99dd6e9ddef926bf72f275b7b443f91fba96158235831bafcf7d30a6ba3692d8";
|
|
91
|
+
}
|
|
80
92
|
const { layoutBlocks, children } = t0;
|
|
81
93
|
let t1;
|
|
82
|
-
if ($[
|
|
94
|
+
if ($[1] !== layoutBlocks) {
|
|
83
95
|
t1 = { layoutBlocks };
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
} else t1 = $[
|
|
96
|
+
$[1] = layoutBlocks;
|
|
97
|
+
$[2] = t1;
|
|
98
|
+
} else t1 = $[2];
|
|
87
99
|
const value = t1;
|
|
88
100
|
let t2;
|
|
89
|
-
if ($[
|
|
101
|
+
if ($[3] !== children || $[4] !== value) {
|
|
90
102
|
t2 = /* @__PURE__ */ jsx(LayoutContext.Provider, {
|
|
91
103
|
value,
|
|
92
104
|
children
|
|
93
105
|
});
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
} else t2 = $[
|
|
106
|
+
$[3] = children;
|
|
107
|
+
$[4] = value;
|
|
108
|
+
$[5] = t2;
|
|
109
|
+
} else t2 = $[5];
|
|
98
110
|
return t2;
|
|
99
111
|
};
|
|
100
112
|
const blockDefinitions = [...beforeBlocks.map((block) => {
|
|
@@ -9,9 +9,13 @@ import { useSelector } from "@xstate/store/react";
|
|
|
9
9
|
* Matches when the selection points to this exact field (type + name + optional repeater item).
|
|
10
10
|
*/
|
|
11
11
|
function useFieldSelection(blockId, fieldName, fieldType, repeaterItemId) {
|
|
12
|
-
const $ = c(
|
|
12
|
+
const $ = c(6);
|
|
13
|
+
if ($[0] !== "c83180daeb2b318128d16b794abbd2d75add5a0d5b928aaf42a4ec53f1be7b98") {
|
|
14
|
+
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
15
|
+
$[0] = "c83180daeb2b318128d16b794abbd2d75add5a0d5b928aaf42a4ec53f1be7b98";
|
|
16
|
+
}
|
|
13
17
|
let t0;
|
|
14
|
-
if ($[
|
|
18
|
+
if ($[1] !== blockId || $[2] !== fieldName || $[3] !== fieldType || $[4] !== repeaterItemId) {
|
|
15
19
|
t0 = (state) => {
|
|
16
20
|
const sel = state.context.selection;
|
|
17
21
|
if (!sel || sel.blockId !== blockId) return false;
|
|
@@ -25,12 +29,12 @@ function useFieldSelection(blockId, fieldName, fieldType, repeaterItemId) {
|
|
|
25
29
|
}
|
|
26
30
|
return false;
|
|
27
31
|
};
|
|
28
|
-
$[
|
|
29
|
-
$[
|
|
30
|
-
$[
|
|
31
|
-
$[
|
|
32
|
-
$[
|
|
33
|
-
} else t0 = $[
|
|
32
|
+
$[1] = blockId;
|
|
33
|
+
$[2] = fieldName;
|
|
34
|
+
$[3] = fieldType;
|
|
35
|
+
$[4] = repeaterItemId;
|
|
36
|
+
$[5] = t0;
|
|
37
|
+
} else t0 = $[5];
|
|
34
38
|
return useSelector(previewStore, t0);
|
|
35
39
|
}
|
|
36
40
|
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { previewStore } from "../../features/preview/previewStore.js";
|
|
2
2
|
import { useIsAuthenticated } from "../../lib/auth.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
3
4
|
import { useSelector } from "@xstate/store/react";
|
|
4
5
|
|
|
5
6
|
//#region src/core/hooks/useIsEditable.ts
|
|
6
7
|
function useIsEditable(mode) {
|
|
8
|
+
const $ = c(1);
|
|
9
|
+
if ($[0] !== "a238b8e080e05852b1cb210aa44077f2b223fb70fe72a3cb94571c87e1c28713") {
|
|
10
|
+
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
11
|
+
$[0] = "a238b8e080e05852b1cb210aa44077f2b223fb70fe72a3cb94571c87e1c28713";
|
|
12
|
+
}
|
|
7
13
|
const isAuthenticated = useIsAuthenticated();
|
|
8
14
|
const isPresentationMode = useSelector(previewStore, _temp);
|
|
9
15
|
const isContentLocked = useSelector(previewStore, _temp2);
|
|
@@ -11,18 +11,22 @@ import * as React from "react";
|
|
|
11
11
|
* `match` is undefined.
|
|
12
12
|
*/
|
|
13
13
|
function useOverlayMessage(iframeWindow, enabled, startType, endType, match) {
|
|
14
|
-
const $ = c(
|
|
14
|
+
const $ = c(10);
|
|
15
|
+
if ($[0] !== "054e151c2e2c2385d80749bd79af75fa91d1c017ccb12caf70e0f41df7360b1a") {
|
|
16
|
+
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
17
|
+
$[0] = "054e151c2e2c2385d80749bd79af75fa91d1c017ccb12caf70e0f41df7360b1a";
|
|
18
|
+
}
|
|
15
19
|
const [active, setActive] = React.useState(false);
|
|
16
20
|
let t0;
|
|
17
|
-
if ($[
|
|
21
|
+
if ($[1] !== match) {
|
|
18
22
|
t0 = JSON.stringify(match);
|
|
19
|
-
$[
|
|
20
|
-
$[
|
|
21
|
-
} else t0 = $[
|
|
23
|
+
$[1] = match;
|
|
24
|
+
$[2] = t0;
|
|
25
|
+
} else t0 = $[2];
|
|
22
26
|
const matchJson = t0;
|
|
23
27
|
let t1;
|
|
24
28
|
let t2;
|
|
25
|
-
if ($[
|
|
29
|
+
if ($[3] !== enabled || $[4] !== endType || $[5] !== iframeWindow || $[6] !== matchJson || $[7] !== startType) {
|
|
26
30
|
t1 = () => {
|
|
27
31
|
if (!enabled || !iframeWindow) return;
|
|
28
32
|
const matchEntries = Object.entries(JSON.parse(matchJson));
|
|
@@ -47,16 +51,16 @@ function useOverlayMessage(iframeWindow, enabled, startType, endType, match) {
|
|
|
47
51
|
endType,
|
|
48
52
|
matchJson
|
|
49
53
|
];
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
54
|
+
$[3] = enabled;
|
|
55
|
+
$[4] = endType;
|
|
56
|
+
$[5] = iframeWindow;
|
|
57
|
+
$[6] = matchJson;
|
|
58
|
+
$[7] = startType;
|
|
59
|
+
$[8] = t1;
|
|
60
|
+
$[9] = t2;
|
|
57
61
|
} else {
|
|
58
|
-
t1 = $[
|
|
59
|
-
t2 = $[
|
|
62
|
+
t1 = $[8];
|
|
63
|
+
t2 = $[9];
|
|
60
64
|
}
|
|
61
65
|
React.useEffect(t1, t2);
|
|
62
66
|
return active;
|
|
@@ -24,7 +24,7 @@ declare class Conditional {
|
|
|
24
24
|
}
|
|
25
25
|
type ConditionalChild = string | FieldToken | Conditional;
|
|
26
26
|
type ConditionalLines = ConditionalChild | ReadonlyArray<ConditionalChild>;
|
|
27
|
-
type ContentProxy<TShape extends Record<string, TSchema>> = { [K in keyof TShape & string]: FieldToken };
|
|
27
|
+
type ContentProxy<TShape extends Record<string, TSchema>> = { [K in keyof TShape & string]: string & FieldToken };
|
|
28
28
|
/**
|
|
29
29
|
* Callable shape for one entry on the settings proxy. Booleans take a single `lines`
|
|
30
30
|
* argument; enums take `(value, lines)`. Settings of other shapes are disallowed — they
|
|
@@ -72,6 +72,10 @@ type FileValue = {
|
|
|
72
72
|
} & {
|
|
73
73
|
readonly __brand: "FileValue";
|
|
74
74
|
};
|
|
75
|
+
declare function _imageType(options: {
|
|
76
|
+
title?: string;
|
|
77
|
+
multiple?: false;
|
|
78
|
+
}): TUnsafe<ImageValue>;
|
|
75
79
|
declare function _imageType(options: {
|
|
76
80
|
title?: string;
|
|
77
81
|
multiple: true;
|
|
@@ -79,10 +83,11 @@ declare function _imageType(options: {
|
|
|
79
83
|
}): TArray<TObject<{
|
|
80
84
|
image: TUnsafe<ImageValue>;
|
|
81
85
|
}>>;
|
|
82
|
-
declare function
|
|
86
|
+
declare function _fileType(options: {
|
|
87
|
+
accept: string[];
|
|
83
88
|
title?: string;
|
|
84
89
|
multiple?: false;
|
|
85
|
-
}): TUnsafe<
|
|
90
|
+
}): TUnsafe<FileValue>;
|
|
86
91
|
declare function _fileType(options: {
|
|
87
92
|
accept: string[];
|
|
88
93
|
title?: string;
|
|
@@ -91,11 +96,6 @@ declare function _fileType(options: {
|
|
|
91
96
|
}): TArray<TObject<{
|
|
92
97
|
file: TUnsafe<FileValue>;
|
|
93
98
|
}>>;
|
|
94
|
-
declare function _fileType(options: {
|
|
95
|
-
accept: string[];
|
|
96
|
-
title?: string;
|
|
97
|
-
multiple?: false;
|
|
98
|
-
}): TUnsafe<FileValue>;
|
|
99
99
|
/**
|
|
100
100
|
* Type builders for createBlock content schemas.
|
|
101
101
|
* All fields must have default values.
|
|
@@ -129,6 +129,13 @@ function _fileType(options) {
|
|
|
129
129
|
* All fields must have default values.
|
|
130
130
|
*/
|
|
131
131
|
const Type$1 = {
|
|
132
|
+
/**
|
|
133
|
+
* Creates a string field with a required default value.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* Type.String({ default: 'Hello' })
|
|
137
|
+
* Type.String({ default: 'Hello', maxLength: 100, title: 'Title' })
|
|
138
|
+
*/
|
|
132
139
|
String: (options) => {
|
|
133
140
|
return Type.Unsafe({
|
|
134
141
|
type: "string",
|
|
@@ -137,6 +144,29 @@ const Type$1 = {
|
|
|
137
144
|
fieldType: "String"
|
|
138
145
|
});
|
|
139
146
|
},
|
|
147
|
+
/**
|
|
148
|
+
* Creates a repeatable array of object items.
|
|
149
|
+
* The default array is auto-generated based on minItems.
|
|
150
|
+
*
|
|
151
|
+
* Items may also declare per-item `settings` (Enum/Boolean only) — not
|
|
152
|
+
* inline-editable; they appear in the sidebar when the item is selected,
|
|
153
|
+
* similar to block-level settings.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* Type.RepeatableItem({
|
|
157
|
+
* content: {
|
|
158
|
+
* title: Type.String({ default: 'Item' }),
|
|
159
|
+
* description: Type.String({ default: 'Description' }),
|
|
160
|
+
* },
|
|
161
|
+
* settings: {
|
|
162
|
+
* highlighted: Type.Boolean({ default: false, title: 'Highlighted' }),
|
|
163
|
+
* },
|
|
164
|
+
* minItems: 1,
|
|
165
|
+
* maxItems: 10,
|
|
166
|
+
* title: 'Items',
|
|
167
|
+
* toMarkdown: (c) => [`### ${c.title}`, c.description],
|
|
168
|
+
* })
|
|
169
|
+
*/
|
|
140
170
|
RepeatableItem: (options) => {
|
|
141
171
|
if (options.minItems < 1) throw new Error("RepeatableItem requires minItems to be at least 1");
|
|
142
172
|
const objectSchema = Type.Object(options.content);
|
|
@@ -164,6 +194,16 @@ const Type$1 = {
|
|
|
164
194
|
defaultItemSettings: settingsTypeboxSchema ? defaultItemSettings : void 0
|
|
165
195
|
});
|
|
166
196
|
},
|
|
197
|
+
/**
|
|
198
|
+
* Creates an enum field with a set of predefined options.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* Type.Enum({
|
|
202
|
+
* default: 'left',
|
|
203
|
+
* options: { left: 'Left', center: 'Center', right: 'Right' },
|
|
204
|
+
* title: 'Alignment'
|
|
205
|
+
* })
|
|
206
|
+
*/
|
|
167
207
|
Enum: (options) => {
|
|
168
208
|
const enumValues = Object.keys(options.options);
|
|
169
209
|
return Type.Unsafe({
|
|
@@ -175,6 +215,12 @@ const Type$1 = {
|
|
|
175
215
|
fieldType: "Enum"
|
|
176
216
|
});
|
|
177
217
|
},
|
|
218
|
+
/**
|
|
219
|
+
* Creates a boolean toggle field.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* Type.Boolean({ default: false, title: 'Show background' })
|
|
223
|
+
*/
|
|
178
224
|
Boolean: (options) => {
|
|
179
225
|
return Type.Boolean({
|
|
180
226
|
default: options.default,
|
|
@@ -182,6 +228,16 @@ const Type$1 = {
|
|
|
182
228
|
fieldType: "Boolean"
|
|
183
229
|
});
|
|
184
230
|
},
|
|
231
|
+
/**
|
|
232
|
+
* Creates an embed field for URLs matching a specific pattern.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* Type.Embed({
|
|
236
|
+
* pattern: 'https:\\/\\/(www\\.)?youtube\\.com\\/watch\\?v=.+',
|
|
237
|
+
* default: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
|
238
|
+
* title: 'YouTube URL'
|
|
239
|
+
* })
|
|
240
|
+
*/
|
|
185
241
|
Embed: (options) => {
|
|
186
242
|
if (!new RegExp(options.pattern).test(options.default)) throw new Error(`Embed default value "${options.default}" does not match pattern "${options.pattern}"`);
|
|
187
243
|
return Type.Unsafe({
|
|
@@ -192,6 +248,13 @@ const Type$1 = {
|
|
|
192
248
|
fieldType: "Embed"
|
|
193
249
|
});
|
|
194
250
|
},
|
|
251
|
+
/**
|
|
252
|
+
* Creates a link field with text, href/pageId, and newTab properties.
|
|
253
|
+
* Supports both external URLs and internal page links.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* Type.Link({ default: { text: 'Learn more', href: '/', newTab: false }, title: 'CTA' })
|
|
257
|
+
*/
|
|
195
258
|
Link: (options) => {
|
|
196
259
|
return Type.Unsafe({
|
|
197
260
|
type: "object",
|
|
@@ -18,71 +18,75 @@ import { FloatingToolbar } from "@camox/ui/floating-toolbar";
|
|
|
18
18
|
|
|
19
19
|
//#region src/features/content/CamoxContent.tsx
|
|
20
20
|
const CamoxContent = () => {
|
|
21
|
-
const $ = c(
|
|
21
|
+
const $ = c(50);
|
|
22
|
+
if ($[0] !== "555aaa7d0dfb9d48290ff084e4bccb6f79b8d215cf4511a7189c87640abf6593") {
|
|
23
|
+
for (let $i = 0; $i < 50; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
24
|
+
$[0] = "555aaa7d0dfb9d48290ff084e4bccb6f79b8d215cf4511a7189c87640abf6593";
|
|
25
|
+
}
|
|
22
26
|
const projectSlug = useProjectSlug();
|
|
23
27
|
let t0;
|
|
24
|
-
if ($[
|
|
28
|
+
if ($[1] !== projectSlug) {
|
|
25
29
|
t0 = projectQueries.getBySlug(projectSlug);
|
|
26
|
-
$[
|
|
27
|
-
$[
|
|
28
|
-
} else t0 = $[
|
|
30
|
+
$[1] = projectSlug;
|
|
31
|
+
$[2] = t0;
|
|
32
|
+
} else t0 = $[2];
|
|
29
33
|
const { data: project } = useQuery(t0);
|
|
30
34
|
let t1;
|
|
31
|
-
if ($[
|
|
35
|
+
if ($[3] !== project?.id) {
|
|
32
36
|
t1 = fileQueries.list(project?.id ?? 0);
|
|
33
|
-
$[
|
|
34
|
-
$[
|
|
35
|
-
} else t1 = $[
|
|
37
|
+
$[3] = project?.id;
|
|
38
|
+
$[4] = t1;
|
|
39
|
+
} else t1 = $[4];
|
|
36
40
|
const t2 = !!project;
|
|
37
41
|
let t3;
|
|
38
|
-
if ($[
|
|
42
|
+
if ($[5] !== t1 || $[6] !== t2) {
|
|
39
43
|
t3 = {
|
|
40
44
|
...t1,
|
|
41
45
|
enabled: t2
|
|
42
46
|
};
|
|
43
|
-
$[
|
|
44
|
-
$[
|
|
45
|
-
$[
|
|
46
|
-
} else t3 = $[
|
|
47
|
+
$[5] = t1;
|
|
48
|
+
$[6] = t2;
|
|
49
|
+
$[7] = t3;
|
|
50
|
+
} else t3 = $[7];
|
|
47
51
|
const { data: files } = useQuery(t3);
|
|
48
52
|
let t4;
|
|
49
|
-
if ($[
|
|
53
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
50
54
|
t4 = /* @__PURE__ */ new Set();
|
|
51
|
-
$[
|
|
52
|
-
} else t4 = $[
|
|
55
|
+
$[8] = t4;
|
|
56
|
+
} else t4 = $[8];
|
|
53
57
|
const [selectedIds, setSelectedIds] = useState(t4);
|
|
54
58
|
const [lightboxFileId, setLightboxFileId] = useState(null);
|
|
55
59
|
const t5 = project?.id;
|
|
56
60
|
let t6;
|
|
57
|
-
if ($[
|
|
61
|
+
if ($[9] !== t5) {
|
|
58
62
|
t6 = { projectId: t5 };
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
} else t6 = $[
|
|
63
|
+
$[9] = t5;
|
|
64
|
+
$[10] = t6;
|
|
65
|
+
} else t6 = $[10];
|
|
62
66
|
const { uploads, uploadFiles, clearAll } = useFileUpload(t6);
|
|
63
67
|
let t7;
|
|
64
|
-
if ($[
|
|
68
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
65
69
|
t7 = {
|
|
66
70
|
...fileMutations.deleteMany(),
|
|
67
71
|
onSuccess: () => setSelectedIds(/* @__PURE__ */ new Set())
|
|
68
72
|
};
|
|
69
|
-
$[
|
|
70
|
-
} else t7 = $[
|
|
73
|
+
$[11] = t7;
|
|
74
|
+
} else t7 = $[11];
|
|
71
75
|
const deleteFiles = useMutation(t7);
|
|
72
76
|
const containerRef = useRef(null);
|
|
73
77
|
let t8;
|
|
74
|
-
if ($[
|
|
78
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
75
79
|
t8 = (ids) => setSelectedIds(ids);
|
|
76
|
-
$[
|
|
77
|
-
} else t8 = $[
|
|
80
|
+
$[12] = t8;
|
|
81
|
+
} else t8 = $[12];
|
|
78
82
|
const { selectionRect, didDragRef, handlers } = useMarqueeSelection(containerRef, t8);
|
|
79
83
|
let t9;
|
|
80
|
-
if ($[
|
|
84
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
81
85
|
t9 = /* @__PURE__ */ jsx(ContentSidebar, {});
|
|
82
|
-
$[
|
|
83
|
-
} else t9 = $[
|
|
86
|
+
$[13] = t9;
|
|
87
|
+
} else t9 = $[13];
|
|
84
88
|
let t10;
|
|
85
|
-
if ($[
|
|
89
|
+
if ($[14] !== didDragRef) {
|
|
86
90
|
t10 = () => {
|
|
87
91
|
if (didDragRef.current) {
|
|
88
92
|
didDragRef.current = false;
|
|
@@ -90,20 +94,20 @@ const CamoxContent = () => {
|
|
|
90
94
|
}
|
|
91
95
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
92
96
|
};
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
} else t10 = $[
|
|
97
|
+
$[14] = didDragRef;
|
|
98
|
+
$[15] = t10;
|
|
99
|
+
} else t10 = $[15];
|
|
96
100
|
let t11;
|
|
97
|
-
if ($[
|
|
101
|
+
if ($[16] !== files) {
|
|
98
102
|
t11 = files === void 0 && /* @__PURE__ */ jsx("div", {
|
|
99
103
|
className: "grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-4",
|
|
100
104
|
children: Array.from({ length: 12 }, _temp)
|
|
101
105
|
});
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
} else t11 = $[
|
|
106
|
+
$[16] = files;
|
|
107
|
+
$[17] = t11;
|
|
108
|
+
} else t11 = $[17];
|
|
105
109
|
let t12;
|
|
106
|
-
if ($[
|
|
110
|
+
if ($[18] !== files?.length) {
|
|
107
111
|
t12 = files?.length === 0 && /* @__PURE__ */ jsx("div", {
|
|
108
112
|
className: "flex h-full flex-1 items-center justify-center",
|
|
109
113
|
children: /* @__PURE__ */ jsx("p", {
|
|
@@ -111,11 +115,11 @@ const CamoxContent = () => {
|
|
|
111
115
|
children: "No assets yet"
|
|
112
116
|
})
|
|
113
117
|
});
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
} else t12 = $[
|
|
118
|
+
$[18] = files?.length;
|
|
119
|
+
$[19] = t12;
|
|
120
|
+
} else t12 = $[19];
|
|
117
121
|
let t13;
|
|
118
|
-
if ($[
|
|
122
|
+
if ($[20] !== files || $[21] !== selectedIds) {
|
|
119
123
|
t13 = files && files.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
120
124
|
className: "grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-4",
|
|
121
125
|
children: files.map((file) => /* @__PURE__ */ jsx(AssetCard, {
|
|
@@ -132,12 +136,12 @@ const CamoxContent = () => {
|
|
|
132
136
|
onOpen: () => setLightboxFileId(file.id)
|
|
133
137
|
}, file.id))
|
|
134
138
|
});
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
} else t13 = $[
|
|
139
|
+
$[20] = files;
|
|
140
|
+
$[21] = selectedIds;
|
|
141
|
+
$[22] = t13;
|
|
142
|
+
} else t13 = $[22];
|
|
139
143
|
let t14;
|
|
140
|
-
if ($[
|
|
144
|
+
if ($[23] !== selectionRect) {
|
|
141
145
|
t14 = selectionRect && /* @__PURE__ */ jsx("div", {
|
|
142
146
|
className: "border-primary bg-primary/10 pointer-events-none absolute z-50 border",
|
|
143
147
|
style: {
|
|
@@ -147,11 +151,11 @@ const CamoxContent = () => {
|
|
|
147
151
|
height: selectionRect.height
|
|
148
152
|
}
|
|
149
153
|
});
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
} else t14 = $[
|
|
154
|
+
$[23] = selectionRect;
|
|
155
|
+
$[24] = t14;
|
|
156
|
+
} else t14 = $[24];
|
|
153
157
|
let t15;
|
|
154
|
-
if ($[
|
|
158
|
+
if ($[25] !== handlers.onPointerDown || $[26] !== handlers.onPointerMove || $[27] !== handlers.onPointerUp || $[28] !== t10 || $[29] !== t11 || $[30] !== t12 || $[31] !== t13 || $[32] !== t14) {
|
|
155
159
|
t15 = /* @__PURE__ */ jsxs(PanelContent, {
|
|
156
160
|
ref: containerRef,
|
|
157
161
|
className: "relative p-4 select-none",
|
|
@@ -166,18 +170,18 @@ const CamoxContent = () => {
|
|
|
166
170
|
t14
|
|
167
171
|
]
|
|
168
172
|
});
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
} else t15 = $[
|
|
173
|
+
$[25] = handlers.onPointerDown;
|
|
174
|
+
$[26] = handlers.onPointerMove;
|
|
175
|
+
$[27] = handlers.onPointerUp;
|
|
176
|
+
$[28] = t10;
|
|
177
|
+
$[29] = t11;
|
|
178
|
+
$[30] = t12;
|
|
179
|
+
$[31] = t13;
|
|
180
|
+
$[32] = t14;
|
|
181
|
+
$[33] = t15;
|
|
182
|
+
} else t15 = $[33];
|
|
179
183
|
let t16;
|
|
180
|
-
if ($[
|
|
184
|
+
if ($[34] !== t15 || $[35] !== uploadFiles) {
|
|
181
185
|
t16 = /* @__PURE__ */ jsx("div", {
|
|
182
186
|
className: "flex min-w-0 flex-1 flex-col",
|
|
183
187
|
children: /* @__PURE__ */ jsx(UploadDropZone, {
|
|
@@ -186,22 +190,22 @@ const CamoxContent = () => {
|
|
|
186
190
|
children: t15
|
|
187
191
|
})
|
|
188
192
|
});
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
} else t16 = $[
|
|
193
|
+
$[34] = t15;
|
|
194
|
+
$[35] = uploadFiles;
|
|
195
|
+
$[36] = t16;
|
|
196
|
+
} else t16 = $[36];
|
|
193
197
|
let t17;
|
|
194
|
-
if ($[
|
|
198
|
+
if ($[37] !== clearAll || $[38] !== uploads) {
|
|
195
199
|
t17 = /* @__PURE__ */ jsx(UploadProgressDrawer, {
|
|
196
200
|
uploads,
|
|
197
201
|
onClose: clearAll
|
|
198
202
|
});
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
} else t17 = $[
|
|
203
|
+
$[37] = clearAll;
|
|
204
|
+
$[38] = uploads;
|
|
205
|
+
$[39] = t17;
|
|
206
|
+
} else t17 = $[39];
|
|
203
207
|
let t18;
|
|
204
|
-
if ($[
|
|
208
|
+
if ($[40] !== deleteFiles || $[41] !== selectedIds) {
|
|
205
209
|
t18 = selectedIds.size > 0 && /* @__PURE__ */ jsxs(FloatingToolbar, {
|
|
206
210
|
className: "bottom-4 min-w-xs justify-between gap-4 pl-3",
|
|
207
211
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
@@ -222,12 +226,12 @@ const CamoxContent = () => {
|
|
|
222
226
|
children: deleteFiles.isPending ? "Deleting…" : "Delete"
|
|
223
227
|
})]
|
|
224
228
|
});
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
} else t18 = $[
|
|
229
|
+
$[40] = deleteFiles;
|
|
230
|
+
$[41] = selectedIds;
|
|
231
|
+
$[42] = t18;
|
|
232
|
+
} else t18 = $[42];
|
|
229
233
|
let t19;
|
|
230
|
-
if ($[
|
|
234
|
+
if ($[43] !== lightboxFileId) {
|
|
231
235
|
t19 = lightboxFileId && /* @__PURE__ */ jsx(AssetLightbox, {
|
|
232
236
|
open: true,
|
|
233
237
|
onOpenChange: (open) => {
|
|
@@ -235,11 +239,11 @@ const CamoxContent = () => {
|
|
|
235
239
|
},
|
|
236
240
|
fileId: lightboxFileId
|
|
237
241
|
});
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
} else t19 = $[
|
|
242
|
+
$[43] = lightboxFileId;
|
|
243
|
+
$[44] = t19;
|
|
244
|
+
} else t19 = $[44];
|
|
241
245
|
let t20;
|
|
242
|
-
if ($[
|
|
246
|
+
if ($[45] !== t16 || $[46] !== t17 || $[47] !== t18 || $[48] !== t19) {
|
|
243
247
|
t20 = /* @__PURE__ */ jsxs("div", {
|
|
244
248
|
className: "flex flex-1 flex-row",
|
|
245
249
|
children: [
|
|
@@ -250,12 +254,12 @@ const CamoxContent = () => {
|
|
|
250
254
|
t19
|
|
251
255
|
]
|
|
252
256
|
});
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
} else t20 = $[
|
|
257
|
+
$[45] = t16;
|
|
258
|
+
$[46] = t17;
|
|
259
|
+
$[47] = t18;
|
|
260
|
+
$[48] = t19;
|
|
261
|
+
$[49] = t20;
|
|
262
|
+
} else t20 = $[49];
|
|
259
263
|
return t20;
|
|
260
264
|
};
|
|
261
265
|
function _temp(_, i) {
|