camox 0.28.6 → 0.29.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.
|
@@ -20,6 +20,11 @@ import { Textarea } from "@camox/ui/textarea";
|
|
|
20
20
|
import { useForm } from "@tanstack/react-form";
|
|
21
21
|
|
|
22
22
|
//#region src/features/preview/components/CreatePageModal.tsx
|
|
23
|
+
const slugifyPathSegment = (nickname) => {
|
|
24
|
+
const trimmedNickname = nickname.trim();
|
|
25
|
+
if (trimmedNickname.toLowerCase() === "home") return "";
|
|
26
|
+
return trimmedNickname.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
27
|
+
};
|
|
23
28
|
const CreatePageModal = () => {
|
|
24
29
|
const projectSlug = useProjectSlug();
|
|
25
30
|
const open = useSelector(previewStore, (state) => state.context.isCreatePageModalOpen);
|
|
@@ -106,7 +111,11 @@ const CreatePageModal = () => {
|
|
|
106
111
|
name: "nickname",
|
|
107
112
|
children: (field) => /* @__PURE__ */ jsx(PageNicknameField, {
|
|
108
113
|
value: field.state.value,
|
|
109
|
-
onChange:
|
|
114
|
+
onChange: (value_0) => {
|
|
115
|
+
field.handleChange(value_0);
|
|
116
|
+
if (form.getFieldMeta("pathSegment")?.isDirty) return;
|
|
117
|
+
form.setFieldValue("pathSegment", slugifyPathSegment(value_0), { dontUpdateMeta: true });
|
|
118
|
+
},
|
|
110
119
|
autoFocus: true
|
|
111
120
|
})
|
|
112
121
|
}),
|
|
@@ -132,8 +141,8 @@ const CreatePageModal = () => {
|
|
|
132
141
|
children: "Layout"
|
|
133
142
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
134
143
|
value: field_0.state.value,
|
|
135
|
-
onValueChange: (
|
|
136
|
-
if (
|
|
144
|
+
onValueChange: (value_1) => {
|
|
145
|
+
if (value_1 != null) field_0.handleChange(value_1);
|
|
137
146
|
},
|
|
138
147
|
disabled: layouts != null && layouts.length <= 1,
|
|
139
148
|
items: layouts?.map((t) => ({
|
|
@@ -118,19 +118,19 @@ const PagePicker = () => {
|
|
|
118
118
|
className: "flex min-w-0 flex-1 items-start gap-2",
|
|
119
119
|
children: [/* @__PURE__ */ jsx(Check, { className: cn("size-4 mt-0.5 shrink-0", currentPage.fullPath !== page_1.fullPath && "invisible") }), /* @__PURE__ */ jsxs("div", {
|
|
120
120
|
className: "flex min-w-0 flex-col",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
122
|
-
className: "truncate",
|
|
123
|
-
children: page_1.nickname
|
|
124
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
121
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
125
122
|
className: "flex min-w-0 items-center gap-1.5",
|
|
126
123
|
children: [/* @__PURE__ */ jsx("p", {
|
|
127
|
-
className: "
|
|
128
|
-
children: page_1.
|
|
124
|
+
className: "truncate",
|
|
125
|
+
children: page_1.nickname
|
|
129
126
|
}), /* @__PURE__ */ jsx(PageStatusBadge, {
|
|
130
127
|
size: "sm",
|
|
131
128
|
status: page_1.status,
|
|
132
129
|
modifiedReason: page_1.modifiedReason
|
|
133
130
|
})]
|
|
131
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
132
|
+
className: "text-muted-foreground truncate font-mono text-xs",
|
|
133
|
+
children: page_1.fullPath
|
|
134
134
|
})]
|
|
135
135
|
})]
|
|
136
136
|
}), /* @__PURE__ */ jsxs("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"camox": "./bin/camox.mjs"
|
|
6
6
|
},
|
|
@@ -126,9 +126,9 @@
|
|
|
126
126
|
"react-og-preview": "^0.2.0",
|
|
127
127
|
"shiki": "^4.1.0",
|
|
128
128
|
"zod": "^4.4.3",
|
|
129
|
-
"@camox/
|
|
130
|
-
"@camox/
|
|
131
|
-
"@camox/
|
|
129
|
+
"@camox/api-contract": "0.29.0",
|
|
130
|
+
"@camox/cli": "0.29.0",
|
|
131
|
+
"@camox/ui": "0.29.0"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
134
|
"@babel/core": "^7.29.0",
|