@soloworks/smking-next 0.12.2 → 0.14.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/src/types.ts CHANGED
@@ -58,6 +58,25 @@ export type CmsStatus = "ready" | "pending" | "not_found";
58
58
 
59
59
  export type CmsContentType = "article" | "landing" | "listing";
60
60
 
61
+ /**
62
+ * Theme mode (v0.14+) — decides how `<SmkingCms>` ships styling.
63
+ *
64
+ * - `'css'` (Mode A, default) — SDK inlines the canonical
65
+ * `<style data-smking="cms-styles">` once per render plus emits
66
+ * `.smk-*` class hooks on every block. Zero dependency on Tailwind.
67
+ * Customers theme via CSS variable overrides (`:root { --smk-accent: … }`).
68
+ *
69
+ * - `'tailwind-prose'` (Mode B) — SDK skips the inline stylesheet,
70
+ * wraps the article in `<article class="prose dark:prose-invert">`
71
+ * and emits Tailwind utility classes on each block. Customer must
72
+ * have `@tailwindcss/typography` plugin wired up and the required
73
+ * classes safelisted (the wizard does this on install).
74
+ *
75
+ * Resolution order: explicit `<SmkingCms mode>` prop → `SMKING_CMS_THEME`
76
+ * env var → 'css'.
77
+ */
78
+ export type CmsThemeMode = "css" | "tailwind-prose";
79
+
61
80
  /**
62
81
  * v2 substrate block primitives. Mirrors `apps/web/src/features/cms/types.ts`
63
82
  * on the SaaS side (kept in sync manually — when the v1 block catalog
@@ -79,10 +98,30 @@ export interface ModuleHeader {
79
98
  viewAll?: { label: string; href: string };
80
99
  }
81
100
  export type NavLayout = "grid" | "list" | "carousel";
101
+
102
+ /**
103
+ * Materialized snapshot entry — published pages on the smking SaaS
104
+ * pre-resolve their nav-* block data at publish time and bake it into
105
+ * `block.props.snapshot`. Customer SDK echoes this verbatim, never
106
+ * round-trips back to smking for nav rendering. If smking is down,
107
+ * customer pages still render whatever was last published.
108
+ */
109
+ export interface NavSnapshotEntry {
110
+ slug: string;
111
+ title: string | null;
112
+ excerpt: string | null;
113
+ featuredImageUrl: string | null;
114
+ /** ISO string. */
115
+ publishedAt: string | null;
116
+ contentType: "article" | "landing" | "listing" | null;
117
+ }
118
+
82
119
  export interface NavRecentPostsProps extends ModuleHeader {
83
120
  limit: number;
84
121
  layout: NavLayout;
85
122
  contentType?: "article" | "all";
123
+ /** Publish-time materialized — never fetched live. */
124
+ snapshot?: NavSnapshotEntry[];
86
125
  }
87
126
  export interface NavTaxonomyListProps extends ModuleHeader {
88
127
  /** category-by-path: slug prefix; tag: taxonomies.slug */
@@ -90,15 +129,49 @@ export interface NavTaxonomyListProps extends ModuleHeader {
90
129
  path: string;
91
130
  limit: number;
92
131
  layout: NavLayout;
132
+ /** Publish-time materialized — never fetched live. */
133
+ snapshot?: NavSnapshotEntry[];
134
+ }
135
+
136
+ /**
137
+ * Search index entry. Customer SDK does client-side fuzzy filter
138
+ * against this list; clicking a result navigates to the slug.
139
+ */
140
+ export interface NavSearchIndexEntry {
141
+ slug: string;
142
+ title: string | null;
143
+ excerpt: string | null;
93
144
  }
145
+
94
146
  export interface NavSearchProps {
95
147
  placeholder: string;
96
148
  contentType?: "article" | "all";
149
+ /** Publish-time materialized full-site search index. */
150
+ index?: NavSearchIndexEntry[];
151
+ }
152
+
153
+ export interface CarouselSlideProps {
154
+ imageUrl: string;
155
+ caption: string;
156
+ }
157
+
158
+ export type CarouselAspectRatio =
159
+ | "16:9"
160
+ | "4:3"
161
+ | "1:1"
162
+ | "3:4"
163
+ | "9:16";
164
+
165
+ export interface CarouselProps {
166
+ slides: CarouselSlideProps[];
167
+ /** Fixed aspect ratio for all slides — image fills via `object-fit: cover`. Default `16:9`. */
168
+ aspectRatio?: CarouselAspectRatio;
97
169
  }
98
170
 
99
171
  export type Block =
100
172
  | { component: "hero"; id: string; props: HeroProps }
101
173
  | { component: "article"; id: string; props: ArticleProps }
174
+ | { component: "carousel"; id: string; props: CarouselProps }
102
175
  | {
103
176
  component: "nav-recent-posts";
104
177
  id: string;