@praxisui/tabs 3.0.0-beta.1 → 3.0.0-beta.10

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/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, Provider } from '@angular/core';
3
3
  import { MatTabChangeEvent } from '@angular/material/tabs';
4
+ import { WidgetDefinition, WidgetEventEnvelope, WidgetEventPathSegment, PraxisI18nConfig, ComponentDocMeta, ComponentMetadataRegistry, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog } from '@praxisui/core';
4
5
  import { FormGroup } from '@angular/forms';
5
6
  import { CdkDragDrop } from '@angular/cdk/drag-drop';
6
- import { WidgetDefinition, ComponentDocMeta, ComponentMetadataRegistry, AiCapabilityCategory, AiValueKind, AiCapability, AiCapabilityCatalog } from '@praxisui/core';
7
7
  import { BaseAiAdapter, Capability as Capability$1, PatchResult } from '@praxisui/ai';
8
8
  import { BehaviorSubject } from 'rxjs';
9
9
  import { SettingsValueProvider } from '@praxisui/settings-panel';
@@ -129,6 +129,7 @@ interface TabsStyleTokens {
129
129
  'background-color': string;
130
130
  }
131
131
  declare class PraxisTabs implements OnInit, OnChanges, OnDestroy {
132
+ private readonly i18n;
132
133
  private readonly settings;
133
134
  private readonly storage;
134
135
  private readonly snack;
@@ -148,21 +149,14 @@ declare class PraxisTabs implements OnInit, OnChanges, OnDestroy {
148
149
  selectedTabChange: EventEmitter<MatTabChangeEvent>;
149
150
  indexFocused: EventEmitter<number>;
150
151
  selectFocusedIndex: EventEmitter<number>;
151
- widgetEvent: EventEmitter<{
152
- tabId?: string;
153
- tabIndex?: number;
154
- linkId?: string;
155
- linkIndex?: number;
156
- sourceId: string;
157
- output?: string;
158
- payload?: any;
159
- }>;
152
+ widgetEvent: EventEmitter<WidgetEventEnvelope>;
160
153
  aiAdapter: TabsAiAdapter;
161
154
  protected currentNavIndex: i0.WritableSignal<number>;
162
155
  protected selectedIndexSignal: i0.WritableSignal<number>;
163
156
  private groupLoaded;
164
157
  private navLoaded;
165
158
  private readonly destroy$;
159
+ private readonly widgetDefinitionCache;
166
160
  ngOnInit(): void;
167
161
  ngOnChanges(changes: SimpleChanges): void;
168
162
  ngOnDestroy(): void;
@@ -179,6 +173,9 @@ declare class PraxisTabs implements OnInit, OnChanges, OnDestroy {
179
173
  /** Clears persisted tabs configuration to fallback to defaults */
180
174
  resetPreferences(): void;
181
175
  openQuickSetup(): void;
176
+ private currentTabsBindings;
177
+ t(key: string, fallback: string): string;
178
+ private applyTabsAuthoringPlan;
182
179
  private storageKey;
183
180
  private syncSelectionFromConfig;
184
181
  private persistConfig;
@@ -190,34 +187,86 @@ declare class PraxisTabs implements OnInit, OnChanges, OnDestroy {
190
187
  protected groupContentReady(index: number): boolean;
191
188
  protected navContentReady(index: number): boolean;
192
189
  protected isEmptyGlobal(): boolean;
193
- protected emitWidgetEvent(loc: {
194
- tabId?: string;
195
- tabIndex?: number;
196
- linkId?: string;
197
- linkIndex?: number;
198
- }, ev: {
199
- sourceId: string;
200
- output?: string;
201
- payload?: any;
202
- }): void;
190
+ protected trackNavLink(index: number, link: TabLinkMetadata): string;
191
+ protected trackTab(index: number, tab: TabMetadata): string;
192
+ protected trackWidgetDefinition(index: number, widget: WidgetDefinition): string;
193
+ protected resolveWidgetDefinition(widget: WidgetDefinition): WidgetDefinition;
194
+ protected emitWidgetEvent(path: WidgetEventPathSegment[], ev: WidgetEventEnvelope): void;
195
+ protected tabEventPath(tabId: string | undefined, tabIndex: number): WidgetEventPathSegment[];
196
+ protected linkEventPath(linkId: string | undefined, linkIndex: number): WidgetEventPathSegment[];
203
197
  protected styleScopeId(): string;
204
198
  protected safeCustomCss(): string | null;
205
199
  private sanitizeCssValue;
206
200
  protected styleCss(): string | null;
201
+ private cloneWidgetDefinition;
207
202
  static ɵfac: i0.ɵɵFactoryDeclaration<PraxisTabs, never>;
208
203
  static ɵcmp: i0.ɵɵComponentDeclaration<PraxisTabs, "praxis-tabs", never, { "config": { "alias": "config"; "required": false; }; "tabsId": { "alias": "tabsId"; "required": true; }; "componentInstanceId": { "alias": "componentInstanceId"; "required": false; }; "enableCustomization": { "alias": "enableCustomization"; "required": false; }; "form": { "alias": "form"; "required": false; }; "context": { "alias": "context"; "required": false; }; }, { "animationDone": "animationDone"; "focusChange": "focusChange"; "selectedIndexChange": "selectedIndexChange"; "selectedTabChange": "selectedTabChange"; "indexFocused": "indexFocused"; "selectFocusedIndex": "selectFocusedIndex"; "widgetEvent": "widgetEvent"; }, never, never, true, never>;
209
204
  }
210
205
 
206
+ declare const PRAXIS_TABS_I18N_NAMESPACE = "praxisTabs";
207
+ declare function createPraxisTabsI18nConfig(): Partial<PraxisI18nConfig>;
208
+ declare const PRAXIS_TABS_I18N_CONFIG: Partial<PraxisI18nConfig>;
209
+ declare function providePraxisTabsI18n(): Provider;
210
+
211
211
  declare const PRAXIS_TABS_COMPONENT_METADATA: ComponentDocMeta;
212
212
  declare function providePraxisTabsMetadata(): Provider;
213
213
 
214
+ type TabsEditorDocumentKind = 'praxis.tabs.editor';
215
+ interface TabsAuthoringBindings {
216
+ tabsId?: string | null;
217
+ componentInstanceId?: string | null;
218
+ }
219
+ interface TabsRuntimeContext {
220
+ currentBindings?: TabsAuthoringBindings;
221
+ currentConfig?: TabsMetadata | null;
222
+ }
223
+ type TabsEditorDiagnosticLevel = 'error' | 'warning' | 'info';
224
+ interface TabsEditorDiagnostic {
225
+ level: TabsEditorDiagnosticLevel;
226
+ code: string;
227
+ message: string;
228
+ path?: string;
229
+ }
230
+ interface TabsAuthoringDocument {
231
+ kind: TabsEditorDocumentKind;
232
+ version: 1;
233
+ config: TabsMetadata;
234
+ bindings?: TabsAuthoringBindings;
235
+ }
236
+ interface TabsBindingsDiff {
237
+ tabsIdChanged: boolean;
238
+ componentInstanceIdChanged: boolean;
239
+ requiresPersistenceKeyRefresh: boolean;
240
+ }
241
+ interface TabsRuntimePlan {
242
+ refreshSelection: boolean;
243
+ rebuildLazyState: boolean;
244
+ refreshPersistenceScope: boolean;
245
+ }
246
+ interface TabsApplyPlan {
247
+ canonicalConfig: TabsMetadata;
248
+ bindingsPatch?: TabsAuthoringBindings;
249
+ persistence: {
250
+ saveConfig: boolean;
251
+ saveBindings: boolean;
252
+ };
253
+ runtime: TabsRuntimePlan;
254
+ diff: TabsBindingsDiff;
255
+ diagnostics: TabsEditorDiagnostic[];
256
+ }
257
+
214
258
  declare class PraxisTabsConfigEditor implements SettingsValueProvider {
215
259
  private registry;
260
+ private readonly i18n;
261
+ primaryMode: 'group' | 'nav';
262
+ editedDocument: TabsAuthoringDocument;
216
263
  editedConfig: TabsMetadata;
217
- private initialConfig;
264
+ private initialDocument;
265
+ private bindings;
218
266
  jsonText: string;
219
267
  isValid: boolean;
220
268
  errorMsg: string;
269
+ diagnostics: TabsEditorDiagnostic[];
221
270
  componentOptions: Array<{
222
271
  id: string;
223
272
  friendlyName?: string;
@@ -226,53 +275,72 @@ declare class PraxisTabsConfigEditor implements SettingsValueProvider {
226
275
  selectedLinkWidgetId: Record<number, string>;
227
276
  quickResourcePathTab: Record<number, string>;
228
277
  quickResourcePathLink: Record<number, string>;
278
+ protected t(key: string, fallback: string): string;
279
+ protected diagnosticLevelLabel(level: TabsEditorDiagnostic['level']): string;
229
280
  tokenList: readonly [{
230
281
  readonly key: "active-indicator-color";
231
- readonly label: "Indicador ativo";
282
+ readonly labelKey: "editor.tokens.activeIndicator";
283
+ readonly fallback: "Indicador ativo";
232
284
  }, {
233
285
  readonly key: "active-label-text-color";
234
- readonly label: "Texto ativo";
286
+ readonly labelKey: "editor.tokens.activeLabel";
287
+ readonly fallback: "Texto ativo";
235
288
  }, {
236
289
  readonly key: "active-hover-indicator-color";
237
- readonly label: "Indicador ativo (hover)";
290
+ readonly labelKey: "editor.tokens.activeHoverIndicator";
291
+ readonly fallback: "Indicador ativo (hover)";
238
292
  }, {
239
293
  readonly key: "active-hover-label-text-color";
240
- readonly label: "Texto ativo (hover)";
294
+ readonly labelKey: "editor.tokens.activeHoverLabel";
295
+ readonly fallback: "Texto ativo (hover)";
241
296
  }, {
242
297
  readonly key: "active-focus-indicator-color";
243
- readonly label: "Indicador ativo (focus)";
298
+ readonly labelKey: "editor.tokens.activeFocusIndicator";
299
+ readonly fallback: "Indicador ativo (focus)";
244
300
  }, {
245
301
  readonly key: "active-focus-label-text-color";
246
- readonly label: "Texto ativo (focus)";
302
+ readonly labelKey: "editor.tokens.activeFocusLabel";
303
+ readonly fallback: "Texto ativo (focus)";
247
304
  }, {
248
305
  readonly key: "inactive-label-text-color";
249
- readonly label: "Texto inativo";
306
+ readonly labelKey: "editor.tokens.inactiveLabel";
307
+ readonly fallback: "Texto inativo";
250
308
  }, {
251
309
  readonly key: "inactive-hover-label-text-color";
252
- readonly label: "Texto inativo (hover)";
310
+ readonly labelKey: "editor.tokens.inactiveHoverLabel";
311
+ readonly fallback: "Texto inativo (hover)";
253
312
  }, {
254
313
  readonly key: "inactive-focus-label-text-color";
255
- readonly label: "Texto inativo (focus)";
314
+ readonly labelKey: "editor.tokens.inactiveFocusLabel";
315
+ readonly fallback: "Texto inativo (focus)";
256
316
  }, {
257
317
  readonly key: "pagination-icon-color";
258
- readonly label: "Ícones de paginação";
318
+ readonly labelKey: "editor.tokens.paginationIcon";
319
+ readonly fallback: "Icones de paginacao";
259
320
  }, {
260
321
  readonly key: "divider-color";
261
- readonly label: "Divisor/linha";
322
+ readonly labelKey: "editor.tokens.divider";
323
+ readonly fallback: "Divisor/linha";
262
324
  }, {
263
325
  readonly key: "background-color";
264
- readonly label: "Fundo do header";
326
+ readonly labelKey: "editor.tokens.headerBackground";
327
+ readonly fallback: "Fundo do header";
265
328
  }];
266
329
  private presets;
267
330
  isDirty$: BehaviorSubject<boolean>;
268
331
  isValid$: BehaviorSubject<boolean>;
269
332
  isBusy$: BehaviorSubject<boolean>;
270
333
  constructor(data: any, registry: ComponentMetadataRegistry);
334
+ private inferPrimaryMode;
335
+ setPrimaryMode(mode: 'group' | 'nav'): void;
271
336
  private updateDirty;
337
+ private syncEditedDocumentFromConfig;
338
+ private syncEditorStateFromDocument;
339
+ private refreshDiagnostics;
272
340
  onJsonTextChange(text: string): void;
273
341
  formatJson(): void;
274
- getSettingsValue(): any;
275
- onSave(): any;
342
+ getSettingsValue(): TabsAuthoringDocument;
343
+ onSave(): TabsAuthoringDocument;
276
344
  reset(): void;
277
345
  get appearance(): NonNullable<TabsMetadata['appearance']>;
278
346
  onAppearanceChange(): void;
@@ -308,6 +376,19 @@ declare class PraxisTabsConfigEditor implements SettingsValueProvider {
308
376
  static ɵcmp: i0.ɵɵComponentDeclaration<PraxisTabsConfigEditor, "praxis-tabs-config-editor", never, {}, {}, never, never, true, never>;
309
377
  }
310
378
 
379
+ declare function createTabsAuthoringDocument(source: {
380
+ config?: TabsMetadata | null;
381
+ bindings?: TabsAuthoringBindings;
382
+ }): TabsAuthoringDocument;
383
+ declare function normalizeTabsAuthoringDocument(doc: TabsAuthoringDocument): TabsAuthoringDocument;
384
+ declare function validateTabsAuthoringDocument(doc: TabsAuthoringDocument, _context?: TabsRuntimeContext): TabsEditorDiagnostic[];
385
+ declare function toCanonicalTabsConfig(doc: TabsAuthoringDocument, _context?: TabsRuntimeContext): TabsMetadata;
386
+ declare function buildTabsApplyPlan(doc: TabsAuthoringDocument, runtime?: TabsRuntimeContext, options?: {
387
+ saveConfig?: boolean;
388
+ saveBindings?: boolean;
389
+ }): TabsApplyPlan;
390
+ declare function serializeTabsAuthoringDocument(doc: TabsAuthoringDocument): TabsAuthoringDocument;
391
+
311
392
  /**
312
393
  * Capabilities catalog for Praxis Tabs (TabsMetadata).
313
394
  * Paths follow TabsMetadata shape (patches are merged at config root).
@@ -331,5 +412,5 @@ interface CapabilityCatalog extends AiCapabilityCatalog {
331
412
  }
332
413
  declare const TABS_AI_CAPABILITIES: CapabilityCatalog;
333
414
 
334
- export { PRAXIS_TABS_COMPONENT_METADATA, PraxisTabs, PraxisTabsConfigEditor, TABS_AI_CAPABILITIES, providePraxisTabsMetadata };
335
- export type { Capability, CapabilityCatalog, CapabilityCategory, TabGroupMetadata, TabLinkMetadata, TabMetadata, TabNavMetadata, TabsAccessibilityConfig, TabsAppearanceConfig, TabsBehaviorConfig, TabsEventConfig, TabsMetadata, TabsStyleTokens, ValueKind };
415
+ export { PRAXIS_TABS_COMPONENT_METADATA, PRAXIS_TABS_I18N_CONFIG, PRAXIS_TABS_I18N_NAMESPACE, PraxisTabs, PraxisTabsConfigEditor, TABS_AI_CAPABILITIES, buildTabsApplyPlan, createPraxisTabsI18nConfig, createTabsAuthoringDocument, normalizeTabsAuthoringDocument, providePraxisTabsI18n, providePraxisTabsMetadata, serializeTabsAuthoringDocument, toCanonicalTabsConfig, validateTabsAuthoringDocument };
416
+ export type { Capability, CapabilityCatalog, CapabilityCategory, TabGroupMetadata, TabLinkMetadata, TabMetadata, TabNavMetadata, TabsAccessibilityConfig, TabsAppearanceConfig, TabsApplyPlan, TabsAuthoringBindings, TabsAuthoringDocument, TabsBehaviorConfig, TabsBindingsDiff, TabsEditorDiagnostic, TabsEditorDiagnosticLevel, TabsEditorDocumentKind, TabsEventConfig, TabsMetadata, TabsRuntimeContext, TabsRuntimePlan, TabsStyleTokens, ValueKind };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@praxisui/tabs",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "Configurable tabs (group and nav) for Praxis UI with metadata-driven content and runtime editor.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^20.0.0",
7
7
  "@angular/core": "^20.0.0",
8
8
  "@angular/material": "^20.0.0",
9
9
  "@angular/cdk": "^20.0.0",
10
- "@praxisui/core": "^3.0.0-beta.1",
11
- "@praxisui/dynamic-fields": "^3.0.0-beta.1",
12
- "@praxisui/settings-panel": "^3.0.0-beta.1"
10
+ "@praxisui/core": "^3.0.0-beta.10",
11
+ "@praxisui/dynamic-fields": "^3.0.0-beta.10",
12
+ "@praxisui/settings-panel": "^3.0.0-beta.10"
13
13
  },
14
14
  "dependencies": {
15
15
  "tslib": "^2.3.0",