@vectoriox/iox-ui 5.121.0 → 5.123.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.
@@ -1,4 +1,5 @@
1
1
  import { AiStep, JsonSchema, PlanWordContext, AdjustAxis, AdjustKind, SerializedNode, SectionInput } from '@vectoriox/iox-ui/generation-core';
2
+ import { DesignChoices, DesignMode } from '@vectoriox/iox-ui/design-core';
2
3
 
3
4
  /**
4
5
  * The surfaces AI Assist runs on (ai-assist-plan §2, §4): each screen that offers a prompt registers ONE spec — what it
@@ -75,7 +76,8 @@ declare enum AssistPermission {
75
76
  PageUpdate = "page_update",
76
77
  PageDelete = "page_delete",
77
78
  StorageAll = "storage_all",
78
- ProductsAll = "products_all"
79
+ ProductsAll = "products_all",
80
+ SettingsAll = "settings_all"
79
81
  }
80
82
  declare enum SurfaceStatus {
81
83
  Built = "built",
@@ -186,7 +188,9 @@ declare enum AssistIssueCode {
186
188
  /** Looks like an e-mail, phone, price or time nobody gave (generation-core `factIssues`, R-H2). */
187
189
  InventedFact = "inventedFact",
188
190
  /** A word this site must not use. */
189
- AvoidWord = "avoidWord"
191
+ AvoidWord = "avoidWord",
192
+ /** A look whose colours fail the contrast audit in a mode the site is worn in (family `look`, R4). */
193
+ Contrast = "contrast"
190
194
  }
191
195
  interface AssistIssue {
192
196
  readonly code: AssistIssueCode;
@@ -633,9 +637,9 @@ interface SizeEdit {
633
637
  readonly step: string;
634
638
  }
635
639
  /** Any edit of family `style`. */
636
- type LookEdit = StyleEdit | SchemeEdit | SizeEdit;
640
+ type NodeStyleEdit = StyleEdit | SchemeEdit | SizeEdit;
637
641
  /** The answer → the edits it makes. */
638
- declare function decodeStyleAnswers(answers: ReadonlyArray<unknown>): LookEdit[];
642
+ declare function decodeStyleAnswers(answers: ReadonlyArray<unknown>): NodeStyleEdit[];
639
643
  declare const isStyleEdit: (e: object) => e is StyleEdit;
640
644
  declare const isSchemeEdit: (e: object) => e is SchemeEdit;
641
645
  declare const isSizeEdit: (e: object) => e is SizeEdit;
@@ -645,7 +649,9 @@ declare enum PageChangeOp {
645
649
  Style = "style",
646
650
  Scheme = "scheme",
647
651
  Size = "size",
648
- Section = "section"
652
+ Section = "section",
653
+ /** The site's look (family `look`, AI2e) — every page follows. */
654
+ Look = "look"
649
655
  }
650
656
  interface StyleChange {
651
657
  readonly op: PageChangeOp.Style | PageChangeOp.Scheme | PageChangeOp.Size;
@@ -682,7 +688,7 @@ interface StyleEditsOutcome {
682
688
  * handle not in the focus, a style the target may not take, a scheme on a target that takes none are refused (re-asked
683
689
  * once by the server, never repaired here); an edit that changes nothing is dropped.
684
690
  */
685
- declare function applyStyleEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<LookEdit>, ctx: StyleEditContext): StyleEditsOutcome;
691
+ declare function applyStyleEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<NodeStyleEdit>, ctx: StyleEditContext): StyleEditsOutcome;
686
692
 
687
693
  /**
688
694
  * Surface S1 (the builder, this page), family `sections` (ai-assist-plan AI2d; ai-session-panel-plan `addSection` /
@@ -791,6 +797,101 @@ interface SectionEditsOutcome {
791
797
  */
792
798
  declare function applySectionEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<SectionEdit>, ctx: SectionEditContext): SectionEditsOutcome;
793
799
 
800
+ /**
801
+ * Surface S1 (the builder), family `look` (ai-assist-plan §4 AI2e; ai-session-panel-plan `setLook` / `setMotion`): the
802
+ * SITE's look and motion — every page follows — changed only along the contract's own axes: a style preset, the brand
803
+ * colour, the background tint, corners, pill buttons, spacing, the type pairing, the colour mode, speed, scrolling, how
804
+ * animated and the change between pages. Never a token value, never CSS. A preset brings its whole look and keeps the
805
+ * site's own Scrolling · How animated · Between pages (MO-D3, as Design ▸ Look does); a type pairing is one of the worn
806
+ * style's own. The colour is checked by the SAME audit the contract gates every preset with (`auditDesignContrast`, in
807
+ * every mode the look is worn) — a colour that fails is refused, never worn (R4: the AA gate decides the colour).
808
+ * The SAME pure functions run on the server (the check) and in the builder (the trial through the Design side-card's
809
+ * own trial): `lookJsonSchema`, `decodeLookAnswers`, `applyLookEdits`.
810
+ */
811
+ /** One axis of the look, as the answer names it and the change card says it. */
812
+ declare enum LookAxis {
813
+ Style = "style",
814
+ Colour = "colour",
815
+ Tint = "tint",
816
+ Corners = "corners",
817
+ Buttons = "buttons",
818
+ Spacing = "spacing",
819
+ Type = "type",
820
+ Mode = "mode",
821
+ Speed = "speed",
822
+ Scrolling = "scrolling",
823
+ Entrances = "entrances",
824
+ Between = "between"
825
+ }
826
+ /** How the card names each axis (the builder translates it by the axis). */
827
+ declare const LOOK_AXIS_LABELS: Readonly<Record<LookAxis, string>>;
828
+ /** The axes in the order a card lists them (and the answer asks them). */
829
+ declare const LOOK_AXES: ReadonlyArray<LookAxis>;
830
+ /** The answer's extra key. Every axis is required; `''` keeps it as it is. */
831
+ declare enum LookAnswerKey {
832
+ Note = "note"
833
+ }
834
+ /** "Keep it as it is" — strict outputs require every key. */
835
+ declare const LOOK_KEEP = "";
836
+ /** `buttons`: pill-shaped or as the look draws them. */
837
+ declare enum LookButtons {
838
+ Pill = "pill",
839
+ Look = "look"
840
+ }
841
+ /** How the owner reads a colour mode. */
842
+ declare const MODE_LABELS: Readonly<Record<DesignMode, string>>;
843
+ /** A colour as the look stores it (`#RRGGBB`), or null. */
844
+ declare function lookHex(value: string): string | null;
845
+ /** How the owner reads one axis of a set of choices. */
846
+ declare function lookAxisValue(choices: DesignChoices, axis: LookAxis): {
847
+ readonly id: string;
848
+ readonly label: string;
849
+ };
850
+ /** The look as the brief says it — one readable value per axis (the model reads the site's look before changing it). */
851
+ type LookSummary = Readonly<Record<LookAxis, string>>;
852
+ declare function summarizeLook(choices: DesignChoices): LookSummary;
853
+ interface LookSchemas {
854
+ /** One request: every axis plus a note. */
855
+ readonly parts: ReadonlyArray<JsonSchema>;
856
+ /** No handles — the look is the site's. */
857
+ readonly handles: ReadonlyArray<ReadonlyArray<string>>;
858
+ }
859
+ /** Family `look`'s ONE strict format: every axis required, `''` keeps it; the ids listed and described from the contract. */
860
+ declare function lookJsonSchema(current: DesignChoices | null | undefined): LookSchemas;
861
+ /** The look the answer asks for — the axes it names, nothing else. */
862
+ interface SiteLookEdit {
863
+ readonly look: Readonly<Partial<Record<LookAxis, string>>>;
864
+ }
865
+ declare const isSiteLookEdit: (e: unknown) => e is SiteLookEdit;
866
+ /** The answer as ONE edit (or none, when every axis is kept). */
867
+ declare function decodeLookAnswers(answers: ReadonlyArray<unknown>): SiteLookEdit[];
868
+ /** One axis the turn changed, as the card says it. */
869
+ interface SiteLookChange {
870
+ readonly op: PageChangeOp.Look;
871
+ readonly axis: LookAxis;
872
+ /** The axis as the card names it ("Corners"). */
873
+ readonly label: string;
874
+ /** The ids, and how the owner reads them. */
875
+ readonly from: string;
876
+ readonly to: string;
877
+ readonly before: string;
878
+ readonly after: string;
879
+ }
880
+ interface LookEditsOutcome {
881
+ readonly ok: boolean;
882
+ /** The look the trial wears (the current one when not ok). */
883
+ readonly choices: DesignChoices;
884
+ readonly changes: ReadonlyArray<SiteLookChange>;
885
+ readonly issues: ReadonlyArray<AssistIssue>;
886
+ }
887
+ /**
888
+ * The answer on the current look: a style first (its whole look, the site's motion kept, the mode kept when the style
889
+ * offers it), then every other axis named. Refused, all or none: an id the axis does not have, a colour that is not one,
890
+ * a pairing the style does not offer, a mode the style was not drawn in, and a colour, tint or mode that fails the contrast
891
+ * audit in a mode the site is worn in. A look that is exactly an audited style is not re-audited (the contract gated it).
892
+ */
893
+ declare function applyLookEdits(current: DesignChoices | null | undefined, edits: ReadonlyArray<SiteLookEdit>): LookEditsOutcome;
894
+
794
895
  /**
795
896
  * Surface S1 (the builder, this page), family `words` (ai-assist-plan §4, ai-session-panel-plan §3b–§3d): the page as
796
897
  * the model sees it — sections in order, each a handle (`s0`), the parts that carry words as handles (`s0.heading1`,
@@ -875,6 +976,8 @@ interface PageAround {
875
976
  }>;
876
977
  /** The site's other pages, by name. */
877
978
  readonly pages: ReadonlyArray<string>;
979
+ /** Family `look`: the look the whole site wears, one readable value per axis (AI2e). */
980
+ readonly look?: LookSummary;
878
981
  }
879
982
  type PageBrief = Brief<PageFocus, PageAround>;
880
983
  interface PageBriefContext {
@@ -890,6 +993,8 @@ interface PageBriefContext {
890
993
  readonly pages?: ReadonlyArray<string>;
891
994
  readonly owner?: string | null;
892
995
  readonly memory?: ReadonlyArray<string>;
996
+ /** The look the site wears (its stored choices) — said in the brief so "rounder", "darker", "calmer" read from it. */
997
+ readonly look?: DesignChoices | null;
893
998
  }
894
999
  interface SummarizedPage {
895
1000
  readonly brief: PageBrief;
@@ -994,11 +1099,12 @@ declare function pageWriteLocale(layout: ReadonlyArray<SerializedNode>, ctx: {
994
1099
  * Surface S1's answer as ONE thing (AI2b–AI2d): the edits of every family a page turn routed to — words (`{ handle, value }`),
995
1100
  * styles (`{ handle, style }`), schemes (`{ handle, scheme }`), size steps (`{ handle, axis, step }`), sections
996
1101
  * (`{ add | remove | move | swap }`) — applied in that order on a copy, all or none. Sections go last: every handle the
997
- * other families name is read on the page as it stood. The server checks each family as it is asked; the builder's trial
1102
+ * other families name is read on the page as it stood. The site's look (`{ look }`, AI2e) changes no node: it is applied
1103
+ * on `ctx.look` (the look the site wears) and comes back as `look`, the choices the trial wears. The server checks each family as it is asked; the builder's trial
998
1104
  * applies the turn's edits through this, so both read one rule.
999
1105
  */
1000
- type PageEdit = WordEdit | StyleEdit | SchemeEdit | SizeEdit | SectionEdit;
1001
- type PageChange = WordChange | StyleChange | SectionChange;
1106
+ type PageEdit = WordEdit | StyleEdit | SchemeEdit | SizeEdit | SectionEdit | SiteLookEdit;
1107
+ type PageChange = WordChange | StyleChange | SectionChange | SiteLookChange;
1002
1108
  interface PageEditContext extends Omit<WordEditContext, 'handles' | 'never'> {
1003
1109
  readonly summary: Pick<SummarizedPage, 'handles' | 'looks'> & Partial<Pick<SummarizedPage, 'sections'>> & {
1004
1110
  readonly brief: {
@@ -1012,12 +1118,16 @@ interface PageEditContext extends Omit<WordEditContext, 'handles' | 'never'> {
1012
1118
  /** Family `sections`: the studio's name and pages (what the palette composes with) and the builder's fresh ids. */
1013
1119
  readonly sectionInput?: SectionEditContext['input'];
1014
1120
  readonly newId?: SectionEditContext['newId'];
1121
+ /** Family `look`: the look the site wears (its stored choices); absent = the default look. */
1122
+ readonly look?: DesignChoices | null;
1015
1123
  }
1016
1124
  interface PageEditsOutcome {
1017
1125
  readonly ok: boolean;
1018
1126
  readonly result: SerializedNode[];
1019
1127
  readonly changes: ReadonlyArray<PageChange>;
1020
1128
  readonly issues: ReadonlyArray<AssistIssue>;
1129
+ /** Family `look`: the choices the turn's look wears — present only when the turn changed the look. */
1130
+ readonly look?: DesignChoices;
1021
1131
  }
1022
1132
  declare function applyPageEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<PageEdit>, ctx: PageEditContext): PageEditsOutcome;
1023
1133
 
@@ -1070,9 +1180,9 @@ interface AssistTurnRequest {
1070
1180
  };
1071
1181
  }
1072
1182
  /** What a turn proposes, per family: a field's value (`fields`), a part's words (`words`), an element's style or a section's scheme (`style`). */
1073
- type AssistEdit = FieldEdit | WordEdit | StyleEdit | SchemeEdit | SizeEdit | SectionEdit;
1183
+ type AssistEdit = FieldEdit | WordEdit | StyleEdit | SchemeEdit | SizeEdit | SectionEdit | SiteLookEdit;
1074
1184
  /** What a turn changed, as the card says it. */
1075
- type AssistChange = FieldChange | WordChange | StyleChange | SectionChange;
1185
+ type AssistChange = FieldChange | WordChange | StyleChange | SectionChange | SiteLookChange;
1076
1186
  /** POST's 202 answer. */
1077
1187
  interface AssistTurnAccepted {
1078
1188
  readonly turnId: string;
@@ -1183,5 +1293,5 @@ declare function turnLocale(sentence: string, fields: ReadonlyArray<AssistField>
1183
1293
  /** The language's own name in the admin's language (`en` → "English" / "אנגלית"). */
1184
1294
  declare const languageName: (locale: string, uiLang: string) => string;
1185
1295
 
1186
- export { AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, ASK_SECTION_PATTERNS, ASK_STYLE_SETS, ASSIST_MODEL_AUTO, ASSIST_POLL_MS, ASSIST_ROUTES, AssistBriefError, AssistBudgetError, AssistFieldKind, AssistIssueCode, AssistPathError, AssistPermission, AssistRefusalCode, AssistRouteKey, AssistScope, AssistStep, AssistSurface, AssistTurnStatus, BOOLEAN_FALSE, BOOLEAN_TRUE, CommitKind, EditFamily, FIELDS_PER_PART, FIELD_HANDLE_PREFIX, FOCUS_TEXT_CHARS, FieldsAnswerKey, ItemSuggestionKind, LOCALE_NAME_LANGUAGES, MAX_ASSIST_PROPERTIES, MAX_ROUTE_PROPERTIES, MAX_SENTENCE_CHARS, MEMORY_TURNS, NEW_TARGET, NONE_TEXT, NeverWriteReason, PAGE_WORD_SLOTS, PageChangeOp, PagePartKind, PageSuggestionKind, RouteAnswerKey, SECTION_START, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, SectionChangeKind, SectionsAnswerKey, StyleAnswerKey, SurfaceStatus, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, applyFieldEdits, applyPageEdits, applySectionEdits, applyStyleEdits, applyWordEdits, askSectionPatternNames, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeSectionsAnswers, decodeStyleAnswers, decodeWordsAnswers, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, isEmptyFieldValue, isPlainRecord, isSchemeEdit, isSectionEdit, isSessionOf, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookNames, memoryLine, namedLocale, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, sectionPatternOf, sectionsJsonSchema, serializedBaselineStyles, sessionMemory, styleJsonSchema, summarizeItem, summarizePage, surfacePermissions, surfaceSpec, titleField, turnLocale, unknownHandles, validateTurnRequest, wordsJsonSchema };
1187
- export type { AssistChange, AssistEdit, AssistField, AssistIssue, AssistMemoryLine, AssistModelChoice, AssistRoute, AssistSession, AssistTarget, AssistTurn, AssistTurnAccepted, AssistTurnRefusal, AssistTurnRequest, AssistWordContext, BaselineStyles, Brief, BriefRules, BriefValue, ContentControllerDef, ContentPropertyDef, ContentRecord, ContentTypeSchema, FieldChange, FieldEdit, FieldEditContext, FieldEditsOutcome, FieldsSchemaOptions, FieldsSchemas, HandleMap, HandleResolution, HandleTarget, ItemAround, ItemBrief, ItemBriefContext, ItemBriefField, ItemFocus, ItemSuggestion, ItemSummary, LookEdit, LookMap, LookTarget, NeverWrite, PageAround, PageBrief, PageBriefContext, PageChange, PageEdit, PageEditContext, PageEditsOutcome, PageFocus, PageLook, PagePart, PageSectionSummary, PageSuggestion, SchemeEdit, SectionAdd, SectionChange, SectionEdit, SectionEditContext, SectionEditsOutcome, SectionMap, SectionMove, SectionRemove, SectionSwap, SectionTarget, SizeEdit, StyleChange, StyleEdit, StyleEditContext, StyleEditsOutcome, StyleSchemas, SummarizedItem, SummarizedPage, SurfaceSpec, WalkedLook, WordChange, WordEdit, WordEditContext, WordEditsOutcome, WordsSchemas, WrittenWords };
1296
+ export { AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, ASK_SECTION_PATTERNS, ASK_STYLE_SETS, ASSIST_MODEL_AUTO, ASSIST_POLL_MS, ASSIST_ROUTES, AssistBriefError, AssistBudgetError, AssistFieldKind, AssistIssueCode, AssistPathError, AssistPermission, AssistRefusalCode, AssistRouteKey, AssistScope, AssistStep, AssistSurface, AssistTurnStatus, BOOLEAN_FALSE, BOOLEAN_TRUE, CommitKind, EditFamily, FIELDS_PER_PART, FIELD_HANDLE_PREFIX, FOCUS_TEXT_CHARS, FieldsAnswerKey, ItemSuggestionKind, LOCALE_NAME_LANGUAGES, LOOK_AXES, LOOK_AXIS_LABELS, LOOK_KEEP, LookAnswerKey, LookAxis, LookButtons, MAX_ASSIST_PROPERTIES, MAX_ROUTE_PROPERTIES, MAX_SENTENCE_CHARS, MEMORY_TURNS, MODE_LABELS, NEW_TARGET, NONE_TEXT, NeverWriteReason, PAGE_WORD_SLOTS, PageChangeOp, PagePartKind, PageSuggestionKind, RouteAnswerKey, SECTION_START, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, SectionChangeKind, SectionsAnswerKey, StyleAnswerKey, SurfaceStatus, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, applyFieldEdits, applyLookEdits, applyPageEdits, applySectionEdits, applyStyleEdits, applyWordEdits, askSectionPatternNames, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeLookAnswers, decodeSectionsAnswers, decodeStyleAnswers, decodeWordsAnswers, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, isEmptyFieldValue, isPlainRecord, isSchemeEdit, isSectionEdit, isSessionOf, isSiteLookEdit, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookAxisValue, lookHex, lookJsonSchema, lookNames, memoryLine, namedLocale, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, sectionPatternOf, sectionsJsonSchema, serializedBaselineStyles, sessionMemory, styleJsonSchema, summarizeItem, summarizeLook, summarizePage, surfacePermissions, surfaceSpec, titleField, turnLocale, unknownHandles, validateTurnRequest, wordsJsonSchema };
1297
+ export type { AssistChange, AssistEdit, AssistField, AssistIssue, AssistMemoryLine, AssistModelChoice, AssistRoute, AssistSession, AssistTarget, AssistTurn, AssistTurnAccepted, AssistTurnRefusal, AssistTurnRequest, AssistWordContext, BaselineStyles, Brief, BriefRules, BriefValue, ContentControllerDef, ContentPropertyDef, ContentRecord, ContentTypeSchema, FieldChange, FieldEdit, FieldEditContext, FieldEditsOutcome, FieldsSchemaOptions, FieldsSchemas, HandleMap, HandleResolution, HandleTarget, ItemAround, ItemBrief, ItemBriefContext, ItemBriefField, ItemFocus, ItemSuggestion, ItemSummary, LookEditsOutcome, LookMap, LookSchemas, LookSummary, LookTarget, NeverWrite, NodeStyleEdit, PageAround, PageBrief, PageBriefContext, PageChange, PageEdit, PageEditContext, PageEditsOutcome, PageFocus, PageLook, PagePart, PageSectionSummary, PageSuggestion, SchemeEdit, SectionAdd, SectionChange, SectionEdit, SectionEditContext, SectionEditsOutcome, SectionMap, SectionMove, SectionRemove, SectionSwap, SectionTarget, SiteLookChange, SiteLookEdit, SizeEdit, StyleChange, StyleEdit, StyleEditContext, StyleEditsOutcome, StyleSchemas, SummarizedItem, SummarizedPage, SurfaceSpec, WalkedLook, WordChange, WordEdit, WordEditContext, WordEditsOutcome, WordsSchemas, WrittenWords };