@aglyn/plugins-ai 1.12.0 → 1.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.
Files changed (61) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-media-create.component.js +1 -1
  3. package/src/lib/components/ai-media-create.component.js.map +1 -1
  4. package/src/lib/components/ai-upsell-dialog.component.js +1 -1
  5. package/src/lib/components/ai-upsell-dialog.component.js.map +1 -1
  6. package/src/lib/jobs/ai-job-import-step.js +11 -1
  7. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  8. package/src/lib/jobs/ai-site-import-compile.js +23 -3
  9. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  10. package/src/lib/jobs/ai-site-import-look.d.ts +19 -4
  11. package/src/lib/jobs/ai-site-import-look.js +142 -45
  12. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  13. package/src/lib/jobs/ai-theme-brand-inputs.d.ts +12 -0
  14. package/src/lib/jobs/ai-theme-brand-inputs.js +1 -1
  15. package/src/lib/jobs/ai-theme-brand-inputs.js.map +1 -1
  16. package/src/lib/layout-language/ai-layout-compiler.js +90 -8
  17. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  18. package/src/lib/layout-language/ai-layout-language.d.ts +8 -2
  19. package/src/lib/layout-language/ai-layout-language.js +4 -2
  20. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  21. package/src/lib/model/ai-site-import-fidelity.d.ts +9 -0
  22. package/src/lib/model/ai-site-import-fidelity.js +64 -6
  23. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  24. package/src/lib/model/ai-site-import.d.ts +36 -1
  25. package/src/lib/model/ai-site-import.js.map +1 -1
  26. package/src/lib/model/ai-upsell-copy.js +1 -1
  27. package/src/lib/model/ai-upsell-copy.js.map +1 -1
  28. package/src/lib/runtime/site-inventory.js +2 -3
  29. package/src/lib/runtime/site-inventory.js.map +1 -1
  30. package/src/lib/server/assist-view-context.js +3 -3
  31. package/src/lib/server/assist-view-context.js.map +1 -1
  32. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +12 -1
  33. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +19 -9
  34. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  35. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +32 -0
  36. package/src/lib/site-import/fixtures/site-layout-recordings.js +55 -0
  37. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
  38. package/src/lib/site-import/site-import-concealed.d.ts +30 -0
  39. package/src/lib/site-import/site-import-concealed.js +231 -0
  40. package/src/lib/site-import/site-import-concealed.js.map +1 -0
  41. package/src/lib/site-import/site-import-crawl.d.ts +5 -1
  42. package/src/lib/site-import/site-import-crawl.js +35 -18
  43. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  44. package/src/lib/site-import/site-import-css.d.ts +81 -0
  45. package/src/lib/site-import/site-import-css.js +456 -27
  46. package/src/lib/site-import/site-import-css.js.map +1 -1
  47. package/src/lib/site-import/site-import-data-forms.d.ts +32 -0
  48. package/src/lib/site-import/site-import-data-forms.js +531 -0
  49. package/src/lib/site-import/site-import-data-forms.js.map +1 -0
  50. package/src/lib/site-import/site-import-html.d.ts +36 -1
  51. package/src/lib/site-import/site-import-html.js +264 -54
  52. package/src/lib/site-import/site-import-html.js.map +1 -1
  53. package/src/lib/site-import/site-import-layout.d.ts +1 -1
  54. package/src/lib/site-import/site-import-layout.js +490 -44
  55. package/src/lib/site-import/site-import-layout.js.map +1 -1
  56. package/src/lib/site-import/site-import-nav.js +17 -3
  57. package/src/lib/site-import/site-import-nav.js.map +1 -1
  58. package/src/lib/site-import/site-import-page.js +2 -0
  59. package/src/lib/site-import/site-import-page.js.map +1 -1
  60. package/src/lib/testing/stand-in-dataset-index.js +6 -2
  61. package/src/lib/testing/stand-in-dataset-index.js.map +1 -1
@@ -60,6 +60,8 @@ export interface SiteImportCss {
60
60
  fontFaces: string[];
61
61
  /** Read for its dark scheme (AGL-4152): the rules that scheme alone selects, by a media query or a class on the page. */
62
62
  darkRules: number;
63
+ /** How many declarations read each custom property (AGL-4152): what its palette uses most. */
64
+ variableUses: Map<string, number>;
63
65
  }
64
66
  /** Which of a page's color schemes a read of its stylesheets answers for. */
65
67
  export interface SiteImportCssOptions {
@@ -80,6 +82,8 @@ export interface SiteImportStyles {
80
82
  of(element: number): SiteImportComputedStyle;
81
83
  /** The root's (`<html>`) element id, which `:root` matches; -1 for none. */
82
84
  readonly root: number;
85
+ /** The custom properties the root declares (AGL-4152), each read through to what it holds. */
86
+ rootVariables(): ReadonlyMap<string, string>;
83
87
  }
84
88
  /**
85
89
  * Elements' styles over a page's structure and its sheets. Styles are
@@ -94,6 +98,13 @@ export interface SiteImportRgba {
94
98
  }
95
99
  /** The first color a value names, or `null`; `transparent` is a color of no strength. */
96
100
  export declare function siteImportColorOf(value: string | undefined): SiteImportRgba | null;
101
+ /**
102
+ * The brand colors a page's root declares (AGL-4152): the custom properties
103
+ * named for a brand that hold a color, a triple included, none too pale, dark
104
+ * or grey to carry one, the most read first. What the page says its brand is,
105
+ * even where nothing on this page happens to draw it.
106
+ */
107
+ export declare function siteImportPaletteOf(styles: Pick<SiteImportStyles, 'rootVariables'>, uses: ReadonlyMap<string, number>): string[];
97
108
  /** `#rrggbb` of a color, its strength ignored. */
98
109
  export declare function siteImportHex(color: SiteImportRgba): string;
99
110
  /** Relative luminance, 0 (black) to 1 (white). */
@@ -139,8 +150,78 @@ export declare function siteImportRadiusPx(style: SiteImportComputedStyle): numb
139
150
  export declare function siteImportFontSizePx(style: SiteImportComputedStyle): number | null;
140
151
  /** The relative widths a grid template draws its columns at, or `null` for none. */
141
152
  export declare function siteImportGridColumns(template: string | undefined): number[] | null;
153
+ /**
154
+ * How many tracks a grid template draws (AGL-4152), each `repeat()` opened at
155
+ * its whole count; `null` for none, or where the screen decides (`auto-fill`).
156
+ */
157
+ export declare function siteImportGridTrackCount(template: string | undefined): number | null;
158
+ /** The cells a child of a grid covers, by grid line: `rowEnd` and `columnEnd` are the lines after its last row and column. */
159
+ export interface SiteImportGridBox {
160
+ rowStart: number;
161
+ rowEnd: number;
162
+ columnStart: number;
163
+ columnEnd: number;
164
+ }
165
+ /** A flex or grid child's `order`, 0 where it sets none. */
166
+ export declare function siteImportOrderOf(style: SiteImportComputedStyle): number;
167
+ /**
168
+ * Where a grid places its children (AGL-4152), each child's cells by grid
169
+ * line, as a browser lays them out: the lines each child names (by
170
+ * `grid-area`, a named area, `grid-row` or `grid-column`, a longhand over the
171
+ * shorthand; lines from the end read from the template), then the children it
172
+ * leaves to the grid's flow, in `order`, each in the first cells free.
173
+ *
174
+ * `null` where it cannot say, or there is nothing to say: no child names a
175
+ * place (a `span` says how wide, and `1 / -1` the whole row, not where), the
176
+ * rest of the children flow by columns, or through tracks the screen decides.
177
+ */
178
+ export declare function siteImportGridBoxes(container: SiteImportComputedStyle, items: readonly SiteImportComputedStyle[]): SiteImportGridBox[] | null;
142
179
  /** Weights scaled to twelfths, each at least 1: `[420, 788]` is `[4, 8]`. */
143
180
  export declare function siteImportTwelfths(weights: readonly number[]): number[];
144
181
  /** The families a `font-family` value names, quotes dropped, generic ones left out. */
145
182
  export declare function siteImportFontFamilies(value: string | undefined): string[];
183
+ /**
184
+ * How much of a page's stylesheets is read (AGL-4152). A site builder's own
185
+ * sheet can be its fifth link and 1.3 MB, with half a megabyte more behind it,
186
+ * and every color and font of the site is in it. So:
187
+ *
188
+ * - `firstLookBytes`: every link is first read this far. Most sheets end
189
+ * inside it, and those are done; a larger one shows here whether it declares
190
+ * `:root` custom properties, which they do at their top.
191
+ * - `budgetBytes`: what all the page's sheets may hold together, first looks
192
+ * included. Three times the sheet that set it, with room for what comes with
193
+ * it. What does not fit is cut, and a cut sheet is read as far as it goes.
194
+ * - `atOnce`: first looks asked together, so twenty links are not twenty
195
+ * connections to one host.
196
+ *
197
+ * So one page's read costs at most its links' first looks and the budget:
198
+ * 3.8 MB at the most links a page lists, however large its sheets are.
199
+ */
200
+ export declare const SITE_IMPORT_SHEET_LIMITS: {
201
+ readonly firstLookBytes: number;
202
+ readonly budgetBytes: number;
203
+ readonly atOnce: 6;
204
+ };
205
+ /** What a read of a stylesheet gives back. */
206
+ export interface SiteImportSheetAnswer {
207
+ ok: boolean;
208
+ text: string;
209
+ /** Bytes read. */
210
+ bytes: number;
211
+ /** Whether the sheet goes on past `maxBytes`. */
212
+ truncated: boolean;
213
+ }
214
+ /** Reads a stylesheet to a number of bytes; `null` where it cannot. */
215
+ export type SiteImportSheetRead = (url: string, maxBytes: number) => Promise<SiteImportSheetAnswer | null>;
216
+ /**
217
+ * Every stylesheet a page links, to a byte budget (AGL-4152), in link order,
218
+ * as the cascade needs them. Each is read a first look; then the ones that go
219
+ * on are read whole, the ones declaring `:root` custom properties first, then
220
+ * the rest in link order, each to what is left of the budget. A read that fails
221
+ * leaves its sheet out, and never the page.
222
+ */
223
+ export declare function siteImportReadStylesheets(urls: readonly string[], read: SiteImportSheetRead, options?: {
224
+ budgetBytes?: number;
225
+ outOfTime?: () => boolean;
226
+ }): Promise<string[]>;
146
227
  export {};