@simple-table/react 3.0.0-beta.10 → 3.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("simple-table-core"),n=require("react-dom/client"),o=require("react-dom");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}function i(r){return t=>{const d=document.createElement("div"),c=n.createRoot(d);return o.flushSync(()=>{c.render(e.jsx(r,Object.assign({},t)))}),d}}function a(r){const t=document.createElement("div"),d=n.createRoot(t);return o.flushSync(()=>{d.render(e.jsx(e.Fragment,{children:r}))}),t}function l(e){return"function"==typeof e}function u(e){const{cellRenderer:r,headerRenderer:t,children:n,nestedTable:o}=e,d=c(e,["cellRenderer","headerRenderer","children","nestedTable"]),a=Object.assign({},d);if(r&&(a.cellRenderer=i(r)),t&&(a.headerRenderer=i(t)),n&&(a.children=n.map(u)),o){const e=Object.assign(Object.assign({},o),{rows:[]});a.nestedTable=s(e)}return a}function s(e){const{defaultHeaders:r,footerRenderer:t,emptyStateRenderer:n,errorStateRenderer:o,loadingStateRenderer:d,tableEmptyStateRenderer:s,headerDropdown:f,columnEditorConfig:p,icons:R}=e,m=c(e,["defaultHeaders","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons"]),b=Object.assign(Object.assign({},m),{defaultHeaders:r.map(u)});if(void 0!==t&&(b.footerRenderer=i(t)),void 0!==n)if(l(n))b.emptyStateRenderer=i(n);else{const e=n;b.emptyStateRenderer=()=>a(e)}if(void 0!==o)if(l(o))b.errorStateRenderer=i(o);else{const e=o;b.errorStateRenderer=()=>a(e)}if(void 0!==d)if(l(d))b.loadingStateRenderer=i(d);else{const e=d;b.loadingStateRenderer=()=>a(e)}return void 0!==s&&(b.tableEmptyStateRenderer=null===s?null:a(s)),void 0!==f&&(b.headerDropdown=i(f)),void 0!==p&&(b.columnEditorConfig=function(e){const{rowRenderer:r}=e,t=c(e,["rowRenderer"]);return Object.assign(Object.assign({},t),r?{rowRenderer:i(r)}:{})}(p)),void 0!==R&&(b.icons=function(e){const r={};for(const[t,n]of Object.entries(e))null!=n&&(r[t]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGElement?n:a(n));return r}(R)),b}"function"==typeof SuppressedError&&SuppressedError;const f=d(r).default.forwardRef(function(n,o){const d=r.useRef(null),c=r.useRef(null),i=n;return r.useEffect(()=>{if(!d.current)return;const e=new t.SimpleTableVanilla(d.current,s(i));if(e.mount(),c.current=e,o){const r=e.getAPI();"function"==typeof o?o(r):o.current=r}return()=>{e.destroy(),c.current=null,o&&"function"!=typeof o&&(o.current=null)}},[]),r.useEffect(()=>{var e;null===(e=c.current)||void 0===e||e.update(s(i))}),e.jsx("div",{ref:d})});f.displayName="SimpleTable",exports.SimpleTable=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");exports.SimpleTable=()=>e.jsx("div",{children:"hello"});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,3 @@
1
- import React from "react";
2
- import type { TableAPI } from "simple-table-core";
3
- import type { SimpleTableReactProps } from "./types";
4
1
  /**
5
2
  * SimpleTable — React adapter for simple-table-core.
6
3
  *
@@ -23,5 +20,5 @@ import type { SimpleTableReactProps } from "./types";
23
20
  * footerRenderer={MyFooter}
24
21
  * />
25
22
  */
26
- declare const SimpleTable: React.ForwardRefExoticComponent<SimpleTableReactProps & React.RefAttributes<TableAPI>>;
23
+ declare const SimpleTable: () => import("react/jsx-runtime").JSX.Element;
27
24
  export default SimpleTable;
@@ -9,14 +9,16 @@ import React from "react";
9
9
  export declare function wrapReactRenderer<P extends object>(Component: React.ComponentType<P>): (props: P) => HTMLElement;
10
10
  /**
11
11
  * Renders a static ReactNode into an HTMLElement.
12
- * Used for static ReactNode props (tableEmptyStateRenderer) and icon props where
13
- * the vanilla table accepts string | HTMLElement | SVGSVGElement.
14
- *
15
- * Note: react-dom/server (renderToStaticMarkup) is intentionally NOT used here.
16
- * A static top-level import of react-dom/server causes Turbopack to throw during
17
- * client bundle evaluation, making the entire @simple-table/react module fail and
18
- * SimpleTable export as undefined.
12
+ * Used for props like tableEmptyStateRenderer that are not called with arguments.
19
13
  */
20
14
  export declare function wrapReactNode(node: React.ReactNode): HTMLElement;
15
+ /**
16
+ * Converts a ReactNode to an HTML string using server-side static rendering.
17
+ * Used for icon props where the vanilla table expects a string | HTMLElement | SVGSVGElement.
18
+ * Uses renderToStaticMarkup so it works synchronously from any context — including
19
+ * inside a useEffect — unlike createRoot + flushSync which silently produces empty
20
+ * output when called during React 18's passive effects phase.
21
+ */
22
+ export declare function reactNodeToHtmlString(node: React.ReactNode): string;
21
23
  /** Returns true if the value is a React component (function or class). */
22
24
  export declare function isReactComponent(value: unknown): value is React.ComponentType<any>;
package/dist/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,Fragment as r}from"react/jsx-runtime";import t,{useRef as n,useEffect as o}from"react";import{SimpleTableVanilla as d}from"simple-table-core";import{createRoot as i}from"react-dom/client";import{flushSync as c}from"react-dom";function a(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}function l(r){return t=>{const n=document.createElement("div"),o=i(n);return c(()=>{o.render(e(r,Object.assign({},t)))}),n}}function s(t){const n=document.createElement("div"),o=i(n);return c(()=>{o.render(e(r,{children:t}))}),n}function u(e){return"function"==typeof e}function f(e){const{cellRenderer:r,headerRenderer:t,children:n,nestedTable:o}=e,d=a(e,["cellRenderer","headerRenderer","children","nestedTable"]),i=Object.assign({},d);if(r&&(i.cellRenderer=l(r)),t&&(i.headerRenderer=l(t)),n&&(i.children=n.map(f)),o){const e=Object.assign(Object.assign({},o),{rows:[]});i.nestedTable=p(e)}return i}function p(e){const{defaultHeaders:r,footerRenderer:t,emptyStateRenderer:n,errorStateRenderer:o,loadingStateRenderer:d,tableEmptyStateRenderer:i,headerDropdown:c,columnEditorConfig:p,icons:m}=e,R=a(e,["defaultHeaders","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons"]),b=Object.assign(Object.assign({},R),{defaultHeaders:r.map(f)});if(void 0!==t&&(b.footerRenderer=l(t)),void 0!==n)if(u(n))b.emptyStateRenderer=l(n);else{const e=n;b.emptyStateRenderer=()=>s(e)}if(void 0!==o)if(u(o))b.errorStateRenderer=l(o);else{const e=o;b.errorStateRenderer=()=>s(e)}if(void 0!==d)if(u(d))b.loadingStateRenderer=l(d);else{const e=d;b.loadingStateRenderer=()=>s(e)}return void 0!==i&&(b.tableEmptyStateRenderer=null===i?null:s(i)),void 0!==c&&(b.headerDropdown=l(c)),void 0!==p&&(b.columnEditorConfig=function(e){const{rowRenderer:r}=e,t=a(e,["rowRenderer"]);return Object.assign(Object.assign({},t),r?{rowRenderer:l(r)}:{})}(p)),void 0!==m&&(b.icons=function(e){const r={};for(const[t,n]of Object.entries(e))null!=n&&(r[t]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGElement?n:s(n));return r}(m)),b}"function"==typeof SuppressedError&&SuppressedError;const m=t.forwardRef(function(r,t){const i=n(null),c=n(null),a=r;return o(()=>{if(!i.current)return;const e=new d(i.current,p(a));if(e.mount(),c.current=e,t){const r=e.getAPI();"function"==typeof t?t(r):t.current=r}return()=>{e.destroy(),c.current=null,t&&"function"!=typeof t&&(t.current=null)}},[]),o(()=>{var e;null===(e=c.current)||void 0===e||e.update(p(a))}),e("div",{ref:i})});m.displayName="SimpleTable";export{m as SimpleTable};
1
+ import{jsx as r}from"react/jsx-runtime";const e=()=>r("div",{children:"hello"});export{e as SimpleTable};
2
2
  //# sourceMappingURL=index.es.js.map
@@ -1,6 +1,3 @@
1
- import React from "react";
2
- import type { TableAPI } from "simple-table-core";
3
- import type { SimpleTableReactProps } from "./types";
4
1
  /**
5
2
  * SimpleTable — React adapter for simple-table-core.
6
3
  *
@@ -23,5 +20,5 @@ import type { SimpleTableReactProps } from "./types";
23
20
  * footerRenderer={MyFooter}
24
21
  * />
25
22
  */
26
- declare const SimpleTable: React.ForwardRefExoticComponent<SimpleTableReactProps & React.RefAttributes<TableAPI>>;
23
+ declare const SimpleTable: () => import("react/jsx-runtime").JSX.Element;
27
24
  export default SimpleTable;
@@ -9,14 +9,16 @@ import React from "react";
9
9
  export declare function wrapReactRenderer<P extends object>(Component: React.ComponentType<P>): (props: P) => HTMLElement;
10
10
  /**
11
11
  * Renders a static ReactNode into an HTMLElement.
12
- * Used for static ReactNode props (tableEmptyStateRenderer) and icon props where
13
- * the vanilla table accepts string | HTMLElement | SVGSVGElement.
14
- *
15
- * Note: react-dom/server (renderToStaticMarkup) is intentionally NOT used here.
16
- * A static top-level import of react-dom/server causes Turbopack to throw during
17
- * client bundle evaluation, making the entire @simple-table/react module fail and
18
- * SimpleTable export as undefined.
12
+ * Used for props like tableEmptyStateRenderer that are not called with arguments.
19
13
  */
20
14
  export declare function wrapReactNode(node: React.ReactNode): HTMLElement;
15
+ /**
16
+ * Converts a ReactNode to an HTML string using server-side static rendering.
17
+ * Used for icon props where the vanilla table expects a string | HTMLElement | SVGSVGElement.
18
+ * Uses renderToStaticMarkup so it works synchronously from any context — including
19
+ * inside a useEffect — unlike createRoot + flushSync which silently produces empty
20
+ * output when called during React 18's passive effects phase.
21
+ */
22
+ export declare function reactNodeToHtmlString(node: React.ReactNode): string;
21
23
  /** Returns true if the value is a React component (function or class). */
22
24
  export declare function isReactComponent(value: unknown): value is React.ComponentType<any>;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@simple-table/react",
3
- "version": "3.0.0-beta.10",
3
+ "version": "3.0.0-beta.11",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.es.js",
6
- "types": "dist/index.d.ts",
6
+ "types": "dist/types/index.d.ts",
7
7
  "sideEffects": false,
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/index.es.js",
11
11
  "require": "./dist/cjs/index.js",
12
- "types": "./dist/index.d.ts"
12
+ "types": "./dist/types/index.d.ts"
13
13
  }
14
14
  },
15
15
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "react-dom": ">=18.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "simple-table-core": "3.0.0-beta.10"
28
+ "simple-table-core": "3.0.0-beta.11"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@rollup/plugin-alias": "^4.0.4",
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }