@tanstack/svelte-table 8.6.0 → 8.7.2
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/lib/index.d.ts +7 -0
- package/build/lib/index.esm.js +201 -0
- package/build/lib/index.esm.js.map +1 -0
- package/build/{cjs/svelte-table/src → lib}/index.js +10 -49
- package/build/lib/index.js.map +1 -0
- package/build/lib/index.mjs +201 -0
- package/build/lib/index.mjs.map +1 -0
- package/build/lib/placeholder.d.ts +3 -0
- package/build/{cjs/svelte-table/src → lib}/placeholder.js +0 -0
- package/build/lib/placeholder.js.map +1 -0
- package/build/{cjs/svelte-table/src → lib}/placeholder.svelte.js +1 -1
- package/build/lib/placeholder.svelte.js.map +1 -0
- package/build/lib/render-component.d.ts +27 -0
- package/build/{cjs/svelte-table/src → lib}/render-component.js +0 -0
- package/build/lib/render-component.js.map +1 -0
- package/build/umd/index.development.js +473 -314
- 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 +15 -7
- package/build/cjs/svelte-table/src/index.js.map +0 -1
- package/build/cjs/svelte-table/src/placeholder.js.map +0 -1
- package/build/cjs/svelte-table/src/placeholder.svelte.js.map +0 -1
- package/build/cjs/svelte-table/src/render-component.js.map +0 -1
- package/build/cjs/table-core/build/esm/index.js +0 -3446
- package/build/cjs/table-core/build/esm/index.js.map +0 -1
- package/build/esm/index.js +0 -3587
- package/build/esm/index.js.map +0 -1
- package/build/stats-html.html +0 -4044
- package/build/stats-react.json +0 -205
- package/build/types/index.d.ts +0 -48
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RowData, TableOptions } from '@tanstack/table-core';
|
|
2
|
+
import { Readable } from 'svelte/store';
|
|
3
|
+
export { renderComponent } from './render-component';
|
|
4
|
+
export * from '@tanstack/table-core';
|
|
5
|
+
export declare function flexRender(component: any, props: any): any;
|
|
6
|
+
type ReadableOrVal<T> = T | Readable<T>;
|
|
7
|
+
export declare function createSvelteTable<TData extends RowData>(options: ReadableOrVal<TableOptions<TData>>): Readable<import("@tanstack/table-core").Table<TData>>;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* svelte-table
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { createTable } from '@tanstack/table-core';
|
|
12
|
+
export * from '@tanstack/table-core';
|
|
13
|
+
import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
|
|
14
|
+
import { readable, get, writable, derived } from 'svelte/store';
|
|
15
|
+
|
|
16
|
+
/* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.54.0 */
|
|
17
|
+
|
|
18
|
+
function create_fragment$1(ctx) {
|
|
19
|
+
let t;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
c() {
|
|
23
|
+
t = text(/*content*/ ctx[0]);
|
|
24
|
+
},
|
|
25
|
+
l(nodes) {
|
|
26
|
+
t = claim_text(nodes, /*content*/ ctx[0]);
|
|
27
|
+
},
|
|
28
|
+
m(target, anchor) {
|
|
29
|
+
insert_hydration(target, t, anchor);
|
|
30
|
+
},
|
|
31
|
+
p(ctx, [dirty]) {
|
|
32
|
+
if (dirty & /*content*/ 1) set_data(t, /*content*/ ctx[0]);
|
|
33
|
+
},
|
|
34
|
+
i: noop,
|
|
35
|
+
o: noop,
|
|
36
|
+
d(detaching) {
|
|
37
|
+
if (detaching) detach(t);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function instance($$self, $$props, $$invalidate) {
|
|
43
|
+
let { content } = $$props;
|
|
44
|
+
|
|
45
|
+
$$self.$$set = $$props => {
|
|
46
|
+
if ('content' in $$props) $$invalidate(0, content = $$props.content);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return [content];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class Placeholder$1 extends SvelteComponent {
|
|
53
|
+
constructor(options) {
|
|
54
|
+
super();
|
|
55
|
+
init(this, options, instance, create_fragment$1, safe_not_equal, { content: 0 });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const PlaceholderServer = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
60
|
+
return `${escape($$props.content)}`;
|
|
61
|
+
});
|
|
62
|
+
var Placeholder = typeof document === 'undefined' ? PlaceholderServer : Placeholder$1;
|
|
63
|
+
|
|
64
|
+
function create_fragment(ctx, Comp, props) {
|
|
65
|
+
let c;
|
|
66
|
+
let current;
|
|
67
|
+
c = new Comp({
|
|
68
|
+
props,
|
|
69
|
+
$$inline: true
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
c() {
|
|
73
|
+
create_component(c.$$.fragment);
|
|
74
|
+
},
|
|
75
|
+
l(nodes) {
|
|
76
|
+
claim_component(c.$$.fragment, nodes);
|
|
77
|
+
},
|
|
78
|
+
m(target, anchor) {
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
mount_component(c, target, anchor);
|
|
81
|
+
current = true;
|
|
82
|
+
},
|
|
83
|
+
p: noop,
|
|
84
|
+
i(local) {
|
|
85
|
+
if (current) return;
|
|
86
|
+
transition_in(c.$$.fragment, local);
|
|
87
|
+
current = true;
|
|
88
|
+
},
|
|
89
|
+
o(local) {
|
|
90
|
+
transition_out(c.$$.fragment, local);
|
|
91
|
+
current = false;
|
|
92
|
+
},
|
|
93
|
+
d(detaching) {
|
|
94
|
+
destroy_component(c, detaching);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function renderClient(Comp, props) {
|
|
99
|
+
return class WrapperComp extends SvelteComponent {
|
|
100
|
+
constructor(options) {
|
|
101
|
+
super();
|
|
102
|
+
init(this, options, null, ctx => create_fragment(ctx, Comp, props), safe_not_equal, {}, undefined);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function renderServer(Comp, props) {
|
|
107
|
+
const WrapperComp = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
108
|
+
return `${validate_component(Comp, 'TableComponent').$$render($$result, props, {}, {})}`;
|
|
109
|
+
});
|
|
110
|
+
return WrapperComp;
|
|
111
|
+
}
|
|
112
|
+
const renderComponent = typeof window === 'undefined' ? renderServer : renderClient;
|
|
113
|
+
|
|
114
|
+
function isSvelteServerComponent(component) {
|
|
115
|
+
return typeof component === 'object' && typeof component.$$render === 'function' && typeof component.render === 'function';
|
|
116
|
+
}
|
|
117
|
+
function isSvelteClientComponent(component) {
|
|
118
|
+
let isHMR = ('__SVELTE_HMR' in window);
|
|
119
|
+
return component.prototype instanceof SvelteComponent || isHMR && component.name?.startsWith('Proxy<') && component.name?.endsWith('>');
|
|
120
|
+
}
|
|
121
|
+
function isSvelteComponent(component) {
|
|
122
|
+
if (typeof document === 'undefined') {
|
|
123
|
+
return isSvelteServerComponent(component);
|
|
124
|
+
} else {
|
|
125
|
+
return isSvelteClientComponent(component);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function wrapInPlaceholder(content) {
|
|
129
|
+
return renderComponent(Placeholder, {
|
|
130
|
+
content
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function flexRender(component, props) {
|
|
134
|
+
if (!component) return null;
|
|
135
|
+
if (isSvelteComponent(component)) {
|
|
136
|
+
return renderComponent(component, props);
|
|
137
|
+
}
|
|
138
|
+
if (typeof component === 'function') {
|
|
139
|
+
const result = component(props);
|
|
140
|
+
if (isSvelteComponent(result)) {
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
return wrapInPlaceholder(result);
|
|
144
|
+
}
|
|
145
|
+
return wrapInPlaceholder(component);
|
|
146
|
+
}
|
|
147
|
+
function createSvelteTable(options) {
|
|
148
|
+
let optionsStore;
|
|
149
|
+
if ('subscribe' in options) {
|
|
150
|
+
optionsStore = options;
|
|
151
|
+
} else {
|
|
152
|
+
optionsStore = readable(options);
|
|
153
|
+
}
|
|
154
|
+
let resolvedOptions = {
|
|
155
|
+
state: {},
|
|
156
|
+
// Dummy state
|
|
157
|
+
onStateChange: () => {},
|
|
158
|
+
// noop
|
|
159
|
+
renderFallbackValue: null,
|
|
160
|
+
...get(optionsStore)
|
|
161
|
+
};
|
|
162
|
+
let table = createTable(resolvedOptions);
|
|
163
|
+
let stateStore = writable( /** @type {number} */table.initialState);
|
|
164
|
+
// combine stores
|
|
165
|
+
let stateOptionsStore = derived([stateStore, optionsStore], s => s);
|
|
166
|
+
const tableReadable = readable(table, function start(set) {
|
|
167
|
+
const unsubscribe = stateOptionsStore.subscribe(_ref => {
|
|
168
|
+
let [state, options] = _ref;
|
|
169
|
+
table.setOptions(prev => {
|
|
170
|
+
return {
|
|
171
|
+
...prev,
|
|
172
|
+
...options,
|
|
173
|
+
state: {
|
|
174
|
+
...state,
|
|
175
|
+
...options.state
|
|
176
|
+
},
|
|
177
|
+
// Similarly, we'll maintain both our internal state and any user-provided
|
|
178
|
+
// state.
|
|
179
|
+
onStateChange: updater => {
|
|
180
|
+
if (updater instanceof Function) {
|
|
181
|
+
stateStore.update(updater);
|
|
182
|
+
} else {
|
|
183
|
+
stateStore.set(updater);
|
|
184
|
+
}
|
|
185
|
+
resolvedOptions.onStateChange?.(updater);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// it didn't seem to rerender without setting the table
|
|
191
|
+
set(table);
|
|
192
|
+
});
|
|
193
|
+
return function stop() {
|
|
194
|
+
unsubscribe();
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
return tableReadable;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export { createSvelteTable, flexRender, renderComponent };
|
|
201
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/placeholder.svelte","../../src/placeholder.ts","../../src/render-component.ts","../../src/index.ts"],"sourcesContent":["<script>\nexport let content;\n</script>\n\n{content}","import type { SvelteComponentDev } from 'svelte/internal'\nimport { create_ssr_component, escape } from 'svelte/internal'\nimport PlaceholderClient from './placeholder.svelte'\n\ntype X = typeof PlaceholderClient\n\nconst PlaceholderServer = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${escape($$props.content)}`\n }\n) as any as typeof SvelteComponentDev\n\nexport default typeof document === 'undefined'\n ? PlaceholderServer\n : PlaceholderClient\n","import type { ComponentType, ComponentProps } from 'svelte'\nimport {\n SvelteComponent,\n claim_component,\n create_component,\n destroy_component,\n init,\n mount_component,\n noop,\n safe_not_equal,\n transition_in,\n transition_out,\n create_ssr_component,\n validate_component,\n} from 'svelte/internal'\n\nfunction create_fragment(ctx: any, Comp: any, props: any) {\n let c: any\n let current: any\n c = new Comp({ props, $$inline: true })\n\n return {\n c() {\n create_component(c.$$.fragment)\n },\n l(nodes: any) {\n claim_component(c.$$.fragment, nodes)\n },\n m(target: any, anchor: any) {\n // @ts-ignore\n mount_component(c, target, anchor)\n current = true\n },\n p: noop,\n i(local: any) {\n if (current) return\n transition_in(c.$$.fragment, local)\n current = true\n },\n o(local: any) {\n transition_out(c.$$.fragment, local)\n current = false\n },\n d(detaching: any) {\n destroy_component(c, detaching)\n },\n }\n}\n\nfunction renderClient<T>(\n Comp: T,\n props: T extends ComponentType<infer C> ? ComponentProps<C> : any\n) {\n return class WrapperComp extends SvelteComponent {\n constructor(options: any) {\n super()\n init(\n this,\n options,\n null,\n (ctx: any) => create_fragment(ctx, Comp, props),\n safe_not_equal,\n {},\n undefined\n )\n }\n }\n}\n\nfunction renderServer<T>(\n Comp: T,\n props: T extends ComponentType<infer C> ? ComponentProps<C> : any\n) {\n const WrapperComp = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${validate_component(Comp, 'TableComponent').$$render(\n $$result,\n props,\n {},\n {}\n )}`\n }\n )\n\n return WrapperComp\n}\n\nexport const renderComponent =\n typeof window === 'undefined' ? renderServer : renderClient\n","import {\n RowData,\n createTable,\n TableOptions,\n TableOptionsResolved,\n} from '@tanstack/table-core'\nimport Placeholder from './placeholder'\nimport { SvelteComponent } from 'svelte/internal'\nimport { readable, writable, derived, Readable, get } from 'svelte/store'\nimport { renderComponent } from './render-component'\n\nexport { renderComponent } from './render-component'\n\nexport * from '@tanstack/table-core'\n\nfunction isSvelteServerComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$render === 'function' &&\n typeof component.render === 'function'\n )\n}\n\nfunction isSvelteClientComponent(component: any) {\n let isHMR = '__SVELTE_HMR' in window\n\n return (\n component.prototype instanceof SvelteComponent ||\n (isHMR &&\n component.name?.startsWith('Proxy<') &&\n component.name?.endsWith('>'))\n )\n}\n\nfunction isSvelteComponent(component: any) {\n if (typeof document === 'undefined') {\n return isSvelteServerComponent(component)\n } else {\n return isSvelteClientComponent(component)\n }\n}\n\nfunction wrapInPlaceholder(content: any) {\n return renderComponent(Placeholder, { content })\n}\n\nexport function flexRender(component: any, props: any) {\n if (!component) return null\n\n if (isSvelteComponent(component)) {\n return renderComponent(component, props)\n }\n\n if (typeof component === 'function') {\n const result = component(props)\n\n if (isSvelteComponent(result)) {\n return result\n }\n\n return wrapInPlaceholder(result)\n }\n\n return wrapInPlaceholder(component)\n}\n\ntype ReadableOrVal<T> = T | Readable<T>\n\nexport function createSvelteTable<TData extends RowData>(\n options: ReadableOrVal<TableOptions<TData>>\n) {\n let optionsStore: Readable<TableOptions<TData>>\n\n if ('subscribe' in options) {\n optionsStore = options\n } else {\n optionsStore = readable(options)\n }\n\n let resolvedOptions: TableOptionsResolved<TData> = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...get(optionsStore),\n }\n\n let table = createTable(resolvedOptions)\n\n let stateStore = writable(/** @type {number} */ table.initialState)\n // combine stores\n let stateOptionsStore = derived([stateStore, optionsStore], s => s)\n const tableReadable = readable(table, function start(set) {\n const unsubscribe = stateOptionsStore.subscribe(([state, options]) => {\n table.setOptions(prev => {\n return {\n ...prev,\n ...options,\n state: { ...state, ...options.state },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n if (updater instanceof Function) {\n stateStore.update(updater)\n } else {\n stateStore.set(updater)\n }\n\n resolvedOptions.onStateChange?.(updater)\n },\n }\n })\n\n // it didn't seem to rerender without setting the table\n set(table)\n })\n\n return function stop() {\n unsubscribe()\n }\n })\n\n return tableReadable\n}\n"],"names":["PlaceholderServer","create_ssr_component","$$result","$$props","$$bindings","slots","escape","content","document","PlaceholderClient","create_fragment","ctx","Comp","props","c","current","$$inline","create_component","$$","fragment","l","nodes","claim_component","m","target","anchor","mount_component","p","noop","i","local","transition_in","o","transition_out","d","detaching","destroy_component","renderClient","WrapperComp","SvelteComponent","constructor","options","init","safe_not_equal","undefined","renderServer","validate_component","$$render","renderComponent","window","isSvelteServerComponent","component","render","isSvelteClientComponent","isHMR","prototype","name","startsWith","endsWith","isSvelteComponent","wrapInPlaceholder","Placeholder","flexRender","result","createSvelteTable","optionsStore","readable","resolvedOptions","state","onStateChange","renderFallbackValue","get","table","createTable","stateStore","writable","initialState","stateOptionsStore","derived","s","tableReadable","start","set","unsubscribe","subscribe","setOptions","prev","updater","Function","update","stop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBAIC,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;qCAAP,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;sDAAP,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;OAHG,OAAO,EAAA,GAAA,OAAA,CAAA;;;;;;;;;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,CAAA;AAC5B,aAAC,MAAM;AACLb,cAAAA,UAAU,CAACQ,GAAG,CAACK,OAAO,CAAC,CAAA;AACzB,aAAA;AAEApB,YAAAA,eAAe,CAACE,aAAa,GAAGkB,OAAO,CAAC,CAAA;AAC1C,WAAA;SACD,CAAA;AACH,OAAC,CAAC,CAAA;;AAEF;MACAL,GAAG,CAACV,KAAK,CAAC,CAAA;AACZ,KAAC,CAAC,CAAA;IAEF,OAAO,SAASkB,IAAI,GAAG;AACrBP,MAAAA,WAAW,EAAE,CAAA;KACd,CAAA;AACH,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,aAAa,CAAA;AACtB;;;;"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var tableCore = require('@tanstack/table-core');
|
|
16
16
|
var placeholder = require('./placeholder.js');
|
|
17
17
|
var internal = require('svelte/internal');
|
|
18
18
|
var store = require('svelte/store');
|
|
@@ -22,9 +22,8 @@ function isSvelteServerComponent(component) {
|
|
|
22
22
|
return typeof component === 'object' && typeof component.$$render === 'function' && typeof component.render === 'function';
|
|
23
23
|
}
|
|
24
24
|
function isSvelteClientComponent(component) {
|
|
25
|
-
var _component$name, _component$name2;
|
|
26
25
|
let isHMR = ('__SVELTE_HMR' in window);
|
|
27
|
-
return component.prototype instanceof internal.SvelteComponent || isHMR &&
|
|
26
|
+
return component.prototype instanceof internal.SvelteComponent || isHMR && component.name?.startsWith('Proxy<') && component.name?.endsWith('>');
|
|
28
27
|
}
|
|
29
28
|
function isSvelteComponent(component) {
|
|
30
29
|
if (typeof document === 'undefined') {
|
|
@@ -67,7 +66,7 @@ function createSvelteTable(options) {
|
|
|
67
66
|
renderFallbackValue: null,
|
|
68
67
|
...store.get(optionsStore)
|
|
69
68
|
};
|
|
70
|
-
let table =
|
|
69
|
+
let table = tableCore.createTable(resolvedOptions);
|
|
71
70
|
let stateStore = store.writable( /** @type {number} */table.initialState);
|
|
72
71
|
// combine stores
|
|
73
72
|
let stateOptionsStore = store.derived([stateStore, optionsStore], s => s);
|
|
@@ -90,7 +89,7 @@ function createSvelteTable(options) {
|
|
|
90
89
|
} else {
|
|
91
90
|
stateStore.set(updater);
|
|
92
91
|
}
|
|
93
|
-
resolvedOptions.onStateChange
|
|
92
|
+
resolvedOptions.onStateChange?.(updater);
|
|
94
93
|
}
|
|
95
94
|
};
|
|
96
95
|
});
|
|
@@ -105,51 +104,13 @@ function createSvelteTable(options) {
|
|
|
105
104
|
return tableReadable;
|
|
106
105
|
}
|
|
107
106
|
|
|
108
|
-
exports.ColumnSizing = index.ColumnSizing;
|
|
109
|
-
exports.Expanding = index.Expanding;
|
|
110
|
-
exports.Filters = index.Filters;
|
|
111
|
-
exports.Grouping = index.Grouping;
|
|
112
|
-
exports.Headers = index.Headers;
|
|
113
|
-
exports.Ordering = index.Ordering;
|
|
114
|
-
exports.Pagination = index.Pagination;
|
|
115
|
-
exports.Pinning = index.Pinning;
|
|
116
|
-
exports.RowSelection = index.RowSelection;
|
|
117
|
-
exports.Sorting = index.Sorting;
|
|
118
|
-
exports.Visibility = index.Visibility;
|
|
119
|
-
exports.aggregationFns = index.aggregationFns;
|
|
120
|
-
exports.buildHeaderGroups = index.buildHeaderGroups;
|
|
121
|
-
exports.createCell = index.createCell;
|
|
122
|
-
exports.createColumn = index.createColumn;
|
|
123
|
-
exports.createColumnHelper = index.createColumnHelper;
|
|
124
|
-
exports.createRow = index.createRow;
|
|
125
|
-
exports.createTable = index.createTable;
|
|
126
|
-
exports.defaultColumnSizing = index.defaultColumnSizing;
|
|
127
|
-
exports.expandRows = index.expandRows;
|
|
128
|
-
exports.filterFns = index.filterFns;
|
|
129
|
-
exports.flattenBy = index.flattenBy;
|
|
130
|
-
exports.functionalUpdate = index.functionalUpdate;
|
|
131
|
-
exports.getCoreRowModel = index.getCoreRowModel;
|
|
132
|
-
exports.getExpandedRowModel = index.getExpandedRowModel;
|
|
133
|
-
exports.getFacetedMinMaxValues = index.getFacetedMinMaxValues;
|
|
134
|
-
exports.getFacetedRowModel = index.getFacetedRowModel;
|
|
135
|
-
exports.getFacetedUniqueValues = index.getFacetedUniqueValues;
|
|
136
|
-
exports.getFilteredRowModel = index.getFilteredRowModel;
|
|
137
|
-
exports.getGroupedRowModel = index.getGroupedRowModel;
|
|
138
|
-
exports.getPaginationRowModel = index.getPaginationRowModel;
|
|
139
|
-
exports.getSortedRowModel = index.getSortedRowModel;
|
|
140
|
-
exports.isFunction = index.isFunction;
|
|
141
|
-
exports.isRowSelected = index.isRowSelected;
|
|
142
|
-
exports.isSubRowSelected = index.isSubRowSelected;
|
|
143
|
-
exports.makeStateUpdater = index.makeStateUpdater;
|
|
144
|
-
exports.memo = index.memo;
|
|
145
|
-
exports.noop = index.noop;
|
|
146
|
-
exports.orderColumns = index.orderColumns;
|
|
147
|
-
exports.passiveEventSupported = index.passiveEventSupported;
|
|
148
|
-
exports.reSplitAlphaNumeric = index.reSplitAlphaNumeric;
|
|
149
|
-
exports.selectRowsFn = index.selectRowsFn;
|
|
150
|
-
exports.shouldAutoRemoveFilter = index.shouldAutoRemoveFilter;
|
|
151
|
-
exports.sortingFns = index.sortingFns;
|
|
152
107
|
exports.renderComponent = renderComponent.renderComponent;
|
|
153
108
|
exports.createSvelteTable = createSvelteTable;
|
|
154
109
|
exports.flexRender = flexRender;
|
|
110
|
+
Object.keys(tableCore).forEach(function (k) {
|
|
111
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () { return tableCore[k]; }
|
|
114
|
+
});
|
|
115
|
+
});
|
|
155
116
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n RowData,\n createTable,\n TableOptions,\n TableOptionsResolved,\n} from '@tanstack/table-core'\nimport Placeholder from './placeholder'\nimport { SvelteComponent } from 'svelte/internal'\nimport { readable, writable, derived, Readable, get } from 'svelte/store'\nimport { renderComponent } from './render-component'\n\nexport { renderComponent } from './render-component'\n\nexport * from '@tanstack/table-core'\n\nfunction isSvelteServerComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$render === 'function' &&\n typeof component.render === 'function'\n )\n}\n\nfunction isSvelteClientComponent(component: any) {\n let isHMR = '__SVELTE_HMR' in window\n\n return (\n component.prototype instanceof SvelteComponent ||\n (isHMR &&\n component.name?.startsWith('Proxy<') &&\n component.name?.endsWith('>'))\n )\n}\n\nfunction isSvelteComponent(component: any) {\n if (typeof document === 'undefined') {\n return isSvelteServerComponent(component)\n } else {\n return isSvelteClientComponent(component)\n }\n}\n\nfunction wrapInPlaceholder(content: any) {\n return renderComponent(Placeholder, { content })\n}\n\nexport function flexRender(component: any, props: any) {\n if (!component) return null\n\n if (isSvelteComponent(component)) {\n return renderComponent(component, props)\n }\n\n if (typeof component === 'function') {\n const result = component(props)\n\n if (isSvelteComponent(result)) {\n return result\n }\n\n return wrapInPlaceholder(result)\n }\n\n return wrapInPlaceholder(component)\n}\n\ntype ReadableOrVal<T> = T | Readable<T>\n\nexport function createSvelteTable<TData extends RowData>(\n options: ReadableOrVal<TableOptions<TData>>\n) {\n let optionsStore: Readable<TableOptions<TData>>\n\n if ('subscribe' in options) {\n optionsStore = options\n } else {\n optionsStore = readable(options)\n }\n\n let resolvedOptions: TableOptionsResolved<TData> = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...get(optionsStore),\n }\n\n let table = createTable(resolvedOptions)\n\n let stateStore = writable(/** @type {number} */ table.initialState)\n // combine stores\n let stateOptionsStore = derived([stateStore, optionsStore], s => s)\n const tableReadable = readable(table, function start(set) {\n const unsubscribe = stateOptionsStore.subscribe(([state, options]) => {\n table.setOptions(prev => {\n return {\n ...prev,\n ...options,\n state: { ...state, ...options.state },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n if (updater instanceof Function) {\n stateStore.update(updater)\n } else {\n stateStore.set(updater)\n }\n\n resolvedOptions.onStateChange?.(updater)\n },\n }\n })\n\n // it didn't seem to rerender without setting the table\n set(table)\n })\n\n return function stop() {\n unsubscribe()\n }\n })\n\n return tableReadable\n}\n"],"names":["isSvelteServerComponent","component","$$render","render","isSvelteClientComponent","isHMR","window","prototype","SvelteComponent","name","startsWith","endsWith","isSvelteComponent","document","wrapInPlaceholder","content","renderComponent","Placeholder","flexRender","props","result","createSvelteTable","options","optionsStore","readable","resolvedOptions","state","onStateChange","renderFallbackValue","get","table","createTable","stateStore","writable","initialState","stateOptionsStore","derived","s","tableReadable","start","set","unsubscribe","subscribe","setOptions","prev","updater","Function","update","stop"],"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,SAASA,uBAAuB,CAACC,SAAc,EAAE;AAC/C,EAAA,OACE,OAAOA,SAAS,KAAK,QAAQ,IAC7B,OAAOA,SAAS,CAACC,QAAQ,KAAK,UAAU,IACxC,OAAOD,SAAS,CAACE,MAAM,KAAK,UAAU,CAAA;AAE1C,CAAA;AAEA,SAASC,uBAAuB,CAACH,SAAc,EAAE;AAC/C,EAAA,IAAII,KAAK,IAAG,cAAc,IAAIC,MAAM,CAAA,CAAA;EAEpC,OACEL,SAAS,CAACM,SAAS,YAAYC,wBAAe,IAC7CH,KAAK,IACJJ,SAAS,CAACQ,IAAI,EAAEC,UAAU,CAAC,QAAQ,CAAC,IACpCT,SAAS,CAACQ,IAAI,EAAEE,QAAQ,CAAC,GAAG,CAAE,CAAA;AAEpC,CAAA;AAEA,SAASC,iBAAiB,CAACX,SAAc,EAAE;AACzC,EAAA,IAAI,OAAOY,QAAQ,KAAK,WAAW,EAAE;IACnC,OAAOb,uBAAuB,CAACC,SAAS,CAAC,CAAA;AAC3C,GAAC,MAAM;IACL,OAAOG,uBAAuB,CAACH,SAAS,CAAC,CAAA;AAC3C,GAAA;AACF,CA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
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { createTable } from '@tanstack/table-core';
|
|
12
|
+
export * from '@tanstack/table-core';
|
|
13
|
+
import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
|
|
14
|
+
import { readable, get, writable, derived } from 'svelte/store';
|
|
15
|
+
|
|
16
|
+
/* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.54.0 */
|
|
17
|
+
|
|
18
|
+
function create_fragment$1(ctx) {
|
|
19
|
+
let t;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
c() {
|
|
23
|
+
t = text(/*content*/ ctx[0]);
|
|
24
|
+
},
|
|
25
|
+
l(nodes) {
|
|
26
|
+
t = claim_text(nodes, /*content*/ ctx[0]);
|
|
27
|
+
},
|
|
28
|
+
m(target, anchor) {
|
|
29
|
+
insert_hydration(target, t, anchor);
|
|
30
|
+
},
|
|
31
|
+
p(ctx, [dirty]) {
|
|
32
|
+
if (dirty & /*content*/ 1) set_data(t, /*content*/ ctx[0]);
|
|
33
|
+
},
|
|
34
|
+
i: noop,
|
|
35
|
+
o: noop,
|
|
36
|
+
d(detaching) {
|
|
37
|
+
if (detaching) detach(t);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function instance($$self, $$props, $$invalidate) {
|
|
43
|
+
let { content } = $$props;
|
|
44
|
+
|
|
45
|
+
$$self.$$set = $$props => {
|
|
46
|
+
if ('content' in $$props) $$invalidate(0, content = $$props.content);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return [content];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class Placeholder$1 extends SvelteComponent {
|
|
53
|
+
constructor(options) {
|
|
54
|
+
super();
|
|
55
|
+
init(this, options, instance, create_fragment$1, safe_not_equal, { content: 0 });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const PlaceholderServer = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
60
|
+
return `${escape($$props.content)}`;
|
|
61
|
+
});
|
|
62
|
+
var Placeholder = typeof document === 'undefined' ? PlaceholderServer : Placeholder$1;
|
|
63
|
+
|
|
64
|
+
function create_fragment(ctx, Comp, props) {
|
|
65
|
+
let c;
|
|
66
|
+
let current;
|
|
67
|
+
c = new Comp({
|
|
68
|
+
props,
|
|
69
|
+
$$inline: true
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
c() {
|
|
73
|
+
create_component(c.$$.fragment);
|
|
74
|
+
},
|
|
75
|
+
l(nodes) {
|
|
76
|
+
claim_component(c.$$.fragment, nodes);
|
|
77
|
+
},
|
|
78
|
+
m(target, anchor) {
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
mount_component(c, target, anchor);
|
|
81
|
+
current = true;
|
|
82
|
+
},
|
|
83
|
+
p: noop,
|
|
84
|
+
i(local) {
|
|
85
|
+
if (current) return;
|
|
86
|
+
transition_in(c.$$.fragment, local);
|
|
87
|
+
current = true;
|
|
88
|
+
},
|
|
89
|
+
o(local) {
|
|
90
|
+
transition_out(c.$$.fragment, local);
|
|
91
|
+
current = false;
|
|
92
|
+
},
|
|
93
|
+
d(detaching) {
|
|
94
|
+
destroy_component(c, detaching);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function renderClient(Comp, props) {
|
|
99
|
+
return class WrapperComp extends SvelteComponent {
|
|
100
|
+
constructor(options) {
|
|
101
|
+
super();
|
|
102
|
+
init(this, options, null, ctx => create_fragment(ctx, Comp, props), safe_not_equal, {}, undefined);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function renderServer(Comp, props) {
|
|
107
|
+
const WrapperComp = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
108
|
+
return `${validate_component(Comp, 'TableComponent').$$render($$result, props, {}, {})}`;
|
|
109
|
+
});
|
|
110
|
+
return WrapperComp;
|
|
111
|
+
}
|
|
112
|
+
const renderComponent = typeof window === 'undefined' ? renderServer : renderClient;
|
|
113
|
+
|
|
114
|
+
function isSvelteServerComponent(component) {
|
|
115
|
+
return typeof component === 'object' && typeof component.$$render === 'function' && typeof component.render === 'function';
|
|
116
|
+
}
|
|
117
|
+
function isSvelteClientComponent(component) {
|
|
118
|
+
let isHMR = ('__SVELTE_HMR' in window);
|
|
119
|
+
return component.prototype instanceof SvelteComponent || isHMR && component.name?.startsWith('Proxy<') && component.name?.endsWith('>');
|
|
120
|
+
}
|
|
121
|
+
function isSvelteComponent(component) {
|
|
122
|
+
if (typeof document === 'undefined') {
|
|
123
|
+
return isSvelteServerComponent(component);
|
|
124
|
+
} else {
|
|
125
|
+
return isSvelteClientComponent(component);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function wrapInPlaceholder(content) {
|
|
129
|
+
return renderComponent(Placeholder, {
|
|
130
|
+
content
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function flexRender(component, props) {
|
|
134
|
+
if (!component) return null;
|
|
135
|
+
if (isSvelteComponent(component)) {
|
|
136
|
+
return renderComponent(component, props);
|
|
137
|
+
}
|
|
138
|
+
if (typeof component === 'function') {
|
|
139
|
+
const result = component(props);
|
|
140
|
+
if (isSvelteComponent(result)) {
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
return wrapInPlaceholder(result);
|
|
144
|
+
}
|
|
145
|
+
return wrapInPlaceholder(component);
|
|
146
|
+
}
|
|
147
|
+
function createSvelteTable(options) {
|
|
148
|
+
let optionsStore;
|
|
149
|
+
if ('subscribe' in options) {
|
|
150
|
+
optionsStore = options;
|
|
151
|
+
} else {
|
|
152
|
+
optionsStore = readable(options);
|
|
153
|
+
}
|
|
154
|
+
let resolvedOptions = {
|
|
155
|
+
state: {},
|
|
156
|
+
// Dummy state
|
|
157
|
+
onStateChange: () => {},
|
|
158
|
+
// noop
|
|
159
|
+
renderFallbackValue: null,
|
|
160
|
+
...get(optionsStore)
|
|
161
|
+
};
|
|
162
|
+
let table = createTable(resolvedOptions);
|
|
163
|
+
let stateStore = writable( /** @type {number} */table.initialState);
|
|
164
|
+
// combine stores
|
|
165
|
+
let stateOptionsStore = derived([stateStore, optionsStore], s => s);
|
|
166
|
+
const tableReadable = readable(table, function start(set) {
|
|
167
|
+
const unsubscribe = stateOptionsStore.subscribe(_ref => {
|
|
168
|
+
let [state, options] = _ref;
|
|
169
|
+
table.setOptions(prev => {
|
|
170
|
+
return {
|
|
171
|
+
...prev,
|
|
172
|
+
...options,
|
|
173
|
+
state: {
|
|
174
|
+
...state,
|
|
175
|
+
...options.state
|
|
176
|
+
},
|
|
177
|
+
// Similarly, we'll maintain both our internal state and any user-provided
|
|
178
|
+
// state.
|
|
179
|
+
onStateChange: updater => {
|
|
180
|
+
if (updater instanceof Function) {
|
|
181
|
+
stateStore.update(updater);
|
|
182
|
+
} else {
|
|
183
|
+
stateStore.set(updater);
|
|
184
|
+
}
|
|
185
|
+
resolvedOptions.onStateChange?.(updater);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// it didn't seem to rerender without setting the table
|
|
191
|
+
set(table);
|
|
192
|
+
});
|
|
193
|
+
return function stop() {
|
|
194
|
+
unsubscribe();
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
return tableReadable;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export { createSvelteTable, flexRender, renderComponent };
|
|
201
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/placeholder.svelte","../../src/placeholder.ts","../../src/render-component.ts","../../src/index.ts"],"sourcesContent":["<script>\nexport let content;\n</script>\n\n{content}","import type { SvelteComponentDev } from 'svelte/internal'\nimport { create_ssr_component, escape } from 'svelte/internal'\nimport PlaceholderClient from './placeholder.svelte'\n\ntype X = typeof PlaceholderClient\n\nconst PlaceholderServer = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${escape($$props.content)}`\n }\n) as any as typeof SvelteComponentDev\n\nexport default typeof document === 'undefined'\n ? PlaceholderServer\n : PlaceholderClient\n","import type { ComponentType, ComponentProps } from 'svelte'\nimport {\n SvelteComponent,\n claim_component,\n create_component,\n destroy_component,\n init,\n mount_component,\n noop,\n safe_not_equal,\n transition_in,\n transition_out,\n create_ssr_component,\n validate_component,\n} from 'svelte/internal'\n\nfunction create_fragment(ctx: any, Comp: any, props: any) {\n let c: any\n let current: any\n c = new Comp({ props, $$inline: true })\n\n return {\n c() {\n create_component(c.$$.fragment)\n },\n l(nodes: any) {\n claim_component(c.$$.fragment, nodes)\n },\n m(target: any, anchor: any) {\n // @ts-ignore\n mount_component(c, target, anchor)\n current = true\n },\n p: noop,\n i(local: any) {\n if (current) return\n transition_in(c.$$.fragment, local)\n current = true\n },\n o(local: any) {\n transition_out(c.$$.fragment, local)\n current = false\n },\n d(detaching: any) {\n destroy_component(c, detaching)\n },\n }\n}\n\nfunction renderClient<T>(\n Comp: T,\n props: T extends ComponentType<infer C> ? ComponentProps<C> : any\n) {\n return class WrapperComp extends SvelteComponent {\n constructor(options: any) {\n super()\n init(\n this,\n options,\n null,\n (ctx: any) => create_fragment(ctx, Comp, props),\n safe_not_equal,\n {},\n undefined\n )\n }\n }\n}\n\nfunction renderServer<T>(\n Comp: T,\n props: T extends ComponentType<infer C> ? ComponentProps<C> : any\n) {\n const WrapperComp = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${validate_component(Comp, 'TableComponent').$$render(\n $$result,\n props,\n {},\n {}\n )}`\n }\n )\n\n return WrapperComp\n}\n\nexport const renderComponent =\n typeof window === 'undefined' ? renderServer : renderClient\n","import {\n RowData,\n createTable,\n TableOptions,\n TableOptionsResolved,\n} from '@tanstack/table-core'\nimport Placeholder from './placeholder'\nimport { SvelteComponent } from 'svelte/internal'\nimport { readable, writable, derived, Readable, get } from 'svelte/store'\nimport { renderComponent } from './render-component'\n\nexport { renderComponent } from './render-component'\n\nexport * from '@tanstack/table-core'\n\nfunction isSvelteServerComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$render === 'function' &&\n typeof component.render === 'function'\n )\n}\n\nfunction isSvelteClientComponent(component: any) {\n let isHMR = '__SVELTE_HMR' in window\n\n return (\n component.prototype instanceof SvelteComponent ||\n (isHMR &&\n component.name?.startsWith('Proxy<') &&\n component.name?.endsWith('>'))\n )\n}\n\nfunction isSvelteComponent(component: any) {\n if (typeof document === 'undefined') {\n return isSvelteServerComponent(component)\n } else {\n return isSvelteClientComponent(component)\n }\n}\n\nfunction wrapInPlaceholder(content: any) {\n return renderComponent(Placeholder, { content })\n}\n\nexport function flexRender(component: any, props: any) {\n if (!component) return null\n\n if (isSvelteComponent(component)) {\n return renderComponent(component, props)\n }\n\n if (typeof component === 'function') {\n const result = component(props)\n\n if (isSvelteComponent(result)) {\n return result\n }\n\n return wrapInPlaceholder(result)\n }\n\n return wrapInPlaceholder(component)\n}\n\ntype ReadableOrVal<T> = T | Readable<T>\n\nexport function createSvelteTable<TData extends RowData>(\n options: ReadableOrVal<TableOptions<TData>>\n) {\n let optionsStore: Readable<TableOptions<TData>>\n\n if ('subscribe' in options) {\n optionsStore = options\n } else {\n optionsStore = readable(options)\n }\n\n let resolvedOptions: TableOptionsResolved<TData> = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...get(optionsStore),\n }\n\n let table = createTable(resolvedOptions)\n\n let stateStore = writable(/** @type {number} */ table.initialState)\n // combine stores\n let stateOptionsStore = derived([stateStore, optionsStore], s => s)\n const tableReadable = readable(table, function start(set) {\n const unsubscribe = stateOptionsStore.subscribe(([state, options]) => {\n table.setOptions(prev => {\n return {\n ...prev,\n ...options,\n state: { ...state, ...options.state },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n if (updater instanceof Function) {\n stateStore.update(updater)\n } else {\n stateStore.set(updater)\n }\n\n resolvedOptions.onStateChange?.(updater)\n },\n }\n })\n\n // it didn't seem to rerender without setting the table\n set(table)\n })\n\n return function stop() {\n unsubscribe()\n }\n })\n\n return tableReadable\n}\n"],"names":["PlaceholderServer","create_ssr_component","$$result","$$props","$$bindings","slots","escape","content","document","PlaceholderClient","create_fragment","ctx","Comp","props","c","current","$$inline","create_component","$$","fragment","l","nodes","claim_component","m","target","anchor","mount_component","p","noop","i","local","transition_in","o","transition_out","d","detaching","destroy_component","renderClient","WrapperComp","SvelteComponent","constructor","options","init","safe_not_equal","undefined","renderServer","validate_component","$$render","renderComponent","window","isSvelteServerComponent","component","render","isSvelteClientComponent","isHMR","prototype","name","startsWith","endsWith","isSvelteComponent","wrapInPlaceholder","Placeholder","flexRender","result","createSvelteTable","optionsStore","readable","resolvedOptions","state","onStateChange","renderFallbackValue","get","table","createTable","stateStore","writable","initialState","stateOptionsStore","derived","s","tableReadable","start","set","unsubscribe","subscribe","setOptions","prev","updater","Function","update","stop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBAIC,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;qCAAP,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;sDAAP,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;OAHG,OAAO,EAAA,GAAA,OAAA,CAAA;;;;;;;;;;;;;;;;ACKlB,MAAMA,iBAAiB,GAAGC,oBAAoB,CAC5C,CAACC,QAAa,EAAEC,OAAY,EAAEC,UAAe,EAAEC,KAAU,KAAK;AAC5D,EAAA,OAAQ,GAAEC,MAAM,CAACH,OAAO,CAACI,OAAO,CAAE,CAAC,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,OAAC,CAAC,CAAA;;AAEF;MACAL,GAAG,CAACV,KAAK,CAAC,CAAA;AACZ,KAAC,CAAC,CAAA;IAEF,OAAO,SAASkB,IAAI,GAAG;AACrBP,MAAAA,WAAW,EAAE,CAAA;KACd,CAAA;AACH,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,aAAa,CAAA;AACtB;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.js","sources":["../../src/placeholder.ts"],"sourcesContent":["import type { SvelteComponentDev } from 'svelte/internal'\nimport { create_ssr_component, escape } from 'svelte/internal'\nimport PlaceholderClient from './placeholder.svelte'\n\ntype X = typeof PlaceholderClient\n\nconst PlaceholderServer = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${escape($$props.content)}`\n }\n) as any as typeof SvelteComponentDev\n\nexport default typeof document === 'undefined'\n ? PlaceholderServer\n : PlaceholderClient\n"],"names":["PlaceholderServer","create_ssr_component","$$result","$$props","$$bindings","slots","escape","content","document","PlaceholderClient"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAMA,iBAAiB,GAAGC,6BAAoB,CAC5C,CAACC,QAAa,EAAEC,OAAY,EAAEC,UAAe,EAAEC,KAAU,KAAK;AAC5D,EAAA,OAAQ,GAAEC,eAAM,CAACH,OAAO,CAACI,OAAO,CAAE,CAAC,CAAA,CAAA;AACrC,CAAC,CACkC,CAAA;AAErC,kBAAe,OAAOC,QAAQ,KAAK,WAAW,GAC1CR,iBAAiB,GACjBS,sBAAiB;;;;"}
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
14
14
|
|
|
15
15
|
var internal = require('svelte/internal');
|
|
16
16
|
|
|
17
|
-
/* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.
|
|
17
|
+
/* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.54.0 */
|
|
18
18
|
|
|
19
19
|
function create_fragment(ctx) {
|
|
20
20
|
let t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.svelte.js","sources":["../../src/placeholder.svelte"],"sourcesContent":["<script>\nexport let content;\n</script>\n\n{content}"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iCAIC,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;+DAAP,GAAO,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;OAHG,OAAO,EAAA,GAAA,OAAA,CAAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentType, ComponentProps } from 'svelte';
|
|
2
|
+
import { noop } from 'svelte/internal';
|
|
3
|
+
declare function renderClient<T>(Comp: T, props: T extends ComponentType<infer C> ? ComponentProps<C> : any): {
|
|
4
|
+
new (options: any): {
|
|
5
|
+
$$: import("svelte/types/runtime/internal/types").T$$;
|
|
6
|
+
$$set?: (($$props: any) => void) | undefined;
|
|
7
|
+
$destroy(): void;
|
|
8
|
+
$on(type: any, callback: any): typeof noop;
|
|
9
|
+
$set($$props: any): void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
declare function renderServer<T>(Comp: T, props: T extends ComponentType<infer C> ? ComponentProps<C> : any): {
|
|
13
|
+
render: (props?: {} | undefined, { $$slots, context }?: {
|
|
14
|
+
$$slots?: {} | undefined;
|
|
15
|
+
context?: Map<any, any> | undefined;
|
|
16
|
+
} | undefined) => {
|
|
17
|
+
html: any;
|
|
18
|
+
css: {
|
|
19
|
+
code: string;
|
|
20
|
+
map: any;
|
|
21
|
+
};
|
|
22
|
+
head: string;
|
|
23
|
+
};
|
|
24
|
+
$$render: (result: any, props: any, bindings: any, slots: any, context: any) => any;
|
|
25
|
+
};
|
|
26
|
+
export declare const renderComponent: typeof renderServer | typeof renderClient;
|
|
27
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-component.js","sources":["../../src/render-component.ts"],"sourcesContent":["import type { ComponentType, ComponentProps } from 'svelte'\nimport {\n SvelteComponent,\n claim_component,\n create_component,\n destroy_component,\n init,\n mount_component,\n noop,\n safe_not_equal,\n transition_in,\n transition_out,\n create_ssr_component,\n validate_component,\n} from 'svelte/internal'\n\nfunction create_fragment(ctx: any, Comp: any, props: any) {\n let c: any\n let current: any\n c = new Comp({ props, $$inline: true })\n\n return {\n c() {\n create_component(c.$$.fragment)\n },\n l(nodes: any) {\n claim_component(c.$$.fragment, nodes)\n },\n m(target: any, anchor: any) {\n // @ts-ignore\n mount_component(c, target, anchor)\n current = true\n },\n p: noop,\n i(local: any) {\n if (current) return\n transition_in(c.$$.fragment, local)\n current = true\n },\n o(local: any) {\n transition_out(c.$$.fragment, local)\n current = false\n },\n d(detaching: any) {\n destroy_component(c, detaching)\n },\n }\n}\n\nfunction renderClient<T>(\n Comp: T,\n props: T extends ComponentType<infer C> ? ComponentProps<C> : any\n) {\n return class WrapperComp extends SvelteComponent {\n constructor(options: any) {\n super()\n init(\n this,\n options,\n null,\n (ctx: any) => create_fragment(ctx, Comp, props),\n safe_not_equal,\n {},\n undefined\n )\n }\n }\n}\n\nfunction renderServer<T>(\n Comp: T,\n props: T extends ComponentType<infer C> ? ComponentProps<C> : any\n) {\n const WrapperComp = create_ssr_component(\n ($$result: any, $$props: any, $$bindings: any, slots: any) => {\n return `${validate_component(Comp, 'TableComponent').$$render(\n $$result,\n props,\n {},\n {}\n )}`\n }\n )\n\n return WrapperComp\n}\n\nexport const renderComponent =\n typeof window === 'undefined' ? renderServer : renderClient\n"],"names":["create_fragment","ctx","Comp","props","c","current","$$inline","create_component","$$","fragment","l","nodes","claim_component","m","target","anchor","mount_component","p","noop","i","local","transition_in","o","transition_out","d","detaching","destroy_component","renderClient","WrapperComp","SvelteComponent","constructor","options","init","safe_not_equal","undefined","renderServer","create_ssr_component","$$result","$$props","$$bindings","slots","validate_component","$$render","renderComponent","window"],"mappings":";;;;;;;;;;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