@luhtech/site-template 0.3.0 → 0.3.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.
- package/package.json +1 -1
- package/src/content/loadPage.ts +51 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luhtech/site-template",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
package/src/content/loadPage.ts
CHANGED
|
@@ -31,7 +31,58 @@ async function buildValidator() {
|
|
|
31
31
|
return ajv.compile(pageSchema as object);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export interface PageBlock {
|
|
35
|
+
blockType: string;
|
|
36
|
+
text: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface PageClaim {
|
|
41
|
+
claimId: string;
|
|
42
|
+
kind: string;
|
|
43
|
+
text: string;
|
|
44
|
+
featureRef?: string;
|
|
45
|
+
sourcedStatus?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface PageCta {
|
|
49
|
+
label: string;
|
|
50
|
+
href: string;
|
|
51
|
+
intent: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface PageCrossLink {
|
|
55
|
+
brandRef: string;
|
|
56
|
+
relationshipLine: string;
|
|
57
|
+
href: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface PageSection {
|
|
61
|
+
sectionId: string;
|
|
62
|
+
sectionKind: string;
|
|
63
|
+
heading?: string;
|
|
64
|
+
subheading?: string;
|
|
65
|
+
eyebrow?: string;
|
|
66
|
+
blocks?: PageBlock[];
|
|
67
|
+
claims?: PageClaim[];
|
|
68
|
+
ctas?: PageCta[];
|
|
69
|
+
crossLinks?: PageCrossLink[];
|
|
70
|
+
figures?: unknown[];
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `sections` is typed as a real array (not the bare index signature's
|
|
76
|
+
* `unknown`) so a consumer's `page.sections.map(...)` typechecks without
|
|
77
|
+
* a local cast -- found live migrating Ectropy/JobsiteControl/Qullqa/
|
|
78
|
+
* Siltana to this package: `astro check` failed ts(18046) on every one
|
|
79
|
+
* of them ("'page.sections' is of type 'unknown'"), each independently
|
|
80
|
+
* patched with its own `(s: any)` workaround before this fix landed.
|
|
81
|
+
* Other top-level fields stay on the index signature -- only the one
|
|
82
|
+
* every consumer actually iterates gets a real type.
|
|
83
|
+
*/
|
|
34
84
|
export interface LoadedPage {
|
|
85
|
+
sections: PageSection[];
|
|
35
86
|
[key: string]: unknown;
|
|
36
87
|
}
|
|
37
88
|
|