@praxisui/rich-content 10.0.0-rc.33 → 10.0.0-rc.34

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,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-10-18T21:58:32.782Z",
3
+ "generatedAt": "2026-10-19T09:48:25.455Z",
4
4
  "packageName": "@praxisui/rich-content",
5
- "packageVersion": "10.0.0-rc.33",
5
+ "packageVersion": "10.0.0-rc.34",
6
6
  "sourceRegistry": "praxis-component-registry-ingestion",
7
7
  "sourceRegistryVersion": "1.0.0",
8
8
  "componentCount": 1,
@@ -4,10 +4,10 @@ import * as i2 from '@angular/material/menu';
4
4
  import { MatMenuModule } from '@angular/material/menu';
5
5
  import * as i0 from '@angular/core';
6
6
  import { InjectionToken, inject, Injectable, LOCALE_ID, signal, input, EventEmitter, computed, Output, Input, ChangeDetectionStrategy, Component, ChangeDetectorRef, ENVIRONMENT_INITIALIZER } from '@angular/core';
7
- import { providePraxisI18n, PraxisI18nService, PraxisJsonLogicService, GlobalActionService, SchemaNormalizerService, GenericCrudService, SCHEMA_METADATA_CLIENT_OPTIONS, normalizeCardMediaAspectRatio, MemoryCacheAdapter, SchemaMetadataClient, isUnresolvedTemplateToken, applyDeclarativeValuePipe, DynamicWidgetLoaderDirective, ComponentMetadataRegistry, SETTINGS_PANEL_DATA, generateId } from '@praxisui/core';
7
+ import { providePraxisI18n, PraxisI18nService, PraxisJsonLogicService, GlobalActionService, SchemaNormalizerService, GenericCrudService, ResourceDiscoveryService, SCHEMA_METADATA_CLIENT_OPTIONS, normalizeCardMediaAspectRatio, MemoryCacheAdapter, SchemaMetadataClient, isUnresolvedTemplateToken, applyDeclarativeValuePipe, DynamicWidgetLoaderDirective, ComponentMetadataRegistry, SETTINGS_PANEL_DATA, generateId } from '@praxisui/core';
8
+ import { firstValueFrom, BehaviorSubject } from 'rxjs';
8
9
  import * as i2$1 from '@angular/forms';
9
10
  import { FormsModule } from '@angular/forms';
10
- import { BehaviorSubject } from 'rxjs';
11
11
 
12
12
  const PRAXIS_RICH_CONTENT_EN_US = {
13
13
  'praxis.richContent.editor.invalidJsonStatus': 'Invalid JSON',
@@ -1339,6 +1339,7 @@ class PraxisRichContent {
1339
1339
  schemaNormalizer = inject(SchemaNormalizerService, { optional: true });
1340
1340
  localeId = inject(LOCALE_ID, { optional: true }) || 'pt-BR';
1341
1341
  crud = inject(GenericCrudService, { optional: true });
1342
+ resourceDiscovery = inject(ResourceDiscoveryService, { optional: true });
1342
1343
  schemaTransportOptions = inject(SCHEMA_METADATA_CLIENT_OPTIONS, { optional: true });
1343
1344
  localSchemaMap = new Map();
1344
1345
  schemaVersion = signal(0, ...(ngDevMode ? [{ debugName: "schemaVersion" }] : /* istanbul ignore next */ []));
@@ -2123,40 +2124,54 @@ class PraxisRichContent {
2123
2124
  return;
2124
2125
  }
2125
2126
  this.inFlightSchemaRequests.add(resourcePath);
2126
- let baseUrl = '';
2127
- try {
2128
- if (this.crud &&
2129
- typeof this.crud.getSchemasFilteredBaseUrl === 'function') {
2130
- baseUrl = this.crud.getSchemasFilteredBaseUrl();
2127
+ const canUseDiscovery = typeof this.resourceDiscovery?.getResourceSchemaFields === 'function' &&
2128
+ (typeof this.resourceDiscovery.canResolveSchemas !== 'function' ||
2129
+ this.resourceDiscovery.canResolveSchemas());
2130
+ const loadViaFallbackClient = async () => {
2131
+ let baseUrl = '';
2132
+ try {
2133
+ if (this.crud &&
2134
+ typeof this.crud.getSchemasFilteredBaseUrl === 'function') {
2135
+ baseUrl = this.crud.getSchemasFilteredBaseUrl();
2136
+ }
2137
+ else if (typeof globalThis !== 'undefined' &&
2138
+ globalThis.location?.origin) {
2139
+ baseUrl = `${globalThis.location.origin}/schemas/filtered`;
2140
+ }
2131
2141
  }
2132
- else if (typeof globalThis !== 'undefined' &&
2133
- globalThis.location?.origin) {
2134
- baseUrl = `${globalThis.location.origin}/schemas/filtered`;
2142
+ catch {
2143
+ baseUrl = '/schemas/filtered';
2135
2144
  }
2136
- }
2137
- catch {
2138
- baseUrl = '/schemas/filtered';
2139
- }
2140
- if (!baseUrl) {
2141
- this.inFlightSchemaRequests.delete(resourcePath);
2142
- return;
2143
- }
2144
- const adapter = new MemoryCacheAdapter();
2145
- const client = new SchemaMetadataClient(adapter, this.schemaTransportOptions ?? {});
2146
- client
2147
- .getSchema({
2148
- baseUrl,
2149
- path: resourcePath,
2150
- operation: 'get',
2151
- schemaType: 'response',
2152
- })
2153
- .then((entry) => {
2145
+ if (!baseUrl) {
2146
+ return;
2147
+ }
2148
+ const adapter = new MemoryCacheAdapter();
2149
+ const client = new SchemaMetadataClient(adapter, this.schemaTransportOptions ?? {});
2150
+ const entry = await client.getSchema({
2151
+ baseUrl,
2152
+ path: resourcePath,
2153
+ operation: 'get',
2154
+ schemaType: 'response',
2155
+ });
2154
2156
  if (entry?.schema) {
2155
2157
  const defs = (this.schemaNormalizer ?? new SchemaNormalizerService()).normalizeSchema(entry.schema);
2156
2158
  this.localSchemaMap.set(resourcePath, defs);
2157
2159
  this.schemaVersion.update((v) => v + 1);
2158
2160
  }
2159
- })
2161
+ };
2162
+ const resolvePromise = canUseDiscovery
2163
+ ? firstValueFrom(this.resourceDiscovery.getResourceSchemaFields(resourcePath))
2164
+ .then(async (defs) => {
2165
+ if (Array.isArray(defs) && defs.length > 0) {
2166
+ this.localSchemaMap.set(resourcePath, defs);
2167
+ this.schemaVersion.update((v) => v + 1);
2168
+ return;
2169
+ }
2170
+ await loadViaFallbackClient();
2171
+ })
2172
+ .catch(() => loadViaFallbackClient())
2173
+ : loadViaFallbackClient();
2174
+ resolvePromise
2160
2175
  .catch(() => {
2161
2176
  // Fail-open: if schema cannot be fetched over network, property sheet continues gracefully
2162
2177
  })
@@ -3054,9 +3069,10 @@ class PraxisRichContent {
3054
3069
  }
3055
3070
  if (resolved === undefined && path.includes('.')) {
3056
3071
  const cleanSegments = path.replace(/^(?:context|state(?:\.derived)?)\./, '').split('.').filter(Boolean);
3057
- if (cleanSegments.length > 1 && lookup(cleanSegments[0]) === undefined) {
3072
+ const hasNumericSegment = cleanSegments.some((segment) => /^\d+$/.test(segment));
3073
+ if (cleanSegments.length === 2 && !hasNumericSegment && lookup(cleanSegments[0]) === undefined) {
3058
3074
  const leafKey = cleanSegments[cleanSegments.length - 1];
3059
- if (leafKey && !/^\d+$/.test(leafKey)) {
3075
+ if (leafKey) {
3060
3076
  resolved = lookup(leafKey) ?? lookup(`context.${leafKey}`);
3061
3077
  }
3062
3078
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@praxisui/rich-content",
3
- "version": "10.0.0-rc.33",
3
+ "version": "10.0.0-rc.34",
4
4
  "description": "Rich content rendering and authoring primitives for Praxis UI surfaces, including semantic blocks and page-builder integration.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
7
7
  "@angular/core": "^21.0.0",
8
8
  "@angular/material": "^21.0.0",
9
- "@praxisui/core": "^10.0.0-rc.33",
9
+ "@praxisui/core": "^10.0.0-rc.34",
10
10
  "@angular/forms": "^21.0.0",
11
11
  "rxjs": "~7.8.0"
12
12
  },
@@ -13,6 +13,7 @@ declare class PraxisRichContent {
13
13
  private readonly schemaNormalizer;
14
14
  private readonly localeId;
15
15
  private readonly crud;
16
+ private readonly resourceDiscovery;
16
17
  private readonly schemaTransportOptions;
17
18
  private readonly localSchemaMap;
18
19
  private readonly schemaVersion;