@xenosystem/blocks 0.13.19 → 0.13.21

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.
@@ -241,6 +241,21 @@ declare class TableController {
241
241
  private snapshot;
242
242
  constructor(options: TableControllerOptions);
243
243
  /** Subscribe to state changes. Returns an unsubscribe function. */
244
+ /** The scroller's measured viewport — the view state windows rows AND columns from it (`table/Scroller` reports it). */
245
+ private viewport;
246
+ /** The scroller reports its viewport; the view state windows the grid from it. */
247
+ setViewport(viewport: {
248
+ width: number;
249
+ height: number;
250
+ scrollTop: number;
251
+ scrollLeft: number;
252
+ }): void;
253
+ getViewport(): {
254
+ width: number;
255
+ height: number;
256
+ scrollTop: number;
257
+ scrollLeft: number;
258
+ };
244
259
  subscribe: (listener: () => void) => (() => void);
245
260
  /** The current view snapshot (stable reference until something changes). */
246
261
  getState: () => TableViewState;
@@ -658,39 +673,199 @@ declare function constraintsOfColumn(column: {
658
673
  }): NumericConstraints;
659
674
 
660
675
  /**
661
- * The Table panel's React view — grid + pivot.
676
+ * The Table panel AS A DECLARATION — the twenty-first block written the §8d way, and the first
677
+ * GRID: rows AND columns windowed, frozen columns, an inline cell editor, and a cross-tab.
662
678
  *
663
- * **First real consumer of `@xenosystem/components/chrome`.** Everything that is chrome (toolbar,
664
- * status strip, empty/loading/error states, badges, icon buttons, segmented control) comes from the
665
- * primitives; only the grid body itself — which is the panel's actual job — is local.
679
+ * Presentation contract: input `view` (a {@link TableViewModel} the runtime derives from the
680
+ * controller on every draw — the result state decided, both windows computed from the viewport the
681
+ * controller holds, every header, row and cell as DATA), output `ui` (a {@link TableUiIntent})
682
+ * applied by the runtime to the controller's own methods.
666
683
  *
667
- * The view is deliberately thin: all state lives in {@link TableController}, bound through
668
- * `useSyncExternalStore`. Rendering is the only thing that happens here.
684
+ * The grid is the `chrome/Grid*` family: a sticky `GridHeader` of `GridHeaderCell`s, fixed-height
685
+ * `GridRow`s of `GridCell`s, a `GridSpacer` standing in for the columns windowed out to the left.
686
+ * Frozen columns come first in every row and are sticky at their own offset. The cell being edited
687
+ * holds a plain `chrome/Input` over the controller's own draft. The pivot is `chrome/PivotTable`
688
+ * rows flattened with their depth. Values are FORMATTED HERE, in the model — a cell aligns, it never
689
+ * formats.
669
690
  *
670
- * @module
691
+ * What a declaration cannot hold: the SCROLLER (`table/Scroller` — measured width and height, the
692
+ * scroll offsets both ways). The runtime registers it bound to its controller
693
+ * ({@link tableRuntimeComponents}).
671
694
  */
672
695
 
673
- /** Props for {@link TablePanelView}. */
674
- interface TablePanelViewProps {
675
- /** The controller. */
676
- controller: TableController;
696
+ /** The half of a renderer's config the view reads. */
697
+ interface TableViewOptions {
677
698
  /** Fixed row height in px (config `rowHeight`). */
678
699
  rowHeight?: number;
679
700
  /** Render the grand-totals footer. */
680
701
  showFooter?: boolean;
681
702
  /** Shade alternate rows. */
682
703
  zebra?: boolean;
683
- /**
684
- * Render a leading ordinal gutter.
685
- *
686
- * U5: the manifest declared this from day one and the view never rendered it — declared config
687
- * with no implementation. The numbers are 1-based over the CURRENT PAGE plus the query offset,
688
- * so row 1 of page 2 reads as its absolute position rather than restarting.
689
- */
704
+ /** Render a leading ordinal gutter — 1-based over the CURRENT PAGE plus the query offset. */
690
705
  showRowNumbers?: boolean;
691
706
  }
707
+ interface TableViewHeaderCell {
708
+ key: string;
709
+ columnId: string;
710
+ name: string;
711
+ width: number;
712
+ frozen: boolean;
713
+ offset: number;
714
+ sort: 'asc' | 'desc' | null;
715
+ sortAsc: boolean;
716
+ sortDesc: boolean;
717
+ sortable: boolean;
718
+ title: string;
719
+ }
720
+ interface TableViewCell {
721
+ key: string;
722
+ rowId: string;
723
+ columnId: string;
724
+ width: number;
725
+ align: 'left' | 'right' | 'center';
726
+ frozen: boolean;
727
+ offset: number;
728
+ editing: boolean;
729
+ draft: string;
730
+ text: string;
731
+ }
732
+ interface TableViewRow {
733
+ key: string;
734
+ id: string;
735
+ height: number;
736
+ width: number;
737
+ selected: boolean;
738
+ zebra: boolean;
739
+ hasGutter: boolean;
740
+ ordinal: string;
741
+ gutterWidth: number;
742
+ frozenCells: TableViewCell[];
743
+ cells: TableViewCell[];
744
+ }
745
+ interface TableViewPivotRow {
746
+ key: string;
747
+ label: string;
748
+ depth: number;
749
+ total: boolean;
750
+ cells: {
751
+ key: string;
752
+ text: string;
753
+ }[];
754
+ }
755
+ interface TableViewModel {
756
+ modes: {
757
+ label: string;
758
+ value: 'grid' | 'pivot';
759
+ }[];
760
+ mode: 'grid' | 'pivot';
761
+ partial: boolean;
762
+ loadingBadge: boolean;
763
+ prevDisabled: boolean;
764
+ nextDisabled: boolean;
765
+ idle: boolean;
766
+ failed: boolean;
767
+ failedTitle: string;
768
+ failedMessage?: string;
769
+ retryable: boolean;
770
+ failedNoRetry: boolean;
771
+ loading: boolean;
772
+ pivot: boolean;
773
+ pivotEmpty: boolean;
774
+ noRows: boolean;
775
+ grid: boolean;
776
+ width: number;
777
+ headerHeight: number;
778
+ frozenHeaders: TableViewHeaderCell[];
779
+ headers: TableViewHeaderCell[];
780
+ spacerWidth: number;
781
+ totalHeight: number;
782
+ offsetTop: number;
783
+ rows: TableViewRow[];
784
+ pivotHeads: {
785
+ key: string;
786
+ name: string;
787
+ }[];
788
+ pivotRows: TableViewPivotRow[];
789
+ footerShown: boolean;
790
+ countLabel: string;
791
+ selectedLabel?: string;
792
+ }
793
+ type TableUiIntent = {
794
+ kind: 'mode';
795
+ mode: 'grid' | 'pivot';
796
+ } | {
797
+ kind: 'prev';
798
+ } | {
799
+ kind: 'next';
800
+ } | {
801
+ kind: 'refresh';
802
+ } | {
803
+ kind: 'sort';
804
+ columnId: string;
805
+ shiftKey?: boolean;
806
+ } | {
807
+ kind: 'rowClick';
808
+ id: string;
809
+ ctrlKey?: boolean;
810
+ metaKey?: boolean;
811
+ } | {
812
+ kind: 'rowDouble';
813
+ id: string;
814
+ } | {
815
+ kind: 'cellDouble';
816
+ rowId: string;
817
+ columnId: string;
818
+ } | {
819
+ kind: 'draft';
820
+ value: string;
821
+ } | {
822
+ kind: 'editKey';
823
+ key: string;
824
+ } | {
825
+ kind: 'commitEdit';
826
+ };
827
+ /** Derive the view model from the live controller — the runtime calls this on every draw. */
828
+ declare function tableViewState(c: TableController, options?: TableViewOptions): TableViewModel;
829
+ /** Apply a `ui` intent to the controller — the runtime's half of the contract. */
830
+ declare function applyTableUi(c: TableController, intent: TableUiIntent): void;
831
+ declare const tableViewManifest: PanelManifest;
832
+ declare const BEHAVIOURS$4: {
833
+ 'data/tablePanelView': (inputs: Record<string, unknown>) => TableViewModel;
834
+ };
835
+ declare const TABLE_DECLARATION: BlockDeclaration;
836
+
837
+ /**
838
+ * The Table panel view — the CODE VIEW of `TABLE_DECLARATION`, drawing the same {@link TableViewModel}
839
+ * byte-identical (the equivalence suite holds the two together). The one runtime-bound unit is the
840
+ * scroller (`table/Scroller`: the viewport both windows are computed from); every other intent goes
841
+ * through `applyTableUi`.
842
+ *
843
+ * Composes `@xenosystem/components/chrome` — the grid family for the grid, the pivot family for the
844
+ * cross-tab; only the scroller is local.
845
+ *
846
+ * @module
847
+ */
848
+
849
+ /** Props for {@link TablePanelView}. */
850
+ interface TablePanelViewProps extends TableViewOptions {
851
+ /** The controller. */
852
+ controller: TableController;
853
+ }
692
854
  /** The Table panel view. */
693
- declare function TablePanelView({ controller, showRowNumbers, rowHeight, showFooter, zebra, }: TablePanelViewProps): ReactNode;
855
+ declare function TablePanelView({ controller, ...options }: TablePanelViewProps): ReactNode;
856
+ /**
857
+ * The scroller — `table/Scroller` in the declaration, bound to the controller: the viewport is
858
+ * MEASURED (ResizeObserver, sheets' Grid.tsx discipline), never assumed, so both windows are right
859
+ * on first paint and after every dock resize; the scroll offsets are reported both ways.
860
+ */
861
+ declare function TableScroller({ controller, children }: {
862
+ controller: TableController;
863
+ children?: ReactNode;
864
+ }): ReactNode;
865
+ /** The unit names the runtime supplies for this block — what a host's registry check must accept beside the shared families. */
866
+ declare const TABLE_RUNTIME_UNITS: readonly ["table/Scroller"];
867
+ /** The units the runtime registers for `TABLE_DECLARATION`, bound to ITS controller. */
868
+ declare function tableRuntimeComponents(controller: TableController): Record<(typeof TABLE_RUNTIME_UNITS)[number], React.ComponentType<any>>;
694
869
 
695
870
  /**
696
871
  * The `xeno.core.chart` contract.
@@ -3586,4 +3761,4 @@ interface ConnectorsPanelViewProps extends ConnectorsViewOptions {
3586
3761
  /** The Connectors panel view. */
3587
3762
  declare function ConnectorsPanelView({ controller, emptyHint }: ConnectorsPanelViewProps): ReactNode;
3588
3763
 
3589
- export { AGENT_HIDDEN_COMMANDS, ALL_AGGREGATES, ALL_CHART_TYPES, type BuildChartOptions, type BuildSelectOptions, type BuildSelectResult, BEHAVIOURS$3 as CHART_BEHAVIOURS, CHART_DECLARATION, CHART_EMPTY_FILL, CHART_PALETTE_STEPS, CHART_PANEL_ID, CHART_RUNTIME_UNITS, CHART_TYPE_LABELS, BEHAVIOURS as CONNECTORS_BEHAVIOURS, CONNECTORS_DECLARATION, CONNECTORS_PANEL_ID, CONNECTORS_RUNTIME_UNITS, type CellAddress, ChartController, type ChartControllerOptions, type ChartHostBridge, type ChartPanelState, ChartPanelView, type ChartPanelViewProps, ChartPlot, type ChartRenderContext, type ChartRenderInput, type ChartRenderOptions, type ChartRenderer, type ChartUiIntent, type ChartViewModel, type ChartViewOptions, type ChartViewState, type ColumnLayout, type ColumnWindow, ConnectorExecuteInput, ConnectorExecuteOutput, ConnectorTransport, ConnectorsController, type ConnectorsControllerOptions, type ConnectorsHostBridge, ConnectorsPanelState, ConnectorsPanelView, type ConnectorsPanelViewProps, type ConnectorsRenderContext, type ConnectorsUiIntent, type ConnectorsViewField, type ConnectorsViewModel, type ConnectorsViewOptions, type ConnectorsViewSource, ConnectorsViewState, type CreateChartPanelOptions, type CreateConnectorExecutorOptions, type CreateConnectorsPanelOptions, type CreateFieldsPanelOptions, type CreateMetricsPanelOptions, type CreateTablePanelOptions, type CredentialDraft, type CredentialErrors, DEFAULT_CHART_OPTIONS, DEFAULT_COLUMN_WIDTH, DEFAULT_PAGE_SIZE, DEFAULT_RANGES, type DeltaDirection, EMPTY_LAYOUT, EXPIRY_SKEW_MS, type ExecuteError, BEHAVIOURS$1 as FIELDS_BEHAVIOURS, FIELDS_DECLARATION, FIELDS_PANEL_ID, FIELDS_RUNTIME_UNITS, FieldsController, type FieldsControllerOptions, type FieldsHostBridge, type FieldsPanelState, FieldsPanelView, type FieldsPanelViewProps, type FieldsRenderContext, type FieldsUiIntent, type FieldsViewColumn, type FieldsViewEntry, type FieldsViewFilter, type FieldsViewModel, type FieldsViewOptions, type FieldsViewShelf, type FieldsViewState, type HostSqlResolver, IMPLEMENTED_VIEW_MODES, type LoopbackRequest, type LoopbackVerdict, BEHAVIOURS$2 as METRICS_BEHAVIOURS, METRICS_DECLARATION, METRICS_PANEL_ID, METRICS_RUNTIME_UNITS, MIN_COLUMN_WIDTH, MONO_FILL_PALETTE, MONO_PALETTE, MetricsController, type MetricsControllerOptions, type MetricsHostBridge, type MetricsPanelState, MetricsPanelView, type MetricsPanelViewProps, type MetricsRenderContext, type MetricsUiIntent, type MetricsViewModel, type MetricsViewOptions, type MetricsViewState, type MetricsViewTile, type NumericConstraints, type OAuthStateRecord, type OAuthStateStore, type OAuthStateStoreOptions, type ParseCsvOptions, type ParseResult, type ParsedCsv, type PkcePair, PushdownSplit, type RefreshCoordinator, type ResolvedColumn, SHELF_PRESETS, type StoredOAuthToken, SubstrateFacilities, TABLE_PANEL_ID, TableController, type TableControllerOptions, type TableHostBridge, type TablePanelState, TablePanelView, type TablePanelViewProps, type TableRenderContext, type TableViewMode, type TableViewState, type TokenEndpointResponse, type VirtualWindow, type XenoAlertLevel, type XenoCalculatedFieldRequest, type XenoCellEdit, type XenoChartData, type XenoChartDrillDown, type XenoChartEncoding, type XenoChartExportRequest, type XenoChartHighlight, type XenoChartSeries, type XenoChartType, XenoConnection, XenoConnectionStatus, XenoConnectorFetch, XenoConnectorFileReader, XenoConnectorQueryRequest, XenoCredentialField, XenoCredentialFormSpec, XenoCredentialResult, type XenoFieldStat, type XenoMetricAlert, type XenoMetricRange, type XenoMetricSpec, type XenoMetricThreshold, type XenoMetricValue, XenoResolverErrorCode, XenoRestPaging, type XenoRowActivate, type XenoShelfEntry, type XenoShelfSpec, XenoSqlEngine, applyChartUi, applyConnectorsUi, applyFieldsUi, applyMetricsUi, applyPrecision, base64Url, breachSideOf, buildChartData, buildRestUrl, buildSelect, chartManifest, chartPanel, chartRuntimeComponents, chartViewManifest, chartViewState, clamp, classifyHttpStatus, coerceCsvValues, columnIndexAt, columnsOf, compileForHost, computeColumnWindow, computeWindow, connectorsManifest, connectorsPanel, connectorsViewManifest, connectorsViewState, constraintsOfColumn, createChartPanel, createConnectorExecutor, createConnectorsPanel, createFieldsPanel, createMetricsPanel, createOAuthStateStore, createPkcePair, createRefreshCoordinator, createTablePanel, credentialSpecProblem, defaultAggregateFor, defaultEncoding, deltaToneOf, emptyFilterGroup, entityOf, escapeLikePattern, executeCsvFile, executeDuckDb, executeGraphql, executeJsonFile, executeRest, executeSql, extractJsonPath, extractRows, fieldsManifest, fieldsPanel, fieldsViewManifest, fieldsViewState, firstGraphqlError, frozenWidth, getChartRenderer, isCategorical, isFieldVisible, isFilled, isLeafFilter, isLoopbackHost, isSafeTableName, mergeRefreshResponse, metricsManifest, metricsPanel, metricsViewManifest, metricsViewState, moveCell, moveColumn, needsRefresh, nextPageToken, normalizeLayout, normalizeNumeric, offerableAggregates, offerableFilterOps, parseCsv, parseJsonBody, parseJsonPath, parseLinkHeader, parseNumeric, pruneHiddenValues, queriesEqual, quoteIdent, quoteLiteral, redirectUriFor, renderFilterGroup, resolveChartColors, resolveColumns, rowsForMark, scrollLeftToReveal, scrollTopToReveal, setChartRenderer, setColumnVisible, setColumnWidth, setFrozenCount, sniffDelimiter, suggestedShelfFor, tableManifest, tablePanel, toChartJsConfig, toExecuteError, totalWidth, uniqueTableName, unsupportedMessage, validateCredentialDraft, validateEncoding, validateLoopbackRequest, visibleFields };
3764
+ export { AGENT_HIDDEN_COMMANDS, ALL_AGGREGATES, ALL_CHART_TYPES, type BuildChartOptions, type BuildSelectOptions, type BuildSelectResult, BEHAVIOURS$3 as CHART_BEHAVIOURS, CHART_DECLARATION, CHART_EMPTY_FILL, CHART_PALETTE_STEPS, CHART_PANEL_ID, CHART_RUNTIME_UNITS, CHART_TYPE_LABELS, BEHAVIOURS as CONNECTORS_BEHAVIOURS, CONNECTORS_DECLARATION, CONNECTORS_PANEL_ID, CONNECTORS_RUNTIME_UNITS, type CellAddress, ChartController, type ChartControllerOptions, type ChartHostBridge, type ChartPanelState, ChartPanelView, type ChartPanelViewProps, ChartPlot, type ChartRenderContext, type ChartRenderInput, type ChartRenderOptions, type ChartRenderer, type ChartUiIntent, type ChartViewModel, type ChartViewOptions, type ChartViewState, type ColumnLayout, type ColumnWindow, ConnectorExecuteInput, ConnectorExecuteOutput, ConnectorTransport, ConnectorsController, type ConnectorsControllerOptions, type ConnectorsHostBridge, ConnectorsPanelState, ConnectorsPanelView, type ConnectorsPanelViewProps, type ConnectorsRenderContext, type ConnectorsUiIntent, type ConnectorsViewField, type ConnectorsViewModel, type ConnectorsViewOptions, type ConnectorsViewSource, ConnectorsViewState, type CreateChartPanelOptions, type CreateConnectorExecutorOptions, type CreateConnectorsPanelOptions, type CreateFieldsPanelOptions, type CreateMetricsPanelOptions, type CreateTablePanelOptions, type CredentialDraft, type CredentialErrors, DEFAULT_CHART_OPTIONS, DEFAULT_COLUMN_WIDTH, DEFAULT_PAGE_SIZE, DEFAULT_RANGES, type DeltaDirection, EMPTY_LAYOUT, EXPIRY_SKEW_MS, type ExecuteError, BEHAVIOURS$1 as FIELDS_BEHAVIOURS, FIELDS_DECLARATION, FIELDS_PANEL_ID, FIELDS_RUNTIME_UNITS, FieldsController, type FieldsControllerOptions, type FieldsHostBridge, type FieldsPanelState, FieldsPanelView, type FieldsPanelViewProps, type FieldsRenderContext, type FieldsUiIntent, type FieldsViewColumn, type FieldsViewEntry, type FieldsViewFilter, type FieldsViewModel, type FieldsViewOptions, type FieldsViewShelf, type FieldsViewState, type HostSqlResolver, IMPLEMENTED_VIEW_MODES, type LoopbackRequest, type LoopbackVerdict, BEHAVIOURS$2 as METRICS_BEHAVIOURS, METRICS_DECLARATION, METRICS_PANEL_ID, METRICS_RUNTIME_UNITS, MIN_COLUMN_WIDTH, MONO_FILL_PALETTE, MONO_PALETTE, MetricsController, type MetricsControllerOptions, type MetricsHostBridge, type MetricsPanelState, MetricsPanelView, type MetricsPanelViewProps, type MetricsRenderContext, type MetricsUiIntent, type MetricsViewModel, type MetricsViewOptions, type MetricsViewState, type MetricsViewTile, type NumericConstraints, type OAuthStateRecord, type OAuthStateStore, type OAuthStateStoreOptions, type ParseCsvOptions, type ParseResult, type ParsedCsv, type PkcePair, PushdownSplit, type RefreshCoordinator, type ResolvedColumn, SHELF_PRESETS, type StoredOAuthToken, SubstrateFacilities, BEHAVIOURS$4 as TABLE_BEHAVIOURS, TABLE_DECLARATION, TABLE_PANEL_ID, TABLE_RUNTIME_UNITS, TableController, type TableControllerOptions, type TableHostBridge, type TablePanelState, TablePanelView, type TablePanelViewProps, type TableRenderContext, TableScroller, type TableUiIntent, type TableViewCell, type TableViewHeaderCell, type TableViewMode, type TableViewModel, type TableViewOptions, type TableViewPivotRow, type TableViewRow, type TableViewState, type TokenEndpointResponse, type VirtualWindow, type XenoAlertLevel, type XenoCalculatedFieldRequest, type XenoCellEdit, type XenoChartData, type XenoChartDrillDown, type XenoChartEncoding, type XenoChartExportRequest, type XenoChartHighlight, type XenoChartSeries, type XenoChartType, XenoConnection, XenoConnectionStatus, XenoConnectorFetch, XenoConnectorFileReader, XenoConnectorQueryRequest, XenoCredentialField, XenoCredentialFormSpec, XenoCredentialResult, type XenoFieldStat, type XenoMetricAlert, type XenoMetricRange, type XenoMetricSpec, type XenoMetricThreshold, type XenoMetricValue, XenoResolverErrorCode, XenoRestPaging, type XenoRowActivate, type XenoShelfEntry, type XenoShelfSpec, XenoSqlEngine, applyChartUi, applyConnectorsUi, applyFieldsUi, applyMetricsUi, applyPrecision, applyTableUi, base64Url, breachSideOf, buildChartData, buildRestUrl, buildSelect, chartManifest, chartPanel, chartRuntimeComponents, chartViewManifest, chartViewState, clamp, classifyHttpStatus, coerceCsvValues, columnIndexAt, columnsOf, compileForHost, computeColumnWindow, computeWindow, connectorsManifest, connectorsPanel, connectorsViewManifest, connectorsViewState, constraintsOfColumn, createChartPanel, createConnectorExecutor, createConnectorsPanel, createFieldsPanel, createMetricsPanel, createOAuthStateStore, createPkcePair, createRefreshCoordinator, createTablePanel, credentialSpecProblem, defaultAggregateFor, defaultEncoding, deltaToneOf, emptyFilterGroup, entityOf, escapeLikePattern, executeCsvFile, executeDuckDb, executeGraphql, executeJsonFile, executeRest, executeSql, extractJsonPath, extractRows, fieldsManifest, fieldsPanel, fieldsViewManifest, fieldsViewState, firstGraphqlError, frozenWidth, getChartRenderer, isCategorical, isFieldVisible, isFilled, isLeafFilter, isLoopbackHost, isSafeTableName, mergeRefreshResponse, metricsManifest, metricsPanel, metricsViewManifest, metricsViewState, moveCell, moveColumn, needsRefresh, nextPageToken, normalizeLayout, normalizeNumeric, offerableAggregates, offerableFilterOps, parseCsv, parseJsonBody, parseJsonPath, parseLinkHeader, parseNumeric, pruneHiddenValues, queriesEqual, quoteIdent, quoteLiteral, redirectUriFor, renderFilterGroup, resolveChartColors, resolveColumns, rowsForMark, scrollLeftToReveal, scrollTopToReveal, setChartRenderer, setColumnVisible, setColumnWidth, setFrozenCount, sniffDelimiter, suggestedShelfFor, tableManifest, tablePanel, tableRuntimeComponents, tableViewManifest, tableViewState, toChartJsConfig, toExecuteError, totalWidth, uniqueTableName, unsupportedMessage, validateCredentialDraft, validateEncoding, validateLoopbackRequest, visibleFields };