Skip to content

Commit 30ce4d4

Browse files
author
dasathyakuma
committed
Fix everything
1 parent b29e8cf commit 30ce4d4

File tree

18 files changed

+234
-350
lines changed

18 files changed

+234
-350
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ dist/
33
coverage/
44
*.tsbuildinfo
55
.DS_Store
6-
.vscode
6+
.vscode
7+
demo/node_modules/

demo/.marko-run/routes.d.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
WARNING: This file is automatically generated and any changes made to it will be overwritten without warning.
3+
Do NOT manually edit this file or your changes will be lost.
4+
*/
5+
6+
import { NotHandled, NotMatched, GetPaths, PostPaths, GetablePath, GetableHref, PostablePath, PostableHref, Platform } from "@marko/run/namespace";
7+
import type * as Run from "@marko/run";
8+
9+
10+
declare module "@marko/run" {
11+
interface AppData extends Run.DefineApp<{
12+
routes: {
13+
"/": { verb: "get"; };
14+
"/client-only": { verb: "get"; };
15+
"/virtual": { verb: "get"; };
16+
}
17+
}> {}
18+
}
19+
20+
declare module "../src/routes/+page.marko" {
21+
namespace MarkoRun {
22+
export { NotHandled, NotMatched, GetPaths, PostPaths, GetablePath, GetableHref, PostablePath, PostableHref, Platform };
23+
export type Route = Run.Routes["/"];
24+
export type Context = Run.MultiRouteContext<Route> & Marko.Global;
25+
export type Handler = Run.HandlerLike<Route>;
26+
/** @deprecated use `((context, next) => { ... }) satisfies MarkoRun.Handler` instead */
27+
export const route: Run.HandlerTypeFn<Route>;
28+
}
29+
}
30+
31+
declare module "../src/routes/client-only/+page.marko" {
32+
namespace MarkoRun {
33+
export { NotHandled, NotMatched, GetPaths, PostPaths, GetablePath, GetableHref, PostablePath, PostableHref, Platform };
34+
export type Route = Run.Routes["/client-only"];
35+
export type Context = Run.MultiRouteContext<Route> & Marko.Global;
36+
export type Handler = Run.HandlerLike<Route>;
37+
/** @deprecated use `((context, next) => { ... }) satisfies MarkoRun.Handler` instead */
38+
export const route: Run.HandlerTypeFn<Route>;
39+
}
40+
}
41+
42+
declare module "../src/routes/virtual/+page.marko" {
43+
namespace MarkoRun {
44+
export { NotHandled, NotMatched, GetPaths, PostPaths, GetablePath, GetableHref, PostablePath, PostableHref, Platform };
45+
export type Route = Run.Routes["/virtual"];
46+
export type Context = Run.MultiRouteContext<Route> & Marko.Global;
47+
export type Handler = Run.HandlerLike<Route>;
48+
/** @deprecated use `((context, next) => { ... }) satisfies MarkoRun.Handler` instead */
49+
export const route: Run.HandlerTypeFn<Route>;
50+
}
51+
}

demo/.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ const config: StorybookConfig = {
88
},
99
};
1010

11-
export default config;
11+
export default config;

demo/.storybook/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ const preview: Preview = {
1111
},
1212
};
1313

14-
export default preview;
14+
export default preview;

demo/package-lock.json

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"@marko/run": "^0.7.0",
1616
"@tanstack/table-core": "^8.21.3",
1717
"@tanstack/virtual-core": "^3.13.23",
18-
"marko": "^6.0.0"
18+
"marko": "^6.0.0",
19+
"marko-table": "file:.."
1920
},
2021
"devDependencies": {
2122
"@storybook/marko": "^10.1.0",

demo/src/lib/marko-table.ts

Lines changed: 0 additions & 165 deletions
This file was deleted.

demo/src/routes/client-only/components/data-table-client.marko

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type ColumnFiltersState, type VisibilityState, type ExpandedState,
88
type SortingState, type PaginationState, type RowSelectionState,
99
type ColumnSizingState,
10-
} from "../../../lib/marko-table";
10+
} from "marko-table";
1111

1212
export interface Input { data: Person[] }
1313
export interface Person {
@@ -46,18 +46,18 @@ static const columns = [
4646

4747
<let/mounted = false />
4848
<let/tableId = generateTableId() />
49-
<let/sorting: SortingState = [] />
50-
<let/pagination: PaginationState = { pageIndex: 0, pageSize: 5 } />
51-
<let/rowSelection: RowSelectionState = {} />
49+
<let/sorting = ([] as SortingState) />
50+
<let/pagination = ({ pageIndex: 0, pageSize: 5 } as PaginationState) />
51+
<let/rowSelection = ({} as RowSelectionState) />
5252
<let/globalFilter = "" />
53-
<let/columnFilters: ColumnFiltersState = [] />
54-
<let/columnVisibility: VisibilityState = {} />
55-
<let/expanded: ExpandedState = {} />
56-
<let/columnSizing: ColumnSizingState = {} />
53+
<let/columnFilters = ([] as ColumnFiltersState) />
54+
<let/columnVisibility = ({} as VisibilityState) />
55+
<let/expanded = ({} as ExpandedState) />
56+
<let/columnSizing = ({} as ColumnSizingState) />
5757
<let/showColMenu = false />
5858

59-
<effect() { mounted = true } />
60-
<effect() { return () => destroyTable(tableId) } />
59+
<script() { mounted = true } />
60+
<script() { return () => destroyTable(tableId) } />
6161

6262
<if=!mounted>
6363
<div class="loading">Loading table…</div>
@@ -86,7 +86,7 @@ static const columns = [
8686
{ sorting, pagination, rowSelection, globalFilter, columnFilters, columnVisibility, expanded, columnSizing },
8787
(updater) => {
8888
const cur = { sorting, pagination, rowSelection, globalFilter, columnFilters, columnVisibility, expanded, columnSizing };
89-
const nxt = typeof updater === "function" ? updater(cur) : updater;
89+
const nxt = (typeof updater === "function" ? updater(cur) : updater) as typeof cur;
9090
if (nxt.sorting !== sorting) sorting = nxt.sorting;
9191
if (nxt.pagination !== pagination) pagination = nxt.pagination;
9292
if (nxt.rowSelection !== rowSelection) rowSelection = nxt.rowSelection;

demo/src/routes/components/data-table.marko

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type ColumnFiltersState, type VisibilityState, type ExpandedState,
88
type SortingState, type PaginationState, type RowSelectionState,
99
type ColumnSizingState,
10-
} from "../../lib/marko-table";
10+
} from "marko-table";
1111

1212
export interface Input { data: Person[] }
1313
export interface Person {
@@ -47,14 +47,14 @@ static const columns = [
4747
];
4848

4949
<let/tableId = generateTableId() />
50-
<let/sorting: SortingState = [] />
51-
<let/pagination: PaginationState = { pageIndex: 0, pageSize: 5 } />
52-
<let/rowSelection: RowSelectionState = {} />
50+
<let/sorting = ([] as SortingState) />
51+
<let/pagination = ({ pageIndex: 0, pageSize: 5 } as PaginationState) />
52+
<let/rowSelection = ({} as RowSelectionState) />
5353
<let/globalFilter = "" />
54-
<let/columnFilters: ColumnFiltersState = [] />
55-
<let/columnVisibility: VisibilityState = {} />
56-
<let/expanded: ExpandedState = {} />
57-
<let/columnSizing: ColumnSizingState = {} />
54+
<let/columnFilters = ([] as ColumnFiltersState) />
55+
<let/columnVisibility = ({} as VisibilityState) />
56+
<let/expanded = ({} as ExpandedState) />
57+
<let/columnSizing = ({} as ColumnSizingState) />
5858
<let/showColMenu = false />
5959

6060
// ── The key fix: everything derived from `t` lives inside ONE IIFE ────────
@@ -80,7 +80,7 @@ static const columns = [
8080
{ sorting, pagination, rowSelection, globalFilter, columnFilters, columnVisibility, expanded, columnSizing },
8181
(updater) => {
8282
const cur = { sorting, pagination, rowSelection, globalFilter, columnFilters, columnVisibility, expanded, columnSizing };
83-
const nxt = typeof updater === "function" ? updater(cur) : updater;
83+
const nxt = (typeof updater === "function" ? updater(cur) : updater) as typeof cur;
8484
if (nxt.sorting !== sorting) sorting = nxt.sorting;
8585
if (nxt.pagination !== pagination) pagination = nxt.pagination;
8686
if (nxt.rowSelection !== rowSelection) rowSelection = nxt.rowSelection;
@@ -155,7 +155,7 @@ static const columns = [
155155
};
156156
})() />
157157

158-
<effect() { return () => destroyTable(tableId) } />
158+
<script() { return () => destroyTable(tableId) } />
159159

160160
<div class="dt-wrap">
161161
<div class="toolbar">

0 commit comments

Comments
 (0)