@btst/stack 1.1.3 → 1.1.5
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/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.cjs +182 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs +149 -0
- package/dist/packages/better-stack/src/plugins/blog/client/components/forms/post-forms.cjs +64 -14
- package/dist/packages/better-stack/src/plugins/blog/client/components/forms/post-forms.mjs +66 -16
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.cjs +5 -1
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.mjs +5 -1
- package/dist/packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.cjs +31 -0
- package/dist/packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.mjs +31 -1
- package/dist/packages/better-stack/src/plugins/blog/client/localization/blog-forms.cjs +8 -0
- package/dist/packages/better-stack/src/plugins/blog/client/localization/blog-forms.mjs +8 -0
- package/dist/packages/ui/src/components/alert-dialog.cjs +149 -0
- package/dist/packages/ui/src/components/alert-dialog.mjs +137 -0
- package/dist/plugins/blog/client/hooks/index.cjs +1 -0
- package/dist/plugins/blog/client/hooks/index.d.cts +7 -1
- package/dist/plugins/blog/client/hooks/index.d.mts +7 -1
- package/dist/plugins/blog/client/hooks/index.d.ts +7 -1
- package/dist/plugins/blog/client/hooks/index.mjs +1 -1
- package/dist/plugins/blog/client/index.d.cts +8 -1
- package/dist/plugins/blog/client/index.d.mts +8 -1
- package/dist/plugins/blog/client/index.d.ts +8 -1
- package/dist/plugins/client/index.d.cts +5 -9
- package/dist/plugins/client/index.d.mts +5 -9
- package/dist/plugins/client/index.d.ts +5 -9
- package/package.json +1 -1
- package/src/plugins/blog/client/components/forms/post-forms.tsx +92 -14
- package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +6 -0
- package/src/plugins/blog/client/hooks/blog-hooks.tsx +38 -0
- package/src/plugins/blog/client/localization/blog-forms.ts +10 -0
- package/src/plugins/client/index.ts +10 -16
|
@@ -267,6 +267,36 @@ function useUpdatePost() {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
+
function useDeletePost() {
|
|
271
|
+
const { refresh, apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
272
|
+
const client = createApiClient({
|
|
273
|
+
baseURL: apiBaseURL,
|
|
274
|
+
basePath: apiBasePath
|
|
275
|
+
});
|
|
276
|
+
const queryClient = useQueryClient();
|
|
277
|
+
const queries = createBlogQueryKeys(client);
|
|
278
|
+
return useMutation({
|
|
279
|
+
mutationKey: [...queries.posts._def, "delete"],
|
|
280
|
+
mutationFn: async ({ id }) => {
|
|
281
|
+
const response = await client(`@delete/posts/:id`, {
|
|
282
|
+
method: "DELETE",
|
|
283
|
+
params: { id }
|
|
284
|
+
});
|
|
285
|
+
return response.data;
|
|
286
|
+
},
|
|
287
|
+
onSuccess: async () => {
|
|
288
|
+
await queryClient.invalidateQueries({
|
|
289
|
+
queryKey: queries.posts._def
|
|
290
|
+
});
|
|
291
|
+
await queryClient.invalidateQueries({
|
|
292
|
+
queryKey: queries.drafts.list._def
|
|
293
|
+
});
|
|
294
|
+
if (refresh) {
|
|
295
|
+
await refresh();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
270
300
|
function usePostSearch({
|
|
271
301
|
query,
|
|
272
302
|
enabled = true,
|
|
@@ -365,4 +395,4 @@ function useRecentPosts(options = {}) {
|
|
|
365
395
|
};
|
|
366
396
|
}
|
|
367
397
|
|
|
368
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
398
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
@@ -20,7 +20,15 @@ const BLOG_FORMS = {
|
|
|
20
20
|
BLOG_FORMS_CANCEL_BUTTON: "Cancel",
|
|
21
21
|
BLOG_FORMS_TOAST_CREATE_SUCCESS: "Post created successfully",
|
|
22
22
|
BLOG_FORMS_TOAST_UPDATE_SUCCESS: "Post updated successfully",
|
|
23
|
+
BLOG_FORMS_TOAST_DELETE_SUCCESS: "Post deleted successfully",
|
|
23
24
|
BLOG_FORMS_LOADING_POST: "Loading post...",
|
|
25
|
+
// Delete post
|
|
26
|
+
BLOG_FORMS_DELETE_BUTTON: "Delete Post",
|
|
27
|
+
BLOG_FORMS_DELETE_DIALOG_TITLE: "Delete Post",
|
|
28
|
+
BLOG_FORMS_DELETE_DIALOG_DESCRIPTION: "Are you sure you want to delete this post? This action cannot be undone.",
|
|
29
|
+
BLOG_FORMS_DELETE_DIALOG_CANCEL: "Cancel",
|
|
30
|
+
BLOG_FORMS_DELETE_DIALOG_CONFIRM: "Delete",
|
|
31
|
+
BLOG_FORMS_DELETE_PENDING: "Deleting...",
|
|
24
32
|
// Markdown editor
|
|
25
33
|
BLOG_FORMS_EDITOR_PLACEHOLDER: "Write something...",
|
|
26
34
|
// Featured image field
|
|
@@ -18,7 +18,15 @@ const BLOG_FORMS = {
|
|
|
18
18
|
BLOG_FORMS_CANCEL_BUTTON: "Cancel",
|
|
19
19
|
BLOG_FORMS_TOAST_CREATE_SUCCESS: "Post created successfully",
|
|
20
20
|
BLOG_FORMS_TOAST_UPDATE_SUCCESS: "Post updated successfully",
|
|
21
|
+
BLOG_FORMS_TOAST_DELETE_SUCCESS: "Post deleted successfully",
|
|
21
22
|
BLOG_FORMS_LOADING_POST: "Loading post...",
|
|
23
|
+
// Delete post
|
|
24
|
+
BLOG_FORMS_DELETE_BUTTON: "Delete Post",
|
|
25
|
+
BLOG_FORMS_DELETE_DIALOG_TITLE: "Delete Post",
|
|
26
|
+
BLOG_FORMS_DELETE_DIALOG_DESCRIPTION: "Are you sure you want to delete this post? This action cannot be undone.",
|
|
27
|
+
BLOG_FORMS_DELETE_DIALOG_CANCEL: "Cancel",
|
|
28
|
+
BLOG_FORMS_DELETE_DIALOG_CONFIRM: "Delete",
|
|
29
|
+
BLOG_FORMS_DELETE_PENDING: "Deleting...",
|
|
22
30
|
// Markdown editor
|
|
23
31
|
BLOG_FORMS_EDITOR_PLACEHOLDER: "Write something...",
|
|
24
32
|
// Featured image field
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const index = require('../../../../node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.cjs');
|
|
6
|
+
const utils = require('../lib/utils.cjs');
|
|
7
|
+
const button = require('./button.cjs');
|
|
8
|
+
|
|
9
|
+
function AlertDialog({
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Root, { "data-slot": "alert-dialog", ...props });
|
|
13
|
+
}
|
|
14
|
+
function AlertDialogTrigger({
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
|
|
18
|
+
}
|
|
19
|
+
function AlertDialogPortal({
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
23
|
+
}
|
|
24
|
+
function AlertDialogOverlay({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
+
index.Overlay,
|
|
30
|
+
{
|
|
31
|
+
"data-slot": "alert-dialog-overlay",
|
|
32
|
+
className: utils.cn(
|
|
33
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function AlertDialogContent({
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
index.Content,
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "alert-dialog-content",
|
|
50
|
+
className: utils.cn(
|
|
51
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
52
|
+
className
|
|
53
|
+
),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
function AlertDialogHeader({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}) {
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
"data-slot": "alert-dialog-header",
|
|
67
|
+
className: utils.cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
68
|
+
...props
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function AlertDialogFooter({
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}) {
|
|
76
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-slot": "alert-dialog-footer",
|
|
80
|
+
className: utils.cn(
|
|
81
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
82
|
+
className
|
|
83
|
+
),
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function AlertDialogTitle({
|
|
89
|
+
className,
|
|
90
|
+
...props
|
|
91
|
+
}) {
|
|
92
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
93
|
+
index.Title,
|
|
94
|
+
{
|
|
95
|
+
"data-slot": "alert-dialog-title",
|
|
96
|
+
className: utils.cn("text-lg font-semibold", className),
|
|
97
|
+
...props
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function AlertDialogDescription({
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}) {
|
|
105
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
index.Description,
|
|
107
|
+
{
|
|
108
|
+
"data-slot": "alert-dialog-description",
|
|
109
|
+
className: utils.cn("text-muted-foreground text-sm", className),
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function AlertDialogAction({
|
|
115
|
+
className,
|
|
116
|
+
...props
|
|
117
|
+
}) {
|
|
118
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
index.Action,
|
|
120
|
+
{
|
|
121
|
+
className: utils.cn(button.buttonVariants(), className),
|
|
122
|
+
...props
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function AlertDialogCancel({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}) {
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
+
index.Cancel,
|
|
132
|
+
{
|
|
133
|
+
className: utils.cn(button.buttonVariants({ variant: "outline" }), className),
|
|
134
|
+
...props
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
exports.AlertDialog = AlertDialog;
|
|
140
|
+
exports.AlertDialogAction = AlertDialogAction;
|
|
141
|
+
exports.AlertDialogCancel = AlertDialogCancel;
|
|
142
|
+
exports.AlertDialogContent = AlertDialogContent;
|
|
143
|
+
exports.AlertDialogDescription = AlertDialogDescription;
|
|
144
|
+
exports.AlertDialogFooter = AlertDialogFooter;
|
|
145
|
+
exports.AlertDialogHeader = AlertDialogHeader;
|
|
146
|
+
exports.AlertDialogOverlay = AlertDialogOverlay;
|
|
147
|
+
exports.AlertDialogPortal = AlertDialogPortal;
|
|
148
|
+
exports.AlertDialogTitle = AlertDialogTitle;
|
|
149
|
+
exports.AlertDialogTrigger = AlertDialogTrigger;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Root as Root2, Trigger as Trigger2, Content as Content2, Title as Title2, Description as Description2, Cancel, Action, Portal as Portal2, Overlay as Overlay2 } from '../../../../node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs';
|
|
4
|
+
import { cn } from '../lib/utils.mjs';
|
|
5
|
+
import { buttonVariants } from './button.mjs';
|
|
6
|
+
|
|
7
|
+
function AlertDialog({
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Root2, { "data-slot": "alert-dialog", ...props });
|
|
11
|
+
}
|
|
12
|
+
function AlertDialogTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(Trigger2, { "data-slot": "alert-dialog-trigger", ...props });
|
|
16
|
+
}
|
|
17
|
+
function AlertDialogPortal({
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */ jsx(Portal2, { "data-slot": "alert-dialog-portal", ...props });
|
|
21
|
+
}
|
|
22
|
+
function AlertDialogOverlay({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
Overlay2,
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "alert-dialog-overlay",
|
|
30
|
+
className: cn(
|
|
31
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function AlertDialogContent({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}) {
|
|
42
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(AlertDialogOverlay, {}),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Content2,
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "alert-dialog-content",
|
|
48
|
+
className: cn(
|
|
49
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
50
|
+
className
|
|
51
|
+
),
|
|
52
|
+
...props
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
function AlertDialogHeader({
|
|
58
|
+
className,
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
"data-slot": "alert-dialog-header",
|
|
65
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function AlertDialogFooter({
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}) {
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
"data-slot": "alert-dialog-footer",
|
|
78
|
+
className: cn(
|
|
79
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
80
|
+
className
|
|
81
|
+
),
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function AlertDialogTitle({
|
|
87
|
+
className,
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
return /* @__PURE__ */ jsx(
|
|
91
|
+
Title2,
|
|
92
|
+
{
|
|
93
|
+
"data-slot": "alert-dialog-title",
|
|
94
|
+
className: cn("text-lg font-semibold", className),
|
|
95
|
+
...props
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function AlertDialogDescription({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}) {
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
Description2,
|
|
105
|
+
{
|
|
106
|
+
"data-slot": "alert-dialog-description",
|
|
107
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function AlertDialogAction({
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
115
|
+
}) {
|
|
116
|
+
return /* @__PURE__ */ jsx(
|
|
117
|
+
Action,
|
|
118
|
+
{
|
|
119
|
+
className: cn(buttonVariants(), className),
|
|
120
|
+
...props
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function AlertDialogCancel({
|
|
125
|
+
className,
|
|
126
|
+
...props
|
|
127
|
+
}) {
|
|
128
|
+
return /* @__PURE__ */ jsx(
|
|
129
|
+
Cancel,
|
|
130
|
+
{
|
|
131
|
+
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
@@ -5,6 +5,7 @@ const blogHooks = require('../../../../packages/better-stack/src/plugins/blog/cl
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
exports.useCreatePost = blogHooks.useCreatePost;
|
|
8
|
+
exports.useDeletePost = blogHooks.useDeletePost;
|
|
8
9
|
exports.useNextPreviousPosts = blogHooks.useNextPreviousPosts;
|
|
9
10
|
exports.usePost = blogHooks.usePost;
|
|
10
11
|
exports.usePostSearch = blogHooks.usePostSearch;
|
|
@@ -103,6 +103,12 @@ declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
103
103
|
id: string;
|
|
104
104
|
data: PostUpdateInput;
|
|
105
105
|
}, unknown>;
|
|
106
|
+
/** Delete a post by id */
|
|
107
|
+
declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
}, Error, {
|
|
110
|
+
id: string;
|
|
111
|
+
}, unknown>;
|
|
106
112
|
/**
|
|
107
113
|
* Hook for searching posts by a free-text query. Uses `usePosts` under the hood.
|
|
108
114
|
* Debounces the query and preserves last successful results to avoid flicker.
|
|
@@ -146,5 +152,5 @@ declare function useRecentPosts(options?: UseRecentPostsOptions): UseRecentPosts
|
|
|
146
152
|
inView: boolean;
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
155
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
150
156
|
export type { PostCreateInput, PostUpdateInput, UseNextPreviousPostsOptions, UseNextPreviousPostsResult, UsePostResult, UsePostSearchOptions, UsePostSearchResult, UsePostsOptions, UsePostsResult, UseRecentPostsOptions, UseRecentPostsResult };
|
|
@@ -103,6 +103,12 @@ declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
103
103
|
id: string;
|
|
104
104
|
data: PostUpdateInput;
|
|
105
105
|
}, unknown>;
|
|
106
|
+
/** Delete a post by id */
|
|
107
|
+
declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
}, Error, {
|
|
110
|
+
id: string;
|
|
111
|
+
}, unknown>;
|
|
106
112
|
/**
|
|
107
113
|
* Hook for searching posts by a free-text query. Uses `usePosts` under the hood.
|
|
108
114
|
* Debounces the query and preserves last successful results to avoid flicker.
|
|
@@ -146,5 +152,5 @@ declare function useRecentPosts(options?: UseRecentPostsOptions): UseRecentPosts
|
|
|
146
152
|
inView: boolean;
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
155
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
150
156
|
export type { PostCreateInput, PostUpdateInput, UseNextPreviousPostsOptions, UseNextPreviousPostsResult, UsePostResult, UsePostSearchOptions, UsePostSearchResult, UsePostsOptions, UsePostsResult, UseRecentPostsOptions, UseRecentPostsResult };
|
|
@@ -103,6 +103,12 @@ declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
103
103
|
id: string;
|
|
104
104
|
data: PostUpdateInput;
|
|
105
105
|
}, unknown>;
|
|
106
|
+
/** Delete a post by id */
|
|
107
|
+
declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
}, Error, {
|
|
110
|
+
id: string;
|
|
111
|
+
}, unknown>;
|
|
106
112
|
/**
|
|
107
113
|
* Hook for searching posts by a free-text query. Uses `usePosts` under the hood.
|
|
108
114
|
* Debounces the query and preserves last successful results to avoid flicker.
|
|
@@ -146,5 +152,5 @@ declare function useRecentPosts(options?: UseRecentPostsOptions): UseRecentPosts
|
|
|
146
152
|
inView: boolean;
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
155
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost };
|
|
150
156
|
export type { PostCreateInput, PostUpdateInput, UseNextPreviousPostsOptions, UseNextPreviousPostsResult, UsePostResult, UsePostSearchOptions, UsePostSearchResult, UsePostsOptions, UsePostsResult, UseRecentPostsOptions, UseRecentPostsResult };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useCreatePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost } from '../../../../packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.mjs';
|
|
1
|
+
export { useCreatePost, useDeletePost, useNextPreviousPosts, usePost, usePostSearch, usePosts, useRecentPosts, useSuspensePost, useSuspensePosts, useSuspenseTags, useTags, useUpdatePost } from '../../../../packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.mjs';
|
|
@@ -67,7 +67,7 @@ interface BlogClientHooks {
|
|
|
67
67
|
*
|
|
68
68
|
* @param config - Configuration including queryClient, baseURL, and optional hooks
|
|
69
69
|
*/
|
|
70
|
-
declare const blogClientPlugin: (config: BlogClientConfig) => _btst_stack_plugins_client.ClientPlugin<
|
|
70
|
+
declare const blogClientPlugin: (config: BlogClientConfig) => _btst_stack_plugins_client.ClientPlugin<Record<string, never>, {
|
|
71
71
|
posts: {
|
|
72
72
|
(inputCtx_0?: _btst_yar.InputContext<"/blog", _btst_yar.RouteOptions> | undefined): {
|
|
73
73
|
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
@@ -258,7 +258,14 @@ declare const BLOG_LOCALIZATION: {
|
|
|
258
258
|
BLOG_FORMS_CANCEL_BUTTON: string;
|
|
259
259
|
BLOG_FORMS_TOAST_CREATE_SUCCESS: string;
|
|
260
260
|
BLOG_FORMS_TOAST_UPDATE_SUCCESS: string;
|
|
261
|
+
BLOG_FORMS_TOAST_DELETE_SUCCESS: string;
|
|
261
262
|
BLOG_FORMS_LOADING_POST: string;
|
|
263
|
+
BLOG_FORMS_DELETE_BUTTON: string;
|
|
264
|
+
BLOG_FORMS_DELETE_DIALOG_TITLE: string;
|
|
265
|
+
BLOG_FORMS_DELETE_DIALOG_DESCRIPTION: string;
|
|
266
|
+
BLOG_FORMS_DELETE_DIALOG_CANCEL: string;
|
|
267
|
+
BLOG_FORMS_DELETE_DIALOG_CONFIRM: string;
|
|
268
|
+
BLOG_FORMS_DELETE_PENDING: string;
|
|
262
269
|
BLOG_FORMS_EDITOR_PLACEHOLDER: string;
|
|
263
270
|
BLOG_FORMS_FEATURED_IMAGE_LABEL: string;
|
|
264
271
|
BLOG_FORMS_FEATURED_IMAGE_REQUIRED_ASTERISK: string;
|
|
@@ -67,7 +67,7 @@ interface BlogClientHooks {
|
|
|
67
67
|
*
|
|
68
68
|
* @param config - Configuration including queryClient, baseURL, and optional hooks
|
|
69
69
|
*/
|
|
70
|
-
declare const blogClientPlugin: (config: BlogClientConfig) => _btst_stack_plugins_client.ClientPlugin<
|
|
70
|
+
declare const blogClientPlugin: (config: BlogClientConfig) => _btst_stack_plugins_client.ClientPlugin<Record<string, never>, {
|
|
71
71
|
posts: {
|
|
72
72
|
(inputCtx_0?: _btst_yar.InputContext<"/blog", _btst_yar.RouteOptions> | undefined): {
|
|
73
73
|
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
@@ -258,7 +258,14 @@ declare const BLOG_LOCALIZATION: {
|
|
|
258
258
|
BLOG_FORMS_CANCEL_BUTTON: string;
|
|
259
259
|
BLOG_FORMS_TOAST_CREATE_SUCCESS: string;
|
|
260
260
|
BLOG_FORMS_TOAST_UPDATE_SUCCESS: string;
|
|
261
|
+
BLOG_FORMS_TOAST_DELETE_SUCCESS: string;
|
|
261
262
|
BLOG_FORMS_LOADING_POST: string;
|
|
263
|
+
BLOG_FORMS_DELETE_BUTTON: string;
|
|
264
|
+
BLOG_FORMS_DELETE_DIALOG_TITLE: string;
|
|
265
|
+
BLOG_FORMS_DELETE_DIALOG_DESCRIPTION: string;
|
|
266
|
+
BLOG_FORMS_DELETE_DIALOG_CANCEL: string;
|
|
267
|
+
BLOG_FORMS_DELETE_DIALOG_CONFIRM: string;
|
|
268
|
+
BLOG_FORMS_DELETE_PENDING: string;
|
|
262
269
|
BLOG_FORMS_EDITOR_PLACEHOLDER: string;
|
|
263
270
|
BLOG_FORMS_FEATURED_IMAGE_LABEL: string;
|
|
264
271
|
BLOG_FORMS_FEATURED_IMAGE_REQUIRED_ASTERISK: string;
|
|
@@ -67,7 +67,7 @@ interface BlogClientHooks {
|
|
|
67
67
|
*
|
|
68
68
|
* @param config - Configuration including queryClient, baseURL, and optional hooks
|
|
69
69
|
*/
|
|
70
|
-
declare const blogClientPlugin: (config: BlogClientConfig) => _btst_stack_plugins_client.ClientPlugin<
|
|
70
|
+
declare const blogClientPlugin: (config: BlogClientConfig) => _btst_stack_plugins_client.ClientPlugin<Record<string, never>, {
|
|
71
71
|
posts: {
|
|
72
72
|
(inputCtx_0?: _btst_yar.InputContext<"/blog", _btst_yar.RouteOptions> | undefined): {
|
|
73
73
|
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
@@ -258,7 +258,14 @@ declare const BLOG_LOCALIZATION: {
|
|
|
258
258
|
BLOG_FORMS_CANCEL_BUTTON: string;
|
|
259
259
|
BLOG_FORMS_TOAST_CREATE_SUCCESS: string;
|
|
260
260
|
BLOG_FORMS_TOAST_UPDATE_SUCCESS: string;
|
|
261
|
+
BLOG_FORMS_TOAST_DELETE_SUCCESS: string;
|
|
261
262
|
BLOG_FORMS_LOADING_POST: string;
|
|
263
|
+
BLOG_FORMS_DELETE_BUTTON: string;
|
|
264
|
+
BLOG_FORMS_DELETE_DIALOG_TITLE: string;
|
|
265
|
+
BLOG_FORMS_DELETE_DIALOG_DESCRIPTION: string;
|
|
266
|
+
BLOG_FORMS_DELETE_DIALOG_CANCEL: string;
|
|
267
|
+
BLOG_FORMS_DELETE_DIALOG_CONFIRM: string;
|
|
268
|
+
BLOG_FORMS_DELETE_PENDING: string;
|
|
262
269
|
BLOG_FORMS_EDITOR_PLACEHOLDER: string;
|
|
263
270
|
BLOG_FORMS_FEATURED_IMAGE_LABEL: string;
|
|
264
271
|
BLOG_FORMS_FEATURED_IMAGE_REQUIRED_ASTERISK: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { C as ClientPlugin } from '../../shared/stack.ByOugz9d.cjs';
|
|
2
2
|
export { P as PluginOverrides } from '../../shared/stack.ByOugz9d.cjs';
|
|
3
|
+
import { Route } from '@btst/yar';
|
|
4
|
+
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
3
5
|
import { createClient } from 'better-call/client';
|
|
4
6
|
export { createClient } from 'better-call/client';
|
|
5
7
|
import { Router, Endpoint } from 'better-call';
|
|
6
|
-
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
7
8
|
import '@btst/db';
|
|
8
9
|
|
|
9
10
|
interface CreateApiClientOptions {
|
|
@@ -31,16 +32,10 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
31
32
|
* - Client: import type { ClientPlugin } from "@btst/stack/plugins/client"
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
|
-
/**
|
|
35
|
-
* Helper type to extract plugin structure without leaking internal type references
|
|
36
|
-
* This ensures types are portable across package boundaries
|
|
37
|
-
*/
|
|
38
|
-
type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin<TPlugin extends ClientPlugin<infer TOverrides, any> ? TOverrides : never, TPlugin extends ClientPlugin<any, infer TRoutes> ? TRoutes : never>;
|
|
39
35
|
/**
|
|
40
36
|
* Helper to define a client plugin with full type inference
|
|
41
37
|
*
|
|
42
38
|
* Automatically infers route keys, hook names, and their types without needing casts.
|
|
43
|
-
* Returns a portable type that doesn't leak internal pnpm path references.
|
|
44
39
|
*
|
|
45
40
|
* @example
|
|
46
41
|
* ```ts
|
|
@@ -53,8 +48,9 @@ type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin
|
|
|
53
48
|
* });
|
|
54
49
|
* ```
|
|
55
50
|
*
|
|
56
|
-
* @template
|
|
51
|
+
* @template TOverrides - The shape of overridable components/functions this plugin requires
|
|
52
|
+
* @template TRoutes - The exact shape of routes this plugin provides (preserves keys and route types)
|
|
57
53
|
*/
|
|
58
|
-
declare function defineClientPlugin<
|
|
54
|
+
declare function defineClientPlugin<TOverrides = Record<string, never>, TRoutes extends Record<string, Route> = Record<string, Route>>(plugin: ClientPlugin<TOverrides, TRoutes>): ClientPlugin<TOverrides, TRoutes>;
|
|
59
55
|
|
|
60
56
|
export { ClientPlugin, createApiClient, defineClientPlugin };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { C as ClientPlugin } from '../../shared/stack.ByOugz9d.mjs';
|
|
2
2
|
export { P as PluginOverrides } from '../../shared/stack.ByOugz9d.mjs';
|
|
3
|
+
import { Route } from '@btst/yar';
|
|
4
|
+
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
3
5
|
import { createClient } from 'better-call/client';
|
|
4
6
|
export { createClient } from 'better-call/client';
|
|
5
7
|
import { Router, Endpoint } from 'better-call';
|
|
6
|
-
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
7
8
|
import '@btst/db';
|
|
8
9
|
|
|
9
10
|
interface CreateApiClientOptions {
|
|
@@ -31,16 +32,10 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
31
32
|
* - Client: import type { ClientPlugin } from "@btst/stack/plugins/client"
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
|
-
/**
|
|
35
|
-
* Helper type to extract plugin structure without leaking internal type references
|
|
36
|
-
* This ensures types are portable across package boundaries
|
|
37
|
-
*/
|
|
38
|
-
type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin<TPlugin extends ClientPlugin<infer TOverrides, any> ? TOverrides : never, TPlugin extends ClientPlugin<any, infer TRoutes> ? TRoutes : never>;
|
|
39
35
|
/**
|
|
40
36
|
* Helper to define a client plugin with full type inference
|
|
41
37
|
*
|
|
42
38
|
* Automatically infers route keys, hook names, and their types without needing casts.
|
|
43
|
-
* Returns a portable type that doesn't leak internal pnpm path references.
|
|
44
39
|
*
|
|
45
40
|
* @example
|
|
46
41
|
* ```ts
|
|
@@ -53,8 +48,9 @@ type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin
|
|
|
53
48
|
* });
|
|
54
49
|
* ```
|
|
55
50
|
*
|
|
56
|
-
* @template
|
|
51
|
+
* @template TOverrides - The shape of overridable components/functions this plugin requires
|
|
52
|
+
* @template TRoutes - The exact shape of routes this plugin provides (preserves keys and route types)
|
|
57
53
|
*/
|
|
58
|
-
declare function defineClientPlugin<
|
|
54
|
+
declare function defineClientPlugin<TOverrides = Record<string, never>, TRoutes extends Record<string, Route> = Record<string, Route>>(plugin: ClientPlugin<TOverrides, TRoutes>): ClientPlugin<TOverrides, TRoutes>;
|
|
59
55
|
|
|
60
56
|
export { ClientPlugin, createApiClient, defineClientPlugin };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { C as ClientPlugin } from '../../shared/stack.ByOugz9d.js';
|
|
2
2
|
export { P as PluginOverrides } from '../../shared/stack.ByOugz9d.js';
|
|
3
|
+
import { Route } from '@btst/yar';
|
|
4
|
+
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
3
5
|
import { createClient } from 'better-call/client';
|
|
4
6
|
export { createClient } from 'better-call/client';
|
|
5
7
|
import { Router, Endpoint } from 'better-call';
|
|
6
|
-
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
7
8
|
import '@btst/db';
|
|
8
9
|
|
|
9
10
|
interface CreateApiClientOptions {
|
|
@@ -31,16 +32,10 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
31
32
|
* - Client: import type { ClientPlugin } from "@btst/stack/plugins/client"
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
|
-
/**
|
|
35
|
-
* Helper type to extract plugin structure without leaking internal type references
|
|
36
|
-
* This ensures types are portable across package boundaries
|
|
37
|
-
*/
|
|
38
|
-
type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin<TPlugin extends ClientPlugin<infer TOverrides, any> ? TOverrides : never, TPlugin extends ClientPlugin<any, infer TRoutes> ? TRoutes : never>;
|
|
39
35
|
/**
|
|
40
36
|
* Helper to define a client plugin with full type inference
|
|
41
37
|
*
|
|
42
38
|
* Automatically infers route keys, hook names, and their types without needing casts.
|
|
43
|
-
* Returns a portable type that doesn't leak internal pnpm path references.
|
|
44
39
|
*
|
|
45
40
|
* @example
|
|
46
41
|
* ```ts
|
|
@@ -53,8 +48,9 @@ type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin
|
|
|
53
48
|
* });
|
|
54
49
|
* ```
|
|
55
50
|
*
|
|
56
|
-
* @template
|
|
51
|
+
* @template TOverrides - The shape of overridable components/functions this plugin requires
|
|
52
|
+
* @template TRoutes - The exact shape of routes this plugin provides (preserves keys and route types)
|
|
57
53
|
*/
|
|
58
|
-
declare function defineClientPlugin<
|
|
54
|
+
declare function defineClientPlugin<TOverrides = Record<string, never>, TRoutes extends Record<string, Route> = Record<string, Route>>(plugin: ClientPlugin<TOverrides, TRoutes>): ClientPlugin<TOverrides, TRoutes>;
|
|
59
55
|
|
|
60
56
|
export { ClientPlugin, createApiClient, defineClientPlugin };
|