@vectoriox/iox-ui 5.120.0 → 5.121.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/assist-core/index.d.ts +131 -13
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +381 -13
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assist-core/assist-turn.ts +5 -3
- package/src/assist-core/page-edits.ts +20 -11
- package/src/assist-core/page-sections.ts +371 -0
- package/src/assist-core/page-style.ts +1 -0
- package/src/assist-core/page-words.ts +16 -0
- package/src/assist-core/public-api.ts +1 -0
- package/src/assist-core/surfaces.ts +2 -2
package/assist-core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiStep, JsonSchema, PlanWordContext, AdjustAxis, AdjustKind, SerializedNode } from '@vectoriox/iox-ui/generation-core';
|
|
1
|
+
import { AiStep, JsonSchema, PlanWordContext, AdjustAxis, AdjustKind, SerializedNode, SectionInput } 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
|
|
@@ -644,7 +644,8 @@ declare enum PageChangeOp {
|
|
|
644
644
|
Words = "words",
|
|
645
645
|
Style = "style",
|
|
646
646
|
Scheme = "scheme",
|
|
647
|
-
Size = "size"
|
|
647
|
+
Size = "size",
|
|
648
|
+
Section = "section"
|
|
648
649
|
}
|
|
649
650
|
interface StyleChange {
|
|
650
651
|
readonly op: PageChangeOp.Style | PageChangeOp.Scheme | PageChangeOp.Size;
|
|
@@ -683,6 +684,113 @@ interface StyleEditsOutcome {
|
|
|
683
684
|
*/
|
|
684
685
|
declare function applyStyleEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<LookEdit>, ctx: StyleEditContext): StyleEditsOutcome;
|
|
685
686
|
|
|
687
|
+
/**
|
|
688
|
+
* Surface S1 (the builder, this page), family `sections` (ai-assist-plan AI2d; ai-session-panel-plan `addSection` /
|
|
689
|
+
* `removeSection` / `moveSection` / `swapPattern`): a section is added, removed, moved or swapped for another — and every
|
|
690
|
+
* section Ask adds is a library pattern stamped by generation-core's `composeSection`, the SAME recipe the builder palette's
|
|
691
|
+
* ready-made sections and the composer use (R-H9). The model names a pattern from a closed list and a place by handle;
|
|
692
|
+
* it never writes a node. The same pure functions run on the server (the check on a copy) and in the builder (the trial).
|
|
693
|
+
*/
|
|
694
|
+
/**
|
|
695
|
+
* The library patterns Ask may add or swap to — those `composeSection` stamps on their own with no Site Plan behind
|
|
696
|
+
* them. Not offered: headers and footers (globals), lists and products (they need a content source — a Pages & data
|
|
697
|
+
* change), Scenes and the owner's film (the look's motion decides them, and a page holds one).
|
|
698
|
+
*/
|
|
699
|
+
declare const ASK_SECTION_PATTERNS: ReadonlyArray<string>;
|
|
700
|
+
/** Where an added or moved section goes when it is first on the page. */
|
|
701
|
+
declare const SECTION_START = "start";
|
|
702
|
+
/** The library pattern a section root was stamped from, by its label (the composer names a root by its pattern). */
|
|
703
|
+
declare function sectionPatternOf(root: Pick<SerializedNode, 'label'>): string | undefined;
|
|
704
|
+
/** The patterns Ask offers, as the model and the owner read them: id → its name ("Hero — words centred"). */
|
|
705
|
+
declare function askSectionPatternNames(): Record<string, string>;
|
|
706
|
+
/** A section of the page the family may name: its root, its name, and whether it is in the focus (may be removed, moved, swapped). */
|
|
707
|
+
interface SectionTarget {
|
|
708
|
+
readonly id: string;
|
|
709
|
+
readonly label: string;
|
|
710
|
+
readonly focus: boolean;
|
|
711
|
+
}
|
|
712
|
+
/** Every section of the page by handle (`s0`…) — `after` may name any of them; only focus ones may be changed. */
|
|
713
|
+
type SectionMap = Readonly<Record<string, SectionTarget>>;
|
|
714
|
+
declare enum SectionsAnswerKey {
|
|
715
|
+
Add = "add",
|
|
716
|
+
Remove = "remove",
|
|
717
|
+
Move = "move",
|
|
718
|
+
Swap = "swap",
|
|
719
|
+
Note = "note"
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* The strict format of family `sections` — ONE request: `add [{pattern, after}]`, `remove [{handle}]`,
|
|
723
|
+
* `move [{handle, after}]`, `swap [{handle, pattern}]`, `note`. Handles are enums of the page's sections (the focus's for
|
|
724
|
+
* what may change), patterns an enum of {@link ASK_SECTION_PATTERNS}. Whether an op makes sense is the check's.
|
|
725
|
+
*/
|
|
726
|
+
declare function sectionsJsonSchema(sections: SectionMap): {
|
|
727
|
+
parts: JsonSchema[];
|
|
728
|
+
handles: string[][];
|
|
729
|
+
};
|
|
730
|
+
interface SectionAdd {
|
|
731
|
+
readonly add: string;
|
|
732
|
+
readonly after: string;
|
|
733
|
+
}
|
|
734
|
+
interface SectionRemove {
|
|
735
|
+
readonly remove: string;
|
|
736
|
+
}
|
|
737
|
+
interface SectionMove {
|
|
738
|
+
readonly move: string;
|
|
739
|
+
readonly after: string;
|
|
740
|
+
}
|
|
741
|
+
interface SectionSwap {
|
|
742
|
+
readonly swap: string;
|
|
743
|
+
readonly pattern: string;
|
|
744
|
+
}
|
|
745
|
+
/** Any edit of family `sections`. */
|
|
746
|
+
type SectionEdit = SectionAdd | SectionRemove | SectionMove | SectionSwap;
|
|
747
|
+
declare const isSectionEdit: (e: object) => e is SectionEdit;
|
|
748
|
+
/** The answer → the edits it makes. */
|
|
749
|
+
declare function decodeSectionsAnswers(answers: ReadonlyArray<unknown>): SectionEdit[];
|
|
750
|
+
declare enum SectionChangeKind {
|
|
751
|
+
Add = "add",
|
|
752
|
+
Remove = "remove",
|
|
753
|
+
Move = "move",
|
|
754
|
+
Swap = "swap"
|
|
755
|
+
}
|
|
756
|
+
interface SectionChange {
|
|
757
|
+
readonly op: PageChangeOp.Section;
|
|
758
|
+
readonly kind: SectionChangeKind;
|
|
759
|
+
/** The section's handle (`s2`), or `new` for one added. */
|
|
760
|
+
readonly handle: string;
|
|
761
|
+
/** The node the card outlines — the new root of an added or swapped section, the moved one; a removed one's id (gone). */
|
|
762
|
+
readonly nodeId: string;
|
|
763
|
+
readonly label: string;
|
|
764
|
+
/** The pattern added or swapped to. */
|
|
765
|
+
readonly pattern?: string;
|
|
766
|
+
/** Where it stood / stands, or what it was / is, as the owner reads it. */
|
|
767
|
+
readonly before: string;
|
|
768
|
+
readonly after: string;
|
|
769
|
+
/** A swap: the owner's words and pictures the new section had no place for (still in the old one — Discard keeps it). */
|
|
770
|
+
readonly notPlaced?: number;
|
|
771
|
+
}
|
|
772
|
+
interface SectionEditContext {
|
|
773
|
+
readonly sections: SectionMap;
|
|
774
|
+
/** The studio's name and pages, as the palette composes with (`composeSection`). */
|
|
775
|
+
readonly input?: SectionInput;
|
|
776
|
+
/** A fresh node id (the builder's); default a stable `ask-s<n>` no node of the page holds. */
|
|
777
|
+
readonly newId?: () => string;
|
|
778
|
+
}
|
|
779
|
+
interface SectionEditsOutcome {
|
|
780
|
+
readonly ok: boolean;
|
|
781
|
+
readonly result: SerializedNode[];
|
|
782
|
+
readonly changes: ReadonlyArray<SectionChange>;
|
|
783
|
+
readonly issues: ReadonlyArray<AssistIssue>;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Family `sections`, applied — the SAME check on the server and in the builder. All or none; never mutates its input.
|
|
787
|
+
* Swaps redraw in place, then removals, moves and additions, each placed by the ORIGINAL handles. Refused (re-asked once
|
|
788
|
+
* by the server, never repaired): a handle not on the page or not in the focus, a pattern not offered, a section given two
|
|
789
|
+
* changes, a place that is the section itself or one removed in the same answer, a swap of a section holding a form,
|
|
790
|
+
* content-bound words or a Scene.
|
|
791
|
+
*/
|
|
792
|
+
declare function applySectionEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<SectionEdit>, ctx: SectionEditContext): SectionEditsOutcome;
|
|
793
|
+
|
|
686
794
|
/**
|
|
687
795
|
* Surface S1 (the builder, this page), family `words` (ai-assist-plan §4, ai-session-panel-plan §3b–§3d): the page as
|
|
688
796
|
* the model sees it — sections in order, each a handle (`s0`), the parts that carry words as handles (`s0.heading1`,
|
|
@@ -738,6 +846,8 @@ interface PageSectionSummary {
|
|
|
738
846
|
readonly parts: ReadonlyArray<PagePart>;
|
|
739
847
|
/** Family `style`: the elements of the section that may take another element style, colour scheme or size step. */
|
|
740
848
|
readonly looks?: ReadonlyArray<PageLook>;
|
|
849
|
+
/** Family `sections`: the library pattern the section was stamped from, when it is one Ask offers. */
|
|
850
|
+
readonly pattern?: string;
|
|
741
851
|
}
|
|
742
852
|
interface PageFocus {
|
|
743
853
|
readonly scope: AssistScope;
|
|
@@ -753,6 +863,8 @@ interface PageFocus {
|
|
|
753
863
|
/** How the owner reads the style and scheme ids the looks name. */
|
|
754
864
|
readonly styleNames?: Readonly<Record<string, string>>;
|
|
755
865
|
readonly schemeNames?: Readonly<Record<string, string>>;
|
|
866
|
+
/** Family `sections`: the library sections Ask may add or swap to, by id → name. */
|
|
867
|
+
readonly sectionPatterns?: Readonly<Record<string, string>>;
|
|
756
868
|
}
|
|
757
869
|
interface PageAround {
|
|
758
870
|
/** The other sections, one line each. */
|
|
@@ -789,6 +901,8 @@ interface SummarizedPage {
|
|
|
789
901
|
readonly nodes: Readonly<Record<string, string>>;
|
|
790
902
|
/** Family `style`: the focus's targets — what a style request carries and the check may write. */
|
|
791
903
|
readonly looks: LookMap;
|
|
904
|
+
/** Family `sections`: every section of the page by handle; the focus's may be removed, moved or swapped. */
|
|
905
|
+
readonly sections: SectionMap;
|
|
792
906
|
}
|
|
793
907
|
/**
|
|
794
908
|
* The page as the model sees it. The selection decides the focus: a node → its section in full, its own parts as
|
|
@@ -877,15 +991,16 @@ declare function pageWriteLocale(layout: ReadonlyArray<SerializedNode>, ctx: {
|
|
|
877
991
|
}): string;
|
|
878
992
|
|
|
879
993
|
/**
|
|
880
|
-
* Surface S1's answer as ONE thing (AI2b
|
|
881
|
-
* styles (`{ handle, style }`), schemes (`{ handle, scheme }`), size steps (`{ handle, axis, step }`)
|
|
882
|
-
* order on a copy, all or none.
|
|
883
|
-
* checks each family as it is asked; the builder's trial
|
|
994
|
+
* Surface S1's answer as ONE thing (AI2b–AI2d): the edits of every family a page turn routed to — words (`{ handle, value }`),
|
|
995
|
+
* styles (`{ handle, style }`), schemes (`{ handle, scheme }`), size steps (`{ handle, axis, step }`), sections
|
|
996
|
+
* (`{ 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
|
|
998
|
+
* applies the turn's edits through this, so both read one rule.
|
|
884
999
|
*/
|
|
885
|
-
type PageEdit = WordEdit | StyleEdit | SchemeEdit | SizeEdit;
|
|
886
|
-
type PageChange = WordChange | StyleChange;
|
|
1000
|
+
type PageEdit = WordEdit | StyleEdit | SchemeEdit | SizeEdit | SectionEdit;
|
|
1001
|
+
type PageChange = WordChange | StyleChange | SectionChange;
|
|
887
1002
|
interface PageEditContext extends Omit<WordEditContext, 'handles' | 'never'> {
|
|
888
|
-
readonly summary: Pick<SummarizedPage, 'handles' | 'looks'> & {
|
|
1003
|
+
readonly summary: Pick<SummarizedPage, 'handles' | 'looks'> & Partial<Pick<SummarizedPage, 'sections'>> & {
|
|
889
1004
|
readonly brief: {
|
|
890
1005
|
readonly rules: {
|
|
891
1006
|
readonly never: WordEditContext['never'];
|
|
@@ -894,6 +1009,9 @@ interface PageEditContext extends Omit<WordEditContext, 'handles' | 'never'> {
|
|
|
894
1009
|
};
|
|
895
1010
|
/** The builder's registry baseline; default the saved shape's (`serializedBaselineStyles`). */
|
|
896
1011
|
readonly baseline?: BaselineStyles;
|
|
1012
|
+
/** Family `sections`: the studio's name and pages (what the palette composes with) and the builder's fresh ids. */
|
|
1013
|
+
readonly sectionInput?: SectionEditContext['input'];
|
|
1014
|
+
readonly newId?: SectionEditContext['newId'];
|
|
897
1015
|
}
|
|
898
1016
|
interface PageEditsOutcome {
|
|
899
1017
|
readonly ok: boolean;
|
|
@@ -952,9 +1070,9 @@ interface AssistTurnRequest {
|
|
|
952
1070
|
};
|
|
953
1071
|
}
|
|
954
1072
|
/** 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`). */
|
|
955
|
-
type AssistEdit = FieldEdit | WordEdit | StyleEdit | SchemeEdit | SizeEdit;
|
|
1073
|
+
type AssistEdit = FieldEdit | WordEdit | StyleEdit | SchemeEdit | SizeEdit | SectionEdit;
|
|
956
1074
|
/** What a turn changed, as the card says it. */
|
|
957
|
-
type AssistChange = FieldChange | WordChange | StyleChange;
|
|
1075
|
+
type AssistChange = FieldChange | WordChange | StyleChange | SectionChange;
|
|
958
1076
|
/** POST's 202 answer. */
|
|
959
1077
|
interface AssistTurnAccepted {
|
|
960
1078
|
readonly turnId: string;
|
|
@@ -1065,5 +1183,5 @@ declare function turnLocale(sentence: string, fields: ReadonlyArray<AssistField>
|
|
|
1065
1183
|
/** The language's own name in the admin's language (`en` → "English" / "אנגלית"). */
|
|
1066
1184
|
declare const languageName: (locale: string, uiLang: string) => string;
|
|
1067
1185
|
|
|
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 };
|
|
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 };
|