@inneropen/marvin-astro 1.1.1 → 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.
Files changed (47) hide show
  1. package/README.md +173 -14
  2. package/dist/embeds-BTNryQA6.d.ts +79 -0
  3. package/dist/index.d.ts +43 -6
  4. package/dist/index.js +116 -14
  5. package/dist/index.js.map +1 -1
  6. package/dist/renderers/index.d.ts +119 -0
  7. package/dist/renderers/index.js +251 -0
  8. package/dist/renderers/index.js.map +1 -0
  9. package/dist/types.d.ts +8 -1
  10. package/package.json +16 -6
  11. package/src/chrome.ts +242 -0
  12. package/src/client.ts +119 -0
  13. package/src/components/Embed.astro +119 -0
  14. package/src/components/EmbedLoader.astro +24 -0
  15. package/src/components/EntryRenderer.astro +40 -0
  16. package/src/components/FormRenderer.astro +188 -0
  17. package/src/components/LinkCard.astro +42 -0
  18. package/src/components/embed-frame.ts +168 -0
  19. package/src/components/embeds.css +137 -0
  20. package/src/components/index.ts +29 -0
  21. package/src/components/integration.ts +62 -0
  22. package/src/components/markdown.ts +4 -0
  23. package/src/components/registry.ts +34 -0
  24. package/src/components/renderers/ArticleRenderer.astro +56 -0
  25. package/src/components/renderers/FaqRenderer.astro +26 -0
  26. package/src/components/renderers/NavigationRenderer.astro +27 -0
  27. package/src/components/renderers/PageRenderer.astro +51 -0
  28. package/src/config.ts +149 -0
  29. package/src/embeds.ts +137 -0
  30. package/src/env.d.ts +5 -0
  31. package/src/fetch.ts +208 -0
  32. package/src/fields.ts +330 -0
  33. package/src/format.ts +63 -0
  34. package/src/index.ts +169 -0
  35. package/src/markdown.ts +84 -0
  36. package/src/normalize.ts +284 -0
  37. package/src/renderers/debug.ts +6 -0
  38. package/src/renderers/index.ts +48 -0
  39. package/src/renderers/registry.ts +133 -0
  40. package/src/renderers/resolve.ts +134 -0
  41. package/src/renderers/types.ts +71 -0
  42. package/src/renderers/validation-types.ts +23 -0
  43. package/src/renderers/validation.ts +55 -0
  44. package/src/repository.ts +206 -0
  45. package/src/sections.ts +39 -0
  46. package/src/site.ts +222 -0
  47. package/src/types.ts +188 -0
package/src/types.ts ADDED
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Site-integration types.
3
+ *
4
+ * These are the *resolved* shapes a site renders from — Marvin's raw payloads normalized,
5
+ * defaulted, and made non-optional where a template would otherwise need a guard on every
6
+ * use. Nothing here is specific to a particular site's design system.
7
+ */
8
+
9
+ import type { MarvinSiteEmbeds } from './embeds.js';
10
+ import type {
11
+ CollectionEntry,
12
+ Entry,
13
+ MarvinEntry,
14
+ MarvinEntryListItem,
15
+ } from '@inneropen/marvin-sdk';
16
+
17
+ /**
18
+ * Any entry shape the published API can hand back. `MarvinEntry`/`Entry` carry `data_json`;
19
+ * `CollectionEntry`/`MarvinEntryListItem` (list items) do not — see the `hydrate` repository
20
+ * option.
21
+ */
22
+ export type MarvinContentEntry = MarvinEntry | Entry | CollectionEntry | MarvinEntryListItem;
23
+
24
+ /** Criteria for picking one asset off an entry's `assets[]`. */
25
+ export type AssetSelectOptions = {
26
+ role?: string;
27
+ roles?: string[];
28
+ usage?: string;
29
+ usages?: string[];
30
+ type?: string;
31
+ types?: string[];
32
+ mimeType?: string;
33
+ /** Also accept assets carrying neither a role nor a usage. */
34
+ allowUnroled?: boolean;
35
+ };
36
+
37
+ /** A resolved image: a URL plus the presentation hints stored alongside the asset. */
38
+ export type ApiImage = {
39
+ src: string;
40
+ alt: string;
41
+ /** CSS `object-position` value, e.g. `"40% 65%"`. */
42
+ focalPoint?: string;
43
+ };
44
+
45
+ /** A resolved link to an attached resource (material, construction detail, document…). */
46
+ export type ApiResourceLink = {
47
+ name: string;
48
+ /** The resource type, e.g. `'material'`, `'construction'`. */
49
+ type: string;
50
+ /** The relationship role, e.g. `'primary-material'`. */
51
+ role?: string;
52
+ slug?: string;
53
+ href?: string;
54
+ };
55
+
56
+ /**
57
+ * Resolved SEO / social-sharing metadata for the site. Mirrors Marvin's SiteSeo, with identity
58
+ * fallbacks already applied (title/description/siteName never empty). The rendering layer
59
+ * (SeoHead) turns this into the actual `<meta>`/Open Graph/Twitter tags.
60
+ */
61
+ export type ApiSeo = {
62
+ title: string;
63
+ titleTemplate?: string;
64
+ description: string;
65
+ keywords: string[];
66
+ robots: string;
67
+ image?: string;
68
+ imageAlt?: string;
69
+ ogType: string;
70
+ siteName: string;
71
+ twitterCard: string;
72
+ twitterHandle?: string;
73
+ twitterCreator?: string;
74
+ fbAppId?: string;
75
+ themeColor?: string;
76
+ publisher?: string;
77
+ canonicalUrl?: string;
78
+ verification: {
79
+ google?: string;
80
+ bing?: string;
81
+ pinterest?: string;
82
+ yandex?: string;
83
+ };
84
+ };
85
+
86
+ export type ApiSite = {
87
+ workspaceSlug?: string;
88
+ workspaceName?: string;
89
+ name: string;
90
+ title: string;
91
+ tagline?: string;
92
+ description: string;
93
+ canonicalUrl?: string;
94
+ logo?: string;
95
+ favicon?: string;
96
+ /** Round maker's stamp / seal — resolved from `site_metadata_json.brand.seal` (asset slug). */
97
+ seal?: string;
98
+ /**
99
+ * Brand-asset registry: every `site_metadata_json.brand.<name>` slug resolved to its URL.
100
+ * Add a shared asset with one config line; components read `site.brand.<name>`.
101
+ */
102
+ brand?: Record<string, string>;
103
+ locale: string;
104
+ timezone: string;
105
+ email?: string;
106
+ imprint?: string;
107
+ social: Record<string, string>;
108
+ seo: ApiSeo;
109
+ /**
110
+ * Embed privacy mode, consent text and the frame sources a `frame-src` CSP must allow.
111
+ * Absent when the server predates media embeds.
112
+ */
113
+ embeds?: MarvinSiteEmbeds;
114
+ metadata: Record<string, unknown>;
115
+ };
116
+
117
+ export type ApiNavigationLink = {
118
+ label: string;
119
+ href: string;
120
+ description?: string;
121
+ external: boolean;
122
+ /** Membership role from the nav collection (e.g. `'primary'`, `'legal'`). Drives grouping. */
123
+ role?: string;
124
+ };
125
+
126
+ export type ApiSocialLink = ApiNavigationLink & {
127
+ icon: string;
128
+ };
129
+
130
+ export type ApiSiteChrome = {
131
+ site: ApiSite;
132
+ mainNavigation: ApiNavigationLink[];
133
+ footerNavigation: ApiNavigationLink[][];
134
+ /** Legal links (`role: 'legal'` in the footer nav collection), e.g. Terms/Privacy. */
135
+ legalLinks: ApiNavigationLink[];
136
+ socialLinks: ApiSocialLink[];
137
+ inquiry?: ApiNavigationLink;
138
+ };
139
+
140
+ export type ApiActionVariant = 'primary' | 'secondary';
141
+
142
+ export type ApiPageAction = ApiNavigationLink & {
143
+ variant: ApiActionVariant;
144
+ };
145
+
146
+ export type ApiHeroAction = ApiPageAction;
147
+
148
+ export type ApiHero = {
149
+ kicker: string;
150
+ headline: string;
151
+ body: string;
152
+ actions: ApiHeroAction[];
153
+ layout: 'split' | 'centered';
154
+ image?: {
155
+ src?: string;
156
+ alt: string;
157
+ focalPoint?: string;
158
+ dominantColor?: string;
159
+ fit?: 'cover' | 'contain';
160
+ caption?: string;
161
+ credit?: string;
162
+ orientation?: string;
163
+ };
164
+ };
165
+
166
+ /**
167
+ * A section-landing header driven by a Marvin `page` entry (e.g. `bench-notes`, `projects`).
168
+ * The entry is linkable in nav (collection membership) AND supplies the landing's title, intro,
169
+ * and hero — so the top of an index page stops being static. Absent fields resolve to
170
+ * `undefined` so callers fall back to their existing copy/illustration.
171
+ */
172
+ export type SectionLanding = {
173
+ title?: string;
174
+ /** The `body` field (or summary) rendered from markdown to HTML — render with `set:html`. */
175
+ introHtml?: string;
176
+ hero?: string;
177
+ };
178
+
179
+ export type {
180
+ MarvinEmbed,
181
+ MarvinEmbedIframe,
182
+ MarvinEmbedKind,
183
+ MarvinEmbedLink,
184
+ MarvinEmbedMode,
185
+ MarvinEmbeds,
186
+ MarvinEmbedStatus,
187
+ MarvinSiteEmbeds,
188
+ } from './embeds.js';