@vectoriox/iox-ui 5.116.0 → 5.118.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 +169 -5
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +309 -14
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +19 -7
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/generation-core/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/assist-core/assist-turn.ts +7 -4
- package/src/assist-core/page-edits.ts +39 -0
- package/src/assist-core/page-style.ts +346 -0
- package/src/assist-core/page-words.ts +37 -9
- package/src/assist-core/public-api.ts +5 -2
- package/src/assist-core/surfaces.ts +1 -1
- package/src/generation-core/compose-site.ts +1 -1
- package/src/generation-core/footer-mix.ts +21 -6
package/assist-core/index.d.ts
CHANGED
|
@@ -527,6 +527,135 @@ interface FieldEditsOutcome {
|
|
|
527
527
|
declare function fieldsNamedIn(sentence: string, fields: ReadonlyArray<AssistField>): string[];
|
|
528
528
|
declare function applyFieldEdits(values: ContentRecord, edits: ReadonlyArray<FieldEdit>, ctx: FieldEditContext): FieldEditsOutcome;
|
|
529
529
|
|
|
530
|
+
/**
|
|
531
|
+
* Surface S1 (the builder, this page), family `style` (ai-assist-plan §4, AI2b; ai-session-panel-plan `setStyle` /
|
|
532
|
+
* `setScheme`): an element takes ANOTHER of the look's element styles, a section (or a box) another colour scheme — never
|
|
533
|
+
* a CSS value, a colour or a size. What a node may take is a closed list: the other members of the swap set its current
|
|
534
|
+
* style is in that its type may wear ({@link ASK_STYLE_SETS}). The SAME pure functions run on the server (the check on a
|
|
535
|
+
* copy) and in the builder (the trial): `pageLooks` (the targets and their handles), `styleJsonSchema`,
|
|
536
|
+
* `decodeStyleAnswers`, `applyStyleEdits` — design-core's `switchElementStyle` (the author's own changes are kept) and
|
|
537
|
+
* `setColorScheme` (the ONE scheme writer), all or none.
|
|
538
|
+
*/
|
|
539
|
+
/**
|
|
540
|
+
* The styles an owner may swap between by asking — each set is ONE kind of thing (a button, a heading, words, a box, a
|
|
541
|
+
* badge). Every other element style (a tab, an accordion part, a cart button, the navigation bar) belongs to the recipe
|
|
542
|
+
* that stamped it and is never offered. A node wearing a style is offered the union of the sets that style is in, kept
|
|
543
|
+
* to the styles its type may wear (design-core `elementStylesFor`).
|
|
544
|
+
*/
|
|
545
|
+
declare const ASK_STYLE_SETS: ReadonlyArray<ReadonlyArray<string>>;
|
|
546
|
+
/** The styles a node may take by asking — its own among them — or [] when it is not a target. */
|
|
547
|
+
declare function askableStyles(node: Pick<SerializedNode, 'type' | 'elementStyle'>): string[];
|
|
548
|
+
/** A target of family `style` — what the brief says, and what the check needs (the node id is never sent). */
|
|
549
|
+
interface PageLook {
|
|
550
|
+
readonly handle: string;
|
|
551
|
+
/** "Hero" (a section root), "Box 2", "Heading 1" — how the change card names it. */
|
|
552
|
+
readonly label: string;
|
|
553
|
+
/** The element style it wears, and the styles it may take (its own among them); absent when only its scheme is offered. */
|
|
554
|
+
readonly style?: string;
|
|
555
|
+
readonly styles?: ReadonlyArray<string>;
|
|
556
|
+
/** Its colour scheme, when it takes one. */
|
|
557
|
+
readonly scheme?: string;
|
|
558
|
+
}
|
|
559
|
+
interface WalkedLook {
|
|
560
|
+
readonly look: PageLook;
|
|
561
|
+
readonly section: number;
|
|
562
|
+
readonly nodeId: string;
|
|
563
|
+
readonly type: string;
|
|
564
|
+
readonly lineage: ReadonlyArray<string>;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Every style / scheme target of the page in reading order. A node that carries words keeps its words handle
|
|
568
|
+
* (`wordHandles`: node id → `s0.heading1`); a ButtonBlock is named by its words' handle (`s0.button1`); a section root is
|
|
569
|
+
* `s{i}`; any other box is `s{i}.box{n}`. `selectedId` lets a plain box that is the selection be a target.
|
|
570
|
+
*/
|
|
571
|
+
declare function pageLooks(layout: ReadonlyArray<SerializedNode>, wordHandles: ReadonlyMap<string, string>, selectedId?: string | null): WalkedLook[];
|
|
572
|
+
/** "Hero · ground" → "Hero"; a composed section's id label ("hero-1") reads as words; else "Section 3". */
|
|
573
|
+
declare function sectionLabel(node: SerializedNode, index: number): string;
|
|
574
|
+
/** The labels of the styles and schemes a brief mentions — the model reads ids, the owner reads these. */
|
|
575
|
+
declare function lookNames(looks: ReadonlyArray<PageLook>): {
|
|
576
|
+
styles: Record<string, string>;
|
|
577
|
+
schemes: Record<string, string>;
|
|
578
|
+
};
|
|
579
|
+
/** A focus target the check may write: its node and what it takes. */
|
|
580
|
+
interface LookTarget {
|
|
581
|
+
readonly id: string;
|
|
582
|
+
readonly type: string;
|
|
583
|
+
readonly label: string;
|
|
584
|
+
readonly styles: ReadonlyArray<string>;
|
|
585
|
+
readonly scheme: boolean;
|
|
586
|
+
}
|
|
587
|
+
type LookMap = Readonly<Record<string, LookTarget>>;
|
|
588
|
+
declare enum StyleAnswerKey {
|
|
589
|
+
Styles = "styles",
|
|
590
|
+
Schemes = "schemes",
|
|
591
|
+
Note = "note"
|
|
592
|
+
}
|
|
593
|
+
interface StyleSchemas {
|
|
594
|
+
readonly parts: JsonSchema[];
|
|
595
|
+
readonly handles: string[][];
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* The strict format of family `style` for the focus — ONE request: a list of `{ handle, style }` and a list of
|
|
599
|
+
* `{ handle, scheme }`, each handle an enum of the focus's targets ([] leaves everything as it is). A list whose enum
|
|
600
|
+
* would be empty is left out. The pairing (does THIS handle take THAT style) is the check's, so the format stays small
|
|
601
|
+
* whatever the page holds.
|
|
602
|
+
*/
|
|
603
|
+
declare function styleJsonSchema(looks: LookMap): StyleSchemas;
|
|
604
|
+
/** An element taking another element style. */
|
|
605
|
+
interface StyleEdit {
|
|
606
|
+
readonly handle: string;
|
|
607
|
+
readonly style: string;
|
|
608
|
+
}
|
|
609
|
+
/** A section or box taking another colour scheme. */
|
|
610
|
+
interface SchemeEdit {
|
|
611
|
+
readonly handle: string;
|
|
612
|
+
readonly scheme: string;
|
|
613
|
+
}
|
|
614
|
+
/** The answer → the edits it makes. */
|
|
615
|
+
declare function decodeStyleAnswers(answers: ReadonlyArray<unknown>): Array<StyleEdit | SchemeEdit>;
|
|
616
|
+
declare const isStyleEdit: (e: object) => e is StyleEdit;
|
|
617
|
+
declare const isSchemeEdit: (e: object) => e is SchemeEdit;
|
|
618
|
+
/** Which kind of change a change card shows. */
|
|
619
|
+
declare enum PageChangeOp {
|
|
620
|
+
Words = "words",
|
|
621
|
+
Style = "style",
|
|
622
|
+
Scheme = "scheme"
|
|
623
|
+
}
|
|
624
|
+
interface StyleChange {
|
|
625
|
+
readonly op: PageChangeOp.Style | PageChangeOp.Scheme;
|
|
626
|
+
readonly handle: string;
|
|
627
|
+
readonly nodeId: string;
|
|
628
|
+
readonly label: string;
|
|
629
|
+
/** The style / scheme ids, and how the owner reads them. */
|
|
630
|
+
readonly from: string;
|
|
631
|
+
readonly to: string;
|
|
632
|
+
readonly before: string;
|
|
633
|
+
readonly after: string;
|
|
634
|
+
/** Values the author had set by hand on it, kept (`switchElementStyle`). */
|
|
635
|
+
readonly keptOwn?: number;
|
|
636
|
+
}
|
|
637
|
+
/** A type's unstyled values (what a released trait goes back to) — the builder passes its registry's; this is the saved shape's. */
|
|
638
|
+
type BaselineStyles = (type: string) => Readonly<Record<string, unknown>>;
|
|
639
|
+
/** The serialized baseline: the type's constructor values, its text colour released as a new node's is (generation-core `createSerializedNode`). */
|
|
640
|
+
declare const serializedBaselineStyles: BaselineStyles;
|
|
641
|
+
interface StyleEditContext {
|
|
642
|
+
/** The focus's targets (`summarizePage(…).looks`). */
|
|
643
|
+
readonly looks: LookMap;
|
|
644
|
+
readonly baseline?: BaselineStyles;
|
|
645
|
+
}
|
|
646
|
+
interface StyleEditsOutcome {
|
|
647
|
+
readonly ok: boolean;
|
|
648
|
+
readonly result: SerializedNode[];
|
|
649
|
+
readonly changes: ReadonlyArray<StyleChange>;
|
|
650
|
+
readonly issues: ReadonlyArray<AssistIssue>;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Family `style`, applied — the SAME check on the server and in the builder. All or none; never mutates its input. A
|
|
654
|
+
* 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
|
+
* once by the server, never repaired here); an edit that changes nothing is dropped.
|
|
656
|
+
*/
|
|
657
|
+
declare function applyStyleEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<StyleEdit | SchemeEdit>, ctx: StyleEditContext): StyleEditsOutcome;
|
|
658
|
+
|
|
530
659
|
/**
|
|
531
660
|
* Surface S1 (the builder, this page), family `words` (ai-assist-plan §4, ai-session-panel-plan §3b–§3d): the page as
|
|
532
661
|
* the model sees it — sections in order, each a handle (`s0`), the parts that carry words as handles (`s0.heading1`,
|
|
@@ -580,6 +709,8 @@ interface PageSectionSummary {
|
|
|
580
709
|
/** The section's own name ("Hero", "Our work") or "Section 3". */
|
|
581
710
|
readonly label: string;
|
|
582
711
|
readonly parts: ReadonlyArray<PagePart>;
|
|
712
|
+
/** Family `style`: the elements of the section that may take another element style or colour scheme. */
|
|
713
|
+
readonly looks?: ReadonlyArray<PageLook>;
|
|
583
714
|
}
|
|
584
715
|
interface PageFocus {
|
|
585
716
|
readonly scope: AssistScope;
|
|
@@ -592,6 +723,9 @@ interface PageFocus {
|
|
|
592
723
|
readonly selected: ReadonlyArray<string>;
|
|
593
724
|
/** The selection as the owner sees it ("Hero ▸ Heading 1"). */
|
|
594
725
|
readonly selectedLabel?: string;
|
|
726
|
+
/** How the owner reads the style and scheme ids the looks name. */
|
|
727
|
+
readonly styleNames?: Readonly<Record<string, string>>;
|
|
728
|
+
readonly schemeNames?: Readonly<Record<string, string>>;
|
|
595
729
|
}
|
|
596
730
|
interface PageAround {
|
|
597
731
|
/** The other sections, one line each. */
|
|
@@ -626,6 +760,8 @@ interface SummarizedPage {
|
|
|
626
760
|
readonly focusHandles: ReadonlyArray<string>;
|
|
627
761
|
/** Every part of the page with its node id (for the client to outline a change) — never sent. */
|
|
628
762
|
readonly nodes: Readonly<Record<string, string>>;
|
|
763
|
+
/** Family `style`: the focus's targets — what a style request carries and the check may write. */
|
|
764
|
+
readonly looks: LookMap;
|
|
629
765
|
}
|
|
630
766
|
/**
|
|
631
767
|
* The page as the model sees it. The selection decides the focus: a node → its section in full, its own parts as
|
|
@@ -652,6 +788,8 @@ interface WordEdit {
|
|
|
652
788
|
/** The parts' answers → the edits they make (every leave value dropped). */
|
|
653
789
|
declare function decodeWordsAnswers(answers: ReadonlyArray<unknown>): WordEdit[];
|
|
654
790
|
interface WordChange {
|
|
791
|
+
/** Absent on a turn stored before AI2b — a words change. */
|
|
792
|
+
readonly op?: PageChangeOp.Words;
|
|
655
793
|
readonly handle: string;
|
|
656
794
|
/** The node the change is on — the builder outlines it; never sent to the model. */
|
|
657
795
|
readonly nodeId: string;
|
|
@@ -711,6 +849,32 @@ declare function pageWriteLocale(layout: ReadonlyArray<SerializedNode>, ctx: {
|
|
|
711
849
|
readonly uiLang: string;
|
|
712
850
|
}): string;
|
|
713
851
|
|
|
852
|
+
/**
|
|
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
|
|
855
|
+
* checks each family as it is asked; the builder's trial applies the turn's edits through this, so both read one rule.
|
|
856
|
+
*/
|
|
857
|
+
type PageEdit = WordEdit | StyleEdit | SchemeEdit;
|
|
858
|
+
type PageChange = WordChange | StyleChange;
|
|
859
|
+
interface PageEditContext extends Omit<WordEditContext, 'handles' | 'never'> {
|
|
860
|
+
readonly summary: Pick<SummarizedPage, 'handles' | 'looks'> & {
|
|
861
|
+
readonly brief: {
|
|
862
|
+
readonly rules: {
|
|
863
|
+
readonly never: WordEditContext['never'];
|
|
864
|
+
};
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
/** The builder's registry baseline; default the saved shape's (`serializedBaselineStyles`). */
|
|
868
|
+
readonly baseline?: BaselineStyles;
|
|
869
|
+
}
|
|
870
|
+
interface PageEditsOutcome {
|
|
871
|
+
readonly ok: boolean;
|
|
872
|
+
readonly result: SerializedNode[];
|
|
873
|
+
readonly changes: ReadonlyArray<PageChange>;
|
|
874
|
+
readonly issues: ReadonlyArray<AssistIssue>;
|
|
875
|
+
}
|
|
876
|
+
declare function applyPageEdits(layout: ReadonlyArray<SerializedNode>, edits: ReadonlyArray<PageEdit>, ctx: PageEditContext): PageEditsOutcome;
|
|
877
|
+
|
|
714
878
|
/**
|
|
715
879
|
* The turn wire (plan §3d) — what cms-client posts and polls and iox-cms stores and answers, ONE definition both sides
|
|
716
880
|
* import (generation-core `ai-run.ts` is the precedent for generations). A turn is a document on the jobs runner:
|
|
@@ -759,10 +923,10 @@ interface AssistTurnRequest {
|
|
|
759
923
|
readonly route: string;
|
|
760
924
|
};
|
|
761
925
|
}
|
|
762
|
-
/** What a turn proposes, per family: a field's value (`fields`)
|
|
763
|
-
type AssistEdit = FieldEdit | WordEdit;
|
|
926
|
+
/** 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;
|
|
764
928
|
/** What a turn changed, as the card says it. */
|
|
765
|
-
type AssistChange = FieldChange | WordChange;
|
|
929
|
+
type AssistChange = FieldChange | WordChange | StyleChange;
|
|
766
930
|
/** POST's 202 answer. */
|
|
767
931
|
interface AssistTurnAccepted {
|
|
768
932
|
readonly turnId: string;
|
|
@@ -873,5 +1037,5 @@ declare function turnLocale(sentence: string, fields: ReadonlyArray<AssistField>
|
|
|
873
1037
|
/** The language's own name in the admin's language (`en` → "English" / "אנגלית"). */
|
|
874
1038
|
declare const languageName: (locale: string, uiLang: string) => string;
|
|
875
1039
|
|
|
876
|
-
export { AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, 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, PagePartKind, PageSuggestionKind, RouteAnswerKey, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, SurfaceStatus, WORDS_PER_PART, WordsAnswerKey, applyFieldEdits, applyWordEdits, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeWordsAnswers, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, isEmptyFieldValue, isPlainRecord, isSessionOf, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, memoryLine, namedLocale, pageSuggestions, pageWriteLocale, paragraphsToRichText, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sessionMemory, summarizeItem, summarizePage, surfacePermissions, surfaceSpec, titleField, turnLocale, unknownHandles, validateTurnRequest, wordsJsonSchema };
|
|
877
|
-
export type { AssistChange, AssistEdit, AssistField, AssistIssue, AssistMemoryLine, AssistModelChoice, AssistRoute, AssistSession, AssistTarget, AssistTurn, AssistTurnAccepted, AssistTurnRefusal, AssistTurnRequest, AssistWordContext, Brief, BriefRules, BriefValue, ContentControllerDef, ContentPropertyDef, ContentRecord, ContentTypeSchema, FieldChange, FieldEdit, FieldEditContext, FieldEditsOutcome, FieldsSchemaOptions, FieldsSchemas, HandleMap, HandleResolution, HandleTarget, ItemAround, ItemBrief, ItemBriefContext, ItemBriefField, ItemFocus, ItemSuggestion, ItemSummary, NeverWrite, PageAround, PageBrief, PageBriefContext, PageFocus, PagePart, PageSectionSummary, PageSuggestion, SummarizedItem, SummarizedPage, SurfaceSpec, WordChange, WordEdit, WordEditContext, WordEditsOutcome, WordsSchemas, WrittenWords };
|
|
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 };
|