@rxdrag/website-lib-core 0.0.142 → 0.1.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/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "@rxdrag/website-lib-core",
3
- "version": "0.0.142",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "exports": {
6
- ".": "./index.ts",
7
- "./server": "./server.ts"
6
+ ".": "./index.ts"
8
7
  },
9
8
  "files": [
10
9
  "src",
11
- "index.ts",
12
- "server.ts"
10
+ "index.ts"
13
11
  ],
14
12
  "keywords": [
15
13
  "astro-component"
@@ -25,20 +23,23 @@
25
23
  "@types/react-dom": "^19.1.0",
26
24
  "eslint": "^9.39.2",
27
25
  "typescript": "^5",
28
- "@rxdrag/tiptap-preview": "0.0.3",
29
- "@rxdrag/eslint-config-custom": "0.2.13",
30
- "@rxdrag/tsconfig": "0.2.1"
26
+ "@rxdrag/eslint-config-custom": "0.3.0",
27
+ "@rxdrag/tsconfig": "0.3.0",
28
+ "@rxdrag/tiptap-preview": "0.1.0"
31
29
  },
32
30
  "dependencies": {
33
31
  "@iconify/utils": "^3.0.2",
34
32
  "clsx": "^2.1.0",
35
33
  "gsap": "^3.12.7",
34
+ "hls.js": "^1.6.13",
36
35
  "lodash-es": "^4.17.21",
37
- "@rxdrag/entify-lib": "0.0.30",
38
- "@rxdrag/rxcms-models": "0.3.115"
36
+ "@rxdrag/entify-lib": "0.1.0",
37
+ "@rxdrag/rxcms-models": "0.4.0"
39
38
  },
40
39
  "peerDependencies": {
41
- "astro": "^6.1.1"
40
+ "astro": "^5.18.1",
41
+ "react": "^18.0.0 || ^19.0.0",
42
+ "react-dom": "^18.0.0 || ^19.0.0"
42
43
  },
43
44
  "scripts": {
44
45
  "lint": "eslint . --ext .ts,tsx",
@@ -1,27 +1,20 @@
1
- import { IEntity, IQueryOptions } from "@rxdrag/entify-lib";
2
- import { QueryOptions } from "@rxdrag/rxcms-models";
3
-
4
- type CustomizedDataSource = {
5
- entity?: string;
6
- pageSize?: number;
7
- where?: unknown;
8
- orderBy?: unknown[];
9
- fields?: string;
10
- };
11
-
12
- export function toQueryOptions(dataSource: CustomizedDataSource): IQueryOptions<IEntity> {
13
- const { entity, pageSize, where, orderBy, fields } = dataSource;
14
- if (!entity) {
15
- throw new Error("entity is required in dataSource");
16
- }
17
- const queryOptions = new QueryOptions(
18
- entity,
19
- fields ? ["id", fields] : ["id"],
20
- {
21
- where,
22
- orderBy,
23
- limit: pageSize,
24
- }
25
- );
26
- return queryOptions as unknown as IQueryOptions<IEntity>;
1
+ import { IEntity, IQueryOptions } from "@rxdrag/entify-lib";
2
+ import { ICustomizedDataSource } from "../types";
3
+ import { QueryOptions } from "@rxdrag/rxcms-models";
4
+
5
+ export function toQueryOptions(dataSource: ICustomizedDataSource): IQueryOptions<IEntity> {
6
+ const { entity, pageSize, where, orderBy, fields } = dataSource;
7
+ if (!entity) {
8
+ throw new Error("entity is required in dataSource");
9
+ }
10
+ const queryOptions = new QueryOptions(
11
+ entity,
12
+ fields ? ["id", fields] : ["id"],
13
+ {
14
+ where,
15
+ orderBy,
16
+ limit: pageSize,
17
+ }
18
+ );
19
+ return queryOptions as unknown as IQueryOptions<IEntity>;
27
20
  }
package/src/index.ts CHANGED
@@ -1,5 +1,8 @@
1
- export * from "./astro";
2
- export * from "./component-logic";
3
- export * from "./robots";
4
- export * from "./lib";
5
- export * from "./design-tokens";
1
+ export * from "./astro";
2
+ export * from "./component-logic";
3
+ export * from "./entify";
4
+ export * from "./react";
5
+ export * from "./robots";
6
+ export * from "./lib";
7
+ export * from "./design-tokens";
8
+
package/src/lib/utils.ts CHANGED
@@ -1,135 +1,135 @@
1
- import type {
2
- TBreadcrumbItem,
3
- TPost,
4
- TPostCategory,
5
- TProduct,
6
- TProductCategory,
7
- } from "../entify";
8
- import { paginate } from "./pagination";
9
-
10
- export function postsPagination(options: {
11
- currentPage: number;
12
- totalPages: number;
13
- baseUrl?: string;
14
- }) {
15
- return paginate({
16
- currentPage: options.currentPage,
17
- totalPages: options.totalPages,
18
- baseUrl: options.baseUrl || "/posts/page/",
19
- });
20
- }
21
-
22
- export function productsPagination(options: {
23
- currentPage: number;
24
- totalPages: number;
25
- baseUrl?: string;
26
- }) {
27
- return paginate({
28
- currentPage: options.currentPage,
29
- totalPages: options.totalPages,
30
- baseUrl: options.baseUrl || "/products/page/",
31
- });
32
- }
33
-
34
- export function productBreadcrumbs(
35
- product?: TProduct,
36
- homeTitle: string = "Home",
37
- productsTitle: string = "Products"
38
- ) {
39
- // 生成面包屑
40
- const breadcrumbs: TBreadcrumbItem[] = [
41
- { title: homeTitle, href: "/" },
42
- { title: productsTitle, href: "/products/page/1" },
43
- ];
44
-
45
- const category = product?.category;
46
- if (category?.name) {
47
- breadcrumbs.push({
48
- title: category.name,
49
- href: `/products/categories/${category.slug}/1`,
50
- });
51
- }
52
-
53
- breadcrumbs.push({ title: product?.title || "Product" });
54
-
55
- return breadcrumbs;
56
- }
57
-
58
- export function productListBreadcrumbs(
59
- category?: TProductCategory | null,
60
- homeTitle: string = "Home",
61
- productsTitle: string = "Products"
62
- ) {
63
- // 生成面包屑
64
- const breadcrumbs: TBreadcrumbItem[] = [
65
- { title: homeTitle, href: "/" },
66
- { title: productsTitle, href: "/products/page/1" },
67
- ];
68
- if (category?.name) {
69
- breadcrumbs.push({
70
- title: category.name,
71
- });
72
- }
73
- return breadcrumbs;
74
- }
75
-
76
- export function postBreadcrumbs(
77
- post: TPost | undefined,
78
- homeTitle: string = "Home",
79
- postsTitle: string = "Posts"
80
- ) {
81
- // 生成面包屑
82
- const breadcrumbs: TBreadcrumbItem[] = [
83
- { title: homeTitle, href: "/" },
84
- { title: postsTitle, href: "/posts/page/1" },
85
- ];
86
-
87
- const category = post?.category;
88
- if (category?.name) {
89
- breadcrumbs.push({
90
- title: category.name,
91
- href: `/posts/categories/${category.slug}/1`,
92
- });
93
- }
94
-
95
- breadcrumbs.push({ title: post?.title || "Post" });
96
-
97
- return breadcrumbs;
98
- }
99
-
100
- export function postListBreadcrumbs(
101
- category?: TPostCategory | null,
102
- homeTitle: string = "Home",
103
- postsTitle: string = "Posts"
104
- ) {
105
- // 生成面包屑
106
- const breadcrumbs: TBreadcrumbItem[] = [
107
- { title: homeTitle, href: "/" },
108
- { title: postsTitle, href: "/posts/page/1" },
109
- ];
110
- if (category?.name) {
111
- breadcrumbs.push({
112
- title: category.name,
113
- });
114
- }
115
- return breadcrumbs;
116
- }
117
-
118
- export function pageBreadcrumbs(title: string, homeTitle: string = "Home") {
119
- // 生成面包屑
120
- const breadcrumbs: TBreadcrumbItem[] = [
121
- { title: homeTitle, href: "/" },
122
- { title },
123
- ];
124
- return breadcrumbs;
125
- }
126
-
127
- export const rxPage = {
128
- postsPagination,
129
- productsPagination,
130
- postBreadcrumbs,
131
- postListBreadcrumbs,
132
- breadcrumbs: pageBreadcrumbs,
133
- productBreadcrumbs,
134
- productListBreadcrumbs,
135
- };
1
+ import {
2
+ TBreadcrumbItem,
3
+ TPost,
4
+ TPostCategory,
5
+ TProduct,
6
+ TProductCategory,
7
+ } from "../entify";
8
+ import { paginate } from "./pagination";
9
+
10
+ export function postsPagination(options: {
11
+ currentPage: number;
12
+ totalPages: number;
13
+ baseUrl?: string;
14
+ }) {
15
+ return paginate({
16
+ currentPage: options.currentPage,
17
+ totalPages: options.totalPages,
18
+ baseUrl: options.baseUrl || "/posts/page/",
19
+ });
20
+ }
21
+
22
+ export function productsPagination(options: {
23
+ currentPage: number;
24
+ totalPages: number;
25
+ baseUrl?: string;
26
+ }) {
27
+ return paginate({
28
+ currentPage: options.currentPage,
29
+ totalPages: options.totalPages,
30
+ baseUrl: options.baseUrl || "/products/page/",
31
+ });
32
+ }
33
+
34
+ export function productBreadcrumbs(
35
+ product?: TProduct,
36
+ homeTitle: string = "Home",
37
+ productsTitle: string = "Products"
38
+ ) {
39
+ // 生成面包屑
40
+ const breadcrumbs: TBreadcrumbItem[] = [
41
+ { title: homeTitle, href: "/" },
42
+ { title: productsTitle, href: "/products/page/1" },
43
+ ];
44
+
45
+ const category = product?.category;
46
+ if (category?.name) {
47
+ breadcrumbs.push({
48
+ title: category.name,
49
+ href: `/products/categories/${category.slug}/1`,
50
+ });
51
+ }
52
+
53
+ breadcrumbs.push({ title: product?.title || "Product" });
54
+
55
+ return breadcrumbs;
56
+ }
57
+
58
+ export function productListBreadcrumbs(
59
+ category?: TProductCategory | null,
60
+ homeTitle: string = "Home",
61
+ productsTitle: string = "Products"
62
+ ) {
63
+ // 生成面包屑
64
+ const breadcrumbs: TBreadcrumbItem[] = [
65
+ { title: homeTitle, href: "/" },
66
+ { title: productsTitle, href: "/products/page/1" },
67
+ ];
68
+ if (category?.name) {
69
+ breadcrumbs.push({
70
+ title: category.name,
71
+ });
72
+ }
73
+ return breadcrumbs;
74
+ }
75
+
76
+ export function postBreadcrumbs(
77
+ post: TPost | undefined,
78
+ homeTitle: string = "Home",
79
+ postsTitle: string = "Posts"
80
+ ) {
81
+ // 生成面包屑
82
+ const breadcrumbs: TBreadcrumbItem[] = [
83
+ { title: homeTitle, href: "/" },
84
+ { title: postsTitle, href: "/posts/page/1" },
85
+ ];
86
+
87
+ const category = post?.category;
88
+ if (category?.name) {
89
+ breadcrumbs.push({
90
+ title: category.name,
91
+ href: `/posts/categories/${category.slug}/1`,
92
+ });
93
+ }
94
+
95
+ breadcrumbs.push({ title: post?.title || "Post" });
96
+
97
+ return breadcrumbs;
98
+ }
99
+
100
+ export function postListBreadcrumbs(
101
+ category?: TPostCategory | null,
102
+ homeTitle: string = "Home",
103
+ postsTitle: string = "Posts"
104
+ ) {
105
+ // 生成面包屑
106
+ const breadcrumbs: TBreadcrumbItem[] = [
107
+ { title: homeTitle, href: "/" },
108
+ { title: postsTitle, href: "/posts/page/1" },
109
+ ];
110
+ if (category?.name) {
111
+ breadcrumbs.push({
112
+ title: category.name,
113
+ });
114
+ }
115
+ return breadcrumbs;
116
+ }
117
+
118
+ export function pageBreadcrumbs(title: string, homeTitle: string = "Home") {
119
+ // 生成面包屑
120
+ const breadcrumbs: TBreadcrumbItem[] = [
121
+ { title: homeTitle, href: "/" },
122
+ { title },
123
+ ];
124
+ return breadcrumbs;
125
+ }
126
+
127
+ export const rxPage = {
128
+ postsPagination,
129
+ productsPagination,
130
+ postBreadcrumbs,
131
+ postListBreadcrumbs,
132
+ breadcrumbs: pageBreadcrumbs,
133
+ productBreadcrumbs,
134
+ productListBreadcrumbs,
135
+ };
package/server.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/entify";