GithubHelp home page GithubHelp logo

webreflection / hyperhtml-element Goto Github PK

View Code? Open in Web Editor NEW
203.0 13.0 25.0 1.23 MB

An extensible class to define hyperHTML based Custom Elements.

License: ISC License

HTML 2.87% JavaScript 97.13%

hyperhtml-element's Introduction

hyperHTML-Element

License: ISC Build Status Greenkeeper badge WebReflection status

An extensible class to define hyperHTML based Custom Elements.

npm install hyperhtml-element

hyperHTML included

This class attaches all hyperHTML methods to itself, with the only exception of the define method, used in here to define Custom Elements instead.

To have same define functionality, please use HyperHTMLElement.intent(...) which provides exact same API.

Documentation

You can find more info about this helper in hyperHTML documentation page.

The Class

const HyperHTMLElement = require('hyperhtml-element');

class MyElement extends HyperHTMLElement {

  // observed attributes are automatically defined as accessors
  static get observedAttributes() { return ['key']; }

  // boolean attributes are automatically defined as accessors
  // and will set or remove the passed value
  static get booleanAttributes() { return ['active']; }

  // invoked once the component has been fully upgraded
  // suitable to perform any sort of setup
  // granted to be invoked right before either
  // connectedCallback or attributeChangedCallback
  created() {
    // triggers automatically attributeChangedCallback
    this.key = 'value';
  }

  attributeChangedCallback(name, prev, curr) {
    // when invoked, attributes will be already reflected
    // through their accessor
    this.key === curr; // true, and curr === "value"
    this.getAttribute('key') === this.key; // always true
    this.render();
  }

  render() {
    // lazily defined, this.html property points to an hyperHTML bound context
    // which could be the element shadowRoot or the element itself.
    // All events can be handled directly by the context, thanks to handleEvent
    // https://medium.com/@WebReflection/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38
    return this.html`
    Hello <strong onclick=${this}>HyperHTMLElement</strong>
    ( ${this.state.clicks} )`;
  }

  // using the inherited handleEvent,
  // events can be easily defined as methods with `on` prefix.
  onclick(e) {
    // `this` refers to the current custom element
    console.log(this, 'click', e.target);
    // state handling, updates the view
    this.setState({clicks: this.state.clicks + 1});
  }

  // alternatively, you can specify a `data-call`
  // attribute with the name of the method to invoke
  // this.html`<i data-call=onAnyEvent onclick=${this}>try</i>`;
  onAnyEvent(e) {
    // `this` still refers to the current custom element
    console.log(this, e.type, e.currentTarget, e.target);
  }

  // you can also use Preact-like events handling
  // this is less efficient, but migration friendly.
  // The method is bound once per instance so that
  // this.handleClick === this.handleClick is always true
  // this.html`<i onclick=${this.handleClick}>try</i>`;
  handleClick(e) {
    // `this` still refers to the current custom element
    console.log(this, e.type, e.currentTarget, e.target);
  }

  // define a default state to use whenever this.state is accessed
  // it can create states from observed properties too
  get defaultState() {
    return {clicks: 0, key: this.key};
  }

  // this method is Preact friendly, once invoked
  // as this.setState({new: 'value'});
  // it will shallow copy properties over
  // and it will invoke this.render() right after
  setState(objOrFn)

  // all other native Custom Elements method works as usual
  // connectedCallback() { ... }
  // adoptedCallback() { ... }
}

// classes must be defined through their public static method
// this is the moment the class will be fully setup once
// and registered to the customElements Registry.
MyElement.define('my-element');

New in v1.8

You can now define custom elements builtins too:

class MyLink extends HyperHTMLElement {
  created() { this.render(); }
  render() {
    return this.html`hello there!`;
  }
}
MyLink.define('my-link', {extends: 'a'});

Compatibility

HyperHTMLElement is compatible with every mobile browser and IE11 or greater.

There is a native live test page also transpiled for ES5 browsers.

hyperhtml-element's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hyperhtml-element's Issues

Uncaught TypeError: Cannot read property 'define' of null

I am creating a browser extension and I am using HyperHTML for content-scripts. Normally with bind everythings works but for encapsulation I want to try hyperHTML-elment. I am getting this error on console.

Uncaught TypeError: Cannot read property 'define' of null
    at Function.define (contentscript.js:1956)
    at Module.<anonymous> (contentscript.js:4512)
    at Module../scripts/contentscript.js (contentscript.js:4568)
    at __webpack_require__ (contentscript.js:20)
    at contentscript.js:84
    at contentscript.js:87

Source code is

class Counter extends HyperHTMLElement {
  get defaultState() {
    return { css: 'font-weight:bold;', count: 0 };
  }
  constructor(count) {
    super();
    this.html = this.bind(this.attachShadow({ mode: 'open' }));
    this.setState({ count });
  }
  onclick() {
    this.setState(prev => ({ count: prev.count + 1 }));
  }
  render() {
    return this.html`
      <button style=${this.state.css} onclick=${this}>
        ${this.state.count}
      </button>`;
  }
}
Counter.define('counter-div', { extends: 'div' });
function DOM() {
  const ch = document.createElement('Counter');
  root.appendChild(ch)
}

I found the root casue here customElements is null here

setPrototypeOf(Class, Intermediate);
      setPrototypeOf(proto, Intermediate.prototype);
      customElements.define(name, Class, options);

My browser is

Google Chrome
Version 83.0.4103.116 (Official Build) (64-bit)

How about support for ref attributes

Several other libs support a ref attribute in template markup so those elements can easily be referenced as this.refs. This is handy and would be great to have in HyperHTMLElement. Right now I have to write this boilerplate for all my refs:

  connectedCallback() {
    // Boilerplate, make it go away please :)
    this.refs = {
      input: this.querySelector('[ref=input]'),
      results: this.querySelector('[ref=results]')
    };

    if (this.hasAttribute('autofocus')) this.refs.input.focus();
  }



// Inside render()
    this.html`
      <input ref="input" type="text">
      <ul ref="results">...</ul>`;

this.refs is not documented

this.refs seems to be a map of all elements with a ref attribute, for example:

search() {
  const query = this.refs.search.value; // => "foo"
  ...
} 

render() {
  return this.html`<input ref="search" value="foo">`
}

This is a great feature, but I don't see it anywhere in the docs.

Super expression must either be null or a function, not object

I get "Super expression must either be null or a function, not object" error when I run index.js:

My index.js code:

import hyperHTML from 'hyperhtml';
import HyperHTMLElement from 'hyperhtml-element';

class SimpleElement extends HyperHTMLElement {
  created() {
    this.render();
  }

  render() {
    return this.html`DO IT`;
  }
}

SimpleElement.define('x-simple');

My index.html code:

<x-simple></x-simple>

My package.json file:
http://jsoneditoronline.org/?id=16781014c5a73885d395019ba5fcc317

What have I done wrong?

nest custom element

I modified a little (just on the Myself class)on the source code of the test example https://webreflection.github.io/hyperHTML-Element/test/

class MySelf extends HyperHTMLElement {
static get observedAttributes() { return ['name', 'age']; }
created() { this.render(); }
attributeChangedCallback() { this.render(); }
changed(e){
if(e.target)
this.age = e.target.value;
this.render();
}
render() { return this.html<p>Hi, my name is ${this.name} and I am ${this.age}<p><my-input value="${this.age}" oninput="${this.changed}"></my-input> ;
}
}

When I change the value of the nested "my-input" element, the content of "my-self" does not change.

Bundling with browserify/babelify not working

Maybe I'm doing something very wrong but I can't seem to get hyperhtml-element to play nice with babel.

If I import HyperHTMLElement from 'hyperhtml-element' then I get raw es6 in my bundle.
If I import HyperHTMLElement from 'hyperhtml-element/es5' then I get Uncaught TypeError: Super expression must either be null or a function

I'm using @babel/preset-env

I've been using hyperhtml-element in an Electron app for the last couple month and love it. But now that I'm trying to use it on the web I can't figure it out. I've been trying to make this work for almost a month now.

Any help you can provide will be greatly appreciated

Boolean attributes written in the kebab case are overridden by common observable attributes

When we have a parent class with only boolean attributes defined, the define method will concat boolean and observed attributes.
This means that when we extend the parent class without overriding any boolean or observed attributes, the new class will contain equal values ​​in the boolean and observed attribute arrays.

When the define method is called for a new class, it defines boolean attribute getters and then replaces it with normal observed attribute getters due to incorrect check of existing attribute getters in kebab-case.

class Parent extends HyperHTMLElement {
	static get booleanAttributes() {
		return ['kebab-case'];
	}
}

Parent.define('parent-class');
console.log(Parent.booleanAttributes) // ['kebab-case']
console.log(Parent.observedAttributes) // ['kebab-case']

class Child extends Parent {};
Child.define('child-class');

const child = document.createElement('child-class');
child.kebabCase = 'any value';
console.log(child.kebabCase) // 'any value' instead of true

The problem is that the define method checks the attribute in the prototype using its name in the kebab case, but defines a getter in the camel case.
This leads to the problem that a defined getter for a boolean attribute can be overridden by a normal getter for an observed attribute.

question: should hyperHTML support all build formats

\following #31

Hi @WebReflection

Actually, I have a more global question/comment to make as I'm trying to get HyperHTMLElement to play around with Webpack and IE11.

I proposed an UMD build (#31) because I actually need an ESM + ES5 (=ESM5) build so Webpack and IE are happy...

What do you think about the multiplication of build formats from ESM2015, ESM5, FESM5, FESM2015, CJS to UMD ?

Do you think as a library you should support none, most or all of them ?

\personaly
I kind of feel like there is no end to the possible combinations so it might be better to look for a way to compile your ES6 code to whatever target I need. What you think ?

Douglas.

Example page: Cursor moves to the end when user starts typing

Hello there,

At the example page if you put the cursor inside the text box - not at the end but between two characters - and you start typing, the cursor moves to the end.

I believe this is something nobody wants to happen. I understand that it may not actually be an issue in hyperHTML-Element - could be poor implementation or a bug in HyperHTML, I don't really have time to look into it right now - but I just thought I should report it.

(for the record, its Chrome 59.0.3071.115 on MacOSX
Cheers

customElements is undefined inside HyperHTMLElement.

We are running a webpack based javascript applicatio. As we updated to HyperHTML 2.10.3 and HyperHTMLElements 1.8.0 the application has stopped rendering with no apparent error on Google Chrome.

However, opening the same application on Firefox, shows an error in the console:

ReferenceError: customElements is not defined[Learn More]

This occurs inside the HyperHTMLElement base class, at this line:

customElements.define(name, Class);

Is there a dependency which has been factored out? The class doesn't seem to have any customElements nor it seems to be defined in the base class HTMLElement

Cannot find name 'MSManipulationEvent'

Apon compiling, I receive the following error:

C:/path/to/my/project/node_modules/hyperhtml-element/index.d.ts(52,37): error TS2304: Cannot find 
name 'MSManipulationEvent'.

Looking at index.d.ts (line 52) I can see that you have declared:
onmsmanipulationstatechanged(ev: MSManipulationEvent): void;

However, MSManipulationEvent is not defined nor imported in the file.

EDIT:
It looks like the issue would be resolved by pull request #24
Hopefully, it will be merged sooner than later as this issue is halting my current build process.

IE bug ?

IE version: 11

I got the following errors when trying the test page (transpiled version):

Here is the source part:

Unexpected reflection with boolean attributes

Hi,
I'm trying to initialize a property based on an attribute like:
this.active = this.hasAttribute('active') || null;

It works fine in a vanilla custom element but isn't working as I expect in a hyperHTML-Element because the property is reflected as attribute, this means this.active will be always true.

I'm missing something or boolean attributes shouldn't be reflected in this case?

Add greenkeper

Can you add greenkeeper so this have the latest version of hyperhtml... or update it manually whatever works best

Strange behavior in FF with Shadow Dom

Description

In Firefox, calling the render function outside of the component constructor causes the children to disappear.

Take the simple example:

    class ParentElement extends HyperHTMLElement {
        constructor() {
            super()
            const root = this.attachShadow({ mode: 'open' })

            this.render()
            // root.innerHTML = '<slot></slot>'
        }

        get template() {
            return this.html`<slot></slot>`
        }

        render() {
            return this.template
        }

        connectedCallback() {
            console.log('render')
            // this.render()
        }
    }

    ParentElement.define('parent-element')

Addingrender to connectedCallback will break the rendering, however everything works fine if it is called from the constructor. The workaround I came up with was to assign shadowRoot to a variable outside of the class and reapply before render. I'm sure this is not optimal.

For polyfills, I am using shadydom with document-register-element

boolean attributes not observerd by default?

Maybe its a bad understanding of my part but i would assume that by adding an attribute to booleanAttributes will also be observed but thats not the case, i have to put them in both places to make it work
https://stackblitz.com/edit/intermediate-ce-05?file=index.js
from the code above, if i do

static get observedAttributes() {return ['attr1', 'active']; }

then the remove els[1].removeAttribute('active'); works fine otherwise its not updated

Maybe make them be observed by default?

Suggestion: Add typings for Typescript

It would be nice to include a Typescript definition file for this library, like the one included in the main library (WebReflection/hyperHTML#187).

If you want I can make a PR with the .d.ts file. I also think that could be useful to add some examples of how to use this library with typescript.

Fix `created()` once for all.

Currently, if the component is registered before the body gets parsed, the callbacks might fire unpredictably.

This has to stop, and all methods should be triggered after created() and never before.

extending built-in elements with a base class different than HyperHTMLElement doesn't work

Hi there!

I think I've come across an issue today, I would like your opinion!

Minimal reproduction:

<!doctype html>
<html lang="en">
<head>
    <script type="text/javascript" src="https://unpkg.com/[email protected]/min.js"></script>
</head>
<body>
<div id="root"></div>

<script type="text/javascript">

    class Base extends HyperHTMLElement{}

    class MyButtonOK extends HyperHTMLElement{
      created() {
        console.log(this.setState); //function :)
      }
    }

    class MyButtonErr extends Base{
      created() {
        console.log(this.setState); //undefined :(
      }
    }

    class StandaloneOk extends Base{
      created() {
        console.log(this.setState); //function :)
      }
    }

    MyButtonOK.define('my-button', {extends: 'button'});
    MyButtonErr.define('my-button-sad', {extends: 'button'});
    StandaloneOk.define('standalone-ok');

  HyperHTMLElement.bind(document.getElementById('root'))`
    <button is="my-button">this.setState is ok</button>
    <button is="my-button-sad">this.setState is undefined</button>
    <standalone-ok>this.setState is ok</standalone-ok>
    `;
</script>
</body>
</html>

The problem seems to be in this bit of code: https://github.com/WebReflection/hyperHTML-Element/blob/master/index.js#L2372

I think it's assuming that Super is going to be the HyperHTMLElement class. I got it fixed by including ownKeys(HyperHTMLElement). I'll open a PR in a bit so you can have a look.

Thanks!

Basic question on how to use it

Can someone please elaborate on how to load this into a browser:

-npm install hyperhtml-element
to use Custom Elements in Node doesn't make any sense to me

-documentation suggest //unpkg.com/hyperhtml@latest/min.js
no HyperHTMLElement there

-Testcase
just loads document-register-element.js

Proposal: automatically add getter and setter for not primitive values

IMO, for a Web Component is really common having to deal with object attributes and I find writing a getter/setter for each of them to be annoying. Besides the source code is not very concise and I don't like my object properties not listed in observedAttributes, making them "special" compared to primitive properties. Is there any way to improve the situation?

My first idea is to create getter/setter in the library, as follows for instance:

    const observedAttributes = Class.observedAttributes || [];
    observedAttributes.forEach(name => {
      // it is possible to redefine the behavior at any time
      // simply overwriting get prop() and set prop(value)
      if (!(name in proto))
        defineProperty(proto, camel(name), {
          configurable: true,
          get() {
            return this.getAttribute(name) || this[`_${name}`];
          },
          set(value) {
            if (typeof value === 'object' && value !== null) {
              this[`_${name}`] = value;
            } else {
              if (value == null) this.removeAttribute(name);
              else this.setAttribute(name, value);
            }
          },
        });
    });

This would allow me to just return the property name in observedAttributes like any other.

Why do custom elements need explicit this.render() call to render initially?

Think about this minimal HyperHTMLElement derived element implementation:

class SimpleElement extends HyperHTMLElement {
    render() {
        return this.html`DO IT`;
    }
}
SimpleElement.define('x-simple');

I was wondering why this is not working out of the box. Well there must be at least one call of this.render() when the component initialized itself. E. g. by overwriting connectedCallback() method:

class SimpleElement extends HyperHTMLElement {
    connectedCallback() {
        this.render();
    }
    render() {...}
}

See: https://jsbin.com/xevisiviwa/edit?html,output

But is there any use-case, where it makes sense to not render the element initially? Otherwise, can't this be a default implementation in HyperHTMLElement class? I can then still override it in my derived class if needed.

Uncaught TypeError: Class constructor HyperHTMLElement cannot be invoked without 'new'

Hi everyone,

First of all, I would like to thank you for creating hyperHTML, it's amazing!
I want to play with it, especially with the HyperHTMLElement, but I have an error:

Uncaught TypeError: Class constructor HyperHTMLElement cannot be invoked without 'new'

I use Parcel with Babel 7.

Can you please help me on resolving this? I uploaded the project here:
https://github.com/dios-david/hyperhtml-test

Thanks in advance,
David

Observation: self-closing custom tags

Not sure if this is a bug or known issue.

When using self-closing custom tags, only the first one renders. For example, using the codepen, change the innerHTML line to this:

document.body.innerHTML =
  '<my-component name="First"/><my-component name="Third"/>';

I would expect to see "Hello, First Hello, Third Hello, Second" but instead only see "First" and "Second".

es5-test: Uncaught TypeError: Failed to construct 'HTMLAnchorElement'

I just opened the ES5 test page in Chrome and Firefox and got:

Chrome:

Uncaught TypeError: Failed to construct 'HTMLAnchorElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
    at new Intermediate (es5.js?_=0.4022547931080971:2271)
    at new MyLink (test.es5.js?_=0.9770479712178417:52)

Firefox:

TypeError: Constructor HTMLAnchorElement requires 'new' es5.js:2271:55
    Intermediate https://webreflection.github.io/hyperHTML-Element/es5.js?_=0.04575158785649547:2271
    MyLink https://webreflection.github.io/hyperHTML-Element/test/test.es5.js?_=0.6995535751188614:52

Set rendering

Hello! I have a code:
HyperHTMLElement.html<div>${arr}</div>.

Array is rendered. it's ok. How can I render Set data structure.

Redux integration

are you planning to add some Redux integration to the HyperHTML Element like polymer-redux?
I know I can write a subscribe listener to the store and update properties on the custom element but I was curious to know if you were already thinking to add e more elegant binding between the two.

Question: support template element for single file components

In the docs it states "because behind the scenes hyperHTML uses a template element."

This makes me think it's very possible for HyperHTMLElement to support single file components like Riot and Vue:

<!-- Vue -->
<template>
    <p>You're a winner!</p>
    <button v-on:click="dismiss">Close</button>
</template>

<script>
    export default {
        name: 's-alert',
        dismiss() {
            // Tell the parent to remove this child
        }
    }
</script>

<style scoped lang="less">
    p { color: green }
</style>


<!-- Riot -->
<s-alert>
    <p>You're a winner!</p>
    <button onclick="{dismiss}">Close</button>

    <script>
        dismiss() {
            this.unmount();
        }
    </script>

    <style type="text/less">
        :scope p { color: green }
    </style>
</s-alert>

Hyper could look like:

<template>
    <p>You're a winner!</p>
    <button onclick="dismiss">Close</button>
</template>

<script>
    export default {
        name: 's-alert',
        dismiss() {
            this.remove();
        }
    }
</script>

<style scoped type="text/less">
    p { color: green }
</style>

Cannot define `get defaultState` with TypeScript

Getter for defaultState cannot be defined with TypeScript.
Example:

class MyComponent extends HyperHTMLElement {
    get defaultState() {
        return { test: 123 };
    }
}

Following error appears:

'defaultState' is defined as a property in class 'HyperHTMLElement<{}>', but is overridden here in 'MyComponent' as an accessor.

I've created a minimal code here:

https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEkoGdnwBIE8AOIboBUBZAGQFEIQBbEAOwBcAeA+AXngG8BfAPk4Ch4Q5PSj0AlmHhwowAPa0ImeHIBGyPADcQwAIL16McaoCu9EMgBc8EUdoBzANoBdANyChYBbZNh6cmAAKAEp3IUQZc2AQ6005cWAwoTFDYzMQAGEACygHHQyoCAhVKDAAa0DaKBprW3EHABp4bDhNWtTGxBMYGHa7e2DY+MSPeBzaYEoybQZAkDb4abp6Qfg4hKSbUXNrAk2ZeUVlUAAzKBMIegBlbZBd-bpQINX1kfCNa9vAkTE7+AAFWASQrMPgAH3ggUC9Cy4is8BhcKaPx28AIwTYfEBMGBEFBwRew02KMk8FO9RAlWqfzqnTk2Ak3gA-NYKNRlgAREAneriRm0ADyDPE3kJG34XH4-CQqDRFno8BAAA9zBM0FhcPhiORKDQGAJwvB7CAFadzpcbr8QgbDeE4PRurROAj5dYAIwAJgAzPAuJtfRKgA

This is because defaultState is defined as just readonly property when it should be described as getter:

declare class HyperHTMLElement<T = {}> {
   ...
   readonly defaultState: T;
}

The solution is to change definition of defaultState to something like this:

declare class HyperHTMLElement<T = {}> {
   ...
   get defaultState(): T {}
}

ES6 Module

Please export this as an ES6 module with an .mjs file the same way you did with hyperHTML.

dynamic attributes of elements inside other elements are not evaluated in proper time

OK, this might be a silly question, or maybe something is wrong with my understanding.

please see this plunk

The title is not displayed in the first my-title element which is defined in the my-element template. It gets its title attribute from the parent element. The second my-title has a static title, and it shows up as expected.

I was expecting that it would be visible, but it is not. Is this the expected behaviour?

If so, could someone be kind enough to explain me why this is happening and how I could avoid such cases in the future?

In this plunk, I also included a button that, when clicked, updates the my-title element, and then, the title shows up!

Tia,

An in-range update of rollup is breaking the build 🚨

The devDependency rollup was updated from 1.9.2 to 1.9.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v1.9.3

2019-04-10

Bug Fixes

  • Simplify return expressions that are evaluated before the surrounding function is bound (#2803)

Pull Requests

  • #2803: Handle out-of-order binding of identifiers to improve tree-shaking (@lukastaegert)
Commits

The new version differs by 3 commits.

  • 516a06d 1.9.3
  • a5526ea Update changelog
  • c3d73ff Handle out-of-order binding of identifiers to improve tree-shaking (#2803)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Console Error/Rendering Issue in ES5 Test Page

There is an error in the console on the es5 test page on Chrome version 76 and the "it worked" link is not rendering.

Error is as follows:

Uncaught TypeError: Failed to construct 'HTMLAnchorElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
    at MyLink.Intermediate (es5.js?_=0.48887823511286244:2397)
    at new MyLink (test.es5.js?_=0.18174445391217642:154)

An in-range update of hyperhtml is breaking the build 🚨

The dependency hyperhtml was updated from 2.28.0 to 2.29.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

hyperhtml is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 8 commits.

  • ef6a76e 2.29.0
  • b5f11d8 updated to latest @ungap/template-tag-arguments
  • f53c06b Merge pull request #366 from WebReflection/greenkeeper/domtagger-0.4.0
  • 7a86922 fix(package): update domtagger to version 0.4.0
  • 74e0f39 Update FUNDING.yml
  • 4faa5ab Update FUNDING.yml
  • 1897aa4 Create FUNDING.yml
  • aa9b059 enough of rollup updates

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Alternative to `on` prefix for event listeners

I'm wondering if, for the sake of preventing potential conflicts, you would consider it helpful to making the "on" prefix convention customizable in some manner (or whether you would just expect such users to rely on data-call).

GitHub has a rule to prevent use of on for custom elements due to the possibility of these global events becoming extended, and it would seem to me to be a reasonable concern (even if it doesn't address addEventListener type conflicts). But having a convention such that one could just define methods beginning with event_ or what not, also seems useful to me.

Maybe not too big of a real world concern, but thought I'd request your thoughts on it.

bump hyperhtml dependency

Is there a reason hyperhtml dependency in package.json is still at 0.17.x? Need help updating it to 1.x?

HyperHTMLElement.define('my-tag', class {...}) please

Was hoping to be able to do

HyperHTMLElement.define('my-component', class {
  created() {}
  ...
});

instead of

class MyComponent extends HyperHTMLElement {
  created() {}
  ...
}

MyComponent.define('my-component');

Doesn't seem to work. Can this be made possible?

Btw, really happy to find another solution that's staying close to standards. I think libraries like this and Riot.js and others are the future and will have a longer life because of the decision to stay close to standards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.