@tanstack/svelte-table 8.0.0-alpha.76 → 8.0.0-alpha.77

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.
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
2669
2669
  </script>
2670
2670
  <script>
2671
2671
  /*<!--*/
2672
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"e2ab-163"},{"name":"svelte-table/src","children":[{"uid":"e2ab-165","name":"placeholder.svelte"},{"uid":"e2ab-167","name":"render-component.ts"},{"uid":"e2ab-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"e2ab-163":{"renderedLength":139597,"gzipLength":23873,"brotliLength":0,"mainUid":"e2ab-162"},"e2ab-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"e2ab-164"},"e2ab-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"e2ab-166"},"e2ab-169":{"renderedLength":1958,"gzipLength":709,"brotliLength":0,"mainUid":"e2ab-168"}},"nodeMetas":{"e2ab-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"e2ab-163"},"imported":[],"importedBy":[{"uid":"e2ab-168"}]},"e2ab-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"e2ab-165"},"imported":[{"uid":"e2ab-171"}],"importedBy":[{"uid":"e2ab-168"}]},"e2ab-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"e2ab-167"},"imported":[{"uid":"e2ab-171"}],"importedBy":[{"uid":"e2ab-168"}]},"e2ab-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"e2ab-169"},"imported":[{"uid":"e2ab-162"},{"uid":"e2ab-164"},{"uid":"e2ab-170"},{"uid":"e2ab-166"}],"importedBy":[],"isEntry":true},"e2ab-170":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"e2ab-168"}],"isExternal":true},"e2ab-171":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"e2ab-164"},{"uid":"e2ab-166"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
2672
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"8982-163"},{"name":"svelte-table/src","children":[{"uid":"8982-165","name":"placeholder.svelte"},{"uid":"8982-167","name":"render-component.ts"},{"uid":"8982-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"8982-163":{"renderedLength":139597,"gzipLength":23873,"brotliLength":0,"mainUid":"8982-162"},"8982-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"8982-164"},"8982-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"8982-166"},"8982-169":{"renderedLength":2729,"gzipLength":868,"brotliLength":0,"mainUid":"8982-168"}},"nodeMetas":{"8982-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"8982-163"},"imported":[],"importedBy":[{"uid":"8982-168"}]},"8982-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"8982-165"},"imported":[{"uid":"8982-170"}],"importedBy":[{"uid":"8982-168"}]},"8982-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"8982-167"},"imported":[{"uid":"8982-170"}],"importedBy":[{"uid":"8982-168"}]},"8982-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"8982-169"},"imported":[{"uid":"8982-162"},{"uid":"8982-164"},{"uid":"8982-170"},{"uid":"8982-171"},{"uid":"8982-166"}],"importedBy":[],"isEntry":true},"8982-170":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"8982-168"},{"uid":"8982-164"},{"uid":"8982-166"}],"isExternal":true},"8982-171":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"8982-168"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
2673
2673
 
2674
2674
  const run = () => {
2675
2675
  const width = window.innerWidth;
@@ -11,21 +11,21 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "e2ab-173"
14
+ "uid": "8982-173"
15
15
  },
16
16
  {
17
17
  "name": "svelte-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "e2ab-175",
20
+ "uid": "8982-175",
21
21
  "name": "placeholder.svelte"
22
22
  },
23
23
  {
24
- "uid": "e2ab-177",
24
+ "uid": "8982-177",
25
25
  "name": "render-component.ts"
26
26
  },
27
27
  {
28
- "uid": "e2ab-179",
28
+ "uid": "8982-179",
29
29
  "name": "index.ts"
30
30
  }
31
31
  ]
@@ -38,119 +38,125 @@
38
38
  "isRoot": true
39
39
  },
40
40
  "nodeParts": {
41
- "e2ab-173": {
41
+ "8982-173": {
42
42
  "renderedLength": 139597,
43
43
  "gzipLength": 23873,
44
44
  "brotliLength": 0,
45
- "mainUid": "e2ab-172"
45
+ "mainUid": "8982-172"
46
46
  },
47
- "e2ab-175": {
47
+ "8982-175": {
48
48
  "renderedLength": 925,
49
49
  "gzipLength": 444,
50
50
  "brotliLength": 0,
51
- "mainUid": "e2ab-174"
51
+ "mainUid": "8982-174"
52
52
  },
53
- "e2ab-177": {
53
+ "8982-177": {
54
54
  "renderedLength": 1365,
55
55
  "gzipLength": 519,
56
56
  "brotliLength": 0,
57
- "mainUid": "e2ab-176"
57
+ "mainUid": "8982-176"
58
58
  },
59
- "e2ab-179": {
60
- "renderedLength": 1958,
61
- "gzipLength": 709,
59
+ "8982-179": {
60
+ "renderedLength": 2729,
61
+ "gzipLength": 868,
62
62
  "brotliLength": 0,
63
- "mainUid": "e2ab-178"
63
+ "mainUid": "8982-178"
64
64
  }
65
65
  },
66
66
  "nodeMetas": {
67
- "e2ab-172": {
67
+ "8982-172": {
68
68
  "id": "/packages/table-core/build/esm/index.js",
69
69
  "moduleParts": {
70
- "index.production.js": "e2ab-173"
70
+ "index.production.js": "8982-173"
71
71
  },
72
72
  "imported": [],
73
73
  "importedBy": [
74
74
  {
75
- "uid": "e2ab-178"
75
+ "uid": "8982-178"
76
76
  }
77
77
  ]
78
78
  },
79
- "e2ab-174": {
79
+ "8982-174": {
80
80
  "id": "/packages/svelte-table/src/placeholder.svelte",
81
81
  "moduleParts": {
82
- "index.production.js": "e2ab-175"
82
+ "index.production.js": "8982-175"
83
83
  },
84
84
  "imported": [
85
85
  {
86
- "uid": "e2ab-181"
86
+ "uid": "8982-180"
87
87
  }
88
88
  ],
89
89
  "importedBy": [
90
90
  {
91
- "uid": "e2ab-178"
91
+ "uid": "8982-178"
92
92
  }
93
93
  ]
94
94
  },
95
- "e2ab-176": {
95
+ "8982-176": {
96
96
  "id": "/packages/svelte-table/src/render-component.ts",
97
97
  "moduleParts": {
98
- "index.production.js": "e2ab-177"
98
+ "index.production.js": "8982-177"
99
99
  },
100
100
  "imported": [
101
101
  {
102
- "uid": "e2ab-181"
102
+ "uid": "8982-180"
103
103
  }
104
104
  ],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "e2ab-178"
107
+ "uid": "8982-178"
108
108
  }
109
109
  ]
110
110
  },
111
- "e2ab-178": {
111
+ "8982-178": {
112
112
  "id": "/packages/svelte-table/src/index.ts",
113
113
  "moduleParts": {
114
- "index.production.js": "e2ab-179"
114
+ "index.production.js": "8982-179"
115
115
  },
116
116
  "imported": [
117
117
  {
118
- "uid": "e2ab-172"
118
+ "uid": "8982-172"
119
119
  },
120
120
  {
121
- "uid": "e2ab-174"
121
+ "uid": "8982-174"
122
122
  },
123
123
  {
124
- "uid": "e2ab-180"
124
+ "uid": "8982-180"
125
125
  },
126
126
  {
127
- "uid": "e2ab-176"
127
+ "uid": "8982-181"
128
+ },
129
+ {
130
+ "uid": "8982-176"
128
131
  }
129
132
  ],
130
133
  "importedBy": [],
131
134
  "isEntry": true
132
135
  },
133
- "e2ab-180": {
134
- "id": "svelte/store",
136
+ "8982-180": {
137
+ "id": "svelte/internal",
135
138
  "moduleParts": {},
136
139
  "imported": [],
137
140
  "importedBy": [
138
141
  {
139
- "uid": "e2ab-178"
142
+ "uid": "8982-178"
143
+ },
144
+ {
145
+ "uid": "8982-174"
146
+ },
147
+ {
148
+ "uid": "8982-176"
140
149
  }
141
150
  ],
142
151
  "isExternal": true
143
152
  },
144
- "e2ab-181": {
145
- "id": "svelte/internal",
153
+ "8982-181": {
154
+ "id": "svelte/store",
146
155
  "moduleParts": {},
147
156
  "imported": [],
148
157
  "importedBy": [
149
158
  {
150
- "uid": "e2ab-174"
151
- },
152
- {
153
- "uid": "e2ab-176"
159
+ "uid": "8982-178"
154
160
  }
155
161
  ],
156
162
  "isExternal": true
@@ -2,7 +2,7 @@ import { PartialKeys, Table, TableGenerics, TableOptions } from '@tanstack/table
2
2
  import { Readable } from 'svelte/store';
3
3
  export { renderComponent } from './render-component';
4
4
  export * from '@tanstack/table-core';
5
- export declare function render(Comp: any, props: any): any;
5
+ export declare function render(component: any, props: any): any;
6
6
  export declare const createTable: () => Table<{
7
7
  Renderer: typeof render;
8
8
  Rendered: any;
@@ -4001,18 +4001,46 @@
4001
4001
 
4002
4002
  const renderComponent = typeof window === 'undefined' ? renderServer : renderClient;
4003
4003
 
4004
- function render(Comp, props) {
4005
- if (!Comp) return null;
4004
+ function isSvelteServerComponent(component) {
4005
+ return typeof component === 'object' && typeof component.$$render === 'function' && typeof component.render === 'function';
4006
+ }
4007
+
4008
+ function isSvelteClientComponent(component) {
4009
+ return component.prototype instanceof internal.SvelteComponent;
4010
+ }
4006
4011
 
4007
- if (Comp instanceof Function) {
4008
- let res = Comp(props);
4009
- return res;
4012
+ function isSvelteComponent(component) {
4013
+ if (typeof document === 'undefined') {
4014
+ return isSvelteServerComponent(component);
4010
4015
  } else {
4011
- return renderComponent(Placeholder, {
4012
- content: Comp
4013
- });
4014
- } // return Comp
4016
+ return isSvelteClientComponent(component);
4017
+ }
4018
+ }
4019
+
4020
+ function wrapInPlaceholder(content) {
4021
+ return renderComponent(Placeholder, {
4022
+ content
4023
+ });
4024
+ }
4025
+
4026
+ function render(component, props) {
4027
+ if (!component) return null;
4028
+
4029
+ if (isSvelteComponent(component)) {
4030
+ return renderComponent(component, props);
4031
+ }
4032
+
4033
+ if (typeof component === 'function') {
4034
+ const result = component(props);
4035
+
4036
+ if (isSvelteComponent(result)) {
4037
+ return result;
4038
+ }
4039
+
4040
+ return wrapInPlaceholder(result);
4041
+ }
4015
4042
 
4043
+ return wrapInPlaceholder(component);
4016
4044
  }
4017
4045
  const createTable = createTableFactory({
4018
4046
  render