@stephenchenorg/astro 7.2.0 → 8.0.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.
@@ -1,4 +1,4 @@
1
- import * as graphql14 from "graphql";
1
+ import * as graphql6 from "graphql";
2
2
 
3
3
  //#region src/company-setting/types.d.ts
4
4
  interface DataCompanySetting {
@@ -42,6 +42,6 @@ declare function createCompanySetting(companySetting: Partial<CompanySetting>):
42
42
  };
43
43
  //#endregion
44
44
  //#region src/company-setting/fragments.d.ts
45
- declare const companySettingFields: graphql14.DocumentNode;
45
+ declare const companySettingFields: graphql6.DocumentNode;
46
46
  //#endregion
47
47
  export { CompanySetting, DataCompanySetting, companySettingFields, createCompanySetting };
@@ -1,4 +1,4 @@
1
- import * as vue27 from "vue";
1
+ import * as vue33 from "vue";
2
2
  import { PropType } from "vue";
3
3
 
4
4
  //#region src/form-validator/types.d.ts
@@ -23,7 +23,7 @@ declare class FormValidator {
23
23
  }
24
24
  //#endregion
25
25
  //#region src/form-validator/components/FormField.d.ts
26
- declare const FormField: vue27.DefineComponent<vue27.ExtractPropTypes<{
26
+ declare const FormField: vue33.DefineComponent<vue33.ExtractPropTypes<{
27
27
  id: {
28
28
  type: StringConstructor;
29
29
  required: true;
@@ -32,9 +32,9 @@ declare const FormField: vue27.DefineComponent<vue27.ExtractPropTypes<{
32
32
  type: PropType<FormRule[]>;
33
33
  default: () => never[];
34
34
  };
35
- }>, () => vue27.VNode<vue27.RendererNode, vue27.RendererElement, {
35
+ }>, () => vue33.VNode<vue33.RendererNode, vue33.RendererElement, {
36
36
  [key: string]: any;
37
- }>[] | undefined, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<vue27.ExtractPropTypes<{
37
+ }>[] | undefined, {}, {}, {}, vue33.ComponentOptionsMixin, vue33.ComponentOptionsMixin, {}, string, vue33.PublicProps, Readonly<vue33.ExtractPropTypes<{
38
38
  id: {
39
39
  type: StringConstructor;
40
40
  required: true;
@@ -45,27 +45,27 @@ declare const FormField: vue27.DefineComponent<vue27.ExtractPropTypes<{
45
45
  };
46
46
  }>> & Readonly<{}>, {
47
47
  rules: FormRule[];
48
- }, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
48
+ }, {}, {}, {}, string, vue33.ComponentProvideOptions, true, {}, any>;
49
49
  //#endregion
50
50
  //#region src/form-validator/components/FormValidatorProvider.d.ts
51
51
  interface FormValidatorProviderExposed {
52
52
  formValidator: () => FormValidator;
53
53
  }
54
- declare const FormValidatorProvider: vue27.DefineComponent<vue27.ExtractPropTypes<{
54
+ declare const FormValidatorProvider: vue33.DefineComponent<vue33.ExtractPropTypes<{
55
55
  errors: {
56
56
  type: PropType<FormErrors>;
57
57
  default: () => {};
58
58
  };
59
- }>, () => vue27.VNode<vue27.RendererNode, vue27.RendererElement, {
59
+ }>, () => vue33.VNode<vue33.RendererNode, vue33.RendererElement, {
60
60
  [key: string]: any;
61
- }>[] | undefined, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<vue27.ExtractPropTypes<{
61
+ }>[] | undefined, {}, {}, {}, vue33.ComponentOptionsMixin, vue33.ComponentOptionsMixin, {}, string, vue33.PublicProps, Readonly<vue33.ExtractPropTypes<{
62
62
  errors: {
63
63
  type: PropType<FormErrors>;
64
64
  default: () => {};
65
65
  };
66
66
  }>> & Readonly<{}>, {
67
67
  errors: FormErrors;
68
- }, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
68
+ }, {}, {}, {}, string, vue33.ComponentProvideOptions, true, {}, any>;
69
69
  //#endregion
70
70
  //#region src/form-validator/useFormValidator.d.ts
71
71
  declare function useFormValidator(): FormValidator;
@@ -1,9 +1,9 @@
1
- import * as graphql0 from "graphql";
1
+ import * as graphql18 from "graphql";
2
2
 
3
3
  //#region src/image/fragments.d.ts
4
- declare const imageFields: graphql0.DocumentNode;
5
- declare const coverFields: graphql0.DocumentNode;
6
- declare const backgroundFields: graphql0.DocumentNode;
4
+ declare const imageFields: graphql18.DocumentNode;
5
+ declare const coverFields: graphql18.DocumentNode;
6
+ declare const backgroundFields: graphql18.DocumentNode;
7
7
  //#endregion
8
8
  //#region src/image/types.d.ts
9
9
  interface ImageSource {
@@ -1,4 +1,4 @@
1
- import * as graphql39 from "graphql";
1
+ import * as graphql44 from "graphql";
2
2
 
3
3
  //#region src/page/field/fragments.d.ts
4
4
 
@@ -6,7 +6,7 @@ import * as graphql39 from "graphql";
6
6
  * Page fields fragment requires explicit import image
7
7
  * fields fragment `imageFields` from Image module.
8
8
  */
9
- declare const pageFields: graphql39.DocumentNode;
9
+ declare const pageFields: graphql44.DocumentNode;
10
10
  //#endregion
11
11
  //#region src/page/types.d.ts
12
12
  interface DataPage {
@@ -88,7 +88,7 @@ declare function pageTextField(fields: PageField[], key: string): string | null;
88
88
  declare function pageImageFieldForBackground(fields: PageField[], key: string): string;
89
89
  //#endregion
90
90
  //#region src/page/seo-meta/fragments.d.ts
91
- declare const seoMetaFields: (dummyClass: string) => graphql39.DocumentNode;
91
+ declare const seoMetaFields: (dummyClass: string) => graphql44.DocumentNode;
92
92
  //#endregion
93
93
  //#region src/page/seo-meta/helpers.d.ts
94
94
  type UseSeoMetaOptions = Partial<Omit<PageMeta, 'title'>> & {
@@ -0,0 +1,32 @@
1
+ import * as vue0 from "vue";
2
+ import { MaybeRefOrGetter } from "vue";
3
+
4
+ //#region src/pagination-vue-client-side/types.d.ts
5
+ interface Paginator<T> {
6
+ total: number;
7
+ per_page: number;
8
+ data: T[];
9
+ }
10
+ //#endregion
11
+ //#region src/pagination-vue-client-side/usePagination.d.ts
12
+ declare function usePagination(options: {
13
+ total: MaybeRefOrGetter<number>;
14
+ currentPage: MaybeRefOrGetter<number>;
15
+ perPage?: MaybeRefOrGetter<number | undefined>;
16
+ visiblePages?: MaybeRefOrGetter<number | undefined>;
17
+ onChange?: (page: number) => void;
18
+ }): {
19
+ items: vue0.ComputedRef<number[]>;
20
+ showPagination: vue0.ComputedRef<boolean>;
21
+ canFirst: vue0.ComputedRef<boolean>;
22
+ canPrev: vue0.ComputedRef<boolean>;
23
+ canNext: vue0.ComputedRef<boolean>;
24
+ canLast: vue0.ComputedRef<boolean>;
25
+ gotoFirst: () => void;
26
+ gotoPrev: () => void;
27
+ gotoNext: () => void;
28
+ gotoLast: () => void;
29
+ gotoPage: (page: number) => void;
30
+ };
31
+ //#endregion
32
+ export { Paginator, usePagination };
@@ -0,0 +1,42 @@
1
+ import { computed, toValue } from "vue";
2
+
3
+ //#region src/pagination-vue-client-side/usePagination.ts
4
+ function usePagination(options) {
5
+ const total = computed(() => toValue(options.total));
6
+ const currentPage = computed(() => toValue(options.currentPage));
7
+ const perPage = computed(() => toValue(options.perPage) || 12);
8
+ const totalPages = computed(() => Math.ceil(total.value / perPage.value));
9
+ const visiblePages = computed(() => Math.min(toValue(options.visiblePages) || 5, totalPages.value));
10
+ const sideCount = computed(() => Math.floor(visiblePages.value / 2));
11
+ const items = computed(() => {
12
+ const items$1 = [];
13
+ let start = Math.max(1, currentPage.value - sideCount.value);
14
+ let end = Math.min(totalPages.value, currentPage.value + sideCount.value);
15
+ if (end - start + 1 < visiblePages.value && currentPage.value > 0) {
16
+ if (currentPage.value <= sideCount.value) end = Math.min(totalPages.value, start + visiblePages.value - 1);
17
+ else if (currentPage.value > totalPages.value - sideCount.value) start = Math.max(1, end - visiblePages.value + 1);
18
+ }
19
+ for (let i = start; i <= end; i++) items$1.push(i);
20
+ return items$1;
21
+ });
22
+ function gotoPage(page) {
23
+ const newPage = Math.max(1, Math.min(page, totalPages.value));
24
+ if (newPage !== currentPage.value) options.onChange?.(newPage);
25
+ }
26
+ return {
27
+ items,
28
+ showPagination: computed(() => total.value > perPage.value),
29
+ canFirst: computed(() => currentPage.value > 1),
30
+ canPrev: computed(() => currentPage.value > 1),
31
+ canNext: computed(() => currentPage.value < totalPages.value),
32
+ canLast: computed(() => currentPage.value < totalPages.value),
33
+ gotoFirst: () => gotoPage(1),
34
+ gotoPrev: () => gotoPage(currentPage.value - 1),
35
+ gotoNext: () => gotoPage(currentPage.value + 1),
36
+ gotoLast: () => gotoPage(totalPages.value),
37
+ gotoPage
38
+ };
39
+ }
40
+
41
+ //#endregion
42
+ export { usePagination };
@@ -0,0 +1,32 @@
1
+ import * as vue7 from "vue";
2
+ import { MaybeRefOrGetter } from "vue";
3
+
4
+ //#region src/pagination-vue-server-side/types.d.ts
5
+ interface Paginator<T> {
6
+ total: number;
7
+ per_page: number;
8
+ data: T[];
9
+ }
10
+ //#endregion
11
+ //#region src/pagination-vue-server-side/usePagination.d.ts
12
+ declare function usePagination(options: {
13
+ total: MaybeRefOrGetter<number>;
14
+ currentPage: MaybeRefOrGetter<number>;
15
+ url: string;
16
+ perPage?: MaybeRefOrGetter<number | undefined>;
17
+ visiblePages?: MaybeRefOrGetter<number | undefined>;
18
+ }): {
19
+ items: vue7.ComputedRef<number[]>;
20
+ showPagination: vue7.ComputedRef<boolean>;
21
+ canFirst: vue7.ComputedRef<boolean>;
22
+ canPrev: vue7.ComputedRef<boolean>;
23
+ canNext: vue7.ComputedRef<boolean>;
24
+ canLast: vue7.ComputedRef<boolean>;
25
+ firstUrl: vue7.ComputedRef<string>;
26
+ prevUrl: vue7.ComputedRef<string>;
27
+ nextUrl: vue7.ComputedRef<string>;
28
+ lastUrl: vue7.ComputedRef<string>;
29
+ getUrl: (page: number) => string;
30
+ };
31
+ //#endregion
32
+ export { Paginator, usePagination };
@@ -1,12 +1,12 @@
1
1
  import { computed, toValue } from "vue";
2
2
 
3
- //#region src/pagination-vue/usePagination.ts
3
+ //#region src/pagination-vue-server-side/usePagination.ts
4
4
  function usePagination(options) {
5
5
  const total = computed(() => toValue(options.total));
6
6
  const currentPage = computed(() => toValue(options.currentPage));
7
- const perPage = computed(() => toValue(options.perPage || 12));
7
+ const perPage = computed(() => toValue(options.perPage) || 12);
8
8
  const totalPages = computed(() => Math.ceil(total.value / perPage.value));
9
- const visiblePages = computed(() => Math.min(toValue(options.visiblePages || 5), totalPages.value));
9
+ const visiblePages = computed(() => Math.min(toValue(options.visiblePages) || 5, totalPages.value));
10
10
  const sideCount = computed(() => Math.floor(visiblePages.value / 2));
11
11
  const items = computed(() => {
12
12
  const items$1 = [];
@@ -27,7 +27,6 @@ function usePagination(options) {
27
27
  return {
28
28
  items,
29
29
  showPagination: computed(() => total.value > perPage.value),
30
- currentPage,
31
30
  canFirst: computed(() => currentPage.value > 1),
32
31
  canPrev: computed(() => currentPage.value > 1),
33
32
  canNext: computed(() => currentPage.value < totalPages.value),
@@ -1,4 +1,4 @@
1
- import * as nanostores37 from "nanostores";
1
+ import * as nanostores17 from "nanostores";
2
2
  import qs from "query-string";
3
3
 
4
4
  //#region src/query-params/types.d.ts
@@ -13,7 +13,7 @@ interface UrlConfig {
13
13
  declare function createUrlConfig(config: UrlConfig): UrlConfig;
14
14
  //#endregion
15
15
  //#region src/query-params/store.d.ts
16
- declare const urlConfigStore: nanostores37.PreinitializedWritableAtom<UrlConfig> & object;
16
+ declare const urlConfigStore: nanostores17.PreinitializedWritableAtom<UrlConfig> & object;
17
17
  //#endregion
18
18
  //#region src/query-params/url.d.ts
19
19
  declare global {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stephenchenorg/astro",
3
3
  "type": "module",
4
- "version": "7.2.0",
4
+ "version": "8.0.0",
5
5
  "description": "Stephenchenorg Astro 前端通用套件",
6
6
  "license": "MIT",
7
7
  "homepage": "https://stephenchenorg-astro.netlify.app",
@@ -46,9 +46,13 @@
46
46
  "types": "./dist/pagination-astro/index.d.ts",
47
47
  "import": "./dist/pagination-astro/index.js"
48
48
  },
49
- "./pagination-vue": {
50
- "types": "./dist/pagination-vue/index.d.ts",
51
- "import": "./dist/pagination-vue/index.js"
49
+ "./pagination-vue-client-side": {
50
+ "types": "./dist/pagination-vue-client-side/index.d.ts",
51
+ "import": "./dist/pagination-vue-client-side/index.js"
52
+ },
53
+ "./pagination-vue-server-side": {
54
+ "types": "./dist/pagination-vue-server-side/index.d.ts",
55
+ "import": "./dist/pagination-vue-server-side/index.js"
52
56
  },
53
57
  "./query-params": {
54
58
  "types": "./dist/query-params/index.d.ts",
@@ -1,33 +0,0 @@
1
- import * as vue3 from "vue";
2
- import { MaybeRefOrGetter } from "vue";
3
-
4
- //#region src/pagination-vue/types.d.ts
5
- interface Paginator<T> {
6
- total: number;
7
- per_page: number;
8
- data: T[];
9
- }
10
- //#endregion
11
- //#region src/pagination-vue/usePagination.d.ts
12
- declare function usePagination(options: {
13
- total: MaybeRefOrGetter<number>;
14
- currentPage: MaybeRefOrGetter<number>;
15
- url: string;
16
- perPage?: MaybeRefOrGetter<number>;
17
- visiblePages?: MaybeRefOrGetter<number>;
18
- }): {
19
- items: vue3.ComputedRef<number[]>;
20
- showPagination: vue3.ComputedRef<boolean>;
21
- currentPage: vue3.ComputedRef<number>;
22
- canFirst: vue3.ComputedRef<boolean>;
23
- canPrev: vue3.ComputedRef<boolean>;
24
- canNext: vue3.ComputedRef<boolean>;
25
- canLast: vue3.ComputedRef<boolean>;
26
- firstUrl: vue3.ComputedRef<string>;
27
- prevUrl: vue3.ComputedRef<string>;
28
- nextUrl: vue3.ComputedRef<string>;
29
- lastUrl: vue3.ComputedRef<string>;
30
- getUrl: (page: number) => string;
31
- };
32
- //#endregion
33
- export { Paginator, usePagination };