@vertexvis/html-templates 0.24.6-canary.0 → 1.0.0-canary.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/dist/binding.d.ts +36 -36
- package/dist/{bundle.cjs.js → bundle.cjs} +231 -231
- package/dist/bundle.cjs.map +1 -0
- package/dist/{bundle.esm.js → bundle.js} +231 -231
- package/dist/bundle.js.map +1 -0
- package/dist/element-pool.d.ts +18 -18
- package/dist/index.d.ts +3 -3
- package/dist/templates.d.ts +7 -7
- package/package.json +25 -15
- package/dist/bundle.cjs.js.map +0 -1
- package/dist/bundle.esm.js.map +0 -1
package/dist/binding.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
export
|
|
2
|
-
export interface Binding {
|
|
3
|
-
bind<T extends BindingDataMap>(data: T): void;
|
|
4
|
-
}
|
|
5
|
-
export declare class CollectionBinding implements Binding {
|
|
6
|
-
private bindings;
|
|
7
|
-
constructor(bindings: Binding[]);
|
|
8
|
-
bind<T extends BindingDataMap>(data: T): void;
|
|
9
|
-
}
|
|
10
|
-
export declare abstract class NodeBinding<N extends Node> implements Binding {
|
|
11
|
-
protected node: N;
|
|
12
|
-
protected expr: string;
|
|
13
|
-
protected constructor(node: N, expr: string);
|
|
14
|
-
abstract bind<T extends BindingDataMap>(data: T): void;
|
|
15
|
-
}
|
|
16
|
-
export declare class TextNodeBinding extends NodeBinding<Node> {
|
|
17
|
-
constructor(node: Node, expr: string);
|
|
18
|
-
bind<T extends BindingDataMap>(data: T): void;
|
|
19
|
-
}
|
|
20
|
-
export declare class AttributeBinding extends NodeBinding<Element> {
|
|
21
|
-
private attr;
|
|
22
|
-
constructor(node: Element, expr: string, attr: string);
|
|
23
|
-
bind<T extends BindingDataMap>(data: T): void;
|
|
24
|
-
}
|
|
25
|
-
export declare class PropertyBinding extends NodeBinding<Element> {
|
|
26
|
-
private prop;
|
|
27
|
-
constructor(node: Element, expr: string, prop: string);
|
|
28
|
-
bind<T extends BindingDataMap>(data: T): void;
|
|
29
|
-
}
|
|
30
|
-
export declare class EventHandlerBinding extends NodeBinding<Element> {
|
|
31
|
-
private eventName;
|
|
32
|
-
private disposable?;
|
|
33
|
-
constructor(node: Element, expr: string, eventName: string);
|
|
34
|
-
bind<T extends BindingDataMap>(data: T): void;
|
|
35
|
-
}
|
|
36
|
-
export declare function generateBindings(node: Node): Binding[];
|
|
1
|
+
export type BindingDataMap = Record<string, any>;
|
|
2
|
+
export interface Binding {
|
|
3
|
+
bind<T extends BindingDataMap>(data: T): void;
|
|
4
|
+
}
|
|
5
|
+
export declare class CollectionBinding implements Binding {
|
|
6
|
+
private bindings;
|
|
7
|
+
constructor(bindings: Binding[]);
|
|
8
|
+
bind<T extends BindingDataMap>(data: T): void;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class NodeBinding<N extends Node> implements Binding {
|
|
11
|
+
protected node: N;
|
|
12
|
+
protected expr: string;
|
|
13
|
+
protected constructor(node: N, expr: string);
|
|
14
|
+
abstract bind<T extends BindingDataMap>(data: T): void;
|
|
15
|
+
}
|
|
16
|
+
export declare class TextNodeBinding extends NodeBinding<Node> {
|
|
17
|
+
constructor(node: Node, expr: string);
|
|
18
|
+
bind<T extends BindingDataMap>(data: T): void;
|
|
19
|
+
}
|
|
20
|
+
export declare class AttributeBinding extends NodeBinding<Element> {
|
|
21
|
+
private readonly attr;
|
|
22
|
+
constructor(node: Element, expr: string, attr: string);
|
|
23
|
+
bind<T extends BindingDataMap>(data: T): void;
|
|
24
|
+
}
|
|
25
|
+
export declare class PropertyBinding extends NodeBinding<Element> {
|
|
26
|
+
private prop;
|
|
27
|
+
constructor(node: Element, expr: string, prop: string);
|
|
28
|
+
bind<T extends BindingDataMap>(data: T): void;
|
|
29
|
+
}
|
|
30
|
+
export declare class EventHandlerBinding extends NodeBinding<Element> {
|
|
31
|
+
private eventName;
|
|
32
|
+
private disposable?;
|
|
33
|
+
constructor(node: Element, expr: string, eventName: string);
|
|
34
|
+
bind<T extends BindingDataMap>(data: T): void;
|
|
35
|
+
}
|
|
36
|
+
export declare function generateBindings(node: Node): Binding[];
|
|
@@ -67,240 +67,240 @@ function camelCase(input, options) {
|
|
|
67
67
|
return pascalCase(input, tslib.__assign({ transform: camelCaseTransform }, options));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const bindingRegEx = /{{(.+)}}/;
|
|
71
|
-
class CollectionBinding {
|
|
72
|
-
constructor(bindings) {
|
|
73
|
-
this.bindings = bindings;
|
|
74
|
-
}
|
|
75
|
-
bind(data) {
|
|
76
|
-
this.bindings.forEach((binding) => binding.bind(data));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
class NodeBinding {
|
|
80
|
-
constructor(node, expr) {
|
|
81
|
-
this.node = node;
|
|
82
|
-
this.expr = expr;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
class TextNodeBinding extends NodeBinding {
|
|
86
|
-
constructor(node, expr) {
|
|
87
|
-
super(node, expr);
|
|
88
|
-
}
|
|
89
|
-
bind(data) {
|
|
90
|
-
const newContent = replaceBindingString(data, this.expr);
|
|
91
|
-
if (newContent !== this.node.textContent) {
|
|
92
|
-
this.node.textContent = newContent;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
class AttributeBinding extends NodeBinding {
|
|
97
|
-
constructor(node, expr, attr) {
|
|
98
|
-
super(node, expr);
|
|
99
|
-
this.attr = attr;
|
|
100
|
-
}
|
|
101
|
-
bind(data) {
|
|
102
|
-
const newValue = replaceBindingString(data, this.expr);
|
|
103
|
-
const oldValue = this.node.getAttribute(this.attr);
|
|
104
|
-
if (oldValue !== newValue) {
|
|
105
|
-
this.node.setAttribute(this.attr, newValue);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
class PropertyBinding extends NodeBinding {
|
|
110
|
-
constructor(node, expr, prop) {
|
|
111
|
-
super(node, expr);
|
|
112
|
-
this.prop = prop;
|
|
113
|
-
}
|
|
114
|
-
bind(data) {
|
|
115
|
-
const newValue = replaceBinding(data, this.expr);
|
|
116
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
117
|
-
const oldValue = this.node[this.prop];
|
|
118
|
-
if (oldValue !== newValue) {
|
|
119
|
-
this.node[this.prop] = newValue;
|
|
120
|
-
}
|
|
121
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
class EventHandlerBinding extends NodeBinding {
|
|
125
|
-
constructor(node, expr, eventName) {
|
|
126
|
-
super(node, expr);
|
|
127
|
-
this.eventName = eventName;
|
|
128
|
-
}
|
|
129
|
-
bind(data) {
|
|
130
|
-
var _a;
|
|
131
|
-
const path = extractBindingPath(this.expr);
|
|
132
|
-
if (path != null) {
|
|
133
|
-
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
134
|
-
const listener = getBindableValue(data, path, true);
|
|
135
|
-
this.node.addEventListener(this.eventName, listener);
|
|
136
|
-
this.disposable = {
|
|
137
|
-
dispose: () => {
|
|
138
|
-
this.node.removeEventListener(this.eventName, listener);
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function generateBindings(node) {
|
|
145
|
-
const bindings = [];
|
|
146
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
147
|
-
const el = node;
|
|
148
|
-
const bindableAttributes = getBindableAttributes(el);
|
|
149
|
-
bindableAttributes.forEach((attr) => {
|
|
150
|
-
if (attr.name.startsWith('event:')) {
|
|
151
|
-
const eventName = camelCase(attr.name.replace('event:', ''));
|
|
152
|
-
bindings.push(new EventHandlerBinding(el, attr.value, eventName));
|
|
153
|
-
}
|
|
154
|
-
else if (attr.name.startsWith('attr:')) {
|
|
155
|
-
bindings.push(new AttributeBinding(el, attr.value, attr.name.replace('attr:', '')));
|
|
156
|
-
}
|
|
157
|
-
else if (attr.name.startsWith('prop:')) {
|
|
158
|
-
const propName = camelCase(attr.name.replace('prop:', ''));
|
|
159
|
-
bindings.push(new PropertyBinding(el, attr.value, propName));
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
else if (node.nodeType === Node.TEXT_NODE &&
|
|
164
|
-
node.textContent != null &&
|
|
165
|
-
bindingRegEx.test(node.textContent)) {
|
|
166
|
-
bindings.push(new TextNodeBinding(node, node.textContent));
|
|
167
|
-
}
|
|
168
|
-
for (let i = 0; i < node.childNodes.length; i++) {
|
|
169
|
-
bindings.push(...generateBindings(node.childNodes[i]));
|
|
170
|
-
}
|
|
171
|
-
return bindings;
|
|
172
|
-
}
|
|
173
|
-
function getBindableAttributes(element) {
|
|
174
|
-
return Array.from(element.attributes).filter((attr) => bindingRegEx.test(attr.value));
|
|
175
|
-
}
|
|
176
|
-
function extractBindingPath(expr) {
|
|
177
|
-
const result = bindingRegEx.exec(expr);
|
|
178
|
-
return result != null ? result[1] : undefined;
|
|
179
|
-
}
|
|
180
|
-
function replaceBindingString(data, expr) {
|
|
181
|
-
const path = extractBindingPath(expr);
|
|
182
|
-
if (path != null) {
|
|
183
|
-
const value = getBindableValue(data, path, true);
|
|
184
|
-
return expr.replace(`{{${path}}}`, value === null || value === void 0 ? void 0 : value.toString());
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
return expr;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
191
|
-
function replaceBinding(data, expr) {
|
|
192
|
-
const path = extractBindingPath(expr);
|
|
193
|
-
if (path != null) {
|
|
194
|
-
const value = getBindableValue(data, path, true);
|
|
195
|
-
return value;
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
return expr;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function getBindableValue(data, path, isHead = false
|
|
202
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
203
|
-
) {
|
|
204
|
-
const [head, ...tail] = path.split('.');
|
|
205
|
-
if (isHead && tail.length === 0) {
|
|
206
|
-
return data;
|
|
207
|
-
}
|
|
208
|
-
else if (isHead && tail.length > 0) {
|
|
209
|
-
return getBindableValue(data, tail.join('.'), false);
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
const value = data[head];
|
|
213
|
-
if (tail.length > 0) {
|
|
214
|
-
return getBindableValue(value, tail.join('.'), false);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
return value;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
70
|
+
const bindingRegEx = /{{(.+)}}/;
|
|
71
|
+
class CollectionBinding {
|
|
72
|
+
constructor(bindings) {
|
|
73
|
+
this.bindings = bindings;
|
|
74
|
+
}
|
|
75
|
+
bind(data) {
|
|
76
|
+
this.bindings.forEach((binding) => binding.bind(data));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class NodeBinding {
|
|
80
|
+
constructor(node, expr) {
|
|
81
|
+
this.node = node;
|
|
82
|
+
this.expr = expr;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
class TextNodeBinding extends NodeBinding {
|
|
86
|
+
constructor(node, expr) {
|
|
87
|
+
super(node, expr);
|
|
88
|
+
}
|
|
89
|
+
bind(data) {
|
|
90
|
+
const newContent = replaceBindingString(data, this.expr);
|
|
91
|
+
if (newContent !== this.node.textContent) {
|
|
92
|
+
this.node.textContent = newContent;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
class AttributeBinding extends NodeBinding {
|
|
97
|
+
constructor(node, expr, attr) {
|
|
98
|
+
super(node, expr);
|
|
99
|
+
this.attr = attr;
|
|
100
|
+
}
|
|
101
|
+
bind(data) {
|
|
102
|
+
const newValue = replaceBindingString(data, this.expr);
|
|
103
|
+
const oldValue = this.node.getAttribute(this.attr);
|
|
104
|
+
if (oldValue !== newValue) {
|
|
105
|
+
this.node.setAttribute(this.attr, newValue);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
class PropertyBinding extends NodeBinding {
|
|
110
|
+
constructor(node, expr, prop) {
|
|
111
|
+
super(node, expr);
|
|
112
|
+
this.prop = prop;
|
|
113
|
+
}
|
|
114
|
+
bind(data) {
|
|
115
|
+
const newValue = replaceBinding(data, this.expr);
|
|
116
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
117
|
+
const oldValue = this.node[this.prop];
|
|
118
|
+
if (oldValue !== newValue) {
|
|
119
|
+
this.node[this.prop] = newValue;
|
|
120
|
+
}
|
|
121
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
class EventHandlerBinding extends NodeBinding {
|
|
125
|
+
constructor(node, expr, eventName) {
|
|
126
|
+
super(node, expr);
|
|
127
|
+
this.eventName = eventName;
|
|
128
|
+
}
|
|
129
|
+
bind(data) {
|
|
130
|
+
var _a;
|
|
131
|
+
const path = extractBindingPath(this.expr);
|
|
132
|
+
if (path != null) {
|
|
133
|
+
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
134
|
+
const listener = getBindableValue(data, path, true);
|
|
135
|
+
this.node.addEventListener(this.eventName, listener);
|
|
136
|
+
this.disposable = {
|
|
137
|
+
dispose: () => {
|
|
138
|
+
this.node.removeEventListener(this.eventName, listener);
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function generateBindings(node) {
|
|
145
|
+
const bindings = [];
|
|
146
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
147
|
+
const el = node;
|
|
148
|
+
const bindableAttributes = getBindableAttributes(el);
|
|
149
|
+
bindableAttributes.forEach((attr) => {
|
|
150
|
+
if (attr.name.startsWith('event:')) {
|
|
151
|
+
const eventName = camelCase(attr.name.replace('event:', ''));
|
|
152
|
+
bindings.push(new EventHandlerBinding(el, attr.value, eventName));
|
|
153
|
+
}
|
|
154
|
+
else if (attr.name.startsWith('attr:')) {
|
|
155
|
+
bindings.push(new AttributeBinding(el, attr.value, attr.name.replace('attr:', '')));
|
|
156
|
+
}
|
|
157
|
+
else if (attr.name.startsWith('prop:')) {
|
|
158
|
+
const propName = camelCase(attr.name.replace('prop:', ''));
|
|
159
|
+
bindings.push(new PropertyBinding(el, attr.value, propName));
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else if (node.nodeType === Node.TEXT_NODE &&
|
|
164
|
+
node.textContent != null &&
|
|
165
|
+
bindingRegEx.test(node.textContent)) {
|
|
166
|
+
bindings.push(new TextNodeBinding(node, node.textContent));
|
|
167
|
+
}
|
|
168
|
+
for (let i = 0; i < node.childNodes.length; i++) {
|
|
169
|
+
bindings.push(...generateBindings(node.childNodes[i]));
|
|
170
|
+
}
|
|
171
|
+
return bindings;
|
|
172
|
+
}
|
|
173
|
+
function getBindableAttributes(element) {
|
|
174
|
+
return Array.from(element.attributes).filter((attr) => bindingRegEx.test(attr.value));
|
|
175
|
+
}
|
|
176
|
+
function extractBindingPath(expr) {
|
|
177
|
+
const result = bindingRegEx.exec(expr);
|
|
178
|
+
return result != null ? result[1] : undefined;
|
|
179
|
+
}
|
|
180
|
+
function replaceBindingString(data, expr) {
|
|
181
|
+
const path = extractBindingPath(expr);
|
|
182
|
+
if (path != null) {
|
|
183
|
+
const value = getBindableValue(data, path, true);
|
|
184
|
+
return expr.replace(`{{${path}}}`, value === null || value === void 0 ? void 0 : value.toString());
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return expr;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
191
|
+
function replaceBinding(data, expr) {
|
|
192
|
+
const path = extractBindingPath(expr);
|
|
193
|
+
if (path != null) {
|
|
194
|
+
const value = getBindableValue(data, path, true);
|
|
195
|
+
return value;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return expr;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function getBindableValue(data, path, isHead = false
|
|
202
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
203
|
+
) {
|
|
204
|
+
const [head, ...tail] = path.split('.');
|
|
205
|
+
if (isHead && tail.length === 0) {
|
|
206
|
+
return data;
|
|
207
|
+
}
|
|
208
|
+
else if (isHead && tail.length > 0) {
|
|
209
|
+
return getBindableValue(data, tail.join('.'), false);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const value = data[head];
|
|
213
|
+
if (tail.length > 0) {
|
|
214
|
+
return getBindableValue(value, tail.join('.'), false);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
class ElementPool {
|
|
223
|
-
constructor(container, elementFactory) {
|
|
224
|
-
this.container = container;
|
|
225
|
-
this.elementFactory = elementFactory;
|
|
226
|
-
this.instanceMap = new Map();
|
|
227
|
-
this.elements = [];
|
|
228
|
-
}
|
|
229
|
-
swapHeadToTail(count) {
|
|
230
|
-
const sliced = this.elements.splice(0, count);
|
|
231
|
-
this.elements.splice(this.elements.length, 0, ...sliced);
|
|
232
|
-
return this.elements.concat();
|
|
233
|
-
}
|
|
234
|
-
swapTailToHead(count) {
|
|
235
|
-
const sliced = this.elements.splice(-count, count);
|
|
236
|
-
this.elements.splice(0, 0, ...sliced);
|
|
237
|
-
return this.elements.concat();
|
|
238
|
-
}
|
|
239
|
-
updateElements(count) {
|
|
240
|
-
const diff = count - this.elements.length;
|
|
241
|
-
if (diff > 0) {
|
|
242
|
-
for (let i = 0; i < diff; i++) {
|
|
243
|
-
this.createElement();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
for (let i = 0; i < -diff; i++) {
|
|
248
|
-
this.deleteElement();
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return this.elements.concat();
|
|
252
|
-
}
|
|
253
|
-
updateData(f) {
|
|
254
|
-
this.elements.forEach((el, i) => {
|
|
255
|
-
const instance = this.instanceMap.get(el);
|
|
256
|
-
const data = f(i);
|
|
257
|
-
instance === null || instance === void 0 ? void 0 : instance.bindings.bind(data);
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
updateElementFactory(elementFactory) {
|
|
261
|
-
this.elementFactory = elementFactory;
|
|
262
|
-
this.updateElements(0);
|
|
263
|
-
}
|
|
264
|
-
iterateElements(f) {
|
|
265
|
-
this.elements.forEach((el, i) => {
|
|
266
|
-
const instance = this.instanceMap.get(el);
|
|
267
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
268
|
-
f(el, instance.bindings, i);
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
createElement() {
|
|
272
|
-
const instance = this.elementFactory();
|
|
273
|
-
this.elements.push(instance.element);
|
|
274
|
-
this.instanceMap.set(instance.element, instance);
|
|
275
|
-
this.container.append(instance.element);
|
|
276
|
-
return instance;
|
|
277
|
-
}
|
|
278
|
-
deleteElement() {
|
|
279
|
-
const element = this.elements.pop();
|
|
280
|
-
if (element != null) {
|
|
281
|
-
this.instanceMap.delete(element);
|
|
282
|
-
element.remove();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
222
|
+
class ElementPool {
|
|
223
|
+
constructor(container, elementFactory) {
|
|
224
|
+
this.container = container;
|
|
225
|
+
this.elementFactory = elementFactory;
|
|
226
|
+
this.instanceMap = new Map();
|
|
227
|
+
this.elements = [];
|
|
228
|
+
}
|
|
229
|
+
swapHeadToTail(count) {
|
|
230
|
+
const sliced = this.elements.splice(0, count);
|
|
231
|
+
this.elements.splice(this.elements.length, 0, ...sliced);
|
|
232
|
+
return this.elements.concat();
|
|
233
|
+
}
|
|
234
|
+
swapTailToHead(count) {
|
|
235
|
+
const sliced = this.elements.splice(-count, count);
|
|
236
|
+
this.elements.splice(0, 0, ...sliced);
|
|
237
|
+
return this.elements.concat();
|
|
238
|
+
}
|
|
239
|
+
updateElements(count) {
|
|
240
|
+
const diff = count - this.elements.length;
|
|
241
|
+
if (diff > 0) {
|
|
242
|
+
for (let i = 0; i < diff; i++) {
|
|
243
|
+
this.createElement();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
for (let i = 0; i < -diff; i++) {
|
|
248
|
+
this.deleteElement();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return this.elements.concat();
|
|
252
|
+
}
|
|
253
|
+
updateData(f) {
|
|
254
|
+
this.elements.forEach((el, i) => {
|
|
255
|
+
const instance = this.instanceMap.get(el);
|
|
256
|
+
const data = f(i);
|
|
257
|
+
instance === null || instance === void 0 ? void 0 : instance.bindings.bind(data);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
updateElementFactory(elementFactory) {
|
|
261
|
+
this.elementFactory = elementFactory;
|
|
262
|
+
this.updateElements(0);
|
|
263
|
+
}
|
|
264
|
+
iterateElements(f) {
|
|
265
|
+
this.elements.forEach((el, i) => {
|
|
266
|
+
const instance = this.instanceMap.get(el);
|
|
267
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
268
|
+
f(el, instance.bindings, i);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
createElement() {
|
|
272
|
+
const instance = this.elementFactory();
|
|
273
|
+
this.elements.push(instance.element);
|
|
274
|
+
this.instanceMap.set(instance.element, instance);
|
|
275
|
+
this.container.append(instance.element);
|
|
276
|
+
return instance;
|
|
277
|
+
}
|
|
278
|
+
deleteElement() {
|
|
279
|
+
const element = this.elements.pop();
|
|
280
|
+
if (element != null) {
|
|
281
|
+
this.instanceMap.delete(element);
|
|
282
|
+
element.remove();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
function append(container, element, data) {
|
|
288
|
-
const bindings = new CollectionBinding(generateBindings(element));
|
|
289
|
-
bindings.bind(data);
|
|
290
|
-
container.appendChild(element);
|
|
291
|
-
const created = container.lastElementChild;
|
|
292
|
-
if (created != null) {
|
|
293
|
-
return { element: created, bindings };
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
throw new Error('Failed to append element');
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function generateInstanceFromTemplate(template) {
|
|
300
|
-
const fragment = template.content.cloneNode(true);
|
|
301
|
-
const element = fragment.firstElementChild;
|
|
302
|
-
const bindings = new CollectionBinding(generateBindings(fragment));
|
|
303
|
-
return { element, bindings };
|
|
287
|
+
function append(container, element, data) {
|
|
288
|
+
const bindings = new CollectionBinding(generateBindings(element));
|
|
289
|
+
bindings.bind(data);
|
|
290
|
+
container.appendChild(element);
|
|
291
|
+
const created = container.lastElementChild;
|
|
292
|
+
if (created != null) {
|
|
293
|
+
return { element: created, bindings };
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
throw new Error('Failed to append element');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function generateInstanceFromTemplate(template) {
|
|
300
|
+
const fragment = template.content.cloneNode(true);
|
|
301
|
+
const element = fragment.firstElementChild;
|
|
302
|
+
const bindings = new CollectionBinding(generateBindings(fragment));
|
|
303
|
+
return { element, bindings };
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
exports.AttributeBinding = AttributeBinding;
|
|
@@ -313,4 +313,4 @@ exports.TextNodeBinding = TextNodeBinding;
|
|
|
313
313
|
exports.append = append;
|
|
314
314
|
exports.generateBindings = generateBindings;
|
|
315
315
|
exports.generateInstanceFromTemplate = generateInstanceFromTemplate;
|
|
316
|
-
//# sourceMappingURL=bundle.cjs.
|
|
316
|
+
//# sourceMappingURL=bundle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.cjs","sources":["../../../node_modules/lower-case/dist.es2015/index.js","../../../node_modules/no-case/dist.es2015/index.js","../../../node_modules/pascal-case/dist.es2015/index.js","../../../node_modules/camel-case/dist.es2015/index.js","../src/binding.ts","../src/element-pool.ts","../src/templates.ts"],"sourcesContent":["/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /\\u0130|\\u0049|\\u0049\\u0307/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n az: {\n regexp: /\\u0130/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n lt: {\n regexp: /\\u0049|\\u004A|\\u012E|\\u00CC|\\u00CD|\\u0128/g,\n map: {\n I: \"\\u0069\\u0307\",\n J: \"\\u006A\\u0307\",\n Į: \"\\u012F\\u0307\",\n Ì: \"\\u0069\\u0307\\u0300\",\n Í: \"\\u0069\\u0307\\u0301\",\n Ĩ: \"\\u0069\\u0307\\u0303\",\n },\n },\n};\n/**\n * Localized lower case.\n */\nexport function localeLowerCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return lowerCase(str);\n}\n/**\n * Lower case as a function.\n */\nexport function lowerCase(str) {\n return str.toLowerCase();\n}\n//# sourceMappingURL=index.js.map","import { lowerCase } from \"lower-case\";\n// Support camel case (\"camelCase\" -> \"camel Case\" and \"CAMELCase\" -> \"CAMEL Case\").\nvar DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];\n// Remove all non-word characters.\nvar DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;\n/**\n * Normalize the string into something other libraries can manipulate easier.\n */\nexport function noCase(input, options) {\n if (options === void 0) { options = {}; }\n var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? \" \" : _d;\n var result = replace(replace(input, splitRegexp, \"$1\\0$2\"), stripRegexp, \"\\0\");\n var start = 0;\n var end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\")\n start++;\n while (result.charAt(end - 1) === \"\\0\")\n end--;\n // Transform each token independently.\n return result.slice(start, end).split(\"\\0\").map(transform).join(delimiter);\n}\n/**\n * Replace `re` in the input string with the replacement value.\n */\nfunction replace(input, re, value) {\n if (re instanceof RegExp)\n return input.replace(re, value);\n return re.reduce(function (input, re) { return input.replace(re, value); }, input);\n}\n//# sourceMappingURL=index.js.map","import { __assign } from \"tslib\";\nimport { noCase } from \"no-case\";\nexport function pascalCaseTransform(input, index) {\n var firstChar = input.charAt(0);\n var lowerChars = input.substr(1).toLowerCase();\n if (index > 0 && firstChar >= \"0\" && firstChar <= \"9\") {\n return \"_\" + firstChar + lowerChars;\n }\n return \"\" + firstChar.toUpperCase() + lowerChars;\n}\nexport function pascalCaseTransformMerge(input) {\n return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();\n}\nexport function pascalCase(input, options) {\n if (options === void 0) { options = {}; }\n return noCase(input, __assign({ delimiter: \"\", transform: pascalCaseTransform }, options));\n}\n//# sourceMappingURL=index.js.map","import { __assign } from \"tslib\";\nimport { pascalCase, pascalCaseTransform, pascalCaseTransformMerge, } from \"pascal-case\";\nexport function camelCaseTransform(input, index) {\n if (index === 0)\n return input.toLowerCase();\n return pascalCaseTransform(input, index);\n}\nexport function camelCaseTransformMerge(input, index) {\n if (index === 0)\n return input.toLowerCase();\n return pascalCaseTransformMerge(input);\n}\nexport function camelCase(input, options) {\n if (options === void 0) { options = {}; }\n return pascalCase(input, __assign({ transform: camelCaseTransform }, options));\n}\n//# sourceMappingURL=index.js.map","import { Disposable } from '@vertexvis/utils';\nimport { camelCase } from 'camel-case';\n\nconst bindingRegEx = /{{(.+)}}/;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type BindingDataMap = Record<string, any>;\n\nexport interface Binding {\n bind<T extends BindingDataMap>(data: T): void;\n}\n\nexport class CollectionBinding implements Binding {\n public constructor(private bindings: Binding[]) {}\n\n public bind<T extends BindingDataMap>(data: T): void {\n this.bindings.forEach((binding) => binding.bind(data));\n }\n}\n\nexport abstract class NodeBinding<N extends Node> implements Binding {\n protected constructor(\n protected node: N,\n protected expr: string\n ) {}\n\n public abstract bind<T extends BindingDataMap>(data: T): void;\n}\n\nexport class TextNodeBinding extends NodeBinding<Node> {\n public constructor(node: Node, expr: string) {\n super(node, expr);\n }\n\n public bind<T extends BindingDataMap>(data: T): void {\n const newContent = replaceBindingString(data, this.expr);\n if (newContent !== this.node.textContent) {\n this.node.textContent = newContent;\n }\n }\n}\n\nexport class AttributeBinding extends NodeBinding<Element> {\n public constructor(\n node: Element,\n expr: string,\n private readonly attr: string\n ) {\n super(node, expr);\n }\n\n public bind<T extends BindingDataMap>(data: T): void {\n const newValue = replaceBindingString(data, this.expr);\n const oldValue = this.node.getAttribute(this.attr);\n if (oldValue !== newValue) {\n this.node.setAttribute(this.attr, newValue);\n }\n }\n}\n\nexport class PropertyBinding extends NodeBinding<Element> {\n public constructor(\n node: Element,\n expr: string,\n private prop: string\n ) {\n super(node, expr);\n }\n\n public bind<T extends BindingDataMap>(data: T): void {\n const newValue = replaceBinding(data, this.expr);\n /* eslint-disable @typescript-eslint/no-explicit-any */\n const oldValue = (this.node as any)[this.prop];\n if (oldValue !== newValue) {\n (this.node as any)[this.prop] = newValue;\n }\n /* eslint-enable @typescript-eslint/no-explicit-any */\n }\n}\n\nexport class EventHandlerBinding extends NodeBinding<Element> {\n private disposable?: Disposable;\n\n public constructor(\n node: Element,\n expr: string,\n private eventName: string\n ) {\n super(node, expr);\n }\n\n public bind<T extends BindingDataMap>(data: T): void {\n const path = extractBindingPath(this.expr);\n if (path != null) {\n this.disposable?.dispose();\n\n const listener = getBindableValue(data, path, true);\n this.node.addEventListener(this.eventName, listener);\n\n this.disposable = {\n dispose: () => {\n this.node.removeEventListener(this.eventName, listener);\n },\n };\n }\n }\n}\n\nexport function generateBindings(node: Node): Binding[] {\n const bindings: Binding[] = [];\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n const el = node as HTMLElement;\n const bindableAttributes = getBindableAttributes(el);\n\n bindableAttributes.forEach((attr) => {\n if (attr.name.startsWith('event:')) {\n const eventName = camelCase(attr.name.replace('event:', ''));\n bindings.push(new EventHandlerBinding(el, attr.value, eventName));\n } else if (attr.name.startsWith('attr:')) {\n bindings.push(\n new AttributeBinding(el, attr.value, attr.name.replace('attr:', ''))\n );\n } else if (attr.name.startsWith('prop:')) {\n const propName = camelCase(attr.name.replace('prop:', ''));\n bindings.push(new PropertyBinding(el, attr.value, propName));\n }\n });\n } else if (\n node.nodeType === Node.TEXT_NODE &&\n node.textContent != null &&\n bindingRegEx.test(node.textContent)\n ) {\n bindings.push(new TextNodeBinding(node, node.textContent));\n }\n\n for (let i = 0; i < node.childNodes.length; i++) {\n bindings.push(...generateBindings(node.childNodes[i]));\n }\n\n return bindings;\n}\n\nfunction getBindableAttributes(element: Element): Attr[] {\n return Array.from(element.attributes).filter((attr) =>\n bindingRegEx.test(attr.value)\n );\n}\n\nfunction extractBindingPath(expr: string): string | undefined {\n const result = bindingRegEx.exec(expr);\n return result != null ? result[1] : undefined;\n}\n\nfunction replaceBindingString(data: BindingDataMap, expr: string): string {\n const path = extractBindingPath(expr);\n if (path != null) {\n const value = getBindableValue(data, path, true);\n return expr.replace(`{{${path}}}`, value?.toString());\n } else {\n return expr;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction replaceBinding(data: BindingDataMap, expr: string): any {\n const path = extractBindingPath(expr);\n if (path != null) {\n const value = getBindableValue(data, path, true);\n return value;\n } else {\n return expr;\n }\n}\n\nfunction getBindableValue(\n data: BindingDataMap,\n path: string,\n isHead = false\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n const [head, ...tail] = path.split('.');\n if (isHead && tail.length === 0) {\n return data;\n } else if (isHead && tail.length > 0) {\n return getBindableValue(data, tail.join('.'), false);\n } else {\n const value = data[head];\n if (tail.length > 0) {\n return getBindableValue(value, tail.join('.'), false);\n } else {\n return value;\n }\n }\n}\n","import { Binding, BindingDataMap } from './binding';\nimport { InstancedTemplate } from './templates';\n\nexport type ElementFactory = () => InstancedTemplate<HTMLElement>;\n\nexport class ElementPool {\n private readonly elements: HTMLElement[];\n private instanceMap = new Map<HTMLElement, InstancedTemplate<HTMLElement>>();\n\n public constructor(\n private container: Element,\n private elementFactory: ElementFactory\n ) {\n this.elements = [];\n }\n\n public swapHeadToTail(count: number): HTMLElement[] {\n const sliced = this.elements.splice(0, count);\n this.elements.splice(this.elements.length, 0, ...sliced);\n return this.elements.concat();\n }\n\n public swapTailToHead(count: number): HTMLElement[] {\n const sliced = this.elements.splice(-count, count);\n this.elements.splice(0, 0, ...sliced);\n return this.elements.concat();\n }\n\n public updateElements(count: number): HTMLElement[] {\n const diff = count - this.elements.length;\n\n if (diff > 0) {\n for (let i = 0; i < diff; i++) {\n this.createElement();\n }\n } else {\n for (let i = 0; i < -diff; i++) {\n this.deleteElement();\n }\n }\n\n return this.elements.concat();\n }\n\n public updateData<D extends BindingDataMap>(f: (index: number) => D): void {\n this.elements.forEach((el, i) => {\n const instance = this.instanceMap.get(el);\n const data = f(i);\n instance?.bindings.bind(data);\n });\n }\n\n public updateElementFactory(elementFactory: ElementFactory): void {\n this.elementFactory = elementFactory;\n this.updateElements(0);\n }\n\n public iterateElements(\n f: (element: HTMLElement, binding: Binding, index: number) => void\n ): void {\n this.elements.forEach((el, i) => {\n const instance = this.instanceMap.get(el);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n f(el, instance!.bindings, i);\n });\n }\n\n private createElement(): InstancedTemplate<HTMLElement> {\n const instance = this.elementFactory();\n this.elements.push(instance.element);\n this.instanceMap.set(instance.element, instance);\n this.container.append(instance.element);\n return instance;\n }\n\n private deleteElement(): void {\n const element = this.elements.pop();\n if (element != null) {\n this.instanceMap.delete(element);\n element.remove();\n }\n }\n}\n","import { BindingDataMap, CollectionBinding, generateBindings } from './binding';\n\nexport interface InstancedTemplate<E extends Element> {\n element: E;\n bindings: CollectionBinding;\n}\n\nexport function append<E extends Element, D extends BindingDataMap>(\n container: Element,\n element: E,\n data: D\n): InstancedTemplate<E> {\n const bindings = new CollectionBinding(generateBindings(element));\n bindings.bind(data);\n container.appendChild(element);\n const created = container.lastElementChild as E;\n if (created != null) {\n return { element: created, bindings };\n } else {\n throw new Error('Failed to append element');\n }\n}\n\nexport function generateInstanceFromTemplate(\n template: HTMLTemplateElement\n): InstancedTemplate<HTMLElement> {\n const fragment = template.content.cloneNode(true) as HTMLElement;\n const element = fragment.firstElementChild as HTMLElement;\n const bindings = new CollectionBinding(generateBindings(fragment));\n return { element, bindings };\n}\n"],"names":["__assign"],"mappings":";;;;;;AAAA;AACA;AACA;AAuCA;AACA;AACA;AACO,SAAS,SAAS,CAAC,GAAG,EAAE;AAC/B,IAAI,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC7B;;AC7CA;AACA,IAAI,oBAAoB,GAAG,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;AAC1E;AACA,IAAI,oBAAoB,GAAG,cAAc,CAAC;AAC1C;AACA;AACA;AACO,SAAS,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE;AACvC,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AAC7C,IAAI,IAAI,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,oBAAoB,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,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