@contentrain/astro-kit 0.28.0 → 0.29.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/catalog.json CHANGED
@@ -774,7 +774,7 @@
774
774
  {
775
775
  "id": "embed",
776
776
  "name": "Embed",
777
- "description": "A video, map or player from another site (YouTube, Vimeo, Google Maps, OpenStreetMap, Spotify, SoundCloud, Calendly, Typeform, Loom, Wistia), loaded only on click: until then a poster link to the provider's page, with no iframe, no third-party request and no cookie (YouTube through youtube-nocookie.com). Unknown providers are never framed; they stay a plain link.",
777
+ "description": "A video, map or player from another site (YouTube, Vimeo, Google Maps, OpenStreetMap, Spotify, SoundCloud, Calendly, Typeform, Google Forms, Loom, Wistia), loaded only on click: until then a poster link to the provider's page, with no iframe, no third-party request and no cookie (YouTube through youtube-nocookie.com). Unknown providers are never framed; they stay a plain link.",
778
778
  "category": "content",
779
779
  "uses": [],
780
780
  "shared": [
@@ -805,7 +805,7 @@
805
805
  "props": {
806
806
  "url": {
807
807
  "type": "url",
808
- "description": "A video page (youtube.com/watch, youtu.be, /shorts/, vimeo.com/<id>) or a known provider's embed address (google.com/maps/embed, open.spotify.com/embed, w.soundcloud.com/player, calendly.com, *.typeform.com/to, loom.com/embed, fast.wistia.net/embed)."
808
+ "description": "A video page (youtube.com/watch, youtu.be, /shorts/, vimeo.com/<id>) or a known provider's embed address (google.com/maps/embed, open.spotify.com/embed, w.soundcloud.com/player, calendly.com, *.typeform.com/to, docs.google.com/forms/…/viewform, loom.com/embed, fast.wistia.net/embed)."
809
809
  },
810
810
  "address": {
811
811
  "type": "string",
@@ -34,7 +34,7 @@ const embed = tv({
34
34
  })
35
35
 
36
36
  interface Props {
37
- /** A video page (YouTube, Vimeo) or a known provider's embed address (Google Maps embed, Spotify, SoundCloud, Calendly, Typeform, Loom, Wistia). */
37
+ /** A video page (YouTube, Vimeo) or a known provider's embed address (Google Maps embed, Spotify, SoundCloud, Calendly, Typeform, Google Forms, Loom, Wistia). */
38
38
  url?: string | undefined
39
39
  /** A place or address to show on a Google map, when there is no `url`. */
40
40
  address?: string | undefined
@@ -3,7 +3,7 @@
3
3
  // Only known providers get an iframe; anything else stays a link, so a page
4
4
  // can never frame an arbitrary address that came in with the content.
5
5
 
6
- export type EmbedProvider = 'youtube' | 'vimeo' | 'google-maps' | 'openstreetmap' | 'spotify' | 'soundcloud' | 'calendly' | 'typeform' | 'loom' | 'wistia'
6
+ export type EmbedProvider = 'youtube' | 'vimeo' | 'google-maps' | 'openstreetmap' | 'spotify' | 'soundcloud' | 'calendly' | 'typeform' | 'google-forms' | 'loom' | 'wistia'
7
7
 
8
8
  export interface EmbedTarget {
9
9
  provider: EmbedProvider
@@ -76,12 +76,15 @@ const GOOGLE = new Set(['www.google.com', 'google.com'])
76
76
  /** Framed as given: the host is known to serve an embeddable page at that address. */
77
77
  const FRAMED: Array<[EmbedProvider, EmbedTarget['kind'], (url: URL) => boolean]> = [
78
78
  // Exact hosts only: a pattern over Google's country domains also admits look-alikes (`google.com.evil.example`).
79
- ['google-maps', 'map', u => (GOOGLE.has(u.hostname) && u.pathname.startsWith('/maps/embed')) || (u.hostname === 'maps.google.com' && u.searchParams.get('output') === 'embed')],
79
+ // A hand-pasted "embed a map" iframe is `google.com/maps?q=…&output=embed` as much as `/maps/embed?pb=…` (what `mapTarget` writes too).
80
+ ['google-maps', 'map', u => (GOOGLE.has(u.hostname) && (u.pathname.startsWith('/maps/embed') || (u.pathname === '/maps' && u.searchParams.get('output') === 'embed'))) || (u.hostname === 'maps.google.com' && u.searchParams.get('output') === 'embed')],
80
81
  ['openstreetmap', 'map', u => u.hostname === 'www.openstreetmap.org' && u.pathname === '/export/embed.html'],
81
82
  ['spotify', 'audio', u => u.hostname === 'open.spotify.com' && u.pathname.startsWith('/embed/')],
82
83
  ['soundcloud', 'audio', u => u.hostname === 'w.soundcloud.com' && u.pathname.startsWith('/player')],
83
84
  ['calendly', 'widget', u => u.hostname === 'calendly.com'],
84
85
  ['typeform', 'widget', u => /^[\w-]+\.typeform\.com$/.test(u.hostname) && u.pathname.startsWith('/to/')],
86
+ // A Google Form's own embed address (`/forms/d/e/<id>/viewform?embedded=true`): the form, not the rest of Google Docs.
87
+ ['google-forms', 'widget', u => u.hostname === 'docs.google.com' && /^\/forms\/d\/(?:e\/)?[\w-]+\/viewform$/.test(u.pathname)],
85
88
  ['loom', 'video', u => /^(?:www\.)?loom\.com$/.test(u.hostname) && u.pathname.startsWith('/embed/')],
86
89
  ['wistia', 'video', u => u.hostname === 'fast.wistia.net' && u.pathname.startsWith('/embed/')],
87
90
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "embed",
3
3
  "name": "Embed",
4
- "description": "A video, map or player from another site (YouTube, Vimeo, Google Maps, OpenStreetMap, Spotify, SoundCloud, Calendly, Typeform, Loom, Wistia), loaded only on click: until then a poster link to the provider's page, with no iframe, no third-party request and no cookie (YouTube through youtube-nocookie.com). Unknown providers are never framed; they stay a plain link.",
4
+ "description": "A video, map or player from another site (YouTube, Vimeo, Google Maps, OpenStreetMap, Spotify, SoundCloud, Calendly, Typeform, Google Forms, Loom, Wistia), loaded only on click: until then a poster link to the provider's page, with no iframe, no third-party request and no cookie (YouTube through youtube-nocookie.com). Unknown providers are never framed; they stay a plain link.",
5
5
  "category": "content",
6
6
  "uses": [],
7
7
  "shared": ["KitImage.astro", "types.ts"],
@@ -10,7 +10,7 @@
10
10
  "width": { "options": ["prose", "page"], "default": "prose", "description": "prose: as wide as the reading column. page: the full page frame." }
11
11
  },
12
12
  "props": {
13
- "url": { "type": "url", "description": "A video page (youtube.com/watch, youtu.be, /shorts/, vimeo.com/<id>) or a known provider's embed address (google.com/maps/embed, open.spotify.com/embed, w.soundcloud.com/player, calendly.com, *.typeform.com/to, loom.com/embed, fast.wistia.net/embed)." },
13
+ "url": { "type": "url", "description": "A video page (youtube.com/watch, youtu.be, /shorts/, vimeo.com/<id>) or a known provider's embed address (google.com/maps/embed, open.spotify.com/embed, w.soundcloud.com/player, calendly.com, *.typeform.com/to, docs.google.com/forms/…/viewform, loom.com/embed, fast.wistia.net/embed)." },
14
14
  "address": { "type": "string", "description": "A place or address shown on a Google map when there is no url (Elementor google_maps address, Divi map address)." },
15
15
  "title": { "type": "string", "description": "What it is: the player's accessible name and the poster's text." },
16
16
  "caption": { "type": "string", "description": "A line under the embed." },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "format": "astro-kit-mapping@1",
3
3
  "builder": "classic",
4
- "version": "5",
4
+ "version": "6",
5
5
  "fallback": "prose",
6
6
  "rules": [
7
7
  {
@@ -292,6 +292,15 @@
292
292
  "showLabel": "ui:embed.show"
293
293
  }
294
294
  },
295
+ {
296
+ "match": "classic/provider-embed",
297
+ "component": "embed",
298
+ "props": {
299
+ "url": "dom:iframe@src",
300
+ "playLabel": "ui:embed.play",
301
+ "showLabel": "ui:embed.show"
302
+ }
303
+ },
295
304
  {
296
305
  "match": "classic/mailchimp",
297
306
  "component": "newsletter",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/astro-kit",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "license": "MIT",
5
5
  "description": "Copy-in Astro components for Contentrain sites (shadcn model): typed props, tailwind-variants, zero JavaScript by default — with a machine-readable catalog",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "mapping"
43
43
  ],
44
44
  "dependencies": {
45
- "@contentrain/types": "1.53.0"
45
+ "@contentrain/types": "1.54.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^22.10.0",