@sandboxsonny/ace-kit 0.9.0 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @sandboxsonny/ace-kit
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4215f32: Show the site's favicon in `<AceSeo>`. The favicon is chosen in the site's settings in the CMS; `<AceSeo>` adds `<link rel="icon">` and `<link rel="apple-touch-icon">` for it when you don't pass a `favicon` yourself. If your layout already has its own icon link, remove it, or the browser may pick either. `getSite()` now also returns the favicon.
8
+
3
9
  ## 0.9.0
4
10
 
5
11
  ### Minor Changes
@@ -7,10 +7,15 @@ import { getSite } from "../dist/astro.js";
7
7
 
8
8
  type Props = AceSeoOptions;
9
9
 
10
- // With no picture of its own, a page shows the social image chosen in the site's settings. The tags are never worth
11
- // failing the page for, so a CMS that can't be reached just means no picture.
12
- const site = Astro.props.image === undefined ? await getSite().catch(() => null) : null;
13
- const properties = seoProperties({ ...Astro.props, image: Astro.props.image ?? site?.social_image?.src });
10
+ // With no picture or icon of its own, a page shows the ones chosen in the site's settings. The tags are never worth
11
+ // failing the page for, so a CMS that can't be reached just means none.
12
+ const needsSite = Astro.props.image === undefined || Astro.props.favicon === undefined;
13
+ const site = needsSite ? await getSite().catch(() => null) : null;
14
+ const properties = seoProperties({
15
+ ...Astro.props,
16
+ image: Astro.props.image ?? site?.social_image?.src,
17
+ favicon: Astro.props.favicon ?? site?.favicon ?? undefined,
18
+ });
14
19
  ---
15
20
 
16
21
  <SEO {...properties} />
package/dist/astro.d.ts CHANGED
@@ -29,6 +29,18 @@ type AceImageData = {
29
29
  content_type: string;
30
30
  };
31
31
 
32
+ /** The site's favicon as the CMS Ace public API returns it: the original, and square PNG copies. */
33
+ type AceFavicon = {
34
+ id: number;
35
+ /** The untouched original. */
36
+ url: string;
37
+ /** A small square PNG (48 pixels), for the browser tab and search results. */
38
+ icon: string;
39
+ /** A square PNG (180 pixels), for a phone's home screen. */
40
+ apple_touch_icon: string;
41
+ content_type: string;
42
+ };
43
+
32
44
  /** The site the request is for, as the CMS Ace public API returns it. */
33
45
  type AceSite = {
34
46
  id: number;
@@ -37,6 +49,8 @@ type AceSite = {
37
49
  handle: string;
38
50
  /** The picture the site's owners chose to show in search results and social posts; null if none. */
39
51
  social_image: AceImageData | null;
52
+ /** The small picture the site's owners chose for browser tabs; null if none. */
53
+ favicon: AceFavicon | null;
40
54
  };
41
55
 
42
56
  /** One link of a menu as the public API returns it, with its address already worked out. */
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ if (major < 22 || major === 22 && minor < 12) {
9
9
  process.exit(1);
10
10
  }
11
11
  try {
12
- const { createRealEnvironment } = await import("./environment-YCQRJ56U.js");
12
+ const { createRealEnvironment } = await import("./environment-M3B4UZ5T.js");
13
13
  const { runCli } = await import("./main-6O2IIVHO.js");
14
14
  const environment = await createRealEnvironment();
15
15
  process.exit(await runCli(process.argv.slice(2), environment));
@@ -145,7 +145,7 @@ function createLastApiUrl(path) {
145
145
  }
146
146
 
147
147
  // src/cli/version.ts
148
- var aceKitVersion = true ? "0.9.0" : "development";
148
+ var aceKitVersion = true ? "0.10.0" : "development";
149
149
 
150
150
  // src/cli/environment.ts
151
151
  var runCommand = (command, commandArguments, input) => new Promise((resolve, reject) => {
package/dist/index.d.ts CHANGED
@@ -99,6 +99,18 @@ type AceImageData = {
99
99
  content_type: string;
100
100
  };
101
101
 
102
+ /** The site's favicon as the CMS Ace public API returns it: the original, and square PNG copies. */
103
+ type AceFavicon = {
104
+ id: number;
105
+ /** The untouched original. */
106
+ url: string;
107
+ /** A small square PNG (48 pixels), for the browser tab and search results. */
108
+ icon: string;
109
+ /** A square PNG (180 pixels), for a phone's home screen. */
110
+ apple_touch_icon: string;
111
+ content_type: string;
112
+ };
113
+
102
114
  /** The site the request is for, as the CMS Ace public API returns it. */
103
115
  type AceSite = {
104
116
  id: number;
@@ -107,6 +119,8 @@ type AceSite = {
107
119
  handle: string;
108
120
  /** The picture the site's owners chose to show in search results and social posts; null if none. */
109
121
  social_image: AceImageData | null;
122
+ /** The small picture the site's owners chose for browser tabs; null if none. */
123
+ favicon: AceFavicon | null;
110
124
  };
111
125
 
112
126
  /**
@@ -478,6 +492,11 @@ type AceSeoOptions = {
478
492
  * social image chosen in the site's settings in the CMS (if any).
479
493
  */
480
494
  image?: string;
495
+ /**
496
+ * The site's favicon. In the Astro `<AceSeo>`, leaving it out uses the favicon chosen in the site's settings in the
497
+ * CMS (if any); it then adds `<link rel="icon">` and `<link rel="apple-touch-icon">`.
498
+ */
499
+ favicon?: Pick<AceFavicon, "icon" | "apple_touch_icon">;
481
500
  /** Tells search engines to leave the page out, as for a draft shown in preview. */
482
501
  noindex?: boolean;
483
502
  };
@@ -486,6 +505,11 @@ type Meta = {
486
505
  name?: string;
487
506
  content: string;
488
507
  };
508
+ type Link = {
509
+ rel: string;
510
+ href: string;
511
+ sizes?: string;
512
+ };
489
513
  /** What `astro-seo`'s `<SEO>` takes (only the parts used here). */
490
514
  type AceSeoProperties = {
491
515
  title?: string;
@@ -500,6 +524,7 @@ type AceSeoProperties = {
500
524
  };
501
525
  extend: {
502
526
  meta: Meta[];
527
+ link?: Link[];
503
528
  };
504
529
  };
505
530
  /**
@@ -551,4 +576,4 @@ type AceSection = {
551
576
  blocks: AceSectionBlock[];
552
577
  };
553
578
 
554
- export { type AceAddress, type AceClient, type AceClientOptions, type AceContentTypeHandle, type AceContentTypeSchema, type AceContentTypes, type AceDateFormat, type AceEntry, type AceFieldSchema, type AceImageAttributes, type AceImageData, type AceImageOptions, type AceLinkAttributes, type AceLinkData, type AceMenu, type AceMenuItem, type AceNavigationLink, type AcePage, AcePreviewExpiredError, type AceRichTextDocument, type AceRichTextMark, type AceRichTextNode, type AceSection, type AceSectionBlock, type AceSeoOptions, type AceSeoProperties, type AceSite, AceUnavailableError, type AceValuesOf, type BlockDefinition, type SectionDefinition, type SectionFieldDefinition, type SectionFieldType, type SectionOf, type SectionTypesPayload, type ValuesOfFields, addFramingPolicy, addressFromPath, checkSectionDefinition, createAceClient, defineSection, formatAceDate, framingPolicy, headingLevel, homeAddress, imageAttributes, isCurrentPage, isHomeAddress, isInternalPath, isRefreshRequest, linkAddress, linkAttributes, linksFromMenu, listStart, listenForPreviewRefresh, loadMenuLinks, loadPage, originOf, pageNotices, pathOfAddress, previewHeaders, previewParameter, previewTokenFrom, refreshMessageType, refreshPageContent, renderRichText, renderTextArea, richTextImageSizes, sectionTypesPayload, seoDescriptionHandle, seoProperties, seoTitleHandle, swapPageContent, visitablePath };
579
+ export { type AceAddress, type AceClient, type AceClientOptions, type AceContentTypeHandle, type AceContentTypeSchema, type AceContentTypes, type AceDateFormat, type AceEntry, type AceFavicon, type AceFieldSchema, type AceImageAttributes, type AceImageData, type AceImageOptions, type AceLinkAttributes, type AceLinkData, type AceMenu, type AceMenuItem, type AceNavigationLink, type AcePage, AcePreviewExpiredError, type AceRichTextDocument, type AceRichTextMark, type AceRichTextNode, type AceSection, type AceSectionBlock, type AceSeoOptions, type AceSeoProperties, type AceSite, AceUnavailableError, type AceValuesOf, type BlockDefinition, type SectionDefinition, type SectionFieldDefinition, type SectionFieldType, type SectionOf, type SectionTypesPayload, type ValuesOfFields, addFramingPolicy, addressFromPath, checkSectionDefinition, createAceClient, defineSection, formatAceDate, framingPolicy, headingLevel, homeAddress, imageAttributes, isCurrentPage, isHomeAddress, isInternalPath, isRefreshRequest, linkAddress, linkAttributes, linksFromMenu, listStart, listenForPreviewRefresh, loadMenuLinks, loadPage, originOf, pageNotices, pathOfAddress, previewHeaders, previewParameter, previewTokenFrom, refreshMessageType, refreshPageContent, renderRichText, renderTextArea, richTextImageSizes, sectionTypesPayload, seoDescriptionHandle, seoProperties, seoTitleHandle, swapPageContent, visitablePath };
package/dist/index.js CHANGED
@@ -160,7 +160,15 @@ function seoProperties(options) {
160
160
  ...description && { description },
161
161
  ...options.image && { image: options.image }
162
162
  },
163
- extend: { meta }
163
+ extend: {
164
+ meta,
165
+ ...options.favicon && {
166
+ link: [
167
+ { rel: "icon", href: options.favicon.icon, sizes: "48x48" },
168
+ { rel: "apple-touch-icon", href: options.favicon.apple_touch_icon }
169
+ ]
170
+ }
171
+ }
164
172
  };
165
173
  }
166
174
 
@@ -50,6 +50,18 @@ type AceImageData = {
50
50
  content_type: string;
51
51
  };
52
52
 
53
+ /** The site's favicon as the CMS Ace public API returns it: the original, and square PNG copies. */
54
+ type AceFavicon = {
55
+ id: number;
56
+ /** The untouched original. */
57
+ url: string;
58
+ /** A small square PNG (48 pixels), for the browser tab and search results. */
59
+ icon: string;
60
+ /** A square PNG (180 pixels), for a phone's home screen. */
61
+ apple_touch_icon: string;
62
+ content_type: string;
63
+ };
64
+
53
65
  /** The site the request is for, as the CMS Ace public API returns it. */
54
66
  type AceSite = {
55
67
  id: number;
@@ -58,6 +70,8 @@ type AceSite = {
58
70
  handle: string;
59
71
  /** The picture the site's owners chose to show in search results and social posts; null if none. */
60
72
  social_image: AceImageData | null;
73
+ /** The small picture the site's owners chose for browser tabs; null if none. */
74
+ favicon: AceFavicon | null;
61
75
  };
62
76
 
63
77
  /** One link of a menu as the public API returns it, with its address already worked out. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandboxsonny/ace-kit",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Everything a website needs to use CMS Ace: a typed client, addressing, images, menus, rich text, live preview, and Astro and React adapters.",
5
5
  "keywords": [
6
6
  "cms",