@stephenchenorg/astro 1.1.2 → 1.2.1

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.
@@ -0,0 +1,18 @@
1
+ import type { CompanySetting } from './types';
2
+ export declare function createCompanySetting(companySetting: Partial<CompanySetting>): {
3
+ lang: string;
4
+ name: string;
5
+ description: string;
6
+ logo: string;
7
+ address_1: string;
8
+ address_2: string;
9
+ email_1: string;
10
+ email_2: string;
11
+ fb_link: string;
12
+ ig_link: string;
13
+ line_link: string;
14
+ phone_1: string;
15
+ phone_2: string;
16
+ twitter_link: string;
17
+ threads_link: string;
18
+ };
@@ -0,0 +1,19 @@
1
+ export function createCompanySetting(companySetting) {
2
+ return {
3
+ lang: companySetting.lang || "zh_TW",
4
+ name: companySetting.name || "Astro",
5
+ description: companySetting.description || "",
6
+ logo: companySetting.logo || "",
7
+ address_1: companySetting.address_1 || "",
8
+ address_2: companySetting.address_2 || "",
9
+ email_1: companySetting.email_1 || "",
10
+ email_2: companySetting.email_2 || "",
11
+ fb_link: companySetting.fb_link || "",
12
+ ig_link: companySetting.ig_link || "",
13
+ line_link: companySetting.line_link || "",
14
+ phone_1: companySetting.phone_1 || "",
15
+ phone_2: companySetting.phone_2 || "",
16
+ twitter_link: companySetting.twitter_link || "",
17
+ threads_link: companySetting.threads_link || ""
18
+ };
19
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './fragments';
2
+ export * from './create';
2
3
  export * from './types';
@@ -1,2 +1,3 @@
1
1
  export * from "./fragments.js";
2
+ export * from "./create.js";
2
3
  export * from "./types.js";
@@ -1,5 +1,5 @@
1
1
  ---
2
- import { isPlainTextField, isPlainTextareaField, isContentField, isImageField } from '../field/helpers'
2
+ import { isContentField, isImageField, isPlainTextField, isPlainTextareaField } from '../field/helpers'
3
3
  import type { PageField } from '../types'
4
4
  import { ResponsiveImage } from '../../image'
5
5
 
@@ -16,10 +16,10 @@ const field = fields.find(field => field.key === key)
16
16
 
17
17
  {
18
18
  field && (
19
- isPlainTextField(field) ? <Fragment set:text={field.content} /> :
20
- isPlainTextareaField(field) ? <Fragment set:html={field.content} /> :
21
- isContentField(field) ? <Fragment set:html={field.content} /> :
22
- isImageField(field) ? (
19
+ isPlainTextField(field) ? <Fragment set:text={field.content} />
20
+ : isPlainTextareaField(field) ? <Fragment set:html={field.content} />
21
+ : isContentField(field) ? <Fragment set:html={field.content} />
22
+ : isImageField(field) ? (
23
23
  <ResponsiveImage
24
24
  desktop={field.image.desktop}
25
25
  desktopBlur={field.image.desktop_blur}
@@ -28,7 +28,7 @@ const field = fields.find(field => field.key === key)
28
28
  alt={`Image of ${key}`}
29
29
  {...attributes}
30
30
  />
31
- ) :
32
- null
31
+ )
32
+ : null
33
33
  )
34
34
  }
@@ -1,4 +1,4 @@
1
- import type { PageField, PagePlainTextField, PagePlainTextareaField, PageContentField, PageImageField } from '../types';
1
+ import type { PageContentField, PageField, PageImageField, PagePlainTextField, PagePlainTextareaField } from '../types';
2
2
  export declare function isPlainTextField(field: PageField): field is PagePlainTextField;
3
3
  export declare function isPlainTextareaField(field: PageField): field is PagePlainTextareaField;
4
4
  export declare function isContentField(field: PageField): field is PageContentField;
@@ -4,4 +4,4 @@ export type UseSeoMetaOptions = Partial<Omit<PageMeta, 'title'>> & {
4
4
  description?: string | null;
5
5
  image?: string | null;
6
6
  };
7
- export declare function seoMeta(options: UseSeoMetaOptions, userOptions?: PageMeta): PageMeta;
7
+ export declare function seoMeta(options: UseSeoMetaOptions, modelMeta?: PageMeta): PageMeta;
@@ -1,14 +1,14 @@
1
- export function seoMeta(options, userOptions) {
1
+ export function seoMeta(options, modelMeta) {
2
2
  return {
3
- title: userOptions?.title || options.title,
4
- seo_title: userOptions?.seo_title || options.seo_title || null,
5
- seo_description: userOptions?.seo_description || options.description || null,
6
- seo_keyword: userOptions?.seo_keyword || options.seo_keyword || null,
7
- seo_json_ld: userOptions?.seo_json_ld || options.seo_json_ld || null,
8
- seo_head: userOptions?.seo_head || options.seo_head,
9
- seo_body: userOptions?.seo_body || options.seo_body,
10
- og_title: userOptions?.og_title || options.og_title || options.title || null,
11
- og_description: userOptions?.og_description || options.og_description || options.description || null,
12
- og_image: userOptions?.og_image || options.og_image || options.image || null
3
+ title: modelMeta?.title || options.title,
4
+ seo_title: modelMeta?.seo_title || options.seo_title || null,
5
+ seo_description: modelMeta?.seo_description || options.description || null,
6
+ seo_keyword: modelMeta?.seo_keyword || options.seo_keyword || null,
7
+ seo_json_ld: modelMeta?.seo_json_ld || options.seo_json_ld || null,
8
+ seo_head: modelMeta?.seo_head || options.seo_head,
9
+ seo_body: modelMeta?.seo_body || options.seo_body,
10
+ og_title: modelMeta?.og_title || options.og_title || options.title || null,
11
+ og_description: modelMeta?.og_description || options.og_description || options.description || null,
12
+ og_image: modelMeta?.og_image || options.og_image || options.image || null
13
13
  };
14
14
  }
@@ -13,6 +13,7 @@ const config: UrlConfig = {
13
13
  ---
14
14
 
15
15
  <script is:inline define:vars={{ config }}>
16
+ // eslint-disable-next-line style/semi
16
17
  window.__astro_provide_url_config__ = config;
17
18
  </script>
18
19
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@stephenchenorg/astro",
3
3
  "type": "module",
4
- "version": "1.1.2",
4
+ "version": "1.2.1",
5
5
  "description": "Stephenchenorg Astro 前端通用套件",
6
6
  "license": "MIT",
7
7
  "homepage": "https://stephenchenorg-astro.netlify.app",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/stephenchenorg/astro.git"
10
+ "url": "git+https://github.com/stephenchenorg/package.astro.git"
11
11
  },
12
12
  "keywords": [
13
13
  "astro"
@@ -56,7 +56,8 @@
56
56
  },
57
57
  "scripts": {
58
58
  "build": "mkdist --declaration --ext=js",
59
- "code-check": "astro check",
59
+ "lint": "eslint .",
60
+ "code-check": "astro check && npm run lint",
60
61
  "prepack": "npm run build",
61
62
  "release": "bumpp --commit \"Release v%s\" && npm publish"
62
63
  },
@@ -73,8 +74,11 @@
73
74
  },
74
75
  "devDependencies": {
75
76
  "@astrojs/check": "^0.9.4",
77
+ "@ycs77/eslint-config": "^4.1.0",
76
78
  "astro": "^5.4.1",
77
79
  "bumpp": "^10.0.3",
80
+ "eslint": "^9.21.0",
81
+ "eslint-plugin-astro": "^1.3.1",
78
82
  "mkdist": "^2.2.0",
79
83
  "typescript": "~5.7.3"
80
84
  }