@praxisui/charts 7.0.0-beta.0 → 8.0.0-beta.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/README.md CHANGED
@@ -115,7 +115,7 @@ See the public exports in `projects/praxis-charts/src/public-api.ts`.
115
115
 
116
116
  ## Runtime Model
117
117
 
118
- O runtime atual de `@praxisui/charts` opera em duas trilhas principais:
118
+ O runtime de `@praxisui/charts` opera em duas trilhas principais:
119
119
 
120
120
  - `dataSource.kind = "local"` para datasets entregues diretamente ao componente
121
121
  - `dataSource.kind = "remote"` para datasets remotos, com foco canônico em `praxis.stats`
@@ -127,6 +127,81 @@ No modo remoto, o componente:
127
127
  - transforma a resposta agregada em `PraxisChartDataRow[]`
128
128
  - renderiza o estado `loading`, `empty`, `error` ou `ready`
129
129
 
130
+ ## Sizing Modes
131
+
132
+ Charts expose sizing as canonical contract, not as host CSS. New chart documents
133
+ should use `sizing` instead of the legacy top-level `height` property.
134
+
135
+ ```ts
136
+ const chartDocument: PraxisXUiChartContract = {
137
+ version: '0.1.0',
138
+ kind: 'bar',
139
+ chartId: 'status-by-team',
140
+ sizing: {
141
+ mode: 'fill-container',
142
+ minHeight: 160,
143
+ },
144
+ source: { kind: 'derived' },
145
+ dimensions: [{ field: 'team' }],
146
+ metrics: [{ field: 'total', aggregation: 'count' }],
147
+ };
148
+ ```
149
+
150
+ Supported modes:
151
+
152
+ - `fixed`: uses `sizing.height`; use it for standalone charts with deliberate fixed height.
153
+ - `fill-container`: fills the usable body of a widget shell or another container with a defined height.
154
+ - `auto`: lets the chart content define its natural height.
155
+
156
+ Sizing values may be numbers or CSS lengths. Numeric editor input is normalized
157
+ to pixels before the runtime applies styles, so `height: 320` and an editor
158
+ value of `320` both resolve to `320px`. `minHeight` and `maxHeight` constrain
159
+ the chart shell, and `aspectRatio` may be a positive number or CSS ratio such
160
+ as `16 / 9`.
161
+
162
+ For corporate dashboards and resizable widget canvases, prefer
163
+ `sizing.mode = "fill-container"` plus a documented `minHeight`. The containing
164
+ widget shell should provide a fill body layout, otherwise the chart cannot infer
165
+ a stable vertical area from CSS alone. Legacy `height` is normalized as
166
+ `sizing: { mode: "fixed", height }` in the canonical mapper only as a migration
167
+ bridge for existing beta payloads.
168
+
169
+ ## Surface Modes
170
+
171
+ Chart visual surface is also part of the canonical contract. Hosts should not
172
+ override the internal chart shell with ad hoc CSS when the intent is business
173
+ semantics such as embedded dashboard rendering versus standalone rendering.
174
+
175
+ ```ts
176
+ const chartDocument: PraxisXUiChartContract = {
177
+ version: '0.1.0',
178
+ kind: 'bar',
179
+ chartId: 'status-by-team',
180
+ sizing: {
181
+ mode: 'fill-container',
182
+ minHeight: 160,
183
+ },
184
+ theme: {
185
+ surface: {
186
+ mode: 'embedded',
187
+ },
188
+ },
189
+ source: { kind: 'derived' },
190
+ dimensions: [{ field: 'team' }],
191
+ metrics: [{ field: 'total', aggregation: 'count' }],
192
+ };
193
+ ```
194
+
195
+ Supported surface modes:
196
+
197
+ - `auto`: default; standalone charts use a contained neutral surface, while charts inside `WidgetShell` render embedded.
198
+ - `embedded`: no internal card chrome; use it for corporate dashboards where `WidgetShell` owns the card, header, border and fullscreen behavior.
199
+ - `contained`: the chart owns its visual surface; use it only for standalone chart placement outside a widget shell.
200
+
201
+ For enterprise dashboards, prefer `theme.surface.mode = "embedded"` or the
202
+ default `auto` inside `WidgetShell`. This avoids nested cards, duplicated
203
+ rounded corners and decorative gradients competing with operational data.
204
+
130
205
  ## Declarative Query Contract
131
206
 
132
207
  For dynamic pages and widget orchestration, the primary public input for remote chart queries is `queryContext`.
@@ -180,7 +255,7 @@ Leitura pedagógica:
180
255
  3. **Quando a fonte é remota, a integração canônica é `praxis.stats`**.
181
256
  4. **O chart renderiza estados de UX e a visualização final a partir de linhas canônicas**.
182
257
 
183
- ### Versão Detalhada e Fiel ao Runtime Atual
258
+ ### Versão Detalhada do Fluxo Canônico
184
259
 
185
260
  ```mermaid
186
261
  sequenceDiagram
@@ -215,21 +290,23 @@ sequenceDiagram
215
290
  end
216
291
  ```
217
292
 
218
- ### Limites Atuais do Contrato Canônico
293
+ ### Restrições do Contrato Canônico
219
294
 
220
- O mapper `x-ui.chart -> PraxisChartConfig` impõe limites importantes que precisam aparecer na documentação pública:
295
+ O mapper `x-ui.chart -> PraxisChartConfig` aplica as restrições públicas abaixo:
221
296
 
222
- - `source.kind` suportado hoje: `praxis.stats` e `derived`
297
+ - `source.kind` aceitos: `praxis.stats` e `derived`
223
298
  - `source.kind = "praxis.stats"` exige `source.resource` e `source.operation`
224
- - agregações suportadas: `count`, `sum`, `avg`, `min`, `max`
225
- - `distinct-count` ainda não está implementado
299
+ - agregações aceitas: `count`, `sum`, `avg`, `min`, `max`
300
+ - `distinct-count` não é uma agregação aceita por `@praxisui/charts`
226
301
  - charts `pie` e `donut` aceitam apenas uma métrica
227
302
  - charts cartesianos `praxis.stats` podem declarar múltiplas métricas apenas em `group-by` e `timeseries`
228
- - `distribution` continua single-métrica
303
+ - `distribution` aceita apenas uma métrica
229
304
  - `combo` exige pelo menos duas métricas e, no modo `praxis.stats`, suporta apenas `group-by` ou `timeseries`
230
305
  - `axis: "secondary"` é exclusivo de `combo`
231
- - `selectionChange` e `crossFilter` declarativos ainda não estão implementados
232
- - `theme.variant` e `theme.palette` por token ainda não estão implementados
306
+ - `selectionChange` e `crossFilter` declarativos não são ações aceitas por `@praxisui/charts`
307
+ - `theme.variant` aceita `default`, `compact` e `executive`
308
+ - `theme.palette` aceita array explícito de cores ou os tokens registrados `brand-primary`, `brand-balanced`, `status` e `executive`
309
+ - campos explícitos de `theme.surface` têm precedência sobre os defaults aplicados por `theme.variant`
233
310
 
234
311
  ## Fluxo Canonico de `praxis.stats`
235
312
 
@@ -248,9 +325,9 @@ O `PraxisChartStatsApiService`:
248
325
 
249
326
  Observação importante:
250
327
 
251
- - o runtime atual assume envelope com `data`
328
+ - a integração remota usa envelope com `data`
252
329
  - `queryRequest` é emitido para observabilidade do host antes da execução remota
253
- - a execução remota automática hoje está acoplada a `praxis.stats`; não existe ainda um hook público de override do request dentro do componente
330
+ - a execução remota automática é limitada a `praxis.stats`; o componente não expõe hook público de override do request
254
331
  - a trilha canônica `x-ui.chart -> PraxisChartConfig -> praxis.stats` já promove múltiplas métricas para charts cartesianos suportados; para evitar semântica enganosa, `combo` segue sendo o único caso com eixo secundário e mistura heterogênea de séries
255
332
 
256
333
  ## Current Scope
@@ -264,6 +341,7 @@ This first published version is focused on the core runtime:
264
341
  - remote execution focused on canonical `praxis.stats`
265
342
  - basic settings-panel-compatible authoring shell focused on canonical `x-ui.chart`
266
343
  - optional runtime edit affordance in `PraxisChartComponent` when `chartDocument` and a settings-panel bridge are available
344
+ - canonical theme variants and registered palette tokens for `x-ui.chart`
267
345
 
268
346
  ## Current Non-Goals
269
347
 
@@ -272,7 +350,6 @@ The current runtime does not yet expose as stable public surface:
272
350
  - direct host control over raw ECharts options as the primary contract
273
351
  - declarative cross-filter orchestration
274
352
  - declarative selectionChange runtime actions
275
- - palette token indirection or theme variants from `x-ui.chart`
276
353
 
277
354
  ## Notes for Hosts
278
355