@warkypublic/svelix 0.1.40 → 0.1.41
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/dist/components/Gridler/adapters/GridlerResolveSpecAdapter.d.ts +1 -0
- package/dist/components/Gridler/adapters/GridlerResolveSpecAdapter.js +6 -3
- package/dist/components/Gridler/adapters/GridlerRestHeaderSpecAdapter.d.ts +1 -0
- package/dist/components/Gridler/adapters/GridlerRestHeaderSpecAdapter.js +6 -3
- package/dist/components/Gridler/components/GridlerFull.svelte +1 -0
- package/dist/components/Gridler/types.d.ts +18 -0
- package/dist/components/Types/generic_grid.d.ts +18 -0
- package/llm/COMPONENT_GUIDE.md +98 -0
- package/package.json +28 -28
|
@@ -4,6 +4,7 @@ export declare class GridlerResolveSpecAdapter {
|
|
|
4
4
|
private readonly client;
|
|
5
5
|
private readonly schema;
|
|
6
6
|
private readonly entity;
|
|
7
|
+
private readonly configExtraOptions;
|
|
7
8
|
readonly uniqueID: string;
|
|
8
9
|
constructor(config: GridlerAdapterConfig);
|
|
9
10
|
readPage(limit: number, cursorForward?: string, sort?: SortOption[], filters?: FilterOption[], fields?: string[], extraOptions?: Partial<Options>): Promise<GridlerPageResult>;
|
|
@@ -4,18 +4,21 @@ export class GridlerResolveSpecAdapter {
|
|
|
4
4
|
client;
|
|
5
5
|
schema;
|
|
6
6
|
entity;
|
|
7
|
+
configExtraOptions;
|
|
7
8
|
uniqueID;
|
|
8
9
|
constructor(config) {
|
|
9
10
|
this.client = new ResolveSpecClient({ baseUrl: config.url, token: config.token });
|
|
10
11
|
this.schema = config.schema;
|
|
11
12
|
this.entity = config.entity;
|
|
12
13
|
this.uniqueID = config.uniqueID ?? 'id';
|
|
14
|
+
this.configExtraOptions = config.extraOptions ?? {};
|
|
13
15
|
}
|
|
14
16
|
async readPage(limit, cursorForward, sort, filters, fields, extraOptions) {
|
|
17
|
+
const merged = { ...this.configExtraOptions, ...extraOptions };
|
|
15
18
|
const options = {
|
|
16
|
-
...
|
|
17
|
-
sort: sort ??
|
|
18
|
-
filters: filters ??
|
|
19
|
+
...merged,
|
|
20
|
+
sort: sort ?? merged.sort ?? [],
|
|
21
|
+
filters: filters ?? merged.filters ?? [],
|
|
19
22
|
limit,
|
|
20
23
|
...(cursorForward != null ? { cursor_forward: cursorForward } : {}),
|
|
21
24
|
...(fields?.length ? { columns: fields } : {}),
|
|
@@ -4,6 +4,7 @@ export declare class GridlerRestHeaderSpecAdapter {
|
|
|
4
4
|
private readonly client;
|
|
5
5
|
private readonly schema;
|
|
6
6
|
private readonly entity;
|
|
7
|
+
private readonly configExtraOptions;
|
|
7
8
|
readonly uniqueID: string;
|
|
8
9
|
constructor(config: GridlerAdapterConfig);
|
|
9
10
|
readPage(limit: number, cursorForward?: string, sort?: SortOption[], filters?: FilterOption[], fields?: string[], extraOptions?: Partial<Options>): Promise<GridlerPageResult>;
|
|
@@ -4,18 +4,21 @@ export class GridlerRestHeaderSpecAdapter {
|
|
|
4
4
|
client;
|
|
5
5
|
schema;
|
|
6
6
|
entity;
|
|
7
|
+
configExtraOptions;
|
|
7
8
|
uniqueID;
|
|
8
9
|
constructor(config) {
|
|
9
10
|
this.client = new HeaderSpecClient({ baseUrl: config.url, token: config.token });
|
|
10
11
|
this.schema = config.schema;
|
|
11
12
|
this.entity = config.entity;
|
|
12
13
|
this.uniqueID = config.uniqueID ?? 'id';
|
|
14
|
+
this.configExtraOptions = config.extraOptions ?? {};
|
|
13
15
|
}
|
|
14
16
|
async readPage(limit, cursorForward, sort, filters, fields, extraOptions) {
|
|
17
|
+
const merged = { ...this.configExtraOptions, ...extraOptions };
|
|
15
18
|
const options = {
|
|
16
|
-
...
|
|
17
|
-
sort: sort ??
|
|
18
|
-
filters: filters ??
|
|
19
|
+
...merged,
|
|
20
|
+
sort: sort ?? merged.sort ?? [],
|
|
21
|
+
filters: filters ?? merged.filters ?? [],
|
|
19
22
|
limit,
|
|
20
23
|
...(cursorForward != null ? { cursor_forward: cursorForward } : {}),
|
|
21
24
|
...(fields?.length ? { columns: fields } : {}),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GridColumn, GridCommonProps, GridColumnSortOrder, GridColumnFilters } from '../Types/generic_grid';
|
|
2
|
+
import type { Options } from '@warkypublic/resolvespec-js';
|
|
2
3
|
export type { GridColumnSortOrder, GridColumnFilters };
|
|
3
4
|
export type Item = [col: number, row: number];
|
|
4
5
|
export interface GridlerAdapterConfig {
|
|
@@ -8,6 +9,23 @@ export interface GridlerAdapterConfig {
|
|
|
8
9
|
entity: string;
|
|
9
10
|
/** Row field whose value is passed as cursor_forward on subsequent requests. Defaults to 'id'. */
|
|
10
11
|
uniqueID?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Default ResolveSpec options applied to every request. Grid-controlled sort, filters, limit,
|
|
14
|
+
* cursor, and columns always take precedence over values set here.
|
|
15
|
+
*
|
|
16
|
+
* Key fields:
|
|
17
|
+
* - `preload` — eager-load relations. Each entry specifies `relation`, optional `columns`,
|
|
18
|
+
* `filters`, `sort`, `limit`, `recursive`, `sql_joins`, etc.
|
|
19
|
+
* - `omit_columns` — columns to exclude from the response.
|
|
20
|
+
* - `computedColumns` — server-side computed expressions: `{ name, expression }`.
|
|
21
|
+
* - `customOperators` — raw SQL WHERE fragments (AND-combined): `{ name, sql }`.
|
|
22
|
+
* - `parameters` — named query parameters passed to the server: `{ name, value, sequence? }`.
|
|
23
|
+
* - `filters` — default server-side filters applied before any grid filters.
|
|
24
|
+
* - `sort` — default sort order, overridden when the user sorts a column.
|
|
25
|
+
* - `fetch_row_number` — column name whose row number is returned in metadata.
|
|
26
|
+
* - `offset` — static row offset (cursor pagination is used by the adapter; avoid mixing).
|
|
27
|
+
*/
|
|
28
|
+
extraOptions?: Partial<Options>;
|
|
11
29
|
}
|
|
12
30
|
export interface GridlerPageResult {
|
|
13
31
|
data: Record<string, unknown>[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Options as ResolveSpecOptions } from '@warkypublic/resolvespec-js';
|
|
1
2
|
export type GridColumnFormat = "text" | "number" | "currency" | "percentage" | "date" | "datetime" | "markdown" | "image" | "uri" | "bubble" | "drilldown";
|
|
2
3
|
/**
|
|
3
4
|
* GridEventType represents the various events that can occur on the grid level, such as clicking, hovering, loading, scrolling, resizing, and changes to sorting, filtering, searching, selection, column arrangement, data, and settings. These events can be used to trigger callbacks for handling user interactions and updates to the grid.
|
|
@@ -72,6 +73,23 @@ export interface GridCommonProps<RowDataType = unknown, CellType = unknown> {
|
|
|
72
73
|
uniqueID?: string;
|
|
73
74
|
headers?: Record<string, string>;
|
|
74
75
|
hotfields?: string[];
|
|
76
|
+
/**
|
|
77
|
+
* Default ResolveSpec options sent with every request. Grid-controlled sort, filters, limit,
|
|
78
|
+
* cursor, and columns always take precedence over values set here.
|
|
79
|
+
*
|
|
80
|
+
* Key fields:
|
|
81
|
+
* - `preload` — eager-load relations. Each entry specifies `relation`, optional `columns`,
|
|
82
|
+
* `filters`, `sort`, `limit`, `recursive`, `sql_joins`, etc.
|
|
83
|
+
* - `omit_columns` — columns to exclude from the response.
|
|
84
|
+
* - `computedColumns` — server-side computed expressions: `{ name, expression }`.
|
|
85
|
+
* - `customOperators` — raw SQL WHERE fragments (AND-combined): `{ name, sql }`.
|
|
86
|
+
* - `parameters` — named query parameters passed to the server: `{ name, value, sequence? }`.
|
|
87
|
+
* - `filters` — default server-side filters applied before any grid filters.
|
|
88
|
+
* - `sort` — default sort order, overridden when the user sorts a column.
|
|
89
|
+
* - `fetch_row_number` — column name whose row number is returned in metadata.
|
|
90
|
+
* - `offset` — static row offset (cursor pagination is used by the adapter; avoid mixing).
|
|
91
|
+
*/
|
|
92
|
+
extraOptions?: Partial<ResolveSpecOptions>;
|
|
75
93
|
};
|
|
76
94
|
data?: RowDataType[] | (() => Promise<RowDataType[]>);
|
|
77
95
|
onDataChange?: (data: RowDataType[]) => Promise<void>;
|
package/llm/COMPONENT_GUIDE.md
CHANGED
|
@@ -478,6 +478,104 @@ Story behavior worth preserving:
|
|
|
478
478
|
- search highlighting and fixed columns are first-class usage patterns
|
|
479
479
|
- theme overrides are an expected integration point, not a niche feature
|
|
480
480
|
|
|
481
|
+
### GridlerFull: server-driven Gridler with adapters
|
|
482
|
+
|
|
483
|
+
`GridlerFull` wraps `Gridler` and handles paging, sorting, filtering, and search against a
|
|
484
|
+
ResolveSpec or HeaderSpec API. Configure via `dataSource` + `dataSourceOptions`.
|
|
485
|
+
|
|
486
|
+
```svelte
|
|
487
|
+
<script lang="ts">
|
|
488
|
+
import { GridlerFull } from '@warkypublic/svelix';
|
|
489
|
+
import type { GridlerColumn } from '@warkypublic/svelix';
|
|
490
|
+
|
|
491
|
+
const columns: GridlerColumn[] = [
|
|
492
|
+
{ id: 'id', title: 'ID', width: 60 },
|
|
493
|
+
{ id: 'name', title: 'Name', width: 180 },
|
|
494
|
+
{ id: 'email', title: 'Email', width: 220 },
|
|
495
|
+
];
|
|
496
|
+
</script>
|
|
497
|
+
|
|
498
|
+
<GridlerFull
|
|
499
|
+
{columns}
|
|
500
|
+
dataSource="resolvespec"
|
|
501
|
+
dataSourceOptions={{
|
|
502
|
+
url: 'https://api.example.com',
|
|
503
|
+
authToken: 'Bearer …',
|
|
504
|
+
schema: 'public',
|
|
505
|
+
entity: 'users',
|
|
506
|
+
uniqueID: 'id',
|
|
507
|
+
hotfields: ['role'],
|
|
508
|
+
extraOptions: {
|
|
509
|
+
preload: [
|
|
510
|
+
{
|
|
511
|
+
relation: 'department',
|
|
512
|
+
columns: ['id', 'name'],
|
|
513
|
+
},
|
|
514
|
+
],
|
|
515
|
+
filters: [{ column: 'active', operator: 'eq', value: true }],
|
|
516
|
+
sort: [{ column: 'created_at', direction: 'desc' }],
|
|
517
|
+
computedColumns: [{ name: 'full_name', expression: "first_name || ' ' || last_name" }],
|
|
518
|
+
customOperators: [{ name: 'tenant', sql: "tenant_id = '123'" }],
|
|
519
|
+
parameters: [{ name: 'p_role', value: 'admin' }],
|
|
520
|
+
},
|
|
521
|
+
}}
|
|
522
|
+
height={480}
|
|
523
|
+
pageSize={50}
|
|
524
|
+
/>
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
#### `dataSource` values
|
|
528
|
+
|
|
529
|
+
| Value | Adapter class | Transport |
|
|
530
|
+
|----------------|----------------------------------|--------------------|
|
|
531
|
+
| `resolvespec` | `GridlerResolveSpecAdapter` | JSON request body |
|
|
532
|
+
| `headerspec` | `GridlerRestHeaderSpecAdapter` | HTTP headers |
|
|
533
|
+
|
|
534
|
+
#### `dataSourceOptions.extraOptions` — all fields
|
|
535
|
+
|
|
536
|
+
These are `Partial<Options>` from `@warkypublic/resolvespec-js`. Grid-controlled values
|
|
537
|
+
(sort, filters, limit, cursor, columns) always win over anything set here.
|
|
538
|
+
|
|
539
|
+
| Field | Type | Purpose |
|
|
540
|
+
|-------------------|-----------------------|------------------------------------------------------------------|
|
|
541
|
+
| `preload` | `PreloadOption[]` | Eager-load related entities. See `PreloadOption` fields below. |
|
|
542
|
+
| `omit_columns` | `string[]` | Exclude these columns from every response. |
|
|
543
|
+
| `computedColumns` | `ComputedColumn[]` | Server-side SQL expressions: `{ name, expression }`. |
|
|
544
|
+
| `customOperators` | `CustomOperator[]` | Raw SQL WHERE fragments (AND-combined): `{ name, sql }`. |
|
|
545
|
+
| `parameters` | `Parameter[]` | Named query params: `{ name, value, sequence? }`. |
|
|
546
|
+
| `filters` | `FilterOption[]` | Default filters prepended before any grid column filters. |
|
|
547
|
+
| `sort` | `SortOption[]` | Default sort, overridden when the user clicks a column header. |
|
|
548
|
+
| `fetch_row_number`| `string` | Column whose absolute row number is returned in metadata. |
|
|
549
|
+
| `offset` | `number` | Static row offset — avoid mixing with cursor pagination. |
|
|
550
|
+
|
|
551
|
+
##### `PreloadOption` key fields
|
|
552
|
+
|
|
553
|
+
| Field | Purpose |
|
|
554
|
+
|----------------------|------------------------------------------------------|
|
|
555
|
+
| `relation` | Relation name (required). |
|
|
556
|
+
| `table_name` | Override the table resolved from the relation. |
|
|
557
|
+
| `columns` | Columns to select on the related table. |
|
|
558
|
+
| `omit_columns` | Columns to exclude on the related table. |
|
|
559
|
+
| `filters` | Filters applied to the related table. |
|
|
560
|
+
| `sort` | Sort order for the related rows. |
|
|
561
|
+
| `limit` | Max related rows per parent row. |
|
|
562
|
+
| `recursive` | Self-referential recursive load. |
|
|
563
|
+
| `primary_key` | Override primary key used for the join. |
|
|
564
|
+
| `related_key` | Foreign key on the related table. |
|
|
565
|
+
| `foreign_key` | Foreign key on the parent table. |
|
|
566
|
+
| `recursive_child_key`| Key used for the recursive child join. |
|
|
567
|
+
| `sql_joins` | Raw SQL JOIN clauses. |
|
|
568
|
+
| `join_aliases` | Aliases for the SQL joins. |
|
|
569
|
+
| `computed_ql` | Map of computed column name → SQL expression. |
|
|
570
|
+
| `where` | Raw SQL WHERE fragment for the relation. |
|
|
571
|
+
| `updatable` | Marks the preloaded relation as updatable. |
|
|
572
|
+
|
|
573
|
+
Key behaviors:
|
|
574
|
+
- `extraOptions` is stored on the adapter at construction time; changing `dataSourceOptions` recreates the adapter and triggers a full refetch.
|
|
575
|
+
- Call-time `extraOptions` passed directly to `readPage` override the config-level defaults; specific params (sort, filters, limit, cursor, columns) override both.
|
|
576
|
+
- `hotfields` are fetched alongside column fields but not rendered — use them for fields needed by filters or computed logic.
|
|
577
|
+
- Use `headerspec` when the API endpoint only accepts query options via HTTP headers instead of a JSON body.
|
|
578
|
+
|
|
481
579
|
### SvarkGrid: adapter-backed tabular data
|
|
482
580
|
|
|
483
581
|
Based on:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warkypublic/svelix",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"description": "Svelte 5 component library with Skeleton UI and Tailwind CSS",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"exports": {
|
|
@@ -26,43 +26,43 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@changesets/cli": "^2.31.0",
|
|
29
|
-
"@chromatic-com/storybook": "^5.1
|
|
30
|
-
"@eslint/compat": "^2.0
|
|
29
|
+
"@chromatic-com/storybook": "^5.2.1",
|
|
30
|
+
"@eslint/compat": "^2.1.0",
|
|
31
31
|
"@eslint/js": "^10.0.1",
|
|
32
|
-
"@playwright/test": "^1.
|
|
33
|
-
"@sentry/svelte": "^10.
|
|
32
|
+
"@playwright/test": "^1.60.0",
|
|
33
|
+
"@sentry/svelte": "^10.53.1",
|
|
34
34
|
"@skeletonlabs/skeleton": "^4.15.2",
|
|
35
35
|
"@skeletonlabs/skeleton-svelte": "^4.15.2",
|
|
36
|
-
"@storybook/addon-a11y": "^10.
|
|
37
|
-
"@storybook/addon-docs": "^10.
|
|
36
|
+
"@storybook/addon-a11y": "^10.4.0",
|
|
37
|
+
"@storybook/addon-docs": "^10.4.0",
|
|
38
38
|
"@storybook/addon-svelte-csf": "^5.1.2",
|
|
39
|
-
"@storybook/addon-vitest": "^10.
|
|
40
|
-
"@storybook/sveltekit": "^10.
|
|
39
|
+
"@storybook/addon-vitest": "^10.4.0",
|
|
40
|
+
"@storybook/sveltekit": "^10.4.0",
|
|
41
41
|
"@storybook/test": "^8.6.15",
|
|
42
42
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
43
|
-
"@sveltejs/kit": "^2.
|
|
43
|
+
"@sveltejs/kit": "^2.60.1",
|
|
44
44
|
"@sveltejs/package": "^2.5.7",
|
|
45
|
-
"@sveltejs/vite-plugin-svelte": "^7.
|
|
46
|
-
"@tailwindcss/vite": "^4.
|
|
45
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
46
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
47
47
|
"@tanstack/svelte-virtual": "^3.13.24",
|
|
48
|
-
"@types/node": "^25.
|
|
49
|
-
"@vitest/browser-playwright": "^4.1.
|
|
50
|
-
"@vitest/coverage-v8": "^4.1.
|
|
51
|
-
"eslint": "^10.
|
|
48
|
+
"@types/node": "^25.8.0",
|
|
49
|
+
"@vitest/browser-playwright": "^4.1.6",
|
|
50
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
51
|
+
"eslint": "^10.4.0",
|
|
52
52
|
"eslint-plugin-svelte": "^3.17.1",
|
|
53
|
-
"globals": "^17.
|
|
54
|
-
"playwright": "^1.
|
|
55
|
-
"publint": "^0.3.
|
|
56
|
-
"storybook": "^10.
|
|
57
|
-
"svelte": "^5.55.
|
|
58
|
-
"svelte-check": "^4.4.
|
|
59
|
-
"tailwindcss": "^4.
|
|
53
|
+
"globals": "^17.6.0",
|
|
54
|
+
"playwright": "^1.60.0",
|
|
55
|
+
"publint": "^0.3.21",
|
|
56
|
+
"storybook": "^10.4.0",
|
|
57
|
+
"svelte": "^5.55.7",
|
|
58
|
+
"svelte-check": "^4.4.8",
|
|
59
|
+
"tailwindcss": "^4.3.0",
|
|
60
60
|
"tslib": "^2.8.1",
|
|
61
61
|
"typescript": "^6.0.3",
|
|
62
|
-
"typescript-eslint": "^8.59.
|
|
63
|
-
"vite": "^8.0.
|
|
62
|
+
"typescript-eslint": "^8.59.3",
|
|
63
|
+
"vite": "^8.0.13",
|
|
64
64
|
"vite-plugin-monaco-editor": "^1.1.0",
|
|
65
|
-
"vitest": "^4.1.
|
|
65
|
+
"vitest": "^4.1.6"
|
|
66
66
|
},
|
|
67
67
|
"svelte": "./dist/index.js",
|
|
68
68
|
"types": "./dist/index.d.ts",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"@warkypublic/artemis-kit": "^1.0.10",
|
|
82
82
|
"carta-md": "^4.11.2",
|
|
83
83
|
"github-markdown-css": "^5.9.0",
|
|
84
|
-
"isomorphic-dompurify": "^3.
|
|
85
|
-
"katex": "^0.16.
|
|
84
|
+
"isomorphic-dompurify": "^3.13.0",
|
|
85
|
+
"katex": "^0.16.47",
|
|
86
86
|
"monaco-editor": "^0.55.1"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|