@webtides/element-js 1.1.5 → 1.1.6
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 +3 -3
- package/src/dom-parts/ChildNodePart.js +64 -57
- package/src/dom-parts/TemplateResult.js +10 -6
- package/CHANGELOG.md +0 -402
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webtides/element-js",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"module": "index.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@babel/eslint-parser": "^7.23.3",
|
|
39
39
|
"@open-wc/testing": "^4.0.0",
|
|
40
|
-
"@web/dev-server": "^0.4.
|
|
41
|
-
"@web/test-runner": "^0.
|
|
40
|
+
"@web/dev-server": "^0.4.6",
|
|
41
|
+
"@web/test-runner": "^0.19.0",
|
|
42
42
|
"babel-eslint": "^10.1.0",
|
|
43
43
|
"eslint": "8.55.0",
|
|
44
44
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -3,31 +3,6 @@ import { Part } from './Part.js';
|
|
|
3
3
|
import { TemplateResult } from './TemplateResult.js';
|
|
4
4
|
import { TemplatePart } from './TemplatePart.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @param {Node | TemplatePart | any[]} node
|
|
8
|
-
* @return {ChildNode}
|
|
9
|
-
*/
|
|
10
|
-
const removeChildNodes = (node) => {
|
|
11
|
-
if (!Array.isArray(node) && !(node instanceof TemplatePart) && !node.hasChildNodes()) {
|
|
12
|
-
return node;
|
|
13
|
-
}
|
|
14
|
-
const range = globalThis.document?.createRange();
|
|
15
|
-
const firstChild = Array.isArray(node)
|
|
16
|
-
? node[0]
|
|
17
|
-
: node instanceof TemplatePart
|
|
18
|
-
? node.childNodes[0]
|
|
19
|
-
: node.firstChild;
|
|
20
|
-
const lastChild = Array.isArray(node)
|
|
21
|
-
? node[node.length - 1]
|
|
22
|
-
: node instanceof TemplatePart
|
|
23
|
-
? node.childNodes[node.childNodes.length - 1]
|
|
24
|
-
: node.lastChild;
|
|
25
|
-
range.setStartAfter(firstChild);
|
|
26
|
-
range.setEndAfter(lastChild);
|
|
27
|
-
range.deleteContents();
|
|
28
|
-
return firstChild;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
6
|
/**
|
|
32
7
|
* @param {Element} commentNode
|
|
33
8
|
*/
|
|
@@ -51,31 +26,38 @@ const removeNodesBetweenComments = (commentNode) => {
|
|
|
51
26
|
* @return {Node[]}
|
|
52
27
|
*/
|
|
53
28
|
const diffChildNodes = function (parentNode, domChildNodes, templateChildNodes, anchorNode) {
|
|
54
|
-
//
|
|
29
|
+
// TODO: when diffing arrays there is sometimes two lists of TemplateParts instead of lists of childNodes
|
|
30
|
+
const offset = domChildNodes.includes(anchorNode) ? 1 : 0;
|
|
31
|
+
|
|
32
|
+
// release first level references to prevent cache mutation
|
|
33
|
+
const clonedDomChildNodes = [...domChildNodes];
|
|
34
|
+
const clonedTemplateChildNodes = [...templateChildNodes];
|
|
35
|
+
|
|
36
|
+
// We always want to have the two arrays (domChildNodes and cloneTemplateChildNodes) to have the same length.
|
|
55
37
|
// We also don't ever want to replace/diff the last node of the domChildNodes as it will always be the
|
|
56
38
|
// closing comment marker (/template-part) aka the anchorNode. So we push it to the end by inserting undefined items.
|
|
57
|
-
if (
|
|
58
|
-
const nodesToFill =
|
|
39
|
+
if (clonedTemplateChildNodes.length > clonedDomChildNodes.length) {
|
|
40
|
+
const nodesToFill = clonedTemplateChildNodes.length - clonedDomChildNodes.length;
|
|
59
41
|
for (let i = 0; i < nodesToFill; i++) {
|
|
60
|
-
|
|
42
|
+
clonedDomChildNodes.splice(clonedDomChildNodes.length - offset, 0, undefined);
|
|
61
43
|
}
|
|
62
44
|
}
|
|
63
45
|
|
|
64
|
-
if (
|
|
65
|
-
const nodesToFill =
|
|
46
|
+
if (clonedDomChildNodes.length > clonedTemplateChildNodes.length) {
|
|
47
|
+
const nodesToFill = clonedDomChildNodes.length - clonedTemplateChildNodes.length;
|
|
66
48
|
for (let i = 0; i < nodesToFill; i++) {
|
|
67
|
-
|
|
49
|
+
clonedTemplateChildNodes.splice(clonedTemplateChildNodes.length - offset, 0, undefined);
|
|
68
50
|
}
|
|
69
51
|
}
|
|
70
52
|
|
|
71
|
-
const length =
|
|
53
|
+
const length = clonedDomChildNodes.length;
|
|
72
54
|
// Diff each node in the child node lists
|
|
73
55
|
for (let index = 0; index < length; index++) {
|
|
74
|
-
let domChildNode =
|
|
75
|
-
let templateChildNode =
|
|
56
|
+
let domChildNode = clonedDomChildNodes[index];
|
|
57
|
+
let templateChildNode = clonedTemplateChildNodes[index];
|
|
76
58
|
|
|
77
59
|
// If the DOM node doesn't exist, append/copy the template node
|
|
78
|
-
if (
|
|
60
|
+
if (domChildNode === undefined) {
|
|
79
61
|
if (templateChildNode instanceof TemplatePart) {
|
|
80
62
|
anchorNode.before(...templateChildNode.childNodes);
|
|
81
63
|
} else if (Array.isArray(templateChildNode)) {
|
|
@@ -90,24 +72,47 @@ const diffChildNodes = function (parentNode, domChildNodes, templateChildNodes,
|
|
|
90
72
|
continue;
|
|
91
73
|
}
|
|
92
74
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
75
|
+
if (templateChildNode === undefined) {
|
|
76
|
+
// If the template node doesn't exist, remove the node in the DOM
|
|
77
|
+
if ('ELEMENT_NODE' in domChildNode) {
|
|
78
|
+
// remove dom node
|
|
79
|
+
parentNode.removeChild(domChildNode);
|
|
80
|
+
} else if (Array.isArray(domChildNode) || domChildNode instanceof TemplatePart) {
|
|
81
|
+
// remove childNodes
|
|
82
|
+
const childNodes = Array.isArray(domChildNode) ? domChildNode : [...domChildNode.childNodes];
|
|
83
|
+
for (const childNode of childNodes) {
|
|
84
|
+
childNode.remove();
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
console.log('This should not happen... what do we do about this node?!', domChildNode);
|
|
88
|
+
}
|
|
96
89
|
continue;
|
|
97
90
|
}
|
|
98
91
|
|
|
99
|
-
// If DOM node is equal to the template node, don't do anything
|
|
92
|
+
// If DOM node is equal to the template node, don't do anything in the DOM
|
|
100
93
|
if (
|
|
101
94
|
domChildNode === templateChildNode ||
|
|
102
|
-
(domChildNode.nodeType
|
|
103
|
-
templateChildNode.nodeType === COMMENT_NODE &&
|
|
104
|
-
domChildNode.isEqualNode(templateChildNode))
|
|
95
|
+
(domChildNode.nodeType && templateChildNode.nodeType && domChildNode.isEqualNode(templateChildNode))
|
|
105
96
|
) {
|
|
97
|
+
// but we need to assign the current DOM node into the templateChildNodes
|
|
98
|
+
// as they will be returned here at the end and become the domNodes for the next diffing.
|
|
99
|
+
const childIndex = templateChildNodes.indexOf(templateChildNode);
|
|
100
|
+
templateChildNodes[childIndex] = domChildNode;
|
|
106
101
|
continue;
|
|
107
102
|
}
|
|
108
103
|
|
|
109
104
|
// Everything else is somehow different and can be replaced
|
|
110
|
-
parentNode.
|
|
105
|
+
if (parentNode.contains(domChildNode)) {
|
|
106
|
+
parentNode.replaceChild(templateChildNode, domChildNode);
|
|
107
|
+
} else {
|
|
108
|
+
console.warn(
|
|
109
|
+
'This should not happen',
|
|
110
|
+
parentNode,
|
|
111
|
+
parentNode.contains(domChildNode),
|
|
112
|
+
templateChildNode,
|
|
113
|
+
domChildNode,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
111
116
|
}
|
|
112
117
|
return templateChildNodes;
|
|
113
118
|
};
|
|
@@ -119,7 +124,7 @@ const diffChildNodes = function (parentNode, domChildNodes, templateChildNodes,
|
|
|
119
124
|
*/
|
|
120
125
|
export const processNodePart = (comment, initialValue) => {
|
|
121
126
|
let nodes = initialValue instanceof TemplatePart ? [...initialValue.childNodes] : [];
|
|
122
|
-
let oldValue = initialValue instanceof TemplatePart ?
|
|
127
|
+
let oldValue = initialValue instanceof TemplatePart ? initialValue.strings : initialValue;
|
|
123
128
|
// this is for string values to be inserted into the DOM. A cached TextNode will be used so that we don't have to constantly create new DOM nodes.
|
|
124
129
|
let cachedTextNode = undefined;
|
|
125
130
|
|
|
@@ -166,17 +171,16 @@ export const processNodePart = (comment, initialValue) => {
|
|
|
166
171
|
oldValue = newValue;
|
|
167
172
|
break;
|
|
168
173
|
}
|
|
169
|
-
|
|
170
|
-
if (oldValue !== newValue) {
|
|
171
|
-
if
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
174
|
+
|
|
175
|
+
if (newValue instanceof TemplatePart && oldValue !== newValue.strings) {
|
|
176
|
+
// if the new value is a node or a fragment, and it's different from the live node, then it's diffed.
|
|
177
|
+
// static strings have changed in tpl part
|
|
178
|
+
oldValue = newValue.strings;
|
|
179
|
+
nodes = diffChildNodes(comment.parentNode, nodes, [...newValue.childNodes], comment);
|
|
180
|
+
} else if (oldValue !== newValue && 'ELEMENT_NODE' in newValue) {
|
|
181
|
+
// DOM Node changed, needs diffing
|
|
182
|
+
oldValue = newValue;
|
|
183
|
+
nodes = diffChildNodes(comment.parentNode, nodes, [newValue], comment);
|
|
180
184
|
}
|
|
181
185
|
break;
|
|
182
186
|
case 'function':
|
|
@@ -275,7 +279,9 @@ export class ChildNodePart extends Part {
|
|
|
275
279
|
this.updateParts(value);
|
|
276
280
|
}
|
|
277
281
|
|
|
278
|
-
|
|
282
|
+
if (!(value instanceof TemplateResult)) {
|
|
283
|
+
this.processor?.(parsedValue);
|
|
284
|
+
}
|
|
279
285
|
}
|
|
280
286
|
|
|
281
287
|
/**
|
|
@@ -324,6 +330,7 @@ export class ChildNodePart extends Part {
|
|
|
324
330
|
let value = values[index];
|
|
325
331
|
|
|
326
332
|
if (value instanceof TemplateResult) {
|
|
333
|
+
// TODO this is probably wrong. Should only be taken from parts cache if it has the same type (eg. template vs string, mixed types arrays)
|
|
327
334
|
let templatePart = this.parts[index];
|
|
328
335
|
if (!templatePart) {
|
|
329
336
|
const templatePartCommentNodes = this.childNodes?.filter(
|
|
@@ -217,14 +217,18 @@ export class TemplateResult {
|
|
|
217
217
|
* @param {Element} domNode
|
|
218
218
|
*/
|
|
219
219
|
renderInto(domNode) {
|
|
220
|
-
|
|
220
|
+
const startNode = Array.from(domNode.childNodes)
|
|
221
|
+
.filter((node) => node.nodeType === COMMENT_NODE)
|
|
222
|
+
.find((node) => node.data === 'template-part');
|
|
223
|
+
|
|
224
|
+
let serverSideRendered = startNode !== undefined;
|
|
225
|
+
|
|
221
226
|
let templatePart = templatePartsCache.get(domNode);
|
|
222
|
-
if (!templatePart) {
|
|
223
|
-
const startNode = Array.from(domNode.childNodes)
|
|
224
|
-
.filter((node) => node.nodeType === COMMENT_NODE)
|
|
225
|
-
.find((node) => node.data === 'template-part');
|
|
226
227
|
|
|
227
|
-
|
|
228
|
+
if (!templatePart || !startNode) {
|
|
229
|
+
if (!startNode) {
|
|
230
|
+
domNode.replaceChildren();
|
|
231
|
+
}
|
|
228
232
|
|
|
229
233
|
templatePart = new TemplatePart(startNode, this);
|
|
230
234
|
templatePartsCache.set(domNode, templatePart);
|
package/CHANGELOG.md
DELETED
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres
|
|
6
|
-
to [Semantic Versioning](http://semver.org/).
|
|
7
|
-
|
|
8
|
-
<!--
|
|
9
|
-
PRs should document their user-visible changes (if any) in the
|
|
10
|
-
Unreleased section, uncommenting the header as necessary.
|
|
11
|
-
-->
|
|
12
|
-
|
|
13
|
-
<!-- ## Unreleased -->
|
|
14
|
-
<!-- ### Added -->
|
|
15
|
-
<!-- ### Changed -->
|
|
16
|
-
<!-- ### Removed -->
|
|
17
|
-
<!-- ### Fixed -->
|
|
18
|
-
|
|
19
|
-
## [1.1.5] - 2024-11-14
|
|
20
|
-
|
|
21
|
-
### FIXED
|
|
22
|
-
|
|
23
|
-
- Fixed using special characters in attribute static strings ([#134](https://github.com/webtides/element-js/issues/134))
|
|
24
|
-
|
|
25
|
-
## [1.1.4] - 2024-11-12
|
|
26
|
-
|
|
27
|
-
### FIXED
|
|
28
|
-
|
|
29
|
-
- Fixed rendering interpolations inside textarea nodes ([#133](https://github.com/webtides/element-js/issues/133))
|
|
30
|
-
|
|
31
|
-
## [1.1.3] - 2024-11-11
|
|
32
|
-
|
|
33
|
-
### FIXED
|
|
34
|
-
|
|
35
|
-
- Fixed unsafeHtml having more than one child ([#135](https://github.com/webtides/element-js/issues/135))
|
|
36
|
-
- Fixed early returns from templates and fixes static html changes not reflecting to DOM ([#132](https://github.com/webtides/element-js/issues/132))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## [1.1.2] - 2024-10-30
|
|
40
|
-
|
|
41
|
-
### FIXED
|
|
42
|
-
|
|
43
|
-
- Fixed rerendering of templates that were initially null, prevent runtime errors
|
|
44
|
-
|
|
45
|
-
## [1.1.1] - 2024-09-16
|
|
46
|
-
|
|
47
|
-
### FIXED
|
|
48
|
-
|
|
49
|
-
- Fixed base url and css rules order in adopted style sheets.
|
|
50
|
-
- Fixed randomUUID not being available in unsecure hosts (like localhost) by adding a helper function
|
|
51
|
-
|
|
52
|
-
## [1.1.0] - 2024-06-24
|
|
53
|
-
|
|
54
|
-
### Added
|
|
55
|
-
|
|
56
|
-
- Added `optionalAttribute` directive to conditionally render attributes (plus value)
|
|
57
|
-
|
|
58
|
-
### FIXED
|
|
59
|
-
|
|
60
|
-
- Fixed `spreadAttributes` to not render "null|undefined|NaN" to the attributes value but removing the entire attribute
|
|
61
|
-
when such values are passed.
|
|
62
|
-
|
|
63
|
-
## [1.0.0] - 2024-05-24
|
|
64
|
-
|
|
65
|
-
### Added
|
|
66
|
-
|
|
67
|
-
- Added our own versions of directives and template helpers ([#67](https://github.com/webtides/element-js/pull/67))
|
|
68
|
-
- Added JSDocs for everything in the codebase. This will especially be helpful when using constructor options.
|
|
69
|
-
- Added state serialization. This improves hydration from SSR a
|
|
70
|
-
lot. ([#106](https://github.com/webtides/element-js/pull/106))
|
|
71
|
-
- added declarative shadow dom rendering for template elements
|
|
72
|
-
|
|
73
|
-
### Changed
|
|
74
|
-
|
|
75
|
-
- _BREAKING_ Uses a new custom renderer for the `TemplateElement`. It replaces the old `lit-html` renderer. The API and
|
|
76
|
-
usage should be exactly the same. The only thing to do/change is the use of the old `lit-html` directives. For
|
|
77
|
-
detailed instructions see the upgrade guide. ([#67](https://github.com/webtides/element-js/pull/67))
|
|
78
|
-
- _BREAKING_ `element-js` will now also trigger the `afterUpdate` hook right after the `connected` hook. This is to
|
|
79
|
-
reduce the cases where you had to do the same things in `connected` and `afterUpdate`. You can now remove those
|
|
80
|
-
duplicate calls from the `connected` hook. ([#60](https://github.com/webtides/element-js/pull/60))
|
|
81
|
-
- _BREAKING_ Changed `package.json` type to `module`. This should hopefully not break anything. `element-js` is either
|
|
82
|
-
used directly from the browser or through a bundler. In both cases the added type: module should not
|
|
83
|
-
matter. ([#64](https://github.com/webtides/element-js/pull/64))
|
|
84
|
-
- _BRAKING_ Changed the default options when using the `dispatch` helper function. `bubbles`, `cancelable`
|
|
85
|
-
and `composed` will now be `true` by default.
|
|
86
|
-
- _BRAKING_ Changed adopting global styles to include ALL global styles. Previously only one inline <style> with the ID
|
|
87
|
-
of '#globalStyles' would be adopted. For more information see the docs.
|
|
88
|
-
|
|
89
|
-
### Removed
|
|
90
|
-
|
|
91
|
-
- _BREAKING_ Removed the `lit-html` dependency. `element-js` is now officially dependency
|
|
92
|
-
free! ([#67](https://github.com/webtides/element-js/pull/67))
|
|
93
|
-
- _BREAKING_ Removed the deprecated `BaseElement` constructor option `childListUpdate`. Please use the "
|
|
94
|
-
mutationObserverOptions" dictionary instead. See the docs for more
|
|
95
|
-
info. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
96
|
-
- _BREAKING_ Removed the `hooks` map in the `BaseElement`. Using the hooks() map for lifecycle hooks is deprecated!
|
|
97
|
-
Please overwrite the existing lifecycle hook functions. See the docs for more
|
|
98
|
-
info. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
99
|
-
- _BREAKING_ Removed the `computed` map in the `BaseElement`. Using the computed() map for computed properties is
|
|
100
|
-
deprecated! Please use regular JS getters and return the computed value. See the docs for more
|
|
101
|
-
info. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
102
|
-
- _BREAKING_ Removed all occurrences of `ShadyCSS`
|
|
103
|
-
in `StyledElement`. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
104
|
-
- _BRAKING_ Removed the `i18n` helper function. See CHANGELOG how to implement it yourself or use a third party library.
|
|
105
|
-
|
|
106
|
-
## [1.0.0-alpha.13] - 2024-05-08
|
|
107
|
-
|
|
108
|
-
### Fixed
|
|
109
|
-
|
|
110
|
-
- catch security errors when `GlobalStylesStore` tries to read css rules from cross-origin stylesheets.
|
|
111
|
-
|
|
112
|
-
## [1.0.0-alpha.12] - 2024-03-03
|
|
113
|
-
|
|
114
|
-
### Added
|
|
115
|
-
|
|
116
|
-
- added declarative shadow dom rendering for template elements
|
|
117
|
-
|
|
118
|
-
### Fixed
|
|
119
|
-
|
|
120
|
-
- fixed issues with whitespace being returned untrimmed in a template result
|
|
121
|
-
|
|
122
|
-
## [1.0.0-alpha.11] - 2024-03-13
|
|
123
|
-
|
|
124
|
-
### Fixed
|
|
125
|
-
|
|
126
|
-
- fixed missing return type `string` for the `template()` function in `TemplateElement`
|
|
127
|
-
- fixed types for the `propertyOptions` option in `BaseElement`
|
|
128
|
-
|
|
129
|
-
## [1.0.0-alpha.10] - 2024-02-20
|
|
130
|
-
|
|
131
|
-
### Fixed
|
|
132
|
-
|
|
133
|
-
- fixed unsafeHTML not rendering anything when toString was called
|
|
134
|
-
- fixed using = sign in attribute positions with interpolations
|
|
135
|
-
- fixed rendering null values in node part positions in SSR
|
|
136
|
-
- fixed missing .js file extensions
|
|
137
|
-
|
|
138
|
-
## [1.0.0-alpha.9] - 2024-01-05
|
|
139
|
-
|
|
140
|
-
### Changed
|
|
141
|
-
|
|
142
|
-
- moved DOM methods into connected callbacks to make it safe for the elements to be created in SSR environments
|
|
143
|
-
|
|
144
|
-
## [1.0.0-alpha.8] - 2024-01-04
|
|
145
|
-
|
|
146
|
-
### Fixed
|
|
147
|
-
|
|
148
|
-
- fixed ChildNodePart not replacing dom nodes from unsafeHTML
|
|
149
|
-
|
|
150
|
-
## [1.0.0-alpha.7] - 2023-12-19
|
|
151
|
-
|
|
152
|
-
### Fixed
|
|
153
|
-
|
|
154
|
-
- fixed wrong attribute parts for the same name on different elements
|
|
155
|
-
|
|
156
|
-
## [1.0.0-alpha.6] - 2023-12-18
|
|
157
|
-
|
|
158
|
-
### Fixed
|
|
159
|
-
|
|
160
|
-
- fixed hyphens in attribute names being split in SSR mode
|
|
161
|
-
|
|
162
|
-
## [1.0.0-alpha.5] - 2023-12-07
|
|
163
|
-
|
|
164
|
-
### Added
|
|
165
|
-
|
|
166
|
-
- Added the /docs directory to the files array in package.json
|
|
167
|
-
- Added part instances as \_\_part to comment nodes
|
|
168
|
-
|
|
169
|
-
### Fixed
|
|
170
|
-
|
|
171
|
-
- fixed escaped unsafeHTML in SSR mode
|
|
172
|
-
|
|
173
|
-
## [1.0.0-alpha.4] - 2023-12-01
|
|
174
|
-
|
|
175
|
-
### Fixed
|
|
176
|
-
|
|
177
|
-
- falsy creation of directive parts for non-directive attributes
|
|
178
|
-
- creating parts with wrong comment marker positions
|
|
179
|
-
|
|
180
|
-
## [1.0.0-alpha.3] - 2023-12-01
|
|
181
|
-
|
|
182
|
-
### Added
|
|
183
|
-
|
|
184
|
-
- Added state serialization. This improves hydration from SSR a
|
|
185
|
-
lot. ([#106](https://github.com/webtides/element-js/pull/106))
|
|
186
|
-
|
|
187
|
-
### Changed
|
|
188
|
-
|
|
189
|
-
- _BRAKING_ Changed the default options when using the `dispatch` helper function. `bubbles`, `cancelable`
|
|
190
|
-
and `composed` will now be `true` by default.
|
|
191
|
-
- _BRAKING_ Changed adopting global styles to include ALL global styles. Previously only one inline <style> with the ID
|
|
192
|
-
of '#globalStyles' would be adopted. For more information see the docs.
|
|
193
|
-
|
|
194
|
-
### Removed
|
|
195
|
-
|
|
196
|
-
- _BRAKING_ Removed `i18n` helper function. See CHANGELOG how to implement it yourself or use a third party library.
|
|
197
|
-
|
|
198
|
-
## [1.0.0-alpha.2] - 2023-08-23
|
|
199
|
-
|
|
200
|
-
### Added
|
|
201
|
-
|
|
202
|
-
- Added JSDocs for everything in the codebase. This will especially be helpful when using constructor options.
|
|
203
|
-
|
|
204
|
-
## [1.0.0-alpha.1] - 2023-08-15
|
|
205
|
-
|
|
206
|
-
### Added
|
|
207
|
-
|
|
208
|
-
- Added our own versions of directives and template helpers ([#67](https://github.com/webtides/element-js/pull/67))
|
|
209
|
-
|
|
210
|
-
### Changed
|
|
211
|
-
|
|
212
|
-
- _BRAKING_ Uses a new custom renderer for the `TemplateElement`. It replaces the old `lit-html` renderer. The API and
|
|
213
|
-
usage should be exactly the same. The only thing to do/change is the use of the old `lit-html` directives. For
|
|
214
|
-
detailed instructions see the upgrade guide. ([#67](https://github.com/webtides/element-js/pull/67))
|
|
215
|
-
- _BREAKING_ `element-js` will now also trigger the `afterUpdate` hook right after the `connected` hook. This is to
|
|
216
|
-
reduce the cases where you had to do the same things in `connected` and `afterUpdate`. You can now remove those
|
|
217
|
-
duplicate calls from the `connected` hook. ([#60](https://github.com/webtides/element-js/pull/60))
|
|
218
|
-
- _BREAKING_ Changed `package.json` type to `module`. This should hopefully not break anything. `element-js` is either
|
|
219
|
-
used directly from the browser or through a bundler. In both cases the added type: module should not
|
|
220
|
-
matter. ([#64](https://github.com/webtides/element-js/pull/64))
|
|
221
|
-
|
|
222
|
-
### Removed
|
|
223
|
-
|
|
224
|
-
- _BREAKING_ Removed the `lit-html` dependency. `element-js` is now officially dependency
|
|
225
|
-
free! ([#67](https://github.com/webtides/element-js/pull/67))
|
|
226
|
-
- _BREAKING_ Removed the deprecated `BaseElement` constructor option `childListUpdate`. Please use the "
|
|
227
|
-
mutationObserverOptions" dictionary instead. See the docs for more
|
|
228
|
-
info. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
229
|
-
- _BREAKING_ Removed the `hooks` map in the `BaseElement`. Using the hooks() map for lifecycle hooks is deprecated!
|
|
230
|
-
Please overwrite the existing lifecycle hook functions. See the docs for more
|
|
231
|
-
info. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
232
|
-
- _BREAKING_ Removed the `computed` map in the `BaseElement`. Using the computed() map for computed properties is
|
|
233
|
-
deprecated! Please use regular JS getters and return the computed value. See the docs for more
|
|
234
|
-
info. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
235
|
-
- _BREAKING_ Removed all occurrences of `ShadyCSS`
|
|
236
|
-
in `StyledElement`. ([#99](https://github.com/webtides/element-js/pull/99))
|
|
237
|
-
|
|
238
|
-
## [0.7.4] - 2023-11-24
|
|
239
|
-
|
|
240
|
-
### Added
|
|
241
|
-
|
|
242
|
-
- storeception (reactive store properties in parent stores)
|
|
243
|
-
- context injection in shadow elements requests travel though shadow roots
|
|
244
|
-
- defer element connection (disables client side code until called manually)
|
|
245
|
-
|
|
246
|
-
### Fixed
|
|
247
|
-
|
|
248
|
-
- late context injection if parent mounts after child (loading order)
|
|
249
|
-
- stores updating elements that want to be updated
|
|
250
|
-
|
|
251
|
-
## [0.7.3] - 2023-03-07
|
|
252
|
-
|
|
253
|
-
### Fixed
|
|
254
|
-
|
|
255
|
-
- last release was tagged wrong
|
|
256
|
-
|
|
257
|
-
## [0.7.2] - 2023-03-03
|
|
258
|
-
|
|
259
|
-
### Fixed
|
|
260
|
-
|
|
261
|
-
- watcher callbacks for injected stores
|
|
262
|
-
|
|
263
|
-
## [0.7.1] - 2023-03-03
|
|
264
|
-
|
|
265
|
-
### Added
|
|
266
|
-
|
|
267
|
-
- Elements are now able to watch Stores
|
|
268
|
-
|
|
269
|
-
### Fixed
|
|
270
|
-
|
|
271
|
-
- Injection of falsy values
|
|
272
|
-
|
|
273
|
-
## [0.7.0] - 2023-02-13
|
|
274
|
-
|
|
275
|
-
### Added
|
|
276
|
-
|
|
277
|
-
- Dependency Injection via Context Protocol 💉
|
|
278
|
-
- Provide reactive Properties or entire Stores via: provideProperties() { return { name : value}}
|
|
279
|
-
- Inject / Request them via injectProperties() { return { name : 'defaultValue'}}
|
|
280
|
-
|
|
281
|
-
### Changed
|
|
282
|
-
|
|
283
|
-
- docs structure
|
|
284
|
-
|
|
285
|
-
### Fixed
|
|
286
|
-
|
|
287
|
-
- Cannot re-render slotted light dom when using the vanilla renderer https://github.com/webtides/element-js/issues/76
|
|
288
|
-
- adds Vanilla Renderer Tests
|
|
289
|
-
|
|
290
|
-
## [0.6.2] - 2022-11-18
|
|
291
|
-
|
|
292
|
-
### FIXED
|
|
293
|
-
|
|
294
|
-
- Store always switching to singleProperty Mode if constructed without any arguments.
|
|
295
|
-
|
|
296
|
-
## [0.6.1] - 2022-11-18
|
|
297
|
-
|
|
298
|
-
### ADDED
|
|
299
|
-
|
|
300
|
-
- Store watch() map to control internal store state scope
|
|
301
|
-
|
|
302
|
-
## [0.6.0] - 2022-11-17
|
|
303
|
-
|
|
304
|
-
### ADDED
|
|
305
|
-
|
|
306
|
-
- StoreProperty for shared application state
|
|
307
|
-
- Directives for Vanilla Renderer
|
|
308
|
-
|
|
309
|
-
## [0.5.0] - 2022-09-13
|
|
310
|
-
|
|
311
|
-
### Changed
|
|
312
|
-
|
|
313
|
-
- improved the performance of the vanilla-renderer
|
|
314
|
-
|
|
315
|
-
### Removed
|
|
316
|
-
|
|
317
|
-
- setting attributes as properties during dom diffing for the vanilla renderer. This is potentially a **breaking**
|
|
318
|
-
change if you used attributes with the "." (dot) notation
|
|
319
|
-
|
|
320
|
-
## [0.4.3] - 2022-07-06
|
|
321
|
-
|
|
322
|
-
### ADDED
|
|
323
|
-
|
|
324
|
-
- parse option to propertyOptions that can be either a boolean OR a function for custom parsing
|
|
325
|
-
- enhance reflect option in propertyOptions that it can also be a function for custom reflection
|
|
326
|
-
|
|
327
|
-
## [0.4.2] - 2022-02-03
|
|
328
|
-
|
|
329
|
-
### Fixed
|
|
330
|
-
|
|
331
|
-
- vanilla-renderer: fixes attribute comparsion
|
|
332
|
-
|
|
333
|
-
## [0.4.1] - 2022-02-01
|
|
334
|
-
|
|
335
|
-
### Fixed
|
|
336
|
-
|
|
337
|
-
- refs="id[]" indexing keys not nodes _rolleyes_
|
|
338
|
-
|
|
339
|
-
### Added
|
|
340
|
-
|
|
341
|
-
- refs="id[]" aka possibbility to refrence a list of nodes to the $refs map.
|
|
342
|
-
|
|
343
|
-
## [0.4.0] - 2022-01-28
|
|
344
|
-
|
|
345
|
-
### Added
|
|
346
|
-
|
|
347
|
-
- a "vanilla" renderer with support for hydration and no dependencies
|
|
348
|
-
|
|
349
|
-
### Changed
|
|
350
|
-
|
|
351
|
-
- uses new @web/test-runner isntead of karma (#27)
|
|
352
|
-
|
|
353
|
-
## [0.3.3] - 2021-09-22
|
|
354
|
-
|
|
355
|
-
### Added
|
|
356
|
-
|
|
357
|
-
- optional complex event callback notation to support addEventListener options (i.E. for passive Event Listeners )
|
|
358
|
-
- Example: {listener: () => {}, options: { passive: true } }
|
|
359
|
-
- docs
|
|
360
|
-
- tests
|
|
361
|
-
|
|
362
|
-
## [0.3.2] - 2021-03-09
|
|
363
|
-
|
|
364
|
-
### Added
|
|
365
|
-
|
|
366
|
-
- bundled version of `element-js` to use from a CDN and be able to prototype in tools like CodePen etc.
|
|
367
|
-
|
|
368
|
-
## [0.3.1] - 2020-12-08
|
|
369
|
-
|
|
370
|
-
### Fixed
|
|
371
|
-
|
|
372
|
-
- i18n fallback values
|
|
373
|
-
|
|
374
|
-
### Added
|
|
375
|
-
|
|
376
|
-
- i18n tests
|
|
377
|
-
|
|
378
|
-
## [0.3.0] - 2020-07-27
|
|
379
|
-
|
|
380
|
-
### Added
|
|
381
|
-
|
|
382
|
-
- first batch/draft of the documentation
|
|
383
|
-
- property/attribute reflection via constructor options (see the [Documentation](/docs/README.md#propertyoptions) for
|
|
384
|
-
more info)
|
|
385
|
-
- mutationObserverOptions to enable observing subtree mutations (see
|
|
386
|
-
the [Documentation](/docs/README.md#mutationobserveroptions) for more info)
|
|
387
|
-
|
|
388
|
-
### Removed
|
|
389
|
-
|
|
390
|
-
- `childListUpdate` constructor option has been deprecated and will be removed before `1.0`
|
|
391
|
-
|
|
392
|
-
## [0.2.0] - 2020-07-01
|
|
393
|
-
|
|
394
|
-
### Changed
|
|
395
|
-
|
|
396
|
-
- uses shady-render instead of render from `lit-html` for rendering templates to be compatible with the shady-css
|
|
397
|
-
polyfill
|
|
398
|
-
- refactored and simplified `StyledElement`s handling/loading of style sheets
|
|
399
|
-
|
|
400
|
-
## [0.1.0] - 2020-06-26
|
|
401
|
-
|
|
402
|
-
- initial release
|