wc-compiler 0.6.1 → 0.6.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/dist/wcc.dist.cjs +21 -15
- package/package.json +5 -1
- package/src/wcc.js +17 -11
package/dist/wcc.dist.cjs
CHANGED
|
@@ -86,7 +86,7 @@ class Document extends Node$1 {
|
|
|
86
86
|
return new HTMLTemplateElement();
|
|
87
87
|
|
|
88
88
|
default:
|
|
89
|
-
return new HTMLElement();
|
|
89
|
+
return new HTMLElement$1();
|
|
90
90
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -98,7 +98,7 @@ class Document extends Node$1 {
|
|
|
98
98
|
|
|
99
99
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
100
100
|
// EventTarget <- Node <- Element <- HTMLElement
|
|
101
|
-
class HTMLElement extends Element {
|
|
101
|
+
class HTMLElement$1 extends Element {
|
|
102
102
|
attachShadow(options) {
|
|
103
103
|
this.shadowRoot = new ShadowRoot(options);
|
|
104
104
|
|
|
@@ -129,7 +129,7 @@ class ShadowRoot extends DocumentFragment {
|
|
|
129
129
|
|
|
130
130
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement
|
|
131
131
|
// EventTarget <- Node <- Element <- HTMLElement <- HTMLTemplateElement
|
|
132
|
-
class HTMLTemplateElement extends HTMLElement {
|
|
132
|
+
class HTMLTemplateElement extends HTMLElement$1 {
|
|
133
133
|
constructor() {
|
|
134
134
|
super();
|
|
135
135
|
this.content = new DocumentFragment();
|
|
@@ -171,7 +171,7 @@ class CustomElementsRegistry {
|
|
|
171
171
|
globalThis.addEventListener = noop;
|
|
172
172
|
globalThis.document = new Document();
|
|
173
173
|
globalThis.customElements = new CustomElementsRegistry();
|
|
174
|
-
globalThis.HTMLElement = HTMLElement;
|
|
174
|
+
globalThis.HTMLElement = HTMLElement$1;
|
|
175
175
|
|
|
176
176
|
// Reserved word lists for various dialects of the language
|
|
177
177
|
|
|
@@ -27998,19 +27998,25 @@ async function initializeCustomElement(elementURL, tagName, attrs = [], definiti
|
|
|
27998
27998
|
: (await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(pathname)).default;
|
|
27999
27999
|
const dataLoader = (await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(pathname)).getData;
|
|
28000
28000
|
const data = dataLoader ? await dataLoader() : {};
|
|
28001
|
-
const elementInstance = new element(data); // eslint-disable-line new-cap
|
|
28002
28001
|
|
|
28003
|
-
|
|
28004
|
-
elementInstance
|
|
28002
|
+
if (element) {
|
|
28003
|
+
const elementInstance = new element(data); // eslint-disable-line new-cap
|
|
28005
28004
|
|
|
28006
|
-
|
|
28007
|
-
|
|
28008
|
-
|
|
28009
|
-
|
|
28010
|
-
|
|
28011
|
-
|
|
28012
|
-
|
|
28013
|
-
|
|
28005
|
+
attrs.forEach((attr) => {
|
|
28006
|
+
elementInstance.setAttribute(attr.name, attr.value);
|
|
28007
|
+
|
|
28008
|
+
if (attr.name === 'hydrate') {
|
|
28009
|
+
definitions[tagName].hydrate = attr.value;
|
|
28010
|
+
}
|
|
28011
|
+
});
|
|
28012
|
+
|
|
28013
|
+
await elementInstance.connectedCallback();
|
|
28014
|
+
|
|
28015
|
+
return elementInstance;
|
|
28016
|
+
} else {
|
|
28017
|
+
console.debug('No custom element class found for this file');
|
|
28018
|
+
return new HTMLElement();
|
|
28019
|
+
}
|
|
28014
28020
|
}
|
|
28015
28021
|
|
|
28016
28022
|
async function renderToString(elementURL) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wc-compiler",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Experimental native Web Components compiler.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/ProjectEvergreen/wcc.git"
|
|
8
|
+
},
|
|
5
9
|
"main": "src/wcc.js",
|
|
6
10
|
"type": "module",
|
|
7
11
|
"author": "Owen Buckley <owen@thegreenhouse.io>",
|
package/src/wcc.js
CHANGED
|
@@ -139,19 +139,25 @@ async function initializeCustomElement(elementURL, tagName, attrs = [], definiti
|
|
|
139
139
|
: (await import(pathname)).default;
|
|
140
140
|
const dataLoader = (await import(pathname)).getData;
|
|
141
141
|
const data = dataLoader ? await dataLoader() : {};
|
|
142
|
-
const elementInstance = new element(data); // eslint-disable-line new-cap
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
elementInstance
|
|
143
|
+
if (element) {
|
|
144
|
+
const elementInstance = new element(data); // eslint-disable-line new-cap
|
|
146
145
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
attrs.forEach((attr) => {
|
|
147
|
+
elementInstance.setAttribute(attr.name, attr.value);
|
|
148
|
+
|
|
149
|
+
if (attr.name === 'hydrate') {
|
|
150
|
+
definitions[tagName].hydrate = attr.value;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
await elementInstance.connectedCallback();
|
|
155
|
+
|
|
156
|
+
return elementInstance;
|
|
157
|
+
} else {
|
|
158
|
+
console.debug('No custom element class found for this file');
|
|
159
|
+
return new HTMLElement();
|
|
160
|
+
}
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
async function renderToString(elementURL) {
|