grainjs 1.0.1 → 1.1.0
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/README.md +23 -26
- package/dist/cjs/index.js +28 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/PriorityQueue.d.ts +2 -2
- package/dist/cjs/lib/PriorityQueue.js +1 -0
- package/dist/cjs/lib/PriorityQueue.js.map +1 -1
- package/dist/cjs/lib/_computed_queue.js +4 -3
- package/dist/cjs/lib/_computed_queue.js.map +1 -1
- package/dist/cjs/lib/binding.d.ts +11 -4
- package/dist/cjs/lib/binding.js +6 -5
- package/dist/cjs/lib/binding.js.map +1 -1
- package/dist/cjs/lib/browserGlobals.d.ts +4 -1
- package/dist/cjs/lib/browserGlobals.js +2 -0
- package/dist/cjs/lib/browserGlobals.js.map +1 -1
- package/dist/cjs/lib/computed.d.ts +49 -28
- package/dist/cjs/lib/computed.js +38 -51
- package/dist/cjs/lib/computed.js.map +1 -1
- package/dist/cjs/lib/dispose.d.ts +109 -96
- package/dist/cjs/lib/dispose.js +106 -79
- package/dist/cjs/lib/dispose.js.map +1 -1
- package/dist/cjs/lib/dom.d.ts +40 -18
- package/dist/cjs/lib/dom.js +63 -29
- package/dist/cjs/lib/dom.js.map +1 -1
- package/dist/cjs/lib/domComponent.d.ts +56 -51
- package/dist/cjs/lib/domComponent.js +46 -44
- package/dist/cjs/lib/domComponent.js.map +1 -1
- package/dist/cjs/lib/domComputed.d.ts +50 -20
- package/dist/cjs/lib/domComputed.js +37 -7
- package/dist/cjs/lib/domComputed.js.map +1 -1
- package/dist/cjs/lib/domDispose.d.ts +27 -12
- package/dist/cjs/lib/domDispose.js +27 -11
- package/dist/cjs/lib/domDispose.js.map +1 -1
- package/dist/cjs/lib/domForEach.d.ts +5 -4
- package/dist/cjs/lib/domForEach.js +41 -41
- package/dist/cjs/lib/domForEach.js.map +1 -1
- package/dist/cjs/lib/domImpl.d.ts +33 -10
- package/dist/cjs/lib/domImpl.js +29 -9
- package/dist/cjs/lib/domImpl.js.map +1 -1
- package/dist/cjs/lib/domMethods.d.ts +93 -47
- package/dist/cjs/lib/domMethods.js +91 -47
- package/dist/cjs/lib/domMethods.js.map +1 -1
- package/dist/cjs/lib/domevent.d.ts +87 -62
- package/dist/cjs/lib/domevent.js +85 -59
- package/dist/cjs/lib/domevent.js.map +1 -1
- package/dist/cjs/lib/emit.d.ts +62 -32
- package/dist/cjs/lib/emit.js +68 -53
- package/dist/cjs/lib/emit.js.map +1 -1
- package/dist/cjs/lib/kowrap.d.ts +6 -3
- package/dist/cjs/lib/kowrap.js +7 -3
- package/dist/cjs/lib/kowrap.js.map +1 -1
- package/dist/cjs/lib/obsArray.d.ts +91 -53
- package/dist/cjs/lib/obsArray.js +87 -54
- package/dist/cjs/lib/obsArray.js.map +1 -1
- package/dist/cjs/lib/observable.d.ts +25 -15
- package/dist/cjs/lib/observable.js +31 -19
- package/dist/cjs/lib/observable.js.map +1 -1
- package/dist/cjs/lib/pureComputed.d.ts +12 -15
- package/dist/cjs/lib/pureComputed.js +16 -18
- package/dist/cjs/lib/pureComputed.js.map +1 -1
- package/dist/cjs/lib/styled.d.ts +78 -61
- package/dist/cjs/lib/styled.js +27 -79
- package/dist/cjs/lib/styled.js.map +1 -1
- package/dist/cjs/lib/subscribe.d.ts +41 -37
- package/dist/cjs/lib/subscribe.js +31 -39
- package/dist/cjs/lib/subscribe.js.map +1 -1
- package/dist/cjs/lib/util.js +2 -0
- package/dist/cjs/lib/util.js.map +1 -1
- package/dist/cjs/lib/widgets/input.d.ts +3 -1
- package/dist/cjs/lib/widgets/input.js +7 -4
- package/dist/cjs/lib/widgets/input.js.map +1 -1
- package/dist/cjs/lib/widgets/select.d.ts +4 -2
- package/dist/cjs/lib/widgets/select.js +8 -5
- package/dist/cjs/lib/widgets/select.js.map +1 -1
- package/dist/esm/lib/_computed_queue.js +3 -3
- package/dist/esm/lib/_computed_queue.js.map +1 -1
- package/dist/esm/lib/binding.js +2 -2
- package/dist/esm/lib/binding.js.map +1 -1
- package/dist/esm/lib/browserGlobals.js +1 -0
- package/dist/esm/lib/browserGlobals.js.map +1 -1
- package/dist/esm/lib/computed.js +36 -50
- package/dist/esm/lib/computed.js.map +1 -1
- package/dist/esm/lib/dispose.js +104 -78
- package/dist/esm/lib/dispose.js.map +1 -1
- package/dist/esm/lib/dom.js +40 -18
- package/dist/esm/lib/dom.js.map +1 -1
- package/dist/esm/lib/domComponent.js +45 -44
- package/dist/esm/lib/domComponent.js.map +1 -1
- package/dist/esm/lib/domComputed.js +32 -5
- package/dist/esm/lib/domComputed.js.map +1 -1
- package/dist/esm/lib/domDispose.js +26 -11
- package/dist/esm/lib/domDispose.js.map +1 -1
- package/dist/esm/lib/domForEach.js +40 -41
- package/dist/esm/lib/domForEach.js.map +1 -1
- package/dist/esm/lib/domImpl.js +26 -7
- package/dist/esm/lib/domImpl.js.map +1 -1
- package/dist/esm/lib/domMethods.js +77 -35
- package/dist/esm/lib/domMethods.js.map +1 -1
- package/dist/esm/lib/domevent.js +84 -59
- package/dist/esm/lib/domevent.js.map +1 -1
- package/dist/esm/lib/emit.js +67 -53
- package/dist/esm/lib/emit.js.map +1 -1
- package/dist/esm/lib/kowrap.js +5 -2
- package/dist/esm/lib/kowrap.js.map +1 -1
- package/dist/esm/lib/obsArray.js +82 -50
- package/dist/esm/lib/obsArray.js.map +1 -1
- package/dist/esm/lib/observable.js +26 -15
- package/dist/esm/lib/observable.js.map +1 -1
- package/dist/esm/lib/pureComputed.js +15 -18
- package/dist/esm/lib/pureComputed.js.map +1 -1
- package/dist/esm/lib/styled.js +24 -77
- package/dist/esm/lib/styled.js.map +1 -1
- package/dist/esm/lib/subscribe.js +27 -36
- package/dist/esm/lib/subscribe.js.map +1 -1
- package/dist/esm/lib/util.js +1 -0
- package/dist/esm/lib/util.js.map +1 -1
- package/dist/esm/lib/widgets/input.js +3 -1
- package/dist/esm/lib/widgets/input.js.map +1 -1
- package/dist/esm/lib/widgets/select.js +3 -1
- package/dist/esm/lib/widgets/select.js.map +1 -1
- package/dist/grain-full.debug.js +2138 -3052
- package/dist/grain-full.debug.js.map +7 -0
- package/dist/grain-full.min.js +6 -2
- package/dist/grain-full.min.js.map +7 -1
- package/lib/binding.ts +9 -2
- package/lib/browserGlobals.ts +3 -1
- package/lib/computed.ts +56 -56
- package/lib/dispose.ts +110 -85
- package/lib/dom.ts +41 -20
- package/lib/domComponent.ts +68 -70
- package/lib/domComputed.ts +66 -21
- package/lib/domDispose.ts +28 -11
- package/lib/domForEach.ts +13 -12
- package/lib/domImpl.ts +30 -7
- package/lib/domMethods.ts +101 -46
- package/lib/domevent.ts +86 -61
- package/lib/emit.ts +64 -50
- package/lib/kowrap.ts +5 -2
- package/lib/obsArray.ts +89 -54
- package/lib/observable.ts +26 -15
- package/lib/pureComputed.ts +16 -22
- package/lib/styled.ts +85 -71
- package/lib/subscribe.ts +41 -45
- package/lib/util.ts +1 -0
- package/lib/widgets/input.ts +3 -1
- package/lib/widgets/select.ts +3 -1
- package/package.json +48 -38
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IDisposable } from './dispose';
|
|
2
|
-
export
|
|
2
|
+
export type INodeFunc = (node: Node) => void;
|
|
3
|
+
/** @internal */
|
|
3
4
|
export declare function _disposeNode(node: Node): void;
|
|
4
5
|
export interface IDomDisposeHooks {
|
|
5
6
|
disposeRecursive: (node: Node) => void;
|
|
@@ -17,26 +18,40 @@ export declare const domDisposeHooks: IDomDisposeHooks;
|
|
|
17
18
|
* It is automatically called if one of the function arguments to dom() throws an exception during
|
|
18
19
|
* element creation. This way any onDispose() handlers set on the unfinished element get called.
|
|
19
20
|
*
|
|
20
|
-
* @param
|
|
21
|
+
* @param node - The element to run disposers on.
|
|
21
22
|
*/
|
|
22
23
|
export declare function domDispose(node: Node): void;
|
|
23
24
|
/**
|
|
24
|
-
* Associate a
|
|
25
|
-
* using domDispose() on it or any of its parents. If
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param {Function} disposerFunc(elem): Will be called when domDispose() is called on the
|
|
29
|
-
* element or its ancestor.
|
|
25
|
+
* Associate a disposer function with a DOM element. It will be called when the element is disposed
|
|
26
|
+
* using `domDispose()` on it or any of its parents. If called multiple times, all
|
|
27
|
+
* disposer functions will be called in reverse order.
|
|
28
|
+
*
|
|
30
29
|
* Note that it is not necessary usually to dispose event listeners attached to an element (e.g.
|
|
31
|
-
* with dom.on()) since their lifetime is naturally limited to the lifetime of the element.
|
|
30
|
+
* with `dom.on()`) since their lifetime is naturally limited to the lifetime of the element.
|
|
31
|
+
*
|
|
32
|
+
* @param elem - The element to associate the disposer with.
|
|
33
|
+
* @param disposerFunc - Will be called when `domDispose()` is called on the element or its ancestor.
|
|
32
34
|
*/
|
|
33
35
|
export declare function onDisposeElem(elem: Node, disposerFunc: INodeFunc): void;
|
|
36
|
+
/**
|
|
37
|
+
* Associate a disposer function with a DOM element. It will be called when the element is disposed
|
|
38
|
+
* using `domDispose()` on it or any of its parents. If called multiple times, all
|
|
39
|
+
* disposer functions will be called in reverse order.
|
|
40
|
+
*
|
|
41
|
+
* @param disposerFunc - Will be called when `domDispose()` is called on the element or its ancestor.
|
|
42
|
+
*/
|
|
34
43
|
export declare function onDispose(disposerFunc: INodeFunc): (elem: Node) => void;
|
|
35
44
|
/**
|
|
36
|
-
* Make the given element own the disposable, and call its dispose method when domDispose() is
|
|
45
|
+
* Make the given element own the disposable, and call its dispose method when `domDispose()` is
|
|
37
46
|
* called on the element or any of its parents.
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
47
|
+
* @param elem - The element to own the disposable.
|
|
48
|
+
* @param disposable - Anything with a `.dispose()` method.
|
|
40
49
|
*/
|
|
41
50
|
export declare function autoDisposeElem(elem: Node, disposable: IDisposable | null): void;
|
|
51
|
+
/**
|
|
52
|
+
* Make the given element own the disposable, and call its dispose method when `domDispose()` is
|
|
53
|
+
* called on the element or any of its parents.
|
|
54
|
+
*
|
|
55
|
+
* @param disposable - Anything with a `.dispose()` method.
|
|
56
|
+
*/
|
|
42
57
|
export declare function autoDispose(disposable: IDisposable | null): ((elem: Node) => void) | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.autoDispose = exports.autoDisposeElem = exports.onDispose = exports.onDisposeElem = exports.domDispose = exports.domDisposeHooks = exports._disposeNode = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* Private global disposal map. It maintains the association between DOM nodes and cleanup
|
|
5
6
|
* functions added with dom.onDispose(). To support multiple disposers on one element, we use a
|
|
@@ -25,6 +26,7 @@ function _walkDom(elem, visitFunc) {
|
|
|
25
26
|
visitFunc(elem);
|
|
26
27
|
}
|
|
27
28
|
// Internal helper to run all disposers for a single element.
|
|
29
|
+
/** @internal */
|
|
28
30
|
function _disposeNode(node) {
|
|
29
31
|
let disposer = _disposeMap.get(node);
|
|
30
32
|
if (disposer) {
|
|
@@ -57,21 +59,22 @@ exports.domDisposeHooks = {
|
|
|
57
59
|
* It is automatically called if one of the function arguments to dom() throws an exception during
|
|
58
60
|
* element creation. This way any onDispose() handlers set on the unfinished element get called.
|
|
59
61
|
*
|
|
60
|
-
* @param
|
|
62
|
+
* @param node - The element to run disposers on.
|
|
61
63
|
*/
|
|
62
64
|
function domDispose(node) {
|
|
63
65
|
exports.domDisposeHooks.disposeRecursive(node);
|
|
64
66
|
}
|
|
65
67
|
exports.domDispose = domDispose;
|
|
66
68
|
/**
|
|
67
|
-
* Associate a
|
|
68
|
-
* using domDispose() on it or any of its parents. If
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* @param {Function} disposerFunc(elem): Will be called when domDispose() is called on the
|
|
72
|
-
* element or its ancestor.
|
|
69
|
+
* Associate a disposer function with a DOM element. It will be called when the element is disposed
|
|
70
|
+
* using `domDispose()` on it or any of its parents. If called multiple times, all
|
|
71
|
+
* disposer functions will be called in reverse order.
|
|
72
|
+
*
|
|
73
73
|
* Note that it is not necessary usually to dispose event listeners attached to an element (e.g.
|
|
74
|
-
* with dom.on()) since their lifetime is naturally limited to the lifetime of the element.
|
|
74
|
+
* with `dom.on()`) since their lifetime is naturally limited to the lifetime of the element.
|
|
75
|
+
*
|
|
76
|
+
* @param elem - The element to associate the disposer with.
|
|
77
|
+
* @param disposerFunc - Will be called when `domDispose()` is called on the element or its ancestor.
|
|
75
78
|
*/
|
|
76
79
|
function onDisposeElem(elem, disposerFunc) {
|
|
77
80
|
const prevDisposer = _disposeMap.get(elem);
|
|
@@ -81,15 +84,22 @@ function onDisposeElem(elem, disposerFunc) {
|
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
exports.onDisposeElem = onDisposeElem;
|
|
87
|
+
/**
|
|
88
|
+
* Associate a disposer function with a DOM element. It will be called when the element is disposed
|
|
89
|
+
* using `domDispose()` on it or any of its parents. If called multiple times, all
|
|
90
|
+
* disposer functions will be called in reverse order.
|
|
91
|
+
*
|
|
92
|
+
* @param disposerFunc - Will be called when `domDispose()` is called on the element or its ancestor.
|
|
93
|
+
*/
|
|
84
94
|
function onDispose(disposerFunc) {
|
|
85
95
|
return (elem) => onDisposeElem(elem, disposerFunc);
|
|
86
96
|
}
|
|
87
97
|
exports.onDispose = onDispose;
|
|
88
98
|
/**
|
|
89
|
-
* Make the given element own the disposable, and call its dispose method when domDispose() is
|
|
99
|
+
* Make the given element own the disposable, and call its dispose method when `domDispose()` is
|
|
90
100
|
* called on the element or any of its parents.
|
|
91
|
-
* @param
|
|
92
|
-
* @param
|
|
101
|
+
* @param elem - The element to own the disposable.
|
|
102
|
+
* @param disposable - Anything with a `.dispose()` method.
|
|
93
103
|
*/
|
|
94
104
|
function autoDisposeElem(elem, disposable) {
|
|
95
105
|
if (disposable) {
|
|
@@ -97,6 +107,12 @@ function autoDisposeElem(elem, disposable) {
|
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
exports.autoDisposeElem = autoDisposeElem;
|
|
110
|
+
/**
|
|
111
|
+
* Make the given element own the disposable, and call its dispose method when `domDispose()` is
|
|
112
|
+
* called on the element or any of its parents.
|
|
113
|
+
*
|
|
114
|
+
* @param disposable - Anything with a `.dispose()` method.
|
|
115
|
+
*/
|
|
100
116
|
function autoDispose(disposable) {
|
|
101
117
|
if (disposable) {
|
|
102
118
|
return (elem) => autoDisposeElem(elem, disposable);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domDispose.js","sourceRoot":"","sources":["../../../lib/domDispose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domDispose.js","sourceRoot":"","sources":["../../../lib/domDispose.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,GAAuC,IAAI,OAAO,EAAE,CAAC;AAItE,4FAA4F;AAC5F,mCAAmC;AACnC,SAAS,QAAQ,CAAC,IAAU,EAAE,SAAoB;IAChD,IAAI,CAAC,GAAc,IAAI,CAAC,UAAU,CAAC;IACnC,OAAO,CAAC,EAAE;QACR,4FAA4F;QAC5F,gCAAgC;QAChC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACvB,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC;KACnB;IACD,SAAS,CAAC,IAAI,CAAC,CAAC;AAClB,CAAC;AAED,6DAA6D;AAC7D,gBAAgB;AAChB,SAAgB,YAAY,CAAC,IAAU;IACrC,IAAI,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,QAAQ,EAAE;QACZ,IAAI,GAAG,GAAmB,IAAI,CAAC;QAC/B,GAAG;YACD,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,qEAAqE;YACrE,GAAG,GAAG,QAAQ,CAAC;YACf,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACjC,QAAQ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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomContents } from './domComputed';
|
|
2
2
|
import { MaybeObsArray } from './obsArray';
|
|
3
3
|
/**
|
|
4
4
|
* Creates DOM elements for each element of an observable array. As the array is changed, children
|
|
@@ -12,10 +12,11 @@ import { MaybeObsArray } from './obsArray';
|
|
|
12
12
|
* If the created nodes are removed from their parent externally, forEach() will cope with it, but
|
|
13
13
|
* will consider these elements as no longer owned, and will not run domDispose() on them.
|
|
14
14
|
*
|
|
15
|
-
* Note that itemCreateFunc()
|
|
16
|
-
*
|
|
15
|
+
* Note that itemCreateFunc() is called with an index as the second argument, but that index is
|
|
16
|
+
* only accurate at the time of the call, and will stop reflecting the true index if more items
|
|
17
|
+
* are inserted or removed before it.
|
|
17
18
|
*
|
|
18
19
|
* If you'd like to map the DOM node back to its source item, use dom.data() and dom.getData() in
|
|
19
20
|
* itemCreateFunc().
|
|
20
21
|
*/
|
|
21
|
-
export declare function forEach<T>(obsArray: MaybeObsArray<T>, itemCreateFunc: (item: T) => Node | null):
|
|
22
|
+
export declare function forEach<T>(obsArray: MaybeObsArray<T>, itemCreateFunc: (item: T, index: number) => Node | null): DomContents;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forEach = void 0;
|
|
3
4
|
const domComputed_1 = require("./domComputed");
|
|
4
5
|
const domDispose_1 = require("./domDispose");
|
|
5
6
|
const domImpl_1 = require("./domImpl");
|
|
@@ -18,56 +19,55 @@ const browserGlobals_1 = require("./browserGlobals");
|
|
|
18
19
|
* If the created nodes are removed from their parent externally, forEach() will cope with it, but
|
|
19
20
|
* will consider these elements as no longer owned, and will not run domDispose() on them.
|
|
20
21
|
*
|
|
21
|
-
* Note that itemCreateFunc()
|
|
22
|
-
*
|
|
22
|
+
* Note that itemCreateFunc() is called with an index as the second argument, but that index is
|
|
23
|
+
* only accurate at the time of the call, and will stop reflecting the true index if more items
|
|
24
|
+
* are inserted or removed before it.
|
|
23
25
|
*
|
|
24
26
|
* If you'd like to map the DOM node back to its source item, use dom.data() and dom.getData() in
|
|
25
27
|
* itemCreateFunc().
|
|
26
28
|
*/
|
|
27
29
|
function forEach(obsArray, itemCreateFunc) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Remove the elements that are gone.
|
|
43
|
-
for (const node of splice.deleted) {
|
|
44
|
-
if (node && node.parentNode === elem) {
|
|
45
|
-
domDispose_1.domDispose(node);
|
|
46
|
-
elem.removeChild(node);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (splice.numAdded > 0) {
|
|
50
|
-
// Find a valid child immediately following the spliced out portion, for DOM insertion.
|
|
51
|
-
const endIndex = splice.start + splice.numAdded;
|
|
52
|
-
let nextElem = markerPost;
|
|
53
|
-
for (let i = endIndex; i < newArr.length; i++) {
|
|
54
|
-
const node = newArr[i];
|
|
30
|
+
const markerPre = browserGlobals_1.G.document.createComment('a');
|
|
31
|
+
const markerPost = browserGlobals_1.G.document.createComment('b');
|
|
32
|
+
return [markerPre, markerPost, (elem) => {
|
|
33
|
+
if (Array.isArray(obsArray)) {
|
|
34
|
+
(0, domComputed_1.replaceContent)(markerPre, markerPost, obsArray.map(itemCreateFunc));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const nodes = (0, obsArray_1.computedArray)(obsArray, itemCreateFunc);
|
|
38
|
+
// Be sure to dispose the newly-created array when the DOM it's associated with is gone.
|
|
39
|
+
(0, domDispose_1.autoDisposeElem)(markerPost, nodes);
|
|
40
|
+
nodes.addListener((newArr, oldArr, splice) => {
|
|
41
|
+
if (splice) {
|
|
42
|
+
// Remove the elements that are gone.
|
|
43
|
+
for (const node of splice.deleted) {
|
|
55
44
|
if (node && node.parentNode === elem) {
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
(0, domDispose_1.domDispose)(node);
|
|
46
|
+
elem.removeChild(node);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (splice.numAdded > 0) {
|
|
50
|
+
// Find a valid child immediately following the spliced out portion, for DOM insertion.
|
|
51
|
+
const endIndex = splice.start + splice.numAdded;
|
|
52
|
+
let nextElem = markerPost;
|
|
53
|
+
for (let i = endIndex; i < newArr.length; i++) {
|
|
54
|
+
const node = newArr[i];
|
|
55
|
+
if (node && node.parentNode === elem) {
|
|
56
|
+
nextElem = node;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
58
59
|
}
|
|
60
|
+
// Insert the new elements.
|
|
61
|
+
const content = (0, domImpl_1.frag)(newArr.slice(splice.start, endIndex));
|
|
62
|
+
elem.insertBefore(content, nextElem);
|
|
59
63
|
}
|
|
60
|
-
// Insert the new elements.
|
|
61
|
-
const content = domImpl_1.frag(newArr.slice(splice.start, endIndex));
|
|
62
|
-
elem.insertBefore(content, nextElem);
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
65
|
+
else {
|
|
66
|
+
(0, domComputed_1.replaceContent)(markerPre, markerPost, newArr);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
(0, domComputed_1.replaceContent)(markerPre, markerPost, nodes.get());
|
|
70
|
+
}];
|
|
71
71
|
}
|
|
72
72
|
exports.forEach = forEach;
|
|
73
73
|
//# sourceMappingURL=domForEach.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domForEach.js","sourceRoot":"","sources":["../../../lib/domForEach.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domForEach.js","sourceRoot":"","sources":["../../../lib/domForEach.ts"],"names":[],"mappings":";;;AAAA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CAAC;wBAChC,KAAK,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;4BACvB,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;gCACpC,QAAQ,GAAG,IAAI,CAAC;gCAChB,MAAM;6BACP;yBACF;wBAED,2BAA2B;wBAC3B,MAAM,OAAO,GAAG,IAAA,cAAI,EAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;wBAC3D,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;qBACtC;iBACF;qBAAM;oBACL,IAAA,4BAAc,EAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;iBAC/C;YACH,CAAC,CAAC,CAAC;YACH,IAAA,4BAAc,EAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;AACL,CAAC;AAjDD,0BAiDC"}
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type DomMethod<T = Node> = (elem: T) => DomArg<T> | void;
|
|
2
|
+
export type DomElementMethod = DomMethod<HTMLElement>;
|
|
3
|
+
/**
|
|
4
|
+
* Object mapping attribute names to attribute values. When applied to a DOM element, null and
|
|
5
|
+
* undefined values are omitted, and booleans are either omitted or set to empty string.
|
|
6
|
+
*/
|
|
3
7
|
export interface IAttrObj {
|
|
4
8
|
[attrName: string]: string | boolean | null | undefined;
|
|
5
9
|
}
|
|
6
|
-
export
|
|
10
|
+
export type DomArg<T = Node> = Node | string | void | null | undefined | IDomArgs<T> | DomMethod<T> | (T extends Element ? IAttrObj : never);
|
|
7
11
|
export interface IDomArgs<T = Node> extends Array<DomArg<T>> {
|
|
8
12
|
}
|
|
9
|
-
export
|
|
13
|
+
export type DomElementArg = DomArg<HTMLElement>;
|
|
10
14
|
/**
|
|
11
15
|
* dom('tag#id.class1.class2', ...args)
|
|
12
16
|
* The first argument is a string consisting of a tag name, with optional #foo suffix
|
|
13
17
|
* to add the ID 'foo', and zero or more .bar suffixes to add a CSS class 'bar'.
|
|
14
18
|
*
|
|
15
19
|
* NOTE that better typings are available when a tag is used directly, e.g.
|
|
16
|
-
* dom('input', {id: 'foo'}, (elem) => ...)
|
|
17
|
-
* dom('input#foo', (elem) => ...)
|
|
20
|
+
* `dom('input', {id: 'foo'}, (elem) => ...)` -- elem has type HTMLInputElement
|
|
21
|
+
* `dom('input#foo', (elem) => ...)` -- elem has type HTMLElement
|
|
18
22
|
*
|
|
19
23
|
* The rest of the arguments are optional and may be:
|
|
20
24
|
*
|
|
21
25
|
* Nodes - which become children of the created element;
|
|
22
26
|
* strings - which become text node children;
|
|
23
|
-
* objects - of the form {attr: val} to set additional attributes on the element;
|
|
27
|
+
* objects - of the form `{attr: val}` to set additional attributes on the element;
|
|
24
28
|
* Arrays - which are flattened with each item processed recursively;
|
|
25
29
|
* functions - which are called with elem as the argument, for a chance to modify the
|
|
26
30
|
* element as it's being created. Return values are processed recursively.
|
|
@@ -28,8 +32,8 @@ export declare type DomElementArg = DomArg<HTMLElement>;
|
|
|
28
32
|
* are actually special cases of the "functions" category.
|
|
29
33
|
*/
|
|
30
34
|
export declare function dom<Tag extends TagName>(tagString: Tag, ...args: IDomArgs<TagElem<Tag>>): TagElem<Tag>;
|
|
31
|
-
export
|
|
32
|
-
export
|
|
35
|
+
export type TagName = keyof HTMLElementTagNameMap | string;
|
|
36
|
+
export type TagElem<T extends TagName> = T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : HTMLElement;
|
|
33
37
|
/**
|
|
34
38
|
* svg('tag#id.class1.class2', ...args)
|
|
35
39
|
* Same as dom(...), but creates an SVG element.
|
|
@@ -40,7 +44,26 @@ export declare function svg(tagString: string, ...args: IDomArgs<SVGElement>): S
|
|
|
40
44
|
*/
|
|
41
45
|
export declare function update<T extends Node, Args extends IDomArgs<T>>(elem: T, ...args: Args): T;
|
|
42
46
|
/**
|
|
43
|
-
* Creates a DocumentFragment processing arguments the same way as the dom() function.
|
|
47
|
+
* Creates a `DocumentFragment`, processing arguments in the same way as the `dom()` function.
|
|
48
|
+
*
|
|
49
|
+
* It's rarely needed since an array of `dom()` arguments is treated the same as a
|
|
50
|
+
* `DocumentFragment` in most cases.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* dom.frag(dom('span', 'Hello'), ' good ', dom('div', 'world'))
|
|
55
|
+
* ```
|
|
56
|
+
* creates document fragment with `<span>Hello</span> good <div>world</div>`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* These two examples are equivalent:
|
|
60
|
+
* ```ts
|
|
61
|
+
* const world1 = () => dom.frag(' good ', dom('div', 'world'));
|
|
62
|
+
* dom('div', 'Hello', world1);
|
|
63
|
+
*
|
|
64
|
+
* const world2 = () => [' good ', dom('div', 'world')];
|
|
65
|
+
* dom('div', 'Hello', world2);
|
|
66
|
+
* ```
|
|
44
67
|
*/
|
|
45
68
|
export declare function frag(...args: IDomArgs<DocumentFragment>): DocumentFragment;
|
|
46
69
|
/**
|
package/dist/cjs/lib/domImpl.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findAll = exports.find = exports.frag = exports.update = exports.svg = exports.dom = void 0;
|
|
3
4
|
const domDispose_1 = require("./domDispose");
|
|
4
5
|
const domMethods_1 = require("./domMethods");
|
|
5
6
|
// Use the browser globals in a way that allows replacing them with mocks in tests.
|
|
@@ -19,14 +20,14 @@ const browserGlobals_1 = require("./browserGlobals");
|
|
|
19
20
|
* to add the ID 'foo', and zero or more .bar suffixes to add a CSS class 'bar'.
|
|
20
21
|
*
|
|
21
22
|
* NOTE that better typings are available when a tag is used directly, e.g.
|
|
22
|
-
* dom('input', {id: 'foo'}, (elem) => ...)
|
|
23
|
-
* dom('input#foo', (elem) => ...)
|
|
23
|
+
* `dom('input', {id: 'foo'}, (elem) => ...)` -- elem has type HTMLInputElement
|
|
24
|
+
* `dom('input#foo', (elem) => ...)` -- elem has type HTMLElement
|
|
24
25
|
*
|
|
25
26
|
* The rest of the arguments are optional and may be:
|
|
26
27
|
*
|
|
27
28
|
* Nodes - which become children of the created element;
|
|
28
29
|
* strings - which become text node children;
|
|
29
|
-
* objects - of the form {attr: val} to set additional attributes on the element;
|
|
30
|
+
* objects - of the form `{attr: val}` to set additional attributes on the element;
|
|
30
31
|
* Arrays - which are flattened with each item processed recursively;
|
|
31
32
|
* functions - which are called with elem as the argument, for a chance to modify the
|
|
32
33
|
* element as it's being created. Return values are processed recursively.
|
|
@@ -56,11 +57,11 @@ function _createElementSvg(tag) {
|
|
|
56
57
|
/**
|
|
57
58
|
* Internal helper to parse tagString, create an element using createFunc with the given tag, and
|
|
58
59
|
* set its id and classes from the tagString.
|
|
59
|
-
* @param
|
|
60
|
+
* @param createFunc(tag) - Function that should create an element given a tag name.
|
|
60
61
|
* It is passed in to allow creating elements in different namespaces (e.g. plain HTML vs SVG).
|
|
61
|
-
* @param
|
|
62
|
+
* @param tagString - String of the form "tag#id.class1.class2" where id and classes are
|
|
62
63
|
* optional.
|
|
63
|
-
* @
|
|
64
|
+
* @returns {Element} The result of createFunc(), possibly with id and class attributes also set.
|
|
64
65
|
*/
|
|
65
66
|
function _createFromTagString(createFunc, tagString) {
|
|
66
67
|
// We do careful hand-written parsing rather than use a regexp for speed. Using a regexp is
|
|
@@ -121,7 +122,7 @@ function _updateWithArgsOrDispose(elem, args) {
|
|
|
121
122
|
return _updateWithArgs(elem, args);
|
|
122
123
|
}
|
|
123
124
|
catch (e) {
|
|
124
|
-
domDispose_1.domDispose(elem);
|
|
125
|
+
(0, domDispose_1.domDispose)(elem);
|
|
125
126
|
throw e;
|
|
126
127
|
}
|
|
127
128
|
}
|
|
@@ -143,14 +144,33 @@ function _updateWithArg(elem, arg) {
|
|
|
143
144
|
elem.appendChild(arg);
|
|
144
145
|
}
|
|
145
146
|
else if (typeof arg === 'object') {
|
|
146
|
-
domMethods_1.attrsElem(elem, arg);
|
|
147
|
+
(0, domMethods_1.attrsElem)(elem, arg);
|
|
147
148
|
}
|
|
148
149
|
else {
|
|
149
150
|
elem.appendChild(browserGlobals_1.G.document.createTextNode(arg));
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
/**
|
|
153
|
-
* Creates a DocumentFragment processing arguments the same way as the dom() function.
|
|
154
|
+
* Creates a `DocumentFragment`, processing arguments in the same way as the `dom()` function.
|
|
155
|
+
*
|
|
156
|
+
* It's rarely needed since an array of `dom()` arguments is treated the same as a
|
|
157
|
+
* `DocumentFragment` in most cases.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* dom.frag(dom('span', 'Hello'), ' good ', dom('div', 'world'))
|
|
162
|
+
* ```
|
|
163
|
+
* creates document fragment with `<span>Hello</span> good <div>world</div>`.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* These two examples are equivalent:
|
|
167
|
+
* ```ts
|
|
168
|
+
* const world1 = () => dom.frag(' good ', dom('div', 'world'));
|
|
169
|
+
* dom('div', 'Hello', world1);
|
|
170
|
+
*
|
|
171
|
+
* const world2 = () => [' good ', dom('div', 'world')];
|
|
172
|
+
* dom('div', 'Hello', world2);
|
|
173
|
+
* ```
|
|
154
174
|
*/
|
|
155
175
|
function frag(...args) {
|
|
156
176
|
const elem = browserGlobals_1.G.document.createDocumentFragment();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domImpl.js","sourceRoot":"","sources":["../../../lib/domImpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domImpl.js","sourceRoot":"","s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