@stephenchenorg/astro 6.0.0 → 7.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 vue17 from "vue";
1
+ import * as vue18 from "vue";
2
2
  import { PropType } from "vue";
3
3
 
4
4
  //#region src/form-validator/types.d.ts
@@ -22,7 +22,7 @@ declare class FormValidator {
22
22
  }
23
23
  //#endregion
24
24
  //#region src/form-validator/components/FormField.d.ts
25
- declare const FormField: vue17.DefineComponent<vue17.ExtractPropTypes<{
25
+ declare const FormField: vue18.DefineComponent<vue18.ExtractPropTypes<{
26
26
  id: {
27
27
  type: StringConstructor;
28
28
  required: true;
@@ -31,9 +31,9 @@ declare const FormField: vue17.DefineComponent<vue17.ExtractPropTypes<{
31
31
  type: PropType<FormRule[]>;
32
32
  default: () => never[];
33
33
  };
34
- }>, () => vue17.VNode<vue17.RendererNode, vue17.RendererElement, {
34
+ }>, () => vue18.VNode<vue18.RendererNode, vue18.RendererElement, {
35
35
  [key: string]: any;
36
- }>[] | undefined, {}, {}, {}, vue17.ComponentOptionsMixin, vue17.ComponentOptionsMixin, {}, string, vue17.PublicProps, Readonly<vue17.ExtractPropTypes<{
36
+ }>[] | undefined, {}, {}, {}, vue18.ComponentOptionsMixin, vue18.ComponentOptionsMixin, {}, string, vue18.PublicProps, Readonly<vue18.ExtractPropTypes<{
37
37
  id: {
38
38
  type: StringConstructor;
39
39
  required: true;
@@ -44,27 +44,27 @@ declare const FormField: vue17.DefineComponent<vue17.ExtractPropTypes<{
44
44
  };
45
45
  }>> & Readonly<{}>, {
46
46
  rules: FormRule[];
47
- }, {}, {}, {}, string, vue17.ComponentProvideOptions, true, {}, any>;
47
+ }, {}, {}, {}, string, vue18.ComponentProvideOptions, true, {}, any>;
48
48
  //#endregion
49
49
  //#region src/form-validator/components/FormValidatorProvider.d.ts
50
50
  interface FormValidatorProviderExposed {
51
51
  formValidator: () => FormValidator;
52
52
  }
53
- declare const FormValidatorProvider: vue17.DefineComponent<vue17.ExtractPropTypes<{
53
+ declare const FormValidatorProvider: vue18.DefineComponent<vue18.ExtractPropTypes<{
54
54
  errors: {
55
55
  type: PropType<FormErrors>;
56
56
  default: () => {};
57
57
  };
58
- }>, () => vue17.VNode<vue17.RendererNode, vue17.RendererElement, {
58
+ }>, () => vue18.VNode<vue18.RendererNode, vue18.RendererElement, {
59
59
  [key: string]: any;
60
- }>[] | undefined, {}, {}, {}, vue17.ComponentOptionsMixin, vue17.ComponentOptionsMixin, {}, string, vue17.PublicProps, Readonly<vue17.ExtractPropTypes<{
60
+ }>[] | undefined, {}, {}, {}, vue18.ComponentOptionsMixin, vue18.ComponentOptionsMixin, {}, string, vue18.PublicProps, Readonly<vue18.ExtractPropTypes<{
61
61
  errors: {
62
62
  type: PropType<FormErrors>;
63
63
  default: () => {};
64
64
  };
65
65
  }>> & Readonly<{}>, {
66
66
  errors: FormErrors;
67
- }, {}, {}, {}, string, vue17.ComponentProvideOptions, true, {}, any>;
67
+ }, {}, {}, {}, string, vue18.ComponentProvideOptions, true, {}, any>;
68
68
  //#endregion
69
69
  //#region src/form-validator/useFormValidator.d.ts
70
70
  declare function useFormValidator(): FormValidator;
@@ -1,4 +1,4 @@
1
- import * as graphql39 from "graphql";
1
+ import * as graphql38 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: graphql38.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) => graphql38.DocumentNode;
92
92
  //#endregion
93
93
  //#region src/page/seo-meta/helpers.d.ts
94
94
  type UseSeoMetaOptions = Partial<Omit<PageMeta, 'title'>> & {
@@ -1,4 +1,4 @@
1
- import * as vue27 from "vue";
1
+ import * as vue4 from "vue";
2
2
  import { MaybeRefOrGetter } from "vue";
3
3
 
4
4
  //#region src/pagination-vue/types.d.ts
@@ -16,17 +16,17 @@ declare function usePagination(options: {
16
16
  perPage?: MaybeRefOrGetter<number>;
17
17
  visiblePages?: MaybeRefOrGetter<number>;
18
18
  }): {
19
- items: vue27.ComputedRef<number[]>;
20
- showPagination: vue27.ComputedRef<boolean>;
21
- currentPage: vue27.ComputedRef<number>;
22
- canFirst: vue27.ComputedRef<boolean>;
23
- canPrev: vue27.ComputedRef<boolean>;
24
- canNext: vue27.ComputedRef<boolean>;
25
- canLast: vue27.ComputedRef<boolean>;
26
- firstUrl: vue27.ComputedRef<string>;
27
- prevUrl: vue27.ComputedRef<string>;
28
- nextUrl: vue27.ComputedRef<string>;
29
- lastUrl: vue27.ComputedRef<string>;
19
+ items: vue4.ComputedRef<number[]>;
20
+ showPagination: vue4.ComputedRef<boolean>;
21
+ currentPage: vue4.ComputedRef<number>;
22
+ canFirst: vue4.ComputedRef<boolean>;
23
+ canPrev: vue4.ComputedRef<boolean>;
24
+ canNext: vue4.ComputedRef<boolean>;
25
+ canLast: vue4.ComputedRef<boolean>;
26
+ firstUrl: vue4.ComputedRef<string>;
27
+ prevUrl: vue4.ComputedRef<string>;
28
+ nextUrl: vue4.ComputedRef<string>;
29
+ lastUrl: vue4.ComputedRef<string>;
30
30
  getUrl: (page: number) => string;
31
31
  };
32
32
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as nanostores4 from "nanostores";
1
+ import * as nanostores15 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: nanostores4.PreinitializedWritableAtom<UrlConfig> & object;
16
+ declare const urlConfigStore: nanostores15.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": "6.0.0",
4
+ "version": "7.0.0",
5
5
  "description": "Stephenchenorg Astro 前端通用套件",
6
6
  "license": "MIT",
7
7
  "homepage": "https://stephenchenorg-astro.netlify.app",
@@ -10,7 +10,13 @@
10
10
  "url": "git+https://github.com/stephenchenorg/package.astro.git"
11
11
  },
12
12
  "keywords": [
13
- "astro"
13
+ "astro",
14
+ "vue",
15
+ "components",
16
+ "query-string",
17
+ "pagination",
18
+ "form-validator",
19
+ "query-params"
14
20
  ],
15
21
  "exports": {
16
22
  "./api": {
@@ -44,10 +50,6 @@
44
50
  "types": "./dist/pagination-vue/index.d.ts",
45
51
  "import": "./dist/pagination-vue/index.js"
46
52
  },
47
- "./product-variant": {
48
- "types": "./dist/product-variant/index.d.ts",
49
- "import": "./dist/product-variant/index.js"
50
- },
51
53
  "./query-params": {
52
54
  "types": "./dist/query-params/index.d.ts",
53
55
  "import": "./dist/query-params/index.js"
@@ -1,69 +0,0 @@
1
- //#region src/product-variant/types.d.ts
2
- interface ProductVariant {
3
- id: number;
4
- /** 商品規格 Key */
5
- combination_key: string | null;
6
- /** 原價 */
7
- listing_price: number;
8
- /** 實際售價 */
9
- selling_price: number;
10
- /** 商品庫存數量 */
11
- inventory: number;
12
- }
13
- interface ProductVariantAttribute {
14
- id: number;
15
- title: string;
16
- options: ProductVariantAttributeOption[];
17
- }
18
- interface ProductVariantAttributeOption {
19
- id: number;
20
- title: string;
21
- }
22
- //#endregion
23
- //#region src/product-variant/ProductVariantSelector.d.ts
24
- declare class ProductVariantSelector {
25
- /**
26
- * 可用的商品變體列表(所有 SKU)
27
- */
28
- availableVariants: ProductVariant[];
29
- /**
30
- * 商品屬性選項列表(如顏色、尺寸等)
31
- */
32
- variantAttributes: ProductVariantAttribute[];
33
- /**
34
- * 使用者已選擇的屬性值
35
- */
36
- selectedAttributes: Record<number, {
37
- optionId: number;
38
- label: string;
39
- }>;
40
- /**
41
- * 匹配到的商品規格物件
42
- */
43
- currentVariant: ProductVariant | undefined;
44
- constructor({
45
- availableVariants,
46
- variantAttributes
47
- }: {
48
- availableVariants: ProductVariant[];
49
- variantAttributes: ProductVariantAttribute[];
50
- });
51
- /**
52
- * 選擇商品規格
53
- */
54
- selectVariant(attributeId: number, optionId: number, label: string): void;
55
- /**
56
- * 獲取已選擇的商品規格選項標籤
57
- */
58
- getSelectedAttributesLabel(): string;
59
- /**
60
- * 確認是否已選擇所有商品規格選項
61
- */
62
- areAllAttributesSelected(): boolean;
63
- /**
64
- * 確認是否有足夠的庫存
65
- */
66
- hasEnoughStock(stock: number): boolean;
67
- }
68
- //#endregion
69
- export { ProductVariant, ProductVariantAttribute, ProductVariantAttributeOption, ProductVariantSelector };
@@ -1,57 +0,0 @@
1
- //#region src/product-variant/ProductVariantSelector.ts
2
- var ProductVariantSelector = class {
3
- /**
4
- * 可用的商品變體列表(所有 SKU)
5
- */
6
- availableVariants = [];
7
- /**
8
- * 商品屬性選項列表(如顏色、尺寸等)
9
- */
10
- variantAttributes = [];
11
- /**
12
- * 使用者已選擇的屬性值
13
- */
14
- selectedAttributes = {};
15
- /**
16
- * 匹配到的商品規格物件
17
- */
18
- currentVariant = void 0;
19
- constructor({ availableVariants, variantAttributes }) {
20
- this.availableVariants = availableVariants;
21
- this.variantAttributes = variantAttributes;
22
- if (availableVariants.length === 1 && availableVariants[0].combination_key === null) this.currentVariant = availableVariants[0];
23
- }
24
- /**
25
- * 選擇商品規格
26
- */
27
- selectVariant(attributeId, optionId, label) {
28
- this.selectedAttributes[attributeId] = {
29
- optionId,
30
- label
31
- };
32
- const variantCombinationKey = Object.values(this.selectedAttributes).map((attr) => attr.optionId).sort((a, b) => a - b).join("-");
33
- this.currentVariant = this.availableVariants.find((variant) => variant.combination_key === variantCombinationKey);
34
- }
35
- /**
36
- * 獲取已選擇的商品規格選項標籤
37
- */
38
- getSelectedAttributesLabel() {
39
- return Object.values(this.selectedAttributes).map((attr) => attr.label).join(", ");
40
- }
41
- /**
42
- * 確認是否已選擇所有商品規格選項
43
- */
44
- areAllAttributesSelected() {
45
- return Object.keys(this.selectedAttributes).length === this.variantAttributes.length;
46
- }
47
- /**
48
- * 確認是否有足夠的庫存
49
- */
50
- hasEnoughStock(stock) {
51
- const specificationStock = this.currentVariant?.inventory || 0;
52
- return specificationStock > 0 && specificationStock >= stock;
53
- }
54
- };
55
-
56
- //#endregion
57
- export { ProductVariantSelector };