maverick-wave-astro 1.34.0 → 1.36.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.
@@ -95,8 +95,7 @@ const button = classes.buttons ?? 'mw-btn-lg';
95
95
  </h1>
96
96
  ) : (
97
97
  <h1 class:list={['mw-mb-6', classes.title]}>
98
- {titleStart}
99
- <br />
98
+ {titleStart} <br />
100
99
  <span class={`mw-text-${accent}`}>{titleAccent}</span>
101
100
  </h1>
102
101
  )
@@ -8,6 +8,7 @@ export type BuiltPage = {
8
8
  description: string;
9
9
  noIndex: boolean;
10
10
  headings: number;
11
+ imagesWithoutAlt: number;
11
12
  questions: Question[];
12
13
  };
13
14
  export declare const IMAGE_MAX_BYTES: number;
@@ -45,6 +45,8 @@ export const readPage = (html) => {
45
45
  description: decode(description),
46
46
  noIndex: robots.includes('noindex'),
47
47
  headings: html.match(/<h1[\s>]/g)?.length ?? 0,
48
+ // Astro writes alt="" as a bare alt, so the attribute may end the tag.
49
+ imagesWithoutAlt: (html.match(/<img\b[^>]*>/g) ?? []).filter(tag => !/\salt(?=[\s=>/])/.test(tag)).length,
48
50
  questions: questions(html),
49
51
  };
50
52
  };
@@ -60,6 +62,8 @@ export const seoWarnings = (page) => {
60
62
  (length < min || length > max) &&
61
63
  `description has ${length} characters, ${min}-${max} fit the snippet`,
62
64
  page.headings !== 1 && `${page.headings} <h1> on the page, one is right`,
65
+ page.imagesWithoutAlt > 0 &&
66
+ `${page.imagesWithoutAlt} <img> without alt, a decorative image takes alt=""`,
63
67
  ].filter((warning) => typeof warning === 'string');
64
68
  };
65
69
  // Nothing a page needs, and with name and address from the imprint enough to
@@ -185,7 +185,10 @@ export default function homepage(options) {
185
185
  ? []
186
186
  : [sitemap(sitemapOptions(options.sitemap))],
187
187
  vite: {
188
- build: { assetsInlineLimit: 0 },
188
+ build: {
189
+ assetsInlineLimit: 0,
190
+ cssTarget: ['safari16', 'ios16', 'chrome110', 'firefox110'],
191
+ },
189
192
  resolve: { alias: { '@': path.join(root, 'src') } },
190
193
  plugins: [
191
194
  withoutDevHelpers,
@@ -22,6 +22,7 @@ export declare const promoInHtml: (promo: Promo | null | undefined, now?: Date)
22
22
  export declare const promoExpiry: (promo: Promo | null | undefined, now?: Date) => string | null;
23
23
  export declare const discountText: (promo: Promo) => string;
24
24
  export declare const discountedPrice: (promo: Promo, amount: number) => number;
25
+ export declare const currentPrice: (promo: Promo | null | undefined, amount: number, now?: Date) => number;
25
26
  export declare const promoEndDate: (promo: Promo, locale?: string) => string | null;
26
27
  export declare const promoText: (promo: Promo, { locale, untilWord }?: {
27
28
  locale?: string | undefined;
package/dist/schedule.js CHANGED
@@ -68,6 +68,8 @@ export const discountText = (promo) => `-${Number(promo.percent)}\u2009%`;
68
68
  // promised percentage. In whole cents, because 90 * 0.7 is 62.999... in
69
69
  // floating point.
70
70
  export const discountedPrice = (promo, amount) => Math.floor((Math.round(amount * 100) * (100 - Number(promo.percent))) / 10_000);
71
+ // What a customer pays on the day of the build.
72
+ export const currentPrice = (promo, amount, now = new Date()) => (promoInHtml(promo, now) ? discountedPrice(promo, amount) : amount);
71
73
  // Last day of the promotion, formatted. Null without a valid last day.
72
74
  export const promoEndDate = (promo, locale = 'de-DE') => {
73
75
  const end = promo.until ? endOfDay(promo.until) : null;
package/dist/social.d.ts CHANGED
@@ -15,6 +15,10 @@ export declare const SOCIAL_ICONS: {
15
15
  readonly viewBox: "0 0 384 512";
16
16
  readonly body: "<path d=\"M162.7 210c-1.8 3.3-25.2 44.4-70.1 123.5-4.9 8.3-10.8 12.5-17.7 12.5H9.8c-7.7 0-12.1-7.5-8.5-14.4l69-121.3c.2 0 .2-.1 0-.3l-43.9-75.6c-4.3-7.8.3-14.1 8.5-14.1H100c7.3 0 13.3 4.1 18 12.2l44.7 77.5zM382.6 46.1l-144 253v.3L330.2 466c3.9 7.1.2 14.1-8.5 14.1h-65.2c-7.6 0-13.6-4-18-12.2l-92.4-168.5c3.3-5.8 51.5-90.8 144.8-255.2 4.6-8.1 10.4-12.2 17.5-12.2h65.7c8 0 12.3 6.7 8.5 14.1z\"/>";
17
17
  };
18
+ readonly google: {
19
+ readonly viewBox: "0 0 488 512";
20
+ readonly body: "<path d=\"M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z\"/>";
21
+ };
18
22
  readonly devto: {
19
23
  readonly viewBox: "0 0 448 512";
20
24
  readonly body: "<path d=\"M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z\"/>";
package/dist/social.js CHANGED
@@ -18,6 +18,10 @@ export const SOCIAL_ICONS = {
18
18
  viewBox: '0 0 384 512',
19
19
  body: '<path d="M162.7 210c-1.8 3.3-25.2 44.4-70.1 123.5-4.9 8.3-10.8 12.5-17.7 12.5H9.8c-7.7 0-12.1-7.5-8.5-14.4l69-121.3c.2 0 .2-.1 0-.3l-43.9-75.6c-4.3-7.8.3-14.1 8.5-14.1H100c7.3 0 13.3 4.1 18 12.2l44.7 77.5zM382.6 46.1l-144 253v.3L330.2 466c3.9 7.1.2 14.1-8.5 14.1h-65.2c-7.6 0-13.6-4-18-12.2l-92.4-168.5c3.3-5.8 51.5-90.8 144.8-255.2 4.6-8.1 10.4-12.2 17.5-12.2h65.7c8 0 12.3 6.7 8.5 14.1z"/>',
20
20
  },
21
+ google: {
22
+ viewBox: '0 0 488 512',
23
+ body: '<path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z"/>',
24
+ },
21
25
  devto: {
22
26
  viewBox: '0 0 448 512',
23
27
  body: '<path d="M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z"/>',
@@ -1,3 +1,4 @@
1
+ import { type Promo } from './schedule.ts';
1
2
  export declare const jsonLdText: (data: unknown) => string;
2
3
  export type Crumb = {
3
4
  label: string;
@@ -14,3 +15,23 @@ export declare const breadcrumbList: (crumbs: readonly Crumb[], site: URL | stri
14
15
  item: string;
15
16
  }[];
16
17
  };
18
+ export type OfferItem = {
19
+ name: string;
20
+ description?: string;
21
+ price: number;
22
+ currency?: string;
23
+ };
24
+ /** One schema.org Offer. Google wants the price actually charged, so a running promotion counts. */
25
+ export declare const offer: ({ name, description, price, currency }: OfferItem, promo?: Promo | null, now?: Date) => {
26
+ availability: string;
27
+ priceValidUntil?: string | undefined;
28
+ price: string;
29
+ priceCurrency: string;
30
+ description?: string | undefined;
31
+ '@type': string;
32
+ name: string;
33
+ };
34
+ /** "245 € - 525 €" for a LocalBusiness or ProfessionalService, from its offers. */
35
+ export declare const priceRange: (offers: readonly {
36
+ price: string;
37
+ }[], currency?: string) => string;
@@ -1,3 +1,4 @@
1
+ import { currentPrice, promoInHtml } from "./schedule.js";
1
2
  // Without the escape a "</script>" inside any text ends the block early.
2
3
  export const jsonLdText = (data) => JSON.stringify(data).replace(/</g, '\\u003c');
3
4
  /** The trail the Breadcrumbs component shows, start page first, as absolute URLs. */
@@ -11,3 +12,18 @@ export const breadcrumbList = (crumbs, site) => ({
11
12
  item: new URL(crumb.href, site).href,
12
13
  })),
13
14
  });
15
+ /** One schema.org Offer. Google wants the price actually charged, so a running promotion counts. */
16
+ export const offer = ({ name, description, price, currency = 'EUR' }, promo, now = new Date()) => ({
17
+ '@type': 'Offer',
18
+ name,
19
+ ...(description && { description }),
20
+ price: String(currentPrice(promo, price, now)),
21
+ priceCurrency: currency,
22
+ ...(promoInHtml(promo, now) && { priceValidUntil: promo.until }),
23
+ availability: 'https://schema.org/InStock',
24
+ });
25
+ /** "245 € - 525 €" for a LocalBusiness or ProfessionalService, from its offers. */
26
+ export const priceRange = (offers, currency = '€') => {
27
+ const prices = offers.map(({ price }) => Number(price));
28
+ return `${Math.min(...prices)} ${currency} - ${Math.max(...prices)} ${currency}`;
29
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maverick-wave-astro",
3
- "version": "1.34.0",
3
+ "version": "1.36.0",
4
4
  "description": "Shared frame for static Astro homepages built with MaverickWave: layout, SEO, design variants, schedule, building blocks.",
5
5
  "type": "module",
6
6
  "license": "MIT",