jeawin-astro 1.0.13 → 1.0.15
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/index.d.ts +7 -6
- package/index.ts +0 -7
- package/package.json +3 -1
- package/src/components/formitem/country.astro +2 -2
- package/src/components/subcomponents/author_info.astro +1 -1
- package/src/components/subcomponents/banner_swiper.astro +3 -3
- package/src/components/subcomponents/block.astro +1 -1
- package/src/components/subcomponents/breadcrumbs.astro +1 -1
- package/src/components/subcomponents/category_list.astro +1 -1
- package/src/components/subcomponents/children_categories_list.astro +1 -1
- package/src/components/subcomponents/choose_language.astro +1 -1
- package/src/components/subcomponents/comment_form.astro +1 -1
- package/src/components/subcomponents/common_card.astro +1 -1
- package/src/components/subcomponents/detail_images.astro +3 -3
- package/src/components/subcomponents/filter_links.astro +1 -1
- package/src/components/subcomponents/form.astro +2 -2
- package/src/components/subcomponents/friendlinks.astro +3 -3
- package/src/components/subcomponents/index_children_categories_list.astro +1 -1
- package/src/components/subcomponents/news_card.astro +1 -1
- package/src/components/subcomponents/news_category_list.astro +1 -1
- package/src/components/subcomponents/nodes_list.astro +1 -1
- package/src/components/subcomponents/pagination.astro +144 -161
- package/src/components/subcomponents/prevnext.astro +113 -114
- package/src/components/subcomponents/product_card.astro +1 -1
- package/src/components/subcomponents/product_category_list.astro +1 -1
- package/src/components/subcomponents/rel_nodes_list.astro +1 -1
- package/src/components/subcomponents/remote_image.astro +1 -1
- package/src/components/subcomponents/share_button.astro +1 -1
- package/src/components/subcomponents/sidebar.astro +2 -2
- package/src/components/subcomponents/site_options.astro +2 -2
- package/src/components/subcomponents/smartmenus/dropdown_menu.astro +1 -1
- package/src/components/subcomponents/smartmenus.astro +3 -3
- package/src/components/subcomponents/swiper.astro +1 -2
- package/src/components/subcomponents/tags_category_list.astro +1 -1
- package/src/env.d.ts +38 -0
- package/src/scripts/aos.d.ts +1 -0
- package/src/scripts/cms.d.ts +113 -0
- package/src/scripts/lightbox.d.ts +1 -0
- package/src/scripts/smartmenus.d.ts +2 -0
- package/src/scripts/swiper.d.ts +1 -0
- package/src/scripts/util.d.ts +29 -0
- package/src/service/jeawin.ts +2 -2
- package/tsconfig.json +23 -32
package/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="astro/client" />
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/// <reference path="./src/scripts/cms.d.ts" />
|
|
4
|
+
/// <reference path="./src/scripts/util.d.ts" />
|
|
5
|
+
/// <reference path="./src/scripts/aos.d.ts" />
|
|
6
|
+
/// <reference path="./src/scripts/lightbox.d.ts" />
|
|
7
|
+
/// <reference path="./src/scripts/smartmenus.d.ts" />
|
|
8
|
+
/// <reference path="./src/scripts/swiper.d.ts" />
|
|
9
|
+
|
|
9
10
|
|
|
10
11
|
declare namespace App {
|
|
11
12
|
interface Locals {
|
package/index.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
// Do not write code directly here, instead use the `src` folder!
|
|
2
2
|
// Then, use this file to export everything you want your user to access.
|
|
3
3
|
|
|
4
|
-
export * from './src/scripts/cms';
|
|
5
|
-
export * from './src/scripts/util';
|
|
6
|
-
export * from './src/scripts/aos';
|
|
7
|
-
export * from './src/scripts/lightbox';
|
|
8
|
-
export * from './src/scripts/smartmenus';
|
|
9
|
-
export * from './src/scripts/swiper';
|
|
10
|
-
|
|
11
4
|
export default {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jeawin-astro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"author": "chaegumi <chaegumi@qq.com>",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://www.jeawin.com/",
|
|
12
12
|
"type": "module",
|
|
13
|
+
"types": "index.d.ts",
|
|
14
|
+
"main": "index.ts",
|
|
13
15
|
"scripts": {
|
|
14
16
|
"test": "mocha test"
|
|
15
17
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { get_country } from "../../scripts/cms";
|
|
3
|
-
import { render_value } from "../../scripts/util";
|
|
2
|
+
import { get_country } from "../../scripts/cms.js";
|
|
3
|
+
import { render_value } from "../../scripts/util.js";
|
|
4
4
|
const { field } = Astro.props;
|
|
5
5
|
const { all_langs } = Astro.locals;
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { img_change_attrs, render_value } from "../../scripts/util";
|
|
3
|
-
import { get_nodes } from "../../scripts/cms";
|
|
2
|
+
import { img_change_attrs, render_value } from "../../scripts/util.js";
|
|
3
|
+
import { get_nodes } from "../../scripts/cms.js";
|
|
4
4
|
const banners = await get_nodes({ channel_id: 5 });
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -55,7 +55,7 @@ const banners = await get_nodes({ channel_id: 5 });
|
|
|
55
55
|
}
|
|
56
56
|
</style>
|
|
57
57
|
<script>
|
|
58
|
-
import { initSwiper } from "../../scripts/swiper";
|
|
58
|
+
import { initSwiper } from "../../scripts/swiper.js";
|
|
59
59
|
|
|
60
60
|
initSwiper(".banner_swiper");
|
|
61
61
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { img_add_link } from "../../scripts/util";
|
|
2
|
+
import { img_add_link } from "../../scripts/util.js";
|
|
3
3
|
const { nodepics } = Astro.props;
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -90,8 +90,8 @@ const { nodepics } = Astro.props;
|
|
|
90
90
|
</style>
|
|
91
91
|
|
|
92
92
|
<script>
|
|
93
|
-
import { initSwiper } from "../../scripts/swiper";
|
|
94
|
-
import { initPhotoSwipeLightbox } from "../../scripts/lightbox";
|
|
93
|
+
import { initSwiper } from "../../scripts/swiper.js";
|
|
94
|
+
import { initPhotoSwipeLightbox } from "../../scripts/lightbox.js";
|
|
95
95
|
|
|
96
96
|
initSwiper(".mainSwiper");
|
|
97
97
|
initSwiper(".thumbSwiper");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { get_form } from "../../scripts/cms";
|
|
3
|
-
import { render_value } from "../../scripts/util";
|
|
2
|
+
import { get_form } from "../../scripts/cms.js";
|
|
3
|
+
import { render_value } from "../../scripts/util.js";
|
|
4
4
|
import Input from "../formitem/input.astro";
|
|
5
5
|
import Textarea from "../formitem/textarea.astro";
|
|
6
6
|
import Radio from "../formitem/radio.astro";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
import _ from "lodash";
|
|
3
|
-
import { get_friendlinks } from "../../scripts/cms";
|
|
4
|
-
import { render_url, render_value } from "../../scripts/util";
|
|
3
|
+
import { get_friendlinks } from "../../scripts/cms.js";
|
|
4
|
+
import { render_url, render_value } from "../../scripts/util.js";
|
|
5
5
|
|
|
6
6
|
const { canonical, is_home, channel_id, category_id, url, uri } = Astro.props;
|
|
7
7
|
const { all_langs, siteinfo } = Astro.locals;
|
|
8
8
|
|
|
9
9
|
const friendlinksLang = await render_value(all_langs, "friendlinks");
|
|
10
10
|
|
|
11
|
-
const obj = await get_friendlinks();
|
|
11
|
+
const obj = await get_friendlinks({});
|
|
12
12
|
const friendlinks = _.get(obj, [0], []);
|
|
13
13
|
const channeluriarr = _.get(obj, [1], []);
|
|
14
14
|
const categoryuriarr = _.get(obj, [2], []);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { render_url, render_date } from "../../scripts/util";
|
|
2
|
+
import { render_url, render_date } from "../../scripts/util.js";
|
|
3
3
|
import { Icon } from "astro-icon/components";
|
|
4
4
|
import DefaultImage from "./default_image.astro";
|
|
5
5
|
import RenderImage from "./image.astro";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { get_nodes } from "../../scripts/cms";
|
|
2
|
+
import { get_nodes } from "../../scripts/cms.js";
|
|
3
3
|
import Pagination from "./pagination.astro";
|
|
4
4
|
const { channel_id, category_id, uri, page, limit, limit_type, include_children_category_nodes, no_fields, no_images_html, field_array } = Astro.props;
|
|
5
5
|
// console.log(channel_id);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { render_url } from "../../scripts/util";
|
|
2
|
+
import { render_url } from "../../scripts/util.js";
|
|
3
3
|
const { uri, total, per_page, current_page, total_pages } = Astro.props;
|
|
4
4
|
|
|
5
5
|
// const {siteinfo} = Astro.locals;
|
|
@@ -7,194 +7,177 @@ const { uri, total, per_page, current_page, total_pages } = Astro.props;
|
|
|
7
7
|
let centerSize = 5;
|
|
8
8
|
let centerPage = current_page;
|
|
9
9
|
if (current_page > total_pages - 3) {
|
|
10
|
-
|
|
10
|
+
centerPage = total_pages - 3;
|
|
11
11
|
}
|
|
12
12
|
if (current_page < 4) {
|
|
13
|
-
|
|
13
|
+
centerPage = 4;
|
|
14
14
|
}
|
|
15
15
|
let centerArr = [];
|
|
16
16
|
if (total_pages <= centerSize + 2) {
|
|
17
|
-
|
|
17
|
+
// 总页码较小时,全部显示出来
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
for (let i = 2; i < total_pages; i++) {
|
|
20
|
+
centerArr.push(i);
|
|
21
|
+
}
|
|
22
22
|
} else {
|
|
23
|
-
|
|
23
|
+
// 总页码较大时,只显示中间centerSize个页码
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
for (let i = centerPage - 2; i <= centerPage + 2; i++) {
|
|
26
|
+
// console.log(i);
|
|
27
|
+
centerArr.push(i);
|
|
28
|
+
}
|
|
29
29
|
}
|
|
30
30
|
// console.log(uri);
|
|
31
31
|
|
|
32
32
|
let more_right =
|
|
33
|
-
|
|
34
|
-
current_page <= total_pages - centerSize + 1;
|
|
33
|
+
total_pages > centerSize + 2 && current_page <= total_pages - centerSize + 1;
|
|
35
34
|
|
|
36
35
|
let nav_wrapper_class = "isolate inline-flex -space-x-px rounded-md shadow-sm";
|
|
37
36
|
|
|
38
37
|
let btn_class =
|
|
39
|
-
|
|
38
|
+
"relative inline-flex items-center px-4 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0".split(
|
|
39
|
+
" "
|
|
40
|
+
);
|
|
40
41
|
let btn_active_class =
|
|
41
|
-
|
|
42
|
+
`relative z-10 inline-flex items-center bg-[--themeColor] px-4 py-2 text-sm font-semibold text-white focus:z-20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[--themeColor]`.split(
|
|
43
|
+
" "
|
|
44
|
+
);
|
|
42
45
|
|
|
43
46
|
let simple_btn =
|
|
44
|
-
|
|
47
|
+
"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50".split(
|
|
48
|
+
" "
|
|
49
|
+
);
|
|
45
50
|
let simple_btn_disable =
|
|
46
|
-
|
|
51
|
+
"relative inline-flex items-center rounded-md border border-gray-100 bg-white px-4 py-2 text-sm text-gray-500 hover:bg-gray-50".split(
|
|
52
|
+
" "
|
|
53
|
+
);
|
|
47
54
|
---
|
|
48
55
|
|
|
49
56
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
>
|
|
66
|
-
Previous
|
|
67
|
-
</a>
|
|
68
|
-
)}
|
|
57
|
+
total > 0 && (
|
|
58
|
+
<div class="flex items-center justify-between border-t border-gray-200 py-3 my-7">
|
|
59
|
+
<div class="flex flex-1 items-center justify-between sm:hidden">
|
|
60
|
+
{current_page == 1 ? (
|
|
61
|
+
<span class:list={simple_btn_disable}>Previous</span>
|
|
62
|
+
) : (
|
|
63
|
+
<a
|
|
64
|
+
href={render_url(
|
|
65
|
+
`${uri}${current_page - 1 == 1 ? "" : `/P${current_page - 1}`}`
|
|
66
|
+
)}
|
|
67
|
+
class:list={simple_btn}
|
|
68
|
+
>
|
|
69
|
+
Previous
|
|
70
|
+
</a>
|
|
71
|
+
)}
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
""
|
|
117
|
-
)}
|
|
73
|
+
<span>
|
|
74
|
+
{current_page} / {total_pages}
|
|
75
|
+
</span>
|
|
76
|
+
{current_page == total_pages ? (
|
|
77
|
+
<span class:list={simple_btn_disable}>Next</span>
|
|
78
|
+
) : (
|
|
79
|
+
<a
|
|
80
|
+
href={render_url(`${uri}/P${current_page + 1}`)}
|
|
81
|
+
class:list={simple_btn}
|
|
82
|
+
>
|
|
83
|
+
Next
|
|
84
|
+
</a>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
<div class="hidden sm:flex sm:flex-1 sm:items-center sm:justify-between">
|
|
88
|
+
<div>
|
|
89
|
+
<p class="text-sm text-gray-700">
|
|
90
|
+
Total <span class="font-medium">{total}</span>
|
|
91
|
+
results, {per_page} records per page
|
|
92
|
+
</p>
|
|
93
|
+
</div>
|
|
94
|
+
<div>
|
|
95
|
+
{total_pages > 1 ? (
|
|
96
|
+
<nav class={nav_wrapper_class} aria-label="Pagination">
|
|
97
|
+
{total_pages > 7 && current_page >= 5 ? (
|
|
98
|
+
<a
|
|
99
|
+
href={render_url(`${uri}/P${current_page - 1}`)}
|
|
100
|
+
class:list={btn_class}
|
|
101
|
+
>
|
|
102
|
+
<span class="sr-only">Previous</span>
|
|
103
|
+
<svg
|
|
104
|
+
class="h-5 w-5"
|
|
105
|
+
viewBox="0 0 20 20"
|
|
106
|
+
fill="currentColor"
|
|
107
|
+
aria-hidden="true"
|
|
108
|
+
>
|
|
109
|
+
<path
|
|
110
|
+
fill-rule="evenodd"
|
|
111
|
+
d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z"
|
|
112
|
+
clip-rule="evenodd"
|
|
113
|
+
/>
|
|
114
|
+
</svg>
|
|
115
|
+
</a>
|
|
116
|
+
) : (
|
|
117
|
+
""
|
|
118
|
+
)}
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
current_page >= centerSize ? (
|
|
132
|
-
<span class:list={btn_class}>...</span>
|
|
133
|
-
) : (
|
|
134
|
-
""
|
|
135
|
-
)}
|
|
120
|
+
<a
|
|
121
|
+
href={render_url(uri)}
|
|
122
|
+
aria-current="page"
|
|
123
|
+
class:list={current_page == 1 ? btn_active_class : btn_class}
|
|
124
|
+
>
|
|
125
|
+
1
|
|
126
|
+
</a>
|
|
127
|
+
{total_pages > centerSize + 2 && current_page >= centerSize ? (
|
|
128
|
+
<span class:list={btn_class}>...</span>
|
|
129
|
+
) : (
|
|
130
|
+
""
|
|
131
|
+
)}
|
|
136
132
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
>
|
|
146
|
-
{i}
|
|
147
|
-
</a>
|
|
148
|
-
))}
|
|
133
|
+
{centerArr.map((i) => (
|
|
134
|
+
<a
|
|
135
|
+
href={render_url(`${uri}/P${i}`)}
|
|
136
|
+
class:list={i == current_page ? btn_active_class : btn_class}
|
|
137
|
+
>
|
|
138
|
+
{i}
|
|
139
|
+
</a>
|
|
140
|
+
))}
|
|
149
141
|
|
|
150
|
-
|
|
151
|
-
<span class:list={btn_class}>...</span>
|
|
152
|
-
) : (
|
|
153
|
-
""
|
|
154
|
-
)}
|
|
142
|
+
{more_right ? <span class:list={btn_class}>...</span> : ""}
|
|
155
143
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
</a>
|
|
167
|
-
) : null}
|
|
144
|
+
{total_pages > 1 ? (
|
|
145
|
+
<a
|
|
146
|
+
href={render_url(`${uri}/P${total_pages}`)}
|
|
147
|
+
class:list={
|
|
148
|
+
current_page == total_pages ? btn_active_class : btn_class
|
|
149
|
+
}
|
|
150
|
+
>
|
|
151
|
+
{total_pages}
|
|
152
|
+
</a>
|
|
153
|
+
) : null}
|
|
168
154
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)}
|
|
194
|
-
</nav>
|
|
195
|
-
) : null}
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
155
|
+
{total_pages > 7 && current_page < total_pages - 4 ? (
|
|
156
|
+
<a
|
|
157
|
+
href={render_url(`${uri}/P${current_page + 1}`)}
|
|
158
|
+
class:list={btn_class}
|
|
159
|
+
>
|
|
160
|
+
<span class="sr-only">Next</span>
|
|
161
|
+
<svg
|
|
162
|
+
class="h-5 w-5"
|
|
163
|
+
viewBox="0 0 20 20"
|
|
164
|
+
fill="currentColor"
|
|
165
|
+
aria-hidden="true"
|
|
166
|
+
>
|
|
167
|
+
<path
|
|
168
|
+
fill-rule="evenodd"
|
|
169
|
+
d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z"
|
|
170
|
+
clip-rule="evenodd"
|
|
171
|
+
/>
|
|
172
|
+
</svg>
|
|
173
|
+
</a>
|
|
174
|
+
) : (
|
|
175
|
+
""
|
|
176
|
+
)}
|
|
177
|
+
</nav>
|
|
178
|
+
) : null}
|
|
198
179
|
</div>
|
|
199
|
-
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
)
|
|
200
183
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { get_prevnext_node } from "../../scripts/cms";
|
|
3
|
-
import { render_url, render_value } from "../../scripts/util";
|
|
2
|
+
import { get_prevnext_node } from "../../scripts/cms.js";
|
|
3
|
+
import { render_url, render_value } from "../../scripts/util.js";
|
|
4
4
|
const { nodeinfo, node_id, channel_id, category_id } = Astro.props;
|
|
5
5
|
const { all_langs } = Astro.locals;
|
|
6
6
|
|
|
@@ -10,133 +10,132 @@ const nextLang = await render_value(all_langs, "next");
|
|
|
10
10
|
let prevnode = null;
|
|
11
11
|
let nextnode = null;
|
|
12
12
|
let prevnodeurl = "";
|
|
13
|
-
let nextnodeurl =
|
|
13
|
+
let nextnodeurl = "";
|
|
14
14
|
|
|
15
|
-
if(render_value(nodeinfo,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}else{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
if (render_value(nodeinfo, "prevnode")) {
|
|
16
|
+
prevnodeurl = render_value(nodeinfo, ["prevnode", "node_url"]);
|
|
17
|
+
prevnode = nodeinfo.prevnode;
|
|
18
|
+
} else {
|
|
19
|
+
const prevnode1 = await get_prevnext_node({
|
|
20
|
+
node_id: node_id,
|
|
21
|
+
direction: "prev",
|
|
22
|
+
channel_id,
|
|
23
|
+
category_id,
|
|
24
|
+
no_fields: 1,
|
|
25
|
+
});
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
if (prevnode1) {
|
|
28
|
+
prevnodeurl = prevnode1.node_url;
|
|
29
|
+
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if(render_value(nodeinfo,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}else{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
if (render_value(nodeinfo, "nextnode")) {
|
|
33
|
+
nextnodeurl = render_value(nodeinfo, ["nextnode", "node_url"]);
|
|
34
|
+
nextnode = nodeinfo.nextnode;
|
|
35
|
+
} else {
|
|
36
|
+
const nextnode1 = await get_prevnext_node({
|
|
37
|
+
node_id,
|
|
38
|
+
direction: "next",
|
|
39
|
+
channel_id,
|
|
40
|
+
category_id,
|
|
41
|
+
no_fields: 1,
|
|
42
|
+
});
|
|
43
|
+
if (nextnode1) {
|
|
44
|
+
nextnodeurl = nextnode1.node_url;
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
48
|
let backtolisturl = "";
|
|
50
49
|
if (Number(nodeinfo.category_id)) {
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
// 类别列表
|
|
51
|
+
backtolisturl = nodeinfo.category_url;
|
|
53
52
|
} else {
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
// 栏目列表
|
|
54
|
+
backtolisturl = nodeinfo.channel_url;
|
|
56
55
|
}
|
|
57
56
|
// console.log(nodeinfo);
|
|
58
57
|
---
|
|
59
58
|
|
|
60
59
|
<hr class="my-7" />
|
|
61
60
|
<div
|
|
62
|
-
|
|
61
|
+
class="my-7 mx-auto px-4 sm:px-6 lg:px-8 grid items-center grid-cols-[1fr,auto,1fr] gap-6"
|
|
63
62
|
>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
<div class="order-first flex">
|
|
77
|
-
{
|
|
78
|
-
prevnode ? (
|
|
79
|
-
<a
|
|
80
|
-
aria-label={`${previousLang}: ${prevnode.node_title}`}
|
|
81
|
-
class="relative"
|
|
82
|
-
href={render_url(prevnodeurl)}
|
|
83
|
-
title={prevnode.node_title}
|
|
84
|
-
>
|
|
85
|
-
<div class="hidden md:block text-[0.8125rem] leading-6 text-slate-500">
|
|
86
|
-
<span aria-hidden="true">←</span>
|
|
87
|
-
{previousLang}
|
|
88
|
-
</div>
|
|
89
|
-
<div class="hidden md:block mt-2 text-sm leading-6 font-semibold text-slate-900 dark:text-white">
|
|
90
|
-
{prevnode.node_title}
|
|
91
|
-
</div>
|
|
92
|
-
<div class="absolute -inset-1 md:hidden" />
|
|
93
|
-
<svg
|
|
94
|
-
class="md:hidden w-6 h-6 stroke-slate-900 dark:stroke-white"
|
|
95
|
-
fill="none"
|
|
96
|
-
aria-hidden="true"
|
|
97
|
-
>
|
|
98
|
-
<path
|
|
99
|
-
d="M13.25 8.75 9.75 12l3.5 3.25"
|
|
100
|
-
stroke-width="1.5"
|
|
101
|
-
stroke-linecap="round"
|
|
102
|
-
stroke-linejoin="round"
|
|
103
|
-
/>
|
|
104
|
-
</svg>
|
|
105
|
-
</a>
|
|
106
|
-
) : null
|
|
107
|
-
}
|
|
108
|
-
</div>
|
|
109
|
-
<div class="flex text-right justify-end">
|
|
110
|
-
{
|
|
111
|
-
nextnode ? (
|
|
112
|
-
<a
|
|
113
|
-
aria-label={`${nextLang}: ${nextnode.node_title}`}
|
|
114
|
-
class="relative"
|
|
115
|
-
href={render_url(nextnodeurl)}
|
|
116
|
-
title={nextnode.node_title}
|
|
117
|
-
>
|
|
118
|
-
<div class="hidden md:block text-[0.8125rem] leading-6 text-slate-500">
|
|
119
|
-
{nextLang}
|
|
120
|
-
<span aria-hidden="true"> →</span>
|
|
121
|
-
</div>
|
|
122
|
-
<div class="hidden md:block mt-2 text-sm leading-6 font-semibold text-slate-900 dark:text-white">
|
|
123
|
-
{nextnode.node_title}
|
|
124
|
-
</div>
|
|
125
|
-
<div class="absolute -inset-1 md:hidden" />
|
|
126
|
-
<svg
|
|
127
|
-
class="md:hidden w-6 h-6 stroke-slate-900 dark:stroke-white"
|
|
128
|
-
fill="none"
|
|
129
|
-
aria-hidden="true"
|
|
130
|
-
>
|
|
131
|
-
<path
|
|
132
|
-
d="m10.75 8.75 3.5 3.25-3.5 3.25"
|
|
133
|
-
stroke-width="1.5"
|
|
134
|
-
stroke-linecap="round"
|
|
135
|
-
stroke-linejoin="round"
|
|
136
|
-
/>
|
|
137
|
-
</svg>
|
|
138
|
-
</a>
|
|
139
|
-
) : null
|
|
140
|
-
}
|
|
63
|
+
<div class="text-center">
|
|
64
|
+
<p class="leading-6 font-semibold text-sky-500">
|
|
65
|
+
<a href={render_url(backtolisturl)} title="Back to List"
|
|
66
|
+
>{nodeinfo.channel_name}</a
|
|
67
|
+
>
|
|
68
|
+
</p>
|
|
69
|
+
<div
|
|
70
|
+
class="mt-1 text-xl leading-8 tracking-tight font-semibold text-slate-900 dark:text-white"
|
|
71
|
+
>
|
|
72
|
+
{nodeinfo.category_name}
|
|
141
73
|
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="order-first flex">
|
|
76
|
+
{
|
|
77
|
+
prevnode ? (
|
|
78
|
+
<a
|
|
79
|
+
aria-label={`${previousLang}: ${prevnode.node_title}`}
|
|
80
|
+
class="relative"
|
|
81
|
+
href={render_url(prevnodeurl)}
|
|
82
|
+
title={prevnode.node_title}
|
|
83
|
+
>
|
|
84
|
+
<div class="hidden md:block text-[0.8125rem] leading-6 text-slate-500">
|
|
85
|
+
<span aria-hidden="true">←</span>
|
|
86
|
+
{previousLang}
|
|
87
|
+
</div>
|
|
88
|
+
<div class="hidden md:block mt-2 text-sm leading-6 font-semibold text-slate-900 dark:text-white">
|
|
89
|
+
{prevnode.node_title}
|
|
90
|
+
</div>
|
|
91
|
+
<div class="absolute -inset-1 md:hidden" />
|
|
92
|
+
<svg
|
|
93
|
+
class="md:hidden w-6 h-6 stroke-slate-900 dark:stroke-white"
|
|
94
|
+
fill="none"
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
>
|
|
97
|
+
<path
|
|
98
|
+
d="M13.25 8.75 9.75 12l3.5 3.25"
|
|
99
|
+
stroke-width="1.5"
|
|
100
|
+
stroke-linecap="round"
|
|
101
|
+
stroke-linejoin="round"
|
|
102
|
+
/>
|
|
103
|
+
</svg>
|
|
104
|
+
</a>
|
|
105
|
+
) : null
|
|
106
|
+
}
|
|
107
|
+
</div>
|
|
108
|
+
<div class="flex text-right justify-end">
|
|
109
|
+
{
|
|
110
|
+
nextnode ? (
|
|
111
|
+
<a
|
|
112
|
+
aria-label={`${nextLang}: ${nextnode.node_title}`}
|
|
113
|
+
class="relative"
|
|
114
|
+
href={render_url(nextnodeurl)}
|
|
115
|
+
title={nextnode.node_title}
|
|
116
|
+
>
|
|
117
|
+
<div class="hidden md:block text-[0.8125rem] leading-6 text-slate-500">
|
|
118
|
+
{nextLang}
|
|
119
|
+
<span aria-hidden="true"> →</span>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="hidden md:block mt-2 text-sm leading-6 font-semibold text-slate-900 dark:text-white">
|
|
122
|
+
{nextnode.node_title}
|
|
123
|
+
</div>
|
|
124
|
+
<div class="absolute -inset-1 md:hidden" />
|
|
125
|
+
<svg
|
|
126
|
+
class="md:hidden w-6 h-6 stroke-slate-900 dark:stroke-white"
|
|
127
|
+
fill="none"
|
|
128
|
+
aria-hidden="true"
|
|
129
|
+
>
|
|
130
|
+
<path
|
|
131
|
+
d="m10.75 8.75 3.5 3.25-3.5 3.25"
|
|
132
|
+
stroke-width="1.5"
|
|
133
|
+
stroke-linecap="round"
|
|
134
|
+
stroke-linejoin="round"
|
|
135
|
+
/>
|
|
136
|
+
</svg>
|
|
137
|
+
</a>
|
|
138
|
+
) : null
|
|
139
|
+
}
|
|
140
|
+
</div>
|
|
142
141
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import _ from "lodash";
|
|
3
|
-
import { render_url, get_children_categories } from "../../scripts/util";
|
|
3
|
+
import { render_url, get_children_categories } from "../../scripts/util.js";
|
|
4
4
|
import ProductCard from "./product_card.astro";
|
|
5
5
|
import NodesList from "./nodes_list.astro";
|
|
6
6
|
import ChildrenCategoriesList from "./children_categories_list.astro";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { render_url } from "../../scripts/util";
|
|
2
|
+
import { render_url } from "../../scripts/util.js";
|
|
3
3
|
import DropdownMenu from "./smartmenus/dropdown_menu.astro";
|
|
4
4
|
|
|
5
5
|
const menus: any[] = [
|
|
@@ -149,7 +149,7 @@ const menus: any[] = [
|
|
|
149
149
|
</div>
|
|
150
150
|
</nav>
|
|
151
151
|
<script>
|
|
152
|
-
import { smartmenusSidebarInit } from "../../scripts/smartmenus";
|
|
152
|
+
import { smartmenusSidebarInit } from "../../scripts/smartmenus.js";
|
|
153
153
|
|
|
154
154
|
smartmenusSidebarInit();
|
|
155
155
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import _ from "lodash";
|
|
3
|
-
import { get_site_options } from "../../scripts/cms";
|
|
4
|
-
import { render_value } from "../../scripts/util";
|
|
3
|
+
import { get_site_options } from "../../scripts/cms.js";
|
|
4
|
+
import { render_value } from "../../scripts/util.js";
|
|
5
5
|
const { option_name } = Astro.props;
|
|
6
6
|
|
|
7
7
|
let option_value = "";
|
|
@@ -5,9 +5,9 @@ import { Icon } from "astro-icon/components";
|
|
|
5
5
|
import DropdownMenu from "./smartmenus/dropdown_menu.astro";
|
|
6
6
|
import RemoteImage from "./remote_image.astro";
|
|
7
7
|
import "smartmenus/dist/css/smartmenus.css";
|
|
8
|
-
import { render_url, render_value } from "../../scripts/util";
|
|
8
|
+
import { render_url, render_value } from "../../scripts/util.js";
|
|
9
9
|
|
|
10
|
-
import { get_menu_tree } from "../../scripts/cms";
|
|
10
|
+
import { get_menu_tree } from "../../scripts/cms.js";
|
|
11
11
|
import SiteOptions from "./site_options.astro";
|
|
12
12
|
|
|
13
13
|
import defaultImg from "../../assets/images/default.png";
|
|
@@ -247,7 +247,7 @@ const { siteinfo } = Astro.locals;
|
|
|
247
247
|
}
|
|
248
248
|
</style>
|
|
249
249
|
<script>
|
|
250
|
-
import { smartmenusHeaderInit } from "../../scripts/smartmenus";
|
|
250
|
+
import { smartmenusHeaderInit } from "../../scripts/smartmenus.js";
|
|
251
251
|
// import { isOpen } from "../store";
|
|
252
252
|
|
|
253
253
|
smartmenusHeaderInit();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
import CommonCard from "./common_card.astro";
|
|
3
|
-
import { img_change_attrs, render_url } from "../../scripts/util";
|
|
4
3
|
interface Props {
|
|
5
4
|
swiperID: string;
|
|
6
5
|
items: any[];
|
|
@@ -55,7 +54,7 @@ const {
|
|
|
55
54
|
}
|
|
56
55
|
</style>
|
|
57
56
|
<script>
|
|
58
|
-
import { initSwiper } from "../../scripts/swiper";
|
|
57
|
+
import { initSwiper } from "../../scripts/swiper.js";
|
|
59
58
|
class AstroSwiper extends HTMLElement {
|
|
60
59
|
constructor() {
|
|
61
60
|
super();
|
package/src/env.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="astro/client" />
|
|
2
|
+
|
|
3
|
+
declare module 'lodash';
|
|
4
|
+
|
|
5
|
+
declare namespace App {
|
|
6
|
+
interface Locals {
|
|
7
|
+
cache(seconds: number): void,
|
|
8
|
+
base_url: string,
|
|
9
|
+
title: string,
|
|
10
|
+
all_categories: any,
|
|
11
|
+
all_langs: any,
|
|
12
|
+
site_options: {
|
|
13
|
+
copyright: string,
|
|
14
|
+
tel: string,
|
|
15
|
+
sitelogo: string,
|
|
16
|
+
logo_title: string,
|
|
17
|
+
sitename: string,
|
|
18
|
+
seo_title: string,
|
|
19
|
+
seo_keywords: string,
|
|
20
|
+
seo_description: string
|
|
21
|
+
},
|
|
22
|
+
siteinfo: any,
|
|
23
|
+
btn_class: string[]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ImportMetaEnv{
|
|
28
|
+
readonly JEAWIN_API_DOMAIN: string;
|
|
29
|
+
readonly JEAWIN_PREVIEW_DOMAIN: string;
|
|
30
|
+
readonly JEAWIN_FORM_API_DOMAIN: string;
|
|
31
|
+
readonly JEAWIN_API_PATH: string;
|
|
32
|
+
readonly JEAWIN_SITE_ID: number;
|
|
33
|
+
readonly PUBLIC_JEAWIN_API_DOMAIN: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface ImportMeta{
|
|
37
|
+
readonly env: ImportMetaEnv;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function aosInit(): void;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export function consolelog(...items: any[]): void;
|
|
2
|
+
export function delete_cache(): Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* 首页数据
|
|
5
|
+
*/
|
|
6
|
+
export function get_index(): Promise<any>;
|
|
7
|
+
/**
|
|
8
|
+
* 分享按钮
|
|
9
|
+
*/
|
|
10
|
+
export function get_share_button(params: any): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* 评论表单
|
|
13
|
+
*/
|
|
14
|
+
export function get_comment_form(params: any): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* 统计代码
|
|
17
|
+
*/
|
|
18
|
+
export function get_stats(params: any): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* 作者信息
|
|
21
|
+
*/
|
|
22
|
+
export function get_author_info(params: any): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* 国家列表
|
|
25
|
+
*/
|
|
26
|
+
export function get_country(): Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* 获取glossary
|
|
29
|
+
*/
|
|
30
|
+
export function get_glossary(): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* 获取表单
|
|
33
|
+
*/
|
|
34
|
+
export function get_form(params: any): Promise<any>;
|
|
35
|
+
export function get_all_langs(): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* 获取多语言
|
|
38
|
+
*/
|
|
39
|
+
export function get_lang(params: any): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* 所有的uri
|
|
42
|
+
*/
|
|
43
|
+
export function get_all_uri(): Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* 全部site_option
|
|
46
|
+
*/
|
|
47
|
+
export function get_site_options(): Promise<{
|
|
48
|
+
data: any;
|
|
49
|
+
siteinfo: any;
|
|
50
|
+
base_url: any;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* 单个site_option
|
|
54
|
+
*/
|
|
55
|
+
export function get_site_option(params: any): Promise<any>;
|
|
56
|
+
/**
|
|
57
|
+
* 菜单
|
|
58
|
+
*/
|
|
59
|
+
export function get_menus(params: any): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* 树形菜单
|
|
62
|
+
*/
|
|
63
|
+
export function get_menu_tree(params: any): Promise<any>;
|
|
64
|
+
/**
|
|
65
|
+
* 区块列表
|
|
66
|
+
*/
|
|
67
|
+
export function get_blocks(): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* 单个区块
|
|
70
|
+
*/
|
|
71
|
+
export function get_block(params: any): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* 单个栏目
|
|
74
|
+
*/
|
|
75
|
+
export function get_channel(params: any): Promise<any>;
|
|
76
|
+
/**
|
|
77
|
+
* 全部类别
|
|
78
|
+
*/
|
|
79
|
+
export function get_all_categories(params: any): Promise<any>;
|
|
80
|
+
/**
|
|
81
|
+
* 类别
|
|
82
|
+
*/
|
|
83
|
+
export function get_categories(params: any): Promise<any>;
|
|
84
|
+
/**
|
|
85
|
+
* 类别树形
|
|
86
|
+
*/
|
|
87
|
+
export function get_category_tree(params: any): Promise<any>;
|
|
88
|
+
/**
|
|
89
|
+
* 单个类别
|
|
90
|
+
*/
|
|
91
|
+
export function get_category(params: any): Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* 内容列表
|
|
94
|
+
*/
|
|
95
|
+
export function get_nodes(params: any): Promise<any>;
|
|
96
|
+
/**
|
|
97
|
+
* 相关内容列表
|
|
98
|
+
*/
|
|
99
|
+
export function get_rel_nodes(params: any): Promise<any>;
|
|
100
|
+
/**
|
|
101
|
+
* 单个内容
|
|
102
|
+
*/
|
|
103
|
+
export function get_node(params: any): Promise<any>;
|
|
104
|
+
export function get_prevnext_node(params: any): Promise<any>;
|
|
105
|
+
export function get_channel_url(params: any): Promise<any>;
|
|
106
|
+
export function get_category_url(params: any): Promise<any>;
|
|
107
|
+
export function get_node_url(params: any): Promise<any>;
|
|
108
|
+
export function get_friendlinks(params: any): Promise<any[]>;
|
|
109
|
+
export function get_choose_language(params: any): Promise<any>;
|
|
110
|
+
export function get_theme_render_image(params: any): Promise<any>;
|
|
111
|
+
export function get_theme_image_url(params: any): Promise<any>;
|
|
112
|
+
export function get_sitemap(): Promise<any>;
|
|
113
|
+
export function get_filter_links(params: any): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function initPhotoSwipeLightbox(gallery: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function initSwiper(selectors: any, params?: {}): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 判断是不是默认图片
|
|
3
|
+
*/
|
|
4
|
+
export function is_default_image(img_url: any): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* 输出发布时间
|
|
7
|
+
*/
|
|
8
|
+
export function render_date(t: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* 安全输出数据
|
|
11
|
+
*/
|
|
12
|
+
export function render_value(obj: any, prop: any, def?: string): any;
|
|
13
|
+
/**
|
|
14
|
+
* 输出url
|
|
15
|
+
*/
|
|
16
|
+
export function render_url(url: any): string;
|
|
17
|
+
/**
|
|
18
|
+
* 输出url
|
|
19
|
+
*/
|
|
20
|
+
export function get_url(page_type: any, id: any): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* 图片添加链接
|
|
23
|
+
*/
|
|
24
|
+
export function img_add_link(img_html: any): any;
|
|
25
|
+
/**
|
|
26
|
+
* 图片修改属性
|
|
27
|
+
*/
|
|
28
|
+
export function img_change_attrs(img_html: any, add_attrs: any, remove_attrs: any): any;
|
|
29
|
+
export function get_children_categories(all_categories: any, channel_id: any, category_id: any): any;
|
package/src/service/jeawin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LocalImageService, AstroConfig, ImageTransform, ImageOutputFormat } from "astro";
|
|
2
2
|
import {baseService} from 'astro/assets';
|
|
3
|
-
function isESMImportedImage(src) {
|
|
3
|
+
function isESMImportedImage(src: any) {
|
|
4
4
|
return typeof src === "object";
|
|
5
5
|
}
|
|
6
6
|
function parseQuality(quality: any) {
|
|
@@ -10,7 +10,7 @@ function parseQuality(quality: any) {
|
|
|
10
10
|
}
|
|
11
11
|
return result;
|
|
12
12
|
}
|
|
13
|
-
function getTargetDimensions(options) {
|
|
13
|
+
function getTargetDimensions(options: any) {
|
|
14
14
|
let targetWidth = options.width;
|
|
15
15
|
let targetHeight = options.height;
|
|
16
16
|
if (isESMImportedImage(options.src)) {
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "astro/tsconfigs/strict",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"lib": [
|
|
6
|
-
"dom",
|
|
7
|
-
"dom.iterable",
|
|
8
|
-
"esnext",
|
|
9
|
-
],
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"allowJs": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"allowSyntheticDefaultImports": true,
|
|
15
|
-
"strict": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": false,
|
|
17
|
-
"noFallthroughCasesInSwitch": true,
|
|
18
|
-
"module": "esnext",
|
|
19
|
-
"moduleResolution": "node",
|
|
20
|
-
"resolveJsonModule": true,
|
|
21
|
-
"isolatedModules": true,
|
|
22
|
-
"noEmit": true,
|
|
23
|
-
"jsx": "preserve",
|
|
24
|
-
"plugins": [
|
|
4
|
+
"plugins":[
|
|
25
5
|
{
|
|
26
|
-
"name":
|
|
27
|
-
}
|
|
6
|
+
"name":"@astrojs/ts-plugin"
|
|
7
|
+
}
|
|
28
8
|
],
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "node16",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"baseUrl": ".",
|
|
14
|
+
"paths": {
|
|
15
|
+
"@components/*": [
|
|
16
|
+
"src/components/*"
|
|
17
|
+
],
|
|
18
|
+
"@assets/*": [
|
|
19
|
+
"src/assets/*"
|
|
20
|
+
],
|
|
21
|
+
"@layouts/*": [
|
|
22
|
+
"src/layouts/*"
|
|
23
|
+
],
|
|
24
|
+
"@scripts/*":[
|
|
25
|
+
"src/scripts/*"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
38
29
|
}
|