lit-element

Relative references must start with either “/”, “./”, or “../”

狂风中的少年 提交于 2021-02-18 21:12:08
问题 I am newbie to lit-element, and when use import to include the library, I am getting error as: Uncaught TypeError: Failed to resolve module specifier "lit-element". Relative references must start with either "/", "./", or "../". Please provide any alternatives/solutions. import { LitElement, html } from 'lit-element'; class MyElement extends LitElement { render(){ return html` <div> <p>A paragraph</p> </div> `; } } customElements.define('my-element', MyElement); 回答1: This doesn't work because

Relative references must start with either “/”, “./”, or “../”

懵懂的女人 提交于 2021-02-18 21:12:01
问题 I am newbie to lit-element, and when use import to include the library, I am getting error as: Uncaught TypeError: Failed to resolve module specifier "lit-element". Relative references must start with either "/", "./", or "../". Please provide any alternatives/solutions. import { LitElement, html } from 'lit-element'; class MyElement extends LitElement { render(){ return html` <div> <p>A paragraph</p> </div> `; } } customElements.define('my-element', MyElement); 回答1: This doesn't work because

main differences between lit-element & React [closed]

限于喜欢 提交于 2021-02-07 22:21:29
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . Improve this question I have learned and worked with "Lit-element" with some projects. But I have no experiences with working "React" before. Looking into React code it seems more similar to "Lit-Element". It is very helpful if someone can explain the main differences between the

main differences between lit-element & React [closed]

旧城冷巷雨未停 提交于 2021-02-07 22:20:36
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . Improve this question I have learned and worked with "Lit-element" with some projects. But I have no experiences with working "React" before. Looking into React code it seems more similar to "Lit-Element". It is very helpful if someone can explain the main differences between the

Test lit-element webcomponent with Karma

情到浓时终转凉″ 提交于 2021-01-29 11:28:51
问题 I am trying to create a blank project, like a template, using lit-html. I wanted to also add some testing capabilities, so i have been trying to get it to work with Karma. I can run a normal test, like an addition, without any errors, so i think Karma itself is running ok. but i can't run any test involving the webcomponent. I can't import the webcomponent! i am exporting the webcomponent with: export default class MyComponent ... and then on the test file i am importing it with: import

Creating a standalone web component build using as an IIFE

房东的猫 提交于 2021-01-29 11:26:44
问题 I have create a web component for displaying gists generally in any html content. I used the Lit Element Typescript Starter Project as a baseline and it comes with a rollup.config.js file. I changed the output format to iife and left the rest the same, with exception of the component and bundle names. The reason I did this is that I wanted the bundle to be easily accessible via script tags, and rollup says that the iife format does this. This is the modified rollup.config.js file. // ========

How can I get component state change in another component with litElement?

*爱你&永不变心* 提交于 2021-01-28 08:50:37
问题 I started a project based on LitElement There are many components nested in each other, Let us say we have this structure: the root component is my-app import { LitElement, html, customElement, query } from 'lit-element'; import './my-form'; import './my-view'; import { MyView } from './my-view'; @customElement('my-app') export class MyApp extends LitElement { @query('my-view') private myView?: MyView; private handleCountChange(e: CustomEvent<{ count: number }>) { if (!this.myView) throw 'my

How to clear datalist input on click?

戏子无情 提交于 2021-01-27 12:53:38
问题 I have this datalist inside a Lit-Element web component: <input list="cars" name="car" placeholder = "Type car name"> <datalist id="cars"> <option value="Jeep"> <option value="Lamborghini"> <option value="Ferrari"> <option value="Fiat 500"> <option value="Gran Torino"> </datalist> If I select one of these options from the list, and then I click again on input field, I can't see the list of option but only the selected one. If I want to see all the options I have to manually delete with the

How to test Web Component (lit-element) with jest

ⅰ亾dé卋堺 提交于 2020-07-05 03:09:31
问题 Anyone that has a good setup for testing custom elements with jest with jsdom or similar? I have been using Puppeteer ans Selenium, but they slows down the test runs too much. Any other alternatives to or fixes for jsdom that makes the below test runnable? import {LitElement} from 'lit-element'; import {html} from 'lit-html'; export class Counter extends LitElement { static get properties() { return Object.assign({}, super.properties, { count: {type: Number} }); } render() { return html`Count