@barqjs/table 0.0.0-stage → 0.2.0-next.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Salama Ashoush
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,244 @@
1
- # Temporary Holding Version
1
+ # @barqjs/table
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Headless tables for barq: `createTable`, `FlexRender` and `createTableHook`
4
+ over `@tanstack/table-core` 9, the engine of
5
+ [TanStack Table](https://tanstack.com/table). The API follows
6
+ `@tanstack/solid-table`, with the differences listed below.
7
+
8
+ Table state, row models and column APIs are tracked reads. Call one inside JSX,
9
+ `createMemo` or an effect and that computation follows the slice it read: a
10
+ header that reads `column.getIsSorted()` updates when sorting changes and is
11
+ left alone when the page index does.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ bun add @barqjs/table
17
+ ```
18
+
19
+ `@barqjs/core` and `@barqjs/web` are peer dependencies. `@tanstack/table-core` and
20
+ `@tanstack/store` come with the package, and everything table-core exports is
21
+ re-exported from `@barqjs/table`, so an application imports from one place.
22
+
23
+ ## Example
24
+
25
+ ```tsx
26
+ import { For, createSignal } from "@barqjs/core";
27
+ import {
28
+ type Cell,
29
+ type ColumnDef,
30
+ type Header,
31
+ type HeaderGroup,
32
+ type Row,
33
+ type SortingState,
34
+ FlexRender,
35
+ createFilteredRowModel,
36
+ createPaginatedRowModel,
37
+ createSortedRowModel,
38
+ createTable,
39
+ filterFns,
40
+ globalFilteringFeature,
41
+ columnFilteringFeature,
42
+ rowPaginationFeature,
43
+ rowSortingFeature,
44
+ sortFns,
45
+ tableFeatures,
46
+ } from "@barqjs/table";
47
+
48
+ type Person = { id: string; name: string; email: string; age: number };
49
+
50
+ const features = tableFeatures({
51
+ columnFilteringFeature,
52
+ globalFilteringFeature,
53
+ rowPaginationFeature,
54
+ rowSortingFeature,
55
+ filteredRowModel: createFilteredRowModel(),
56
+ paginatedRowModel: createPaginatedRowModel(),
57
+ sortedRowModel: createSortedRowModel(),
58
+ filterFns,
59
+ sortFns,
60
+ });
61
+
62
+ type Features = typeof features;
63
+
64
+ const columns: Array<ColumnDef<Features, Person>> = [
65
+ { accessorKey: "name", header: "Name" },
66
+ {
67
+ accessorKey: "email",
68
+ header: "Email",
69
+ cell: (context) => (
70
+ <a href={`mailto:${context.getValue<string>()}`}>{context.getValue<string>()}</a>
71
+ ),
72
+ },
73
+ { accessorKey: "age", header: "Age", footer: "years" },
74
+ ];
75
+
76
+ const people: Person[] = [
77
+ { id: "1", name: "salama", email: "salama@example.com", age: 30 },
78
+ { id: "2", name: "ada", email: "ada@example.com", age: 40 },
79
+ ];
80
+
81
+ export function People() {
82
+ const [sorting, setSorting] = createSignal<SortingState>([]);
83
+
84
+ const table = createTable(() => ({
85
+ features,
86
+ columns,
87
+ data: people,
88
+ getRowId: (row: Person) => row.id,
89
+ state: { sorting: sorting() },
90
+ onSortingChange: setSorting,
91
+ initialState: { pagination: { pageIndex: 0, pageSize: 20 } },
92
+ }));
93
+
94
+ return (
95
+ <div>
96
+ <input
97
+ placeholder="Search"
98
+ onInput={(event) => table.setGlobalFilter(event.currentTarget.value)}
99
+ />
100
+ <table>
101
+ <thead>
102
+ <For each={table.getHeaderGroups()}>
103
+ {(group: HeaderGroup<Features, Person>) => (
104
+ <tr>
105
+ <For each={group.headers}>
106
+ {(header: Header<Features, Person>) => (
107
+ <th onClick={header.column.getToggleSortingHandler()}>
108
+ <FlexRender header={header} />
109
+ {header.column.getIsSorted() || ""}
110
+ </th>
111
+ )}
112
+ </For>
113
+ </tr>
114
+ )}
115
+ </For>
116
+ </thead>
117
+ <tbody>
118
+ <For each={table.getRowModel().rows}>
119
+ {(row: Row<Features, Person>) => (
120
+ <tr>
121
+ <For each={row.getAllCells()}>
122
+ {(cell: Cell<Features, Person>) => (
123
+ <td>
124
+ <FlexRender cell={cell} />
125
+ </td>
126
+ )}
127
+ </For>
128
+ </tr>
129
+ )}
130
+ </For>
131
+ </tbody>
132
+ </table>
133
+ <button
134
+ type="button"
135
+ disabled={!table.getCanPreviousPage()}
136
+ onClick={() => table.previousPage()}
137
+ >
138
+ Previous
139
+ </button>
140
+ <span>{`${table.atoms.pagination.get().pageIndex + 1} of ${table.getPageCount()}`}</span>
141
+ <button type="button" disabled={!table.getCanNextPage()} onClick={() => table.nextPage()}>
142
+ Next
143
+ </button>
144
+ </div>
145
+ );
146
+ }
147
+ ```
148
+
149
+ `<For>` keys by identity unless told otherwise, and table-core keeps a row
150
+ object for as long as the data it came from, so a sort, a filter or a page
151
+ change moves the `<tr>` elements that stay and builds only the ones that arrive.
152
+ When `data` is replaced wholesale, key by id to keep the rows across it:
153
+ `<For each={table.getRowModel().rows} keyed={(row) => row.id}>` with
154
+ `{(row) => <tr>{row().original.name}</tr>}`.
155
+
156
+ ## API
157
+
158
+ - `createTable(options)` returns the table-core `Table` plus `table.FlexRender`.
159
+ `options` is an accessor (`() => ({ data: rows(), state: { sorting: sorting() } })`),
160
+ re-applied when anything it reads changes, or a plain options object. A
161
+ getter on an options object (`get data() { return rows() }`) is read live.
162
+ The table belongs to the owner it is created under and releases its
163
+ subscriptions when that owner is disposed.
164
+ - `<FlexRender cell={cell} />`, `<FlexRender header={header} />`,
165
+ `<FlexRender footer={footer} />` render the column's template for that
166
+ position. With the grouping feature registered, an aggregated cell renders
167
+ `aggregatedCell` and a placeholder cell renders nothing.
168
+ - `flexRender(template, context)` is the function form, for
169
+ `{flexRender(cell.column.columnDef.cell, cell.getContext())}`.
170
+ - `createTableHook({ features, tableComponents, cellComponents, headerComponents, ...defaults })`
171
+ returns `createAppTable`, `createAppColumnHelper`, `useTableContext`,
172
+ `useCellContext`, `useHeaderContext` and `appFeatures`. A table made by
173
+ `createAppTable` adds `AppTable`, `AppCell`, `AppHeader`, `AppFooter` and the
174
+ registered table components; inside `AppCell` and `AppHeader` the cell or
175
+ header carries `FlexRender` and the registered components.
176
+ - Everything `@tanstack/table-core` exports: `tableFeatures`, `stockFeatures`,
177
+ each feature (`rowSortingFeature`, `columnFilteringFeature`, ...), each row
178
+ model factory (`createSortedRowModel`, `createFilteredRowModel`,
179
+ `createPaginatedRowModel`, `createGroupedRowModel`, `createExpandedRowModel`,
180
+ `createFacetedRowModel`, `createFacetedUniqueValues`,
181
+ `createFacetedMinMaxValues`), the `sortFns`, `filterFns` and `aggregationFns`
182
+ registries, `createColumnHelper`, and the types.
183
+ - `options.atoms` takes atoms made with `createAtom` from `@tanstack/store`, at
184
+ the version this package depends on: an atom from a second copy of the store
185
+ is not tracked.
186
+ - Sub-entries, as in the Solid adapter: `@barqjs/table/static-functions`,
187
+ `@barqjs/table/flex-render`, `@barqjs/table/experimental-worker-plugin`.
188
+
189
+ Every table option, feature and row model is TanStack's: see the
190
+ [TanStack Table documentation](https://tanstack.com/table/latest).
191
+
192
+ ## Templates
193
+
194
+ A template function is called once per cell, untracked, like a component body.
195
+ What it returns is what stays live: markup with reactive holes, or a function.
196
+
197
+ ```tsx
198
+ const columns: Array<ColumnDef<Features, Person>> = [
199
+ { accessorKey: "name", cell: (context) => <Avatar name={context.getValue<string>()} /> },
200
+ { accessorKey: "age", cell: (context) => () => `${context.getValue<number>()} ${unit()}` },
201
+ ];
202
+ ```
203
+
204
+ ## Reading state in JSX
205
+
206
+ The barq compiler wraps a JSX expression that contains a call or a member read,
207
+ so table APIs and the state getters all update where they are rendered:
208
+
209
+ ```tsx
210
+ <span>{table.getPageCount()}</span>
211
+ <span>{table.atoms.pagination.get().pageIndex}</span>
212
+ <span>{table.store.state.pagination.pageIndex}</span>
213
+ ```
214
+
215
+ An array literal built inline for `each` is a value evaluated once, so wrap it:
216
+ `<For each={() => [...column.getFacetedUniqueValues().entries()]}>`.
217
+
218
+ ## Writes and controlled state
219
+
220
+ Table state lives in TanStack Store atoms, so a write is readable on the next
221
+ line: `table.setPageSize(20)` followed by `table.getPageCount()` sees the new
222
+ size. The DOM follows at the next `flush()`, which barq schedules on a
223
+ microtask.
224
+
225
+ A controlled slice (`state` plus `onSortingChange`) held in a barq signal
226
+ follows the signal: `table.setSorting(next)` calls the handler, the signal
227
+ write is staged, and `table.atoms.sorting.get()` shows it after the flush.
228
+
229
+ ## Differences from `@tanstack/solid-table`
230
+
231
+ - Options are an accessor first. The Solid shape, an object with getters, is
232
+ also accepted.
233
+ - Table atoms are TanStack Store atoms with a barq version signal beside each,
234
+ not framework signals. An external atom passed through `options.atoms` is
235
+ read directly instead of being wrapped and synced both ways.
236
+ - `table.Subscribe`, deprecated in the Solid adapter, is not provided. Read
237
+ `table.atoms` or any table API in a tracking scope.
238
+ - `createTableHook` takes a fifth type parameter, `TRow`, inferred from default
239
+ options that take a row (`getRowId: (row: Person) => row.id`). It bounds the
240
+ row type of `createAppTable` and `createAppColumnHelper`. Upstream types those
241
+ defaults against `any`.
242
+ - `useCellContext()` and `useHeaderContext()` type their row as `RowData`,
243
+ where upstream has `any`.
244
+ - `AppTableComponent` takes no type parameter.
@@ -0,0 +1,53 @@
1
+ import { createMemo, untrack } from "@barqjs/core";
2
+ //#region src/FlexRender.ts
3
+ /**
4
+ * Renders a column template with its context: a function is called with the
5
+ * context, anything else is rendered as it is.
6
+ *
7
+ * The template runs untracked, as a component body does. What it reads while
8
+ * building is read once; a hole inside the markup it returns (or a function it
9
+ * returns) is what stays live.
10
+ */
11
+ function flexRender(Comp, props) {
12
+ if (Comp === null || Comp === void 0) return null;
13
+ if (typeof Comp === "function") return untrack(() => Comp(props));
14
+ return Comp;
15
+ }
16
+ const NORMAL = 0;
17
+ const AGGREGATED = 1;
18
+ const PLACEHOLDER = 2;
19
+ function renderSlots(props) {
20
+ const readCell = props.cell;
21
+ const mode = readCell === void 0 ? void 0 : createMemo(() => {
22
+ const cell = readCell();
23
+ if (cell === void 0) return NORMAL;
24
+ if (cell.getIsAggregated?.() === true) return AGGREGATED;
25
+ if (cell.getIsPlaceholder?.() === true) return PLACEHOLDER;
26
+ return NORMAL;
27
+ });
28
+ return createMemo(() => {
29
+ const cell = readCell?.();
30
+ if (cell) {
31
+ const current = mode?.() ?? NORMAL;
32
+ if (current === PLACEHOLDER) return null;
33
+ const def = cell.column.columnDef;
34
+ return flexRender(current === AGGREGATED ? def.aggregatedCell ?? def.cell : def.cell, cell.getContext());
35
+ }
36
+ const header = props.header?.();
37
+ if (header) return flexRender(header.column.columnDef.header, header.getContext());
38
+ const footer = props.footer?.();
39
+ if (footer) return flexRender(footer.column.columnDef.footer, footer.getContext());
40
+ return null;
41
+ });
42
+ }
43
+ /**
44
+ * `<FlexRender cell={cell} />`, `<FlexRender header={header} />` or
45
+ * `<FlexRender footer={footer} />`: the column's template for that position.
46
+ *
47
+ * With the grouping feature registered a cell renders `aggregatedCell` while it
48
+ * is aggregated and nothing while it is a placeholder, and switches when the
49
+ * grouping changes.
50
+ */
51
+ const FlexRender = renderSlots;
52
+ //#endregion
53
+ export { flexRender as n, renderSlots as r, FlexRender as t };
@@ -0,0 +1,36 @@
1
+ import { Cell, CellData, Header, RowData, TableFeatures } from "@tanstack/table-core";
2
+ import { JSXElement } from "@barqjs/core";
3
+ //#region src/FlexRender.d.ts
4
+ /**
5
+ * Renders a column template with its context: a function is called with the
6
+ * context, anything else is rendered as it is.
7
+ *
8
+ * The template runs untracked, as a component body does. What it reads while
9
+ * building is read once; a hole inside the markup it returns (or a function it
10
+ * returns) is what stays live.
11
+ */
12
+ declare function flexRender<TProps>(Comp: ((props: TProps) => JSXElement) | JSXElement | undefined, props: TProps): JSXElement;
13
+ type FlexRenderProps<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = {
14
+ cell: Cell<TFeatures, TData, TValue>;
15
+ header?: never;
16
+ footer?: never;
17
+ } | {
18
+ header: Header<TFeatures, TData, TValue>;
19
+ cell?: never;
20
+ footer?: never;
21
+ } | {
22
+ footer: Header<TFeatures, TData, TValue>;
23
+ cell?: never;
24
+ header?: never;
25
+ };
26
+ /**
27
+ * `<FlexRender cell={cell} />`, `<FlexRender header={header} />` or
28
+ * `<FlexRender footer={footer} />`: the column's template for that position.
29
+ *
30
+ * With the grouping feature registered a cell renders `aggregatedCell` while it
31
+ * is aggregated and nothing while it is a placeholder, and switches when the
32
+ * grouping changes.
33
+ */
34
+ declare const FlexRender: <TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(props: FlexRenderProps<TFeatures, TData, TValue>) => JSXElement;
35
+ //#endregion
36
+ export { FlexRenderProps as n, flexRender as r, FlexRender as t };
@@ -0,0 +1 @@
1
+ export * from "@tanstack/table-core/experimental-worker-plugin";
@@ -0,0 +1,2 @@
1
+ export * from "@tanstack/table-core/experimental-worker-plugin";
2
+ export {};
@@ -0,0 +1,2 @@
1
+ import { n as FlexRenderProps, r as flexRender, t as FlexRender } from "./FlexRender-DRdo5LUP.js";
2
+ export { FlexRender, type FlexRenderProps, flexRender };
@@ -0,0 +1 @@
1
+ export { t as FlexRender, n as flexRender } from "./FlexRender-CdwT-Pu7.js";
@@ -0,0 +1,131 @@
1
+ import { n as FlexRenderProps, r as flexRender, t as FlexRender } from "./FlexRender-DRdo5LUP.js";
2
+ import { AccessorFn, AccessorFnColumnDef, AccessorKeyColumnDef, Cell, CellContext, CellData, Column, ColumnDef, ColumnHelper, DeepKeys, DeepValue, DisplayColumnDef, GroupColumnDef, Header, IdentifiedColumnDef, NoInfer, Row, RowData, Table, TableFeatures, TableOptions } from "@tanstack/table-core";
3
+ import { JSXElement } from "@barqjs/core";
4
+ export * from "@tanstack/table-core";
5
+ //#region src/createTable.d.ts
6
+ type BarqTable<TFeatures extends TableFeatures, TData extends RowData> = Table<TFeatures, TData> & {
7
+ /** `<table.FlexRender cell={cell} />`, the same component `FlexRender` is. */
8
+ FlexRender: typeof FlexRender;
9
+ };
10
+ /** Options as they are, or an accessor that is re-applied when what it reads changes. */
11
+ type MaybeAccessor<T> = T | (() => T);
12
+ /**
13
+ * Creates a table whose APIs and atoms are tracked reads: call them inside JSX,
14
+ * `createMemo` or an effect and that computation follows the slice it read.
15
+ *
16
+ * Pass the options as an accessor to make them reactive. An options object is
17
+ * also accepted, and a getter on it (`get data() { return rows() }`) is read
18
+ * live, the way the Solid adapter's options are.
19
+ */
20
+ export declare function createTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: MaybeAccessor<TableOptions<TFeatures, TData>>): BarqTable<TFeatures, TData>;
21
+ //#endregion
22
+ //#region src/createTableHook.d.ts
23
+ export type ComponentType<TProps> = (props: TProps) => JSXElement;
24
+ type Components = Record<string, ComponentType<never>>;
25
+ export type AppCellContext<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData, TCellComponents extends Components> = {
26
+ cell: Cell<TFeatures, TData, TValue> & TCellComponents & {
27
+ FlexRender: () => JSXElement;
28
+ };
29
+ column: Column<TFeatures, TData, TValue>;
30
+ getValue: CellContext<TFeatures, TData, TValue>["getValue"];
31
+ renderValue: CellContext<TFeatures, TData, TValue>["renderValue"];
32
+ row: Row<TFeatures, TData>;
33
+ table: Table<TFeatures, TData>;
34
+ };
35
+ export type AppHeaderContext<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData, THeaderComponents extends Components> = {
36
+ column: Column<TFeatures, TData, TValue>;
37
+ header: Header<TFeatures, TData, TValue> & THeaderComponents & {
38
+ FlexRender: () => JSXElement;
39
+ };
40
+ table: Table<TFeatures, TData>;
41
+ };
42
+ export type AppColumnDefTemplate<TProps extends object> = string | ((props: TProps) => unknown);
43
+ export type AppColumnDefBase<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData, TCellComponents extends Components, THeaderComponents extends Components> = Omit<IdentifiedColumnDef<TFeatures, TData, TValue>, "cell" | "header" | "footer"> & {
44
+ cell?: AppColumnDefTemplate<AppCellContext<TFeatures, TData, TValue, TCellComponents>>;
45
+ header?: AppColumnDefTemplate<AppHeaderContext<TFeatures, TData, TValue, THeaderComponents>>;
46
+ footer?: AppColumnDefTemplate<AppHeaderContext<TFeatures, TData, TValue, THeaderComponents>>;
47
+ };
48
+ export type AppDisplayColumnDef<TFeatures extends TableFeatures, TData extends RowData, TCellComponents extends Components, THeaderComponents extends Components> = Omit<DisplayColumnDef<TFeatures, TData>, "cell" | "header" | "footer"> & {
49
+ cell?: AppColumnDefTemplate<AppCellContext<TFeatures, TData, unknown, TCellComponents>>;
50
+ header?: AppColumnDefTemplate<AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>>;
51
+ footer?: AppColumnDefTemplate<AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>>;
52
+ };
53
+ export type AppGroupColumnDef<TFeatures extends TableFeatures, TData extends RowData, TCellComponents extends Components, THeaderComponents extends Components> = Omit<GroupColumnDef<TFeatures, TData>, "cell" | "header" | "footer" | "columns"> & {
54
+ cell?: AppColumnDefTemplate<AppCellContext<TFeatures, TData, unknown, TCellComponents>>;
55
+ header?: AppColumnDefTemplate<AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>>;
56
+ footer?: AppColumnDefTemplate<AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>>;
57
+ columns?: ReadonlyArray<ColumnDef<TFeatures, TData>>;
58
+ };
59
+ export type AppColumnHelper<TFeatures extends TableFeatures, TData extends RowData, TCellComponents extends Components, THeaderComponents extends Components> = {
60
+ accessor: <TAccessor extends AccessorFn<TData> | DeepKeys<TData>, TValue extends (TAccessor extends AccessorFn<TData, infer TReturn> ? TReturn : TAccessor extends DeepKeys<TData> ? DeepValue<TData, TAccessor> : never)>(accessor: TAccessor, column: TAccessor extends AccessorFn<TData> ? AppColumnDefBase<TFeatures, TData, TValue, TCellComponents, THeaderComponents> & {
61
+ id: string;
62
+ } : AppColumnDefBase<TFeatures, TData, TValue, TCellComponents, THeaderComponents>) => TAccessor extends AccessorFn<TData> ? AccessorFnColumnDef<TFeatures, TData, TValue> : AccessorKeyColumnDef<TFeatures, TData, TValue>;
63
+ columns: ColumnHelper<TFeatures, TData>["columns"];
64
+ display: (column: AppDisplayColumnDef<TFeatures, TData, TCellComponents, THeaderComponents>) => DisplayColumnDef<TFeatures, TData>;
65
+ group: (column: AppGroupColumnDef<TFeatures, TData, TCellComponents, THeaderComponents>) => GroupColumnDef<TFeatures, TData>;
66
+ };
67
+ /**
68
+ * `TRow` is inferred from the default options that take a row, such as
69
+ * `getRowId: (row: Person) => row.id`, and bounds the row type of every table
70
+ * the hook makes. With no such option it is `RowData` and bounds nothing.
71
+ */
72
+ export type CreateTableHookOptions<TFeatures extends TableFeatures, TTableComponents extends Components, TCellComponents extends Components, THeaderComponents extends Components, TRow extends RowData = RowData> = Omit<TableOptions<TFeatures, TRow>, "columns" | "data" | "store" | "state" | "initialState"> & {
73
+ /** Reached as `table.Name` on a table made by `createAppTable`. */
74
+ tableComponents?: TTableComponents;
75
+ /** Reached as `cell.Name` inside `AppCell` and in a column's `cell` template. */
76
+ cellComponents?: TCellComponents;
77
+ /** Reached as `header.Name` inside `AppHeader`/`AppFooter` and in a column's templates. */
78
+ headerComponents?: THeaderComponents;
79
+ };
80
+ export interface AppTableProps {
81
+ children: JSXElement;
82
+ }
83
+ export interface AppCellProps<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData, TCellComponents extends Components> {
84
+ cell: Cell<TFeatures, TData, TValue>;
85
+ children: (cell: Cell<TFeatures, TData, TValue> & TCellComponents & {
86
+ FlexRender: () => JSXElement;
87
+ }) => JSXElement;
88
+ }
89
+ export interface AppHeaderProps<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData, THeaderComponents extends Components> {
90
+ header: Header<TFeatures, TData, TValue>;
91
+ children: (header: Header<TFeatures, TData, TValue> & THeaderComponents & {
92
+ FlexRender: () => JSXElement;
93
+ }) => JSXElement;
94
+ }
95
+ export interface AppCellComponent<TFeatures extends TableFeatures, TData extends RowData, TCellComponents extends Components> {
96
+ <TValue extends CellData = CellData>(props: AppCellProps<TFeatures, TData, TValue, TCellComponents>): JSXElement;
97
+ }
98
+ export interface AppHeaderComponent<TFeatures extends TableFeatures, TData extends RowData, THeaderComponents extends Components> {
99
+ <TValue extends CellData = CellData>(props: AppHeaderProps<TFeatures, TData, TValue, THeaderComponents>): JSXElement;
100
+ }
101
+ export type AppTableComponent = (props: AppTableProps) => JSXElement;
102
+ export type AppBarqTable<TFeatures extends TableFeatures, TData extends RowData, TTableComponents extends Components, TCellComponents extends Components, THeaderComponents extends Components> = BarqTable<TFeatures, TData> & NoInfer<TTableComponents> & {
103
+ /** Provides the table to `useTableContext` below it. */
104
+ AppTable: AppTableComponent;
105
+ /** Provides the cell to `useCellContext` and hands it over with the cell components on it. */
106
+ AppCell: AppCellComponent<TFeatures, TData, NoInfer<TCellComponents>>;
107
+ /** Provides the header to `useHeaderContext` and hands it over with the header components on it. */
108
+ AppHeader: AppHeaderComponent<TFeatures, TData, NoInfer<THeaderComponents>>;
109
+ /** `AppHeader`, with `FlexRender` rendering the column's footer template. */
110
+ AppFooter: AppHeaderComponent<TFeatures, TData, NoInfer<THeaderComponents>>;
111
+ FlexRender: typeof FlexRender;
112
+ };
113
+ export interface CreateTableHookResult<TFeatures extends TableFeatures, TTableComponents extends Components, TCellComponents extends Components, THeaderComponents extends Components, TRow extends RowData = RowData> {
114
+ appFeatures: TFeatures;
115
+ createAppColumnHelper: <TData extends TRow>() => AppColumnHelper<TFeatures, TData, TCellComponents, THeaderComponents>;
116
+ createAppTable: <TData extends TRow>(tableOptions: MaybeAccessor<Omit<TableOptions<TFeatures, TData>, "features">>) => AppBarqTable<TFeatures, TData, TTableComponents, TCellComponents, THeaderComponents>;
117
+ useTableContext: <TData extends TRow = TRow>() => AppBarqTable<TFeatures, TData, TTableComponents, TCellComponents, THeaderComponents>;
118
+ useCellContext: <TValue extends CellData = CellData>() => Cell<TFeatures, RowData, TValue> & TCellComponents & {
119
+ FlexRender: () => JSXElement;
120
+ };
121
+ useHeaderContext: <TValue extends CellData = CellData>() => Header<TFeatures, RowData, TValue> & THeaderComponents & {
122
+ FlexRender: () => JSXElement;
123
+ };
124
+ }
125
+ /**
126
+ * Binds features, default options and component registries once, and returns
127
+ * the table factory, column helper and context readers typed against them.
128
+ */
129
+ export declare function createTableHook<TFeatures extends TableFeatures, const TTableComponents extends Components, const TCellComponents extends Components, const THeaderComponents extends Components, TRow extends RowData = RowData>({ tableComponents, cellComponents, headerComponents, ...defaultTableOptions }: CreateTableHookOptions<TFeatures, TTableComponents, TCellComponents, THeaderComponents, TRow>): CreateTableHookResult<TFeatures, TTableComponents, TCellComponents, THeaderComponents, TRow>;
130
+ //#endregion
131
+ export { type BarqTable, FlexRender, type FlexRenderProps, type MaybeAccessor, flexRender };