@dazn/kopytko-framework 1.2.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [1.3.2](https://github.com/getndazn/kopytko-framework/compare/v1.3.1...v1.3.2) (2022-09-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Ignoring Invalid elements when calculating elements' index in children array ([#31](https://github.com/getndazn/kopytko-framework/issues/31)) ([73aed6e](https://github.com/getndazn/kopytko-framework/commit/73aed6e2e7ba38b946c81fe18ceecf414f7bbcf2))
|
|
7
|
+
|
|
8
|
+
## [1.3.1](https://github.com/getndazn/kopytko-framework/compare/v1.3.0...v1.3.1) (2022-08-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update dependencies ([#35](https://github.com/getndazn/kopytko-framework/issues/35)) ([7e317e0](https://github.com/getndazn/kopytko-framework/commit/7e317e0850cec411832318bf1491c8375c219cad))
|
|
14
|
+
|
|
15
|
+
# [1.3.0](https://github.com/getndazn/kopytko-framework/compare/v1.2.0...v1.3.0) (2022-08-01)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* enhanced destroyKopytkoRoot to call destroyKopytko ([#34](https://github.com/getndazn/kopytko-framework/issues/34)) ([c21c2bb](https://github.com/getndazn/kopytko-framework/commit/c21c2bb61bae0f165d2a68341aa1cfb75d13a6b8))
|
|
21
|
+
|
|
1
22
|
# [1.2.0](https://github.com/getndazn/kopytko-framework/compare/v1.1.2...v1.2.0) (2022-08-01)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dazn/kopytko-framework",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "A modern Roku's Brightscript framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"brightscript",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"test": "node node_modules/@dazn/kopytko-unit-testing-framework/scripts/test.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@dazn/kopytko-utils": "^2.
|
|
28
|
+
"@dazn/kopytko-utils": "^2.2.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@dazn/eslint-plugin-kopytko": "^2.1.0",
|
|
32
|
-
"@dazn/kopytko-packager": "^1.2.
|
|
33
|
-
"@dazn/kopytko-unit-testing-framework": "^
|
|
34
|
-
"eslint": "^8.
|
|
32
|
+
"@dazn/kopytko-packager": "^1.2.3",
|
|
33
|
+
"@dazn/kopytko-unit-testing-framework": "^2.0.1",
|
|
34
|
+
"eslint": "^8.21.0"
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"kopytkoModuleDir": "src/",
|
|
@@ -69,21 +69,6 @@ function KopytkoDiffUtility() as Object
|
|
|
69
69
|
m._diffElementChildren(currentElement.children, newElement.children, newElement.props.id)
|
|
70
70
|
end sub
|
|
71
71
|
|
|
72
|
-
' @private
|
|
73
|
-
prototype._markElementToBeRemoved = sub (element as Object)
|
|
74
|
-
m._diffResult.elementsToRemove.push(element.props.id)
|
|
75
|
-
|
|
76
|
-
if (element.children = Invalid OR element.children.count() = 0)
|
|
77
|
-
return
|
|
78
|
-
end if
|
|
79
|
-
|
|
80
|
-
for each child in element.children
|
|
81
|
-
if (child <> Invalid)
|
|
82
|
-
m._markElementToBeRemoved(child)
|
|
83
|
-
end if
|
|
84
|
-
end for
|
|
85
|
-
end sub
|
|
86
|
-
|
|
87
72
|
' @private
|
|
88
73
|
prototype._diffElementProps = sub (elementId as String, currentProps as Object, newProps as Object)
|
|
89
74
|
for each newProp in newProps
|
|
@@ -98,34 +83,49 @@ function KopytkoDiffUtility() as Object
|
|
|
98
83
|
end for
|
|
99
84
|
end sub
|
|
100
85
|
|
|
101
|
-
' @todo
|
|
86
|
+
' @todo Support elements reordering
|
|
102
87
|
' @private
|
|
103
88
|
prototype._diffElementChildren = sub (currentChildren as Object, newChildren as Object, parentElementId = Invalid as Dynamic)
|
|
104
|
-
if (
|
|
105
|
-
currentChildren = []
|
|
106
|
-
end if
|
|
89
|
+
if (newChildren = Invalid) then newChildren = []
|
|
107
90
|
|
|
108
|
-
|
|
109
|
-
|
|
91
|
+
currentChildrenMapped = {}
|
|
92
|
+
if (currentChildren <> Invalid)
|
|
93
|
+
for each currentChild in currentChildren
|
|
94
|
+
if (currentChild <> Invalid)
|
|
95
|
+
currentChildrenMapped[currentChild.props.id] = currentChild
|
|
96
|
+
end if
|
|
97
|
+
end for
|
|
110
98
|
end if
|
|
111
99
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
nonInvalidNewChildIndex = 0
|
|
101
|
+
for each newChild in newChildren
|
|
102
|
+
if (newChild <> Invalid)
|
|
103
|
+
newChild.index = nonInvalidNewChildIndex
|
|
104
|
+
nonInvalidNewChildIndex++
|
|
105
|
+
newChild.parentId = parentElementId
|
|
117
106
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
newChildren[i].index = i
|
|
121
|
-
newChildren[i].parentId = parentElementId
|
|
107
|
+
m._diffElement(currentChildrenMapped[newChild.props.id], newChild)
|
|
108
|
+
currentChildrenMapped.delete(newChild.props.id)
|
|
122
109
|
end if
|
|
110
|
+
end for
|
|
123
111
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
112
|
+
for each currentChildIdToRemove in currentChildrenMapped
|
|
113
|
+
m._markElementToBeRemoved(currentChildrenMapped[currentChildIdToRemove])
|
|
114
|
+
end for
|
|
115
|
+
end sub
|
|
116
|
+
|
|
117
|
+
' @private
|
|
118
|
+
prototype._markElementToBeRemoved = sub (element as Object)
|
|
119
|
+
m._diffResult.elementsToRemove.push(element.props.id)
|
|
127
120
|
|
|
128
|
-
|
|
121
|
+
if (element.children = Invalid OR element.children.count() = 0)
|
|
122
|
+
return
|
|
123
|
+
end if
|
|
124
|
+
|
|
125
|
+
for each child in element.children
|
|
126
|
+
if (child <> Invalid)
|
|
127
|
+
m._markElementToBeRemoved(child)
|
|
128
|
+
end if
|
|
129
129
|
end for
|
|
130
130
|
end sub
|
|
131
131
|
|