@datakable/react 1.0.0 → 1.0.1

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
@@ -12,8 +12,9 @@ preset; this package installs **no** features unless you pass them.
12
12
  npm install @datakable/react @datakable/core react
13
13
  ```
14
14
 
15
- React `>=18`. Every module of the bundle carries a `"use client"` directive, so the Next.js app
16
- router treats `<DataTable />` and `useDataTable` imported from here as client code. Like core,
15
+ React `>=18`. The modules of `<DataTable />` and `useDataTable` carry a `"use client"` directive,
16
+ so the Next.js app router treats them as client code even when a server component imports them
17
+ from here; the rest (core's `createTable`, …) stays usable on the server. Like core,
17
18
  it needs a bundler that replaces `process.env.NODE_ENV` (see [core](https://github.com/Ink01101011/datakable/tree/main/packages/core)).
18
19
 
19
20
  ## useDataTable
package/dist/codes.cjs CHANGED
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  "use strict";
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/codes.ts"],"sourcesContent":["import { defineDiagnostic } from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_UNSTABLE_COLUMNS: {\n /** Consecutive renders that passed a new `columns` array with the same shape. */\n renders: number\n }\n DK_UNSTABLE_OPTION: {\n /** `data`, `fetcher`, `rowKey`, or a feature's function option: `features[2].searchFn`. */\n option: string\n /** Consecutive renders that passed a new reference. */\n renders: number\n }\n }\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nconst isFeatureOption = (option: string) => option.startsWith('features[')\n\n/**\n * Codes owned by `@datakable/react` (§8.3, react, dev only). Like core's dev checks, the\n * definitions exist only in development: the NODE_ENV check is written out here (not an imported\n * flag) so a consumer's bundler folds it while parsing and drops the text from production bundles\n * (§8.2). They are never emitted in production, so `datakable/messages` has no text for them.\n */\nexport const reactDiagnostics =\n process.env.NODE_ENV !== 'production'\n ? [\n defineDiagnostic({\n code: 'DK_UNSTABLE_COLUMNS',\n level: 'warn',\n where: () => ({ kind: 'option', path: 'columns' }),\n problem: (d) =>\n `useDataTable received a new columns array with the same shape on ${d.renders} renders ` +\n 'in a row (columns are compared by reference)',\n impact: () =>\n 'each new array rebuilds the column cache and re-runs the pipeline; in a re-render caused ' +\n 'by the table itself, the columns the table already has are kept',\n fix: () => [\n 'define the columns outside the component, or memoise them: ' +\n 'useMemo(() => [...columns], [the values they read])',\n 'a new columns array is how you tell the table the columns changed (accessor / format / ' +\n 'cell), so create one only when they do',\n ],\n }),\n defineDiagnostic({\n code: 'DK_UNSTABLE_OPTION',\n level: 'warn',\n where: (d) => ({ kind: 'option', path: d.option }),\n problem: (d) =>\n `useDataTable received a new ${d.option} reference on ${d.renders} renders in a row`,\n impact: (d) =>\n d.option === 'fetcher'\n ? 'the table always calls the latest fetcher, but a new fetcher does not refetch: ' +\n 'values it reads that are not table state do not reload the data'\n : d.option === 'data'\n ? 'each new array is ingested again (schema, data checks, pipeline); in a re-render ' +\n 'caused by the table itself an array with equal rows is skipped'\n : isFeatureOption(d.option)\n ? 'features are read once, when the table is created: the table keeps calling the ' +\n `${d.option} of the first render (a stale closure)`\n : 'each new rowKey function recomputes every row key',\n fix: (d) =>\n d.option === 'fetcher'\n ? [\n 'call table.refetch() when a value the fetcher reads changes (or keep that value in ' +\n 'a server-mode feature state, which refetches by itself)',\n 'wrap the fetcher in useCallback to silence this warning',\n ]\n : d.option === 'data'\n ? [\n 'memoise derived data: useMemo(() => rows.filter(...), [rows])',\n 'or keep the data in state and pass the same array until it changes',\n ]\n : isFeatureOption(d.option)\n ? [\n 'create the features once: useMemo(() => [search({ searchFn })], []) or outside ' +\n 'the component',\n 'read changing values inside the function through a ref (ref.current) instead ' +\n 'of the render closure',\n ]\n : [\n \"use a key path (rowKey: 'id') or a function defined outside the component\",\n 'or wrap it in useCallback',\n ],\n }),\n ]\n : []\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAoBjC,IAAM,kBAAkB,CAAC,WAAmB,OAAO,WAAW,WAAW;AAQlE,IAAM,mBACX,QAAQ,IAAI,aAAa,eACrB;AAAA,MACE,8BAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,OAAO,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAChD,SAAS,CAAC,MACR,oEAAoE,EAAE,OAAO;AAAA,IAE/E,QAAQ,MACN;AAAA,IAEF,KAAK,MAAM;AAAA,MACT;AAAA,MAEA;AAAA,IAEF;AAAA,EACF,CAAC;AAAA,MACD,8BAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAC,OAAO,EAAE,MAAM,UAAU,MAAM,EAAE,OAAO;AAAA,IAChD,SAAS,CAAC,MACR,+BAA+B,EAAE,MAAM,iBAAiB,EAAE,OAAO;AAAA,IACnE,QAAQ,CAAC,MACP,EAAE,WAAW,YACT,mJAEA,EAAE,WAAW,SACX,oJAEA,gBAAgB,EAAE,MAAM,IACtB,kFACG,EAAE,MAAM,2CACX;AAAA,IACV,KAAK,CAAC,MACJ,EAAE,WAAW,YACT;AAAA,MACE;AAAA,MAEA;AAAA,IACF,IACA,EAAE,WAAW,SACX;AAAA,MACE;AAAA,MACA;AAAA,IACF,IACA,gBAAgB,EAAE,MAAM,IACtB;AAAA,MACE;AAAA,MAEA;AAAA,IAEF,IACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACZ,CAAC;AACH,IACA,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/codes.ts"],"sourcesContent":["import { defineDiagnostic } from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_UNSTABLE_COLUMNS: {\n /** Consecutive renders that passed a new `columns` array with the same shape. */\n renders: number\n }\n DK_UNSTABLE_OPTION: {\n /** `data`, `fetcher`, `rowKey`, or a feature's function option: `features[2].searchFn`. */\n option: string\n /** Consecutive renders that passed a new reference. */\n renders: number\n }\n }\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nconst isFeatureOption = (option: string) => option.startsWith('features[')\n\n/**\n * Codes owned by `@datakable/react` (§8.3, react, dev only). Like core's dev checks, the\n * definitions exist only in development: the NODE_ENV check is written out here (not an imported\n * flag) so a consumer's bundler folds it while parsing and drops the text from production bundles\n * (§8.2). They are never emitted in production, so `datakable/messages` has no text for them.\n */\nexport const reactDiagnostics =\n process.env.NODE_ENV !== 'production'\n ? [\n defineDiagnostic({\n code: 'DK_UNSTABLE_COLUMNS',\n level: 'warn',\n where: () => ({ kind: 'option', path: 'columns' }),\n problem: (d) =>\n `useDataTable received a new columns array with the same shape on ${d.renders} renders ` +\n 'in a row (columns are compared by reference)',\n impact: () =>\n 'each new array rebuilds the column cache and re-runs the pipeline; in a re-render caused ' +\n 'by the table itself, the columns the table already has are kept',\n fix: () => [\n 'define the columns outside the component, or memoise them: ' +\n 'useMemo(() => [...columns], [the values they read])',\n 'a new columns array is how you tell the table the columns changed (accessor / format / ' +\n 'cell), so create one only when they do',\n ],\n }),\n defineDiagnostic({\n code: 'DK_UNSTABLE_OPTION',\n level: 'warn',\n where: (d) => ({ kind: 'option', path: d.option }),\n problem: (d) =>\n `useDataTable received a new ${d.option} reference on ${d.renders} renders in a row`,\n impact: (d) =>\n d.option === 'fetcher'\n ? 'the table always calls the latest fetcher, but a new fetcher does not refetch: ' +\n 'values it reads that are not table state do not reload the data'\n : d.option === 'data'\n ? 'each new array is ingested again (schema, data checks, pipeline); in a re-render ' +\n 'caused by the table itself an array with equal rows is skipped'\n : isFeatureOption(d.option)\n ? 'features are read once, when the table is created: the table keeps calling the ' +\n `${d.option} of the first render (a stale closure)`\n : 'each new rowKey function recomputes every row key',\n fix: (d) =>\n d.option === 'fetcher'\n ? [\n 'call table.refetch() when a value the fetcher reads changes (or keep that value in ' +\n 'a server-mode feature state, which refetches by itself)',\n 'wrap the fetcher in useCallback to silence this warning',\n ]\n : d.option === 'data'\n ? [\n 'memoise derived data: useMemo(() => rows.filter(...), [rows])',\n 'or keep the data in state and pass the same array until it changes',\n ]\n : isFeatureOption(d.option)\n ? [\n 'create the features once: useMemo(() => [search({ searchFn })], []) or outside ' +\n 'the component',\n 'read changing values inside the function through a ref (ref.current) instead ' +\n 'of the render closure',\n ]\n : [\n \"use a key path (rowKey: 'id') or a function defined outside the component\",\n 'or wrap it in useCallback',\n ],\n }),\n ]\n : []\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAoBjC,IAAM,kBAAkB,CAAC,WAAmB,OAAO,WAAW,WAAW;AAQlE,IAAM,mBACX,QAAQ,IAAI,aAAa,eACrB;AAAA,MACE,8BAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,OAAO,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAChD,SAAS,CAAC,MACR,oEAAoE,EAAE,OAAO;AAAA,IAE/E,QAAQ,MACN;AAAA,IAEF,KAAK,MAAM;AAAA,MACT;AAAA,MAEA;AAAA,IAEF;AAAA,EACF,CAAC;AAAA,MACD,8BAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAC,OAAO,EAAE,MAAM,UAAU,MAAM,EAAE,OAAO;AAAA,IAChD,SAAS,CAAC,MACR,+BAA+B,EAAE,MAAM,iBAAiB,EAAE,OAAO;AAAA,IACnE,QAAQ,CAAC,MACP,EAAE,WAAW,YACT,mJAEA,EAAE,WAAW,SACX,oJAEA,gBAAgB,EAAE,MAAM,IACtB,kFACG,EAAE,MAAM,2CACX;AAAA,IACV,KAAK,CAAC,MACJ,EAAE,WAAW,YACT;AAAA,MACE;AAAA,MAEA;AAAA,IACF,IACA,EAAE,WAAW,SACX;AAAA,MACE;AAAA,MACA;AAAA,IACF,IACA,gBAAgB,EAAE,MAAM,IACtB;AAAA,MACE;AAAA,MAEA;AAAA,IAEF,IACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACZ,CAAC;AACH,IACA,CAAC;","names":[]}
package/dist/codes.js CHANGED
@@ -1,5 +1,3 @@
1
- "use client";
2
-
3
1
  // src/codes.ts
4
2
  import { defineDiagnostic } from "@datakable/core";
5
3
  var isFeatureOption = (option) => option.startsWith("features[");
package/dist/codes.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/codes.ts"],"sourcesContent":["import { defineDiagnostic } from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_UNSTABLE_COLUMNS: {\n /** Consecutive renders that passed a new `columns` array with the same shape. */\n renders: number\n }\n DK_UNSTABLE_OPTION: {\n /** `data`, `fetcher`, `rowKey`, or a feature's function option: `features[2].searchFn`. */\n option: string\n /** Consecutive renders that passed a new reference. */\n renders: number\n }\n }\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nconst isFeatureOption = (option: string) => option.startsWith('features[')\n\n/**\n * Codes owned by `@datakable/react` (§8.3, react, dev only). Like core's dev checks, the\n * definitions exist only in development: the NODE_ENV check is written out here (not an imported\n * flag) so a consumer's bundler folds it while parsing and drops the text from production bundles\n * (§8.2). They are never emitted in production, so `datakable/messages` has no text for them.\n */\nexport const reactDiagnostics =\n process.env.NODE_ENV !== 'production'\n ? [\n defineDiagnostic({\n code: 'DK_UNSTABLE_COLUMNS',\n level: 'warn',\n where: () => ({ kind: 'option', path: 'columns' }),\n problem: (d) =>\n `useDataTable received a new columns array with the same shape on ${d.renders} renders ` +\n 'in a row (columns are compared by reference)',\n impact: () =>\n 'each new array rebuilds the column cache and re-runs the pipeline; in a re-render caused ' +\n 'by the table itself, the columns the table already has are kept',\n fix: () => [\n 'define the columns outside the component, or memoise them: ' +\n 'useMemo(() => [...columns], [the values they read])',\n 'a new columns array is how you tell the table the columns changed (accessor / format / ' +\n 'cell), so create one only when they do',\n ],\n }),\n defineDiagnostic({\n code: 'DK_UNSTABLE_OPTION',\n level: 'warn',\n where: (d) => ({ kind: 'option', path: d.option }),\n problem: (d) =>\n `useDataTable received a new ${d.option} reference on ${d.renders} renders in a row`,\n impact: (d) =>\n d.option === 'fetcher'\n ? 'the table always calls the latest fetcher, but a new fetcher does not refetch: ' +\n 'values it reads that are not table state do not reload the data'\n : d.option === 'data'\n ? 'each new array is ingested again (schema, data checks, pipeline); in a re-render ' +\n 'caused by the table itself an array with equal rows is skipped'\n : isFeatureOption(d.option)\n ? 'features are read once, when the table is created: the table keeps calling the ' +\n `${d.option} of the first render (a stale closure)`\n : 'each new rowKey function recomputes every row key',\n fix: (d) =>\n d.option === 'fetcher'\n ? [\n 'call table.refetch() when a value the fetcher reads changes (or keep that value in ' +\n 'a server-mode feature state, which refetches by itself)',\n 'wrap the fetcher in useCallback to silence this warning',\n ]\n : d.option === 'data'\n ? [\n 'memoise derived data: useMemo(() => rows.filter(...), [rows])',\n 'or keep the data in state and pass the same array until it changes',\n ]\n : isFeatureOption(d.option)\n ? [\n 'create the features once: useMemo(() => [search({ searchFn })], []) or outside ' +\n 'the component',\n 'read changing values inside the function through a ref (ref.current) instead ' +\n 'of the render closure',\n ]\n : [\n \"use a key path (rowKey: 'id') or a function defined outside the component\",\n 'or wrap it in useCallback',\n ],\n }),\n ]\n : []\n"],"mappings":";;;AAAA,SAAS,wBAAwB;AAoBjC,IAAM,kBAAkB,CAAC,WAAmB,OAAO,WAAW,WAAW;AAQlE,IAAM,mBACX,QAAQ,IAAI,aAAa,eACrB;AAAA,EACE,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,OAAO,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAChD,SAAS,CAAC,MACR,oEAAoE,EAAE,OAAO;AAAA,IAE/E,QAAQ,MACN;AAAA,IAEF,KAAK,MAAM;AAAA,MACT;AAAA,MAEA;AAAA,IAEF;AAAA,EACF,CAAC;AAAA,EACD,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAC,OAAO,EAAE,MAAM,UAAU,MAAM,EAAE,OAAO;AAAA,IAChD,SAAS,CAAC,MACR,+BAA+B,EAAE,MAAM,iBAAiB,EAAE,OAAO;AAAA,IACnE,QAAQ,CAAC,MACP,EAAE,WAAW,YACT,mJAEA,EAAE,WAAW,SACX,oJAEA,gBAAgB,EAAE,MAAM,IACtB,kFACG,EAAE,MAAM,2CACX;AAAA,IACV,KAAK,CAAC,MACJ,EAAE,WAAW,YACT;AAAA,MACE;AAAA,MAEA;AAAA,IACF,IACA,EAAE,WAAW,SACX;AAAA,MACE;AAAA,MACA;AAAA,IACF,IACA,gBAAgB,EAAE,MAAM,IACtB;AAAA,MACE;AAAA,MAEA;AAAA,IAEF,IACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACZ,CAAC;AACH,IACA,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/codes.ts"],"sourcesContent":["import { defineDiagnostic } from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_UNSTABLE_COLUMNS: {\n /** Consecutive renders that passed a new `columns` array with the same shape. */\n renders: number\n }\n DK_UNSTABLE_OPTION: {\n /** `data`, `fetcher`, `rowKey`, or a feature's function option: `features[2].searchFn`. */\n option: string\n /** Consecutive renders that passed a new reference. */\n renders: number\n }\n }\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nconst isFeatureOption = (option: string) => option.startsWith('features[')\n\n/**\n * Codes owned by `@datakable/react` (§8.3, react, dev only). Like core's dev checks, the\n * definitions exist only in development: the NODE_ENV check is written out here (not an imported\n * flag) so a consumer's bundler folds it while parsing and drops the text from production bundles\n * (§8.2). They are never emitted in production, so `datakable/messages` has no text for them.\n */\nexport const reactDiagnostics =\n process.env.NODE_ENV !== 'production'\n ? [\n defineDiagnostic({\n code: 'DK_UNSTABLE_COLUMNS',\n level: 'warn',\n where: () => ({ kind: 'option', path: 'columns' }),\n problem: (d) =>\n `useDataTable received a new columns array with the same shape on ${d.renders} renders ` +\n 'in a row (columns are compared by reference)',\n impact: () =>\n 'each new array rebuilds the column cache and re-runs the pipeline; in a re-render caused ' +\n 'by the table itself, the columns the table already has are kept',\n fix: () => [\n 'define the columns outside the component, or memoise them: ' +\n 'useMemo(() => [...columns], [the values they read])',\n 'a new columns array is how you tell the table the columns changed (accessor / format / ' +\n 'cell), so create one only when they do',\n ],\n }),\n defineDiagnostic({\n code: 'DK_UNSTABLE_OPTION',\n level: 'warn',\n where: (d) => ({ kind: 'option', path: d.option }),\n problem: (d) =>\n `useDataTable received a new ${d.option} reference on ${d.renders} renders in a row`,\n impact: (d) =>\n d.option === 'fetcher'\n ? 'the table always calls the latest fetcher, but a new fetcher does not refetch: ' +\n 'values it reads that are not table state do not reload the data'\n : d.option === 'data'\n ? 'each new array is ingested again (schema, data checks, pipeline); in a re-render ' +\n 'caused by the table itself an array with equal rows is skipped'\n : isFeatureOption(d.option)\n ? 'features are read once, when the table is created: the table keeps calling the ' +\n `${d.option} of the first render (a stale closure)`\n : 'each new rowKey function recomputes every row key',\n fix: (d) =>\n d.option === 'fetcher'\n ? [\n 'call table.refetch() when a value the fetcher reads changes (or keep that value in ' +\n 'a server-mode feature state, which refetches by itself)',\n 'wrap the fetcher in useCallback to silence this warning',\n ]\n : d.option === 'data'\n ? [\n 'memoise derived data: useMemo(() => rows.filter(...), [rows])',\n 'or keep the data in state and pass the same array until it changes',\n ]\n : isFeatureOption(d.option)\n ? [\n 'create the features once: useMemo(() => [search({ searchFn })], []) or outside ' +\n 'the component',\n 'read changing values inside the function through a ref (ref.current) instead ' +\n 'of the render closure',\n ]\n : [\n \"use a key path (rowKey: 'id') or a function defined outside the component\",\n 'or wrap it in useCallback',\n ],\n }),\n ]\n : []\n"],"mappings":";AAAA,SAAS,wBAAwB;AAoBjC,IAAM,kBAAkB,CAAC,WAAmB,OAAO,WAAW,WAAW;AAQlE,IAAM,mBACX,QAAQ,IAAI,aAAa,eACrB;AAAA,EACE,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,OAAO,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,IAChD,SAAS,CAAC,MACR,oEAAoE,EAAE,OAAO;AAAA,IAE/E,QAAQ,MACN;AAAA,IAEF,KAAK,MAAM;AAAA,MACT;AAAA,MAEA;AAAA,IAEF;AAAA,EACF,CAAC;AAAA,EACD,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAC,OAAO,EAAE,MAAM,UAAU,MAAM,EAAE,OAAO;AAAA,IAChD,SAAS,CAAC,MACR,+BAA+B,EAAE,MAAM,iBAAiB,EAAE,OAAO;AAAA,IACnE,QAAQ,CAAC,MACP,EAAE,WAAW,YACT,mJAEA,EAAE,WAAW,SACX,oJAEA,gBAAgB,EAAE,MAAM,IACtB,kFACG,EAAE,MAAM,2CACX;AAAA,IACV,KAAK,CAAC,MACJ,EAAE,WAAW,YACT;AAAA,MACE;AAAA,MAEA;AAAA,IACF,IACA,EAAE,WAAW,SACX;AAAA,MACE;AAAA,MACA;AAAA,IACF,IACA,gBAAgB,EAAE,MAAM,IACtB;AAAA,MACE;AAAA,MAEA;AAAA,IAEF,IACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACZ,CAAC;AACH,IACA,CAAC;","names":[]}
@@ -1,5 +1,5 @@
1
- "use client";
2
1
  "use strict";
2
+ "use client";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data-table.tsx"],"sourcesContent":["import {\n type AnyFeature,\n boundaryDiagnostics,\n defaultFormat,\n deriveColumns,\n describeReturn,\n emitTableDiagnostic,\n type InvalidRowsMode,\n keepDiagnostics,\n matchesSlot,\n type RowIssue,\n type RowModelStatus,\n type SearchStatus,\n slotDiagnostics,\n type TableSchema,\n type TableState,\n} from '@datakable/core'\nimport {\n Component,\n type ComponentType,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n} from 'react'\nimport {\n cellSlot,\n invalidCellSlot,\n registerRenderOperations,\n renderDiagnostics,\n} from './render-codes'\nimport { type UseDataTableOptions, useDataTable } from './use-data-table'\n\n// The codes this module emits (bundlers keep the definitions; see core's `keepDiagnostics`).\nkeepDiagnostics(renderDiagnostics, boundaryDiagnostics, slotDiagnostics)\n\n// The ops its boundaries stand for (§3.4: `render:table`, `render:cell`). Registered at import:\n// the dist is one file per module (T37), so hook-only bundles (`useDataTable` without\n// `<DataTable />`) never include this module, and this call ships only with `<DataTable />`.\nregisterRenderOperations()\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n// --- public types --------------------------------------------------------------------------------\n\n/** Props of `components.SearchInput`: the search feature's `input`, bound both ways. */\nexport interface SearchInputProps {\n /** `state.search.input` (updates as the user types). */\n value: string\n /** `state.search.status`: `pending` while a debounce waits, `searching` while a request runs. */\n status: SearchStatus\n /** `setSearch(value)`. */\n onChange(value: string): void\n /** `flushSearch()` (Enter). */\n onSubmit(): void\n /** `clearSearch()` (Esc). */\n onClear(): void\n}\n\n/** Props of `components.Pagination` (the pagination feature's state and API). */\nexport interface PaginationProps {\n pageIndex: number\n pageSize: number\n pageCount: number\n canPrev: boolean\n canNext: boolean\n prev(): void\n next(): void\n setPageIndex(index: number): void\n setPageSize(size: number): void\n}\n\n/** Props of `components.Empty`: shown when the table has loaded and has no rows to show. */\nexport interface EmptyProps {\n /** `true` when there is data but filters / search removed every row. */\n filtered: boolean\n}\n\n/** Props of `components.Loading`: the first load (`isInitialLoad`, nothing to show yet). */\nexport interface LoadingProps {\n status: RowModelStatus\n}\n\n/** Props of `components.Error`: the first load failed, or the body failed to render. */\nexport interface ErrorProps {\n status: RowModelStatus\n /**\n * `'load'`: `status === 'error'` on the first load. `'render'`: a component in the body outside\n * the cells threw (a component inside a cell renders `⚠` in that cell only).\n */\n reason: 'load' | 'render'\n /** `'load'`: `refetch()`. `'render'`: renders the body again. */\n retry(): void\n}\n\n/** `<DataTable components={...} />`: replaces the default parts (unstyled, `data-*` hooks only). */\nexport interface DataTableComponents {\n SearchInput?: ComponentType<SearchInputProps>\n Pagination?: ComponentType<PaginationProps>\n Empty?: ComponentType<EmptyProps>\n Loading?: ComponentType<LoadingProps>\n Error?: ComponentType<ErrorProps>\n}\n\n/** What `<DataTable table={...} />` reads: the value `useDataTable` returns. */\nexport interface DataTableSource {\n readonly state: TableState\n readonly rowModel: {\n readonly rows: readonly DataTableRow[]\n readonly filteredCount: number\n readonly totalCount: number\n readonly status: RowModelStatus\n readonly isInitialLoad: boolean\n }\n getOptions(): { readonly columns?: readonly unknown[] | undefined }\n getData(): readonly unknown[]\n refetch(): Promise<unknown>\n}\n\n/** The part of a `Row` (§6.6) `<DataTable />` renders from. */\ninterface DataTableRow {\n readonly key: string | number\n readonly index: number\n readonly original: unknown\n readonly valid: boolean\n readonly issues: readonly RowIssue[]\n getValue(id: string): unknown\n getCellIssues(id: string): readonly RowIssue[]\n}\n\n/** `<DataTable />`'s own props, next to `table` or the `useDataTable` options. */\nexport interface DataTableOwnProps {\n components?: DataTableComponents | undefined\n caption?: ReactNode\n}\n\n/**\n * `<DataTable table={useDataTable(...)} />`, or `<DataTable data={rows} />` with the\n * `useDataTable` options as props (zero-config: columns derived from the data).\n */\nexport type DataTableProps<\n T = unknown,\n Sch = undefined,\n M extends InvalidRowsMode = InvalidRowsMode,\n> = DataTableOwnProps &\n (\n | { table: DataTableSource }\n | (UseDataTableOptions<T, TableState, Sch, M> & {\n features?: readonly AnyFeature[]\n table?: undefined\n })\n )\n\n// --- component -----------------------------------------------------------------------------------\n\n/**\n * The zero-config table (§10). Renders what the installed features provide: sort buttons with\n * `aria-sort`, a search input bound to `input` (Enter = `flushSearch`, Esc = `clearSearch`),\n * pagination, and the Loading / Error / Empty states from `status` + `isInitialLoad` (§6.6).\n * Unstyled: style it through the `data-*` hooks (`data-status`, `data-initial-load`,\n * `data-invalid`, `data-sort`, …) or replace parts with `components`.\n *\n * `@datakable/react`'s `DataTable` installs no features with `data`; `datakable`'s installs the\n * default preset.\n */\nexport function DataTable<\n T,\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(props: DataTableProps<T, Sch, M>): ReactNode\nexport function DataTable(\n props: DataTableOwnProps & { table?: DataTableSource | undefined },\n): ReactNode {\n if (props.table !== undefined) {\n return (\n <DataTableView table={props.table} components={props.components} caption={props.caption} />\n )\n }\n return <ZeroConfig {...(props as DataTableOwnProps & { table?: undefined })} />\n}\n\nfunction ZeroConfig(props: DataTableOwnProps & { table?: undefined }) {\n const { components, caption, table: _, ...options } = props\n const view = useDataTable(options as never) as unknown as DataTableSource\n return <DataTableView table={view} components={components} caption={caption} />\n}\n\n/** Loose access to the installed features' APIs (the table is typed per feature set). */\ntype Api = DataTableSource & {\n toggleSort?(id: string, opts?: { multi?: boolean }): void\n getSortDirection?(id: string): 'asc' | 'desc' | false\n setSearch?(q: string): Promise<unknown>\n flushSearch?(): Promise<unknown>\n clearSearch?(): void\n setPageIndex?(i: number): void\n setPageSize?(n: number): void\n nextPage?(): void\n prevPage?(): void\n getPageCount?(): number\n canNextPage?(): boolean\n canPrevPage?(): boolean\n}\n\n/** The column fields `<DataTable />` reads (types are checked where the columns are written). */\ninterface ColumnLike {\n key?: unknown\n id?: unknown\n header?: unknown\n sortable?: unknown\n cell?: (ctx: { row: unknown; value: unknown }) => ReactNode\n format?: (value: unknown) => unknown\n invalidCell?: (ctx: {\n original: unknown\n value: unknown\n issues: readonly RowIssue[]\n }) => ReactNode\n}\n\ninterface Column {\n readonly def: ColumnLike\n readonly index: number\n readonly id: string\n readonly header: ReactNode\n}\n\n/** A cell callback that threw or broke its contract during this render (reported after commit). */\ninterface Failure {\n slot: string\n column: string\n row: number\n error?: unknown\n /** Bad return: what the contract expects and the type received. */\n expected?: string\n received?: string\n}\n\nconst WARN = '⚠'\nconst BUSY: readonly RowModelStatus[] = ['validating', 'pending', 'searching', 'fetching']\nconst LOADING: readonly RowModelStatus[] = ['validating', 'searching', 'fetching']\n\n/**\n * The table loads its rows asynchronously: a `fetcher`, or a feature with a `searchFn` (its\n * `defineOptions` values). With nothing applied yet, its `'pending'` is a load waiting to start\n * (deferred until the client, §7.2), so `<DataTable />` shows Loading — also in the server HTML.\n */\nfunction hasAsyncSource(table: DataTableSource): boolean {\n const options = table.getOptions() as { fetcher?: unknown; features?: unknown }\n if (typeof options.fetcher === 'function') return true\n if (!Array.isArray(options.features)) return false\n for (const f of options.features as readonly {\n options?: { values?: { searchFn?: unknown } }\n }[]) {\n if (typeof f?.options?.values?.searchFn === 'function') return true\n }\n return false\n}\n\nfunction resolveColumns(defs: readonly unknown[]): Column[] {\n const out: Column[] = []\n for (let index = 0; index < defs.length; index++) {\n const def = defs[index] as ColumnLike | null | undefined\n if (def === null || typeof def !== 'object') continue\n const id = typeof def.key === 'string' ? def.key : def.id\n if (typeof id !== 'string') continue\n out.push({ def, index, id, header: typeof def.header === 'string' ? def.header : id })\n }\n return out\n}\n\nconst segment = (s: PropertyKey | { readonly key: PropertyKey }) =>\n String(typeof s === 'object' ? s.key : s)\n\n/**\n * The redacted issue text for `title` (§5.1): the issue paths only. Schema messages embed the\n * received value, so they are never shown.\n */\nfunction issueTitle(issues: readonly RowIssue[]): string {\n const paths = new Set<string>()\n for (const i of issues) paths.add(i.path?.length ? i.path.map(segment).join('.') : '(row)')\n return `Invalid: ${[...paths].join(', ')}`\n}\n\n/** The table behind a `useDataTable` view (its prototype), for reporting diagnostics. */\nconst tableOf = (view: object): object =>\n Object.hasOwn(view, 'rowModel') ? (Object.getPrototypeOf(view) as object) : view\n\nfunction report(table: object, failures: readonly Failure[]) {\n const bySlot = new Map<string, Failure[]>()\n for (const f of failures) {\n const k = `${f.slot}\\0${f.expected === undefined ? 'throw' : 'return'}`\n const list = bySlot.get(k)\n if (list) list.push(f)\n else bySlot.set(k, [f])\n }\n for (const list of bySlot.values()) {\n const first = list[0] as Failure\n const rows = list.slice(0, 3).map((f) => f.row)\n const fallback = 'those cells rendered ⚠'\n try {\n if (first.expected === undefined) {\n const e = first.error\n emitTableDiagnostic(\n table,\n 'DK_CALLBACK_FAILED',\n {\n slot: first.slot,\n column: first.column,\n rows,\n count: list.length,\n fallback,\n ...(e instanceof Error ? { errorName: e.name } : {}),\n },\n { cause: e },\n )\n } else if (process.env.NODE_ENV !== 'production') {\n emitTableDiagnostic(table, 'DK_CALLBACK_BAD_RETURN', {\n slot: first.slot,\n column: first.column,\n expected: first.expected,\n received: first.received ?? 'undefined',\n count: list.length,\n rows,\n fallback,\n })\n }\n } catch {\n // Not a table made by createTable (a hand-made `table` prop): nothing to report to.\n }\n }\n}\n\n/**\n * Renders one cell's content; a throwing or contract-breaking callback renders `⚠`. An object\n * returned by `cell` / `invalidCell` (an element, an array) may hold components that throw while\n * React renders them, so it gets its own boundary; primitives cannot, so they get none (no cost).\n */\nfunction cellContent(\n col: Column,\n row: DataTableRow,\n failures: Failure[],\n table: object,\n): ReactNode {\n const def = col.def\n const value = row.getValue(col.id)\n const issues = row.valid ? undefined : row.getCellIssues(col.id)\n let slot = 'cell'\n try {\n if (issues !== undefined && issues.length > 0) {\n if (def.invalidCell) {\n slot = 'invalidCell'\n const out = def.invalidCell({ original: row.original, value, issues })\n if (matchesSlot(invalidCellSlot, out)) return guard(out, table, col, row, 'invalidCell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n return (\n <>\n {defaultFormat(value)}{' '}\n <span data-dk-invalid-marker=\"\" aria-hidden=\"true\">\n {WARN}\n </span>\n </>\n )\n }\n if (def.cell) {\n const out = def.cell({ row: row.original, value })\n if (matchesSlot(cellSlot, out)) return guard(out, table, col, row, 'cell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n if (def.format) {\n slot = 'format'\n const out = def.format(value)\n if (typeof out === 'string') return out\n bad(failures, col, row, slot, 'a string', out)\n return defaultFormat(value)\n }\n return defaultFormat(value)\n } catch (error) {\n failures.push({ slot: `columns[${col.index}].${slot}`, column: col.id, row: row.index, error })\n return WARN\n }\n}\n\n/** Wraps object content in a per-cell boundary (`render:cell`); primitives pass through as-is. */\nfunction guard(\n out: ReactNode,\n table: object,\n col: Column,\n row: DataTableRow,\n slot: 'cell' | 'invalidCell',\n): ReactNode {\n if (typeof out !== 'object' || out === null) return out\n return (\n <CellBoundary table={table} col={col} slot={slot} row={row.index} original={row.original}>\n {out}\n </CellBoundary>\n )\n}\n\nfunction bad(\n failures: Failure[],\n col: Column,\n row: DataTableRow,\n slot: string,\n expected: string,\n out: unknown,\n): ReactNode {\n failures.push({\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row: row.index,\n expected,\n received: describeReturn(out),\n })\n return WARN\n}\n\nconst ariaSort = (dir: 'asc' | 'desc' | false) =>\n dir === 'asc' ? 'ascending' : dir === 'desc' ? 'descending' : 'none'\n\nfunction DataTableView(props: {\n table: DataTableSource\n components: DataTableComponents | undefined\n caption: ReactNode\n}) {\n const view = props.table as Api\n const parts = props.components ?? {}\n const { state, rowModel } = view\n const { rows, status, isInitialLoad } = rowModel\n const defs = view.getOptions().columns\n const data = view.getData()\n // Zero-config columns follow the data; given columns follow their reference (§10).\n const derivedFrom = defs === undefined ? data : undefined\n const columns = useMemo(\n () => resolveColumns(defs ?? (derivedFrom ? deriveColumns(derivedFrom) : [])),\n [defs, derivedFrom],\n )\n const failures: Failure[] = []\n const table = tableOf(view)\n // After commit, never during render: a sink may set state.\n useIsomorphicLayoutEffect(() => {\n if (failures.length > 0) report(table, failures)\n })\n\n const sortable = typeof view.toggleSort === 'function'\n const searchState = state.search as { input: string; status: SearchStatus } | undefined\n const paged = typeof view.getPageCount === 'function'\n // Loading (§6.6, §10): nothing to show yet and rows on their way — in flight, or deferred async\n // work that has not started (SSR, §7.2: 'pending').\n const loading =\n isInitialLoad && (LOADING.includes(status) || (status === 'pending' && hasAsyncSource(view)))\n const failed = isInitialLoad && status === 'error'\n const span = Math.max(columns.length, 1)\n const retryLoad = () => void view.refetch()\n\n const Search = parts.SearchInput ?? DefaultSearchInput\n const Pager = parts.Pagination ?? DefaultPagination\n const Empty = parts.Empty ?? DefaultEmpty\n const Loading = parts.Loading ?? DefaultLoading\n const ErrorState = parts.Error ?? DefaultError\n\n let body: ReactNode\n if (loading) {\n body = stateRow(span, 'loading', <Loading status={status} />)\n } else if (failed) {\n body = stateRow(span, 'error', <ErrorState status={status} reason=\"load\" retry={retryLoad} />)\n } else if (rows.length === 0) {\n body = stateRow(span, 'empty', <Empty filtered={rowModel.totalCount > 0} />)\n } else {\n body = rows.map((row) => {\n const valid = row.valid\n return (\n <tr\n key={row.key}\n data-invalid={valid ? undefined : 'true'}\n aria-invalid={valid ? undefined : 'true'}\n title={valid ? undefined : issueTitle(row.issues)}\n >\n {columns.map((col) => {\n const issues = valid ? undefined : row.getCellIssues(col.id)\n const broken = issues !== undefined && issues.length > 0\n return (\n <td\n key={col.index}\n data-invalid={broken ? 'true' : undefined}\n aria-invalid={broken ? 'true' : undefined}\n title={broken ? issueTitle(issues) : undefined}\n >\n {cellContent(col, row, failures, table)}\n </td>\n )\n })}\n </tr>\n )\n })\n }\n\n return (\n <div\n data-datakable=\"\"\n data-status={status}\n data-initial-load={isInitialLoad ? 'true' : 'false'}\n aria-busy={BUSY.includes(status) ? 'true' : undefined}\n >\n {searchState && (\n <div data-dk-search=\"\" data-status={searchState.status}>\n <Search\n value={searchState.input}\n status={searchState.status}\n onChange={(q) => void view.setSearch?.(q)}\n onSubmit={() => void view.flushSearch?.()}\n onClear={() => view.clearSearch?.()}\n />\n </div>\n )}\n {!loading && !failed && status !== 'idle' && (\n <RefreshIndicator status={status} retry={retryLoad} />\n )}\n <table>\n {props.caption != null && <caption>{props.caption}</caption>}\n <thead>\n <tr>\n {columns.map((col) => {\n const canSort = sortable && col.def.sortable !== false\n const dir = canSort ? (view.getSortDirection?.(col.id) ?? false) : false\n return (\n <th\n key={col.index}\n scope=\"col\"\n aria-sort={canSort ? ariaSort(dir) : undefined}\n data-sort={dir || undefined}\n >\n {canSort ? (\n <button\n type=\"button\"\n onClick={(e) => view.toggleSort?.(col.id, { multi: e.shiftKey })}\n >\n {col.header}\n <span data-dk-sort-indicator=\"\" aria-hidden=\"true\">\n {dir === 'asc' ? ' ▲' : dir === 'desc' ? ' ▼' : ''}\n </span>\n </button>\n ) : (\n col.header\n )}\n </th>\n )\n })}\n </tr>\n </thead>\n <tbody>\n <BodyBoundary\n table={table}\n resetKey={rowModel}\n fallback={(retry) =>\n stateRow(span, 'error', <ErrorState status={status} reason=\"render\" retry={retry} />)\n }\n >\n {body}\n </BodyBoundary>\n </tbody>\n </table>\n {paged && (\n <Pager\n pageIndex={(state.pagination as { pageIndex: number }).pageIndex}\n pageSize={(state.pagination as { pageSize: number }).pageSize}\n pageCount={view.getPageCount?.() ?? 0}\n canPrev={view.canPrevPage?.() ?? false}\n canNext={view.canNextPage?.() ?? false}\n prev={() => view.prevPage?.()}\n next={() => view.nextPage?.()}\n setPageIndex={(i) => view.setPageIndex?.(i)}\n setPageSize={(n) => view.setPageSize?.(n)}\n />\n )}\n </div>\n )\n}\n\nfunction stateRow(span: number, kind: string, content: ReactNode) {\n return (\n <tr data-dk-state={kind}>\n <td colSpan={span}>{content}</td>\n </tr>\n )\n}\n\n// --- error boundaries (DK_RENDER_FAILED) ---------------------------------------------------------\n\ninterface BoundaryProps {\n table: object\n /** A new value (the next row model) renders the body again. */\n resetKey: unknown\n fallback(retry: () => void): ReactNode\n children: ReactNode\n}\n\n/**\n * Catches a component that throws inside the body outside any cell boundary (§10: a\n * `components.Empty` / `Loading` / `Error` part): reports `DK_RENDER_FAILED` (`render:table`) and\n * shows the Error state; the header, search and pagination keep working.\n */\nclass BodyBoundary extends Component<BoundaryProps, { failed: boolean; key: unknown }> {\n override state = { failed: false, key: this.props.resetKey }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: BoundaryProps, state: { key: unknown }) {\n return props.resetKey === state.key ? null : { failed: false, key: props.resetKey }\n }\n\n override componentDidCatch(error: unknown) {\n try {\n emitTableDiagnostic(\n this.props.table,\n 'DK_RENDER_FAILED',\n { op: 'render:table', ...(error instanceof Error ? { errorName: error.name } : {}) },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n retry = () => this.setState({ failed: false })\n\n override render() {\n return this.state.failed ? this.props.fallback(this.retry) : this.props.children\n }\n}\n\ninterface CellBoundaryProps {\n table: object\n col: Column\n slot: 'cell' | 'invalidCell'\n /** The row's index in the data (`row.index`). */\n row: number\n /** The row's data: a new object (or new columns) renders a failed cell again. */\n original: unknown\n children: ReactNode\n}\n\ninterface CellBoundaryState {\n failed: boolean\n original: unknown\n def: ColumnLike\n}\n\n/**\n * One cell's boundary (`render:cell`, §3.4): a component returned by `cell` / `invalidCell` that\n * throws renders `⚠` in that cell only and reports `DK_RENDER_FAILED` (deduped per column); the\n * other cells, rows and the table keep working. Only wraps object content (see `guard`).\n */\nclass CellBoundary extends Component<CellBoundaryProps, CellBoundaryState> {\n override state: CellBoundaryState = {\n failed: false,\n original: this.props.original,\n def: this.props.col.def,\n }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: CellBoundaryProps, state: CellBoundaryState) {\n return props.original === state.original && props.col.def === state.def\n ? null\n : { failed: false, original: props.original, def: props.col.def }\n }\n\n override componentDidCatch(error: unknown) {\n const { table, col, slot, row } = this.props\n try {\n emitTableDiagnostic(\n table,\n 'DK_RENDER_FAILED',\n {\n op: 'render:cell',\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row,\n ...(error instanceof Error ? { errorName: error.name } : {}),\n },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n override render() {\n return this.state.failed ? WARN : this.props.children\n }\n}\n\n// --- default parts (unstyled) --------------------------------------------------------------------\n\nfunction DefaultSearchInput({ value, status, onChange, onSubmit, onClear }: SearchInputProps) {\n return (\n <>\n <input\n type=\"search\"\n aria-label=\"Search\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onSubmit()\n else if (e.key === 'Escape') onClear()\n }}\n />\n {(status === 'pending' || status === 'searching') && (\n <span role=\"status\" data-dk-spinner=\"\" aria-label=\"Searching\" />\n )}\n </>\n )\n}\n\nfunction DefaultPagination(p: PaginationProps) {\n return (\n <nav aria-label=\"Pagination\" data-dk-pagination=\"\">\n <button type=\"button\" aria-label=\"Previous page\" disabled={!p.canPrev} onClick={p.prev}>\n ‹\n </button>\n <span data-dk-page=\"\">\n Page {p.pageIndex + 1} of {Math.max(p.pageCount, 1)}\n </span>\n <button type=\"button\" aria-label=\"Next page\" disabled={!p.canNext} onClick={p.next}>\n ›\n </button>\n </nav>\n )\n}\n\nconst DefaultEmpty = ({ filtered }: EmptyProps) => <>{filtered ? 'No matching rows' : 'No rows'}</>\n\nconst DefaultLoading = (_: LoadingProps) => <span role=\"status\">Loading…</span>\n\nfunction DefaultError({ reason, retry }: ErrorProps) {\n return (\n <div role=\"alert\">\n {reason === 'load' ? 'Could not load the rows.' : 'Could not display the rows.'}{' '}\n <button type=\"button\" onClick={retry}>\n Retry\n </button>\n </div>\n )\n}\n\n/** Over stale rows (§6.6): the table is busy, or a later update failed. */\nfunction RefreshIndicator({ status, retry }: { status: RowModelStatus; retry(): void }) {\n if (status === 'error') {\n return (\n <div data-dk-refresh=\"\" data-status={status} role=\"alert\">\n Could not refresh; showing the previous rows.{' '}\n <button type=\"button\" onClick={retry}>\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,CAAC;AAAA,OACpD;AAAA,IACA,4CAAC,YAAO,MAAK,UAAS,cAAW,aAAY,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,MAAM,oBAEpF;AAAA,KACF;AAEJ;AAEA,IAAM,eAAe,CAAC,EAAE,SAAS,MAAkB,2EAAG,qBAAW,qBAAqB,WAAU;AAEhG,IAAM,iBAAiB,CAAC,MAAoB,4CAAC,UAAK,MAAK,UAAS,2BAAQ;AAExE,SAAS,aAAa,EAAE,QAAQ,MAAM,GAAe;AACnD,SACE,6CAAC,SAAI,MAAK,SACP;AAAA,eAAW,SAAS,6BAA6B;AAAA,IAA+B;AAAA,IACjF,4CAAC,YAAO,MAAK,UAAS,SAAS,OAAO,mBAEtC;AAAA,KACF;AAEJ;AAGA,SAAS,iBAAiB,EAAE,QAAQ,MAAM,GAA8C;AACtF,MAAI,WAAW,SAAS;AACtB,WACE,6CAAC,SAAI,mBAAgB,IAAG,eAAa,QAAQ,MAAK,SAAQ;AAAA;AAAA,MACV;AAAA,MAC9C,4CAAC,YAAO,MAAK,UAAS,SAAS,OAAO,mBAEtC;AAAA,OACF;AAAA,EAEJ;AACA,SACE,4CAAC,SAAI,mBAAgB,IAAG,eAAa,QAAQ,MAAK,UAAS,4BAE3D;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/data-table.tsx"],"sourcesContent":["'use client'\n\nimport {\n type AnyFeature,\n boundaryDiagnostics,\n defaultFormat,\n deriveColumns,\n describeReturn,\n emitTableDiagnostic,\n type InvalidRowsMode,\n keepDiagnostics,\n matchesSlot,\n type RowIssue,\n type RowModelStatus,\n type SearchStatus,\n slotDiagnostics,\n type TableSchema,\n type TableState,\n} from '@datakable/core'\nimport {\n Component,\n type ComponentType,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n} from 'react'\nimport {\n cellSlot,\n invalidCellSlot,\n registerRenderOperations,\n renderDiagnostics,\n} from './render-codes'\nimport { type UseDataTableOptions, useDataTable } from './use-data-table'\n\n// The codes this module emits (bundlers keep the definitions; see core's `keepDiagnostics`).\nkeepDiagnostics(renderDiagnostics, boundaryDiagnostics, slotDiagnostics)\n\n// The ops its boundaries stand for (§3.4: `render:table`, `render:cell`). Registered at import:\n// the dist is one file per module (T37), so hook-only bundles (`useDataTable` without\n// `<DataTable />`) never include this module, and this call ships only with `<DataTable />`.\nregisterRenderOperations()\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n// --- public types --------------------------------------------------------------------------------\n\n/** Props of `components.SearchInput`: the search feature's `input`, bound both ways. */\nexport interface SearchInputProps {\n /** `state.search.input` (updates as the user types). */\n value: string\n /** `state.search.status`: `pending` while a debounce waits, `searching` while a request runs. */\n status: SearchStatus\n /** `setSearch(value)`. */\n onChange(value: string): void\n /** `flushSearch()` (Enter). */\n onSubmit(): void\n /** `clearSearch()` (Esc). */\n onClear(): void\n}\n\n/** Props of `components.Pagination` (the pagination feature's state and API). */\nexport interface PaginationProps {\n pageIndex: number\n pageSize: number\n pageCount: number\n canPrev: boolean\n canNext: boolean\n prev(): void\n next(): void\n setPageIndex(index: number): void\n setPageSize(size: number): void\n}\n\n/** Props of `components.Empty`: shown when the table has loaded and has no rows to show. */\nexport interface EmptyProps {\n /** `true` when there is data but filters / search removed every row. */\n filtered: boolean\n}\n\n/** Props of `components.Loading`: the first load (`isInitialLoad`, nothing to show yet). */\nexport interface LoadingProps {\n status: RowModelStatus\n}\n\n/** Props of `components.Error`: the first load failed, or the body failed to render. */\nexport interface ErrorProps {\n status: RowModelStatus\n /**\n * `'load'`: `status === 'error'` on the first load. `'render'`: a component in the body outside\n * the cells threw (a component inside a cell renders `⚠` in that cell only).\n */\n reason: 'load' | 'render'\n /** `'load'`: `refetch()`. `'render'`: renders the body again. */\n retry(): void\n}\n\n/** `<DataTable components={...} />`: replaces the default parts (unstyled, `data-*` hooks only). */\nexport interface DataTableComponents {\n SearchInput?: ComponentType<SearchInputProps>\n Pagination?: ComponentType<PaginationProps>\n Empty?: ComponentType<EmptyProps>\n Loading?: ComponentType<LoadingProps>\n Error?: ComponentType<ErrorProps>\n}\n\n/** What `<DataTable table={...} />` reads: the value `useDataTable` returns. */\nexport interface DataTableSource {\n readonly state: TableState\n readonly rowModel: {\n readonly rows: readonly DataTableRow[]\n readonly filteredCount: number\n readonly totalCount: number\n readonly status: RowModelStatus\n readonly isInitialLoad: boolean\n }\n getOptions(): { readonly columns?: readonly unknown[] | undefined }\n getData(): readonly unknown[]\n refetch(): Promise<unknown>\n}\n\n/** The part of a `Row` (§6.6) `<DataTable />` renders from. */\ninterface DataTableRow {\n readonly key: string | number\n readonly index: number\n readonly original: unknown\n readonly valid: boolean\n readonly issues: readonly RowIssue[]\n getValue(id: string): unknown\n getCellIssues(id: string): readonly RowIssue[]\n}\n\n/** `<DataTable />`'s own props, next to `table` or the `useDataTable` options. */\nexport interface DataTableOwnProps {\n components?: DataTableComponents | undefined\n caption?: ReactNode\n}\n\n/**\n * `<DataTable table={useDataTable(...)} />`, or `<DataTable data={rows} />` with the\n * `useDataTable` options as props (zero-config: columns derived from the data).\n */\nexport type DataTableProps<\n T = unknown,\n Sch = undefined,\n M extends InvalidRowsMode = InvalidRowsMode,\n> = DataTableOwnProps &\n (\n | { table: DataTableSource }\n | (UseDataTableOptions<T, TableState, Sch, M> & {\n features?: readonly AnyFeature[]\n table?: undefined\n })\n )\n\n// --- component -----------------------------------------------------------------------------------\n\n/**\n * The zero-config table (§10). Renders what the installed features provide: sort buttons with\n * `aria-sort`, a search input bound to `input` (Enter = `flushSearch`, Esc = `clearSearch`),\n * pagination, and the Loading / Error / Empty states from `status` + `isInitialLoad` (§6.6).\n * Unstyled: style it through the `data-*` hooks (`data-status`, `data-initial-load`,\n * `data-invalid`, `data-sort`, …) or replace parts with `components`.\n *\n * `@datakable/react`'s `DataTable` installs no features with `data`; `datakable`'s installs the\n * default preset.\n */\nexport function DataTable<\n T,\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(props: DataTableProps<T, Sch, M>): ReactNode\nexport function DataTable(\n props: DataTableOwnProps & { table?: DataTableSource | undefined },\n): ReactNode {\n if (props.table !== undefined) {\n return (\n <DataTableView table={props.table} components={props.components} caption={props.caption} />\n )\n }\n return <ZeroConfig {...(props as DataTableOwnProps & { table?: undefined })} />\n}\n\nfunction ZeroConfig(props: DataTableOwnProps & { table?: undefined }) {\n const { components, caption, table: _, ...options } = props\n const view = useDataTable(options as never) as unknown as DataTableSource\n return <DataTableView table={view} components={components} caption={caption} />\n}\n\n/** Loose access to the installed features' APIs (the table is typed per feature set). */\ntype Api = DataTableSource & {\n toggleSort?(id: string, opts?: { multi?: boolean }): void\n getSortDirection?(id: string): 'asc' | 'desc' | false\n setSearch?(q: string): Promise<unknown>\n flushSearch?(): Promise<unknown>\n clearSearch?(): void\n setPageIndex?(i: number): void\n setPageSize?(n: number): void\n nextPage?(): void\n prevPage?(): void\n getPageCount?(): number\n canNextPage?(): boolean\n canPrevPage?(): boolean\n}\n\n/** The column fields `<DataTable />` reads (types are checked where the columns are written). */\ninterface ColumnLike {\n key?: unknown\n id?: unknown\n header?: unknown\n sortable?: unknown\n cell?: (ctx: { row: unknown; value: unknown }) => ReactNode\n format?: (value: unknown) => unknown\n invalidCell?: (ctx: {\n original: unknown\n value: unknown\n issues: readonly RowIssue[]\n }) => ReactNode\n}\n\ninterface Column {\n readonly def: ColumnLike\n readonly index: number\n readonly id: string\n readonly header: ReactNode\n}\n\n/** A cell callback that threw or broke its contract during this render (reported after commit). */\ninterface Failure {\n slot: string\n column: string\n row: number\n error?: unknown\n /** Bad return: what the contract expects and the type received. */\n expected?: string\n received?: string\n}\n\nconst WARN = '⚠'\nconst BUSY: readonly RowModelStatus[] = ['validating', 'pending', 'searching', 'fetching']\nconst LOADING: readonly RowModelStatus[] = ['validating', 'searching', 'fetching']\n\n/**\n * The table loads its rows asynchronously: a `fetcher`, or a feature with a `searchFn` (its\n * `defineOptions` values). With nothing applied yet, its `'pending'` is a load waiting to start\n * (deferred until the client, §7.2), so `<DataTable />` shows Loading — also in the server HTML.\n */\nfunction hasAsyncSource(table: DataTableSource): boolean {\n const options = table.getOptions() as { fetcher?: unknown; features?: unknown }\n if (typeof options.fetcher === 'function') return true\n if (!Array.isArray(options.features)) return false\n for (const f of options.features as readonly {\n options?: { values?: { searchFn?: unknown } }\n }[]) {\n if (typeof f?.options?.values?.searchFn === 'function') return true\n }\n return false\n}\n\nfunction resolveColumns(defs: readonly unknown[]): Column[] {\n const out: Column[] = []\n for (let index = 0; index < defs.length; index++) {\n const def = defs[index] as ColumnLike | null | undefined\n if (def === null || typeof def !== 'object') continue\n const id = typeof def.key === 'string' ? def.key : def.id\n if (typeof id !== 'string') continue\n out.push({ def, index, id, header: typeof def.header === 'string' ? def.header : id })\n }\n return out\n}\n\nconst segment = (s: PropertyKey | { readonly key: PropertyKey }) =>\n String(typeof s === 'object' ? s.key : s)\n\n/**\n * The redacted issue text for `title` (§5.1): the issue paths only. Schema messages embed the\n * received value, so they are never shown.\n */\nfunction issueTitle(issues: readonly RowIssue[]): string {\n const paths = new Set<string>()\n for (const i of issues) paths.add(i.path?.length ? i.path.map(segment).join('.') : '(row)')\n return `Invalid: ${[...paths].join(', ')}`\n}\n\n/** The table behind a `useDataTable` view (its prototype), for reporting diagnostics. */\nconst tableOf = (view: object): object =>\n Object.hasOwn(view, 'rowModel') ? (Object.getPrototypeOf(view) as object) : view\n\nfunction report(table: object, failures: readonly Failure[]) {\n const bySlot = new Map<string, Failure[]>()\n for (const f of failures) {\n const k = `${f.slot}\\0${f.expected === undefined ? 'throw' : 'return'}`\n const list = bySlot.get(k)\n if (list) list.push(f)\n else bySlot.set(k, [f])\n }\n for (const list of bySlot.values()) {\n const first = list[0] as Failure\n const rows = list.slice(0, 3).map((f) => f.row)\n const fallback = 'those cells rendered ⚠'\n try {\n if (first.expected === undefined) {\n const e = first.error\n emitTableDiagnostic(\n table,\n 'DK_CALLBACK_FAILED',\n {\n slot: first.slot,\n column: first.column,\n rows,\n count: list.length,\n fallback,\n ...(e instanceof Error ? { errorName: e.name } : {}),\n },\n { cause: e },\n )\n } else if (process.env.NODE_ENV !== 'production') {\n emitTableDiagnostic(table, 'DK_CALLBACK_BAD_RETURN', {\n slot: first.slot,\n column: first.column,\n expected: first.expected,\n received: first.received ?? 'undefined',\n count: list.length,\n rows,\n fallback,\n })\n }\n } catch {\n // Not a table made by createTable (a hand-made `table` prop): nothing to report to.\n }\n }\n}\n\n/**\n * Renders one cell's content; a throwing or contract-breaking callback renders `⚠`. An object\n * returned by `cell` / `invalidCell` (an element, an array) may hold components that throw while\n * React renders them, so it gets its own boundary; primitives cannot, so they get none (no cost).\n */\nfunction cellContent(\n col: Column,\n row: DataTableRow,\n failures: Failure[],\n table: object,\n): ReactNode {\n const def = col.def\n const value = row.getValue(col.id)\n const issues = row.valid ? undefined : row.getCellIssues(col.id)\n let slot = 'cell'\n try {\n if (issues !== undefined && issues.length > 0) {\n if (def.invalidCell) {\n slot = 'invalidCell'\n const out = def.invalidCell({ original: row.original, value, issues })\n if (matchesSlot(invalidCellSlot, out)) return guard(out, table, col, row, 'invalidCell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n return (\n <>\n {defaultFormat(value)}{' '}\n <span data-dk-invalid-marker=\"\" aria-hidden=\"true\">\n {WARN}\n </span>\n </>\n )\n }\n if (def.cell) {\n const out = def.cell({ row: row.original, value })\n if (matchesSlot(cellSlot, out)) return guard(out, table, col, row, 'cell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n if (def.format) {\n slot = 'format'\n const out = def.format(value)\n if (typeof out === 'string') return out\n bad(failures, col, row, slot, 'a string', out)\n return defaultFormat(value)\n }\n return defaultFormat(value)\n } catch (error) {\n failures.push({ slot: `columns[${col.index}].${slot}`, column: col.id, row: row.index, error })\n return WARN\n }\n}\n\n/** Wraps object content in a per-cell boundary (`render:cell`); primitives pass through as-is. */\nfunction guard(\n out: ReactNode,\n table: object,\n col: Column,\n row: DataTableRow,\n slot: 'cell' | 'invalidCell',\n): ReactNode {\n if (typeof out !== 'object' || out === null) return out\n return (\n <CellBoundary table={table} col={col} slot={slot} row={row.index} original={row.original}>\n {out}\n </CellBoundary>\n )\n}\n\nfunction bad(\n failures: Failure[],\n col: Column,\n row: DataTableRow,\n slot: string,\n expected: string,\n out: unknown,\n): ReactNode {\n failures.push({\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row: row.index,\n expected,\n received: describeReturn(out),\n })\n return WARN\n}\n\nconst ariaSort = (dir: 'asc' | 'desc' | false) =>\n dir === 'asc' ? 'ascending' : dir === 'desc' ? 'descending' : 'none'\n\nfunction DataTableView(props: {\n table: DataTableSource\n components: DataTableComponents | undefined\n caption: ReactNode\n}) {\n const view = props.table as Api\n const parts = props.components ?? {}\n const { state, rowModel } = view\n const { rows, status, isInitialLoad } = rowModel\n const defs = view.getOptions().columns\n const data = view.getData()\n // Zero-config columns follow the data; given columns follow their reference (§10).\n const derivedFrom = defs === undefined ? data : undefined\n const columns = useMemo(\n () => resolveColumns(defs ?? (derivedFrom ? deriveColumns(derivedFrom) : [])),\n [defs, derivedFrom],\n )\n const failures: Failure[] = []\n const table = tableOf(view)\n // After commit, never during render: a sink may set state.\n useIsomorphicLayoutEffect(() => {\n if (failures.length > 0) report(table, failures)\n })\n\n const sortable = typeof view.toggleSort === 'function'\n const searchState = state.search as { input: string; status: SearchStatus } | undefined\n const paged = typeof view.getPageCount === 'function'\n // Loading (§6.6, §10): nothing to show yet and rows on their way — in flight, or deferred async\n // work that has not started (SSR, §7.2: 'pending').\n const loading =\n isInitialLoad && (LOADING.includes(status) || (status === 'pending' && hasAsyncSource(view)))\n const failed = isInitialLoad && status === 'error'\n const span = Math.max(columns.length, 1)\n const retryLoad = () => void view.refetch()\n\n const Search = parts.SearchInput ?? DefaultSearchInput\n const Pager = parts.Pagination ?? DefaultPagination\n const Empty = parts.Empty ?? DefaultEmpty\n const Loading = parts.Loading ?? DefaultLoading\n const ErrorState = parts.Error ?? DefaultError\n\n let body: ReactNode\n if (loading) {\n body = stateRow(span, 'loading', <Loading status={status} />)\n } else if (failed) {\n body = stateRow(span, 'error', <ErrorState status={status} reason=\"load\" retry={retryLoad} />)\n } else if (rows.length === 0) {\n body = stateRow(span, 'empty', <Empty filtered={rowModel.totalCount > 0} />)\n } else {\n body = rows.map((row) => {\n const valid = row.valid\n return (\n <tr\n key={row.key}\n data-invalid={valid ? undefined : 'true'}\n aria-invalid={valid ? undefined : 'true'}\n title={valid ? undefined : issueTitle(row.issues)}\n >\n {columns.map((col) => {\n const issues = valid ? undefined : row.getCellIssues(col.id)\n const broken = issues !== undefined && issues.length > 0\n return (\n <td\n key={col.index}\n data-invalid={broken ? 'true' : undefined}\n aria-invalid={broken ? 'true' : undefined}\n title={broken ? issueTitle(issues) : undefined}\n >\n {cellContent(col, row, failures, table)}\n </td>\n )\n })}\n </tr>\n )\n })\n }\n\n return (\n <div\n data-datakable=\"\"\n data-status={status}\n data-initial-load={isInitialLoad ? 'true' : 'false'}\n aria-busy={BUSY.includes(status) ? 'true' : undefined}\n >\n {searchState && (\n <div data-dk-search=\"\" data-status={searchState.status}>\n <Search\n value={searchState.input}\n status={searchState.status}\n onChange={(q) => void view.setSearch?.(q)}\n onSubmit={() => void view.flushSearch?.()}\n onClear={() => view.clearSearch?.()}\n />\n </div>\n )}\n {!loading && !failed && status !== 'idle' && (\n <RefreshIndicator status={status} retry={retryLoad} />\n )}\n <table>\n {props.caption != null && <caption>{props.caption}</caption>}\n <thead>\n <tr>\n {columns.map((col) => {\n const canSort = sortable && col.def.sortable !== false\n const dir = canSort ? (view.getSortDirection?.(col.id) ?? false) : false\n return (\n <th\n key={col.index}\n scope=\"col\"\n aria-sort={canSort ? ariaSort(dir) : undefined}\n data-sort={dir || undefined}\n >\n {canSort ? (\n <button\n type=\"button\"\n onClick={(e) => view.toggleSort?.(col.id, { multi: e.shiftKey })}\n >\n {col.header}\n <span data-dk-sort-indicator=\"\" aria-hidden=\"true\">\n {dir === 'asc' ? ' ▲' : dir === 'desc' ? ' ▼' : ''}\n </span>\n </button>\n ) : (\n col.header\n )}\n </th>\n )\n })}\n </tr>\n </thead>\n <tbody>\n <BodyBoundary\n table={table}\n resetKey={rowModel}\n fallback={(retry) =>\n stateRow(span, 'error', <ErrorState status={status} reason=\"render\" retry={retry} />)\n }\n >\n {body}\n </BodyBoundary>\n </tbody>\n </table>\n {paged && (\n <Pager\n pageIndex={(state.pagination as { pageIndex: number }).pageIndex}\n pageSize={(state.pagination as { pageSize: number }).pageSize}\n pageCount={view.getPageCount?.() ?? 0}\n canPrev={view.canPrevPage?.() ?? false}\n canNext={view.canNextPage?.() ?? false}\n prev={() => view.prevPage?.()}\n next={() => view.nextPage?.()}\n setPageIndex={(i) => view.setPageIndex?.(i)}\n setPageSize={(n) => view.setPageSize?.(n)}\n />\n )}\n </div>\n )\n}\n\nfunction stateRow(span: number, kind: string, content: ReactNode) {\n return (\n <tr data-dk-state={kind}>\n <td colSpan={span}>{content}</td>\n </tr>\n )\n}\n\n// --- error boundaries (DK_RENDER_FAILED) ---------------------------------------------------------\n\ninterface BoundaryProps {\n table: object\n /** A new value (the next row model) renders the body again. */\n resetKey: unknown\n fallback(retry: () => void): ReactNode\n children: ReactNode\n}\n\n/**\n * Catches a component that throws inside the body outside any cell boundary (§10: a\n * `components.Empty` / `Loading` / `Error` part): reports `DK_RENDER_FAILED` (`render:table`) and\n * shows the Error state; the header, search and pagination keep working.\n */\nclass BodyBoundary extends Component<BoundaryProps, { failed: boolean; key: unknown }> {\n override state = { failed: false, key: this.props.resetKey }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: BoundaryProps, state: { key: unknown }) {\n return props.resetKey === state.key ? null : { failed: false, key: props.resetKey }\n }\n\n override componentDidCatch(error: unknown) {\n try {\n emitTableDiagnostic(\n this.props.table,\n 'DK_RENDER_FAILED',\n { op: 'render:table', ...(error instanceof Error ? { errorName: error.name } : {}) },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n retry = () => this.setState({ failed: false })\n\n override render() {\n return this.state.failed ? this.props.fallback(this.retry) : this.props.children\n }\n}\n\ninterface CellBoundaryProps {\n table: object\n col: Column\n slot: 'cell' | 'invalidCell'\n /** The row's index in the data (`row.index`). */\n row: number\n /** The row's data: a new object (or new columns) renders a failed cell again. */\n original: unknown\n children: ReactNode\n}\n\ninterface CellBoundaryState {\n failed: boolean\n original: unknown\n def: ColumnLike\n}\n\n/**\n * One cell's boundary (`render:cell`, §3.4): a component returned by `cell` / `invalidCell` that\n * throws renders `⚠` in that cell only and reports `DK_RENDER_FAILED` (deduped per column); the\n * other cells, rows and the table keep working. Only wraps object content (see `guard`).\n */\nclass CellBoundary extends Component<CellBoundaryProps, CellBoundaryState> {\n override state: CellBoundaryState = {\n failed: false,\n original: this.props.original,\n def: this.props.col.def,\n }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: CellBoundaryProps, state: CellBoundaryState) {\n return props.original === state.original && props.col.def === state.def\n ? null\n : { failed: false, original: props.original, def: props.col.def }\n }\n\n override componentDidCatch(error: unknown) {\n const { table, col, slot, row } = this.props\n try {\n emitTableDiagnostic(\n table,\n 'DK_RENDER_FAILED',\n {\n op: 'render:cell',\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row,\n ...(error instanceof Error ? { errorName: error.name } : {}),\n },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n override render() {\n return this.state.failed ? WARN : this.props.children\n }\n}\n\n// --- default parts (unstyled) --------------------------------------------------------------------\n\nfunction DefaultSearchInput({ value, status, onChange, onSubmit, onClear }: SearchInputProps) {\n return (\n <>\n <input\n type=\"search\"\n aria-label=\"Search\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onSubmit()\n else if (e.key === 'Escape') onClear()\n }}\n />\n {(status === 'pending' || status === 'searching') && (\n <span role=\"status\" data-dk-spinner=\"\" aria-label=\"Searching\" />\n )}\n </>\n )\n}\n\nfunction DefaultPagination(p: PaginationProps) {\n return (\n <nav aria-label=\"Pagination\" data-dk-pagination=\"\">\n <button type=\"button\" aria-label=\"Previous page\" disabled={!p.canPrev} onClick={p.prev}>\n ‹\n </button>\n <span data-dk-page=\"\">\n Page {p.pageIndex + 1} of {Math.max(p.pageCount, 1)}\n </span>\n <button type=\"button\" aria-label=\"Next page\" disabled={!p.canNext} onClick={p.next}>\n ›\n </button>\n </nav>\n )\n}\n\nconst DefaultEmpty = ({ filtered }: EmptyProps) => <>{filtered ? 'No matching rows' : 'No rows'}</>\n\nconst DefaultLoading = (_: LoadingProps) => <span role=\"status\">Loading…</span>\n\nfunction DefaultError({ reason, retry }: ErrorProps) {\n return (\n <div role=\"alert\">\n {reason === 'load' ? 'Could not load the rows.' : 'Could not display the rows.'}{' '}\n <button type=\"button\" onClick={retry}>\n Retry\n </button>\n </div>\n )\n}\n\n/** Over stale rows (§6.6): the table is busy, or a later update failed. */\nfunction RefreshIndicator({ status, retry }: { status: RowModelStatus; retry(): void }) {\n if (status === 'error') {\n return (\n <div data-dk-refresh=\"\" data-status={status} role=\"alert\">\n Could not refresh; showing the previous rows.{' '}\n <button type=\"button\" onClick={retry}>\n Retry\n </button>\n </div>\n )\n }\n return (\n <div data-dk-refresh=\"\" data-status={status} role=\"status\">\n Updating…\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAgBO;AACP,mBAOO;AACP,0BAKO;AACP,4BAAuD;AAoJjD;AAAA,IAjJN,6BAAgB,uCAAmB,iCAAqB,2BAAe;AAAA,IAKvE,8CAAyB;AAMzB,IAAM,4BAA4B,OAAO,WAAW,cAAc,yBAAY;AAi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,6CAAC,SAAI,MAAK,SACP;AAAA,eAAW,SAAS,6BAA6B;AAAA,IAA+B;AAAA,IACjF,4CAAC,YAAO,MAAK,UAAS,SAAS,OAAO,mBAEtC;AAAA,KACF;AAEJ;AAGA,SAAS,iBAAiB,EAAE,QAAQ,MAAM,GAA8C;AACtF,MAAI,WAAW,SAAS;AACtB,WACE,6CAAC,SAAI,mBAAgB,IAAG,eAAa,QAAQ,MAAK,SAAQ;AAAA;AAAA,MACV;AAAA,MAC9C,4CAAC,YAAO,MAAK,UAAS,SAAS,OAAO,mBAEtC;AAAA,OACF;AAAA,EAEJ;AACA,SACE,4CAAC,SAAI,mBAAgB,IAAG,eAAa,QAAQ,MAAK,UAAS,4BAE3D;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data-table.tsx"],"sourcesContent":["import {\n type AnyFeature,\n boundaryDiagnostics,\n defaultFormat,\n deriveColumns,\n describeReturn,\n emitTableDiagnostic,\n type InvalidRowsMode,\n keepDiagnostics,\n matchesSlot,\n type RowIssue,\n type RowModelStatus,\n type SearchStatus,\n slotDiagnostics,\n type TableSchema,\n type TableState,\n} from '@datakable/core'\nimport {\n Component,\n type ComponentType,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n} from 'react'\nimport {\n cellSlot,\n invalidCellSlot,\n registerRenderOperations,\n renderDiagnostics,\n} from './render-codes'\nimport { type UseDataTableOptions, useDataTable } from './use-data-table'\n\n// The codes this module emits (bundlers keep the definitions; see core's `keepDiagnostics`).\nkeepDiagnostics(renderDiagnostics, boundaryDiagnostics, slotDiagnostics)\n\n// The ops its boundaries stand for (§3.4: `render:table`, `render:cell`). Registered at import:\n// the dist is one file per module (T37), so hook-only bundles (`useDataTable` without\n// `<DataTable />`) never include this module, and this call ships only with `<DataTable />`.\nregisterRenderOperations()\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n// --- public types --------------------------------------------------------------------------------\n\n/** Props of `components.SearchInput`: the search feature's `input`, bound both ways. */\nexport interface SearchInputProps {\n /** `state.search.input` (updates as the user types). */\n value: string\n /** `state.search.status`: `pending` while a debounce waits, `searching` while a request runs. */\n status: SearchStatus\n /** `setSearch(value)`. */\n onChange(value: string): void\n /** `flushSearch()` (Enter). */\n onSubmit(): void\n /** `clearSearch()` (Esc). */\n onClear(): void\n}\n\n/** Props of `components.Pagination` (the pagination feature's state and API). */\nexport interface PaginationProps {\n pageIndex: number\n pageSize: number\n pageCount: number\n canPrev: boolean\n canNext: boolean\n prev(): void\n next(): void\n setPageIndex(index: number): void\n setPageSize(size: number): void\n}\n\n/** Props of `components.Empty`: shown when the table has loaded and has no rows to show. */\nexport interface EmptyProps {\n /** `true` when there is data but filters / search removed every row. */\n filtered: boolean\n}\n\n/** Props of `components.Loading`: the first load (`isInitialLoad`, nothing to show yet). */\nexport interface LoadingProps {\n status: RowModelStatus\n}\n\n/** Props of `components.Error`: the first load failed, or the body failed to render. */\nexport interface ErrorProps {\n status: RowModelStatus\n /**\n * `'load'`: `status === 'error'` on the first load. `'render'`: a component in the body outside\n * the cells threw (a component inside a cell renders `⚠` in that cell only).\n */\n reason: 'load' | 'render'\n /** `'load'`: `refetch()`. `'render'`: renders the body again. */\n retry(): void\n}\n\n/** `<DataTable components={...} />`: replaces the default parts (unstyled, `data-*` hooks only). */\nexport interface DataTableComponents {\n SearchInput?: ComponentType<SearchInputProps>\n Pagination?: ComponentType<PaginationProps>\n Empty?: ComponentType<EmptyProps>\n Loading?: ComponentType<LoadingProps>\n Error?: ComponentType<ErrorProps>\n}\n\n/** What `<DataTable table={...} />` reads: the value `useDataTable` returns. */\nexport interface DataTableSource {\n readonly state: TableState\n readonly rowModel: {\n readonly rows: readonly DataTableRow[]\n readonly filteredCount: number\n readonly totalCount: number\n readonly status: RowModelStatus\n readonly isInitialLoad: boolean\n }\n getOptions(): { readonly columns?: readonly unknown[] | undefined }\n getData(): readonly unknown[]\n refetch(): Promise<unknown>\n}\n\n/** The part of a `Row` (§6.6) `<DataTable />` renders from. */\ninterface DataTableRow {\n readonly key: string | number\n readonly index: number\n readonly original: unknown\n readonly valid: boolean\n readonly issues: readonly RowIssue[]\n getValue(id: string): unknown\n getCellIssues(id: string): readonly RowIssue[]\n}\n\n/** `<DataTable />`'s own props, next to `table` or the `useDataTable` options. */\nexport interface DataTableOwnProps {\n components?: DataTableComponents | undefined\n caption?: ReactNode\n}\n\n/**\n * `<DataTable table={useDataTable(...)} />`, or `<DataTable data={rows} />` with the\n * `useDataTable` options as props (zero-config: columns derived from the data).\n */\nexport type DataTableProps<\n T = unknown,\n Sch = undefined,\n M extends InvalidRowsMode = InvalidRowsMode,\n> = DataTableOwnProps &\n (\n | { table: DataTableSource }\n | (UseDataTableOptions<T, TableState, Sch, M> & {\n features?: readonly AnyFeature[]\n table?: undefined\n })\n )\n\n// --- component -----------------------------------------------------------------------------------\n\n/**\n * The zero-config table (§10). Renders what the installed features provide: sort buttons with\n * `aria-sort`, a search input bound to `input` (Enter = `flushSearch`, Esc = `clearSearch`),\n * pagination, and the Loading / Error / Empty states from `status` + `isInitialLoad` (§6.6).\n * Unstyled: style it through the `data-*` hooks (`data-status`, `data-initial-load`,\n * `data-invalid`, `data-sort`, …) or replace parts with `components`.\n *\n * `@datakable/react`'s `DataTable` installs no features with `data`; `datakable`'s installs the\n * default preset.\n */\nexport function DataTable<\n T,\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(props: DataTableProps<T, Sch, M>): ReactNode\nexport function DataTable(\n props: DataTableOwnProps & { table?: DataTableSource | undefined },\n): ReactNode {\n if (props.table !== undefined) {\n return (\n <DataTableView table={props.table} components={props.components} caption={props.caption} />\n )\n }\n return <ZeroConfig {...(props as DataTableOwnProps & { table?: undefined })} />\n}\n\nfunction ZeroConfig(props: DataTableOwnProps & { table?: undefined }) {\n const { components, caption, table: _, ...options } = props\n const view = useDataTable(options as never) as unknown as DataTableSource\n return <DataTableView table={view} components={components} caption={caption} />\n}\n\n/** Loose access to the installed features' APIs (the table is typed per feature set). */\ntype Api = DataTableSource & {\n toggleSort?(id: string, opts?: { multi?: boolean }): void\n getSortDirection?(id: string): 'asc' | 'desc' | false\n setSearch?(q: string): Promise<unknown>\n flushSearch?(): Promise<unknown>\n clearSearch?(): void\n setPageIndex?(i: number): void\n setPageSize?(n: number): void\n nextPage?(): void\n prevPage?(): void\n getPageCount?(): number\n canNextPage?(): boolean\n canPrevPage?(): boolean\n}\n\n/** The column fields `<DataTable />` reads (types are checked where the columns are written). */\ninterface ColumnLike {\n key?: unknown\n id?: unknown\n header?: unknown\n sortable?: unknown\n cell?: (ctx: { row: unknown; value: unknown }) => ReactNode\n format?: (value: unknown) => unknown\n invalidCell?: (ctx: {\n original: unknown\n value: unknown\n issues: readonly RowIssue[]\n }) => ReactNode\n}\n\ninterface Column {\n readonly def: ColumnLike\n readonly index: number\n readonly id: string\n readonly header: ReactNode\n}\n\n/** A cell callback that threw or broke its contract during this render (reported after commit). */\ninterface Failure {\n slot: string\n column: string\n row: number\n error?: unknown\n /** Bad return: what the contract expects and the type received. */\n expected?: string\n received?: string\n}\n\nconst WARN = '⚠'\nconst BUSY: readonly RowModelStatus[] = ['validating', 'pending', 'searching', 'fetching']\nconst LOADING: readonly RowModelStatus[] = ['validating', 'searching', 'fetching']\n\n/**\n * The table loads its rows asynchronously: a `fetcher`, or a feature with a `searchFn` (its\n * `defineOptions` values). With nothing applied yet, its `'pending'` is a load waiting to start\n * (deferred until the client, §7.2), so `<DataTable />` shows Loading — also in the server HTML.\n */\nfunction hasAsyncSource(table: DataTableSource): boolean {\n const options = table.getOptions() as { fetcher?: unknown; features?: unknown }\n if (typeof options.fetcher === 'function') return true\n if (!Array.isArray(options.features)) return false\n for (const f of options.features as readonly {\n options?: { values?: { searchFn?: unknown } }\n }[]) {\n if (typeof f?.options?.values?.searchFn === 'function') return true\n }\n return false\n}\n\nfunction resolveColumns(defs: readonly unknown[]): Column[] {\n const out: Column[] = []\n for (let index = 0; index < defs.length; index++) {\n const def = defs[index] as ColumnLike | null | undefined\n if (def === null || typeof def !== 'object') continue\n const id = typeof def.key === 'string' ? def.key : def.id\n if (typeof id !== 'string') continue\n out.push({ def, index, id, header: typeof def.header === 'string' ? def.header : id })\n }\n return out\n}\n\nconst segment = (s: PropertyKey | { readonly key: PropertyKey }) =>\n String(typeof s === 'object' ? s.key : s)\n\n/**\n * The redacted issue text for `title` (§5.1): the issue paths only. Schema messages embed the\n * received value, so they are never shown.\n */\nfunction issueTitle(issues: readonly RowIssue[]): string {\n const paths = new Set<string>()\n for (const i of issues) paths.add(i.path?.length ? i.path.map(segment).join('.') : '(row)')\n return `Invalid: ${[...paths].join(', ')}`\n}\n\n/** The table behind a `useDataTable` view (its prototype), for reporting diagnostics. */\nconst tableOf = (view: object): object =>\n Object.hasOwn(view, 'rowModel') ? (Object.getPrototypeOf(view) as object) : view\n\nfunction report(table: object, failures: readonly Failure[]) {\n const bySlot = new Map<string, Failure[]>()\n for (const f of failures) {\n const k = `${f.slot}\\0${f.expected === undefined ? 'throw' : 'return'}`\n const list = bySlot.get(k)\n if (list) list.push(f)\n else bySlot.set(k, [f])\n }\n for (const list of bySlot.values()) {\n const first = list[0] as Failure\n const rows = list.slice(0, 3).map((f) => f.row)\n const fallback = 'those cells rendered ⚠'\n try {\n if (first.expected === undefined) {\n const e = first.error\n emitTableDiagnostic(\n table,\n 'DK_CALLBACK_FAILED',\n {\n slot: first.slot,\n column: first.column,\n rows,\n count: list.length,\n fallback,\n ...(e instanceof Error ? { errorName: e.name } : {}),\n },\n { cause: e },\n )\n } else if (process.env.NODE_ENV !== 'production') {\n emitTableDiagnostic(table, 'DK_CALLBACK_BAD_RETURN', {\n slot: first.slot,\n column: first.column,\n expected: first.expected,\n received: first.received ?? 'undefined',\n count: list.length,\n rows,\n fallback,\n })\n }\n } catch {\n // Not a table made by createTable (a hand-made `table` prop): nothing to report to.\n }\n }\n}\n\n/**\n * Renders one cell's content; a throwing or contract-breaking callback renders `⚠`. An object\n * returned by `cell` / `invalidCell` (an element, an array) may hold components that throw while\n * React renders them, so it gets its own boundary; primitives cannot, so they get none (no cost).\n */\nfunction cellContent(\n col: Column,\n row: DataTableRow,\n failures: Failure[],\n table: object,\n): ReactNode {\n const def = col.def\n const value = row.getValue(col.id)\n const issues = row.valid ? undefined : row.getCellIssues(col.id)\n let slot = 'cell'\n try {\n if (issues !== undefined && issues.length > 0) {\n if (def.invalidCell) {\n slot = 'invalidCell'\n const out = def.invalidCell({ original: row.original, value, issues })\n if (matchesSlot(invalidCellSlot, out)) return guard(out, table, col, row, 'invalidCell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n return (\n <>\n {defaultFormat(value)}{' '}\n <span data-dk-invalid-marker=\"\" aria-hidden=\"true\">\n {WARN}\n </span>\n </>\n )\n }\n if (def.cell) {\n const out = def.cell({ row: row.original, value })\n if (matchesSlot(cellSlot, out)) return guard(out, table, col, row, 'cell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n if (def.format) {\n slot = 'format'\n const out = def.format(value)\n if (typeof out === 'string') return out\n bad(failures, col, row, slot, 'a string', out)\n return defaultFormat(value)\n }\n return defaultFormat(value)\n } catch (error) {\n failures.push({ slot: `columns[${col.index}].${slot}`, column: col.id, row: row.index, error })\n return WARN\n }\n}\n\n/** Wraps object content in a per-cell boundary (`render:cell`); primitives pass through as-is. */\nfunction guard(\n out: ReactNode,\n table: object,\n col: Column,\n row: DataTableRow,\n slot: 'cell' | 'invalidCell',\n): ReactNode {\n if (typeof out !== 'object' || out === null) return out\n return (\n <CellBoundary table={table} col={col} slot={slot} row={row.index} original={row.original}>\n {out}\n </CellBoundary>\n )\n}\n\nfunction bad(\n failures: Failure[],\n col: Column,\n row: DataTableRow,\n slot: string,\n expected: string,\n out: unknown,\n): ReactNode {\n failures.push({\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row: row.index,\n expected,\n received: describeReturn(out),\n })\n return WARN\n}\n\nconst ariaSort = (dir: 'asc' | 'desc' | false) =>\n dir === 'asc' ? 'ascending' : dir === 'desc' ? 'descending' : 'none'\n\nfunction DataTableView(props: {\n table: DataTableSource\n components: DataTableComponents | undefined\n caption: ReactNode\n}) {\n const view = props.table as Api\n const parts = props.components ?? {}\n const { state, rowModel } = view\n const { rows, status, isInitialLoad } = rowModel\n const defs = view.getOptions().columns\n const data = view.getData()\n // Zero-config columns follow the data; given columns follow their reference (§10).\n const derivedFrom = defs === undefined ? data : undefined\n const columns = useMemo(\n () => resolveColumns(defs ?? (derivedFrom ? deriveColumns(derivedFrom) : [])),\n [defs, derivedFrom],\n )\n const failures: Failure[] = []\n const table = tableOf(view)\n // After commit, never during render: a sink may set state.\n useIsomorphicLayoutEffect(() => {\n if (failures.length > 0) report(table, failures)\n })\n\n const sortable = typeof view.toggleSort === 'function'\n const searchState = state.search as { input: string; status: SearchStatus } | undefined\n const paged = typeof view.getPageCount === 'function'\n // Loading (§6.6, §10): nothing to show yet and rows on their way — in flight, or deferred async\n // work that has not started (SSR, §7.2: 'pending').\n const loading =\n isInitialLoad && (LOADING.includes(status) || (status === 'pending' && hasAsyncSource(view)))\n const failed = isInitialLoad && status === 'error'\n const span = Math.max(columns.length, 1)\n const retryLoad = () => void view.refetch()\n\n const Search = parts.SearchInput ?? DefaultSearchInput\n const Pager = parts.Pagination ?? DefaultPagination\n const Empty = parts.Empty ?? DefaultEmpty\n const Loading = parts.Loading ?? DefaultLoading\n const ErrorState = parts.Error ?? DefaultError\n\n let body: ReactNode\n if (loading) {\n body = stateRow(span, 'loading', <Loading status={status} />)\n } else if (failed) {\n body = stateRow(span, 'error', <ErrorState status={status} reason=\"load\" retry={retryLoad} />)\n } else if (rows.length === 0) {\n body = stateRow(span, 'empty', <Empty filtered={rowModel.totalCount > 0} />)\n } else {\n body = rows.map((row) => {\n const valid = row.valid\n return (\n <tr\n key={row.key}\n data-invalid={valid ? undefined : 'true'}\n aria-invalid={valid ? undefined : 'true'}\n title={valid ? undefined : issueTitle(row.issues)}\n >\n {columns.map((col) => {\n const issues = valid ? undefined : row.getCellIssues(col.id)\n const broken = issues !== undefined && issues.length > 0\n return (\n <td\n key={col.index}\n data-invalid={broken ? 'true' : undefined}\n aria-invalid={broken ? 'true' : undefined}\n title={broken ? issueTitle(issues) : undefined}\n >\n {cellContent(col, row, failures, table)}\n </td>\n )\n })}\n </tr>\n )\n })\n }\n\n return (\n <div\n data-datakable=\"\"\n data-status={status}\n data-initial-load={isInitialLoad ? 'true' : 'false'}\n aria-busy={BUSY.includes(status) ? 'true' : undefined}\n >\n {searchState && (\n <div data-dk-search=\"\" data-status={searchState.status}>\n <Search\n value={searchState.input}\n status={searchState.status}\n onChange={(q) => void view.setSearch?.(q)}\n onSubmit={() => void view.flushSearch?.()}\n onClear={() => view.clearSearch?.()}\n />\n </div>\n )}\n {!loading && !failed && status !== 'idle' && (\n <RefreshIndicator status={status} retry={retryLoad} />\n )}\n <table>\n {props.caption != null && <caption>{props.caption}</caption>}\n <thead>\n <tr>\n {columns.map((col) => {\n const canSort = sortable && col.def.sortable !== false\n const dir = canSort ? (view.getSortDirection?.(col.id) ?? false) : false\n return (\n <th\n key={col.index}\n scope=\"col\"\n aria-sort={canSort ? ariaSort(dir) : undefined}\n data-sort={dir || undefined}\n >\n {canSort ? (\n <button\n type=\"button\"\n onClick={(e) => view.toggleSort?.(col.id, { multi: e.shiftKey })}\n >\n {col.header}\n <span data-dk-sort-indicator=\"\" aria-hidden=\"true\">\n {dir === 'asc' ? ' ▲' : dir === 'desc' ? ' ▼' : ''}\n </span>\n </button>\n ) : (\n col.header\n )}\n </th>\n )\n })}\n </tr>\n </thead>\n <tbody>\n <BodyBoundary\n table={table}\n resetKey={rowModel}\n fallback={(retry) =>\n stateRow(span, 'error', <ErrorState status={status} reason=\"render\" retry={retry} />)\n }\n >\n {body}\n </BodyBoundary>\n </tbody>\n </table>\n {paged && (\n <Pager\n pageIndex={(state.pagination as { pageIndex: number }).pageIndex}\n pageSize={(state.pagination as { pageSize: number }).pageSize}\n pageCount={view.getPageCount?.() ?? 0}\n canPrev={view.canPrevPage?.() ?? false}\n canNext={view.canNextPage?.() ?? false}\n prev={() => view.prevPage?.()}\n next={() => view.nextPage?.()}\n setPageIndex={(i) => view.setPageIndex?.(i)}\n setPageSize={(n) => view.setPageSize?.(n)}\n />\n )}\n </div>\n )\n}\n\nfunction stateRow(span: number, kind: string, content: ReactNode) {\n return (\n <tr data-dk-state={kind}>\n <td colSpan={span}>{content}</td>\n </tr>\n )\n}\n\n// --- error boundaries (DK_RENDER_FAILED) ---------------------------------------------------------\n\ninterface BoundaryProps {\n table: object\n /** A new value (the next row model) renders the body again. */\n resetKey: unknown\n fallback(retry: () => void): ReactNode\n children: ReactNode\n}\n\n/**\n * Catches a component that throws inside the body outside any cell boundary (§10: a\n * `components.Empty` / `Loading` / `Error` part): reports `DK_RENDER_FAILED` (`render:table`) and\n * shows the Error state; the header, search and pagination keep working.\n */\nclass BodyBoundary extends Component<BoundaryProps, { failed: boolean; key: unknown }> {\n override state = { failed: false, key: this.props.resetKey }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: BoundaryProps, state: { key: unknown }) {\n return props.resetKey === state.key ? null : { failed: false, key: props.resetKey }\n }\n\n override componentDidCatch(error: unknown) {\n try {\n emitTableDiagnostic(\n this.props.table,\n 'DK_RENDER_FAILED',\n { op: 'render:table', ...(error instanceof Error ? { errorName: error.name } : {}) },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n retry = () => this.setState({ failed: false })\n\n override render() {\n return this.state.failed ? this.props.fallback(this.retry) : this.props.children\n }\n}\n\ninterface CellBoundaryProps {\n table: object\n col: Column\n slot: 'cell' | 'invalidCell'\n /** The row's index in the data (`row.index`). */\n row: number\n /** The row's data: a new object (or new columns) renders a failed cell again. */\n original: unknown\n children: ReactNode\n}\n\ninterface CellBoundaryState {\n failed: boolean\n original: unknown\n def: ColumnLike\n}\n\n/**\n * One cell's boundary (`render:cell`, §3.4): a component returned by `cell` / `invalidCell` that\n * throws renders `⚠` in that cell only and reports `DK_RENDER_FAILED` (deduped per column); the\n * other cells, rows and the table keep working. Only wraps object content (see `guard`).\n */\nclass CellBoundary extends Component<CellBoundaryProps, CellBoundaryState> {\n override state: CellBoundaryState = {\n failed: false,\n original: this.props.original,\n def: this.props.col.def,\n }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: CellBoundaryProps, state: CellBoundaryState) {\n return props.original === state.original && props.col.def === state.def\n ? null\n : { failed: false, original: props.original, def: props.col.def }\n }\n\n override componentDidCatch(error: unknown) {\n const { table, col, slot, row } = this.props\n try {\n emitTableDiagnostic(\n table,\n 'DK_RENDER_FAILED',\n {\n op: 'render:cell',\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row,\n ...(error instanceof Error ? { errorName: error.name } : {}),\n },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n override render() {\n return this.state.failed ? WARN : this.props.children\n }\n}\n\n// --- default parts (unstyled) --------------------------------------------------------------------\n\nfunction DefaultSearchInput({ value, status, onChange, onSubmit, onClear }: SearchInputProps) {\n return (\n <>\n <input\n type=\"search\"\n aria-label=\"Search\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onSubmit()\n else if (e.key === 'Escape') onClear()\n }}\n />\n {(status === 'pending' || status === 'searching') && (\n <span role=\"status\" data-dk-spinner=\"\" aria-label=\"Searching\" />\n )}\n </>\n )\n}\n\nfunction DefaultPagination(p: PaginationProps) {\n return (\n <nav aria-label=\"Pagination\" data-dk-pagination=\"\">\n <button type=\"button\" aria-label=\"Previous page\" disabled={!p.canPrev} onClick={p.prev}>\n ‹\n </button>\n <span data-dk-page=\"\">\n Page {p.pageIndex + 1} of {Math.max(p.pageCount, 1)}\n </span>\n <button type=\"button\" aria-label=\"Next page\" disabled={!p.canNext} onClick={p.next}>\n ›\n </button>\n </nav>\n )\n}\n\nconst DefaultEmpty = ({ filtered }: EmptyProps) => <>{filtered ? 'No matching rows' : 'No rows'}</>\n\nconst DefaultLoading = (_: LoadingProps) => <span role=\"status\">Loading…</span>\n\nfunction DefaultError({ reason, retry }: ErrorProps) {\n return (\n <div role=\"alert\">\n {reason === 'load' ? 'Could not load the rows.' : 'Could not display the rows.'}{' '}\n <button type=\"button\" onClick={retry}>\n Retry\n </button>\n </div>\n )\n}\n\n/** Over stale rows (§6.6): the table is busy, or a later update failed. */\nfunction RefreshIndicator({ status, retry }: { status: RowModelStatus; retry(): void }) {\n if (status === 'error') {\n return (\n <div data-dk-refresh=\"\" data-status={status} role=\"alert\">\n Could not refresh; showing the previous rows.{' '}\n <button type=\"button\" onClick={retry}>\n Retry\n </button>\n </div>\n )\n }\n return (\n <div data-dk-refresh=\"\" data-status={status} role=\"status\">\n Updating…\n </div>\n )\n}\n"],"mappings":";;;AAAA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAIA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAmC,oBAAoB;AAoJjD,SAoLE,UApLF,KAoLE,YApLF;AAjJN,gBAAgB,mBAAmB,qBAAqB,eAAe;AAKvE,yBAAyB;AAMzB,IAAM,4BAA4B,OAAO,WAAW,cAAc,YAAY;AAiIvE,SAAS,UACd,OACW;AACX,MAAI,MAAM,UAAU,QAAW;AAC7B,WACE,oBAAC,iBAAc,OAAO,MAAM,OAAO,YAAY,MAAM,YAAY,SAAS,MAAM,SAAS;AAAA,EAE7F;AACA,SAAO,oBAAC,cAAY,GAA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;AACtF,MAAI,WAAW,SAAS;AACtB,WACE,qBAAC,SAAI,mBAAgB,IAAG,eAAa,QAAQ,MAAK,SAAQ;AAAA;AAAA,MACV;AAAA,MAC9C,oBAAC,YAAO,MAAK,UAAS,SAAS,OAAO,mBAEtC;AAAA,OACF;AAAA,EAEJ;AACA,SACE,oBAAC,SAAI,mBAAgB,IAAG,eAAa,QAAQ,MAAK,UAAS,4BAE3D;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/data-table.tsx"],"sourcesContent":["'use client'\n\nimport {\n type AnyFeature,\n boundaryDiagnostics,\n defaultFormat,\n deriveColumns,\n describeReturn,\n emitTableDiagnostic,\n type InvalidRowsMode,\n keepDiagnostics,\n matchesSlot,\n type RowIssue,\n type RowModelStatus,\n type SearchStatus,\n slotDiagnostics,\n type TableSchema,\n type TableState,\n} from '@datakable/core'\nimport {\n Component,\n type ComponentType,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n} from 'react'\nimport {\n cellSlot,\n invalidCellSlot,\n registerRenderOperations,\n renderDiagnostics,\n} from './render-codes'\nimport { type UseDataTableOptions, useDataTable } from './use-data-table'\n\n// The codes this module emits (bundlers keep the definitions; see core's `keepDiagnostics`).\nkeepDiagnostics(renderDiagnostics, boundaryDiagnostics, slotDiagnostics)\n\n// The ops its boundaries stand for (§3.4: `render:table`, `render:cell`). Registered at import:\n// the dist is one file per module (T37), so hook-only bundles (`useDataTable` without\n// `<DataTable />`) never include this module, and this call ships only with `<DataTable />`.\nregisterRenderOperations()\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n// --- public types --------------------------------------------------------------------------------\n\n/** Props of `components.SearchInput`: the search feature's `input`, bound both ways. */\nexport interface SearchInputProps {\n /** `state.search.input` (updates as the user types). */\n value: string\n /** `state.search.status`: `pending` while a debounce waits, `searching` while a request runs. */\n status: SearchStatus\n /** `setSearch(value)`. */\n onChange(value: string): void\n /** `flushSearch()` (Enter). */\n onSubmit(): void\n /** `clearSearch()` (Esc). */\n onClear(): void\n}\n\n/** Props of `components.Pagination` (the pagination feature's state and API). */\nexport interface PaginationProps {\n pageIndex: number\n pageSize: number\n pageCount: number\n canPrev: boolean\n canNext: boolean\n prev(): void\n next(): void\n setPageIndex(index: number): void\n setPageSize(size: number): void\n}\n\n/** Props of `components.Empty`: shown when the table has loaded and has no rows to show. */\nexport interface EmptyProps {\n /** `true` when there is data but filters / search removed every row. */\n filtered: boolean\n}\n\n/** Props of `components.Loading`: the first load (`isInitialLoad`, nothing to show yet). */\nexport interface LoadingProps {\n status: RowModelStatus\n}\n\n/** Props of `components.Error`: the first load failed, or the body failed to render. */\nexport interface ErrorProps {\n status: RowModelStatus\n /**\n * `'load'`: `status === 'error'` on the first load. `'render'`: a component in the body outside\n * the cells threw (a component inside a cell renders `⚠` in that cell only).\n */\n reason: 'load' | 'render'\n /** `'load'`: `refetch()`. `'render'`: renders the body again. */\n retry(): void\n}\n\n/** `<DataTable components={...} />`: replaces the default parts (unstyled, `data-*` hooks only). */\nexport interface DataTableComponents {\n SearchInput?: ComponentType<SearchInputProps>\n Pagination?: ComponentType<PaginationProps>\n Empty?: ComponentType<EmptyProps>\n Loading?: ComponentType<LoadingProps>\n Error?: ComponentType<ErrorProps>\n}\n\n/** What `<DataTable table={...} />` reads: the value `useDataTable` returns. */\nexport interface DataTableSource {\n readonly state: TableState\n readonly rowModel: {\n readonly rows: readonly DataTableRow[]\n readonly filteredCount: number\n readonly totalCount: number\n readonly status: RowModelStatus\n readonly isInitialLoad: boolean\n }\n getOptions(): { readonly columns?: readonly unknown[] | undefined }\n getData(): readonly unknown[]\n refetch(): Promise<unknown>\n}\n\n/** The part of a `Row` (§6.6) `<DataTable />` renders from. */\ninterface DataTableRow {\n readonly key: string | number\n readonly index: number\n readonly original: unknown\n readonly valid: boolean\n readonly issues: readonly RowIssue[]\n getValue(id: string): unknown\n getCellIssues(id: string): readonly RowIssue[]\n}\n\n/** `<DataTable />`'s own props, next to `table` or the `useDataTable` options. */\nexport interface DataTableOwnProps {\n components?: DataTableComponents | undefined\n caption?: ReactNode\n}\n\n/**\n * `<DataTable table={useDataTable(...)} />`, or `<DataTable data={rows} />` with the\n * `useDataTable` options as props (zero-config: columns derived from the data).\n */\nexport type DataTableProps<\n T = unknown,\n Sch = undefined,\n M extends InvalidRowsMode = InvalidRowsMode,\n> = DataTableOwnProps &\n (\n | { table: DataTableSource }\n | (UseDataTableOptions<T, TableState, Sch, M> & {\n features?: readonly AnyFeature[]\n table?: undefined\n })\n )\n\n// --- component -----------------------------------------------------------------------------------\n\n/**\n * The zero-config table (§10). Renders what the installed features provide: sort buttons with\n * `aria-sort`, a search input bound to `input` (Enter = `flushSearch`, Esc = `clearSearch`),\n * pagination, and the Loading / Error / Empty states from `status` + `isInitialLoad` (§6.6).\n * Unstyled: style it through the `data-*` hooks (`data-status`, `data-initial-load`,\n * `data-invalid`, `data-sort`, …) or replace parts with `components`.\n *\n * `@datakable/react`'s `DataTable` installs no features with `data`; `datakable`'s installs the\n * default preset.\n */\nexport function DataTable<\n T,\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(props: DataTableProps<T, Sch, M>): ReactNode\nexport function DataTable(\n props: DataTableOwnProps & { table?: DataTableSource | undefined },\n): ReactNode {\n if (props.table !== undefined) {\n return (\n <DataTableView table={props.table} components={props.components} caption={props.caption} />\n )\n }\n return <ZeroConfig {...(props as DataTableOwnProps & { table?: undefined })} />\n}\n\nfunction ZeroConfig(props: DataTableOwnProps & { table?: undefined }) {\n const { components, caption, table: _, ...options } = props\n const view = useDataTable(options as never) as unknown as DataTableSource\n return <DataTableView table={view} components={components} caption={caption} />\n}\n\n/** Loose access to the installed features' APIs (the table is typed per feature set). */\ntype Api = DataTableSource & {\n toggleSort?(id: string, opts?: { multi?: boolean }): void\n getSortDirection?(id: string): 'asc' | 'desc' | false\n setSearch?(q: string): Promise<unknown>\n flushSearch?(): Promise<unknown>\n clearSearch?(): void\n setPageIndex?(i: number): void\n setPageSize?(n: number): void\n nextPage?(): void\n prevPage?(): void\n getPageCount?(): number\n canNextPage?(): boolean\n canPrevPage?(): boolean\n}\n\n/** The column fields `<DataTable />` reads (types are checked where the columns are written). */\ninterface ColumnLike {\n key?: unknown\n id?: unknown\n header?: unknown\n sortable?: unknown\n cell?: (ctx: { row: unknown; value: unknown }) => ReactNode\n format?: (value: unknown) => unknown\n invalidCell?: (ctx: {\n original: unknown\n value: unknown\n issues: readonly RowIssue[]\n }) => ReactNode\n}\n\ninterface Column {\n readonly def: ColumnLike\n readonly index: number\n readonly id: string\n readonly header: ReactNode\n}\n\n/** A cell callback that threw or broke its contract during this render (reported after commit). */\ninterface Failure {\n slot: string\n column: string\n row: number\n error?: unknown\n /** Bad return: what the contract expects and the type received. */\n expected?: string\n received?: string\n}\n\nconst WARN = '⚠'\nconst BUSY: readonly RowModelStatus[] = ['validating', 'pending', 'searching', 'fetching']\nconst LOADING: readonly RowModelStatus[] = ['validating', 'searching', 'fetching']\n\n/**\n * The table loads its rows asynchronously: a `fetcher`, or a feature with a `searchFn` (its\n * `defineOptions` values). With nothing applied yet, its `'pending'` is a load waiting to start\n * (deferred until the client, §7.2), so `<DataTable />` shows Loading — also in the server HTML.\n */\nfunction hasAsyncSource(table: DataTableSource): boolean {\n const options = table.getOptions() as { fetcher?: unknown; features?: unknown }\n if (typeof options.fetcher === 'function') return true\n if (!Array.isArray(options.features)) return false\n for (const f of options.features as readonly {\n options?: { values?: { searchFn?: unknown } }\n }[]) {\n if (typeof f?.options?.values?.searchFn === 'function') return true\n }\n return false\n}\n\nfunction resolveColumns(defs: readonly unknown[]): Column[] {\n const out: Column[] = []\n for (let index = 0; index < defs.length; index++) {\n const def = defs[index] as ColumnLike | null | undefined\n if (def === null || typeof def !== 'object') continue\n const id = typeof def.key === 'string' ? def.key : def.id\n if (typeof id !== 'string') continue\n out.push({ def, index, id, header: typeof def.header === 'string' ? def.header : id })\n }\n return out\n}\n\nconst segment = (s: PropertyKey | { readonly key: PropertyKey }) =>\n String(typeof s === 'object' ? s.key : s)\n\n/**\n * The redacted issue text for `title` (§5.1): the issue paths only. Schema messages embed the\n * received value, so they are never shown.\n */\nfunction issueTitle(issues: readonly RowIssue[]): string {\n const paths = new Set<string>()\n for (const i of issues) paths.add(i.path?.length ? i.path.map(segment).join('.') : '(row)')\n return `Invalid: ${[...paths].join(', ')}`\n}\n\n/** The table behind a `useDataTable` view (its prototype), for reporting diagnostics. */\nconst tableOf = (view: object): object =>\n Object.hasOwn(view, 'rowModel') ? (Object.getPrototypeOf(view) as object) : view\n\nfunction report(table: object, failures: readonly Failure[]) {\n const bySlot = new Map<string, Failure[]>()\n for (const f of failures) {\n const k = `${f.slot}\\0${f.expected === undefined ? 'throw' : 'return'}`\n const list = bySlot.get(k)\n if (list) list.push(f)\n else bySlot.set(k, [f])\n }\n for (const list of bySlot.values()) {\n const first = list[0] as Failure\n const rows = list.slice(0, 3).map((f) => f.row)\n const fallback = 'those cells rendered ⚠'\n try {\n if (first.expected === undefined) {\n const e = first.error\n emitTableDiagnostic(\n table,\n 'DK_CALLBACK_FAILED',\n {\n slot: first.slot,\n column: first.column,\n rows,\n count: list.length,\n fallback,\n ...(e instanceof Error ? { errorName: e.name } : {}),\n },\n { cause: e },\n )\n } else if (process.env.NODE_ENV !== 'production') {\n emitTableDiagnostic(table, 'DK_CALLBACK_BAD_RETURN', {\n slot: first.slot,\n column: first.column,\n expected: first.expected,\n received: first.received ?? 'undefined',\n count: list.length,\n rows,\n fallback,\n })\n }\n } catch {\n // Not a table made by createTable (a hand-made `table` prop): nothing to report to.\n }\n }\n}\n\n/**\n * Renders one cell's content; a throwing or contract-breaking callback renders `⚠`. An object\n * returned by `cell` / `invalidCell` (an element, an array) may hold components that throw while\n * React renders them, so it gets its own boundary; primitives cannot, so they get none (no cost).\n */\nfunction cellContent(\n col: Column,\n row: DataTableRow,\n failures: Failure[],\n table: object,\n): ReactNode {\n const def = col.def\n const value = row.getValue(col.id)\n const issues = row.valid ? undefined : row.getCellIssues(col.id)\n let slot = 'cell'\n try {\n if (issues !== undefined && issues.length > 0) {\n if (def.invalidCell) {\n slot = 'invalidCell'\n const out = def.invalidCell({ original: row.original, value, issues })\n if (matchesSlot(invalidCellSlot, out)) return guard(out, table, col, row, 'invalidCell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n return (\n <>\n {defaultFormat(value)}{' '}\n <span data-dk-invalid-marker=\"\" aria-hidden=\"true\">\n {WARN}\n </span>\n </>\n )\n }\n if (def.cell) {\n const out = def.cell({ row: row.original, value })\n if (matchesSlot(cellSlot, out)) return guard(out, table, col, row, 'cell')\n return bad(failures, col, row, slot, 'a value (not a Promise)', out)\n }\n if (def.format) {\n slot = 'format'\n const out = def.format(value)\n if (typeof out === 'string') return out\n bad(failures, col, row, slot, 'a string', out)\n return defaultFormat(value)\n }\n return defaultFormat(value)\n } catch (error) {\n failures.push({ slot: `columns[${col.index}].${slot}`, column: col.id, row: row.index, error })\n return WARN\n }\n}\n\n/** Wraps object content in a per-cell boundary (`render:cell`); primitives pass through as-is. */\nfunction guard(\n out: ReactNode,\n table: object,\n col: Column,\n row: DataTableRow,\n slot: 'cell' | 'invalidCell',\n): ReactNode {\n if (typeof out !== 'object' || out === null) return out\n return (\n <CellBoundary table={table} col={col} slot={slot} row={row.index} original={row.original}>\n {out}\n </CellBoundary>\n )\n}\n\nfunction bad(\n failures: Failure[],\n col: Column,\n row: DataTableRow,\n slot: string,\n expected: string,\n out: unknown,\n): ReactNode {\n failures.push({\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row: row.index,\n expected,\n received: describeReturn(out),\n })\n return WARN\n}\n\nconst ariaSort = (dir: 'asc' | 'desc' | false) =>\n dir === 'asc' ? 'ascending' : dir === 'desc' ? 'descending' : 'none'\n\nfunction DataTableView(props: {\n table: DataTableSource\n components: DataTableComponents | undefined\n caption: ReactNode\n}) {\n const view = props.table as Api\n const parts = props.components ?? {}\n const { state, rowModel } = view\n const { rows, status, isInitialLoad } = rowModel\n const defs = view.getOptions().columns\n const data = view.getData()\n // Zero-config columns follow the data; given columns follow their reference (§10).\n const derivedFrom = defs === undefined ? data : undefined\n const columns = useMemo(\n () => resolveColumns(defs ?? (derivedFrom ? deriveColumns(derivedFrom) : [])),\n [defs, derivedFrom],\n )\n const failures: Failure[] = []\n const table = tableOf(view)\n // After commit, never during render: a sink may set state.\n useIsomorphicLayoutEffect(() => {\n if (failures.length > 0) report(table, failures)\n })\n\n const sortable = typeof view.toggleSort === 'function'\n const searchState = state.search as { input: string; status: SearchStatus } | undefined\n const paged = typeof view.getPageCount === 'function'\n // Loading (§6.6, §10): nothing to show yet and rows on their way — in flight, or deferred async\n // work that has not started (SSR, §7.2: 'pending').\n const loading =\n isInitialLoad && (LOADING.includes(status) || (status === 'pending' && hasAsyncSource(view)))\n const failed = isInitialLoad && status === 'error'\n const span = Math.max(columns.length, 1)\n const retryLoad = () => void view.refetch()\n\n const Search = parts.SearchInput ?? DefaultSearchInput\n const Pager = parts.Pagination ?? DefaultPagination\n const Empty = parts.Empty ?? DefaultEmpty\n const Loading = parts.Loading ?? DefaultLoading\n const ErrorState = parts.Error ?? DefaultError\n\n let body: ReactNode\n if (loading) {\n body = stateRow(span, 'loading', <Loading status={status} />)\n } else if (failed) {\n body = stateRow(span, 'error', <ErrorState status={status} reason=\"load\" retry={retryLoad} />)\n } else if (rows.length === 0) {\n body = stateRow(span, 'empty', <Empty filtered={rowModel.totalCount > 0} />)\n } else {\n body = rows.map((row) => {\n const valid = row.valid\n return (\n <tr\n key={row.key}\n data-invalid={valid ? undefined : 'true'}\n aria-invalid={valid ? undefined : 'true'}\n title={valid ? undefined : issueTitle(row.issues)}\n >\n {columns.map((col) => {\n const issues = valid ? undefined : row.getCellIssues(col.id)\n const broken = issues !== undefined && issues.length > 0\n return (\n <td\n key={col.index}\n data-invalid={broken ? 'true' : undefined}\n aria-invalid={broken ? 'true' : undefined}\n title={broken ? issueTitle(issues) : undefined}\n >\n {cellContent(col, row, failures, table)}\n </td>\n )\n })}\n </tr>\n )\n })\n }\n\n return (\n <div\n data-datakable=\"\"\n data-status={status}\n data-initial-load={isInitialLoad ? 'true' : 'false'}\n aria-busy={BUSY.includes(status) ? 'true' : undefined}\n >\n {searchState && (\n <div data-dk-search=\"\" data-status={searchState.status}>\n <Search\n value={searchState.input}\n status={searchState.status}\n onChange={(q) => void view.setSearch?.(q)}\n onSubmit={() => void view.flushSearch?.()}\n onClear={() => view.clearSearch?.()}\n />\n </div>\n )}\n {!loading && !failed && status !== 'idle' && (\n <RefreshIndicator status={status} retry={retryLoad} />\n )}\n <table>\n {props.caption != null && <caption>{props.caption}</caption>}\n <thead>\n <tr>\n {columns.map((col) => {\n const canSort = sortable && col.def.sortable !== false\n const dir = canSort ? (view.getSortDirection?.(col.id) ?? false) : false\n return (\n <th\n key={col.index}\n scope=\"col\"\n aria-sort={canSort ? ariaSort(dir) : undefined}\n data-sort={dir || undefined}\n >\n {canSort ? (\n <button\n type=\"button\"\n onClick={(e) => view.toggleSort?.(col.id, { multi: e.shiftKey })}\n >\n {col.header}\n <span data-dk-sort-indicator=\"\" aria-hidden=\"true\">\n {dir === 'asc' ? ' ▲' : dir === 'desc' ? ' ▼' : ''}\n </span>\n </button>\n ) : (\n col.header\n )}\n </th>\n )\n })}\n </tr>\n </thead>\n <tbody>\n <BodyBoundary\n table={table}\n resetKey={rowModel}\n fallback={(retry) =>\n stateRow(span, 'error', <ErrorState status={status} reason=\"render\" retry={retry} />)\n }\n >\n {body}\n </BodyBoundary>\n </tbody>\n </table>\n {paged && (\n <Pager\n pageIndex={(state.pagination as { pageIndex: number }).pageIndex}\n pageSize={(state.pagination as { pageSize: number }).pageSize}\n pageCount={view.getPageCount?.() ?? 0}\n canPrev={view.canPrevPage?.() ?? false}\n canNext={view.canNextPage?.() ?? false}\n prev={() => view.prevPage?.()}\n next={() => view.nextPage?.()}\n setPageIndex={(i) => view.setPageIndex?.(i)}\n setPageSize={(n) => view.setPageSize?.(n)}\n />\n )}\n </div>\n )\n}\n\nfunction stateRow(span: number, kind: string, content: ReactNode) {\n return (\n <tr data-dk-state={kind}>\n <td colSpan={span}>{content}</td>\n </tr>\n )\n}\n\n// --- error boundaries (DK_RENDER_FAILED) ---------------------------------------------------------\n\ninterface BoundaryProps {\n table: object\n /** A new value (the next row model) renders the body again. */\n resetKey: unknown\n fallback(retry: () => void): ReactNode\n children: ReactNode\n}\n\n/**\n * Catches a component that throws inside the body outside any cell boundary (§10: a\n * `components.Empty` / `Loading` / `Error` part): reports `DK_RENDER_FAILED` (`render:table`) and\n * shows the Error state; the header, search and pagination keep working.\n */\nclass BodyBoundary extends Component<BoundaryProps, { failed: boolean; key: unknown }> {\n override state = { failed: false, key: this.props.resetKey }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: BoundaryProps, state: { key: unknown }) {\n return props.resetKey === state.key ? null : { failed: false, key: props.resetKey }\n }\n\n override componentDidCatch(error: unknown) {\n try {\n emitTableDiagnostic(\n this.props.table,\n 'DK_RENDER_FAILED',\n { op: 'render:table', ...(error instanceof Error ? { errorName: error.name } : {}) },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n retry = () => this.setState({ failed: false })\n\n override render() {\n return this.state.failed ? this.props.fallback(this.retry) : this.props.children\n }\n}\n\ninterface CellBoundaryProps {\n table: object\n col: Column\n slot: 'cell' | 'invalidCell'\n /** The row's index in the data (`row.index`). */\n row: number\n /** The row's data: a new object (or new columns) renders a failed cell again. */\n original: unknown\n children: ReactNode\n}\n\ninterface CellBoundaryState {\n failed: boolean\n original: unknown\n def: ColumnLike\n}\n\n/**\n * One cell's boundary (`render:cell`, §3.4): a component returned by `cell` / `invalidCell` that\n * throws renders `⚠` in that cell only and reports `DK_RENDER_FAILED` (deduped per column); the\n * other cells, rows and the table keep working. Only wraps object content (see `guard`).\n */\nclass CellBoundary extends Component<CellBoundaryProps, CellBoundaryState> {\n override state: CellBoundaryState = {\n failed: false,\n original: this.props.original,\n def: this.props.col.def,\n }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n static getDerivedStateFromProps(props: CellBoundaryProps, state: CellBoundaryState) {\n return props.original === state.original && props.col.def === state.def\n ? null\n : { failed: false, original: props.original, def: props.col.def }\n }\n\n override componentDidCatch(error: unknown) {\n const { table, col, slot, row } = this.props\n try {\n emitTableDiagnostic(\n table,\n 'DK_RENDER_FAILED',\n {\n op: 'render:cell',\n slot: `columns[${col.index}].${slot}`,\n column: col.id,\n row,\n ...(error instanceof Error ? { errorName: error.name } : {}),\n },\n { cause: error },\n )\n } catch {\n // Not a table made by createTable: nothing to report to.\n }\n }\n\n override render() {\n return this.state.failed ? WARN : this.props.children\n }\n}\n\n// --- default parts (unstyled) --------------------------------------------------------------------\n\nfunction DefaultSearchInput({ value, status, onChange, onSubmit, onClear }: SearchInputProps) {\n return (\n <>\n <input\n type=\"search\"\n aria-label=\"Search\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onSubmit()\n else if (e.key === 'Escape') onClear()\n }}\n />\n {(status === 'pending' || status === 'searching') && (\n <span role=\"status\" data-dk-spinner=\"\" aria-label=\"Searching\" />\n )}\n </>\n )\n}\n\nfunction DefaultPagination(p: PaginationProps) {\n return (\n <nav aria-label=\"Pagination\" data-dk-pagination=\"\">\n <button type=\"button\" aria-label=\"Previous page\" disabled={!p.canPrev} onClick={p.prev}>\n ‹\n </button>\n <span data-dk-page=\"\">\n Page {p.pageIndex + 1} of {Math.max(p.pageCount, 1)}\n </span>\n <button type=\"button\" aria-label=\"Next page\" disabled={!p.canNext} onClick={p.next}>\n ›\n </button>\n </nav>\n )\n}\n\nconst DefaultEmpty = ({ filtered }: EmptyProps) => <>{filtered ? 'No matching rows' : 'No rows'}</>\n\nconst DefaultLoading = (_: LoadingProps) => <span role=\"status\">Loading…</span>\n\nfunction DefaultError({ reason, retry }: ErrorProps) {\n return (\n <div role=\"alert\">\n {reason === 'load' ? 'Could not load the rows.' : 'Could not display the rows.'}{' '}\n <button type=\"button\" onClick={retry}>\n Retry\n </button>\n </div>\n )\n}\n\n/** Over stale rows (§6.6): the table is busy, or a later update failed. */\nfunction RefreshIndicator({ status, retry }: { status: RowModelStatus; retry(): void }) {\n if (status === 'error') {\n return (\n <div data-dk-refresh=\"\" data-status={status} role=\"alert\">\n Could not refresh; showing the previous rows.{' '}\n <button type=\"button\" onClick={retry}>\n Retry\n </button>\n </div>\n )\n }\n return (\n <div data-dk-refresh=\"\" data-status={status} role=\"status\">\n Updating…\n </div>\n )\n}\n"],"mappings":";;;AAEA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAIA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAmC,oBAAoB;AAoJjD,SAoLE,UApLF,KAoLE,YApLF;AAjJN,gBAAgB,mBAAmB,qBAAqB,eAAe;AAKvE,yBAAyB;AAMzB,IAAM,4BAA4B,OAAO,WAAW,cAAc,YAAY;AAiIvE,SAAS,UACd,OACW;AACX,MAAI,MAAM,UAAU,QAAW;AAC7B,WACE,oBAAC,iBAAc,OAAO,MAAM,OAAO,YAAY,MAAM,YAAY,SAAS,MAAM,SAAS;AAAA,EAE7F;AACA,SAAO,oBAAC,cAAY,GAAI,OAAqD;AAC/E;AAEA,SAAS,WAAW,OAAkD;AACpE,QAAM,EAAE,YAAY,SAAS,OAAO,GAAG,GAAG,QAAQ,IAAI;AACtD,QAAM,OAAO,aAAa,OAAgB;AAC1C,SAAO,oBAAC,iBAAc,OAAO,MAAM,YAAwB,SAAkB;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;AACA,SACE,oBAAC,SAAI,mBAAgB,IAAG,eAAa,QAAQ,MAAK,UAAS,4BAE3D;AAEJ;","names":[]}
package/dist/index.cjs CHANGED
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  "use strict";
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@datakable/core'\nexport { reactDiagnostics } from './codes'\nexport {\n DataTable,\n type DataTableComponents,\n type DataTableOwnProps,\n type DataTableProps,\n type DataTableSource,\n type EmptyProps,\n type ErrorProps,\n type LoadingProps,\n type PaginationProps,\n type SearchInputProps,\n} from './data-table'\nexport { cellSlot, invalidCellSlot, renderDiagnostics, renderMessages } from './render-codes'\nexport { type UseDataTableOptions, type UseDataTableResult, useDataTable } from './use-data-table'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,4BAAd;AACA,mBAAiC;AACjC,wBAWO;AACP,0BAA6E;AAC7E,4BAAgF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@datakable/core'\nexport { reactDiagnostics } from './codes'\nexport {\n DataTable,\n type DataTableComponents,\n type DataTableOwnProps,\n type DataTableProps,\n type DataTableSource,\n type EmptyProps,\n type ErrorProps,\n type LoadingProps,\n type PaginationProps,\n type SearchInputProps,\n} from './data-table'\nexport { cellSlot, invalidCellSlot, renderDiagnostics, renderMessages } from './render-codes'\nexport { type UseDataTableOptions, type UseDataTableResult, useDataTable } from './use-data-table'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,4BAAd;AACA,mBAAiC;AACjC,wBAWO;AACP,0BAA6E;AAC7E,4BAAgF;","names":[]}
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
- "use client";
2
-
3
1
  // src/index.ts
4
2
  export * from "@datakable/core";
5
3
  import { reactDiagnostics } from "./codes.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@datakable/core'\nexport { reactDiagnostics } from './codes'\nexport {\n DataTable,\n type DataTableComponents,\n type DataTableOwnProps,\n type DataTableProps,\n type DataTableSource,\n type EmptyProps,\n type ErrorProps,\n type LoadingProps,\n type PaginationProps,\n type SearchInputProps,\n} from './data-table'\nexport { cellSlot, invalidCellSlot, renderDiagnostics, renderMessages } from './render-codes'\nexport { type UseDataTableOptions, type UseDataTableResult, useDataTable } from './use-data-table'\n"],"mappings":";;;AAAA,cAAc;AACd,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,OAUK;AACP,SAAS,UAAU,iBAAiB,mBAAmB,sBAAsB;AAC7E,SAA4D,oBAAoB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@datakable/core'\nexport { reactDiagnostics } from './codes'\nexport {\n DataTable,\n type DataTableComponents,\n type DataTableOwnProps,\n type DataTableProps,\n type DataTableSource,\n type EmptyProps,\n type ErrorProps,\n type LoadingProps,\n type PaginationProps,\n type SearchInputProps,\n} from './data-table'\nexport { cellSlot, invalidCellSlot, renderDiagnostics, renderMessages } from './render-codes'\nexport { type UseDataTableOptions, type UseDataTableResult, useDataTable } from './use-data-table'\n"],"mappings":";AAAA,cAAc;AACd,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,OAUK;AACP,SAAS,UAAU,iBAAiB,mBAAmB,sBAAsB;AAC7E,SAA4D,oBAAoB;","names":[]}
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  "use strict";
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render-codes.ts"],"sourcesContent":["import {\n type DiagnosticMessages,\n defineDiagnostic,\n defineSlot,\n registerOperation,\n} from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_RENDER_FAILED: {\n /**\n * The render operation: `render:cell` (a cell's boundary: a component returned by `cell` /\n * `invalidCell`) or `render:table` (the body boundary: a component outside the cells).\n */\n op: 'render:table' | 'render:cell'\n /** `render:cell`: the slot whose component threw, `columns[1].cell`. */\n slot?: string\n /** `render:cell`: the column id. */\n column?: string\n /** `render:cell`: the row's index in the data (the first failure; later ones are deduped). */\n row?: number\n /** `error.name` only; the full error is `context.cause`. */\n errorName?: string\n }\n }\n\n /** §3.4: React error boundaries, not interceptor chains (nothing runs interceptors on them). */\n interface Operations {\n 'render:table': { kind: 'sync'; input: undefined; output: undefined }\n 'render:cell': {\n kind: 'sync'\n input: { column: string; slot: 'cell' | 'invalidCell'; row: number }\n output: undefined\n }\n }\n}\n\n/**\n * Registers `render:table` / `render:cell` (§3.4: owned by `@datakable/react`, not core). Neither\n * is hot: no interceptor chain runs per cell, so `on: '*'` interceptors get no hot-op warning for\n * them. Idempotent (an identical re-registration is a no-op).\n */\nexport function registerRenderOperations(): void {\n registerOperation('render:table', { kind: 'sync', hot: false })\n registerOperation('render:cell', { kind: 'sync', hot: false })\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/**\n * `columns[i].cell` (§4.1, §10): renders a React node synchronously. A thenable is a contract\n * violation (`DK_CALLBACK_BAD_RETURN`); `<DataTable />` renders `⚠` instead.\n */\nexport const cellSlot = defineSlot({\n name: 'cell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** `columns[i].invalidCell` (§5.1): renders a flagged cell; same contract as `cell`. */\nexport const invalidCellSlot = defineSlot({\n name: 'invalidCell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** Message text (§8.2): development builds, or production via `datakable/messages`. */\nexport const renderMessages: DiagnosticMessages<'DK_RENDER_FAILED'> = {\n DK_RENDER_FAILED: {\n problem: (d) =>\n d.op === 'render:cell'\n ? `a component returned by ${d.slot} (column \"${d.column}\") threw` +\n `${d.errorName ? ` ${d.errorName}` : ''} while rendering row #${d.row}`\n : `a component rendered inside the table body threw${d.errorName ? ` ${d.errorName}` : ''} ` +\n '(outside the cells: a components.Empty / Loading / Error part)',\n impact: (d) =>\n d.op === 'render:cell'\n ? 'that cell renders ⚠; the other cells and rows, the header, search, pagination and the ' +\n \"table API keep working, and the cell renders again when its row's data or the columns \" +\n 'change'\n : 'the table body shows the Error state; the header, search and pagination keep working, ' +\n 'and the body renders again on the next row model or Retry',\n fix: (d) =>\n d.op === 'render:cell'\n ? [\n `find the throwing component in context.cause (passed to onDiagnostic) and make it ` +\n `total: guard null / undefined / unexpected values of column \"${d.column}\" ` +\n 'instead of throwing',\n 'for your own fallback instead of ⚠, wrap the component in an error boundary inside ' +\n `${d.slot}`,\n ]\n : [\n 'find the throwing component in context.cause (passed to onDiagnostic) and make it ' +\n 'total: guard null / undefined / unexpected values instead of throwing',\n 'a component returned by a column cell / invalidCell is caught per cell (⚠); a throw in ' +\n 'the cell function itself is DK_CALLBACK_FAILED',\n ],\n },\n}\n\n/** Codes owned by `<DataTable />` (§8.3, react). Emitted in production too; text behind NODE_ENV. */\nexport const renderDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_RENDER_FAILED',\n level: 'error',\n where: (d) =>\n d.slot ? { kind: 'operation', op: d.op, slot: d.slot } : { kind: 'operation', op: d.op },\n },\n // Written out (not an imported flag) so a consumer's bundler folds it while parsing (§8.2).\n process.env.NODE_ENV !== 'production' && renderMessages.DK_RENDER_FAILED,\n ),\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKO;AAqCA,SAAS,2BAAiC;AAC/C,qCAAkB,gBAAgB,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC9D,qCAAkB,eAAe,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC/D;AASO,IAAM,eAAW,wBAAW;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,sBAAkB,wBAAW;AAAA,EACxC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,iBAAyD;AAAA,EACpE,kBAAkB;AAAA,IAChB,SAAS,CAAC,MACR,EAAE,OAAO,gBACL,2BAA2B,EAAE,IAAI,aAAa,EAAE,MAAM,WACnD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE,yBAAyB,EAAE,GAAG,KACrE,mDAAmD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE;AAAA,IAE7F,QAAQ,CAAC,MACP,EAAE,OAAO,gBACL,4LAGA;AAAA,IAEN,KAAK,CAAC,MACJ,EAAE,OAAO,gBACL;AAAA,MACE,kJACkE,EAAE,MAAM;AAAA,MAE1E,2FACK,EAAE,IAAI;AAAA,IACb,IACA;AAAA,MACE;AAAA,MAEA;AAAA,IAEF;AAAA,EACR;AACF;AAGO,IAAM,oBAAoB;AAAA,MAC/B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,MACN,EAAE,OAAO,EAAE,MAAM,aAAa,IAAI,EAAE,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,IAAI,EAAE,GAAG;AAAA,IAC3F;AAAA;AAAA,IAEA,QAAQ,IAAI,aAAa,gBAAgB,eAAe;AAAA,EAC1D;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/render-codes.ts"],"sourcesContent":["import {\n type DiagnosticMessages,\n defineDiagnostic,\n defineSlot,\n registerOperation,\n} from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_RENDER_FAILED: {\n /**\n * The render operation: `render:cell` (a cell's boundary: a component returned by `cell` /\n * `invalidCell`) or `render:table` (the body boundary: a component outside the cells).\n */\n op: 'render:table' | 'render:cell'\n /** `render:cell`: the slot whose component threw, `columns[1].cell`. */\n slot?: string\n /** `render:cell`: the column id. */\n column?: string\n /** `render:cell`: the row's index in the data (the first failure; later ones are deduped). */\n row?: number\n /** `error.name` only; the full error is `context.cause`. */\n errorName?: string\n }\n }\n\n /** §3.4: React error boundaries, not interceptor chains (nothing runs interceptors on them). */\n interface Operations {\n 'render:table': { kind: 'sync'; input: undefined; output: undefined }\n 'render:cell': {\n kind: 'sync'\n input: { column: string; slot: 'cell' | 'invalidCell'; row: number }\n output: undefined\n }\n }\n}\n\n/**\n * Registers `render:table` / `render:cell` (§3.4: owned by `@datakable/react`, not core). Neither\n * is hot: no interceptor chain runs per cell, so `on: '*'` interceptors get no hot-op warning for\n * them. Idempotent (an identical re-registration is a no-op).\n */\nexport function registerRenderOperations(): void {\n registerOperation('render:table', { kind: 'sync', hot: false })\n registerOperation('render:cell', { kind: 'sync', hot: false })\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/**\n * `columns[i].cell` (§4.1, §10): renders a React node synchronously. A thenable is a contract\n * violation (`DK_CALLBACK_BAD_RETURN`); `<DataTable />` renders `⚠` instead.\n */\nexport const cellSlot = defineSlot({\n name: 'cell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** `columns[i].invalidCell` (§5.1): renders a flagged cell; same contract as `cell`. */\nexport const invalidCellSlot = defineSlot({\n name: 'invalidCell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** Message text (§8.2): development builds, or production via `datakable/messages`. */\nexport const renderMessages: DiagnosticMessages<'DK_RENDER_FAILED'> = {\n DK_RENDER_FAILED: {\n problem: (d) =>\n d.op === 'render:cell'\n ? `a component returned by ${d.slot} (column \"${d.column}\") threw` +\n `${d.errorName ? ` ${d.errorName}` : ''} while rendering row #${d.row}`\n : `a component rendered inside the table body threw${d.errorName ? ` ${d.errorName}` : ''} ` +\n '(outside the cells: a components.Empty / Loading / Error part)',\n impact: (d) =>\n d.op === 'render:cell'\n ? 'that cell renders ⚠; the other cells and rows, the header, search, pagination and the ' +\n \"table API keep working, and the cell renders again when its row's data or the columns \" +\n 'change'\n : 'the table body shows the Error state; the header, search and pagination keep working, ' +\n 'and the body renders again on the next row model or Retry',\n fix: (d) =>\n d.op === 'render:cell'\n ? [\n `find the throwing component in context.cause (passed to onDiagnostic) and make it ` +\n `total: guard null / undefined / unexpected values of column \"${d.column}\" ` +\n 'instead of throwing',\n 'for your own fallback instead of ⚠, wrap the component in an error boundary inside ' +\n `${d.slot}`,\n ]\n : [\n 'find the throwing component in context.cause (passed to onDiagnostic) and make it ' +\n 'total: guard null / undefined / unexpected values instead of throwing',\n 'a component returned by a column cell / invalidCell is caught per cell (⚠); a throw in ' +\n 'the cell function itself is DK_CALLBACK_FAILED',\n ],\n },\n}\n\n/** Codes owned by `<DataTable />` (§8.3, react). Emitted in production too; text behind NODE_ENV. */\nexport const renderDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_RENDER_FAILED',\n level: 'error',\n where: (d) =>\n d.slot ? { kind: 'operation', op: d.op, slot: d.slot } : { kind: 'operation', op: d.op },\n },\n // Written out (not an imported flag) so a consumer's bundler folds it while parsing (§8.2).\n process.env.NODE_ENV !== 'production' && renderMessages.DK_RENDER_FAILED,\n ),\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKO;AAqCA,SAAS,2BAAiC;AAC/C,qCAAkB,gBAAgB,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC9D,qCAAkB,eAAe,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC/D;AASO,IAAM,eAAW,wBAAW;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,sBAAkB,wBAAW;AAAA,EACxC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,iBAAyD;AAAA,EACpE,kBAAkB;AAAA,IAChB,SAAS,CAAC,MACR,EAAE,OAAO,gBACL,2BAA2B,EAAE,IAAI,aAAa,EAAE,MAAM,WACnD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE,yBAAyB,EAAE,GAAG,KACrE,mDAAmD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE;AAAA,IAE7F,QAAQ,CAAC,MACP,EAAE,OAAO,gBACL,4LAGA;AAAA,IAEN,KAAK,CAAC,MACJ,EAAE,OAAO,gBACL;AAAA,MACE,kJACkE,EAAE,MAAM;AAAA,MAE1E,2FACK,EAAE,IAAI;AAAA,IACb,IACA;AAAA,MACE;AAAA,MAEA;AAAA,IAEF;AAAA,EACR;AACF;AAGO,IAAM,oBAAoB;AAAA,MAC/B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,MACN,EAAE,OAAO,EAAE,MAAM,aAAa,IAAI,EAAE,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,IAAI,EAAE,GAAG;AAAA,IAC3F;AAAA;AAAA,IAEA,QAAQ,IAAI,aAAa,gBAAgB,eAAe;AAAA,EAC1D;AACF;","names":[]}
@@ -1,5 +1,3 @@
1
- "use client";
2
-
3
1
  // src/render-codes.ts
4
2
  import {
5
3
  defineDiagnostic,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render-codes.ts"],"sourcesContent":["import {\n type DiagnosticMessages,\n defineDiagnostic,\n defineSlot,\n registerOperation,\n} from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_RENDER_FAILED: {\n /**\n * The render operation: `render:cell` (a cell's boundary: a component returned by `cell` /\n * `invalidCell`) or `render:table` (the body boundary: a component outside the cells).\n */\n op: 'render:table' | 'render:cell'\n /** `render:cell`: the slot whose component threw, `columns[1].cell`. */\n slot?: string\n /** `render:cell`: the column id. */\n column?: string\n /** `render:cell`: the row's index in the data (the first failure; later ones are deduped). */\n row?: number\n /** `error.name` only; the full error is `context.cause`. */\n errorName?: string\n }\n }\n\n /** §3.4: React error boundaries, not interceptor chains (nothing runs interceptors on them). */\n interface Operations {\n 'render:table': { kind: 'sync'; input: undefined; output: undefined }\n 'render:cell': {\n kind: 'sync'\n input: { column: string; slot: 'cell' | 'invalidCell'; row: number }\n output: undefined\n }\n }\n}\n\n/**\n * Registers `render:table` / `render:cell` (§3.4: owned by `@datakable/react`, not core). Neither\n * is hot: no interceptor chain runs per cell, so `on: '*'` interceptors get no hot-op warning for\n * them. Idempotent (an identical re-registration is a no-op).\n */\nexport function registerRenderOperations(): void {\n registerOperation('render:table', { kind: 'sync', hot: false })\n registerOperation('render:cell', { kind: 'sync', hot: false })\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/**\n * `columns[i].cell` (§4.1, §10): renders a React node synchronously. A thenable is a contract\n * violation (`DK_CALLBACK_BAD_RETURN`); `<DataTable />` renders `⚠` instead.\n */\nexport const cellSlot = defineSlot({\n name: 'cell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** `columns[i].invalidCell` (§5.1): renders a flagged cell; same contract as `cell`. */\nexport const invalidCellSlot = defineSlot({\n name: 'invalidCell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** Message text (§8.2): development builds, or production via `datakable/messages`. */\nexport const renderMessages: DiagnosticMessages<'DK_RENDER_FAILED'> = {\n DK_RENDER_FAILED: {\n problem: (d) =>\n d.op === 'render:cell'\n ? `a component returned by ${d.slot} (column \"${d.column}\") threw` +\n `${d.errorName ? ` ${d.errorName}` : ''} while rendering row #${d.row}`\n : `a component rendered inside the table body threw${d.errorName ? ` ${d.errorName}` : ''} ` +\n '(outside the cells: a components.Empty / Loading / Error part)',\n impact: (d) =>\n d.op === 'render:cell'\n ? 'that cell renders ⚠; the other cells and rows, the header, search, pagination and the ' +\n \"table API keep working, and the cell renders again when its row's data or the columns \" +\n 'change'\n : 'the table body shows the Error state; the header, search and pagination keep working, ' +\n 'and the body renders again on the next row model or Retry',\n fix: (d) =>\n d.op === 'render:cell'\n ? [\n `find the throwing component in context.cause (passed to onDiagnostic) and make it ` +\n `total: guard null / undefined / unexpected values of column \"${d.column}\" ` +\n 'instead of throwing',\n 'for your own fallback instead of ⚠, wrap the component in an error boundary inside ' +\n `${d.slot}`,\n ]\n : [\n 'find the throwing component in context.cause (passed to onDiagnostic) and make it ' +\n 'total: guard null / undefined / unexpected values instead of throwing',\n 'a component returned by a column cell / invalidCell is caught per cell (⚠); a throw in ' +\n 'the cell function itself is DK_CALLBACK_FAILED',\n ],\n },\n}\n\n/** Codes owned by `<DataTable />` (§8.3, react). Emitted in production too; text behind NODE_ENV. */\nexport const renderDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_RENDER_FAILED',\n level: 'error',\n where: (d) =>\n d.slot ? { kind: 'operation', op: d.op, slot: d.slot } : { kind: 'operation', op: d.op },\n },\n // Written out (not an imported flag) so a consumer's bundler folds it while parsing (§8.2).\n process.env.NODE_ENV !== 'production' && renderMessages.DK_RENDER_FAILED,\n ),\n]\n"],"mappings":";;;AAAA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqCA,SAAS,2BAAiC;AAC/C,oBAAkB,gBAAgB,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC9D,oBAAkB,eAAe,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC/D;AASO,IAAM,WAAW,WAAW;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,kBAAkB,WAAW;AAAA,EACxC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,iBAAyD;AAAA,EACpE,kBAAkB;AAAA,IAChB,SAAS,CAAC,MACR,EAAE,OAAO,gBACL,2BAA2B,EAAE,IAAI,aAAa,EAAE,MAAM,WACnD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE,yBAAyB,EAAE,GAAG,KACrE,mDAAmD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE;AAAA,IAE7F,QAAQ,CAAC,MACP,EAAE,OAAO,gBACL,4LAGA;AAAA,IAEN,KAAK,CAAC,MACJ,EAAE,OAAO,gBACL;AAAA,MACE,kJACkE,EAAE,MAAM;AAAA,MAE1E,2FACK,EAAE,IAAI;AAAA,IACb,IACA;AAAA,MACE;AAAA,MAEA;AAAA,IAEF;AAAA,EACR;AACF;AAGO,IAAM,oBAAoB;AAAA,EAC/B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,MACN,EAAE,OAAO,EAAE,MAAM,aAAa,IAAI,EAAE,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,IAAI,EAAE,GAAG;AAAA,IAC3F;AAAA;AAAA,IAEA,QAAQ,IAAI,aAAa,gBAAgB,eAAe;AAAA,EAC1D;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/render-codes.ts"],"sourcesContent":["import {\n type DiagnosticMessages,\n defineDiagnostic,\n defineSlot,\n registerOperation,\n} from '@datakable/core'\n\ndeclare module '@datakable/core' {\n interface DiagnosticCatalog {\n DK_RENDER_FAILED: {\n /**\n * The render operation: `render:cell` (a cell's boundary: a component returned by `cell` /\n * `invalidCell`) or `render:table` (the body boundary: a component outside the cells).\n */\n op: 'render:table' | 'render:cell'\n /** `render:cell`: the slot whose component threw, `columns[1].cell`. */\n slot?: string\n /** `render:cell`: the column id. */\n column?: string\n /** `render:cell`: the row's index in the data (the first failure; later ones are deduped). */\n row?: number\n /** `error.name` only; the full error is `context.cause`. */\n errorName?: string\n }\n }\n\n /** §3.4: React error boundaries, not interceptor chains (nothing runs interceptors on them). */\n interface Operations {\n 'render:table': { kind: 'sync'; input: undefined; output: undefined }\n 'render:cell': {\n kind: 'sync'\n input: { column: string; slot: 'cell' | 'invalidCell'; row: number }\n output: undefined\n }\n }\n}\n\n/**\n * Registers `render:table` / `render:cell` (§3.4: owned by `@datakable/react`, not core). Neither\n * is hot: no interceptor chain runs per cell, so `on: '*'` interceptors get no hot-op warning for\n * them. Idempotent (an identical re-registration is a no-op).\n */\nexport function registerRenderOperations(): void {\n registerOperation('render:table', { kind: 'sync', hot: false })\n registerOperation('render:cell', { kind: 'sync', hot: false })\n}\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/**\n * `columns[i].cell` (§4.1, §10): renders a React node synchronously. A thenable is a contract\n * violation (`DK_CALLBACK_BAD_RETURN`); `<DataTable />` renders `⚠` instead.\n */\nexport const cellSlot = defineSlot({\n name: 'cell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** `columns[i].invalidCell` (§5.1): renders a flagged cell; same contract as `cell`. */\nexport const invalidCellSlot = defineSlot({\n name: 'invalidCell',\n returns: 'sync',\n fallback: 'those cells rendered ⚠',\n})\n\n/** Message text (§8.2): development builds, or production via `datakable/messages`. */\nexport const renderMessages: DiagnosticMessages<'DK_RENDER_FAILED'> = {\n DK_RENDER_FAILED: {\n problem: (d) =>\n d.op === 'render:cell'\n ? `a component returned by ${d.slot} (column \"${d.column}\") threw` +\n `${d.errorName ? ` ${d.errorName}` : ''} while rendering row #${d.row}`\n : `a component rendered inside the table body threw${d.errorName ? ` ${d.errorName}` : ''} ` +\n '(outside the cells: a components.Empty / Loading / Error part)',\n impact: (d) =>\n d.op === 'render:cell'\n ? 'that cell renders ⚠; the other cells and rows, the header, search, pagination and the ' +\n \"table API keep working, and the cell renders again when its row's data or the columns \" +\n 'change'\n : 'the table body shows the Error state; the header, search and pagination keep working, ' +\n 'and the body renders again on the next row model or Retry',\n fix: (d) =>\n d.op === 'render:cell'\n ? [\n `find the throwing component in context.cause (passed to onDiagnostic) and make it ` +\n `total: guard null / undefined / unexpected values of column \"${d.column}\" ` +\n 'instead of throwing',\n 'for your own fallback instead of ⚠, wrap the component in an error boundary inside ' +\n `${d.slot}`,\n ]\n : [\n 'find the throwing component in context.cause (passed to onDiagnostic) and make it ' +\n 'total: guard null / undefined / unexpected values instead of throwing',\n 'a component returned by a column cell / invalidCell is caught per cell (⚠); a throw in ' +\n 'the cell function itself is DK_CALLBACK_FAILED',\n ],\n },\n}\n\n/** Codes owned by `<DataTable />` (§8.3, react). Emitted in production too; text behind NODE_ENV. */\nexport const renderDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_RENDER_FAILED',\n level: 'error',\n where: (d) =>\n d.slot ? { kind: 'operation', op: d.op, slot: d.slot } : { kind: 'operation', op: d.op },\n },\n // Written out (not an imported flag) so a consumer's bundler folds it while parsing (§8.2).\n process.env.NODE_ENV !== 'production' && renderMessages.DK_RENDER_FAILED,\n ),\n]\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqCA,SAAS,2BAAiC;AAC/C,oBAAkB,gBAAgB,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC9D,oBAAkB,eAAe,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC/D;AASO,IAAM,WAAW,WAAW;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,kBAAkB,WAAW;AAAA,EACxC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AACZ,CAAC;AAGM,IAAM,iBAAyD;AAAA,EACpE,kBAAkB;AAAA,IAChB,SAAS,CAAC,MACR,EAAE,OAAO,gBACL,2BAA2B,EAAE,IAAI,aAAa,EAAE,MAAM,WACnD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE,yBAAyB,EAAE,GAAG,KACrE,mDAAmD,EAAE,YAAY,IAAI,EAAE,SAAS,KAAK,EAAE;AAAA,IAE7F,QAAQ,CAAC,MACP,EAAE,OAAO,gBACL,4LAGA;AAAA,IAEN,KAAK,CAAC,MACJ,EAAE,OAAO,gBACL;AAAA,MACE,kJACkE,EAAE,MAAM;AAAA,MAE1E,2FACK,EAAE,IAAI;AAAA,IACb,IACA;AAAA,MACE;AAAA,MAEA;AAAA,IAEF;AAAA,EACR;AACF;AAGO,IAAM,oBAAoB;AAAA,EAC/B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,MACN,EAAE,OAAO,EAAE,MAAM,aAAa,IAAI,EAAE,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,IAAI,EAAE,GAAG;AAAA,IAC3F;AAAA;AAAA,IAEA,QAAQ,IAAI,aAAa,gBAAgB,eAAe;AAAA,EAC1D;AACF;","names":[]}
@@ -1,5 +1,5 @@
1
- "use client";
2
1
  "use strict";
2
+ "use client";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -28,7 +28,7 @@ var import_core = require("@datakable/core");
28
28
  var import_react = require("react");
29
29
 
30
30
  // package.json
31
- var version = "1.0.0";
31
+ var version = "1.0.1";
32
32
 
33
33
  // src/use-data-table.ts
34
34
  var import_codes = require("./codes.cjs");
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-data-table.ts","../package.json"],"sourcesContent":["import {\n type AnyFeature,\n type ApiOf,\n type ColumnDef,\n type CreateTableOptions,\n createDeferred,\n createTable,\n type Diagnostic,\n emitTableDiagnostic,\n type InvalidRowsMode,\n isOptionsDefinition,\n keepDiagnostics,\n type RowModel,\n registerPackage,\n type SchemaRow,\n SERVER_SOURCE,\n startTable,\n type Table,\n type TableSchema,\n type TableState,\n type TableStateFor,\n} from '@datakable/core'\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useInsertionEffect,\n useLayoutEffect,\n useReducer,\n useRef,\n useSyncExternalStore,\n} from 'react'\nimport { version } from '../package.json'\nimport { reactDiagnostics } from './codes'\n\n// Registers the (development-only) definitions where they are emitted, so bundlers keep them.\nkeepDiagnostics(reactDiagnostics)\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n/**\n * `useDataTable` options: `createTable`'s (§3.2), with `cell` / `invalidCell` returning a\n * `ReactNode` (§10). Read once, at creation: `features`, `schema`, `invalidRows`, `initialState`,\n * `name`, `timeout`, `strict`, `diagnostics`. Every other option follows the latest render.\n */\nexport type UseDataTableOptions<\n T,\n S extends TableState = TableState,\n Sch = undefined,\n M extends InvalidRowsMode = 'drop',\n> = Omit<CreateTableOptions<T, S, Sch, M>, 'columns'> & {\n /**\n * Compared by reference (§10): a new array tells the table the columns changed. Define them\n * outside the component or memoise them (`DK_UNSTABLE_COLUMNS` in development).\n */\n columns?: readonly ColumnDef<SchemaRow<T, Sch>, ReactNode>[]\n}\n\n/**\n * What `useDataTable` returns: the table (its methods and the installed features' APIs) with the\n * `state` and `rowModel` of this render. A new object whenever the table notifies, so it can be a\n * dependency of `useMemo` / `memo` children; the same object while nothing changed.\n */\nexport type UseDataTableResult<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n In = T,\n Api = unknown,\n> = Table<T, S, M, In> &\n Api & {\n /** The state snapshot of this render (`getState()`). */\n readonly state: S\n /** The row model of this render (`getRowModel()`, §6.6): rows, counts, status. */\n readonly rowModel: RowModel<T, M>\n }\n\ntype Options = Record<string, unknown> & { features?: readonly AnyFeature[] }\ntype AnyTable = Table<unknown, TableState> & Record<string, unknown>\ntype Callback = (arg: never) => unknown\n\n/** Options forwarded through `setOptions` when they change; the rest are read once (§3.4). */\nconst SYNCED = [\n 'data',\n 'columns',\n 'rowKey',\n 'state',\n 'onStateChange',\n 'interceptors',\n 'onDiagnostic',\n 'fetcher',\n 'rowCount',\n] as const\n\n/** Given to the table as stable wrappers that call the latest prop (latest-ref). */\nconst CALLBACKS = ['onStateChange', 'onDiagnostic', 'fetcher'] as const\ntype CallbackKey = (typeof CALLBACKS)[number]\n\n/** Renders in a row with a new reference before `DK_UNSTABLE_*` is reported. */\nconst UNSTABLE_AFTER = 2\n\ninterface Instance {\n table: AnyTable\n destroyed: boolean\n mounted: boolean\n /** The options of the latest committed render (what the wrappers call). */\n latest: Options\n /** The option values the table has (user values; callbacks count by presence). */\n synced: Options\n readonly wrappers: Record<CallbackKey, Callback>\n /** `onDiagnostic` calls made while rendering, delivered after the commit. */\n queue: Diagnostic[] | undefined\n rendering: number\n /** Inside the hook's own `setOptions` call. */\n syncing: boolean\n /** That call notified: the next commit is the re-render it caused. */\n selfCaused: boolean\n /**\n * `data` was forwarded in a self-caused re-render. Rows that differ on every render (nested\n * objects, computed fields) would otherwise ingest → notify → re-render forever: the next\n * self-caused re-render keeps the data the table has.\n */\n selfData: boolean\n /** Notifications seen; part of the view cache key (a notification is never silent, §6.6). */\n version: number\n view: { table: AnyTable; version: number; value: object } | undefined\n /**\n * SSR (§7.2): the view of `table` at its creation — initial state, controlled state and data /\n * initialData, no async result (the table is created deferred). `getServerSnapshot`.\n */\n server: { table: AnyTable; value: object } | undefined\n /** React read `getServerSnapshot` on the client: this render hydrates server HTML. */\n hydrating: boolean\n // Dev: DK_UNSTABLE_* bookkeeping.\n /** The options of the previous committed render. */\n seen: Options\n unstable: Map<string, number>\n warned: Set<string>\n}\n\nlet registered = false\n\n/**\n * Binds a table to a component (§10): the table is created once per component instance and\n * destroyed on unmount; renders read it through `useSyncExternalStore` (with\n * `getServerSnapshot`), and options are synced with `table.setOptions` in a layout effect, never\n * during render.\n *\n * - `features` (and the other read-once options) are read at creation: a new inline `features`\n * array never recreates the table.\n * - `fetcher`, `onStateChange` and `onDiagnostic` may be inline functions: the table always calls\n * the latest one, and a new reference never refetches (call `refetch()` when a value the fetcher\n * reads changes).\n * - `columns`, `data` and a `rowKey` function are compared by reference: memoise them.\n * - Controlled slices (§3.2): pass `state` and `onStateChange`; changes come back through `state`.\n * - SSR (§7.2): rendering starts no async work. The fetcher's first request and a `searchFn` for an\n * initial query start after the commit (`status: 'pending'` until then; `DK_SSR_ASYNC_DEFERRED`\n * on the server), unless `initialData` already holds their result. `initialState` (e.g. parsed\n * from the URL) applies on the server: client-mode features filter / search / sort the HTML.\n * `getServerSnapshot` is the view at creation; a table that changed before the hydration commit\n * reports `DK_HYDRATION_MISMATCH`.\n *\n * `@datakable/react` installs no features by default; `datakable`'s `useDataTable` installs the\n * default preset.\n */\nexport function useDataTable<\n T,\n S extends TableState = never,\n const Fs extends readonly AnyFeature[] = [],\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(\n options: UseDataTableOptions<T, TableStateFor<S, Fs, SchemaRow<T, Sch>>, Sch, M> & {\n features?: Fs\n },\n): UseDataTableResult<\n SchemaRow<T, Sch>,\n TableStateFor<S, Fs, SchemaRow<T, Sch>>,\n M,\n [Sch] extends [TableSchema] ? unknown : T,\n ApiOf<Fs, SchemaRow<T, Sch>>\n>\nexport function useDataTable(options: Options): unknown {\n const ref = useRef<Instance | null>(null)\n // Created during the first render (React keeps the ref across the StrictMode double render),\n // deferred: its async work (fetcher, searchFn) starts in the mount effect, never on the server.\n if (ref.current === null) ref.current = createInstance(options)\n const inst = ref.current\n const table = inst.table\n const [, rerender] = useReducer((n: number) => n + 1, 0)\n\n const subscribe = useCallback(\n (onChange: () => void) => {\n // Replaced or destroyed meanwhile (`<Activity>`): nothing to subscribe to.\n if (inst.table !== table || inst.destroyed) return () => {}\n return table.subscribe(() => {\n inst.version++\n if (inst.syncing) inst.selfCaused = true\n onChange()\n })\n },\n [inst, table],\n )\n const getSnapshot = useCallback(() => snapshot(inst, table), [inst, table])\n const getServerSnapshot = useCallback(() => serverSnapshot(inst, table), [inst, table])\n const view = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n\n // Hydration commit (§7.2): before any layout effect can change the table, the snapshot React\n // hydrated with must still be the live one, else React replaces the server HTML at once.\n useInsertionEffect(() => checkHydration(inst), [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.mounted = true\n // Destroyed while hidden (`<Activity>`): a new table, from the latest options.\n if (inst.destroyed) {\n recreate(inst)\n startTable(inst.table)\n rerender()\n } else {\n // The deferred fetch / searchFn starts now; its status shows before paint.\n startTable(inst.table)\n if (snapshot(inst, inst.table) !== view) rerender()\n }\n return () => {\n inst.mounted = false\n // Deferred: the StrictMode effect re-run mounts again synchronously and keeps the table.\n queueMicrotask(() => {\n if (inst.mounted || inst.destroyed) return\n inst.destroyed = true\n inst.table.destroy()\n })\n }\n }, [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.latest = options\n const selfCaused = inst.selfCaused\n inst.selfCaused = false\n if (!inst.destroyed) sync(inst, options, selfCaused)\n deliver(inst)\n })\n\n return view\n}\n\nfunction createInstance(options: Options): Instance {\n const inst: Instance = {\n table: undefined as unknown as AnyTable,\n destroyed: false,\n mounted: false,\n latest: options,\n synced: options,\n wrappers: {\n onStateChange: (updater) => (inst.latest.onStateChange as Callback)(updater),\n onDiagnostic: (d: Diagnostic) => {\n if (inst.rendering === 0) {\n ;(inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined)?.(d)\n return\n }\n if (inst.queue === undefined) {\n inst.queue = []\n // Delivered by the next layout effect, or here when this render never commits.\n queueMicrotask(() => deliver(inst))\n }\n inst.queue.push(d)\n },\n fetcher: (params) => (inst.latest.fetcher as Callback)(params),\n },\n queue: undefined,\n rendering: 0,\n syncing: false,\n selfCaused: false,\n selfData: false,\n version: 0,\n view: undefined,\n server: undefined,\n hydrating: false,\n seen: options,\n unstable: new Map(),\n warned: new Set(),\n }\n // The version checks are development-only (§8.5): production bundles no registry.\n if (process.env.NODE_ENV !== 'production' && !registered) {\n registered = true\n registerPackage('@datakable/react', version)\n }\n build(inst, options)\n return inst\n}\n\n/**\n * The stable wrapper of callback `k`. The fetcher's also carries the server source of the user's\n * `withFetcher` fetcher (§7.1), which is what makes the table load through it.\n */\nfunction wrapper(inst: Instance, k: CallbackKey, v: unknown): Callback {\n const w = inst.wrappers[k]\n if (k === 'fetcher') {\n ;(w as unknown as Record<symbol, unknown>)[SERVER_SOURCE] = (v as Record<symbol, unknown>)[\n SERVER_SOURCE\n ]\n }\n return w\n}\n\nfunction build(inst: Instance, options: Options) {\n const init: Options = { ...options }\n for (const k of CALLBACKS) {\n if (typeof options[k] === 'function') init[k] = wrapper(inst, k, options[k])\n }\n inst.rendering++\n try {\n // Deferred (§7.2): rendering starts no fetch / searchFn (none at all on the server, where\n // effects never run); the mount effect starts it.\n inst.table = createDeferred(() => createTable(init as never)) as unknown as AnyTable\n } finally {\n inst.rendering--\n }\n inst.synced = options\n inst.seen = options\n inst.view = undefined\n inst.server = undefined\n}\n\nfunction recreate(inst: Instance) {\n build(inst, inst.latest)\n inst.destroyed = false\n}\n\n/** The view of the table's snapshot, cached on (table, state, row model, notifications). */\nfunction snapshot(inst: Instance, table: AnyTable): object {\n inst.rendering++\n try {\n const state = table.getState()\n const rowModel = table.getRowModel()\n const v = inst.view\n if (v && v.table === table && v.version === inst.version) {\n const value = v.value as { state: unknown; rowModel: unknown }\n if (value.state === state && value.rowModel === rowModel) return value\n }\n const value = Object.create(table, {\n state: { value: state, enumerable: true },\n rowModel: { value: rowModel, enumerable: true },\n }) as object\n inst.view = { table, version: inst.version, value }\n return value\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * `getServerSnapshot` (§7.2): the view of the table at its creation. React reads it on the server\n * and while hydrating, so both render the same snapshot; async work never ran in it.\n */\nfunction serverSnapshot(inst: Instance, table: AnyTable): object {\n if (inst.table !== table) return snapshot(inst, table)\n // On the client React reads it only to hydrate.\n if (typeof window !== 'undefined') inst.hydrating = true\n const s = inst.server\n if (s && s.table === table) return s.value\n const value = snapshot(inst, table)\n inst.server = { table, value }\n return value\n}\n\n/** `DK_HYDRATION_MISMATCH`: what differs between the hydrated (server) view and the live one. */\nfunction checkHydration(inst: Instance) {\n if (!inst.hydrating) return\n inst.hydrating = false\n const server = inst.server\n if (!server || server.table !== inst.table) return\n const live = snapshot(inst, inst.table) as { state: TableState; rowModel: unknown }\n const hydrated = server.value as { state: TableState; rowModel: unknown }\n if (live === hydrated) return\n const slices: string[] = []\n for (const k of new Set([...Object.keys(hydrated.state), ...Object.keys(live.state)])) {\n if (!Object.is(hydrated.state[k], live.state[k])) slices.push(k)\n }\n if (slices.length === 0) {\n if (live.rowModel === hydrated.rowModel) return\n slices.push('rows')\n }\n // Delivered to onDiagnostic by the layout effect (no update during the commit).\n inst.rendering++\n try {\n emitTableDiagnostic(\n inst.table,\n 'DK_HYDRATION_MISMATCH',\n { slices },\n { trigger: 'hydrate', phase: 'hydrate' },\n )\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * Forwards the changed options with one `setOptions` call. In the re-render caused by that call,\n * values recomputed from the same inputs (same-shape `columns`, `data` with equal rows, a `rowKey`\n * function) are not forwarded again: an inline `columns` / `data` would otherwise loop. A `data`\n * that still differs is forwarded at most once per chain of self-caused re-renders, so rows that\n * are new on every render (`data: [{ … }]` with nested objects) re-ingest but never hang.\n */\nfunction sync(inst: Instance, options: Options, selfCaused: boolean) {\n // Written out (not a module-level flag) so bundlers fold it while parsing (§8.2).\n if (process.env.NODE_ENV !== 'production') checkUnstable(inst, options)\n const prev = inst.synced\n if (!selfCaused) inst.selfData = false\n let partial: Record<string, unknown> | undefined\n for (const k of SYNCED) {\n const v = options[k]\n const p = prev[k]\n if (Object.is(v, p)) continue\n let forward: unknown = v\n switch (k) {\n case 'onStateChange':\n case 'onDiagnostic':\n case 'fetcher': {\n const on = typeof v === 'function'\n if (on === (typeof p === 'function')) continue\n forward = on ? wrapper(inst, k, v) : undefined\n break\n }\n case 'state':\n if (sameSlices(v, p)) continue\n break\n case 'interceptors':\n if (sameItems(v, p)) continue\n break\n case 'data':\n // Two empty arrays hold nothing to ingest (e.g. an inline `data: []` with a fetcher).\n if (isEmpty(v) && sameItems(v, p)) continue\n if (selfCaused) {\n if (inst.selfData || sameRows(v, p)) continue\n inst.selfData = true\n }\n break\n case 'columns':\n if (selfCaused && sameShape(v, p)) continue\n break\n case 'rowKey':\n if (selfCaused && typeof v === 'function' && typeof p === 'function') continue\n break\n }\n partial ??= {}\n partial[k] = forward\n }\n if (partial === undefined) return\n inst.syncing = true\n try {\n inst.table.setOptions(partial)\n } finally {\n inst.syncing = false\n }\n const synced = { ...prev }\n for (const k of Object.keys(partial)) synced[k] = options[k]\n inst.synced = synced\n}\n\n/** Delivers the `onDiagnostic` calls queued while rendering. */\nfunction deliver(inst: Instance) {\n const queue = inst.queue\n if (queue === undefined) return\n inst.queue = undefined\n const sink = inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined\n for (const d of queue) {\n try {\n sink?.(d)\n } catch (e) {\n // Like a failing sink in the hub: the logger never breaks the table.\n console.error('[DataKable] onDiagnostic threw', e)\n }\n }\n}\n\n// --- comparisons ---------------------------------------------------------------------------------\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/** Controlled slices: the same defined slices, each `Object.is`-equal. */\nfunction sameSlices(a: unknown, b: unknown): boolean {\n if (!isObject(a) || !isObject(b)) return false\n const defined = (o: Record<string, unknown>) => Object.keys(o).filter((k) => o[k] !== undefined)\n const keys = defined(a)\n if (keys.length !== defined(b).length) return false\n for (const k of keys) if (!Object.is(a[k], b[k])) return false\n return true\n}\n\nconst isEmpty = (v: unknown) => Array.isArray(v) && v.length === 0\n\n/** Two arrays with the same items (by reference). */\nfunction sameItems(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false\n return true\n}\n\n/**\n * Two arrays of equal rows: each pair the same reference, or objects with the same own keys and\n * `Object.is`-equal values (`data: rows.map((r) => ({ ...r }))` recomputed in a re-render).\n */\nfunction sameRows(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) if (!Object.hasOwn(y, k) || !Object.is(x[k], y[k])) return false\n }\n return true\n}\n\nconst loose = (v: unknown) => typeof v === 'function' || isObject(v)\n\n/**\n * Column arrays of the same shape: same length, same keys per column and equal primitive values;\n * functions and nested objects (`format`, `cell`, `filter`, …) may be new references.\n */\nfunction sameShape(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) {\n if (!Object.hasOwn(y, k)) return false\n const vx = x[k]\n const vy = y[k]\n if (Object.is(vx, vy)) continue\n if (!(loose(vx) && loose(vy) && typeof vx === typeof vy)) return false\n }\n }\n return true\n}\n\n// --- dev: DK_UNSTABLE_COLUMNS / DK_UNSTABLE_OPTION -----------------------------------------------\n\n/** The first function option of a feature that is a new reference: `features[i].<option>`. */\nfunction changedFeatureOption(a: unknown, b: unknown): string | undefined {\n if (!Array.isArray(a) || !Array.isArray(b) || a === b) return undefined\n for (let i = 0; i < a.length; i++) {\n const f = a[i] as AnyFeature | undefined\n const g = b[i] as AnyFeature | undefined\n if (!f || !g || f === g || f.name !== g.name) continue\n if (!isOptionsDefinition(f.options) || !isOptionsDefinition(g.options)) continue\n const fv = f.options.values\n const gv = g.options.values\n if (!fv || !gv) continue\n for (const k of Object.keys(fv)) {\n if (typeof fv[k] === 'function' && fv[k] !== gv[k]) return `features[${i}].${k}`\n }\n }\n return undefined\n}\n\n/** Counts renders in a row that pass a new reference for the same thing; reports each once. */\nfunction checkUnstable(inst: Instance, options: Options) {\n const seen = inst.seen\n inst.seen = options\n const changed = (k: string) => !Object.is(options[k], seen[k])\n const fn = (k: string) =>\n changed(k) && typeof options[k] === 'function' && typeof seen[k] === 'function'\n track(inst, 'columns', changed('columns') && sameShape(options.columns, seen.columns))\n track(inst, 'data', changed('data') && sameRows(options.data, seen.data))\n track(inst, 'fetcher', fn('fetcher'))\n track(inst, 'rowKey', fn('rowKey'))\n const option = changedFeatureOption(options.features, seen.features)\n track(inst, 'features', option !== undefined, option)\n}\n\nfunction track(inst: Instance, key: string, unstable: boolean, option = key) {\n const n = unstable ? (inst.unstable.get(key) ?? 0) + 1 : 0\n inst.unstable.set(key, n)\n if (n < UNSTABLE_AFTER || inst.warned.has(key)) return\n inst.warned.add(key)\n if (key === 'columns') emitTableDiagnostic(inst.table, 'DK_UNSTABLE_COLUMNS', { renders: n })\n else emitTableDiagnostic(inst.table, 'DK_UNSTABLE_OPTION', { option, renders: n })\n}\n","{\n \"name\": \"@datakable/react\",\n \"version\": \"1.0.0\",\n \"description\": \"React bindings for DataKable — useDataTable hook and DataTable component.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/react\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"datatable\",\n \"table\",\n \"data-grid\",\n \"typescript\",\n \"type-safe\",\n \"headless\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/styles.css\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./styles.css\": \"./dist/styles.css\",\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . --profile node16 --exclude-entrypoints styles.css && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"@datakable/core\": \"workspace:^\"\n },\n \"peerDependencies\": {\n \"react\": \">=18\"\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAqBO;AACP,mBASO;;;AC7BL,cAAW;;;AD+Bb,mBAAiC;AAAA,IAGjC,6BAAgB,6BAAgB;AAMhC,IAAM,4BAA4B,OAAO,WAAW,cAAc,yBAAY;AA4C9E,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGA,IAAM,YAAY,CAAC,iBAAiB,gBAAgB,SAAS;AAI7D,IAAM,iBAAiB;AAyCvB,IAAI,aAAa;AA0CV,SAAS,aAAa,SAA2B;AACtD,QAAM,UAAM,qBAAwB,IAAI;AAGxC,MAAI,IAAI,YAAY,KAAM,KAAI,UAAU,eAAe,OAAO;AAC9D,QAAM,OAAO,IAAI;AACjB,QAAM,QAAQ,KAAK;AACnB,QAAM,CAAC,EAAE,QAAQ,QAAI,yBAAW,CAAC,MAAc,IAAI,GAAG,CAAC;AAEvD,QAAM,gBAAY;AAAA,IAChB,CAAC,aAAyB;AAExB,UAAI,KAAK,UAAU,SAAS,KAA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GAAG,CAAC,MAAM,GAAG,CAAC,EAAG,QAAO,YAAY,CAAC,KAAK,CAAC;AAAA,IAChF;AAAA,EACF;AACA,SAAO;AACT;AAGA,SAAS,cAAc,MAAgB,SAAkB;AACvD,QAAM,OAAO,KAAK;AAClB,OAAK,OAAO;AACZ,QAAM,UAAU,CAAC,MAAc,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC;AAC7D,QAAM,KAAK,CAAC,MACV,QAAQ,CAAC,KAAK,OAAO,QAAQ,CAAC,MAAM,cAAc,OAAO,KAAK,CAAC,MAAM;AACvE,QAAM,MAAM,WAAW,QAAQ,SAAS,KAAK,UAAU,QAAQ,SAAS,KAAK,OAAO,CAAC;AACrF,QAAM,MAAM,QAAQ,QAAQ,MAAM,KAAK,SAAS,QAAQ,MAAM,KAAK,IAAI,CAAC;AACxE,QAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AACpC,QAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;AAClC,QAAM,SAAS,qBAAqB,QAAQ,UAAU,KAAK,QAAQ;AACnE,QAAM,MAAM,YAAY,WAAW,QAAW,MAAM;AACtD;AAEA,SAAS,MAAM,MAAgB,KAAa,UAAmB,SAAS,KAAK;AAC3E,QAAM,IAAI,YAAY,KAAK,SAAS,IAAI,GAAG,KAAK,KAAK,IAAI;AACzD,OAAK,SAAS,IAAI,KAAK,CAAC;AACxB,MAAI,IAAI,kBAAkB,KAAK,OAAO,IAAI,GAAG,EAAG;AAChD,OAAK,OAAO,IAAI,GAAG;AACnB,MAAI,QAAQ,UAAW,sCAAoB,KAAK,OAAO,uBAAuB,EAAE,SAAS,EAAE,CAAC;AAAA,MACvF,sCAAoB,KAAK,OAAO,sBAAsB,EAAE,QAAQ,SAAS,EAAE,CAAC;AACnF;","names":["value"]}
1
+ {"version":3,"sources":["../src/use-data-table.ts","../package.json"],"sourcesContent":["'use client'\n\nimport {\n type AnyFeature,\n type ApiOf,\n type ColumnDef,\n type CreateTableOptions,\n createDeferred,\n createTable,\n type Diagnostic,\n emitTableDiagnostic,\n type InvalidRowsMode,\n isOptionsDefinition,\n keepDiagnostics,\n type RowModel,\n registerPackage,\n type SchemaRow,\n SERVER_SOURCE,\n startTable,\n type Table,\n type TableSchema,\n type TableState,\n type TableStateFor,\n} from '@datakable/core'\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useInsertionEffect,\n useLayoutEffect,\n useReducer,\n useRef,\n useSyncExternalStore,\n} from 'react'\nimport { version } from '../package.json'\nimport { reactDiagnostics } from './codes'\n\n// Registers the (development-only) definitions where they are emitted, so bundlers keep them.\nkeepDiagnostics(reactDiagnostics)\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n/**\n * `useDataTable` options: `createTable`'s (§3.2), with `cell` / `invalidCell` returning a\n * `ReactNode` (§10). Read once, at creation: `features`, `schema`, `invalidRows`, `initialState`,\n * `name`, `timeout`, `strict`, `diagnostics`. Every other option follows the latest render.\n */\nexport type UseDataTableOptions<\n T,\n S extends TableState = TableState,\n Sch = undefined,\n M extends InvalidRowsMode = 'drop',\n> = Omit<CreateTableOptions<T, S, Sch, M>, 'columns'> & {\n /**\n * Compared by reference (§10): a new array tells the table the columns changed. Define them\n * outside the component or memoise them (`DK_UNSTABLE_COLUMNS` in development).\n */\n columns?: readonly ColumnDef<SchemaRow<T, Sch>, ReactNode>[]\n}\n\n/**\n * What `useDataTable` returns: the table (its methods and the installed features' APIs) with the\n * `state` and `rowModel` of this render. A new object whenever the table notifies, so it can be a\n * dependency of `useMemo` / `memo` children; the same object while nothing changed.\n */\nexport type UseDataTableResult<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n In = T,\n Api = unknown,\n> = Table<T, S, M, In> &\n Api & {\n /** The state snapshot of this render (`getState()`). */\n readonly state: S\n /** The row model of this render (`getRowModel()`, §6.6): rows, counts, status. */\n readonly rowModel: RowModel<T, M>\n }\n\ntype Options = Record<string, unknown> & { features?: readonly AnyFeature[] }\ntype AnyTable = Table<unknown, TableState> & Record<string, unknown>\ntype Callback = (arg: never) => unknown\n\n/** Options forwarded through `setOptions` when they change; the rest are read once (§3.4). */\nconst SYNCED = [\n 'data',\n 'columns',\n 'rowKey',\n 'state',\n 'onStateChange',\n 'interceptors',\n 'onDiagnostic',\n 'fetcher',\n 'rowCount',\n] as const\n\n/** Given to the table as stable wrappers that call the latest prop (latest-ref). */\nconst CALLBACKS = ['onStateChange', 'onDiagnostic', 'fetcher'] as const\ntype CallbackKey = (typeof CALLBACKS)[number]\n\n/** Renders in a row with a new reference before `DK_UNSTABLE_*` is reported. */\nconst UNSTABLE_AFTER = 2\n\ninterface Instance {\n table: AnyTable\n destroyed: boolean\n mounted: boolean\n /** The options of the latest committed render (what the wrappers call). */\n latest: Options\n /** The option values the table has (user values; callbacks count by presence). */\n synced: Options\n readonly wrappers: Record<CallbackKey, Callback>\n /** `onDiagnostic` calls made while rendering, delivered after the commit. */\n queue: Diagnostic[] | undefined\n rendering: number\n /** Inside the hook's own `setOptions` call. */\n syncing: boolean\n /** That call notified: the next commit is the re-render it caused. */\n selfCaused: boolean\n /**\n * `data` was forwarded in a self-caused re-render. Rows that differ on every render (nested\n * objects, computed fields) would otherwise ingest → notify → re-render forever: the next\n * self-caused re-render keeps the data the table has.\n */\n selfData: boolean\n /** Notifications seen; part of the view cache key (a notification is never silent, §6.6). */\n version: number\n view: { table: AnyTable; version: number; value: object } | undefined\n /**\n * SSR (§7.2): the view of `table` at its creation — initial state, controlled state and data /\n * initialData, no async result (the table is created deferred). `getServerSnapshot`.\n */\n server: { table: AnyTable; value: object } | undefined\n /** React read `getServerSnapshot` on the client: this render hydrates server HTML. */\n hydrating: boolean\n // Dev: DK_UNSTABLE_* bookkeeping.\n /** The options of the previous committed render. */\n seen: Options\n unstable: Map<string, number>\n warned: Set<string>\n}\n\nlet registered = false\n\n/**\n * Binds a table to a component (§10): the table is created once per component instance and\n * destroyed on unmount; renders read it through `useSyncExternalStore` (with\n * `getServerSnapshot`), and options are synced with `table.setOptions` in a layout effect, never\n * during render.\n *\n * - `features` (and the other read-once options) are read at creation: a new inline `features`\n * array never recreates the table.\n * - `fetcher`, `onStateChange` and `onDiagnostic` may be inline functions: the table always calls\n * the latest one, and a new reference never refetches (call `refetch()` when a value the fetcher\n * reads changes).\n * - `columns`, `data` and a `rowKey` function are compared by reference: memoise them.\n * - Controlled slices (§3.2): pass `state` and `onStateChange`; changes come back through `state`.\n * - SSR (§7.2): rendering starts no async work. The fetcher's first request and a `searchFn` for an\n * initial query start after the commit (`status: 'pending'` until then; `DK_SSR_ASYNC_DEFERRED`\n * on the server), unless `initialData` already holds their result. `initialState` (e.g. parsed\n * from the URL) applies on the server: client-mode features filter / search / sort the HTML.\n * `getServerSnapshot` is the view at creation; a table that changed before the hydration commit\n * reports `DK_HYDRATION_MISMATCH`.\n *\n * `@datakable/react` installs no features by default; `datakable`'s `useDataTable` installs the\n * default preset.\n */\nexport function useDataTable<\n T,\n S extends TableState = never,\n const Fs extends readonly AnyFeature[] = [],\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(\n options: UseDataTableOptions<T, TableStateFor<S, Fs, SchemaRow<T, Sch>>, Sch, M> & {\n features?: Fs\n },\n): UseDataTableResult<\n SchemaRow<T, Sch>,\n TableStateFor<S, Fs, SchemaRow<T, Sch>>,\n M,\n [Sch] extends [TableSchema] ? unknown : T,\n ApiOf<Fs, SchemaRow<T, Sch>>\n>\nexport function useDataTable(options: Options): unknown {\n const ref = useRef<Instance | null>(null)\n // Created during the first render (React keeps the ref across the StrictMode double render),\n // deferred: its async work (fetcher, searchFn) starts in the mount effect, never on the server.\n if (ref.current === null) ref.current = createInstance(options)\n const inst = ref.current\n const table = inst.table\n const [, rerender] = useReducer((n: number) => n + 1, 0)\n\n const subscribe = useCallback(\n (onChange: () => void) => {\n // Replaced or destroyed meanwhile (`<Activity>`): nothing to subscribe to.\n if (inst.table !== table || inst.destroyed) return () => {}\n return table.subscribe(() => {\n inst.version++\n if (inst.syncing) inst.selfCaused = true\n onChange()\n })\n },\n [inst, table],\n )\n const getSnapshot = useCallback(() => snapshot(inst, table), [inst, table])\n const getServerSnapshot = useCallback(() => serverSnapshot(inst, table), [inst, table])\n const view = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n\n // Hydration commit (§7.2): before any layout effect can change the table, the snapshot React\n // hydrated with must still be the live one, else React replaces the server HTML at once.\n useInsertionEffect(() => checkHydration(inst), [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.mounted = true\n // Destroyed while hidden (`<Activity>`): a new table, from the latest options.\n if (inst.destroyed) {\n recreate(inst)\n startTable(inst.table)\n rerender()\n } else {\n // The deferred fetch / searchFn starts now; its status shows before paint.\n startTable(inst.table)\n if (snapshot(inst, inst.table) !== view) rerender()\n }\n return () => {\n inst.mounted = false\n // Deferred: the StrictMode effect re-run mounts again synchronously and keeps the table.\n queueMicrotask(() => {\n if (inst.mounted || inst.destroyed) return\n inst.destroyed = true\n inst.table.destroy()\n })\n }\n }, [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.latest = options\n const selfCaused = inst.selfCaused\n inst.selfCaused = false\n if (!inst.destroyed) sync(inst, options, selfCaused)\n deliver(inst)\n })\n\n return view\n}\n\nfunction createInstance(options: Options): Instance {\n const inst: Instance = {\n table: undefined as unknown as AnyTable,\n destroyed: false,\n mounted: false,\n latest: options,\n synced: options,\n wrappers: {\n onStateChange: (updater) => (inst.latest.onStateChange as Callback)(updater),\n onDiagnostic: (d: Diagnostic) => {\n if (inst.rendering === 0) {\n ;(inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined)?.(d)\n return\n }\n if (inst.queue === undefined) {\n inst.queue = []\n // Delivered by the next layout effect, or here when this render never commits.\n queueMicrotask(() => deliver(inst))\n }\n inst.queue.push(d)\n },\n fetcher: (params) => (inst.latest.fetcher as Callback)(params),\n },\n queue: undefined,\n rendering: 0,\n syncing: false,\n selfCaused: false,\n selfData: false,\n version: 0,\n view: undefined,\n server: undefined,\n hydrating: false,\n seen: options,\n unstable: new Map(),\n warned: new Set(),\n }\n // The version checks are development-only (§8.5): production bundles no registry.\n if (process.env.NODE_ENV !== 'production' && !registered) {\n registered = true\n registerPackage('@datakable/react', version)\n }\n build(inst, options)\n return inst\n}\n\n/**\n * The stable wrapper of callback `k`. The fetcher's also carries the server source of the user's\n * `withFetcher` fetcher (§7.1), which is what makes the table load through it.\n */\nfunction wrapper(inst: Instance, k: CallbackKey, v: unknown): Callback {\n const w = inst.wrappers[k]\n if (k === 'fetcher') {\n ;(w as unknown as Record<symbol, unknown>)[SERVER_SOURCE] = (v as Record<symbol, unknown>)[\n SERVER_SOURCE\n ]\n }\n return w\n}\n\nfunction build(inst: Instance, options: Options) {\n const init: Options = { ...options }\n for (const k of CALLBACKS) {\n if (typeof options[k] === 'function') init[k] = wrapper(inst, k, options[k])\n }\n inst.rendering++\n try {\n // Deferred (§7.2): rendering starts no fetch / searchFn (none at all on the server, where\n // effects never run); the mount effect starts it.\n inst.table = createDeferred(() => createTable(init as never)) as unknown as AnyTable\n } finally {\n inst.rendering--\n }\n inst.synced = options\n inst.seen = options\n inst.view = undefined\n inst.server = undefined\n}\n\nfunction recreate(inst: Instance) {\n build(inst, inst.latest)\n inst.destroyed = false\n}\n\n/** The view of the table's snapshot, cached on (table, state, row model, notifications). */\nfunction snapshot(inst: Instance, table: AnyTable): object {\n inst.rendering++\n try {\n const state = table.getState()\n const rowModel = table.getRowModel()\n const v = inst.view\n if (v && v.table === table && v.version === inst.version) {\n const value = v.value as { state: unknown; rowModel: unknown }\n if (value.state === state && value.rowModel === rowModel) return value\n }\n const value = Object.create(table, {\n state: { value: state, enumerable: true },\n rowModel: { value: rowModel, enumerable: true },\n }) as object\n inst.view = { table, version: inst.version, value }\n return value\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * `getServerSnapshot` (§7.2): the view of the table at its creation. React reads it on the server\n * and while hydrating, so both render the same snapshot; async work never ran in it.\n */\nfunction serverSnapshot(inst: Instance, table: AnyTable): object {\n if (inst.table !== table) return snapshot(inst, table)\n // On the client React reads it only to hydrate.\n if (typeof window !== 'undefined') inst.hydrating = true\n const s = inst.server\n if (s && s.table === table) return s.value\n const value = snapshot(inst, table)\n inst.server = { table, value }\n return value\n}\n\n/** `DK_HYDRATION_MISMATCH`: what differs between the hydrated (server) view and the live one. */\nfunction checkHydration(inst: Instance) {\n if (!inst.hydrating) return\n inst.hydrating = false\n const server = inst.server\n if (!server || server.table !== inst.table) return\n const live = snapshot(inst, inst.table) as { state: TableState; rowModel: unknown }\n const hydrated = server.value as { state: TableState; rowModel: unknown }\n if (live === hydrated) return\n const slices: string[] = []\n for (const k of new Set([...Object.keys(hydrated.state), ...Object.keys(live.state)])) {\n if (!Object.is(hydrated.state[k], live.state[k])) slices.push(k)\n }\n if (slices.length === 0) {\n if (live.rowModel === hydrated.rowModel) return\n slices.push('rows')\n }\n // Delivered to onDiagnostic by the layout effect (no update during the commit).\n inst.rendering++\n try {\n emitTableDiagnostic(\n inst.table,\n 'DK_HYDRATION_MISMATCH',\n { slices },\n { trigger: 'hydrate', phase: 'hydrate' },\n )\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * Forwards the changed options with one `setOptions` call. In the re-render caused by that call,\n * values recomputed from the same inputs (same-shape `columns`, `data` with equal rows, a `rowKey`\n * function) are not forwarded again: an inline `columns` / `data` would otherwise loop. A `data`\n * that still differs is forwarded at most once per chain of self-caused re-renders, so rows that\n * are new on every render (`data: [{ … }]` with nested objects) re-ingest but never hang.\n */\nfunction sync(inst: Instance, options: Options, selfCaused: boolean) {\n // Written out (not a module-level flag) so bundlers fold it while parsing (§8.2).\n if (process.env.NODE_ENV !== 'production') checkUnstable(inst, options)\n const prev = inst.synced\n if (!selfCaused) inst.selfData = false\n let partial: Record<string, unknown> | undefined\n for (const k of SYNCED) {\n const v = options[k]\n const p = prev[k]\n if (Object.is(v, p)) continue\n let forward: unknown = v\n switch (k) {\n case 'onStateChange':\n case 'onDiagnostic':\n case 'fetcher': {\n const on = typeof v === 'function'\n if (on === (typeof p === 'function')) continue\n forward = on ? wrapper(inst, k, v) : undefined\n break\n }\n case 'state':\n if (sameSlices(v, p)) continue\n break\n case 'interceptors':\n if (sameItems(v, p)) continue\n break\n case 'data':\n // Two empty arrays hold nothing to ingest (e.g. an inline `data: []` with a fetcher).\n if (isEmpty(v) && sameItems(v, p)) continue\n if (selfCaused) {\n if (inst.selfData || sameRows(v, p)) continue\n inst.selfData = true\n }\n break\n case 'columns':\n if (selfCaused && sameShape(v, p)) continue\n break\n case 'rowKey':\n if (selfCaused && typeof v === 'function' && typeof p === 'function') continue\n break\n }\n partial ??= {}\n partial[k] = forward\n }\n if (partial === undefined) return\n inst.syncing = true\n try {\n inst.table.setOptions(partial)\n } finally {\n inst.syncing = false\n }\n const synced = { ...prev }\n for (const k of Object.keys(partial)) synced[k] = options[k]\n inst.synced = synced\n}\n\n/** Delivers the `onDiagnostic` calls queued while rendering. */\nfunction deliver(inst: Instance) {\n const queue = inst.queue\n if (queue === undefined) return\n inst.queue = undefined\n const sink = inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined\n for (const d of queue) {\n try {\n sink?.(d)\n } catch (e) {\n // Like a failing sink in the hub: the logger never breaks the table.\n console.error('[DataKable] onDiagnostic threw', e)\n }\n }\n}\n\n// --- comparisons ---------------------------------------------------------------------------------\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/** Controlled slices: the same defined slices, each `Object.is`-equal. */\nfunction sameSlices(a: unknown, b: unknown): boolean {\n if (!isObject(a) || !isObject(b)) return false\n const defined = (o: Record<string, unknown>) => Object.keys(o).filter((k) => o[k] !== undefined)\n const keys = defined(a)\n if (keys.length !== defined(b).length) return false\n for (const k of keys) if (!Object.is(a[k], b[k])) return false\n return true\n}\n\nconst isEmpty = (v: unknown) => Array.isArray(v) && v.length === 0\n\n/** Two arrays with the same items (by reference). */\nfunction sameItems(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false\n return true\n}\n\n/**\n * Two arrays of equal rows: each pair the same reference, or objects with the same own keys and\n * `Object.is`-equal values (`data: rows.map((r) => ({ ...r }))` recomputed in a re-render).\n */\nfunction sameRows(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) if (!Object.hasOwn(y, k) || !Object.is(x[k], y[k])) return false\n }\n return true\n}\n\nconst loose = (v: unknown) => typeof v === 'function' || isObject(v)\n\n/**\n * Column arrays of the same shape: same length, same keys per column and equal primitive values;\n * functions and nested objects (`format`, `cell`, `filter`, …) may be new references.\n */\nfunction sameShape(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) {\n if (!Object.hasOwn(y, k)) return false\n const vx = x[k]\n const vy = y[k]\n if (Object.is(vx, vy)) continue\n if (!(loose(vx) && loose(vy) && typeof vx === typeof vy)) return false\n }\n }\n return true\n}\n\n// --- dev: DK_UNSTABLE_COLUMNS / DK_UNSTABLE_OPTION -----------------------------------------------\n\n/** The first function option of a feature that is a new reference: `features[i].<option>`. */\nfunction changedFeatureOption(a: unknown, b: unknown): string | undefined {\n if (!Array.isArray(a) || !Array.isArray(b) || a === b) return undefined\n for (let i = 0; i < a.length; i++) {\n const f = a[i] as AnyFeature | undefined\n const g = b[i] as AnyFeature | undefined\n if (!f || !g || f === g || f.name !== g.name) continue\n if (!isOptionsDefinition(f.options) || !isOptionsDefinition(g.options)) continue\n const fv = f.options.values\n const gv = g.options.values\n if (!fv || !gv) continue\n for (const k of Object.keys(fv)) {\n if (typeof fv[k] === 'function' && fv[k] !== gv[k]) return `features[${i}].${k}`\n }\n }\n return undefined\n}\n\n/** Counts renders in a row that pass a new reference for the same thing; reports each once. */\nfunction checkUnstable(inst: Instance, options: Options) {\n const seen = inst.seen\n inst.seen = options\n const changed = (k: string) => !Object.is(options[k], seen[k])\n const fn = (k: string) =>\n changed(k) && typeof options[k] === 'function' && typeof seen[k] === 'function'\n track(inst, 'columns', changed('columns') && sameShape(options.columns, seen.columns))\n track(inst, 'data', changed('data') && sameRows(options.data, seen.data))\n track(inst, 'fetcher', fn('fetcher'))\n track(inst, 'rowKey', fn('rowKey'))\n const option = changedFeatureOption(options.features, seen.features)\n track(inst, 'features', option !== undefined, option)\n}\n\nfunction track(inst: Instance, key: string, unstable: boolean, option = key) {\n const n = unstable ? (inst.unstable.get(key) ?? 0) + 1 : 0\n inst.unstable.set(key, n)\n if (n < UNSTABLE_AFTER || inst.warned.has(key)) return\n inst.warned.add(key)\n if (key === 'columns') emitTableDiagnostic(inst.table, 'DK_UNSTABLE_COLUMNS', { renders: n })\n else emitTableDiagnostic(inst.table, 'DK_UNSTABLE_OPTION', { option, renders: n })\n}\n","{\n \"name\": \"@datakable/react\",\n \"version\": \"1.0.1\",\n \"description\": \"React bindings for DataKable — useDataTable hook and DataTable component.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/react\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"datatable\",\n \"table\",\n \"data-grid\",\n \"typescript\",\n \"type-safe\",\n \"headless\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/styles.css\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./styles.css\": \"./dist/styles.css\",\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . --profile node16 --exclude-entrypoints styles.css && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"@datakable/core\": \"workspace:^\"\n },\n \"peerDependencies\": {\n \"react\": \">=18\"\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAqBO;AACP,mBASO;;;AC/BL,cAAW;;;ADiCb,mBAAiC;AAAA,IAGjC,6BAAgB,6BAAgB;AAMhC,IAAM,4BAA4B,OAAO,WAAW,cAAc,yBAAY;AA4C9E,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGA,IAAM,YAAY,CAAC,iBAAiB,gBAAgB,SAAS;AAI7D,IAAM,iBAAiB;AAyCvB,IAAI,aAAa;AA0CV,SAAS,aAAa,SAA2B;AACtD,QAAM,UAAM,qBAAwB,IAAI;AAGxC,MAAI,IAAI,YAAY,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,OAAO,uBAAuB,EAAE,SAAS,EAAE,CAAC;AAAA,MACvF,sCAAoB,KAAK,OAAO,sBAAsB,EAAE,QAAQ,SAAS,EAAE,CAAC;AACnF;","names":["value"]}
@@ -22,7 +22,7 @@ import {
22
22
  } from "react";
23
23
 
24
24
  // package.json
25
- var version = "1.0.0";
25
+ var version = "1.0.1";
26
26
 
27
27
  // src/use-data-table.ts
28
28
  import { reactDiagnostics } from "./codes.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-data-table.ts","../package.json"],"sourcesContent":["import {\n type AnyFeature,\n type ApiOf,\n type ColumnDef,\n type CreateTableOptions,\n createDeferred,\n createTable,\n type Diagnostic,\n emitTableDiagnostic,\n type InvalidRowsMode,\n isOptionsDefinition,\n keepDiagnostics,\n type RowModel,\n registerPackage,\n type SchemaRow,\n SERVER_SOURCE,\n startTable,\n type Table,\n type TableSchema,\n type TableState,\n type TableStateFor,\n} from '@datakable/core'\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useInsertionEffect,\n useLayoutEffect,\n useReducer,\n useRef,\n useSyncExternalStore,\n} from 'react'\nimport { version } from '../package.json'\nimport { reactDiagnostics } from './codes'\n\n// Registers the (development-only) definitions where they are emitted, so bundlers keep them.\nkeepDiagnostics(reactDiagnostics)\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n/**\n * `useDataTable` options: `createTable`'s (§3.2), with `cell` / `invalidCell` returning a\n * `ReactNode` (§10). Read once, at creation: `features`, `schema`, `invalidRows`, `initialState`,\n * `name`, `timeout`, `strict`, `diagnostics`. Every other option follows the latest render.\n */\nexport type UseDataTableOptions<\n T,\n S extends TableState = TableState,\n Sch = undefined,\n M extends InvalidRowsMode = 'drop',\n> = Omit<CreateTableOptions<T, S, Sch, M>, 'columns'> & {\n /**\n * Compared by reference (§10): a new array tells the table the columns changed. Define them\n * outside the component or memoise them (`DK_UNSTABLE_COLUMNS` in development).\n */\n columns?: readonly ColumnDef<SchemaRow<T, Sch>, ReactNode>[]\n}\n\n/**\n * What `useDataTable` returns: the table (its methods and the installed features' APIs) with the\n * `state` and `rowModel` of this render. A new object whenever the table notifies, so it can be a\n * dependency of `useMemo` / `memo` children; the same object while nothing changed.\n */\nexport type UseDataTableResult<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n In = T,\n Api = unknown,\n> = Table<T, S, M, In> &\n Api & {\n /** The state snapshot of this render (`getState()`). */\n readonly state: S\n /** The row model of this render (`getRowModel()`, §6.6): rows, counts, status. */\n readonly rowModel: RowModel<T, M>\n }\n\ntype Options = Record<string, unknown> & { features?: readonly AnyFeature[] }\ntype AnyTable = Table<unknown, TableState> & Record<string, unknown>\ntype Callback = (arg: never) => unknown\n\n/** Options forwarded through `setOptions` when they change; the rest are read once (§3.4). */\nconst SYNCED = [\n 'data',\n 'columns',\n 'rowKey',\n 'state',\n 'onStateChange',\n 'interceptors',\n 'onDiagnostic',\n 'fetcher',\n 'rowCount',\n] as const\n\n/** Given to the table as stable wrappers that call the latest prop (latest-ref). */\nconst CALLBACKS = ['onStateChange', 'onDiagnostic', 'fetcher'] as const\ntype CallbackKey = (typeof CALLBACKS)[number]\n\n/** Renders in a row with a new reference before `DK_UNSTABLE_*` is reported. */\nconst UNSTABLE_AFTER = 2\n\ninterface Instance {\n table: AnyTable\n destroyed: boolean\n mounted: boolean\n /** The options of the latest committed render (what the wrappers call). */\n latest: Options\n /** The option values the table has (user values; callbacks count by presence). */\n synced: Options\n readonly wrappers: Record<CallbackKey, Callback>\n /** `onDiagnostic` calls made while rendering, delivered after the commit. */\n queue: Diagnostic[] | undefined\n rendering: number\n /** Inside the hook's own `setOptions` call. */\n syncing: boolean\n /** That call notified: the next commit is the re-render it caused. */\n selfCaused: boolean\n /**\n * `data` was forwarded in a self-caused re-render. Rows that differ on every render (nested\n * objects, computed fields) would otherwise ingest → notify → re-render forever: the next\n * self-caused re-render keeps the data the table has.\n */\n selfData: boolean\n /** Notifications seen; part of the view cache key (a notification is never silent, §6.6). */\n version: number\n view: { table: AnyTable; version: number; value: object } | undefined\n /**\n * SSR (§7.2): the view of `table` at its creation — initial state, controlled state and data /\n * initialData, no async result (the table is created deferred). `getServerSnapshot`.\n */\n server: { table: AnyTable; value: object } | undefined\n /** React read `getServerSnapshot` on the client: this render hydrates server HTML. */\n hydrating: boolean\n // Dev: DK_UNSTABLE_* bookkeeping.\n /** The options of the previous committed render. */\n seen: Options\n unstable: Map<string, number>\n warned: Set<string>\n}\n\nlet registered = false\n\n/**\n * Binds a table to a component (§10): the table is created once per component instance and\n * destroyed on unmount; renders read it through `useSyncExternalStore` (with\n * `getServerSnapshot`), and options are synced with `table.setOptions` in a layout effect, never\n * during render.\n *\n * - `features` (and the other read-once options) are read at creation: a new inline `features`\n * array never recreates the table.\n * - `fetcher`, `onStateChange` and `onDiagnostic` may be inline functions: the table always calls\n * the latest one, and a new reference never refetches (call `refetch()` when a value the fetcher\n * reads changes).\n * - `columns`, `data` and a `rowKey` function are compared by reference: memoise them.\n * - Controlled slices (§3.2): pass `state` and `onStateChange`; changes come back through `state`.\n * - SSR (§7.2): rendering starts no async work. The fetcher's first request and a `searchFn` for an\n * initial query start after the commit (`status: 'pending'` until then; `DK_SSR_ASYNC_DEFERRED`\n * on the server), unless `initialData` already holds their result. `initialState` (e.g. parsed\n * from the URL) applies on the server: client-mode features filter / search / sort the HTML.\n * `getServerSnapshot` is the view at creation; a table that changed before the hydration commit\n * reports `DK_HYDRATION_MISMATCH`.\n *\n * `@datakable/react` installs no features by default; `datakable`'s `useDataTable` installs the\n * default preset.\n */\nexport function useDataTable<\n T,\n S extends TableState = never,\n const Fs extends readonly AnyFeature[] = [],\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(\n options: UseDataTableOptions<T, TableStateFor<S, Fs, SchemaRow<T, Sch>>, Sch, M> & {\n features?: Fs\n },\n): UseDataTableResult<\n SchemaRow<T, Sch>,\n TableStateFor<S, Fs, SchemaRow<T, Sch>>,\n M,\n [Sch] extends [TableSchema] ? unknown : T,\n ApiOf<Fs, SchemaRow<T, Sch>>\n>\nexport function useDataTable(options: Options): unknown {\n const ref = useRef<Instance | null>(null)\n // Created during the first render (React keeps the ref across the StrictMode double render),\n // deferred: its async work (fetcher, searchFn) starts in the mount effect, never on the server.\n if (ref.current === null) ref.current = createInstance(options)\n const inst = ref.current\n const table = inst.table\n const [, rerender] = useReducer((n: number) => n + 1, 0)\n\n const subscribe = useCallback(\n (onChange: () => void) => {\n // Replaced or destroyed meanwhile (`<Activity>`): nothing to subscribe to.\n if (inst.table !== table || inst.destroyed) return () => {}\n return table.subscribe(() => {\n inst.version++\n if (inst.syncing) inst.selfCaused = true\n onChange()\n })\n },\n [inst, table],\n )\n const getSnapshot = useCallback(() => snapshot(inst, table), [inst, table])\n const getServerSnapshot = useCallback(() => serverSnapshot(inst, table), [inst, table])\n const view = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n\n // Hydration commit (§7.2): before any layout effect can change the table, the snapshot React\n // hydrated with must still be the live one, else React replaces the server HTML at once.\n useInsertionEffect(() => checkHydration(inst), [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.mounted = true\n // Destroyed while hidden (`<Activity>`): a new table, from the latest options.\n if (inst.destroyed) {\n recreate(inst)\n startTable(inst.table)\n rerender()\n } else {\n // The deferred fetch / searchFn starts now; its status shows before paint.\n startTable(inst.table)\n if (snapshot(inst, inst.table) !== view) rerender()\n }\n return () => {\n inst.mounted = false\n // Deferred: the StrictMode effect re-run mounts again synchronously and keeps the table.\n queueMicrotask(() => {\n if (inst.mounted || inst.destroyed) return\n inst.destroyed = true\n inst.table.destroy()\n })\n }\n }, [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.latest = options\n const selfCaused = inst.selfCaused\n inst.selfCaused = false\n if (!inst.destroyed) sync(inst, options, selfCaused)\n deliver(inst)\n })\n\n return view\n}\n\nfunction createInstance(options: Options): Instance {\n const inst: Instance = {\n table: undefined as unknown as AnyTable,\n destroyed: false,\n mounted: false,\n latest: options,\n synced: options,\n wrappers: {\n onStateChange: (updater) => (inst.latest.onStateChange as Callback)(updater),\n onDiagnostic: (d: Diagnostic) => {\n if (inst.rendering === 0) {\n ;(inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined)?.(d)\n return\n }\n if (inst.queue === undefined) {\n inst.queue = []\n // Delivered by the next layout effect, or here when this render never commits.\n queueMicrotask(() => deliver(inst))\n }\n inst.queue.push(d)\n },\n fetcher: (params) => (inst.latest.fetcher as Callback)(params),\n },\n queue: undefined,\n rendering: 0,\n syncing: false,\n selfCaused: false,\n selfData: false,\n version: 0,\n view: undefined,\n server: undefined,\n hydrating: false,\n seen: options,\n unstable: new Map(),\n warned: new Set(),\n }\n // The version checks are development-only (§8.5): production bundles no registry.\n if (process.env.NODE_ENV !== 'production' && !registered) {\n registered = true\n registerPackage('@datakable/react', version)\n }\n build(inst, options)\n return inst\n}\n\n/**\n * The stable wrapper of callback `k`. The fetcher's also carries the server source of the user's\n * `withFetcher` fetcher (§7.1), which is what makes the table load through it.\n */\nfunction wrapper(inst: Instance, k: CallbackKey, v: unknown): Callback {\n const w = inst.wrappers[k]\n if (k === 'fetcher') {\n ;(w as unknown as Record<symbol, unknown>)[SERVER_SOURCE] = (v as Record<symbol, unknown>)[\n SERVER_SOURCE\n ]\n }\n return w\n}\n\nfunction build(inst: Instance, options: Options) {\n const init: Options = { ...options }\n for (const k of CALLBACKS) {\n if (typeof options[k] === 'function') init[k] = wrapper(inst, k, options[k])\n }\n inst.rendering++\n try {\n // Deferred (§7.2): rendering starts no fetch / searchFn (none at all on the server, where\n // effects never run); the mount effect starts it.\n inst.table = createDeferred(() => createTable(init as never)) as unknown as AnyTable\n } finally {\n inst.rendering--\n }\n inst.synced = options\n inst.seen = options\n inst.view = undefined\n inst.server = undefined\n}\n\nfunction recreate(inst: Instance) {\n build(inst, inst.latest)\n inst.destroyed = false\n}\n\n/** The view of the table's snapshot, cached on (table, state, row model, notifications). */\nfunction snapshot(inst: Instance, table: AnyTable): object {\n inst.rendering++\n try {\n const state = table.getState()\n const rowModel = table.getRowModel()\n const v = inst.view\n if (v && v.table === table && v.version === inst.version) {\n const value = v.value as { state: unknown; rowModel: unknown }\n if (value.state === state && value.rowModel === rowModel) return value\n }\n const value = Object.create(table, {\n state: { value: state, enumerable: true },\n rowModel: { value: rowModel, enumerable: true },\n }) as object\n inst.view = { table, version: inst.version, value }\n return value\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * `getServerSnapshot` (§7.2): the view of the table at its creation. React reads it on the server\n * and while hydrating, so both render the same snapshot; async work never ran in it.\n */\nfunction serverSnapshot(inst: Instance, table: AnyTable): object {\n if (inst.table !== table) return snapshot(inst, table)\n // On the client React reads it only to hydrate.\n if (typeof window !== 'undefined') inst.hydrating = true\n const s = inst.server\n if (s && s.table === table) return s.value\n const value = snapshot(inst, table)\n inst.server = { table, value }\n return value\n}\n\n/** `DK_HYDRATION_MISMATCH`: what differs between the hydrated (server) view and the live one. */\nfunction checkHydration(inst: Instance) {\n if (!inst.hydrating) return\n inst.hydrating = false\n const server = inst.server\n if (!server || server.table !== inst.table) return\n const live = snapshot(inst, inst.table) as { state: TableState; rowModel: unknown }\n const hydrated = server.value as { state: TableState; rowModel: unknown }\n if (live === hydrated) return\n const slices: string[] = []\n for (const k of new Set([...Object.keys(hydrated.state), ...Object.keys(live.state)])) {\n if (!Object.is(hydrated.state[k], live.state[k])) slices.push(k)\n }\n if (slices.length === 0) {\n if (live.rowModel === hydrated.rowModel) return\n slices.push('rows')\n }\n // Delivered to onDiagnostic by the layout effect (no update during the commit).\n inst.rendering++\n try {\n emitTableDiagnostic(\n inst.table,\n 'DK_HYDRATION_MISMATCH',\n { slices },\n { trigger: 'hydrate', phase: 'hydrate' },\n )\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * Forwards the changed options with one `setOptions` call. In the re-render caused by that call,\n * values recomputed from the same inputs (same-shape `columns`, `data` with equal rows, a `rowKey`\n * function) are not forwarded again: an inline `columns` / `data` would otherwise loop. A `data`\n * that still differs is forwarded at most once per chain of self-caused re-renders, so rows that\n * are new on every render (`data: [{ … }]` with nested objects) re-ingest but never hang.\n */\nfunction sync(inst: Instance, options: Options, selfCaused: boolean) {\n // Written out (not a module-level flag) so bundlers fold it while parsing (§8.2).\n if (process.env.NODE_ENV !== 'production') checkUnstable(inst, options)\n const prev = inst.synced\n if (!selfCaused) inst.selfData = false\n let partial: Record<string, unknown> | undefined\n for (const k of SYNCED) {\n const v = options[k]\n const p = prev[k]\n if (Object.is(v, p)) continue\n let forward: unknown = v\n switch (k) {\n case 'onStateChange':\n case 'onDiagnostic':\n case 'fetcher': {\n const on = typeof v === 'function'\n if (on === (typeof p === 'function')) continue\n forward = on ? wrapper(inst, k, v) : undefined\n break\n }\n case 'state':\n if (sameSlices(v, p)) continue\n break\n case 'interceptors':\n if (sameItems(v, p)) continue\n break\n case 'data':\n // Two empty arrays hold nothing to ingest (e.g. an inline `data: []` with a fetcher).\n if (isEmpty(v) && sameItems(v, p)) continue\n if (selfCaused) {\n if (inst.selfData || sameRows(v, p)) continue\n inst.selfData = true\n }\n break\n case 'columns':\n if (selfCaused && sameShape(v, p)) continue\n break\n case 'rowKey':\n if (selfCaused && typeof v === 'function' && typeof p === 'function') continue\n break\n }\n partial ??= {}\n partial[k] = forward\n }\n if (partial === undefined) return\n inst.syncing = true\n try {\n inst.table.setOptions(partial)\n } finally {\n inst.syncing = false\n }\n const synced = { ...prev }\n for (const k of Object.keys(partial)) synced[k] = options[k]\n inst.synced = synced\n}\n\n/** Delivers the `onDiagnostic` calls queued while rendering. */\nfunction deliver(inst: Instance) {\n const queue = inst.queue\n if (queue === undefined) return\n inst.queue = undefined\n const sink = inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined\n for (const d of queue) {\n try {\n sink?.(d)\n } catch (e) {\n // Like a failing sink in the hub: the logger never breaks the table.\n console.error('[DataKable] onDiagnostic threw', e)\n }\n }\n}\n\n// --- comparisons ---------------------------------------------------------------------------------\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/** Controlled slices: the same defined slices, each `Object.is`-equal. */\nfunction sameSlices(a: unknown, b: unknown): boolean {\n if (!isObject(a) || !isObject(b)) return false\n const defined = (o: Record<string, unknown>) => Object.keys(o).filter((k) => o[k] !== undefined)\n const keys = defined(a)\n if (keys.length !== defined(b).length) return false\n for (const k of keys) if (!Object.is(a[k], b[k])) return false\n return true\n}\n\nconst isEmpty = (v: unknown) => Array.isArray(v) && v.length === 0\n\n/** Two arrays with the same items (by reference). */\nfunction sameItems(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false\n return true\n}\n\n/**\n * Two arrays of equal rows: each pair the same reference, or objects with the same own keys and\n * `Object.is`-equal values (`data: rows.map((r) => ({ ...r }))` recomputed in a re-render).\n */\nfunction sameRows(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) if (!Object.hasOwn(y, k) || !Object.is(x[k], y[k])) return false\n }\n return true\n}\n\nconst loose = (v: unknown) => typeof v === 'function' || isObject(v)\n\n/**\n * Column arrays of the same shape: same length, same keys per column and equal primitive values;\n * functions and nested objects (`format`, `cell`, `filter`, …) may be new references.\n */\nfunction sameShape(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) {\n if (!Object.hasOwn(y, k)) return false\n const vx = x[k]\n const vy = y[k]\n if (Object.is(vx, vy)) continue\n if (!(loose(vx) && loose(vy) && typeof vx === typeof vy)) return false\n }\n }\n return true\n}\n\n// --- dev: DK_UNSTABLE_COLUMNS / DK_UNSTABLE_OPTION -----------------------------------------------\n\n/** The first function option of a feature that is a new reference: `features[i].<option>`. */\nfunction changedFeatureOption(a: unknown, b: unknown): string | undefined {\n if (!Array.isArray(a) || !Array.isArray(b) || a === b) return undefined\n for (let i = 0; i < a.length; i++) {\n const f = a[i] as AnyFeature | undefined\n const g = b[i] as AnyFeature | undefined\n if (!f || !g || f === g || f.name !== g.name) continue\n if (!isOptionsDefinition(f.options) || !isOptionsDefinition(g.options)) continue\n const fv = f.options.values\n const gv = g.options.values\n if (!fv || !gv) continue\n for (const k of Object.keys(fv)) {\n if (typeof fv[k] === 'function' && fv[k] !== gv[k]) return `features[${i}].${k}`\n }\n }\n return undefined\n}\n\n/** Counts renders in a row that pass a new reference for the same thing; reports each once. */\nfunction checkUnstable(inst: Instance, options: Options) {\n const seen = inst.seen\n inst.seen = options\n const changed = (k: string) => !Object.is(options[k], seen[k])\n const fn = (k: string) =>\n changed(k) && typeof options[k] === 'function' && typeof seen[k] === 'function'\n track(inst, 'columns', changed('columns') && sameShape(options.columns, seen.columns))\n track(inst, 'data', changed('data') && sameRows(options.data, seen.data))\n track(inst, 'fetcher', fn('fetcher'))\n track(inst, 'rowKey', fn('rowKey'))\n const option = changedFeatureOption(options.features, seen.features)\n track(inst, 'features', option !== undefined, option)\n}\n\nfunction track(inst: Instance, key: string, unstable: boolean, option = key) {\n const n = unstable ? (inst.unstable.get(key) ?? 0) + 1 : 0\n inst.unstable.set(key, n)\n if (n < UNSTABLE_AFTER || inst.warned.has(key)) return\n inst.warned.add(key)\n if (key === 'columns') emitTableDiagnostic(inst.table, 'DK_UNSTABLE_COLUMNS', { renders: n })\n else emitTableDiagnostic(inst.table, 'DK_UNSTABLE_OPTION', { option, renders: n })\n}\n","{\n \"name\": \"@datakable/react\",\n \"version\": \"1.0.0\",\n \"description\": \"React bindings for DataKable — useDataTable hook and DataTable component.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/react\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"datatable\",\n \"table\",\n \"data-grid\",\n \"typescript\",\n \"type-safe\",\n \"headless\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/styles.css\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./styles.css\": \"./dist/styles.css\",\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . --profile node16 --exclude-entrypoints styles.css && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"@datakable/core\": \"workspace:^\"\n },\n \"peerDependencies\": {\n \"react\": \">=18\"\n }\n}\n"],"mappings":";;;AAAA;AAAA,EAKE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;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S,QAAQ,MAAM,KAAK,IAAI,CAAC;AACxE,QAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AACpC,QAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;AAClC,QAAM,SAAS,qBAAqB,QAAQ,UAAU,KAAK,QAAQ;AACnE,QAAM,MAAM,YAAY,WAAW,QAAW,MAAM;AACtD;AAEA,SAAS,MAAM,MAAgB,KAAa,UAAmB,SAAS,KAAK;AAC3E,QAAM,IAAI,YAAY,KAAK,SAAS,IAAI,GAAG,KAAK,KAAK,IAAI;AACzD,OAAK,SAAS,IAAI,KAAK,CAAC;AACxB,MAAI,IAAI,kBAAkB,KAAK,OAAO,IAAI,GAAG,EAAG;AAChD,OAAK,OAAO,IAAI,GAAG;AACnB,MAAI,QAAQ,UAAW,qBAAoB,KAAK,OAAO,uBAAuB,EAAE,SAAS,EAAE,CAAC;AAAA,MACvF,qBAAoB,KAAK,OAAO,sBAAsB,EAAE,QAAQ,SAAS,EAAE,CAAC;AACnF;","names":["value"]}
1
+ {"version":3,"sources":["../src/use-data-table.ts","../package.json"],"sourcesContent":["'use client'\n\nimport {\n type AnyFeature,\n type ApiOf,\n type ColumnDef,\n type CreateTableOptions,\n createDeferred,\n createTable,\n type Diagnostic,\n emitTableDiagnostic,\n type InvalidRowsMode,\n isOptionsDefinition,\n keepDiagnostics,\n type RowModel,\n registerPackage,\n type SchemaRow,\n SERVER_SOURCE,\n startTable,\n type Table,\n type TableSchema,\n type TableState,\n type TableStateFor,\n} from '@datakable/core'\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useInsertionEffect,\n useLayoutEffect,\n useReducer,\n useRef,\n useSyncExternalStore,\n} from 'react'\nimport { version } from '../package.json'\nimport { reactDiagnostics } from './codes'\n\n// Registers the (development-only) definitions where they are emitted, so bundlers keep them.\nkeepDiagnostics(reactDiagnostics)\n\n// No @types/node here: declare just what is read.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n/** No layout effects on the server (React 18 warns about them there). */\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\n/**\n * `useDataTable` options: `createTable`'s (§3.2), with `cell` / `invalidCell` returning a\n * `ReactNode` (§10). Read once, at creation: `features`, `schema`, `invalidRows`, `initialState`,\n * `name`, `timeout`, `strict`, `diagnostics`. Every other option follows the latest render.\n */\nexport type UseDataTableOptions<\n T,\n S extends TableState = TableState,\n Sch = undefined,\n M extends InvalidRowsMode = 'drop',\n> = Omit<CreateTableOptions<T, S, Sch, M>, 'columns'> & {\n /**\n * Compared by reference (§10): a new array tells the table the columns changed. Define them\n * outside the component or memoise them (`DK_UNSTABLE_COLUMNS` in development).\n */\n columns?: readonly ColumnDef<SchemaRow<T, Sch>, ReactNode>[]\n}\n\n/**\n * What `useDataTable` returns: the table (its methods and the installed features' APIs) with the\n * `state` and `rowModel` of this render. A new object whenever the table notifies, so it can be a\n * dependency of `useMemo` / `memo` children; the same object while nothing changed.\n */\nexport type UseDataTableResult<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n In = T,\n Api = unknown,\n> = Table<T, S, M, In> &\n Api & {\n /** The state snapshot of this render (`getState()`). */\n readonly state: S\n /** The row model of this render (`getRowModel()`, §6.6): rows, counts, status. */\n readonly rowModel: RowModel<T, M>\n }\n\ntype Options = Record<string, unknown> & { features?: readonly AnyFeature[] }\ntype AnyTable = Table<unknown, TableState> & Record<string, unknown>\ntype Callback = (arg: never) => unknown\n\n/** Options forwarded through `setOptions` when they change; the rest are read once (§3.4). */\nconst SYNCED = [\n 'data',\n 'columns',\n 'rowKey',\n 'state',\n 'onStateChange',\n 'interceptors',\n 'onDiagnostic',\n 'fetcher',\n 'rowCount',\n] as const\n\n/** Given to the table as stable wrappers that call the latest prop (latest-ref). */\nconst CALLBACKS = ['onStateChange', 'onDiagnostic', 'fetcher'] as const\ntype CallbackKey = (typeof CALLBACKS)[number]\n\n/** Renders in a row with a new reference before `DK_UNSTABLE_*` is reported. */\nconst UNSTABLE_AFTER = 2\n\ninterface Instance {\n table: AnyTable\n destroyed: boolean\n mounted: boolean\n /** The options of the latest committed render (what the wrappers call). */\n latest: Options\n /** The option values the table has (user values; callbacks count by presence). */\n synced: Options\n readonly wrappers: Record<CallbackKey, Callback>\n /** `onDiagnostic` calls made while rendering, delivered after the commit. */\n queue: Diagnostic[] | undefined\n rendering: number\n /** Inside the hook's own `setOptions` call. */\n syncing: boolean\n /** That call notified: the next commit is the re-render it caused. */\n selfCaused: boolean\n /**\n * `data` was forwarded in a self-caused re-render. Rows that differ on every render (nested\n * objects, computed fields) would otherwise ingest → notify → re-render forever: the next\n * self-caused re-render keeps the data the table has.\n */\n selfData: boolean\n /** Notifications seen; part of the view cache key (a notification is never silent, §6.6). */\n version: number\n view: { table: AnyTable; version: number; value: object } | undefined\n /**\n * SSR (§7.2): the view of `table` at its creation — initial state, controlled state and data /\n * initialData, no async result (the table is created deferred). `getServerSnapshot`.\n */\n server: { table: AnyTable; value: object } | undefined\n /** React read `getServerSnapshot` on the client: this render hydrates server HTML. */\n hydrating: boolean\n // Dev: DK_UNSTABLE_* bookkeeping.\n /** The options of the previous committed render. */\n seen: Options\n unstable: Map<string, number>\n warned: Set<string>\n}\n\nlet registered = false\n\n/**\n * Binds a table to a component (§10): the table is created once per component instance and\n * destroyed on unmount; renders read it through `useSyncExternalStore` (with\n * `getServerSnapshot`), and options are synced with `table.setOptions` in a layout effect, never\n * during render.\n *\n * - `features` (and the other read-once options) are read at creation: a new inline `features`\n * array never recreates the table.\n * - `fetcher`, `onStateChange` and `onDiagnostic` may be inline functions: the table always calls\n * the latest one, and a new reference never refetches (call `refetch()` when a value the fetcher\n * reads changes).\n * - `columns`, `data` and a `rowKey` function are compared by reference: memoise them.\n * - Controlled slices (§3.2): pass `state` and `onStateChange`; changes come back through `state`.\n * - SSR (§7.2): rendering starts no async work. The fetcher's first request and a `searchFn` for an\n * initial query start after the commit (`status: 'pending'` until then; `DK_SSR_ASYNC_DEFERRED`\n * on the server), unless `initialData` already holds their result. `initialState` (e.g. parsed\n * from the URL) applies on the server: client-mode features filter / search / sort the HTML.\n * `getServerSnapshot` is the view at creation; a table that changed before the hydration commit\n * reports `DK_HYDRATION_MISMATCH`.\n *\n * `@datakable/react` installs no features by default; `datakable`'s `useDataTable` installs the\n * default preset.\n */\nexport function useDataTable<\n T,\n S extends TableState = never,\n const Fs extends readonly AnyFeature[] = [],\n const Sch extends TableSchema | undefined = undefined,\n const M extends InvalidRowsMode = 'drop',\n>(\n options: UseDataTableOptions<T, TableStateFor<S, Fs, SchemaRow<T, Sch>>, Sch, M> & {\n features?: Fs\n },\n): UseDataTableResult<\n SchemaRow<T, Sch>,\n TableStateFor<S, Fs, SchemaRow<T, Sch>>,\n M,\n [Sch] extends [TableSchema] ? unknown : T,\n ApiOf<Fs, SchemaRow<T, Sch>>\n>\nexport function useDataTable(options: Options): unknown {\n const ref = useRef<Instance | null>(null)\n // Created during the first render (React keeps the ref across the StrictMode double render),\n // deferred: its async work (fetcher, searchFn) starts in the mount effect, never on the server.\n if (ref.current === null) ref.current = createInstance(options)\n const inst = ref.current\n const table = inst.table\n const [, rerender] = useReducer((n: number) => n + 1, 0)\n\n const subscribe = useCallback(\n (onChange: () => void) => {\n // Replaced or destroyed meanwhile (`<Activity>`): nothing to subscribe to.\n if (inst.table !== table || inst.destroyed) return () => {}\n return table.subscribe(() => {\n inst.version++\n if (inst.syncing) inst.selfCaused = true\n onChange()\n })\n },\n [inst, table],\n )\n const getSnapshot = useCallback(() => snapshot(inst, table), [inst, table])\n const getServerSnapshot = useCallback(() => serverSnapshot(inst, table), [inst, table])\n const view = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n\n // Hydration commit (§7.2): before any layout effect can change the table, the snapshot React\n // hydrated with must still be the live one, else React replaces the server HTML at once.\n useInsertionEffect(() => checkHydration(inst), [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.mounted = true\n // Destroyed while hidden (`<Activity>`): a new table, from the latest options.\n if (inst.destroyed) {\n recreate(inst)\n startTable(inst.table)\n rerender()\n } else {\n // The deferred fetch / searchFn starts now; its status shows before paint.\n startTable(inst.table)\n if (snapshot(inst, inst.table) !== view) rerender()\n }\n return () => {\n inst.mounted = false\n // Deferred: the StrictMode effect re-run mounts again synchronously and keeps the table.\n queueMicrotask(() => {\n if (inst.mounted || inst.destroyed) return\n inst.destroyed = true\n inst.table.destroy()\n })\n }\n }, [inst])\n\n useIsomorphicLayoutEffect(() => {\n inst.latest = options\n const selfCaused = inst.selfCaused\n inst.selfCaused = false\n if (!inst.destroyed) sync(inst, options, selfCaused)\n deliver(inst)\n })\n\n return view\n}\n\nfunction createInstance(options: Options): Instance {\n const inst: Instance = {\n table: undefined as unknown as AnyTable,\n destroyed: false,\n mounted: false,\n latest: options,\n synced: options,\n wrappers: {\n onStateChange: (updater) => (inst.latest.onStateChange as Callback)(updater),\n onDiagnostic: (d: Diagnostic) => {\n if (inst.rendering === 0) {\n ;(inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined)?.(d)\n return\n }\n if (inst.queue === undefined) {\n inst.queue = []\n // Delivered by the next layout effect, or here when this render never commits.\n queueMicrotask(() => deliver(inst))\n }\n inst.queue.push(d)\n },\n fetcher: (params) => (inst.latest.fetcher as Callback)(params),\n },\n queue: undefined,\n rendering: 0,\n syncing: false,\n selfCaused: false,\n selfData: false,\n version: 0,\n view: undefined,\n server: undefined,\n hydrating: false,\n seen: options,\n unstable: new Map(),\n warned: new Set(),\n }\n // The version checks are development-only (§8.5): production bundles no registry.\n if (process.env.NODE_ENV !== 'production' && !registered) {\n registered = true\n registerPackage('@datakable/react', version)\n }\n build(inst, options)\n return inst\n}\n\n/**\n * The stable wrapper of callback `k`. The fetcher's also carries the server source of the user's\n * `withFetcher` fetcher (§7.1), which is what makes the table load through it.\n */\nfunction wrapper(inst: Instance, k: CallbackKey, v: unknown): Callback {\n const w = inst.wrappers[k]\n if (k === 'fetcher') {\n ;(w as unknown as Record<symbol, unknown>)[SERVER_SOURCE] = (v as Record<symbol, unknown>)[\n SERVER_SOURCE\n ]\n }\n return w\n}\n\nfunction build(inst: Instance, options: Options) {\n const init: Options = { ...options }\n for (const k of CALLBACKS) {\n if (typeof options[k] === 'function') init[k] = wrapper(inst, k, options[k])\n }\n inst.rendering++\n try {\n // Deferred (§7.2): rendering starts no fetch / searchFn (none at all on the server, where\n // effects never run); the mount effect starts it.\n inst.table = createDeferred(() => createTable(init as never)) as unknown as AnyTable\n } finally {\n inst.rendering--\n }\n inst.synced = options\n inst.seen = options\n inst.view = undefined\n inst.server = undefined\n}\n\nfunction recreate(inst: Instance) {\n build(inst, inst.latest)\n inst.destroyed = false\n}\n\n/** The view of the table's snapshot, cached on (table, state, row model, notifications). */\nfunction snapshot(inst: Instance, table: AnyTable): object {\n inst.rendering++\n try {\n const state = table.getState()\n const rowModel = table.getRowModel()\n const v = inst.view\n if (v && v.table === table && v.version === inst.version) {\n const value = v.value as { state: unknown; rowModel: unknown }\n if (value.state === state && value.rowModel === rowModel) return value\n }\n const value = Object.create(table, {\n state: { value: state, enumerable: true },\n rowModel: { value: rowModel, enumerable: true },\n }) as object\n inst.view = { table, version: inst.version, value }\n return value\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * `getServerSnapshot` (§7.2): the view of the table at its creation. React reads it on the server\n * and while hydrating, so both render the same snapshot; async work never ran in it.\n */\nfunction serverSnapshot(inst: Instance, table: AnyTable): object {\n if (inst.table !== table) return snapshot(inst, table)\n // On the client React reads it only to hydrate.\n if (typeof window !== 'undefined') inst.hydrating = true\n const s = inst.server\n if (s && s.table === table) return s.value\n const value = snapshot(inst, table)\n inst.server = { table, value }\n return value\n}\n\n/** `DK_HYDRATION_MISMATCH`: what differs between the hydrated (server) view and the live one. */\nfunction checkHydration(inst: Instance) {\n if (!inst.hydrating) return\n inst.hydrating = false\n const server = inst.server\n if (!server || server.table !== inst.table) return\n const live = snapshot(inst, inst.table) as { state: TableState; rowModel: unknown }\n const hydrated = server.value as { state: TableState; rowModel: unknown }\n if (live === hydrated) return\n const slices: string[] = []\n for (const k of new Set([...Object.keys(hydrated.state), ...Object.keys(live.state)])) {\n if (!Object.is(hydrated.state[k], live.state[k])) slices.push(k)\n }\n if (slices.length === 0) {\n if (live.rowModel === hydrated.rowModel) return\n slices.push('rows')\n }\n // Delivered to onDiagnostic by the layout effect (no update during the commit).\n inst.rendering++\n try {\n emitTableDiagnostic(\n inst.table,\n 'DK_HYDRATION_MISMATCH',\n { slices },\n { trigger: 'hydrate', phase: 'hydrate' },\n )\n } finally {\n inst.rendering--\n }\n}\n\n/**\n * Forwards the changed options with one `setOptions` call. In the re-render caused by that call,\n * values recomputed from the same inputs (same-shape `columns`, `data` with equal rows, a `rowKey`\n * function) are not forwarded again: an inline `columns` / `data` would otherwise loop. A `data`\n * that still differs is forwarded at most once per chain of self-caused re-renders, so rows that\n * are new on every render (`data: [{ … }]` with nested objects) re-ingest but never hang.\n */\nfunction sync(inst: Instance, options: Options, selfCaused: boolean) {\n // Written out (not a module-level flag) so bundlers fold it while parsing (§8.2).\n if (process.env.NODE_ENV !== 'production') checkUnstable(inst, options)\n const prev = inst.synced\n if (!selfCaused) inst.selfData = false\n let partial: Record<string, unknown> | undefined\n for (const k of SYNCED) {\n const v = options[k]\n const p = prev[k]\n if (Object.is(v, p)) continue\n let forward: unknown = v\n switch (k) {\n case 'onStateChange':\n case 'onDiagnostic':\n case 'fetcher': {\n const on = typeof v === 'function'\n if (on === (typeof p === 'function')) continue\n forward = on ? wrapper(inst, k, v) : undefined\n break\n }\n case 'state':\n if (sameSlices(v, p)) continue\n break\n case 'interceptors':\n if (sameItems(v, p)) continue\n break\n case 'data':\n // Two empty arrays hold nothing to ingest (e.g. an inline `data: []` with a fetcher).\n if (isEmpty(v) && sameItems(v, p)) continue\n if (selfCaused) {\n if (inst.selfData || sameRows(v, p)) continue\n inst.selfData = true\n }\n break\n case 'columns':\n if (selfCaused && sameShape(v, p)) continue\n break\n case 'rowKey':\n if (selfCaused && typeof v === 'function' && typeof p === 'function') continue\n break\n }\n partial ??= {}\n partial[k] = forward\n }\n if (partial === undefined) return\n inst.syncing = true\n try {\n inst.table.setOptions(partial)\n } finally {\n inst.syncing = false\n }\n const synced = { ...prev }\n for (const k of Object.keys(partial)) synced[k] = options[k]\n inst.synced = synced\n}\n\n/** Delivers the `onDiagnostic` calls queued while rendering. */\nfunction deliver(inst: Instance) {\n const queue = inst.queue\n if (queue === undefined) return\n inst.queue = undefined\n const sink = inst.latest.onDiagnostic as ((d: Diagnostic) => void) | undefined\n for (const d of queue) {\n try {\n sink?.(d)\n } catch (e) {\n // Like a failing sink in the hub: the logger never breaks the table.\n console.error('[DataKable] onDiagnostic threw', e)\n }\n }\n}\n\n// --- comparisons ---------------------------------------------------------------------------------\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/** Controlled slices: the same defined slices, each `Object.is`-equal. */\nfunction sameSlices(a: unknown, b: unknown): boolean {\n if (!isObject(a) || !isObject(b)) return false\n const defined = (o: Record<string, unknown>) => Object.keys(o).filter((k) => o[k] !== undefined)\n const keys = defined(a)\n if (keys.length !== defined(b).length) return false\n for (const k of keys) if (!Object.is(a[k], b[k])) return false\n return true\n}\n\nconst isEmpty = (v: unknown) => Array.isArray(v) && v.length === 0\n\n/** Two arrays with the same items (by reference). */\nfunction sameItems(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false\n return true\n}\n\n/**\n * Two arrays of equal rows: each pair the same reference, or objects with the same own keys and\n * `Object.is`-equal values (`data: rows.map((r) => ({ ...r }))` recomputed in a re-render).\n */\nfunction sameRows(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) if (!Object.hasOwn(y, k) || !Object.is(x[k], y[k])) return false\n }\n return true\n}\n\nconst loose = (v: unknown) => typeof v === 'function' || isObject(v)\n\n/**\n * Column arrays of the same shape: same length, same keys per column and equal primitive values;\n * functions and nested objects (`format`, `cell`, `filter`, …) may be new references.\n */\nfunction sameShape(a: unknown, b: unknown): boolean {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n const x: unknown = a[i]\n const y: unknown = b[i]\n if (Object.is(x, y)) continue\n if (!isObject(x) || !isObject(y)) return false\n const keys = Object.keys(x)\n if (keys.length !== Object.keys(y).length) return false\n for (const k of keys) {\n if (!Object.hasOwn(y, k)) return false\n const vx = x[k]\n const vy = y[k]\n if (Object.is(vx, vy)) continue\n if (!(loose(vx) && loose(vy) && typeof vx === typeof vy)) return false\n }\n }\n return true\n}\n\n// --- dev: DK_UNSTABLE_COLUMNS / DK_UNSTABLE_OPTION -----------------------------------------------\n\n/** The first function option of a feature that is a new reference: `features[i].<option>`. */\nfunction changedFeatureOption(a: unknown, b: unknown): string | undefined {\n if (!Array.isArray(a) || !Array.isArray(b) || a === b) return undefined\n for (let i = 0; i < a.length; i++) {\n const f = a[i] as AnyFeature | undefined\n const g = b[i] as AnyFeature | undefined\n if (!f || !g || f === g || f.name !== g.name) continue\n if (!isOptionsDefinition(f.options) || !isOptionsDefinition(g.options)) continue\n const fv = f.options.values\n const gv = g.options.values\n if (!fv || !gv) continue\n for (const k of Object.keys(fv)) {\n if (typeof fv[k] === 'function' && fv[k] !== gv[k]) return `features[${i}].${k}`\n }\n }\n return undefined\n}\n\n/** Counts renders in a row that pass a new reference for the same thing; reports each once. */\nfunction checkUnstable(inst: Instance, options: Options) {\n const seen = inst.seen\n inst.seen = options\n const changed = (k: string) => !Object.is(options[k], seen[k])\n const fn = (k: string) =>\n changed(k) && typeof options[k] === 'function' && typeof seen[k] === 'function'\n track(inst, 'columns', changed('columns') && sameShape(options.columns, seen.columns))\n track(inst, 'data', changed('data') && sameRows(options.data, seen.data))\n track(inst, 'fetcher', fn('fetcher'))\n track(inst, 'rowKey', fn('rowKey'))\n const option = changedFeatureOption(options.features, seen.features)\n track(inst, 'features', option !== undefined, option)\n}\n\nfunction track(inst: Instance, key: string, unstable: boolean, option = key) {\n const n = unstable ? (inst.unstable.get(key) ?? 0) + 1 : 0\n inst.unstable.set(key, n)\n if (n < UNSTABLE_AFTER || inst.warned.has(key)) return\n inst.warned.add(key)\n if (key === 'columns') emitTableDiagnostic(inst.table, 'DK_UNSTABLE_COLUMNS', { renders: n })\n else emitTableDiagnostic(inst.table, 'DK_UNSTABLE_OPTION', { option, renders: n })\n}\n","{\n \"name\": \"@datakable/react\",\n \"version\": \"1.0.1\",\n \"description\": \"React bindings for DataKable — useDataTable hook and DataTable component.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/react\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"datatable\",\n \"table\",\n \"data-grid\",\n \"typescript\",\n \"type-safe\",\n \"headless\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/styles.css\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./styles.css\": \"./dist/styles.css\",\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . --profile node16 --exclude-entrypoints styles.css && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"@datakable/core\": \"workspace:^\"\n },\n \"peerDependencies\": {\n \"react\": \">=18\"\n }\n}\n"],"mappings":";;;AAEA;AAAA,EAKE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,OAKK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;AC/BL,cAAW;;;ADiCb,SAAS,wBAAwB;AAGjC,gBAAgB,gBAAgB;AAMhC,IAAM,4BAA4B,OAAO,WAAW,cAAc,YAAY;AA4C9E,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGA,IAAM,YAAY,CAAC,iBAAiB,gBAAgB,SAAS;AAI7D,IAAM,iBAAiB;AAyCvB,IAAI,aAAa;AA0CV,SAAS,aAAa,SAA2B;AACtD,QAAM,MAAM,OAAwB,IAAI;AAGxC,MAAI,IAAI,YAAY,KAAM,KAAI,UAAU,eAAe,OAAO;AAC9D,QAAM,OAAO,IAAI;AACjB,QAAM,QAAQ,KAAK;AACnB,QAAM,CAAC,EAAE,QAAQ,IAAI,WAAW,CAAC,MAAc,IAAI,GAAG,CAAC;AAEvD,QAAM,YAAY;AAAA,IAChB,CAAC,aAAyB;AAExB,UAAI,KAAK,UAAU,SAAS,KAAK,UAAW,QAAO,MAAM;AAAA,MAAC;AAC1D,aAAO,MAAM,UAAU,MAAM;AAC3B,aAAK;AACL,YAAI,KAAK,QAAS,MAAK,aAAa;AACpC,iBAAS;AAAA,MACX,CAAC;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AAO,KAAK;AAClB,OAAK,OAAO;AACZ,QAAM,UAAU,CAAC,MAAc,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC;AAC7D,QAAM,KAAK,CAAC,MACV,QAAQ,CAAC,KAAK,OAAO,QAAQ,CAAC,MAAM,cAAc,OAAO,KAAK,CAAC,MAAM;AACvE,QAAM,MAAM,WAAW,QAAQ,SAAS,KAAK,UAAU,QAAQ,SAAS,KAAK,OAAO,CAAC;AACrF,QAAM,MAAM,QAAQ,QAAQ,MAAM,KAAK,SAAS,QAAQ,MAAM,KAAK,IAAI,CAAC;AACxE,QAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AACpC,QAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;AAClC,QAAM,SAAS,qBAAqB,QAAQ,UAAU,KAAK,QAAQ;AACnE,QAAM,MAAM,YAAY,WAAW,QAAW,MAAM;AACtD;AAEA,SAAS,MAAM,MAAgB,KAAa,UAAmB,SAAS,KAAK;AAC3E,QAAM,IAAI,YAAY,KAAK,SAAS,IAAI,GAAG,KAAK,KAAK,IAAI;AACzD,OAAK,SAAS,IAAI,KAAK,CAAC;AACxB,MAAI,IAAI,kBAAkB,KAAK,OAAO,IAAI,GAAG,EAAG;AAChD,OAAK,OAAO,IAAI,GAAG;AACnB,MAAI,QAAQ,UAAW,qBAAoB,KAAK,OAAO,uBAAuB,EAAE,SAAS,EAAE,CAAC;AAAA,MACvF,qBAAoB,KAAK,OAAO,sBAAsB,EAAE,QAAQ,SAAS,EAAE,CAAC;AACnF;","names":["value"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datakable/react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "React bindings for DataKable — useDataTable hook and DataTable component.",
5
5
  "license": "MIT",
6
6
  "author": "Supakit Kitjanabumrungsak",
@@ -45,7 +45,7 @@
45
45
  "dist"
46
46
  ],
47
47
  "dependencies": {
48
- "@datakable/core": "^1.0.0"
48
+ "@datakable/core": "^1.0.1"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": ">=18"