@aglyn/plugins-ai 1.0.0-beta.292 → 1.0.0-beta.296

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 (203) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-job-links.d.ts +15 -2
  3. package/src/lib/components/ai-job-links.js +24 -3
  4. package/src/lib/components/ai-job-links.js.map +1 -1
  5. package/src/lib/components/ai-job-requests.d.ts +9 -0
  6. package/src/lib/components/ai-job-requests.js +34 -0
  7. package/src/lib/components/ai-job-requests.js.map +1 -1
  8. package/src/lib/components/ai-site-build-page.component.js +28 -2
  9. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  10. package/src/lib/components/ai-site-import-job.component.js +5 -4
  11. package/src/lib/components/ai-site-import-job.component.js.map +1 -1
  12. package/src/lib/components/ai-site-import-start.component.js +3 -3
  13. package/src/lib/components/ai-site-import-start.component.js.map +1 -1
  14. package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
  15. package/src/lib/components/ai-site-start-card.component.js +129 -29
  16. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  17. package/src/lib/components/ai-site-start-steps.component.d.ts +15 -3
  18. package/src/lib/components/ai-site-start-steps.component.js +42 -25
  19. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  20. package/src/lib/components/ai-site-style-previews.d.ts +17 -0
  21. package/src/lib/components/ai-site-style-previews.js +26 -95
  22. package/src/lib/components/ai-site-style-previews.js.map +1 -1
  23. package/src/lib/components/assist-jobs-drawer.component.d.ts +7 -1
  24. package/src/lib/components/assist-jobs-drawer.component.js +20 -6
  25. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
  26. package/src/lib/components/assist-page-change-card.component.d.ts +44 -0
  27. package/src/lib/components/assist-page-change-card.component.js +166 -0
  28. package/src/lib/components/assist-page-change-card.component.js.map +1 -0
  29. package/src/lib/components/assist-panel.component.d.ts +105 -1
  30. package/src/lib/components/assist-panel.component.js +224 -29
  31. package/src/lib/components/assist-panel.component.js.map +1 -1
  32. package/src/lib/declarations.server.js +22 -0
  33. package/src/lib/declarations.server.js.map +1 -1
  34. package/src/lib/jobs/ai-job-edit-step.d.ts +62 -16
  35. package/src/lib/jobs/ai-job-edit-step.js +172 -61
  36. package/src/lib/jobs/ai-job-edit-step.js.map +1 -1
  37. package/src/lib/jobs/ai-job-import-step.d.ts +21 -2
  38. package/src/lib/jobs/ai-job-import-step.js +179 -49
  39. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  40. package/src/lib/jobs/ai-job-layout-language.d.ts +27 -3
  41. package/src/lib/jobs/ai-job-layout-language.js +156 -113
  42. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  43. package/src/lib/jobs/ai-job-layout-step.js +56 -17
  44. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  45. package/src/lib/jobs/ai-job-navigation-step.js +4 -2
  46. package/src/lib/jobs/ai-job-navigation-step.js.map +1 -1
  47. package/src/lib/jobs/ai-job-page-language.d.ts +25 -15
  48. package/src/lib/jobs/ai-job-page-language.js +120 -66
  49. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  50. package/src/lib/jobs/ai-job-page-step.js +27 -7
  51. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  52. package/src/lib/jobs/ai-job-site-datasets.d.ts +12 -4
  53. package/src/lib/jobs/ai-job-site-datasets.js +36 -16
  54. package/src/lib/jobs/ai-job-site-datasets.js.map +1 -1
  55. package/src/lib/jobs/ai-jobs.js +6 -2
  56. package/src/lib/jobs/ai-jobs.js.map +1 -1
  57. package/src/lib/jobs/ai-layout-stock-photos.d.ts +50 -1
  58. package/src/lib/jobs/ai-layout-stock-photos.js +586 -35
  59. package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
  60. package/src/lib/jobs/ai-site-import-compile.d.ts +147 -0
  61. package/src/lib/jobs/ai-site-import-compile.js +1143 -0
  62. package/src/lib/jobs/ai-site-import-compile.js.map +1 -0
  63. package/src/lib/jobs/ai-site-import-document.d.ts +9 -36
  64. package/src/lib/jobs/ai-site-import-document.js +23 -489
  65. package/src/lib/jobs/ai-site-import-document.js.map +1 -1
  66. package/src/lib/jobs/ai-site-import-look.d.ts +54 -7
  67. package/src/lib/jobs/ai-site-import-look.js +163 -52
  68. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  69. package/src/lib/jobs/ai-site-import-publish.d.ts +7 -1
  70. package/src/lib/jobs/ai-site-import-publish.js +19 -5
  71. package/src/lib/jobs/ai-site-import-publish.js.map +1 -1
  72. package/src/lib/jobs/ai-site-late-photos.js +4 -2
  73. package/src/lib/jobs/ai-site-late-photos.js.map +1 -1
  74. package/src/lib/jobs/ai-site-publish.d.ts +10 -1
  75. package/src/lib/jobs/ai-site-publish.js +8 -3
  76. package/src/lib/jobs/ai-site-publish.js.map +1 -1
  77. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.d.ts +23 -0
  78. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js +677 -0
  79. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js.map +1 -0
  80. package/src/lib/layout-language/ai-layout-compiler.d.ts +26 -0
  81. package/src/lib/layout-language/ai-layout-compiler.js +677 -33
  82. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  83. package/src/lib/layout-language/ai-layout-frame-hollows.js +5 -1
  84. package/src/lib/layout-language/ai-layout-frame-hollows.js.map +1 -1
  85. package/src/lib/layout-language/ai-layout-frame-source.d.ts +196 -0
  86. package/src/lib/layout-language/ai-layout-frame-source.js +726 -0
  87. package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -0
  88. package/src/lib/layout-language/ai-layout-frame.d.ts +22 -0
  89. package/src/lib/layout-language/ai-layout-frame.js +121 -29
  90. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  91. package/src/lib/layout-language/ai-layout-language.d.ts +103 -37
  92. package/src/lib/layout-language/ai-layout-language.js +85 -120
  93. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  94. package/src/lib/model/ai-credit-estimate.d.ts +11 -7
  95. package/src/lib/model/ai-credit-estimate.js +11 -7
  96. package/src/lib/model/ai-credit-estimate.js.map +1 -1
  97. package/src/lib/model/ai-edit-job.d.ts +33 -16
  98. package/src/lib/model/ai-edit-job.js +50 -34
  99. package/src/lib/model/ai-edit-job.js.map +1 -1
  100. package/src/lib/model/ai-job-activity.d.ts +6 -11
  101. package/src/lib/model/ai-job-activity.js +8 -15
  102. package/src/lib/model/ai-job-activity.js.map +1 -1
  103. package/src/lib/model/ai-jobs.types.d.ts +6 -0
  104. package/src/lib/model/ai-jobs.types.js.map +1 -1
  105. package/src/lib/model/ai-site-import.d.ts +307 -13
  106. package/src/lib/model/ai-site-import.js +227 -19
  107. package/src/lib/model/ai-site-import.js.map +1 -1
  108. package/src/lib/model/ai-site-inventory.d.ts +6 -0
  109. package/src/lib/model/ai-site-inventory.js.map +1 -1
  110. package/src/lib/model/ai-site-look.d.ts +65 -1
  111. package/src/lib/model/ai-site-look.js +141 -23
  112. package/src/lib/model/ai-site-look.js.map +1 -1
  113. package/src/lib/model/ai-site-photos.d.ts +2 -0
  114. package/src/lib/model/ai-site-photos.js.map +1 -1
  115. package/src/lib/model/ai-site-start-steps.d.ts +4 -3
  116. package/src/lib/model/ai-site-start-steps.js +11 -3
  117. package/src/lib/model/ai-site-start-steps.js.map +1 -1
  118. package/src/lib/model/ai-site-start.d.ts +23 -2
  119. package/src/lib/model/ai-site-start.js +25 -3
  120. package/src/lib/model/ai-site-start.js.map +1 -1
  121. package/src/lib/model/assist-edit.d.ts +18 -1
  122. package/src/lib/model/assist-edit.js +7 -0
  123. package/src/lib/model/assist-edit.js.map +1 -1
  124. package/src/lib/model/assist-page-change.d.ts +86 -0
  125. package/src/lib/model/assist-page-change.js +86 -0
  126. package/src/lib/model/assist-page-change.js.map +1 -0
  127. package/src/lib/providers/routing.d.ts +11 -0
  128. package/src/lib/providers/routing.js +23 -0
  129. package/src/lib/providers/routing.js.map +1 -1
  130. package/src/lib/runtime/ai-doctrine-validators.d.ts +4 -2
  131. package/src/lib/runtime/ai-doctrine-validators.js +7 -2
  132. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  133. package/src/lib/runtime/ai-eval.js +3 -1
  134. package/src/lib/runtime/ai-eval.js.map +1 -1
  135. package/src/lib/runtime/ai-icon-library.d.ts +4 -0
  136. package/src/lib/runtime/ai-icon-library.js +4 -0
  137. package/src/lib/runtime/ai-icon-library.js.map +1 -1
  138. package/src/lib/runtime/ai-node-tree.d.ts +5 -0
  139. package/src/lib/runtime/ai-node-tree.js +23 -4
  140. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  141. package/src/lib/runtime/ai-palette.d.ts +2 -0
  142. package/src/lib/runtime/ai-palette.generated.js +19 -3
  143. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  144. package/src/lib/runtime/ai-palette.js +2 -1
  145. package/src/lib/runtime/ai-palette.js.map +1 -1
  146. package/src/lib/runtime/site-inventory.d.ts +8 -1
  147. package/src/lib/runtime/site-inventory.js +18 -0
  148. package/src/lib/runtime/site-inventory.js.map +1 -1
  149. package/src/lib/server/assist-build.js +2 -0
  150. package/src/lib/server/assist-build.js.map +1 -1
  151. package/src/lib/server/assist-chat.js +51 -2
  152. package/src/lib/server/assist-chat.js.map +1 -1
  153. package/src/lib/server/assist-edit.d.ts +54 -2
  154. package/src/lib/server/assist-edit.js +219 -30
  155. package/src/lib/server/assist-edit.js.map +1 -1
  156. package/src/lib/server/assist-page-change.d.ts +62 -0
  157. package/src/lib/server/assist-page-change.js +140 -0
  158. package/src/lib/server/assist-page-change.js.map +1 -0
  159. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +50 -0
  160. package/src/lib/site-import/fixtures/site-layout-recordings.js +86 -0
  161. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -0
  162. package/src/lib/site-import/site-import-crawl.d.ts +18 -1
  163. package/src/lib/site-import/site-import-crawl.js +70 -10
  164. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  165. package/src/lib/site-import/site-import-css.d.ts +110 -0
  166. package/src/lib/site-import/site-import-css.js +826 -0
  167. package/src/lib/site-import/site-import-css.js.map +1 -0
  168. package/src/lib/site-import/site-import-html.d.ts +116 -1
  169. package/src/lib/site-import/site-import-html.js +538 -46
  170. package/src/lib/site-import/site-import-html.js.map +1 -1
  171. package/src/lib/site-import/site-import-layout.d.ts +79 -0
  172. package/src/lib/site-import/site-import-layout.js +1608 -0
  173. package/src/lib/site-import/site-import-layout.js.map +1 -0
  174. package/src/lib/site-import/site-import-nav.d.ts +40 -0
  175. package/src/lib/site-import/site-import-nav.js +437 -0
  176. package/src/lib/site-import/site-import-nav.js.map +1 -0
  177. package/src/lib/site-import/site-import-page.d.ts +8 -1
  178. package/src/lib/site-import/site-import-page.js +24 -2
  179. package/src/lib/site-import/site-import-page.js.map +1 -1
  180. package/src/lib/assets/site-styles/beauty.webp +0 -0
  181. package/src/lib/assets/site-styles/blog.webp +0 -0
  182. package/src/lib/assets/site-styles/business.webp +0 -0
  183. package/src/lib/assets/site-styles/coming-soon.webp +0 -0
  184. package/src/lib/assets/site-styles/education.webp +0 -0
  185. package/src/lib/assets/site-styles/events.webp +0 -0
  186. package/src/lib/assets/site-styles/fitness.webp +0 -0
  187. package/src/lib/assets/site-styles/landing.webp +0 -0
  188. package/src/lib/assets/site-styles/music.webp +0 -0
  189. package/src/lib/assets/site-styles/nonprofit.webp +0 -0
  190. package/src/lib/assets/site-styles/personal.webp +0 -0
  191. package/src/lib/assets/site-styles/photography.webp +0 -0
  192. package/src/lib/assets/site-styles/portfolio.webp +0 -0
  193. package/src/lib/assets/site-styles/professional.webp +0 -0
  194. package/src/lib/assets/site-styles/realestate.webp +0 -0
  195. package/src/lib/assets/site-styles/restaurant.webp +0 -0
  196. package/src/lib/assets/site-styles/store.webp +0 -0
  197. package/src/lib/assets/site-styles/studio.webp +0 -0
  198. package/src/lib/assets/site-styles/trades.webp +0 -0
  199. package/src/lib/assets/site-styles/wellness.webp +0 -0
  200. package/src/lib/assets/site-styles/yoga.webp +0 -0
  201. package/src/lib/site-import/site-import-review.d.ts +0 -40
  202. package/src/lib/site-import/site-import-review.js +0 -149
  203. package/src/lib/site-import/site-import-review.js.map +0 -1
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import type { HostTheme, HostThemeSchemeColors } from '@aglyn/shared-data-types';
17
+ import type { HostTheme, HostThemeFontCategory, HostThemeSchemeColors } from '@aglyn/shared-data-types';
18
18
  import { type AiSiteMotionStyle } from '../layout-language/ai-layout-motion';
19
19
  import type { AiTool } from '../runtime/ai-runtime';
20
20
  import { type AiSiteBase, type AiSiteButtons, type AiSiteChroma, type AiSiteCorners, type AiSiteDensity, type AiSiteGround, type AiSiteKind, type AiSiteRhythm } from './ai-site-kinds';
@@ -92,7 +92,33 @@ export interface AiSiteStyle {
92
92
  * pages move in its kind's mood.
93
93
  */
94
94
  motion?: AiSiteMotionStyle;
95
+ /**
96
+ * A site brought in's own page ground (AGL-4108), `#rrggbb`: the color its
97
+ * source's pages sit on, where it is light enough for the theme's text.
98
+ * Absent, the ground is drawn as `ground` says.
99
+ */
100
+ page?: string;
101
+ /**
102
+ * A site brought in's own type (AGL-4108): the families its source sets
103
+ * its body and its headings in, where the theme font catalog has them,
104
+ * loaded in place of the pairing's. The pairing still sets the weights and
105
+ * the scale they are drawn at. Absent on every other site, whose type is
106
+ * the pairing's alone.
107
+ */
108
+ sourceFonts?: {
109
+ body: AiSiteSourceFont;
110
+ heading: AiSiteSourceFont | null;
111
+ } | null;
112
+ }
113
+ /** A family a site brought in is set in (AGL-4108), with the weights the catalog says it has. */
114
+ export interface AiSiteSourceFont {
115
+ family: string;
116
+ category: HostThemeFontCategory;
117
+ /** The upright weights the family offers. */
118
+ weights: number[];
95
119
  }
120
+ /** The weights of `wanted` a family offers, each the nearest it has where it lacks one. */
121
+ export declare function aiSiteFontWeightsIn(wanted: readonly number[], offered: readonly number[]): number[];
96
122
  /** What the model may choose, every field optional. */
97
123
  export type AiSiteLookAnswer = Partial<Pick<AiSiteStyle, 'base' | 'hue' | 'accent' | 'ground' | 'fonts' | 'corners' | 'buttons' | 'cards' | 'fields' | 'eyebrow' | 'header' | 'brand' | 'motion'>>;
98
124
  /**
@@ -188,3 +214,41 @@ export declare const AI_SITE_DISPLAY_BOOST: Readonly<Record<string, {
188
214
  * and dialog styles, its control heights — stays the base's.
189
215
  */
190
216
  export declare function aiSiteTheme(style: AiSiteStyle, base: HostTheme): HostTheme;
217
+ /** A kind's first look as a built-in theme with a brand over it, and the style answers that say the same. */
218
+ export interface AiSiteKindDefaultLook {
219
+ /** The `builtin` starter theme a site created in this style starts with. */
220
+ theme: {
221
+ kind: 'builtin';
222
+ base: string;
223
+ brand: {
224
+ light: Record<string, string>;
225
+ dark?: Record<string, string>;
226
+ };
227
+ fonts: string | null;
228
+ };
229
+ /** The same look as the AI start's style answers name it (`fp-starter-{kind}-ai`). */
230
+ answerStyle: {
231
+ base: string;
232
+ hue?: number;
233
+ ground: AiSiteGround;
234
+ fonts: string | null;
235
+ corners: AiSiteCorners;
236
+ buttons: AiSiteButtons;
237
+ };
238
+ }
239
+ /**
240
+ * A kind of site's FIRST look (AGL-4049), the one a site created in that
241
+ * style starts with and the one the platform's own starter listings carry:
242
+ * the kind's first base theme the deployment has (`starter`, or a built-in
243
+ * whose preset `known.presetIds` holds), its first font pairing the platform
244
+ * has, and a brand primary from the midpoint of its first hue range, colored
245
+ * as {@link aiSiteColors} colors one. A kind that suits any hue keeps the
246
+ * base's own colors. One derivation, so the style a person picks in Create
247
+ * site and the seeded `fp-starter-{kind}-base` listing look the same.
248
+ *
249
+ * Deterministic: no draw, the seed is the kind's id.
250
+ */
251
+ export declare function aiSiteKindDefaultLook(kind: AiSiteKind, known: {
252
+ presetIds: ReadonlySet<string>;
253
+ pairingIds?: ReadonlySet<string>;
254
+ }): AiSiteKindDefaultLook;
@@ -80,6 +80,15 @@ const DENSITIES = [
80
80
  'regular',
81
81
  'airy'
82
82
  ];
83
+ /** The weights of `wanted` a family offers, each the nearest it has where it lacks one. */ export function aiSiteFontWeightsIn(wanted, offered) {
84
+ if (!offered.length) return [
85
+ ...new Set(wanted)
86
+ ].sort((a, b)=>a - b);
87
+ const nearest = (weight)=>offered.reduce((best, each)=>Math.abs(each - weight) < Math.abs(best - weight) ? each : best, offered[0]);
88
+ return [
89
+ ...new Set(wanted.map(nearest))
90
+ ].sort((a, b)=>a - b);
91
+ }
83
92
  // ── The seed ─────────────────────────────────────────────────────────────
84
93
  /** A job's seed: FNV-1a over its id. */ export function aiSiteSeed(jobId) {
85
94
  let hash = 0x811c9dc5;
@@ -780,7 +789,9 @@ const START_L = {
780
789
  }
781
790
  };
782
791
  const ground = grounds[style.ground];
783
- const background = aiOklchHex(ground.L, ground.C * groundChroma, ground.h);
792
+ // A site brought in keeps the ground its source's pages sit on (AGL-4108), where its text reads on it.
793
+ const own = style.page && /^#[0-9a-f]{6}$/i.test(style.page) && aiHexOklch(style.page).L >= 0.9 ? style.page.toLowerCase() : null;
794
+ const background = own != null ? own : aiOklchHex(ground.L, ground.C * groundChroma, ground.h);
784
795
  const paper = aiOklchHex(ground.paper[0], ground.paper[1] * groundChroma, ground.h);
785
796
  // The brand color: a button label reads on it, so it reads on the page too.
786
797
  let primaryMain;
@@ -1241,7 +1252,7 @@ function isRecord(value) {
1241
1252
  * site's own; whatever the base sets beyond them — its focus rings, its menu
1242
1253
  * and dialog styles, its control heights — stays the base's.
1243
1254
  */ export function aiSiteTheme(style, base) {
1244
- var _aiSiteFontPairing, _base_typography, _base_shape, _base_components;
1255
+ var _aiSiteFontPairing, _base_typography, _base_shape, _base_components, _style_sourceFonts;
1245
1256
  var _theme_fonts;
1246
1257
  const pairing = (_aiSiteFontPairing = aiSiteFontPairing(style.fonts)) != null ? _aiSiteFontPairing : AI_SITE_FONT_PAIRINGS[0];
1247
1258
  const colors = aiSiteColors(style);
@@ -1273,37 +1284,54 @@ function isRecord(value) {
1273
1284
  components: merged((_base_components = base.components) != null ? _base_components : {}, componentsFor(style))
1274
1285
  });
1275
1286
  delete theme.darkScheme;
1276
- const sameFamily = pairing.heading.family === pairing.body.family;
1287
+ // A site brought in is set in its source's own families (AGL-4108), at the
1288
+ // weights the pairing draws with, as near as each family has them.
1289
+ const headingWeights = [
1290
+ pairing.heading.weight,
1291
+ pairing.heading.sub
1292
+ ];
1293
+ const source = (_style_sourceFonts = style.sourceFonts) != null ? _style_sourceFonts : null;
1294
+ const body = (source == null ? void 0 : source.body) ? {
1295
+ family: source.body.family,
1296
+ category: source.body.category,
1297
+ weights: aiSiteFontWeightsIn(pairing.body.weights, source.body.weights)
1298
+ } : {
1299
+ family: pairing.body.family,
1300
+ category: pairing.body.category,
1301
+ weights: [
1302
+ ...pairing.body.weights
1303
+ ]
1304
+ };
1305
+ const heading = source ? source.heading ? {
1306
+ family: source.heading.family,
1307
+ category: source.heading.category,
1308
+ weights: aiSiteFontWeightsIn(headingWeights, source.heading.weights)
1309
+ } : _extends({}, body, {
1310
+ weights: aiSiteFontWeightsIn(headingWeights, source.body.weights)
1311
+ }) : {
1312
+ family: pairing.heading.family,
1313
+ category: pairing.heading.category,
1314
+ weights: [
1315
+ ...new Set(headingWeights)
1316
+ ].sort((a, b)=>a - b)
1317
+ };
1318
+ const sameFamily = heading.family.toLowerCase() === body.family.toLowerCase();
1277
1319
  theme = writeThemeFonts(theme, {
1278
- body: {
1279
- family: pairing.body.family,
1280
- category: pairing.body.category,
1281
- weights: [
1282
- ...pairing.body.weights
1283
- ],
1320
+ body: _extends({}, body, {
1284
1321
  source: 'google'
1285
- },
1286
- heading: sameFamily ? null : {
1287
- family: pairing.heading.family,
1288
- category: pairing.heading.category,
1289
- weights: [
1290
- ...new Set([
1291
- pairing.heading.weight,
1292
- pairing.heading.sub
1293
- ])
1294
- ].sort((a, b)=>a - b),
1322
+ }),
1323
+ heading: sameFamily ? null : _extends({}, heading, {
1295
1324
  source: 'google'
1296
- }
1325
+ })
1297
1326
  });
1298
- // A pairing whose heading is the body family loads the heading weights too.
1327
+ // A heading in the body's family loads the heading weights too.
1299
1328
  if (sameFamily && ((_theme_fonts = theme.fonts) == null ? void 0 : _theme_fonts[0])) {
1300
1329
  var _theme_fonts__weights;
1301
1330
  theme.fonts[0] = _extends({}, theme.fonts[0], {
1302
1331
  weights: [
1303
1332
  ...new Set([
1304
1333
  ...(_theme_fonts__weights = theme.fonts[0].weights) != null ? _theme_fonts__weights : [],
1305
- pairing.heading.weight,
1306
- pairing.heading.sub
1334
+ ...heading.weights
1307
1335
  ])
1308
1336
  ].sort((a, b)=>a - b)
1309
1337
  });
@@ -1316,5 +1344,95 @@ function isRecord(value) {
1316
1344
  }
1317
1345
  return theme;
1318
1346
  }
1347
+ // ── A kind's first look (AGL-4049) ──────────────────────────────────────────
1348
+ /** The midpoint of a kind's first hue range, or `null` when it spans the whole wheel (any hue suits it). */ function firstHueOf(hues) {
1349
+ var _ref;
1350
+ const [from, to] = (_ref = hues == null ? void 0 : hues[0]) != null ? _ref : [
1351
+ 0,
1352
+ 360
1353
+ ];
1354
+ const span = from <= to ? to - from : 360 - from + to;
1355
+ if (span >= 360) return null;
1356
+ return Math.round(from + span / 2) % 360;
1357
+ }
1358
+ /**
1359
+ * A kind of site's FIRST look (AGL-4049), the one a site created in that
1360
+ * style starts with and the one the platform's own starter listings carry:
1361
+ * the kind's first base theme the deployment has (`starter`, or a built-in
1362
+ * whose preset `known.presetIds` holds), its first font pairing the platform
1363
+ * has, and a brand primary from the midpoint of its first hue range, colored
1364
+ * as {@link aiSiteColors} colors one. A kind that suits any hue keeps the
1365
+ * base's own colors. One derivation, so the style a person picks in Create
1366
+ * site and the seeded `fp-starter-{kind}-base` listing look the same.
1367
+ *
1368
+ * Deterministic: no draw, the seed is the kind's id.
1369
+ */ export function aiSiteKindDefaultLook(kind, known) {
1370
+ var _known_pairingIds, _family_bases_find, _family_fonts_find;
1371
+ const family = kind.look;
1372
+ const pairingIds = (_known_pairingIds = known.pairingIds) != null ? _known_pairingIds : new Set(AI_SITE_FONT_PAIRINGS.map((pairing)=>pairing.id));
1373
+ const base = (_family_bases_find = family.bases.find((name)=>name === 'starter' || known.presetIds.has(`theme-presets.${name}`))) != null ? _family_bases_find : 'starter';
1374
+ const fonts = (_family_fonts_find = family.fonts.find((id)=>pairingIds.has(id))) != null ? _family_fonts_find : null;
1375
+ const hue = firstHueOf(family.hues);
1376
+ const ground = family.grounds[0];
1377
+ const corners = family.corners[0];
1378
+ const colors = hue === null ? null : aiSiteColors({
1379
+ v: 1,
1380
+ kind: kind.id,
1381
+ base,
1382
+ seed: aiSiteSeed(kind.id),
1383
+ hue,
1384
+ accent: hue,
1385
+ chroma: family.chroma,
1386
+ ground,
1387
+ fonts: fonts != null ? fonts : '',
1388
+ corners,
1389
+ buttons: family.buttons,
1390
+ // Not read by the colors; named so the style is whole.
1391
+ cards: 'flat',
1392
+ fields: 'outlined',
1393
+ eyebrow: 'caps',
1394
+ header: 'line',
1395
+ headerAlign: 'start',
1396
+ rhythm: 'calm',
1397
+ headingScale: family.headingScale,
1398
+ density: family.density,
1399
+ brand: null
1400
+ });
1401
+ const primary = (scheme)=>{
1402
+ var _colors_scheme;
1403
+ const value = colors == null ? void 0 : (_colors_scheme = colors[scheme]) == null ? void 0 : _colors_scheme.primary;
1404
+ return value && typeof value === 'object' && typeof value.main === 'string' ? value.main : null;
1405
+ };
1406
+ const light = primary('light');
1407
+ const dark = primary('dark');
1408
+ const brand = light && dark ? {
1409
+ light: {
1410
+ primary: light
1411
+ },
1412
+ dark: {
1413
+ primary: dark
1414
+ }
1415
+ } : {
1416
+ light: {}
1417
+ };
1418
+ return {
1419
+ theme: {
1420
+ kind: 'builtin',
1421
+ base,
1422
+ brand,
1423
+ fonts
1424
+ },
1425
+ answerStyle: _extends({
1426
+ base
1427
+ }, hue === null ? {} : {
1428
+ hue
1429
+ }, {
1430
+ ground,
1431
+ fonts,
1432
+ corners,
1433
+ buttons: family.buttons
1434
+ })
1435
+ };
1436
+ }
1319
1437
 
1320
1438
  //# sourceMappingURL=ai-site-look.js.map