@stephenchenorg/astro 1.2.2 → 1.2.4

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.
@@ -7,6 +7,8 @@ interface GraphQLRequestExtensions {
7
7
  line: number;
8
8
  call: number;
9
9
  }[];
10
+ validation?: Record<string, string[]>;
11
+ category?: string;
10
12
  }
11
13
  export declare class GraphQLRequestError extends Error {
12
14
  type: string;
@@ -12,10 +12,14 @@ const {
12
12
  items,
13
13
  showPagination,
14
14
  currentPage,
15
+ canFirst,
15
16
  canPrev,
16
17
  canNext,
18
+ canLast,
19
+ firstUrl,
17
20
  prevUrl,
18
21
  nextUrl,
22
+ lastUrl,
19
23
  getUrl,
20
24
  } = usePagination({
21
25
  total: Astro.props.total,
@@ -28,12 +32,14 @@ const {
28
32
 
29
33
  {showPagination && (
30
34
  <div>
31
- {canPrev && <a href={prevUrl}>&lt;</a>}
35
+ {canFirst && <a href={firstUrl}>First</a>}
36
+ {canPrev && <a href={prevUrl}>Previous</a>}
32
37
  {items.map(page =>
33
38
  page === currentPage
34
39
  ? <span>{page}</span>
35
40
  : <a href={getUrl(page)}>{page}</a>
36
41
  )}
37
- {canNext && <a href={nextUrl}>&gt;</a>}
42
+ {canNext && <a href={nextUrl}>Next</a>}
43
+ {canLast && <a href={lastUrl}>Last</a>}
38
44
  </div>
39
45
  )}
@@ -13,14 +13,12 @@ const config: UrlConfig = {
13
13
  ---
14
14
 
15
15
  <script is:inline define:vars={{ config }}>
16
- // eslint-disable-next-line style/semi
17
16
  window.__astro_provide_url_config__ = config;
18
17
  </script>
19
18
 
20
19
  <script>
21
- import { urlConfigStore } from '../store'
20
+ import { urlConfigStore } from '@stephenchenorg/astro/query-params'
22
21
 
23
- // @ts-ignore
24
22
  const props = window.__astro_provide_url_config__
25
23
 
26
24
  const baseUrl: string = props?.baseUrl || location.pathname
@@ -1,5 +1,6 @@
1
1
  import ProvideUrlConfig from './components/ProvideUrlConfig.astro';
2
2
  export * from './config';
3
+ export * from './store';
3
4
  export * from './url';
4
5
  export * from './utils';
5
6
  export * from './types';
@@ -1,5 +1,6 @@
1
1
  import ProvideUrlConfig from "./components/ProvideUrlConfig.astro";
2
2
  export * from "./config.js";
3
+ export * from "./store.js";
3
4
  export * from "./url.js";
4
5
  export * from "./utils.js";
5
6
  export * from "./types.js";
@@ -1,5 +1,10 @@
1
1
  import qs from 'query-string';
2
2
  import type { UrlConfig } from './types';
3
+ declare global {
4
+ interface Window {
5
+ __astro_provide_url_config__?: UrlConfig;
6
+ }
7
+ }
3
8
  export interface QueryParamsUrlOptions {
4
9
  transformParams?: (params: Record<string, any>) => Record<string, any>;
5
10
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stephenchenorg/astro",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.2.4",
5
5
  "description": "Stephenchenorg Astro 前端通用套件",
6
6
  "license": "MIT",
7
7
  "homepage": "https://stephenchenorg-astro.netlify.app",