@webreflection/elements 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.md +4 -2
  2. package/auto.js +6 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  HTML & SVG Custom Elements, glueing [qsa-observer](https://github.com/WebReflection/qsa-observer#readme) and [nonchalance](https://github.com/WebReflection/nonchalance#readme) together.
4
4
 
5
+ **[Live Test](https://webreflection.github.io/elements/test.html)**
6
+
5
7
  ```html
6
8
  <script type="module">
7
9
 
@@ -18,7 +20,7 @@ HTML & SVG Custom Elements, glueing [qsa-observer](https://github.com/WebReflect
18
20
  #private;
19
21
 
20
22
  // only caveat:
21
- // if defined, the constructor MUST forwards arguments!
23
+ // if defined, the constructor MUST forward arguments!
22
24
  constructor(...args) {
23
25
  super(...args);
24
26
  this.#private = 'test';
@@ -39,6 +41,6 @@ Enjoy 👋
39
41
 
40
42
  ### Native Support Included
41
43
 
42
- If your browser supports natively custom elements builtin extends (i.e. Chrome/ium based) you can use [@webreflection/elements/native](./native.js) export instead, which offers exact same API without any dependency, hence it's lightweight, easier to reason about, and natively wonderful.
44
+ If your browser supports natively *HTML* custom elements builtin extends (i.e. Chrome/ium based), and *HTML* is all you want/need to extend 'cause *SVG* custom elements do not exist natively on the Web, you can use [@webreflection/elements/native](./native.js) export instead, which offers the **exact same API** without any dependency, hence it's lightweight, easier to reason about, and natively wonderful.
43
45
 
44
46
  If you don't know if that's supported and you would like to feature detect this ability, you can pick the [@webreflection/elements/auto](./auto.js) export insted.
package/auto.js CHANGED
@@ -4,8 +4,13 @@ let { HTML, SVG, elements } = module;
4
4
 
5
5
  try {
6
6
  const LI = class extends HTMLLIElement {};
7
- customElements.define('extends-' + Date.now(), LI, { extends: 'li' });
7
+ customElements.define('li-' + Date.now(), LI, { extends: 'li' });
8
8
  new LI;
9
+ SVG = new Proxy(module, {
10
+ get() {
11
+ throw new DOMException('SVG extends not natively supported');
12
+ }
13
+ });
9
14
  }
10
15
  catch {
11
16
  ({ HTML, SVG, elements } = await import('./min.js'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webreflection/elements",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "HTML & SVG Custom Elements",
5
5
  "main": "index.js",
6
6
  "module": "index.js",