@praxisui/rich-content 8.0.0-beta.1 → 8.0.0-beta.12
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/README.md +39 -0
- package/fesm2022/praxisui-rich-content.mjs +3278 -71
- package/index.d.ts +102 -3
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { OnChanges, OnInit, SimpleChanges, InjectionToken, Provider } from '@angular/core';
|
|
3
|
-
import { RichContentDocument, RichPrimitiveNode, RichPresetReferenceNode, JsonLogicDataRecord, RichBlockHostCapabilities, RichBlockNode, RichPresenterNode, RichComposeNode, RichCardNode, RichMediaBlockNode, RichTimelineNode, RichTimelineItem,
|
|
3
|
+
import { RichContentDocument, RichPrimitiveNode, RichPresetReferenceNode, JsonLogicDataRecord, RichBlockHostCapabilities, RichBlockNode, RichPresenterNode, RichComposeNode, RichCardNode, RichMediaBlockNode, RichTimelineNode, RichTimelineItem, RichTextNode, RichBadgeNode, RichIconNode, RichImageNode, RichLinkNode, RichMetricNode, RichProgressNode, SettingsValueProvider, CorePresetRef, CorePresetDescriptor, ComponentDocMeta, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog, ComponentAuthoringManifest, PraxisI18nDictionary, PraxisI18nConfig, PraxisI18nService } from '@praxisui/core';
|
|
4
|
+
import * as _praxisui_rich_content from '@praxisui/rich-content';
|
|
4
5
|
import { BehaviorSubject } from 'rxjs';
|
|
5
6
|
|
|
6
7
|
type RenderableNode = RichPrimitiveNode | RichPresetReferenceNode;
|
|
@@ -26,6 +27,12 @@ declare class PraxisRichContent {
|
|
|
26
27
|
resolveImageAlt(node: Extract<RichPresenterNode, {
|
|
27
28
|
type: 'image';
|
|
28
29
|
}>): string;
|
|
30
|
+
resolveLinkLabel(node: Extract<RichPresenterNode, {
|
|
31
|
+
type: 'link';
|
|
32
|
+
}>): string;
|
|
33
|
+
resolveLinkRel(node: Extract<RichPresenterNode, {
|
|
34
|
+
type: 'link';
|
|
35
|
+
}>): string | null;
|
|
29
36
|
resolveBadgeLabel(node: Extract<RichPresenterNode, {
|
|
30
37
|
type: 'badge';
|
|
31
38
|
}>): string;
|
|
@@ -66,6 +73,9 @@ declare class PraxisRichContent {
|
|
|
66
73
|
resolveTimelineItemIcon(item: RichTimelineItem): string | null;
|
|
67
74
|
resolveTimelineItemBadge(item: RichTimelineItem): string | null;
|
|
68
75
|
resolvePresetNodes(node: RichPresetReferenceNode): RenderableNode[] | null;
|
|
76
|
+
private expandPresetReference;
|
|
77
|
+
private resolvePresetDocument;
|
|
78
|
+
private getPresetKey;
|
|
69
79
|
private buildEvaluationContext;
|
|
70
80
|
private resolveValue;
|
|
71
81
|
private getByPath;
|
|
@@ -74,6 +84,24 @@ declare class PraxisRichContent {
|
|
|
74
84
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PraxisRichContent, "praxis-rich-content", never, { "document": { "alias": "document"; "required": false; "isSignal": true; }; "nodes": { "alias": "nodes"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "hostCapabilities": { "alias": "hostCapabilities"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "rootClassName": { "alias": "rootClassName"; "required": false; }; }, {}, never, never, true, never>;
|
|
75
85
|
}
|
|
76
86
|
|
|
87
|
+
interface RichContentValidationIssue {
|
|
88
|
+
path: string;
|
|
89
|
+
messageKey: string;
|
|
90
|
+
fallback: string;
|
|
91
|
+
}
|
|
92
|
+
interface RichContentValidationResult {
|
|
93
|
+
valid: boolean;
|
|
94
|
+
issues: RichContentValidationIssue[];
|
|
95
|
+
}
|
|
96
|
+
declare function validateRichContentDocument(value: unknown): RichContentValidationResult;
|
|
97
|
+
declare function isValidRichContentDocument(value: unknown): value is RichContentDocument;
|
|
98
|
+
|
|
99
|
+
type EditableTopLevelNode = RichTextNode | RichBadgeNode | RichIconNode | RichImageNode | RichLinkNode | RichMetricNode | RichProgressNode | RichComposeNode | RichCardNode | RichMediaBlockNode | RichTimelineNode | RichPresetReferenceNode;
|
|
100
|
+
type EditableTopLevelNodeType = EditableTopLevelNode['type'];
|
|
101
|
+
type EditablePresenterNode = RichPresenterNode;
|
|
102
|
+
type EditablePresenterNodeType = EditablePresenterNode['type'];
|
|
103
|
+
type EditableCardContentNodeType = EditablePresenterNodeType | 'compose';
|
|
104
|
+
|
|
77
105
|
interface PraxisRichContentEditorInputs {
|
|
78
106
|
document?: RichContentDocument | null;
|
|
79
107
|
layout?: 'block' | 'inline';
|
|
@@ -86,17 +114,28 @@ interface PraxisRichContentEditorValue {
|
|
|
86
114
|
declare class PraxisRichContentConfigEditor implements SettingsValueProvider, OnChanges, OnInit {
|
|
87
115
|
private readonly cdr;
|
|
88
116
|
private readonly i18n;
|
|
117
|
+
private readonly presetRegistry;
|
|
89
118
|
private readonly injectedData;
|
|
90
119
|
inputs: PraxisRichContentEditorInputs | null;
|
|
91
120
|
readonly isDirty$: BehaviorSubject<boolean>;
|
|
92
121
|
readonly isValid$: BehaviorSubject<boolean>;
|
|
93
122
|
readonly isBusy$: BehaviorSubject<boolean>;
|
|
123
|
+
readonly editableNodeTypes: ("text" | "icon" | "image" | "link" | "badge" | "metric" | "progress" | "compose" | "card" | "mediaBlock" | "timeline" | "preset")[];
|
|
124
|
+
readonly presenterNodeTypes: ("text" | "icon" | "image" | "link" | "badge" | "avatar" | "metric" | "progress")[];
|
|
125
|
+
readonly cardContentNodeTypes: EditableCardContentNodeType[];
|
|
126
|
+
readonly presetOptions: _praxisui_rich_content.RichBlockPresetDefinition[];
|
|
94
127
|
documentJson: string;
|
|
95
128
|
layout: 'block' | 'inline';
|
|
96
129
|
rootClassName: string;
|
|
130
|
+
newNodeType: EditableTopLevelNodeType;
|
|
97
131
|
errorMessage: string;
|
|
98
132
|
valid: boolean;
|
|
133
|
+
parsedDocument: RichContentDocument | null;
|
|
134
|
+
validationIssues: RichContentValidationIssue[];
|
|
135
|
+
nodeCount: number;
|
|
136
|
+
nodeTypeSummary: string;
|
|
99
137
|
private initialInputs;
|
|
138
|
+
private pendingRemoval;
|
|
100
139
|
ngOnChanges(changes: SimpleChanges): void;
|
|
101
140
|
ngOnInit(): void;
|
|
102
141
|
getSettingsValue(): PraxisRichContentEditorValue | null;
|
|
@@ -106,9 +145,67 @@ declare class PraxisRichContentConfigEditor implements SettingsValueProvider, On
|
|
|
106
145
|
onDocumentJsonChange(): void;
|
|
107
146
|
tx(key: string, fallback: string): string;
|
|
108
147
|
useEmptyDocument(): void;
|
|
148
|
+
addTopLevelNode(): void;
|
|
149
|
+
removeTopLevelNode(index: number): void;
|
|
150
|
+
moveTopLevelNode(index: number, delta: number): void;
|
|
151
|
+
changeTopLevelNodeType(index: number, nextType: EditableTopLevelNodeType): void;
|
|
152
|
+
getStringField(node: RichBlockNode, field: string): string;
|
|
153
|
+
setStringField(index: number, field: string, value: string): void;
|
|
154
|
+
getNumberField(node: RichBlockNode, field: string): number | null;
|
|
155
|
+
setNumberField(index: number, field: string, value: number | string | null): void;
|
|
156
|
+
getVisibleWhenPath(node: RichBlockNode): string;
|
|
157
|
+
getVisibleWhenValue(node: RichBlockNode): string;
|
|
158
|
+
setVisibleWhenPath(index: number, path: string): void;
|
|
159
|
+
setVisibleWhenValue(index: number, value: string): void;
|
|
160
|
+
getFirstStyleName(node: RichBlockNode): string;
|
|
161
|
+
getFirstStyleValue(node: RichBlockNode): string;
|
|
162
|
+
setFirstStyleName(index: number, propertyName: string): void;
|
|
163
|
+
setFirstStyleValue(index: number, propertyValue: string): void;
|
|
164
|
+
requestTopLevelNodeRemoval(index: number): void;
|
|
165
|
+
confirmTopLevelNodeRemoval(index: number): void;
|
|
166
|
+
requestNestedRemoval(scope: string, index: number): void;
|
|
167
|
+
cancelRemoval(): void;
|
|
168
|
+
isRemovalPending(scope: string, index: number): boolean;
|
|
169
|
+
addCardContentNode(cardIndex: number): void;
|
|
170
|
+
setCardContentStringField(cardIndex: number, contentIndex: number, field: string, value: string): void;
|
|
171
|
+
setCardContentNumberField(cardIndex: number, contentIndex: number, field: string, value: number | string | null): void;
|
|
172
|
+
changeCardContentType(cardIndex: number, contentIndex: number, type: EditablePresenterNodeType): void;
|
|
173
|
+
confirmCardContentRemoval(cardIndex: number, contentIndex: number): void;
|
|
174
|
+
addComposeItem(composeIndex: number): void;
|
|
175
|
+
setComposeItemStringField(composeIndex: number, itemIndex: number, field: string, value: string): void;
|
|
176
|
+
setComposeItemNumberField(composeIndex: number, itemIndex: number, field: string, value: number | string | null): void;
|
|
177
|
+
changeComposeItemType(composeIndex: number, itemIndex: number, type: EditablePresenterNodeType): void;
|
|
178
|
+
confirmComposeItemRemoval(composeIndex: number, itemIndex: number): void;
|
|
179
|
+
isPresenterNode(node: RichBlockNode): node is RichPresenterNode;
|
|
180
|
+
isCardContentEditable(type: string): type is EditablePresenterNodeType;
|
|
181
|
+
setMediaBlockAvatarField(index: number, field: string, value: string): void;
|
|
182
|
+
getMediaBlockAvatarField(index: number, field: string): string;
|
|
183
|
+
setMediaBlockTextField(index: number, field: 'title' | 'subtitle', value: string): void;
|
|
184
|
+
getMediaBlockTextField(index: number, field: 'title' | 'subtitle'): string;
|
|
185
|
+
addTimelineItem(index: number): void;
|
|
186
|
+
setTimelineItemField(index: number, itemIndex: number, field: keyof RichTimelineItem, value: string): void;
|
|
187
|
+
getTimelineItemField(index: number, itemIndex: number, field: keyof RichTimelineItem): string;
|
|
188
|
+
confirmTimelineItemRemoval(index: number, itemIndex: number): void;
|
|
189
|
+
setPresetSelection(index: number, optionValue: string): void;
|
|
190
|
+
getPresetSelection(node: RichBlockNode): string;
|
|
191
|
+
getPresetOptionValue(ref: CorePresetRef): string;
|
|
192
|
+
getIssueMessages(path: string): string[];
|
|
193
|
+
isEditableNodeType(type: string): type is EditableTopLevelNodeType;
|
|
194
|
+
private isPresenterNodeType;
|
|
109
195
|
private load;
|
|
110
196
|
private normalizeInputs;
|
|
197
|
+
private ensureEditableDocument;
|
|
198
|
+
private syncStructuredDocumentChange;
|
|
199
|
+
private createDefaultNode;
|
|
200
|
+
private getDefaultPresetRef;
|
|
201
|
+
private ensureCardNode;
|
|
202
|
+
private ensureComposeNode;
|
|
203
|
+
private ensureMediaBlockNode;
|
|
204
|
+
private ensureMediaBlockAvatar;
|
|
205
|
+
private ensureTimelineNode;
|
|
111
206
|
private parseDocument;
|
|
207
|
+
private setInvalidState;
|
|
208
|
+
private updateDocumentOverview;
|
|
112
209
|
private matchesInitialState;
|
|
113
210
|
private cloneInputs;
|
|
114
211
|
private cloneValue;
|
|
@@ -153,6 +250,8 @@ interface RichContentCapabilityCatalog extends AiCapabilityCatalog {
|
|
|
153
250
|
}
|
|
154
251
|
declare const RICH_CONTENT_AI_CAPABILITIES: RichContentCapabilityCatalog;
|
|
155
252
|
|
|
253
|
+
declare const PRAXIS_RICH_CONTENT_AUTHORING_MANIFEST: ComponentAuthoringManifest;
|
|
254
|
+
|
|
156
255
|
interface PraxisRichContentI18nOptions {
|
|
157
256
|
locale?: string;
|
|
158
257
|
fallbackLocale?: string;
|
|
@@ -162,5 +261,5 @@ declare function createPraxisRichContentI18nConfig(options?: PraxisRichContentI1
|
|
|
162
261
|
declare function providePraxisRichContentI18n(options?: PraxisRichContentI18nOptions): _angular_core.Provider[];
|
|
163
262
|
declare function resolvePraxisRichContentText(i18n: PraxisI18nService, key: string, fallback: string): string;
|
|
164
263
|
|
|
165
|
-
export { PRAXIS_RICH_BLOCK_PRESETS, PRAXIS_RICH_CONTENT_COMPONENT_METADATA, PraxisRichContent, PraxisRichContentConfigEditor, RICH_CONTENT_AI_CAPABILITIES, RichContentPresetRegistryService, createPraxisRichContentI18nConfig, providePraxisRichContentI18n, providePraxisRichContentMetadata, resolvePraxisRichContentText };
|
|
166
|
-
export type { PraxisRichContentEditorInputs, PraxisRichContentEditorValue, PraxisRichContentI18nOptions, RichBlockPresetDefinition, RichContentCapability, RichContentCapabilityCatalog, RichContentCapabilityCategory, RichContentValueKind };
|
|
264
|
+
export { PRAXIS_RICH_BLOCK_PRESETS, PRAXIS_RICH_CONTENT_AUTHORING_MANIFEST, PRAXIS_RICH_CONTENT_COMPONENT_METADATA, PraxisRichContent, PraxisRichContentConfigEditor, RICH_CONTENT_AI_CAPABILITIES, RichContentPresetRegistryService, createPraxisRichContentI18nConfig, isValidRichContentDocument, providePraxisRichContentI18n, providePraxisRichContentMetadata, resolvePraxisRichContentText, validateRichContentDocument };
|
|
265
|
+
export type { PraxisRichContentEditorInputs, PraxisRichContentEditorValue, PraxisRichContentI18nOptions, RichBlockPresetDefinition, RichContentCapability, RichContentCapabilityCatalog, RichContentCapabilityCategory, RichContentValidationIssue, RichContentValidationResult, RichContentValueKind };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/rich-content",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.12",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^20.3.0",
|
|
6
6
|
"@angular/core": "^20.3.0",
|
|
7
|
-
"@praxisui/core": "^8.0.0-beta.
|
|
7
|
+
"@praxisui/core": "^8.0.0-beta.12"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"tslib": "^2.3.0"
|