@universal-ember/table 3.5.0 → 3.6.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/package.json +1 -1
- package/src/-private/interfaces/table.ts +25 -21
- package/src/-private/table.ts +7 -2
- package/src/plugins/column-reordering/plugin.ts +4 -6
- package/declarations/-private/-type-tests/plugin-properties.test.d.ts +0 -2
- package/declarations/-private/-type-tests/plugin-properties.test.d.ts.map +0 -1
- package/declarations/-private/-type-tests/plugin-with.test.d.ts +0 -2
- package/declarations/-private/-type-tests/plugin-with.test.d.ts.map +0 -1
- package/declarations/-private/-type-tests/plugins-accessors.test.d.ts +0 -2
- package/declarations/-private/-type-tests/plugins-accessors.test.d.ts.map +0 -1
- package/declarations/-private/-type-tests/plugins-signature-from.test.d.ts +0 -2
- package/declarations/-private/-type-tests/plugins-signature-from.test.d.ts.map +0 -1
- package/declarations/-private/-type-tests/plugins-signature-utils.test.d.ts +0 -2
- package/declarations/-private/-type-tests/plugins-signature-utils.test.d.ts.map +0 -1
- package/declarations/-private/-type-tests/table-api.test.d.ts +0 -2
- package/declarations/-private/-type-tests/table-api.test.d.ts.map +0 -1
- package/declarations/-private/-type-tests/table-config.test.d.ts +0 -2
- package/declarations/-private/-type-tests/table-config.test.d.ts.map +0 -1
- package/declarations/-private/column.d.ts +0 -18
- package/declarations/-private/column.d.ts.map +0 -1
- package/declarations/-private/ember-compat.d.ts +0 -8
- package/declarations/-private/ember-compat.d.ts.map +0 -1
- package/declarations/-private/interfaces/column.d.ts +0 -63
- package/declarations/-private/interfaces/column.d.ts.map +0 -1
- package/declarations/-private/interfaces/index.d.ts +0 -8
- package/declarations/-private/interfaces/index.d.ts.map +0 -1
- package/declarations/-private/interfaces/modifier.d.ts +0 -7
- package/declarations/-private/interfaces/modifier.d.ts.map +0 -1
- package/declarations/-private/interfaces/pagination.d.ts +0 -17
- package/declarations/-private/interfaces/pagination.d.ts.map +0 -1
- package/declarations/-private/interfaces/plugins.d.ts +0 -315
- package/declarations/-private/interfaces/plugins.d.ts.map +0 -1
- package/declarations/-private/interfaces/preferences.d.ts +0 -74
- package/declarations/-private/interfaces/preferences.d.ts.map +0 -1
- package/declarations/-private/interfaces/selection.d.ts +0 -36
- package/declarations/-private/interfaces/selection.d.ts.map +0 -1
- package/declarations/-private/interfaces/table.d.ts +0 -122
- package/declarations/-private/interfaces/table.d.ts.map +0 -1
- package/declarations/-private/js-helper.d.ts +0 -39
- package/declarations/-private/js-helper.d.ts.map +0 -1
- package/declarations/-private/preferences.d.ts +0 -47
- package/declarations/-private/preferences.d.ts.map +0 -1
- package/declarations/-private/private-types.d.ts +0 -6
- package/declarations/-private/private-types.d.ts.map +0 -1
- package/declarations/-private/row.d.ts +0 -12
- package/declarations/-private/row.d.ts.map +0 -1
- package/declarations/-private/table.d.ts +0 -136
- package/declarations/-private/table.d.ts.map +0 -1
- package/declarations/-private/utils.d.ts +0 -3
- package/declarations/-private/utils.d.ts.map +0 -1
- package/declarations/index.d.ts +0 -14
- package/declarations/index.d.ts.map +0 -1
- package/declarations/plugins/-private/base.d.ts +0 -281
- package/declarations/plugins/-private/base.d.ts.map +0 -1
- package/declarations/plugins/-private/utils.d.ts +0 -22
- package/declarations/plugins/-private/utils.d.ts.map +0 -1
- package/declarations/plugins/column-reordering/helpers.d.ts +0 -54
- package/declarations/plugins/column-reordering/helpers.d.ts.map +0 -1
- package/declarations/plugins/column-reordering/index.d.ts +0 -5
- package/declarations/plugins/column-reordering/index.d.ts.map +0 -1
- package/declarations/plugins/column-reordering/plugin.d.ts +0 -196
- package/declarations/plugins/column-reordering/plugin.d.ts.map +0 -1
- package/declarations/plugins/column-reordering/utils.d.ts +0 -8
- package/declarations/plugins/column-reordering/utils.d.ts.map +0 -1
- package/declarations/plugins/column-resizing/handle.d.ts +0 -128
- package/declarations/plugins/column-resizing/handle.d.ts.map +0 -1
- package/declarations/plugins/column-resizing/helpers.d.ts +0 -40
- package/declarations/plugins/column-resizing/helpers.d.ts.map +0 -1
- package/declarations/plugins/column-resizing/index.d.ts +0 -6
- package/declarations/plugins/column-resizing/index.d.ts.map +0 -1
- package/declarations/plugins/column-resizing/plugin.d.ts +0 -172
- package/declarations/plugins/column-resizing/plugin.d.ts.map +0 -1
- package/declarations/plugins/column-resizing/resize-observer.d.ts +0 -14
- package/declarations/plugins/column-resizing/resize-observer.d.ts.map +0 -1
- package/declarations/plugins/column-resizing/utils.d.ts +0 -22
- package/declarations/plugins/column-resizing/utils.d.ts.map +0 -1
- package/declarations/plugins/column-visibility/helpers.d.ts +0 -18
- package/declarations/plugins/column-visibility/helpers.d.ts.map +0 -1
- package/declarations/plugins/column-visibility/index.d.ts +0 -5
- package/declarations/plugins/column-visibility/index.d.ts.map +0 -1
- package/declarations/plugins/column-visibility/plugin.d.ts +0 -64
- package/declarations/plugins/column-visibility/plugin.d.ts.map +0 -1
- package/declarations/plugins/data-sorting/helpers.d.ts +0 -38
- package/declarations/plugins/data-sorting/helpers.d.ts.map +0 -1
- package/declarations/plugins/data-sorting/index.d.ts +0 -7
- package/declarations/plugins/data-sorting/index.d.ts.map +0 -1
- package/declarations/plugins/data-sorting/plugin.d.ts +0 -102
- package/declarations/plugins/data-sorting/plugin.d.ts.map +0 -1
- package/declarations/plugins/data-sorting/types.d.ts +0 -23
- package/declarations/plugins/data-sorting/types.d.ts.map +0 -1
- package/declarations/plugins/index.d.ts +0 -6
- package/declarations/plugins/index.d.ts.map +0 -1
- package/declarations/plugins/metadata/helpers.d.ts +0 -4
- package/declarations/plugins/metadata/helpers.d.ts.map +0 -1
- package/declarations/plugins/metadata/index.d.ts +0 -5
- package/declarations/plugins/metadata/index.d.ts.map +0 -1
- package/declarations/plugins/metadata/plugin.d.ts +0 -25
- package/declarations/plugins/metadata/plugin.d.ts.map +0 -1
- package/declarations/plugins/row-selection/helpers.d.ts +0 -6
- package/declarations/plugins/row-selection/helpers.d.ts.map +0 -1
- package/declarations/plugins/row-selection/index.d.ts +0 -5
- package/declarations/plugins/row-selection/index.d.ts.map +0 -1
- package/declarations/plugins/row-selection/plugin.d.ts +0 -80
- package/declarations/plugins/row-selection/plugin.d.ts.map +0 -1
- package/declarations/plugins/sticky-columns/helpers.d.ts +0 -17
- package/declarations/plugins/sticky-columns/helpers.d.ts.map +0 -1
- package/declarations/plugins/sticky-columns/index.d.ts +0 -5
- package/declarations/plugins/sticky-columns/index.d.ts.map +0 -1
- package/declarations/plugins/sticky-columns/plugin.d.ts +0 -70
- package/declarations/plugins/sticky-columns/plugin.d.ts.map +0 -1
- package/declarations/test-support/index.d.ts +0 -15
- package/declarations/test-support/index.d.ts.map +0 -1
- package/declarations/utils.d.ts +0 -26
- package/declarations/utils.d.ts.map +0 -1
- package/dist/-private/-type-tests/plugin-properties.test.js +0 -27
- package/dist/-private/-type-tests/plugin-properties.test.js.map +0 -1
- package/dist/-private/-type-tests/plugin-with.test.js +0 -20
- package/dist/-private/-type-tests/plugin-with.test.js.map +0 -1
- package/dist/-private/-type-tests/plugins-accessors.test.js +0 -36
- package/dist/-private/-type-tests/plugins-accessors.test.js.map +0 -1
- package/dist/-private/-type-tests/plugins-signature-from.test.js +0 -15
- package/dist/-private/-type-tests/plugins-signature-from.test.js.map +0 -1
- package/dist/-private/-type-tests/plugins-signature-utils.test.js +0 -36
- package/dist/-private/-type-tests/plugins-signature-utils.test.js.map +0 -1
- package/dist/-private/-type-tests/table-api.test.js +0 -17
- package/dist/-private/-type-tests/table-api.test.js.map +0 -1
- package/dist/-private/-type-tests/table-config.test.js +0 -55
- package/dist/-private/-type-tests/table-config.test.js.map +0 -1
- package/dist/-private/column.js +0 -62
- package/dist/-private/column.js.map +0 -1
- package/dist/-private/ember-compat.js +0 -17
- package/dist/-private/ember-compat.js.map +0 -1
- package/dist/-private/interfaces/column.js +0 -2
- package/dist/-private/interfaces/column.js.map +0 -1
- package/dist/-private/interfaces/index.js +0 -2
- package/dist/-private/interfaces/index.js.map +0 -1
- package/dist/-private/interfaces/modifier.js +0 -2
- package/dist/-private/interfaces/modifier.js.map +0 -1
- package/dist/-private/interfaces/pagination.js +0 -2
- package/dist/-private/interfaces/pagination.js.map +0 -1
- package/dist/-private/interfaces/plugins.js +0 -2
- package/dist/-private/interfaces/plugins.js.map +0 -1
- package/dist/-private/interfaces/preferences.js +0 -2
- package/dist/-private/interfaces/preferences.js.map +0 -1
- package/dist/-private/interfaces/selection.js +0 -2
- package/dist/-private/interfaces/selection.js.map +0 -1
- package/dist/-private/interfaces/table.js +0 -2
- package/dist/-private/interfaces/table.js.map +0 -1
- package/dist/-private/js-helper.js +0 -55
- package/dist/-private/js-helper.js.map +0 -1
- package/dist/-private/preferences.js +0 -149
- package/dist/-private/preferences.js.map +0 -1
- package/dist/-private/private-types.js +0 -2
- package/dist/-private/private-types.js.map +0 -1
- package/dist/-private/row.js +0 -51
- package/dist/-private/row.js.map +0 -1
- package/dist/-private/table.js +0 -273
- package/dist/-private/table.js.map +0 -1
- package/dist/-private/utils.js +0 -15
- package/dist/-private/utils.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-CjaRjJZX.js +0 -63
- package/dist/_rollupPluginBabelHelpers-CjaRjJZX.js.map +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/plugins/-private/base.js +0 -532
- package/dist/plugins/-private/base.js.map +0 -1
- package/dist/plugins/-private/utils.js +0 -103
- package/dist/plugins/-private/utils.js.map +0 -1
- package/dist/plugins/column-reordering/helpers.js +0 -81
- package/dist/plugins/column-reordering/helpers.js.map +0 -1
- package/dist/plugins/column-reordering/index.js +0 -3
- package/dist/plugins/column-reordering/index.js.map +0 -1
- package/dist/plugins/column-reordering/plugin.js +0 -453
- package/dist/plugins/column-reordering/plugin.js.map +0 -1
- package/dist/plugins/column-reordering/utils.js +0 -34
- package/dist/plugins/column-reordering/utils.js.map +0 -1
- package/dist/plugins/column-resizing/handle.js +0 -243
- package/dist/plugins/column-resizing/handle.js.map +0 -1
- package/dist/plugins/column-resizing/helpers.js +0 -77
- package/dist/plugins/column-resizing/helpers.js.map +0 -1
- package/dist/plugins/column-resizing/index.js +0 -4
- package/dist/plugins/column-resizing/index.js.map +0 -1
- package/dist/plugins/column-resizing/plugin.js +0 -365
- package/dist/plugins/column-resizing/plugin.js.map +0 -1
- package/dist/plugins/column-resizing/resize-observer.js +0 -44
- package/dist/plugins/column-resizing/resize-observer.js.map +0 -1
- package/dist/plugins/column-resizing/utils.js +0 -44
- package/dist/plugins/column-resizing/utils.js.map +0 -1
- package/dist/plugins/column-visibility/helpers.js +0 -25
- package/dist/plugins/column-visibility/helpers.js.map +0 -1
- package/dist/plugins/column-visibility/index.js +0 -3
- package/dist/plugins/column-visibility/index.js.map +0 -1
- package/dist/plugins/column-visibility/plugin.js +0 -92
- package/dist/plugins/column-visibility/plugin.js.map +0 -1
- package/dist/plugins/data-sorting/helpers.js +0 -49
- package/dist/plugins/data-sorting/helpers.js.map +0 -1
- package/dist/plugins/data-sorting/index.js +0 -4
- package/dist/plugins/data-sorting/index.js.map +0 -1
- package/dist/plugins/data-sorting/plugin.js +0 -132
- package/dist/plugins/data-sorting/plugin.js.map +0 -1
- package/dist/plugins/data-sorting/types.js +0 -14
- package/dist/plugins/data-sorting/types.js.map +0 -1
- package/dist/plugins/index.js +0 -3
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/metadata/helpers.js +0 -12
- package/dist/plugins/metadata/helpers.js.map +0 -1
- package/dist/plugins/metadata/index.js +0 -3
- package/dist/plugins/metadata/index.js.map +0 -1
- package/dist/plugins/metadata/plugin.js +0 -25
- package/dist/plugins/metadata/plugin.js.map +0 -1
- package/dist/plugins/row-selection/helpers.js +0 -10
- package/dist/plugins/row-selection/helpers.js.map +0 -1
- package/dist/plugins/row-selection/index.js +0 -3
- package/dist/plugins/row-selection/index.js.map +0 -1
- package/dist/plugins/row-selection/plugin.js +0 -118
- package/dist/plugins/row-selection/plugin.js.map +0 -1
- package/dist/plugins/sticky-columns/helpers.js +0 -49
- package/dist/plugins/sticky-columns/helpers.js.map +0 -1
- package/dist/plugins/sticky-columns/index.js +0 -3
- package/dist/plugins/sticky-columns/index.js.map +0 -1
- package/dist/plugins/sticky-columns/plugin.js +0 -139
- package/dist/plugins/sticky-columns/plugin.js.map +0 -1
- package/dist/test-support/index.js +0 -62
- package/dist/test-support/index.js.map +0 -1
- package/dist/utils.js +0 -77
- package/dist/utils.js.map +0 -1
package/dist/-private/table.js
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { a as _applyDecoratedDescriptor, _ as _defineProperty, b as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-CjaRjJZX.js';
|
|
2
|
-
import { tracked, cached } from '@glimmer/tracking';
|
|
3
|
-
import { assert } from '@ember/debug';
|
|
4
|
-
import { action } from '@ember/object';
|
|
5
|
-
import { guidFor } from '@ember/object/internals';
|
|
6
|
-
import { macroCondition, isDevelopingApp } from '@embroider/macros';
|
|
7
|
-
import { modifier } from 'ember-modifier';
|
|
8
|
-
import { Resource } from 'ember-modify-based-class-resource';
|
|
9
|
-
import { map } from 'reactiveweb/map';
|
|
10
|
-
import { normalizePluginsConfig, verifyPlugins } from '../plugins/-private/utils.js';
|
|
11
|
-
import { Column } from './column.js';
|
|
12
|
-
import { TablePreferences } from './preferences.js';
|
|
13
|
-
import { Row } from './row.js';
|
|
14
|
-
import { composeFunctionModifiers } from './utils.js';
|
|
15
|
-
import { compatOwner } from './ember-compat.js';
|
|
16
|
-
|
|
17
|
-
var _class, _descriptor, _descriptor2, _descriptor3;
|
|
18
|
-
const getOwner = compatOwner.getOwner;
|
|
19
|
-
const setOwner = compatOwner.setOwner;
|
|
20
|
-
const DEFAULT_COLUMN_CONFIG = {
|
|
21
|
-
isVisible: true,
|
|
22
|
-
minWidth: 128
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Because the table is our entry-point object to all the table behaviors,
|
|
26
|
-
* we need a stable way to know which table we have.
|
|
27
|
-
* Normally, this could be done with referential integrity / identity.
|
|
28
|
-
* However, due to how resources are implemented, if the consumer opts to
|
|
29
|
-
* not use the `@use` decorator, then proxies get involved.
|
|
30
|
-
* The proxies don't maintain instanceof checks, which may be a bug in
|
|
31
|
-
* ember-resources.
|
|
32
|
-
*/
|
|
33
|
-
const TABLE_KEY = Symbol('__TABLE_KEY__');
|
|
34
|
-
const TABLE_META_KEY = Symbol('__TABLE_META__');
|
|
35
|
-
const COLUMN_META_KEY = Symbol('__COLUMN_META__');
|
|
36
|
-
const ROW_META_KEY = Symbol('__ROW_META__');
|
|
37
|
-
const attachContainer = (element, table) => {
|
|
38
|
-
assert('Must be installed on an HTMLElement', element instanceof HTMLElement);
|
|
39
|
-
table.scrollContainerElement = element;
|
|
40
|
-
};
|
|
41
|
-
let Table = (_class = class Table extends Resource {
|
|
42
|
-
constructor(...args) {
|
|
43
|
-
super(...args);
|
|
44
|
-
/**
|
|
45
|
-
* @private
|
|
46
|
-
*/
|
|
47
|
-
_defineProperty(this, TABLE_KEY, guidFor(this));
|
|
48
|
-
/**
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
_defineProperty(this, TABLE_META_KEY, new Map());
|
|
52
|
-
/**
|
|
53
|
-
* @private
|
|
54
|
-
*/
|
|
55
|
-
_defineProperty(this, COLUMN_META_KEY, new WeakMap());
|
|
56
|
-
/**
|
|
57
|
-
* @private
|
|
58
|
-
*/
|
|
59
|
-
_defineProperty(this, ROW_META_KEY, new WeakMap());
|
|
60
|
-
/**
|
|
61
|
-
* @private
|
|
62
|
-
*
|
|
63
|
-
* Unused for now, may be used in the future.
|
|
64
|
-
* This data is collected along with the scrollContainerWidth, (which is currently in use)
|
|
65
|
-
*/
|
|
66
|
-
_initializerDefineProperty(this, "scrollContainerHeight", _descriptor, this);
|
|
67
|
-
/**
|
|
68
|
-
* @private
|
|
69
|
-
*
|
|
70
|
-
* Used to help determine how much space we can give to columns.
|
|
71
|
-
* As we generate widths for columns, the columns' widths must
|
|
72
|
-
* add up to about this number.
|
|
73
|
-
*/
|
|
74
|
-
_initializerDefineProperty(this, "scrollContainerWidth", _descriptor2, this);
|
|
75
|
-
/**
|
|
76
|
-
* @private
|
|
77
|
-
*
|
|
78
|
-
* Lazy way to delay consuming arguments until they are needed.
|
|
79
|
-
*/
|
|
80
|
-
_initializerDefineProperty(this, "args", _descriptor3, this);
|
|
81
|
-
/**
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
_defineProperty(this, "scrollContainerElement", void 0);
|
|
85
|
-
/**
|
|
86
|
-
* Collection of utility modifiers that are the result of composing modifiers
|
|
87
|
-
* from plugins.
|
|
88
|
-
*
|
|
89
|
-
* Using this is optional, and you can "just" use modifiers from specific plugins
|
|
90
|
-
* in specific places if you wish -- but these exists as a "convenience".
|
|
91
|
-
*
|
|
92
|
-
* These are all no-use, no-cost utilities
|
|
93
|
-
*/
|
|
94
|
-
_defineProperty(this, "modifiers", {
|
|
95
|
-
container: modifier(element => {
|
|
96
|
-
const modifiers = this.plugins.map(plugin => plugin.containerModifier);
|
|
97
|
-
const composed = composeFunctionModifiers([attachContainer, ...modifiers]);
|
|
98
|
-
return composed(element, this);
|
|
99
|
-
}),
|
|
100
|
-
// resize: ResizeModifier,
|
|
101
|
-
// TODO: switch to composing real modifiers once "curry" and "compose"
|
|
102
|
-
// RFCs are accepted and implemented
|
|
103
|
-
//
|
|
104
|
-
// Atm the moment, if _any_ header modifier's tracked data changes,
|
|
105
|
-
// all the functions for all of the plugins run again.
|
|
106
|
-
//
|
|
107
|
-
// With curried+composed modifiers, only the plugin's headerModifier
|
|
108
|
-
// that has tracked changes would run, leaving the other modifiers alone
|
|
109
|
-
columnHeader: modifier((element, [column]) => {
|
|
110
|
-
const modifiers = this.plugins.map(plugin => plugin.headerCellModifier);
|
|
111
|
-
const composed = composeFunctionModifiers(modifiers);
|
|
112
|
-
return composed(element, {
|
|
113
|
-
column,
|
|
114
|
-
table: this
|
|
115
|
-
});
|
|
116
|
-
}),
|
|
117
|
-
row: modifier((element, [row]) => {
|
|
118
|
-
const modifiers = this.plugins.map(plugin => plugin.rowModifier);
|
|
119
|
-
const composed = composeFunctionModifiers(modifiers);
|
|
120
|
-
return composed(element, {
|
|
121
|
-
row,
|
|
122
|
-
table: this
|
|
123
|
-
});
|
|
124
|
-
})
|
|
125
|
-
});
|
|
126
|
-
_defineProperty(this, "rows", map(this, {
|
|
127
|
-
data: () => {
|
|
128
|
-
const dataFn = this.args.named?.data;
|
|
129
|
-
if (!dataFn) return [];
|
|
130
|
-
return dataFn() ?? [];
|
|
131
|
-
},
|
|
132
|
-
map: datum => new Row(this, datum)
|
|
133
|
-
}));
|
|
134
|
-
_defineProperty(this, "columns", map(this, {
|
|
135
|
-
data: () => {
|
|
136
|
-
const configFn = this.args.named?.columns;
|
|
137
|
-
if (!configFn) return [];
|
|
138
|
-
const result = configFn() ?? [];
|
|
139
|
-
if (macroCondition(isDevelopingApp())) {
|
|
140
|
-
/**
|
|
141
|
-
* Assertions for a column config to be valid:
|
|
142
|
-
* - every key must be unique
|
|
143
|
-
*/
|
|
144
|
-
const keys = new Set();
|
|
145
|
-
const allKeys = result.map(columnConfig => columnConfig.key);
|
|
146
|
-
result.forEach(columnConfig => {
|
|
147
|
-
if (keys.has(columnConfig.key)) {
|
|
148
|
-
throw new Error(`Every column key in the table's column config must be unique. ` + `Found duplicate entry: ${columnConfig.key}. ` + `All keys used: ${allKeys}`);
|
|
149
|
-
}
|
|
150
|
-
keys.add(columnConfig.key);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
return result;
|
|
154
|
-
},
|
|
155
|
-
map: config => {
|
|
156
|
-
return new Column(this, {
|
|
157
|
-
...DEFAULT_COLUMN_CONFIG,
|
|
158
|
-
...config
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}));
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Interact with, save, modify, etc the preferences for the table,
|
|
165
|
-
* plugins, columns, etc
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @private
|
|
170
|
-
*/
|
|
171
|
-
modify(_, named) {
|
|
172
|
-
this.args = {
|
|
173
|
-
named
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// only set the preferences once
|
|
177
|
-
if (!this.preferences) {
|
|
178
|
-
const {
|
|
179
|
-
key = guidFor(this),
|
|
180
|
-
adapter
|
|
181
|
-
} = named?.preferences ?? {};
|
|
182
|
-
|
|
183
|
-
// TODO: when no key is present,
|
|
184
|
-
// use "local-storage" preferences.
|
|
185
|
-
// it does not make sense to use a guid in a user's preferences
|
|
186
|
-
this.preferences = new TablePreferences(key, adapter);
|
|
187
|
-
} else {
|
|
188
|
-
// subsequent updates to args
|
|
189
|
-
this.resetScrollContainer();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* @private
|
|
194
|
-
*
|
|
195
|
-
* For all configured plugins, instantiates each one.
|
|
196
|
-
* If the plugins argument changes to the Table (either directly or through
|
|
197
|
-
* headlessTable, all state is lost and re-created)
|
|
198
|
-
*/
|
|
199
|
-
get plugins() {
|
|
200
|
-
const plugins = normalizePluginsConfig(this.args.named?.plugins);
|
|
201
|
-
verifyPlugins(plugins);
|
|
202
|
-
return plugins.map(tuple => {
|
|
203
|
-
// We don't need the options here
|
|
204
|
-
const [PluginClass] = tuple;
|
|
205
|
-
if (typeof PluginClass === 'function') {
|
|
206
|
-
const plugin = new PluginClass(this);
|
|
207
|
-
const owner = getOwner(this);
|
|
208
|
-
assert(`The Table does not have an owner. cannot create a plugin without an owner`, owner);
|
|
209
|
-
setOwner(plugin, owner);
|
|
210
|
-
return plugin;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// This is a plugin object, rather than a class
|
|
214
|
-
// TODO: add test coverage around using classless plugins
|
|
215
|
-
return PluginClass;
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Get the active plugin instance for the given plugin class
|
|
221
|
-
*/
|
|
222
|
-
pluginOf(klass) {
|
|
223
|
-
const result = this.plugins.find(plugin => plugin instanceof klass);
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* This is an unsafe cast, because Instance could be unrelated to any of the types
|
|
227
|
-
* that matches Plugin[]
|
|
228
|
-
*
|
|
229
|
-
* For example, `table.pluginOf(MyCustomPlugin)`, where MyCustomPlugin isn't in the
|
|
230
|
-
* `plugins` list. This partially a problem with how Array.prototype.find doesn't
|
|
231
|
-
* effectively narrow for what we want (combined with TS being clunky around
|
|
232
|
-
* comparing Instance and Class types).
|
|
233
|
-
*/
|
|
234
|
-
return result;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* @private
|
|
239
|
-
*
|
|
240
|
-
* used by other private APIs
|
|
241
|
-
*/
|
|
242
|
-
get config() {
|
|
243
|
-
return this.args.named;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* @private
|
|
247
|
-
*/
|
|
248
|
-
resetScrollContainer() {
|
|
249
|
-
if (!this.scrollContainerElement) return;
|
|
250
|
-
this.scrollContainerElement.scrollTop = 0;
|
|
251
|
-
}
|
|
252
|
-
resetToDefaults() {
|
|
253
|
-
this.plugins.forEach(plugin => plugin.reset?.());
|
|
254
|
-
}
|
|
255
|
-
}, _descriptor = _applyDecoratedDescriptor(_class.prototype, "scrollContainerHeight", [tracked], {
|
|
256
|
-
configurable: true,
|
|
257
|
-
enumerable: true,
|
|
258
|
-
writable: true,
|
|
259
|
-
initializer: null
|
|
260
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "scrollContainerWidth", [tracked], {
|
|
261
|
-
configurable: true,
|
|
262
|
-
enumerable: true,
|
|
263
|
-
writable: true,
|
|
264
|
-
initializer: null
|
|
265
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "args", [tracked], {
|
|
266
|
-
configurable: true,
|
|
267
|
-
enumerable: true,
|
|
268
|
-
writable: true,
|
|
269
|
-
initializer: null
|
|
270
|
-
}), _applyDecoratedDescriptor(_class.prototype, "plugins", [cached], Object.getOwnPropertyDescriptor(_class.prototype, "plugins"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resetScrollContainer", [action], Object.getOwnPropertyDescriptor(_class.prototype, "resetScrollContainer"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resetToDefaults", [action], Object.getOwnPropertyDescriptor(_class.prototype, "resetToDefaults"), _class.prototype), _class);
|
|
271
|
-
|
|
272
|
-
export { COLUMN_META_KEY, ROW_META_KEY, TABLE_KEY, TABLE_META_KEY, Table };
|
|
273
|
-
//# sourceMappingURL=table.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sources":["../../src/-private/table.ts"],"sourcesContent":["import { cached, tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { action } from '@ember/object';\nimport { guidFor } from '@ember/object/internals';\n\nimport { isDevelopingApp, macroCondition } from '@embroider/macros';\nimport { modifier } from 'ember-modifier';\nimport { Resource } from 'ember-modify-based-class-resource';\nimport { map } from 'reactiveweb/map';\n\nimport {\n normalizePluginsConfig,\n verifyPlugins,\n} from '../plugins/-private/utils.ts';\nimport { Column } from './column.ts';\nimport { TablePreferences } from './preferences.ts';\nimport { Row } from './row.ts';\nimport { composeFunctionModifiers } from './utils.ts';\n\nimport type { BasePlugin, Plugin } from '../plugins/index.ts';\nimport type { Class } from './private-types.ts';\nimport type { Destructor, TableConfig } from './interfaces';\nimport { compatOwner } from './ember-compat.ts';\n\nconst getOwner = compatOwner.getOwner;\nconst setOwner = compatOwner.setOwner;\n\nconst DEFAULT_COLUMN_CONFIG = {\n isVisible: true,\n minWidth: 128,\n};\n\ninterface Signature<DataType> {\n Named: TableConfig<DataType>;\n}\n\n/**\n * Because the table is our entry-point object to all the table behaviors,\n * we need a stable way to know which table we have.\n * Normally, this could be done with referential integrity / identity.\n * However, due to how resources are implemented, if the consumer opts to\n * not use the `@use` decorator, then proxies get involved.\n * The proxies don't maintain instanceof checks, which may be a bug in\n * ember-resources.\n */\nexport const TABLE_KEY = Symbol('__TABLE_KEY__');\nexport const TABLE_META_KEY = Symbol('__TABLE_META__');\nexport const COLUMN_META_KEY = Symbol('__COLUMN_META__');\nexport const ROW_META_KEY = Symbol('__ROW_META__');\n\nconst attachContainer = (element: Element, table: Table) => {\n assert('Must be installed on an HTMLElement', element instanceof HTMLElement);\n\n table.scrollContainerElement = element;\n};\n\nexport class Table<DataType = unknown> extends Resource<Signature<DataType>> {\n /**\n * @private\n */\n [TABLE_KEY] = guidFor(this);\n /**\n * @private\n */\n [TABLE_META_KEY] = new Map<Class<unknown>, any>();\n /**\n * @private\n */\n [COLUMN_META_KEY] = new WeakMap<Column, Map<Class<unknown>, any>>();\n /**\n * @private\n */\n [ROW_META_KEY] = new WeakMap<Row, Map<Class<unknown>, any>>();\n\n /**\n * @private\n *\n * Unused for now, may be used in the future.\n * This data is collected along with the scrollContainerWidth, (which is currently in use)\n */\n @tracked scrollContainerHeight?: number;\n\n /**\n * @private\n *\n * Used to help determine how much space we can give to columns.\n * As we generate widths for columns, the columns' widths must\n * add up to about this number.\n */\n @tracked scrollContainerWidth?: number;\n\n /**\n * @private\n *\n * Lazy way to delay consuming arguments until they are needed.\n */\n @tracked declare args: { named: Signature<DataType>['Named'] };\n\n /**\n * @private\n */\n scrollContainerElement?: HTMLElement;\n\n /**\n * Interact with, save, modify, etc the preferences for the table,\n * plugins, columns, etc\n */\n declare preferences: TablePreferences;\n\n /**\n * @private\n */\n modify(_: [] | undefined, named: Signature<DataType>['Named']) {\n this.args = { named };\n\n // only set the preferences once\n if (!this.preferences) {\n const { key = guidFor(this), adapter } = named?.preferences ?? {};\n\n // TODO: when no key is present,\n // use \"local-storage\" preferences.\n // it does not make sense to use a guid in a user's preferences\n this.preferences = new TablePreferences(key, adapter);\n } else {\n // subsequent updates to args\n this.resetScrollContainer();\n }\n }\n\n /**\n * Collection of utility modifiers that are the result of composing modifiers\n * from plugins.\n *\n * Using this is optional, and you can \"just\" use modifiers from specific plugins\n * in specific places if you wish -- but these exists as a \"convenience\".\n *\n * These are all no-use, no-cost utilities\n */\n modifiers = {\n container: modifier((element: HTMLElement): Destructor => {\n const modifiers = this.plugins.map((plugin) => plugin.containerModifier);\n const composed = composeFunctionModifiers([\n attachContainer,\n ...modifiers,\n ]);\n\n return composed(element, this as Table<unknown>);\n }),\n\n // resize: ResizeModifier,\n // TODO: switch to composing real modifiers once \"curry\" and \"compose\"\n // RFCs are accepted and implemented\n //\n // Atm the moment, if _any_ header modifier's tracked data changes,\n // all the functions for all of the plugins run again.\n //\n // With curried+composed modifiers, only the plugin's headerModifier\n // that has tracked changes would run, leaving the other modifiers alone\n columnHeader: modifier(\n (element: HTMLElement, [column]: [Column<DataType>]): Destructor => {\n const modifiers = this.plugins.map(\n (plugin) => plugin.headerCellModifier,\n );\n const composed = composeFunctionModifiers(modifiers);\n\n return composed(element, { column, table: this });\n },\n ),\n\n row: modifier(\n (element: HTMLElement, [row]: [Row<DataType>]): Destructor => {\n const modifiers = this.plugins.map((plugin) => plugin.rowModifier);\n const composed = composeFunctionModifiers(modifiers);\n\n return composed(element, { row, table: this });\n },\n ),\n };\n\n /**\n * @private\n *\n * For all configured plugins, instantiates each one.\n * If the plugins argument changes to the Table (either directly or through\n * headlessTable, all state is lost and re-created)\n */\n @cached\n get plugins(): Plugin[] {\n const plugins = normalizePluginsConfig(this.args.named?.plugins);\n\n verifyPlugins(plugins);\n\n return plugins.map((tuple) => {\n // We don't need the options here\n const [PluginClass] = tuple;\n\n if (typeof PluginClass === 'function') {\n const plugin = new PluginClass(this);\n\n const owner = getOwner(this);\n\n assert(\n `The Table does not have an owner. cannot create a plugin without an owner`,\n owner,\n );\n setOwner(plugin, owner);\n\n return plugin;\n }\n\n // This is a plugin object, rather than a class\n // TODO: add test coverage around using classless plugins\n return PluginClass;\n });\n }\n\n /**\n * Get the active plugin instance for the given plugin class\n */\n pluginOf<Instance extends BasePlugin<any>>(\n klass: Class<Instance>,\n ): Instance | undefined {\n const result = this.plugins.find((plugin) => plugin instanceof klass);\n\n /**\n * This is an unsafe cast, because Instance could be unrelated to any of the types\n * that matches Plugin[]\n *\n * For example, `table.pluginOf(MyCustomPlugin)`, where MyCustomPlugin isn't in the\n * `plugins` list. This partially a problem with how Array.prototype.find doesn't\n * effectively narrow for what we want (combined with TS being clunky around\n * comparing Instance and Class types).\n */\n return result as unknown as Instance | undefined;\n }\n\n /**\n * @private\n *\n * used by other private APIs\n */\n get config() {\n return this.args.named;\n }\n\n rows = map(this, {\n data: () => {\n const dataFn = this.args.named?.data;\n\n if (!dataFn) return [];\n\n return dataFn() ?? [];\n },\n map: (datum) => new Row(this, datum),\n });\n\n columns = map(this, {\n data: () => {\n const configFn = this.args.named?.columns;\n\n if (!configFn) return [];\n\n const result = configFn() ?? [];\n\n if (macroCondition(isDevelopingApp())) {\n /**\n * Assertions for a column config to be valid:\n * - every key must be unique\n */\n const keys = new Set();\n const allKeys = result.map((columnConfig) => columnConfig.key);\n\n result.forEach((columnConfig) => {\n if (keys.has(columnConfig.key)) {\n throw new Error(\n `Every column key in the table's column config must be unique. ` +\n `Found duplicate entry: ${columnConfig.key}. ` +\n `All keys used: ${allKeys}`,\n );\n }\n\n keys.add(columnConfig.key);\n });\n }\n\n return result;\n },\n map: (config) => {\n return new Column<DataType>(this, {\n ...DEFAULT_COLUMN_CONFIG,\n ...config,\n });\n },\n });\n\n /**\n * @private\n */\n @action\n resetScrollContainer() {\n if (!this.scrollContainerElement) return;\n\n this.scrollContainerElement.scrollTop = 0;\n }\n\n @action\n resetToDefaults() {\n this.plugins.forEach((plugin) => plugin.reset?.());\n }\n}\n"],"names":["getOwner","compatOwner","setOwner","DEFAULT_COLUMN_CONFIG","isVisible","minWidth","TABLE_KEY","Symbol","TABLE_META_KEY","COLUMN_META_KEY","ROW_META_KEY","attachContainer","element","table","assert","HTMLElement","scrollContainerElement","Table","_class","Resource","constructor","args","_defineProperty","guidFor","Map","WeakMap","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","container","modifier","modifiers","plugins","map","plugin","containerModifier","composed","composeFunctionModifiers","columnHeader","column","headerCellModifier","row","rowModifier","data","dataFn","named","datum","Row","configFn","columns","result","macroCondition","isDevelopingApp","keys","Set","allKeys","columnConfig","key","forEach","has","Error","add","config","Column","modify","_","preferences","adapter","TablePreferences","resetScrollContainer","normalizePluginsConfig","verifyPlugins","tuple","PluginClass","owner","pluginOf","klass","find","scrollTop","resetToDefaults","reset","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","cached","Object","getOwnPropertyDescriptor","action"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAMA,QAAQ,GAAGC,WAAW,CAACD,QAAQ;AACrC,MAAME,QAAQ,GAAGD,WAAW,CAACC,QAAQ;AAErC,MAAMC,qBAAqB,GAAG;AAC5BC,EAAAA,SAAS,EAAE,IAAI;AACfC,EAAAA,QAAQ,EAAE;AACZ,CAAC;AAMD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaC,SAAS,GAAGC,MAAM,CAAC,eAAe;MAClCC,cAAc,GAAGD,MAAM,CAAC,gBAAgB;MACxCE,eAAe,GAAGF,MAAM,CAAC,iBAAiB;MAC1CG,YAAY,GAAGH,MAAM,CAAC,cAAc;AAEjD,MAAMI,eAAe,GAAGA,CAACC,OAAgB,EAAEC,KAAY,KAAK;AAC1DC,EAAAA,MAAM,CAAC,qCAAqC,EAAEF,OAAO,YAAYG,WAAW,CAAC;EAE7EF,KAAK,CAACG,sBAAsB,GAAGJ,OAAO;AACxC,CAAC;AAEYK,IAAAA,KAAK,IAAAC,MAAA,GAAX,MAAMD,KAAK,SAA6BE,QAAQ,CAAsB;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;AAC3E;AACF;AACA;AAFEC,IAAAA,eAAA,OAGChB,SAAS,EAAIiB,OAAO,CAAC,IA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AA,EAAA,iBAAA,EAAA,CAONS,MAAM,CAAA,EAAAF,MAAA,CAAAC,wBAAA,CAAAzE,MAAA,CAAAiE,SAAA,EAAA,iBAAA,CAAA,EAAAjE,MAAA,CAAAiE,SAAA,CAAA,EAAAjE,MAAA;;;;"}
|
package/dist/-private/utils.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
function composeFunctionModifiers(modifiers) {
|
|
2
|
-
const setup = modifiers.filter(Boolean);
|
|
3
|
-
const composed = (element, ...args) => {
|
|
4
|
-
const destructors = setup.map(fn => fn(element, ...args)).filter(Boolean);
|
|
5
|
-
return () => {
|
|
6
|
-
for (const destructor of destructors) {
|
|
7
|
-
destructor();
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
return composed;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { composeFunctionModifiers };
|
|
15
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/-private/utils.ts"],"sourcesContent":["import type { Destructor, FunctionModifier } from './interfaces';\n\nexport function composeFunctionModifiers<Args extends unknown[]>(\n modifiers: Array<FunctionModifier<Args> | undefined>,\n) {\n const setup = modifiers.filter(Boolean) as FunctionModifier<Args>[];\n\n const composed = (element: HTMLElement, ...args: Args) => {\n const destructors = setup\n .map((fn) => fn(element, ...args))\n .filter(Boolean) as Destructor[];\n\n return () => {\n for (const destructor of destructors) {\n destructor();\n }\n };\n };\n\n return composed;\n}\n"],"names":["composeFunctionModifiers","modifiers","setup","filter","Boolean","composed","element","args","destructors","map","fn","destructor"],"mappings":"AAEO,SAASA,wBAAwBA,CACtCC,SAAoD,EACpD;AACA,EAAA,MAAMC,KAAK,GAAGD,SAAS,CAACE,MAAM,CAACC,OAAO,CAA6B;AAEnE,EAAA,MAAMC,QAAQ,GAAGA,CAACC,OAAoB,EAAE,GAAGC,IAAU,KAAK;IACxD,MAAMC,WAAW,GAAGN,KAAK,CACtBO,GAAG,CAAEC,EAAE,IAAKA,EAAE,CAACJ,OAAO,EAAE,GAAGC,IAAI,CAAC,CAAC,CACjCJ,MAAM,CAACC,OAAO,CAAiB;AAElC,IAAA,OAAO,MAAM;AACX,MAAA,KAAK,MAAMO,UAAU,IAAIH,WAAW,EAAE;AACpCG,QAAAA,UAAU,EAAE;AACd;KACD;GACF;AAED,EAAA,OAAON,QAAQ;AACjB;;;;"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
|
2
|
-
var a = {};
|
|
3
|
-
return Object.keys(n).forEach(function (i) {
|
|
4
|
-
a[i] = n[i];
|
|
5
|
-
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = true), a = r.slice().reverse().reduce(function (r, n) {
|
|
6
|
-
return n(i, e, r) || r;
|
|
7
|
-
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
|
8
|
-
}
|
|
9
|
-
function _assertClassBrand(e, t, n) {
|
|
10
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
11
|
-
throw new TypeError("Private element is not present on this object");
|
|
12
|
-
}
|
|
13
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
14
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
15
|
-
}
|
|
16
|
-
function _classPrivateFieldGet2(s, a) {
|
|
17
|
-
return s.get(_assertClassBrand(s, a));
|
|
18
|
-
}
|
|
19
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
20
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
21
|
-
}
|
|
22
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
23
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
24
|
-
}
|
|
25
|
-
function _classPrivateGetter(s, r, a) {
|
|
26
|
-
return a(_assertClassBrand(s, r));
|
|
27
|
-
}
|
|
28
|
-
function _classPrivateMethodInitSpec(e, a) {
|
|
29
|
-
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
30
|
-
}
|
|
31
|
-
function _defineProperty(e, r, t) {
|
|
32
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
33
|
-
value: t,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true
|
|
37
|
-
}) : e[r] = t, e;
|
|
38
|
-
}
|
|
39
|
-
function _initializerDefineProperty(e, i, r, l) {
|
|
40
|
-
r && Object.defineProperty(e, i, {
|
|
41
|
-
enumerable: r.enumerable,
|
|
42
|
-
configurable: r.configurable,
|
|
43
|
-
writable: r.writable,
|
|
44
|
-
value: r.initializer ? r.initializer.call(l) : void 0
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
function _toPrimitive(t, r) {
|
|
48
|
-
if ("object" != typeof t || !t) return t;
|
|
49
|
-
var e = t[Symbol.toPrimitive];
|
|
50
|
-
if (void 0 !== e) {
|
|
51
|
-
var i = e.call(t, r);
|
|
52
|
-
if ("object" != typeof i) return i;
|
|
53
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
54
|
-
}
|
|
55
|
-
return ("string" === r ? String : Number)(t);
|
|
56
|
-
}
|
|
57
|
-
function _toPropertyKey(t) {
|
|
58
|
-
var i = _toPrimitive(t, "string");
|
|
59
|
-
return "symbol" == typeof i ? i : i + "";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { _defineProperty as _, _applyDecoratedDescriptor as a, _initializerDefineProperty as b, _classPrivateMethodInitSpec as c, _classPrivateGetter as d, _classPrivateFieldGet2 as e, _classPrivateFieldInitSpec as f, _classPrivateFieldSet2 as g, _assertClassBrand as h };
|
|
63
|
-
//# sourceMappingURL=_rollupPluginBabelHelpers-CjaRjJZX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers-CjaRjJZX.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|