@tanstack/svelte-table 8.0.0-alpha.73 → 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.
- package/build/cjs/svelte-table/src/index.js +38 -9
- package/build/cjs/svelte-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +40 -141
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +77 -150
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +48 -42
- package/build/types/index.d.ts +1 -1
- package/build/umd/index.development.js +77 -150
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +39 -7
package/build/stats-html.html
CHANGED
|
@@ -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":"
|
|
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;
|
package/build/stats-react.json
CHANGED
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
"children": [
|
|
12
12
|
{
|
|
13
13
|
"name": "table-core/build/esm/index.js",
|
|
14
|
-
"uid": "
|
|
14
|
+
"uid": "8982-173"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "svelte-table/src",
|
|
18
18
|
"children": [
|
|
19
19
|
{
|
|
20
|
-
"uid": "
|
|
20
|
+
"uid": "8982-175",
|
|
21
21
|
"name": "placeholder.svelte"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"uid": "
|
|
24
|
+
"uid": "8982-177",
|
|
25
25
|
"name": "render-component.ts"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
"uid": "
|
|
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
|
-
"
|
|
42
|
-
"renderedLength":
|
|
43
|
-
"gzipLength":
|
|
41
|
+
"8982-173": {
|
|
42
|
+
"renderedLength": 139597,
|
|
43
|
+
"gzipLength": 23873,
|
|
44
44
|
"brotliLength": 0,
|
|
45
|
-
"mainUid": "
|
|
45
|
+
"mainUid": "8982-172"
|
|
46
46
|
},
|
|
47
|
-
"
|
|
47
|
+
"8982-175": {
|
|
48
48
|
"renderedLength": 925,
|
|
49
49
|
"gzipLength": 444,
|
|
50
50
|
"brotliLength": 0,
|
|
51
|
-
"mainUid": "
|
|
51
|
+
"mainUid": "8982-174"
|
|
52
52
|
},
|
|
53
|
-
"
|
|
53
|
+
"8982-177": {
|
|
54
54
|
"renderedLength": 1365,
|
|
55
55
|
"gzipLength": 519,
|
|
56
56
|
"brotliLength": 0,
|
|
57
|
-
"mainUid": "
|
|
57
|
+
"mainUid": "8982-176"
|
|
58
58
|
},
|
|
59
|
-
"
|
|
60
|
-
"renderedLength":
|
|
61
|
-
"gzipLength":
|
|
59
|
+
"8982-179": {
|
|
60
|
+
"renderedLength": 2729,
|
|
61
|
+
"gzipLength": 868,
|
|
62
62
|
"brotliLength": 0,
|
|
63
|
-
"mainUid": "
|
|
63
|
+
"mainUid": "8982-178"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"nodeMetas": {
|
|
67
|
-
"
|
|
67
|
+
"8982-172": {
|
|
68
68
|
"id": "/packages/table-core/build/esm/index.js",
|
|
69
69
|
"moduleParts": {
|
|
70
|
-
"index.production.js": "
|
|
70
|
+
"index.production.js": "8982-173"
|
|
71
71
|
},
|
|
72
72
|
"imported": [],
|
|
73
73
|
"importedBy": [
|
|
74
74
|
{
|
|
75
|
-
"uid": "
|
|
75
|
+
"uid": "8982-178"
|
|
76
76
|
}
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
|
-
"
|
|
79
|
+
"8982-174": {
|
|
80
80
|
"id": "/packages/svelte-table/src/placeholder.svelte",
|
|
81
81
|
"moduleParts": {
|
|
82
|
-
"index.production.js": "
|
|
82
|
+
"index.production.js": "8982-175"
|
|
83
83
|
},
|
|
84
84
|
"imported": [
|
|
85
85
|
{
|
|
86
|
-
"uid": "
|
|
86
|
+
"uid": "8982-180"
|
|
87
87
|
}
|
|
88
88
|
],
|
|
89
89
|
"importedBy": [
|
|
90
90
|
{
|
|
91
|
-
"uid": "
|
|
91
|
+
"uid": "8982-178"
|
|
92
92
|
}
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
-
"
|
|
95
|
+
"8982-176": {
|
|
96
96
|
"id": "/packages/svelte-table/src/render-component.ts",
|
|
97
97
|
"moduleParts": {
|
|
98
|
-
"index.production.js": "
|
|
98
|
+
"index.production.js": "8982-177"
|
|
99
99
|
},
|
|
100
100
|
"imported": [
|
|
101
101
|
{
|
|
102
|
-
"uid": "
|
|
102
|
+
"uid": "8982-180"
|
|
103
103
|
}
|
|
104
104
|
],
|
|
105
105
|
"importedBy": [
|
|
106
106
|
{
|
|
107
|
-
"uid": "
|
|
107
|
+
"uid": "8982-178"
|
|
108
108
|
}
|
|
109
109
|
]
|
|
110
110
|
},
|
|
111
|
-
"
|
|
111
|
+
"8982-178": {
|
|
112
112
|
"id": "/packages/svelte-table/src/index.ts",
|
|
113
113
|
"moduleParts": {
|
|
114
|
-
"index.production.js": "
|
|
114
|
+
"index.production.js": "8982-179"
|
|
115
115
|
},
|
|
116
116
|
"imported": [
|
|
117
117
|
{
|
|
118
|
-
"uid": "
|
|
118
|
+
"uid": "8982-172"
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
|
-
"uid": "
|
|
121
|
+
"uid": "8982-174"
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
|
-
"uid": "
|
|
124
|
+
"uid": "8982-180"
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
|
-
"uid": "
|
|
127
|
+
"uid": "8982-181"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"uid": "8982-176"
|
|
128
131
|
}
|
|
129
132
|
],
|
|
130
133
|
"importedBy": [],
|
|
131
134
|
"isEntry": true
|
|
132
135
|
},
|
|
133
|
-
"
|
|
134
|
-
"id": "svelte/
|
|
136
|
+
"8982-180": {
|
|
137
|
+
"id": "svelte/internal",
|
|
135
138
|
"moduleParts": {},
|
|
136
139
|
"imported": [],
|
|
137
140
|
"importedBy": [
|
|
138
141
|
{
|
|
139
|
-
"uid": "
|
|
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
|
-
"
|
|
145
|
-
"id": "svelte/
|
|
153
|
+
"8982-181": {
|
|
154
|
+
"id": "svelte/store",
|
|
146
155
|
"moduleParts": {},
|
|
147
156
|
"imported": [],
|
|
148
157
|
"importedBy": [
|
|
149
158
|
{
|
|
150
|
-
"uid": "
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
"uid": "1ed1-176"
|
|
159
|
+
"uid": "8982-178"
|
|
154
160
|
}
|
|
155
161
|
],
|
|
156
162
|
"isExternal": true
|
package/build/types/index.d.ts
CHANGED
|
@@ -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(
|
|
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;
|
|
@@ -2709,8 +2709,10 @@
|
|
|
2709
2709
|
}
|
|
2710
2710
|
}),
|
|
2711
2711
|
getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
2712
|
-
|
|
2713
|
-
|
|
2712
|
+
var _left$map$filter;
|
|
2713
|
+
|
|
2714
|
+
const orderedLeafColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
2715
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
|
|
2714
2716
|
}, {
|
|
2715
2717
|
key: 'getLeftHeaderGroups',
|
|
2716
2718
|
debug: () => {
|
|
@@ -2720,8 +2722,10 @@
|
|
|
2720
2722
|
}
|
|
2721
2723
|
}),
|
|
2722
2724
|
getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
+
var _right$map$filter;
|
|
2726
|
+
|
|
2727
|
+
const orderedLeafColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
2728
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
|
|
2725
2729
|
}, {
|
|
2726
2730
|
key: 'getRightHeaderGroups',
|
|
2727
2731
|
debug: () => {
|
|
@@ -3032,7 +3036,6 @@
|
|
|
3032
3036
|
// data: Batch[]
|
|
3033
3037
|
// facets: Batch[]
|
|
3034
3038
|
// }
|
|
3035
|
-
// export type TaskPriority = keyof CoreBatches
|
|
3036
3039
|
function createTableInstance$1(options) {
|
|
3037
3040
|
var _options$initialState;
|
|
3038
3041
|
|
|
@@ -3071,64 +3074,7 @@
|
|
|
3071
3074
|
});
|
|
3072
3075
|
|
|
3073
3076
|
const queued = [];
|
|
3074
|
-
let queuedTimeout = false;
|
|
3075
|
-
// let working = false
|
|
3076
|
-
// let latestCallback: ReturnType<typeof requestIdleCallback>
|
|
3077
|
-
// let batchUid = 0
|
|
3078
|
-
// const onProgress = () => {}
|
|
3079
|
-
// const getBatch = () => {
|
|
3080
|
-
// instance.batches.data = instance.batches.data.filter(d => d.tasks.length)
|
|
3081
|
-
// instance.batches.facets = instance.batches.facets.filter(
|
|
3082
|
-
// d => d.tasks.length
|
|
3083
|
-
// )
|
|
3084
|
-
// return (
|
|
3085
|
-
// instance.batches.data.find(d => d.tasks.length) ??
|
|
3086
|
-
// instance.batches.facets.find(d => d.tasks.length)
|
|
3087
|
-
// )
|
|
3088
|
-
// }
|
|
3089
|
-
// const startWorkLoop = () => {
|
|
3090
|
-
// working = true
|
|
3091
|
-
// const workLoop = (deadline: IdleDeadline) => {
|
|
3092
|
-
// const batch = getBatch()
|
|
3093
|
-
// if (!batch) {
|
|
3094
|
-
// working = false
|
|
3095
|
-
// return
|
|
3096
|
-
// }
|
|
3097
|
-
// // Prioritize tasks
|
|
3098
|
-
// while (deadline.timeRemaining() > 0 && batch.tasks.length) {
|
|
3099
|
-
// batch.tasks.shift()!()
|
|
3100
|
-
// }
|
|
3101
|
-
// onProgress()
|
|
3102
|
-
// if (working) {
|
|
3103
|
-
// latestCallback = requestIdleCallback(workLoop, { timeout: 10000 })
|
|
3104
|
-
// }
|
|
3105
|
-
// }
|
|
3106
|
-
// latestCallback = requestIdleCallback(workLoop, { timeout: 10000 })
|
|
3107
|
-
// }
|
|
3108
|
-
// const startWork = () => {
|
|
3109
|
-
// if (getBatch() && !working) {
|
|
3110
|
-
// if (
|
|
3111
|
-
// ("development" === 'development' && instance.options.debugAll) ??
|
|
3112
|
-
// instance.options.debugTable
|
|
3113
|
-
// ) {
|
|
3114
|
-
// console.info('Starting work...')
|
|
3115
|
-
// }
|
|
3116
|
-
// startWorkLoop()
|
|
3117
|
-
// }
|
|
3118
|
-
// }
|
|
3119
|
-
// const stopWork = () => {
|
|
3120
|
-
// if (working) {
|
|
3121
|
-
// if (
|
|
3122
|
-
// ("development" === 'development' && instance.options.debugAll) ??
|
|
3123
|
-
// instance.options.debugTable
|
|
3124
|
-
// ) {
|
|
3125
|
-
// console.info('Stopping work...')
|
|
3126
|
-
// }
|
|
3127
|
-
// working = false
|
|
3128
|
-
// cancelIdleCallback(latestCallback)
|
|
3129
|
-
// }
|
|
3130
|
-
// }
|
|
3131
|
-
|
|
3077
|
+
let queuedTimeout = false;
|
|
3132
3078
|
const midInstance = { ...instance,
|
|
3133
3079
|
// init: () => {
|
|
3134
3080
|
// startWork()
|
|
@@ -3161,39 +3107,6 @@
|
|
|
3161
3107
|
}));
|
|
3162
3108
|
}
|
|
3163
3109
|
},
|
|
3164
|
-
// batches: {
|
|
3165
|
-
// data: [],
|
|
3166
|
-
// facets: [],
|
|
3167
|
-
// },
|
|
3168
|
-
// createBatch: priority => {
|
|
3169
|
-
// const batchId = batchUid++
|
|
3170
|
-
// let canceled: boolean
|
|
3171
|
-
// const batch: Batch = {
|
|
3172
|
-
// id: batchId,
|
|
3173
|
-
// priority,
|
|
3174
|
-
// tasks: [],
|
|
3175
|
-
// schedule: cb => {
|
|
3176
|
-
// if (canceled) return
|
|
3177
|
-
// batch.tasks.push(cb)
|
|
3178
|
-
// if (!working && !workScheduled) {
|
|
3179
|
-
// workScheduled = true
|
|
3180
|
-
// instance.queue(() => {
|
|
3181
|
-
// workScheduled = false
|
|
3182
|
-
// instance.setState(old => ({ ...old }))
|
|
3183
|
-
// })
|
|
3184
|
-
// }
|
|
3185
|
-
// },
|
|
3186
|
-
// cancel: () => {
|
|
3187
|
-
// canceled = true
|
|
3188
|
-
// batch.tasks = []
|
|
3189
|
-
// instance.batches[priority] = instance.batches[priority].filter(
|
|
3190
|
-
// b => b.id !== batchId
|
|
3191
|
-
// )
|
|
3192
|
-
// },
|
|
3193
|
-
// }
|
|
3194
|
-
// instance.batches[priority].push(batch)
|
|
3195
|
-
// return batch
|
|
3196
|
-
// },
|
|
3197
3110
|
reset: () => {
|
|
3198
3111
|
instance.setState(instance.initialState);
|
|
3199
3112
|
},
|
|
@@ -3304,69 +3217,55 @@
|
|
|
3304
3217
|
|
|
3305
3218
|
function getCoreRowModel() {
|
|
3306
3219
|
return instance => memo(() => [instance.options.data], data => {
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3220
|
+
const rowModel = {
|
|
3221
|
+
rows: [],
|
|
3222
|
+
flatRows: [],
|
|
3223
|
+
rowsById: {}
|
|
3224
|
+
};
|
|
3225
|
+
let rows;
|
|
3226
|
+
let row;
|
|
3227
|
+
let originalRow;
|
|
3312
3228
|
|
|
3313
|
-
const
|
|
3229
|
+
const accessRows = function (originalRows, depth, parent) {
|
|
3314
3230
|
if (depth === void 0) {
|
|
3315
3231
|
depth = 0;
|
|
3316
3232
|
}
|
|
3317
3233
|
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
if (!id) {
|
|
3321
|
-
{
|
|
3322
|
-
throw new Error("getRowId expected an ID, but got " + id);
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
|
|
3326
|
-
const values = {};
|
|
3327
|
-
|
|
3328
|
-
for (let i = 0; i < leafColumns.length; i++) {
|
|
3329
|
-
const column = leafColumns[i];
|
|
3330
|
-
|
|
3331
|
-
if (column && column.accessorFn) {
|
|
3332
|
-
values[column.id] = column.accessorFn(originalRow, rowIndex);
|
|
3333
|
-
}
|
|
3334
|
-
} // Make the row
|
|
3234
|
+
rows = [];
|
|
3335
3235
|
|
|
3236
|
+
for (let i = 0; i < originalRows.length; i++) {
|
|
3237
|
+
originalRow = originalRows[i]; // This could be an expensive check at scale, so we should move it somewhere else, but where?
|
|
3238
|
+
// if (!id) {
|
|
3239
|
+
// if ("development" !== 'production') {
|
|
3240
|
+
// throw new Error(`getRowId expected an ID, but got ${id}`)
|
|
3241
|
+
// }
|
|
3242
|
+
// }
|
|
3243
|
+
// Make the row
|
|
3336
3244
|
|
|
3337
|
-
|
|
3245
|
+
row = instance.createRow(instance.getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
|
|
3338
3246
|
|
|
3339
|
-
|
|
3247
|
+
rowModel.flatRows.push(row); // Also keep track of every row by its ID
|
|
3340
3248
|
|
|
3341
|
-
|
|
3249
|
+
rowModel.rowsById[row.id] = row; // Push instance row into parent
|
|
3342
3250
|
|
|
3343
|
-
|
|
3251
|
+
rows.push(row); // Get the original subrows
|
|
3344
3252
|
|
|
3345
|
-
|
|
3346
|
-
|
|
3253
|
+
if (instance.options.getSubRows) {
|
|
3254
|
+
var _row$originalSubRows;
|
|
3347
3255
|
|
|
3348
|
-
|
|
3349
|
-
row.originalSubRows = originalSubRows;
|
|
3350
|
-
const subRows = [];
|
|
3256
|
+
row.originalSubRows = instance.options.getSubRows(originalRow, i); // Then recursively access them
|
|
3351
3257
|
|
|
3352
|
-
|
|
3353
|
-
|
|
3258
|
+
if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
|
|
3259
|
+
row.subRows = accessRows(row.originalSubRows, depth + 1, row);
|
|
3354
3260
|
}
|
|
3355
|
-
|
|
3356
|
-
row.subRows = subRows;
|
|
3357
3261
|
}
|
|
3358
3262
|
}
|
|
3359
|
-
};
|
|
3360
|
-
|
|
3361
|
-
for (let i = 0; i < data.length; i++) {
|
|
3362
|
-
accessRow(data[i], i, 0, rows);
|
|
3363
|
-
}
|
|
3364
3263
|
|
|
3365
|
-
|
|
3366
|
-
rows,
|
|
3367
|
-
flatRows,
|
|
3368
|
-
rowsById
|
|
3264
|
+
return rows;
|
|
3369
3265
|
};
|
|
3266
|
+
|
|
3267
|
+
rowModel.rows = accessRows(data);
|
|
3268
|
+
return rowModel;
|
|
3370
3269
|
}, {
|
|
3371
3270
|
key: 'getRowModel',
|
|
3372
3271
|
debug: () => {
|
|
@@ -4102,18 +4001,46 @@
|
|
|
4102
4001
|
|
|
4103
4002
|
const renderComponent = typeof window === 'undefined' ? renderServer : renderClient;
|
|
4104
4003
|
|
|
4105
|
-
function
|
|
4106
|
-
|
|
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
|
+
}
|
|
4107
4011
|
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
return
|
|
4012
|
+
function isSvelteComponent(component) {
|
|
4013
|
+
if (typeof document === 'undefined') {
|
|
4014
|
+
return isSvelteServerComponent(component);
|
|
4111
4015
|
} else {
|
|
4112
|
-
return
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
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
|
+
}
|
|
4116
4042
|
|
|
4043
|
+
return wrapInPlaceholder(component);
|
|
4117
4044
|
}
|
|
4118
4045
|
const createTable = createTableFactory({
|
|
4119
4046
|
render
|