@vectoriox/iox-ui 5.118.0 → 5.119.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,4 @@
1
- import { AiStep, JsonSchema, PlanWordContext, SerializedNode } from '@vectoriox/iox-ui/generation-core';
1
+ import { AiStep, JsonSchema, PlanWordContext, AdjustAxis, AdjustKind, SerializedNode } from '@vectoriox/iox-ui/generation-core';
2
2
 
3
3
  /**
4
4
  * The surfaces AI Assist runs on (ai-assist-plan §2, §4): each screen that offers a prompt registers ONE spec — what it
@@ -535,6 +535,9 @@ declare function applyFieldEdits(values: ContentRecord, edits: ReadonlyArray<Fie
535
535
  * copy) and in the builder (the trial): `pageLooks` (the targets and their handles), `styleJsonSchema`,
536
536
  * `decodeStyleAnswers`, `applyStyleEdits` — design-core's `switchElementStyle` (the author's own changes are kept) and
537
537
  * `setColorScheme` (the ONE scheme writer), all or none.
538
+ *
539
+ * AI2c adds SIZE STEPS to the same family: a section's height and spacing, a card's or panel's padding, where words sit
540
+ * — each a row of generation-core `ADJUSTMENTS` (the only place their values come from), never a number the model wrote.
538
541
  */
539
542
  /**
540
543
  * The styles an owner may swap between by asking — each set is ONE kind of thing (a button, a heading, words, a box, a
@@ -543,6 +546,11 @@ declare function applyFieldEdits(values: ContentRecord, edits: ReadonlyArray<Fie
543
546
  * to the styles its type may wear (design-core `elementStylesFor`).
544
547
  */
545
548
  declare const ASK_STYLE_SETS: ReadonlyArray<ReadonlyArray<string>>;
549
+ /**
550
+ * The size axes a node may be stepped on, and which kind each acts as (AI2c): a section root its height and rhythm, a
551
+ * card or panel its padding, a heading or text its alignment. A node that is none of these takes no step.
552
+ */
553
+ declare function adjustAxesOf(node: SerializedNode, isRoot: boolean, carriesWords: boolean): Partial<Record<AdjustAxis, AdjustKind>>;
546
554
  /** The styles a node may take by asking — its own among them — or [] when it is not a target. */
547
555
  declare function askableStyles(node: Pick<SerializedNode, 'type' | 'elementStyle'>): string[];
548
556
  /** A target of family `style` — what the brief says, and what the check needs (the node id is never sent). */
@@ -555,9 +563,13 @@ interface PageLook {
555
563
  readonly styles?: ReadonlyArray<string>;
556
564
  /** Its colour scheme, when it takes one. */
557
565
  readonly scheme?: string;
566
+ /** The size axes it may be stepped on, each with the step it holds now (`own` = a value of its own). */
567
+ readonly sizes?: Readonly<Partial<Record<AdjustAxis, string>>>;
558
568
  }
559
569
  interface WalkedLook {
560
570
  readonly look: PageLook;
571
+ /** Which kind each of its size axes acts as — what the check writes with (never sent). */
572
+ readonly axes: Readonly<Partial<Record<AdjustAxis, AdjustKind>>>;
561
573
  readonly section: number;
562
574
  readonly nodeId: string;
563
575
  readonly type: string;
@@ -583,11 +595,14 @@ interface LookTarget {
583
595
  readonly label: string;
584
596
  readonly styles: ReadonlyArray<string>;
585
597
  readonly scheme: boolean;
598
+ /** The size axes it may be stepped on, and the kind each acts as. */
599
+ readonly sizes?: Readonly<Partial<Record<AdjustAxis, AdjustKind>>>;
586
600
  }
587
601
  type LookMap = Readonly<Record<string, LookTarget>>;
588
602
  declare enum StyleAnswerKey {
589
603
  Styles = "styles",
590
604
  Schemes = "schemes",
605
+ Sizes = "sizes",
591
606
  Note = "note"
592
607
  }
593
608
  interface StyleSchemas {
@@ -611,22 +626,34 @@ interface SchemeEdit {
611
626
  readonly handle: string;
612
627
  readonly scheme: string;
613
628
  }
629
+ /** An element stepped on a size axis — a row of generation-core `ADJUSTMENTS`. */
630
+ interface SizeEdit {
631
+ readonly handle: string;
632
+ readonly axis: string;
633
+ readonly step: string;
634
+ }
635
+ /** Any edit of family `style`. */
636
+ type LookEdit = StyleEdit | SchemeEdit | SizeEdit;
614
637
  /** The answer → the edits it makes. */
615
- declare function decodeStyleAnswers(answers: ReadonlyArray<unknown>): Array<StyleEdit | SchemeEdit>;
638
+ declare function decodeStyleAnswers(answers: ReadonlyArray<unknown>): LookEdit[];
616
639
  declare const isStyleEdit: (e: object) => e is StyleEdit;
617
640
  declare const isSchemeEdit: (e: object) => e is SchemeEdit;
641
+ declare const isSizeEdit: (e: object) => e is SizeEdit;
618
642
  /** Which kind of change a change card shows. */
619
643
  declare enum PageChangeOp {
620
644
  Words = "words",
621
645
  Style = "style",
622
- Scheme = "scheme"
646
+ Scheme = "scheme",
647
+ Size = "size"
623
648
  }
624
649
  interface StyleChange {
625
- readonly op: PageChangeOp.Style | PageChangeOp.Scheme;
650
+ readonly op: PageChangeOp.Style | PageChangeOp.Scheme | PageChangeOp.Size;
651
+ /** A size step's axis. */
652
+ readonly axis?: AdjustAxis;
626
653
  readonly handle: string;
627
654
  readonly nodeId: string;
628
655
  readonly label: string;
629
- /** The style / scheme ids, and how the owner reads them. */
656
+ /** The style / scheme / step ids, and how the owner reads them. */
630
657
  readonly from: string;
631
658
  readonly to: string;
632
659
  readonly before: string;
@@ -654,7 +681,7 @@ interface StyleEditsOutcome {
654
681
  * handle not in the focus, a style the target may not take, a scheme on a target that takes none are refused (re-asked
655
682
  * once by the server, never repaired here); an edit that changes nothing is dropped.
656
683
  */
657
- declare function applyStyleEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<StyleEdit | SchemeEdit>, ctx: StyleEditContext): StyleEditsOutcome;
684
+ declare function applyStyleEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<LookEdit>, ctx: StyleEditContext): StyleEditsOutcome;
658
685
 
659
686
  /**
660
687
  * Surface S1 (the builder, this page), family `words` (ai-assist-plan §4, ai-session-panel-plan §3b–§3d): the page as
@@ -709,7 +736,7 @@ interface PageSectionSummary {
709
736
  /** The section's own name ("Hero", "Our work") or "Section 3". */
710
737
  readonly label: string;
711
738
  readonly parts: ReadonlyArray<PagePart>;
712
- /** Family `style`: the elements of the section that may take another element style or colour scheme. */
739
+ /** Family `style`: the elements of the section that may take another element style, colour scheme or size step. */
713
740
  readonly looks?: ReadonlyArray<PageLook>;
714
741
  }
715
742
  interface PageFocus {
@@ -850,11 +877,12 @@ declare function pageWriteLocale(layout: ReadonlyArray<SerializedNode>, ctx: {
850
877
  }): string;
851
878
 
852
879
  /**
853
- * Surface S1's answer as ONE thing (AI2b): the edits of every family a page turn routed to — words (`{ handle, value }`),
854
- * styles (`{ handle, style }`), schemes (`{ handle, scheme }`) — applied in that order on a copy, all or none. The server
880
+ * Surface S1's answer as ONE thing (AI2b, AI2c): the edits of every family a page turn routed to — words (`{ handle, value }`),
881
+ * styles (`{ handle, style }`), schemes (`{ handle, scheme }`), size steps (`{ handle, axis, step }`) — applied in that
882
+ * order on a copy, all or none. The server
855
883
  * checks each family as it is asked; the builder's trial applies the turn's edits through this, so both read one rule.
856
884
  */
857
- type PageEdit = WordEdit | StyleEdit | SchemeEdit;
885
+ type PageEdit = WordEdit | StyleEdit | SchemeEdit | SizeEdit;
858
886
  type PageChange = WordChange | StyleChange;
859
887
  interface PageEditContext extends Omit<WordEditContext, 'handles' | 'never'> {
860
888
  readonly summary: Pick<SummarizedPage, 'handles' | 'looks'> & {
@@ -924,7 +952,7 @@ interface AssistTurnRequest {
924
952
  };
925
953
  }
926
954
  /** 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`). */
927
- type AssistEdit = FieldEdit | WordEdit | StyleEdit | SchemeEdit;
955
+ type AssistEdit = FieldEdit | WordEdit | StyleEdit | SchemeEdit | SizeEdit;
928
956
  /** What a turn changed, as the card says it. */
929
957
  type AssistChange = FieldChange | WordChange | StyleChange;
930
958
  /** POST's 202 answer. */
@@ -1037,5 +1065,5 @@ declare function turnLocale(sentence: string, fields: ReadonlyArray<AssistField>
1037
1065
  /** The language's own name in the admin's language (`en` → "English" / "אנגלית"). */
1038
1066
  declare const languageName: (locale: string, uiLang: string) => string;
1039
1067
 
1040
- export { AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, 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, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, StyleAnswerKey, SurfaceStatus, WORDS_PER_PART, WordsAnswerKey, applyFieldEdits, applyPageEdits, applyStyleEdits, applyWordEdits, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeStyleAnswers, decodeWordsAnswers, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, isEmptyFieldValue, isPlainRecord, isSchemeEdit, isSessionOf, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookNames, memoryLine, namedLocale, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, serializedBaselineStyles, sessionMemory, styleJsonSchema, summarizeItem, summarizePage, surfacePermissions, surfaceSpec, titleField, turnLocale, unknownHandles, validateTurnRequest, wordsJsonSchema };
1041
- 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, LookMap, LookTarget, NeverWrite, PageAround, PageBrief, PageBriefContext, PageChange, PageEdit, PageEditContext, PageEditsOutcome, PageFocus, PageLook, PagePart, PageSectionSummary, PageSuggestion, SchemeEdit, StyleChange, StyleEdit, StyleEditContext, StyleEditsOutcome, StyleSchemas, SummarizedItem, SummarizedPage, SurfaceSpec, WalkedLook, WordChange, WordEdit, WordEditContext, WordEditsOutcome, WordsSchemas, WrittenWords };
1068
+ export { AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, 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, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, StyleAnswerKey, SurfaceStatus, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, applyFieldEdits, applyPageEdits, applyStyleEdits, applyWordEdits, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeStyleAnswers, decodeWordsAnswers, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, isEmptyFieldValue, isPlainRecord, isSchemeEdit, isSessionOf, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookNames, memoryLine, namedLocale, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, serializedBaselineStyles, sessionMemory, styleJsonSchema, summarizeItem, summarizePage, surfacePermissions, surfaceSpec, titleField, turnLocale, unknownHandles, validateTurnRequest, wordsJsonSchema };
1069
+ 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, SizeEdit, StyleChange, StyleEdit, StyleEditContext, StyleEditsOutcome, StyleSchemas, SummarizedItem, SummarizedPage, SurfaceSpec, WalkedLook, WordChange, WordEdit, WordEditContext, WordEditsOutcome, WordsSchemas, WrittenWords };
@@ -1,4 +1,4 @@
1
- import { AiStep, STRICT_SCHEMA_BUDGET, strictSchemaComplexity, jsonText, jsonListOf, jsonOneOf, jsonClosedObject, jsonAnyOf, PlanWordIssueCode, factIssues, NODE_BASELINES, walkSerialized } from '@vectoriox/iox-ui/generation-core';
1
+ import { AiStep, STRICT_SCHEMA_BUDGET, strictSchemaComplexity, jsonText, jsonListOf, jsonOneOf, jsonClosedObject, jsonAnyOf, PlanWordIssueCode, factIssues, walkSerialized, AdjustKind, AdjustAxis, adjustStepOf, ADJUST_STEPS, NODE_BASELINES, adjustStyleProps, ADJUST_AXIS_LABELS, adjustStepLabel } from '@vectoriox/iox-ui/generation-core';
2
2
  import { elementStylesFor, colorSchemeOf, ColorScheme, COLOR_SCHEME_TYPES, elementStyleById, COLOR_SCHEMES, NEW_NODE_STYLE_DEFAULTS, setColorScheme, switchElementStyle } from '@vectoriox/iox-ui/design-core';
3
3
 
4
4
  /**
@@ -1021,6 +1021,9 @@ const languageName = (locale, uiLang) => displayName(locale, uiLang) ?? locale;
1021
1021
  * copy) and in the builder (the trial): `pageLooks` (the targets and their handles), `styleJsonSchema`,
1022
1022
  * `decodeStyleAnswers`, `applyStyleEdits` — design-core's `switchElementStyle` (the author's own changes are kept) and
1023
1023
  * `setColorScheme` (the ONE scheme writer), all or none.
1024
+ *
1025
+ * AI2c adds SIZE STEPS to the same family: a section's height and spacing, a card's or panel's padding, where words sit
1026
+ * — each a row of generation-core `ADJUSTMENTS` (the only place their values come from), never a number the model wrote.
1024
1027
  */
1025
1028
  /**
1026
1029
  * The styles an owner may swap between by asking — each set is ONE kind of thing (a button, a heading, words, a box, a
@@ -1042,6 +1045,35 @@ const SURFACE_STYLES = new Set(['section', 'card', 'panel']);
1042
1045
  const paintsGround = (style) => SURFACE_STYLES.has(style ?? '');
1043
1046
  /** A Text wearing this is a ButtonBlock's words: the button is the style target. */
1044
1047
  const BUTTON_LABEL_STYLE$1 = 'button-label';
1048
+ /** The words types whose line alignment may be asked for (a button's or a link's words sit as their button does). */
1049
+ const ALIGNABLE_TYPES = new Set(['Heading', 'Text']);
1050
+ /** Boxes whose padding is a framed box's (`--iox-space-pad`). */
1051
+ const PADDED_STYLES = new Set(['card', 'panel']);
1052
+ /** A Scene, or a section holding a pinned (sticky) part, owns its height — it plays over the scroll it is given. */
1053
+ function ownsItsHeight(root) {
1054
+ let owns = false;
1055
+ walkSerialized([root], n => { if (n.role === 'scene' || n.styleProps?.['position'] === 'sticky')
1056
+ owns = true; });
1057
+ return owns;
1058
+ }
1059
+ /**
1060
+ * The size axes a node may be stepped on, and which kind each acts as (AI2c): a section root its height and rhythm, a
1061
+ * card or panel its padding, a heading or text its alignment. A node that is none of these takes no step.
1062
+ */
1063
+ function adjustAxesOf(node, isRoot, carriesWords) {
1064
+ const axes = {};
1065
+ if (isRoot) {
1066
+ if (!ownsItsHeight(node))
1067
+ axes[AdjustAxis.Height] = AdjustKind.Section;
1068
+ axes[AdjustAxis.Spacing] = AdjustKind.Section;
1069
+ }
1070
+ else if (PADDED_STYLES.has(node.elementStyle ?? '')) {
1071
+ axes[AdjustAxis.Spacing] = AdjustKind.Box;
1072
+ }
1073
+ if (carriesWords && ALIGNABLE_TYPES.has(node.type) && node.elementStyle !== BUTTON_LABEL_STYLE$1)
1074
+ axes[AdjustAxis.Align] = AdjustKind.Words;
1075
+ return axes;
1076
+ }
1045
1077
  /** The styles a node may take by asking — its own among them — or [] when it is not a target. */
1046
1078
  function askableStyles(node) {
1047
1079
  const current = node.elementStyle;
@@ -1073,7 +1105,9 @@ function pageLooks(layout, wordHandles, selectedId) {
1073
1105
  // TAKE such a style is offered one too; the check refuses the scheme unless the turn gives it that style.
1074
1106
  const takesScheme = COLOR_SCHEME_TYPES.includes(node.type) && !isRecipePart(node)
1075
1107
  && (paintsGround(node.elementStyle) || scheme !== ColorScheme.Default || (takesStyle && styles.some(paintsGround)));
1076
- if (takesStyle || takesScheme) {
1108
+ const axes = adjustAxesOf(node, isRoot, wordHandles.has(node.id));
1109
+ const sized = Object.entries(axes);
1110
+ if (takesStyle || takesScheme || sized.length) {
1077
1111
  const handle = lookHandle(node, index, isRoot, wordHandles, () => ++boxes);
1078
1112
  if (handle) {
1079
1113
  out.push({
@@ -1082,8 +1116,9 @@ function pageLooks(layout, wordHandles, selectedId) {
1082
1116
  label: lookLabel(handle, root, index),
1083
1117
  ...(takesStyle ? { style: node.elementStyle, styles } : {}),
1084
1118
  ...(takesScheme ? { scheme } : {}),
1119
+ ...(sized.length ? { sizes: Object.fromEntries(sized.map(([axis, kind]) => [axis, adjustStepOf(axis, kind, node.styleProps)])) } : {}),
1085
1120
  },
1086
- section: index, nodeId: node.id, type: node.type, lineage: here,
1121
+ axes, section: index, nodeId: node.id, type: node.type, lineage: here,
1087
1122
  });
1088
1123
  }
1089
1124
  }
@@ -1132,6 +1167,7 @@ var StyleAnswerKey;
1132
1167
  (function (StyleAnswerKey) {
1133
1168
  StyleAnswerKey["Styles"] = "styles";
1134
1169
  StyleAnswerKey["Schemes"] = "schemes";
1170
+ StyleAnswerKey["Sizes"] = "sizes";
1135
1171
  StyleAnswerKey["Note"] = "note";
1136
1172
  })(StyleAnswerKey || (StyleAnswerKey = {}));
1137
1173
  /**
@@ -1143,7 +1179,8 @@ var StyleAnswerKey;
1143
1179
  function styleJsonSchema(looks) {
1144
1180
  const styled = Object.entries(looks).filter(([, t]) => t.styles.length);
1145
1181
  const schemed = Object.entries(looks).filter(([, t]) => t.scheme);
1146
- if (!styled.length && !schemed.length)
1182
+ const sized = Object.entries(looks).filter(([, t]) => Object.keys(t.sizes ?? {}).length);
1183
+ if (!styled.length && !schemed.length && !sized.length)
1147
1184
  return { parts: [], handles: [] };
1148
1185
  const properties = {};
1149
1186
  if (styled.length) {
@@ -1165,10 +1202,21 @@ function styleJsonSchema(looks) {
1165
1202
  description: 'A section or box taking another colour scheme; [] changes no colours.',
1166
1203
  };
1167
1204
  }
1205
+ if (sized.length) {
1206
+ const axes = [...new Set(sized.flatMap(([, t]) => Object.keys(t.sizes ?? {})))];
1207
+ properties[StyleAnswerKey.Sizes] = {
1208
+ ...jsonListOf(jsonClosedObject({
1209
+ handle: jsonOneOf(sized.map(([h]) => h)),
1210
+ axis: jsonOneOf(axes),
1211
+ step: jsonOneOf([...new Set(axes.flatMap(a => ADJUST_STEPS[a].map(s => s.id)))]),
1212
+ }, ['handle', 'axis', 'step'])),
1213
+ description: 'An element stepped on one of the size axes the focus lists for it; [] changes no size.',
1214
+ };
1215
+ }
1168
1216
  properties[StyleAnswerKey.Note] = { ...jsonText(), description: 'One short line for the owner on what changed, or what needs them.' };
1169
1217
  const part = jsonClosedObject(properties, Object.keys(properties));
1170
1218
  assertAssistBudget('style', [part]);
1171
- return { parts: [part], handles: [[...new Set([...styled, ...schemed].map(([h]) => h))]] };
1219
+ return { parts: [part], handles: [[...new Set([...styled, ...schemed, ...sized].map(([h]) => h))]] };
1172
1220
  }
1173
1221
  const listOf = (answer, key) => {
1174
1222
  const list = answer && typeof answer === 'object' ? answer[key] : undefined;
@@ -1179,16 +1227,19 @@ function decodeStyleAnswers(answers) {
1179
1227
  return answers.flatMap(answer => [
1180
1228
  ...listOf(answer, StyleAnswerKey.Styles).map(x => ({ handle: String(x['handle'] ?? ''), style: String(x['style'] ?? '') })),
1181
1229
  ...listOf(answer, StyleAnswerKey.Schemes).map(x => ({ handle: String(x['handle'] ?? ''), scheme: String(x['scheme'] ?? '') })),
1230
+ ...listOf(answer, StyleAnswerKey.Sizes).map(x => ({ handle: String(x['handle'] ?? ''), axis: String(x['axis'] ?? ''), step: String(x['step'] ?? '') })),
1182
1231
  ]);
1183
1232
  }
1184
1233
  const isStyleEdit = (e) => typeof e.style === 'string';
1185
1234
  const isSchemeEdit = (e) => typeof e.scheme === 'string';
1235
+ const isSizeEdit = (e) => typeof e.axis === 'string' && typeof e.step === 'string';
1186
1236
  /** Which kind of change a change card shows. */
1187
1237
  var PageChangeOp;
1188
1238
  (function (PageChangeOp) {
1189
1239
  PageChangeOp["Words"] = "words";
1190
1240
  PageChangeOp["Style"] = "style";
1191
1241
  PageChangeOp["Scheme"] = "scheme";
1242
+ PageChangeOp["Size"] = "size";
1192
1243
  })(PageChangeOp || (PageChangeOp = {}));
1193
1244
  /** The serialized baseline: the type's constructor values, its text colour released as a new node's is (generation-core `createSerializedNode`). */
1194
1245
  const serializedBaselineStyles = type => {
@@ -1213,14 +1264,18 @@ function applyStyleEdits(layout, edits, ctx) {
1213
1264
  const issues = [];
1214
1265
  const changes = [];
1215
1266
  const seen = new Set();
1216
- // Styles first: a scheme may need the style the same turn gives its node (a plain box made a panel, then darkened).
1217
- const ordered = [...edits.filter(e => !isSchemeEdit(e)), ...edits.filter(isSchemeEdit)];
1267
+ // Styles first: a scheme may need the style the same turn gives its node (a plain box made a panel, then darkened);
1268
+ // size steps last, over what the style switch released.
1269
+ const ordered = [
1270
+ ...edits.filter(e => !isSchemeEdit(e) && !isSizeEdit(e)), ...edits.filter(isSchemeEdit), ...edits.filter(isSizeEdit),
1271
+ ];
1218
1272
  for (const edit of ordered) {
1219
1273
  const scheme = isSchemeEdit(edit);
1220
- const key = `${scheme ? 'scheme' : 'style'}:${edit.handle}`;
1274
+ const size = isSizeEdit(edit);
1275
+ const key = size ? `size:${edit.handle}:${edit.axis}` : `${scheme ? 'scheme' : 'style'}:${edit.handle}`;
1221
1276
  const refuse = (code, message) => issues.push({ code, handle: edit.handle, message });
1222
1277
  if (seen.has(key)) {
1223
- refuse(AssistIssueCode.Duplicate, `"${edit.handle}" is given two ${scheme ? 'schemes' : 'styles'}`);
1278
+ refuse(AssistIssueCode.Duplicate, `"${edit.handle}" is given two ${size ? `${edit.axis} steps` : scheme ? 'schemes' : 'styles'}`);
1224
1279
  continue;
1225
1280
  }
1226
1281
  seen.add(key);
@@ -1230,6 +1285,29 @@ function applyStyleEdits(layout, edits, ctx) {
1230
1285
  refuse(AssistIssueCode.UnknownHandle, `"${edit.handle}" is not an element of the focus`);
1231
1286
  continue;
1232
1287
  }
1288
+ if (size) {
1289
+ const axis = edit.axis;
1290
+ const kind = Object.prototype.hasOwnProperty.call(target.sizes ?? {}, axis) ? target.sizes[axis] : undefined;
1291
+ if (!kind) {
1292
+ const takes = Object.keys(target.sizes ?? {});
1293
+ refuse(AssistIssueCode.NotAnOption, `${target.label} takes no ${edit.axis} step${takes.length ? ` — only ${takes.join(', ')}` : ''}`);
1294
+ continue;
1295
+ }
1296
+ const props = adjustStyleProps(axis, kind, edit.step, node.styleProps);
1297
+ if (!props) {
1298
+ refuse(AssistIssueCode.NotAnOption, `${ADJUST_AXIS_LABELS[axis].toLowerCase()} takes ${ADJUST_STEPS[axis].map(s => `"${s.id}"`).join(', ')} — not "${edit.step}"`);
1299
+ continue;
1300
+ }
1301
+ const from = adjustStepOf(axis, kind, node.styleProps);
1302
+ if (from === edit.step)
1303
+ continue;
1304
+ node.styleProps = { ...(node.styleProps ?? {}), ...props };
1305
+ changes.push({
1306
+ op: PageChangeOp.Size, axis, handle: edit.handle, nodeId: node.id, label: `${target.label} · ${ADJUST_AXIS_LABELS[axis].toLowerCase()}`,
1307
+ from, to: edit.step, before: adjustStepLabel(axis, from), after: adjustStepLabel(axis, edit.step),
1308
+ });
1309
+ continue;
1310
+ }
1233
1311
  if (scheme) {
1234
1312
  const to = edit.scheme;
1235
1313
  if (!target.scheme) {
@@ -1424,6 +1502,7 @@ function summarizePage(layout, ctx) {
1424
1502
  const focusLooks = walkedLooks.filter(lookInFocus);
1425
1503
  const looks = Object.fromEntries(focusLooks.map(l => [l.look.handle, {
1426
1504
  id: l.nodeId, type: l.type, label: l.look.label, styles: [...(l.look.styles ?? [])], scheme: l.look.scheme !== undefined,
1505
+ ...(Object.keys(l.axes).length ? { sizes: { ...l.axes } } : {}),
1427
1506
  }]));
1428
1507
  for (const l of walkedLooks)
1429
1508
  nodes[l.look.handle] ??= l.nodeId;
@@ -1664,7 +1743,7 @@ function applyPageEdits(layout, edits, ctx) {
1664
1743
  const words = applyWordEdits(layout, edits.filter(isWordEdit), {
1665
1744
  handles: ctx.summary.handles, never: ctx.summary.brief.rules.never, sentence: ctx.sentence, words: ctx.words,
1666
1745
  });
1667
- const looks = edits.filter((e) => !isWordEdit(e) && (isStyleEdit(e) || isSchemeEdit(e)));
1746
+ const looks = edits.filter((e) => !isWordEdit(e) && (isStyleEdit(e) || isSchemeEdit(e) || isSizeEdit(e)));
1668
1747
  const style = applyStyleEdits(words.result, looks, { looks: ctx.summary.looks, baseline: ctx.baseline });
1669
1748
  const issues = [...words.issues, ...style.issues];
1670
1749
  if (issues.length)
@@ -1692,7 +1771,7 @@ const isTerminalTurn = (status) => TERMINAL.has(status);
1692
1771
  const ASSIST_MODEL_AUTO = 'auto';
1693
1772
  const ASSIST_POLL_MS = 750;
1694
1773
  const MAX_SENTENCE_CHARS = 2000;
1695
- const isLookChange = (c) => 'op' in c && (c.op === PageChangeOp.Style || c.op === PageChangeOp.Scheme);
1774
+ const isLookChange = (c) => 'op' in c && (c.op === PageChangeOp.Style || c.op === PageChangeOp.Scheme || c.op === PageChangeOp.Size);
1696
1775
  /** A turn's own refusals and failures, beside generation-core's `AiRefusalCode`s (credits, plan, key), which a turn returns as they are. */
1697
1776
  var AssistRefusalCode;
1698
1777
  (function (AssistRefusalCode) {
@@ -1840,5 +1919,5 @@ function validateTurnRequest(req) {
1840
1919
  * Generated bundle index. Do not edit.
1841
1920
  */
1842
1921
 
1843
- export { AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, 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, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, StyleAnswerKey, SurfaceStatus, WORDS_PER_PART, WordsAnswerKey, applyFieldEdits, applyPageEdits, applyStyleEdits, applyWordEdits, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeStyleAnswers, decodeWordsAnswers, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, isEmptyFieldValue, isPlainRecord, isSchemeEdit, isSessionOf, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookNames, memoryLine, namedLocale, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, serializedBaselineStyles, sessionMemory, styleJsonSchema, summarizeItem, summarizePage, surfacePermissions, surfaceSpec, titleField, turnLocale, unknownHandles, validateTurnRequest, wordsJsonSchema };
1922
+ export { AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, 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, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, StyleAnswerKey, SurfaceStatus, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, applyFieldEdits, applyPageEdits, applyStyleEdits, applyWordEdits, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeStyleAnswers, decodeWordsAnswers, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, isEmptyFieldValue, isPlainRecord, isSchemeEdit, isSessionOf, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookNames, memoryLine, namedLocale, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, serializedBaselineStyles, sessionMemory, styleJsonSchema, summarizeItem, summarizePage, surfacePermissions, surfaceSpec, titleField, turnLocale, unknownHandles, validateTurnRequest, wordsJsonSchema };
1844
1923
  //# sourceMappingURL=vectoriox-iox-ui-assist-core.mjs.map