@arch-cadre/blog-module 1.0.6 → 1.0.8
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/actions/index.d.ts +38 -5
- package/dist/actions/index.js +149 -0
- package/dist/components/BlogStatsWidget.d.ts +1 -2
- package/dist/components/BlogStatsWidget.js +17 -0
- package/dist/components/RecentCommentsWidget.d.ts +1 -2
- package/dist/components/RecentCommentsWidget.js +24 -0
- package/dist/components/RecentPostsWidget.d.ts +1 -2
- package/dist/components/RecentPostsWidget.js +24 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/card.js +12 -0
- package/dist/components/ui/input.js +8 -0
- package/dist/components/ui/table.js +16 -0
- package/dist/components/ui/textarea.js +8 -0
- package/dist/index.js +98 -0
- package/dist/lib/{utils.mjs → utils.js} +1 -1
- package/dist/lib/validation.d.ts +2 -2
- package/dist/lib/validation.js +11 -0
- package/dist/navigation.js +21 -0
- package/dist/routes.js +55 -0
- package/dist/schema.js +60 -0
- package/dist/ui/views.d.ts +5 -6
- package/dist/ui/views.js +119 -0
- package/package.json +10 -17
- package/dist/actions/index.cjs +0 -158
- package/dist/actions/index.mjs +0 -121
- package/dist/components/BlogStatsWidget.cjs +0 -45
- package/dist/components/BlogStatsWidget.mjs +0 -13
- package/dist/components/RecentCommentsWidget.cjs +0 -47
- package/dist/components/RecentCommentsWidget.mjs +0 -28
- package/dist/components/RecentPostsWidget.cjs +0 -47
- package/dist/components/RecentPostsWidget.mjs +0 -28
- package/dist/components/ui/button.cjs +0 -53
- package/dist/components/ui/button.mjs +0 -44
- package/dist/components/ui/card.cjs +0 -46
- package/dist/components/ui/card.mjs +0 -35
- package/dist/components/ui/input.cjs +0 -23
- package/dist/components/ui/input.mjs +0 -20
- package/dist/components/ui/table.cjs +0 -66
- package/dist/components/ui/table.mjs +0 -59
- package/dist/components/ui/textarea.cjs +0 -21
- package/dist/components/ui/textarea.mjs +0 -19
- package/dist/index.cjs +0 -100
- package/dist/index.mjs +0 -95
- package/dist/intl.d.ts +0 -7
- package/dist/lib/utils.cjs +0 -11
- package/dist/lib/validation.cjs +0 -16
- package/dist/lib/validation.mjs +0 -10
- package/dist/navigation.cjs +0 -23
- package/dist/navigation.mjs +0 -21
- package/dist/routes.cjs +0 -74
- package/dist/routes.mjs +0 -68
- package/dist/schema.cjs +0 -62
- package/dist/schema.mjs +0 -53
- package/dist/styles/globals.css +0 -1
- package/dist/ui/views.cjs +0 -448
- package/dist/ui/views.mjs +0 -232
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
module.exports = RecentPostsWidget;
|
|
7
|
-
var _server = require("@arch-cadre/core/server");
|
|
8
|
-
var _server2 = require("@arch-cadre/intl/server");
|
|
9
|
-
var _ui = require("@arch-cadre/ui");
|
|
10
|
-
var _drizzleOrm = require("drizzle-orm");
|
|
11
|
-
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _schema = require("../schema.cjs");
|
|
13
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
-
async function RecentPostsWidget() {
|
|
16
|
-
const {
|
|
17
|
-
t
|
|
18
|
-
} = await (0, _server2.getTranslation)();
|
|
19
|
-
const posts = await _server.db.select({
|
|
20
|
-
id: _schema.postsTable.id,
|
|
21
|
-
title: _schema.postsTable.title,
|
|
22
|
-
createdAt: _schema.postsTable.createdAt,
|
|
23
|
-
author: {
|
|
24
|
-
name: _server.userTable.name,
|
|
25
|
-
image: _server.userTable.image
|
|
26
|
-
}
|
|
27
|
-
}).from(_schema.postsTable).leftJoin(_server.userTable, (0, _drizzleOrm.eq)(_schema.postsTable.authorId, _server.userTable.id)).orderBy((0, _drizzleOrm.desc)(_schema.postsTable.createdAt)).limit(5);
|
|
28
|
-
return /* @__PURE__ */React.createElement(_ui.Card, null, /* @__PURE__ */React.createElement(_ui.CardHeader, null, /* @__PURE__ */React.createElement(_ui.CardTitle, null, t("Recent Posts")), /* @__PURE__ */React.createElement(_ui.CardDescription, null, t("The latest articles published on your blog."))), /* @__PURE__ */React.createElement(_ui.CardContent, {
|
|
29
|
-
className: "grid gap-8"
|
|
30
|
-
}, posts.map(post => /* @__PURE__ */React.createElement("div", {
|
|
31
|
-
key: post.id,
|
|
32
|
-
className: "flex items-center gap-4"
|
|
33
|
-
}, /* @__PURE__ */React.createElement(_ui.Avatar, {
|
|
34
|
-
className: "h-9 w-9"
|
|
35
|
-
}, /* @__PURE__ */React.createElement(_ui.AvatarImage, {
|
|
36
|
-
src: post.author?.image || "",
|
|
37
|
-
alt: "Avatar"
|
|
38
|
-
}), /* @__PURE__ */React.createElement(_ui.AvatarFallback, null, post.author?.name?.substring(0, 2).toUpperCase() || "AU")), /* @__PURE__ */React.createElement("div", {
|
|
39
|
-
className: "grid gap-1"
|
|
40
|
-
}, /* @__PURE__ */React.createElement("p", {
|
|
41
|
-
className: "text-sm font-medium leading-none"
|
|
42
|
-
}, post.title), /* @__PURE__ */React.createElement("p", {
|
|
43
|
-
className: "text-sm text-muted-foreground"
|
|
44
|
-
}, new Date(post.createdAt).toLocaleDateString())))), posts.length === 0 && /* @__PURE__ */React.createElement("div", {
|
|
45
|
-
className: "text-center py-4 text-muted-foreground"
|
|
46
|
-
}, t("No posts found."))));
|
|
47
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { db, userTable } from "@arch-cadre/core/server";
|
|
2
|
-
import { getTranslation } from "@arch-cadre/intl/server";
|
|
3
|
-
import {
|
|
4
|
-
Avatar,
|
|
5
|
-
AvatarFallback,
|
|
6
|
-
AvatarImage,
|
|
7
|
-
Card,
|
|
8
|
-
CardContent,
|
|
9
|
-
CardDescription,
|
|
10
|
-
CardHeader,
|
|
11
|
-
CardTitle
|
|
12
|
-
} from "@arch-cadre/ui";
|
|
13
|
-
import { desc, eq } from "drizzle-orm";
|
|
14
|
-
import * as React from "react";
|
|
15
|
-
import { postsTable } from "../schema.mjs";
|
|
16
|
-
export default async function RecentPostsWidget() {
|
|
17
|
-
const { t } = await getTranslation();
|
|
18
|
-
const posts = await db.select({
|
|
19
|
-
id: postsTable.id,
|
|
20
|
-
title: postsTable.title,
|
|
21
|
-
createdAt: postsTable.createdAt,
|
|
22
|
-
author: {
|
|
23
|
-
name: userTable.name,
|
|
24
|
-
image: userTable.image
|
|
25
|
-
}
|
|
26
|
-
}).from(postsTable).leftJoin(userTable, eq(postsTable.authorId, userTable.id)).orderBy(desc(postsTable.createdAt)).limit(5);
|
|
27
|
-
return /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, null, /* @__PURE__ */ React.createElement(CardTitle, null, t("Recent Posts")), /* @__PURE__ */ React.createElement(CardDescription, null, t("The latest articles published on your blog."))), /* @__PURE__ */ React.createElement(CardContent, { className: "grid gap-8" }, posts.map((post) => /* @__PURE__ */ React.createElement("div", { key: post.id, className: "flex items-center gap-4" }, /* @__PURE__ */ React.createElement(Avatar, { className: "h-9 w-9" }, /* @__PURE__ */ React.createElement(AvatarImage, { src: post.author?.image || "", alt: "Avatar" }), /* @__PURE__ */ React.createElement(AvatarFallback, null, post.author?.name?.substring(0, 2).toUpperCase() || "AU")), /* @__PURE__ */ React.createElement("div", { className: "grid gap-1" }, /* @__PURE__ */ React.createElement("p", { className: "text-sm font-medium leading-none" }, post.title), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-muted-foreground" }, new Date(post.createdAt).toLocaleDateString())))), posts.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "text-center py-4 text-muted-foreground" }, t("No posts found."))));
|
|
28
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.buttonVariants = exports.Button = void 0;
|
|
7
|
-
var _reactSlot = require("@radix-ui/react-slot");
|
|
8
|
-
var _classVarianceAuthority = require("class-variance-authority");
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _utils = require("../../lib/utils.cjs");
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
const buttonVariants = exports.buttonVariants = (0, _classVarianceAuthority.cva)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", {
|
|
14
|
-
variants: {
|
|
15
|
-
variant: {
|
|
16
|
-
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
17
|
-
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
18
|
-
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
19
|
-
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
20
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
21
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
default: "h-9 px-4 py-2",
|
|
25
|
-
sm: "h-8 rounded-md px-3 text-xs",
|
|
26
|
-
lg: "h-10 rounded-md px-8",
|
|
27
|
-
icon: "size-9"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
defaultVariants: {
|
|
31
|
-
variant: "default",
|
|
32
|
-
size: "default"
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const Button = exports.Button = React.forwardRef(({
|
|
36
|
-
className,
|
|
37
|
-
variant,
|
|
38
|
-
size,
|
|
39
|
-
asChild = false,
|
|
40
|
-
...props
|
|
41
|
-
}, ref) => {
|
|
42
|
-
const Comp = asChild ? _reactSlot.Slot : "button";
|
|
43
|
-
return /* @__PURE__ */React.createElement(Comp, {
|
|
44
|
-
className: (0, _utils.cn)(buttonVariants({
|
|
45
|
-
variant,
|
|
46
|
-
size,
|
|
47
|
-
className
|
|
48
|
-
})),
|
|
49
|
-
ref,
|
|
50
|
-
...props
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
Button.displayName = "Button";
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
-
import { cva } from "class-variance-authority";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { cn } from "../../lib/utils.mjs";
|
|
5
|
-
const buttonVariants = cva(
|
|
6
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
7
|
-
{
|
|
8
|
-
variants: {
|
|
9
|
-
variant: {
|
|
10
|
-
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
11
|
-
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
12
|
-
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
13
|
-
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
14
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
15
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
default: "h-9 px-4 py-2",
|
|
19
|
-
sm: "h-8 rounded-md px-3 text-xs",
|
|
20
|
-
lg: "h-10 rounded-md px-8",
|
|
21
|
-
icon: "size-9"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
defaultVariants: {
|
|
25
|
-
variant: "default",
|
|
26
|
-
size: "default"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
const Button = React.forwardRef(
|
|
31
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
32
|
-
const Comp = asChild ? Slot : "button";
|
|
33
|
-
return /* @__PURE__ */ React.createElement(
|
|
34
|
-
Comp,
|
|
35
|
-
{
|
|
36
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
37
|
-
ref,
|
|
38
|
-
...props
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
Button.displayName = "Button";
|
|
44
|
-
export { Button, buttonVariants };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CardTitle = exports.CardHeader = exports.CardContent = exports.Card = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _utils = require("../../lib/utils.cjs");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const Card = exports.Card = React.forwardRef(({
|
|
12
|
-
className,
|
|
13
|
-
...props
|
|
14
|
-
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
15
|
-
ref,
|
|
16
|
-
className: (0, _utils.cn)("rounded-xl border bg-card text-card-foreground shadow", className),
|
|
17
|
-
...props
|
|
18
|
-
}));
|
|
19
|
-
Card.displayName = "Card";
|
|
20
|
-
const CardHeader = exports.CardHeader = React.forwardRef(({
|
|
21
|
-
className,
|
|
22
|
-
...props
|
|
23
|
-
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
24
|
-
ref,
|
|
25
|
-
className: (0, _utils.cn)("flex flex-col space-y-1.5 p-6", className),
|
|
26
|
-
...props
|
|
27
|
-
}));
|
|
28
|
-
CardHeader.displayName = "CardHeader";
|
|
29
|
-
const CardTitle = exports.CardTitle = React.forwardRef(({
|
|
30
|
-
className,
|
|
31
|
-
...props
|
|
32
|
-
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
33
|
-
ref,
|
|
34
|
-
className: (0, _utils.cn)("font-semibold leading-none tracking-tight", className),
|
|
35
|
-
...props
|
|
36
|
-
}));
|
|
37
|
-
CardTitle.displayName = "CardTitle";
|
|
38
|
-
const CardContent = exports.CardContent = React.forwardRef(({
|
|
39
|
-
className,
|
|
40
|
-
...props
|
|
41
|
-
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
42
|
-
ref,
|
|
43
|
-
className: (0, _utils.cn)("p-6 pt-0", className),
|
|
44
|
-
...props
|
|
45
|
-
}));
|
|
46
|
-
CardContent.displayName = "CardContent";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils.mjs";
|
|
3
|
-
const Card = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
4
|
-
"div",
|
|
5
|
-
{
|
|
6
|
-
ref,
|
|
7
|
-
className: cn(
|
|
8
|
-
"rounded-xl border bg-card text-card-foreground shadow",
|
|
9
|
-
className
|
|
10
|
-
),
|
|
11
|
-
...props
|
|
12
|
-
}
|
|
13
|
-
));
|
|
14
|
-
Card.displayName = "Card";
|
|
15
|
-
const CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
16
|
-
"div",
|
|
17
|
-
{
|
|
18
|
-
ref,
|
|
19
|
-
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
20
|
-
...props
|
|
21
|
-
}
|
|
22
|
-
));
|
|
23
|
-
CardHeader.displayName = "CardHeader";
|
|
24
|
-
const CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
25
|
-
"div",
|
|
26
|
-
{
|
|
27
|
-
ref,
|
|
28
|
-
className: cn("font-semibold leading-none tracking-tight", className),
|
|
29
|
-
...props
|
|
30
|
-
}
|
|
31
|
-
));
|
|
32
|
-
CardTitle.displayName = "CardTitle";
|
|
33
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
34
|
-
CardContent.displayName = "CardContent";
|
|
35
|
-
export { Card, CardHeader, CardTitle, CardContent };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Input = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _utils = require("../../lib/utils.cjs");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const Input = exports.Input = React.forwardRef(({
|
|
12
|
-
className,
|
|
13
|
-
type,
|
|
14
|
-
...props
|
|
15
|
-
}, ref) => {
|
|
16
|
-
return /* @__PURE__ */React.createElement("input", {
|
|
17
|
-
type,
|
|
18
|
-
className: (0, _utils.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
19
|
-
ref,
|
|
20
|
-
...props
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
Input.displayName = "Input";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils.mjs";
|
|
3
|
-
const Input = React.forwardRef(
|
|
4
|
-
({ className, type, ...props }, ref) => {
|
|
5
|
-
return /* @__PURE__ */ React.createElement(
|
|
6
|
-
"input",
|
|
7
|
-
{
|
|
8
|
-
type,
|
|
9
|
-
className: cn(
|
|
10
|
-
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
11
|
-
className
|
|
12
|
-
),
|
|
13
|
-
ref,
|
|
14
|
-
...props
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
Input.displayName = "Input";
|
|
20
|
-
export { Input };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableCell = exports.TableBody = exports.Table = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _utils = require("../../lib/utils.cjs");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const Table = exports.Table = React.forwardRef(({
|
|
12
|
-
className,
|
|
13
|
-
...props
|
|
14
|
-
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
15
|
-
className: "relative w-full overflow-auto"
|
|
16
|
-
}, /* @__PURE__ */React.createElement("table", {
|
|
17
|
-
ref,
|
|
18
|
-
className: (0, _utils.cn)("w-full caption-bottom text-sm", className),
|
|
19
|
-
...props
|
|
20
|
-
})));
|
|
21
|
-
Table.displayName = "Table";
|
|
22
|
-
const TableHeader = exports.TableHeader = React.forwardRef(({
|
|
23
|
-
className,
|
|
24
|
-
...props
|
|
25
|
-
}, ref) => /* @__PURE__ */React.createElement("thead", {
|
|
26
|
-
ref,
|
|
27
|
-
className: (0, _utils.cn)("[&_tr]:border-b", className),
|
|
28
|
-
...props
|
|
29
|
-
}));
|
|
30
|
-
TableHeader.displayName = "TableHeader";
|
|
31
|
-
const TableBody = exports.TableBody = React.forwardRef(({
|
|
32
|
-
className,
|
|
33
|
-
...props
|
|
34
|
-
}, ref) => /* @__PURE__ */React.createElement("tbody", {
|
|
35
|
-
ref,
|
|
36
|
-
className: (0, _utils.cn)("[&_tr:last-child]:border-0", className),
|
|
37
|
-
...props
|
|
38
|
-
}));
|
|
39
|
-
TableBody.displayName = "TableBody";
|
|
40
|
-
const TableRow = exports.TableRow = React.forwardRef(({
|
|
41
|
-
className,
|
|
42
|
-
...props
|
|
43
|
-
}, ref) => /* @__PURE__ */React.createElement("tr", {
|
|
44
|
-
ref,
|
|
45
|
-
className: (0, _utils.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
46
|
-
...props
|
|
47
|
-
}));
|
|
48
|
-
TableRow.displayName = "TableRow";
|
|
49
|
-
const TableHead = exports.TableHead = React.forwardRef(({
|
|
50
|
-
className,
|
|
51
|
-
...props
|
|
52
|
-
}, ref) => /* @__PURE__ */React.createElement("th", {
|
|
53
|
-
ref,
|
|
54
|
-
className: (0, _utils.cn)("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
55
|
-
...props
|
|
56
|
-
}));
|
|
57
|
-
TableHead.displayName = "TableHead";
|
|
58
|
-
const TableCell = exports.TableCell = React.forwardRef(({
|
|
59
|
-
className,
|
|
60
|
-
...props
|
|
61
|
-
}, ref) => /* @__PURE__ */React.createElement("td", {
|
|
62
|
-
ref,
|
|
63
|
-
className: (0, _utils.cn)("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
64
|
-
...props
|
|
65
|
-
}));
|
|
66
|
-
TableCell.displayName = "TableCell";
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils.mjs";
|
|
3
|
-
const Table = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement("div", { className: "relative w-full overflow-auto" }, /* @__PURE__ */ React.createElement(
|
|
4
|
-
"table",
|
|
5
|
-
{
|
|
6
|
-
ref,
|
|
7
|
-
className: cn("w-full caption-bottom text-sm", className),
|
|
8
|
-
...props
|
|
9
|
-
}
|
|
10
|
-
)));
|
|
11
|
-
Table.displayName = "Table";
|
|
12
|
-
const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
13
|
-
TableHeader.displayName = "TableHeader";
|
|
14
|
-
const TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
15
|
-
"tbody",
|
|
16
|
-
{
|
|
17
|
-
ref,
|
|
18
|
-
className: cn("[&_tr:last-child]:border-0", className),
|
|
19
|
-
...props
|
|
20
|
-
}
|
|
21
|
-
));
|
|
22
|
-
TableBody.displayName = "TableBody";
|
|
23
|
-
const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
24
|
-
"tr",
|
|
25
|
-
{
|
|
26
|
-
ref,
|
|
27
|
-
className: cn(
|
|
28
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
29
|
-
className
|
|
30
|
-
),
|
|
31
|
-
...props
|
|
32
|
-
}
|
|
33
|
-
));
|
|
34
|
-
TableRow.displayName = "TableRow";
|
|
35
|
-
const TableHead = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
36
|
-
"th",
|
|
37
|
-
{
|
|
38
|
-
ref,
|
|
39
|
-
className: cn(
|
|
40
|
-
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
41
|
-
className
|
|
42
|
-
),
|
|
43
|
-
...props
|
|
44
|
-
}
|
|
45
|
-
));
|
|
46
|
-
TableHead.displayName = "TableHead";
|
|
47
|
-
const TableCell = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
48
|
-
"td",
|
|
49
|
-
{
|
|
50
|
-
ref,
|
|
51
|
-
className: cn(
|
|
52
|
-
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
53
|
-
className
|
|
54
|
-
),
|
|
55
|
-
...props
|
|
56
|
-
}
|
|
57
|
-
));
|
|
58
|
-
TableCell.displayName = "TableCell";
|
|
59
|
-
export { Table, TableHeader, TableBody, TableHead, TableRow, TableCell };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Textarea = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _utils = require("../../lib/utils.cjs");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const Textarea = exports.Textarea = React.forwardRef(({
|
|
12
|
-
className,
|
|
13
|
-
...props
|
|
14
|
-
}, ref) => {
|
|
15
|
-
return /* @__PURE__ */React.createElement("textarea", {
|
|
16
|
-
className: (0, _utils.cn)("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
17
|
-
ref,
|
|
18
|
-
...props
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
Textarea.displayName = "Textarea";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils.mjs";
|
|
3
|
-
const Textarea = React.forwardRef(
|
|
4
|
-
({ className, ...props }, ref) => {
|
|
5
|
-
return /* @__PURE__ */ React.createElement(
|
|
6
|
-
"textarea",
|
|
7
|
-
{
|
|
8
|
-
className: cn(
|
|
9
|
-
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
10
|
-
className
|
|
11
|
-
),
|
|
12
|
-
ref,
|
|
13
|
-
...props
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
Textarea.displayName = "Textarea";
|
|
19
|
-
export { Textarea };
|
package/dist/index.cjs
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _server = require("@arch-cadre/core/server");
|
|
8
|
-
var _drizzleOrm = require("drizzle-orm");
|
|
9
|
-
var _manifest = _interopRequireDefault(require("../manifest.json"));
|
|
10
|
-
var _BlogStatsWidget = _interopRequireDefault(require("./components/BlogStatsWidget.cjs"));
|
|
11
|
-
var _RecentCommentsWidget = _interopRequireDefault(require("./components/RecentCommentsWidget.cjs"));
|
|
12
|
-
var _RecentPostsWidget = _interopRequireDefault(require("./components/RecentPostsWidget.cjs"));
|
|
13
|
-
var _navigation = require("./navigation.cjs");
|
|
14
|
-
var _routes = require("./routes.cjs");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const BLOG_PERMISSIONS = [{
|
|
17
|
-
name: "post:create",
|
|
18
|
-
description: "Allow creating blog posts"
|
|
19
|
-
}, {
|
|
20
|
-
name: "post:update",
|
|
21
|
-
description: "Allow updating blog posts"
|
|
22
|
-
}, {
|
|
23
|
-
name: "post:delete",
|
|
24
|
-
description: "Allow deleting blog posts"
|
|
25
|
-
}, {
|
|
26
|
-
name: "comment:create",
|
|
27
|
-
description: "Allow creating comments"
|
|
28
|
-
}, {
|
|
29
|
-
name: "comment:update",
|
|
30
|
-
description: "Allow updating comments"
|
|
31
|
-
}, {
|
|
32
|
-
name: "comment:delete",
|
|
33
|
-
description: "Allow deleting comments"
|
|
34
|
-
}];
|
|
35
|
-
const blogModule = {
|
|
36
|
-
manifest: _manifest.default,
|
|
37
|
-
init: async () => {
|
|
38
|
-
console.log("[BlogModule] ready.");
|
|
39
|
-
},
|
|
40
|
-
widgets: [{
|
|
41
|
-
id: "blog-stats",
|
|
42
|
-
name: "Blog Stats",
|
|
43
|
-
area: "dashboard-stats",
|
|
44
|
-
component: _BlogStatsWidget.default,
|
|
45
|
-
priority: 20
|
|
46
|
-
}, {
|
|
47
|
-
id: "recent-posts",
|
|
48
|
-
name: "Recent Posts",
|
|
49
|
-
area: "dashboard-main",
|
|
50
|
-
component: _RecentPostsWidget.default,
|
|
51
|
-
priority: 20
|
|
52
|
-
}, {
|
|
53
|
-
id: "recent-comments",
|
|
54
|
-
name: "Recent Comments",
|
|
55
|
-
area: "dashboard-main",
|
|
56
|
-
component: _RecentCommentsWidget.default,
|
|
57
|
-
priority: 30
|
|
58
|
-
}],
|
|
59
|
-
onEnable: async () => {
|
|
60
|
-
console.log("[BlogModule] enabling and registering permissions...");
|
|
61
|
-
try {
|
|
62
|
-
for (const perm of BLOG_PERMISSIONS) {
|
|
63
|
-
await (0, _server.createPermission)(perm.name, perm.description);
|
|
64
|
-
}
|
|
65
|
-
const roles = await (0, _server.getRoles)();
|
|
66
|
-
const adminRole = roles.find(r => r.name === "admin");
|
|
67
|
-
if (adminRole) {
|
|
68
|
-
const blogPermNames = BLOG_PERMISSIONS.map(p => p.name);
|
|
69
|
-
const blogPerms = await _server.db.select().from(_server.permissionsTable).where((0, _drizzleOrm.inArray)(_server.permissionsTable.name, blogPermNames));
|
|
70
|
-
for (const p of blogPerms) {
|
|
71
|
-
await (0, _server.assignPermissionToRole)(adminRole.id, p.id);
|
|
72
|
-
}
|
|
73
|
-
console.log("[BlogModule] Permissions assigned to admin role.");
|
|
74
|
-
}
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.error("[BlogModule] Error during permission registration:", error);
|
|
77
|
-
}
|
|
78
|
-
console.log("[BlogModule] enabled.");
|
|
79
|
-
},
|
|
80
|
-
onDisable: async () => {
|
|
81
|
-
console.log("[Blog] onDisable: Cleaning up tables and permissions...");
|
|
82
|
-
try {
|
|
83
|
-
const blogPermNames = BLOG_PERMISSIONS.map(p => p.name);
|
|
84
|
-
await _server.db.delete(_server.permissionsTable).where((0, _drizzleOrm.inArray)(_server.permissionsTable.name, blogPermNames));
|
|
85
|
-
console.log("[BlogModule] Permissions and mappings removed.");
|
|
86
|
-
const tables = ["blog_posts", "blog_comments"];
|
|
87
|
-
for (const table of tables) {
|
|
88
|
-
await _server.db.execute(_drizzleOrm.sql.raw(`DROP TABLE IF EXISTS ${table} CASCADE`));
|
|
89
|
-
}
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.error("[Blog] onDisable Error:", e);
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
routes: {
|
|
95
|
-
public: _routes.publicRoutes,
|
|
96
|
-
private: _routes.privateRoutes
|
|
97
|
-
},
|
|
98
|
-
navigation: _navigation.navigation
|
|
99
|
-
};
|
|
100
|
-
module.exports = blogModule;
|