lit.dev | The Lit website | Web Site library

 by   lit TypeScript Version: Current License: BSD-3-Clause

kandi X-RAY | lit.dev Summary

kandi X-RAY | lit.dev Summary

lit.dev is a TypeScript library typically used in Web Site applications. lit.dev has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

New site, new repo.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              lit.dev has a low active ecosystem.
              It has 89 star(s) with 111 fork(s). There are 17 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 144 open issues and 292 have been closed. On average issues are closed in 152 days. There are 18 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of lit.dev is current.

            kandi-Quality Quality

              lit.dev has 0 bugs and 0 code smells.

            kandi-Security Security

              lit.dev has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              lit.dev code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              lit.dev is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              lit.dev releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 6506 lines of code, 0 functions and 722 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of lit.dev
            Get all kandi verified functions for this library.

            lit.dev Key Features

            No Key Features are available at this moment for lit.dev.

            lit.dev Examples and Code Snippets

            No Code Snippets are available at this moment for lit.dev.

            Community Discussions

            QUESTION

            How to access shadowDom when testing Lit element with open-wc
            Asked 2022-Apr-01 at 16:08

            Lit docs refer to Web Test Runner as testing. It navigates to this example page.

            I tried testing MyElement, which has only one

            .

            ...

            ANSWER

            Answered 2022-Jan-31 at 14:08

            Try shadowRoot instead of shadowDom:

            Source https://stackoverflow.com/questions/70912791

            QUESTION

            How to propagate property value down to a child of a LitElement
            Asked 2022-Mar-31 at 09:48

            I want to compose a LitElement widget from two other widgets. The basic idea would be that one "selector" widget selects something, send an event to its parent "mediator" one, which in turns would update the related property in a "viewer" child widget (event up, property down). This follows the "mediator pattern" example of the documentation about composition, only that I need to deal with fully separated classes.

            Below is a minimum working example, which builds and run in the LitElement TypeScript starter template project, with all dependencies force-updated with ncu --upgradeAll.

            Detailed description

            The desired behavior would be that the Viewer widget does render the item["name"] when the user selects something in the dropdown list.

            So far, I managed to send an event up from the Selector to the Mediator, and to update the item_id attribute within the Viewer. However, this does not seem to trigger an update of the item_id property of the Viewer.

            The approach used is to override updated in the Mediator (l.36), loop through its children and do a child.setAttribute, which is probably highly inelegant. There is surely another —cleaner— way, but I failed to clearly understand the update sequence of Lit.

            Example index.html ...

            ANSWER

            Answered 2022-Mar-31 at 09:48

            You are setting the item only in the connectedCallback. Better you get the item dynamically via getter.

            Regarding your question of setting an attribute of a slotted element, there is in my opinion no other way than programmatically.

            Source https://stackoverflow.com/questions/71681915

            QUESTION

            Lit: nested template doesn't render
            Asked 2022-Mar-07 at 13:12

            I have a really simple template and a simple nested template. Unfortunately, my nested template doesn't render anything.

            I followed the example defined at: https://lit.dev/docs/components/rendering/

            This is my container template.

            ...

            ANSWER

            Answered 2022-Mar-07 at 13:12

            Anytime we implement lifecycle callback methods, it's necessary to call the parent class's methods (so the superclass features work as-expected).

            If you need to customize any of the standard custom element lifecycle methods, make sure to call the super implementation (such as super.connectedCallback()) so the standard Lit functionality is maintained.

            Standard custom element lifecycle

            Source https://stackoverflow.com/questions/70529083

            QUESTION

            Lit components do not automatically request an update on property change (problem only in my storybook)
            Asked 2022-Jan-30 at 18:03

            This is really odd: I'm using lit in a storybook (using @storybook/html). I do not know why, but in my environment lit does not update the component automatically when a property has been changed. If I call requestUpdate explicitly, it is indeed updating. This happens with every component, even this very simple demo component (shows 'waiting...' first, and after 3 seconds it should show 'done') ... working obviously in this codesandbox ... but not working in my storybook :-( https://codesandbox.io/s/weathered-river-087wz?file=/src/index.ts

            Is there by any change anybody who might have an idea what could be the reason for this strange issue? TYVMIA

            [EDIT]: This might be the reason: https://lit.dev/msg/class-field-shadowing You should use "useDefineForClassFields": false in tsconfig.json. Actually I indeed had set it to true, but after changing to false I still have the above issue.

            PS: I'm using the latest versions of lit (2.1.1) and storybook (6.4.13)

            PPS: Removing directory node_modules and file yarn.lock and running yarn install did not solve the problem

            ...

            ANSWER

            Answered 2022-Jan-30 at 18:03

            In tsconfig.json you have to set option useDefineForClassFields to false to make lit run properly. For more information please see https://lit.dev/msg/class-field-shadowing .

            To fully solve the issue with Storybook/Webpack I also had to do the following:

            • yarn add -D ts-loader@8.3.0 (version 9.x does not work with Webpack4)

            • [EDIT: Please check Vince's answer below ... his solution (= main.js + webpackFinal) seems to be the preferred way]

              Adding the following to .storybook/webpack.config.json (not really sure why):

            Source https://stackoverflow.com/questions/70768243

            QUESTION

            static shadowRootOptions in Litelements with Typescript, set mode to open or close
            Asked 2022-Jan-20 at 13:08

            I'm currently diving into Webcomponents with Litelements: In Webcomponents you can change the way the shadowdom works by defining the mode property as 'open' or 'closed'. Like this in vanilla Javascript without LitElements:

            Javascript:

            ...

            ANSWER

            Answered 2022-Jan-20 at 13:08

            By default lit element is acting in mode open. So customLitElement.shadowRoot returns a shadow-root.

            If you want to run it in closed mode implement this method:

            Source https://stackoverflow.com/questions/70769654

            QUESTION

            Can Deno be used to bundle a Lit website?
            Asked 2022-Jan-11 at 16:45

            I'm trying to create a simple proof-of-concept of using Deno to bundle a browser application which is using Lit. Basic functionality (e.g., initial component rendering) is functional, but I'm unable to get simple DOM manipulations to trigger the reactive property changes.

            My simple example can be seen working at this Lit Playground example. An example which does not work is this Deno bundle version. These 2 versions have the exact same source code (i.e., index.html and main.ts).

            You can view all of the code and the build process for creating the Deno bundle here.

            Is Deno capable of producing bundles which behave in the expected manner?

            ...

            ANSWER

            Answered 2022-Jan-11 at 16:45

            Deno 1.17.2 is able to successfully create a bundle. See https://github.com/denoland/deno/issues/13048 for background. As @jsejcksn said, SWC is most likely the culprit for the original issue.

            Source https://stackoverflow.com/questions/70280135

            QUESTION

            Why is there an "." In the option in the lit sample?
            Asked 2021-Jun-23 at 08:13

            lit introduces an example of "Change detection" at the following URL. https://lit.dev/playground/#sample=examples/properties-has-changed

            Why is there a "." at the beginning of "date" when specifying the "date-display" option in line 16 of my-element.ts?

            ...

            ANSWER

            Answered 2021-Jun-23 at 08:13

            Lit uses prefixes to indicate the type of expression in a component's template. The . prefix denotes a property expression; without the prefix it would be an attribute expression. Using a property expression makes it very easy and convenient to pass any JS object to a child element (in this case a Date object).

            When using HTML attributes you need to be aware that they are always strings. JS data must be converted to a string on the parent element, and then possibly converted back to the corresponding JS type on the child element. No such conversion is performed with property expressions, because the data stays in "JS land".

            So, why not always use property expressions? Two examples come to my mind right away:

            1. For a property expression to work you need to know an implementation detail of the child element, i.e. that it has a corresponding JS property. (If you're dealing with your own Lit based elements inside a single project that is not a problem.)

            2. If you want to apply selectors based on attributes (e.g. for styling my-button[disabled] { /* CSS ... /* } or using querySelector).

            Source https://stackoverflow.com/questions/68092977

            QUESTION

            Web components community polymer web components
            Asked 2021-May-17 at 17:18

            If I look at the polymer shop I am instantly sold on wanting to use this as a starter for my web shop. Not just because it's already a web shop (full pwa technology) but because it has excellent (offline) experience on browser/mobile, has proper documentation and is still maintained.

            But then look at the polymer home page and see the project is based on an outdated polymer version and even the fact that it's using polymer in the first place is curious:

            The Polymer library is in maintenance mode. For new development, we recommend Lit.

            So my question is if lit will have the rich choice of web components that the shop seems to be depending on?

            This may be a dumb question but I skipped polymer other than looking at some exciting news in google IO

            ...

            ANSWER

            Answered 2021-May-17 at 17:18

            The goal of Lit, and of Polymer before it, is to help build web components and applications using browser features as much as possible.

            For instance jQuery wrapped all the different browser features in it's own syntax, to the point where developers were learning jQuery, rather than Javascript. jQuery components assume that you have jQuery and rely on those jQuery methods to function.

            Both Lit and Polymer championed web components - this makes each component much more self-contained. Using a mix of jQuery and any of its competitors was really painful, but that isn't the case here.

            All the components used to build that shop are stable and still on npm. You can use them if you want and I have live applications that still use them.

            However, championing the latest browser features has its risks. Polymer relied heavily on HTML Imports (that only Chrome ever implemented and were ultimately dropped) and its own template library. It was ultimately ported to ES6 modules, but the core design is far less suited to it. Those components are pretty stable, but you don't really want to start anything new with it.

            Lit is quite a lot less opinionated than Polymer, and much lower level. For instance Polymer supported two way binding with {{property}} syntax, but had to make assumptions (that often broke) about what you were doing to support it. Lit drops that for extremely stable property setters but if you want to users to write values you have to subscribe to events and roll that yourself (Lit does make events very easy to manage though).

            So if you're going to build your own web components or application Lit is by far the better choice, and LitElement is lightweight and extremely compatible with everything else. You can use those Polymer shop components in Lit (I have) but for most of them there are newer alternatives, in particular MWC.

            Source https://stackoverflow.com/questions/67474734

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install lit.dev

            You can download it from GitHub.

            Support

            See the Tutorial Contributing guide at packages/lit-dev-content/samples/tutorials/CONTRIBUTING.md.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/lit/lit.dev.git

          • CLI

            gh repo clone lit/lit.dev

          • sshUrl

            git@github.com:lit/lit.dev.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Web Site Libraries

            website

            by CodingTrain

            itty-bitty

            by alcor

            pinax

            by pinax

            clippy.js

            by smore-inc

            open-event-wsgen

            by fossasia

            Try Top Libraries by lit

            lit

            by litTypeScript

            lit-element

            by litTypeScript

            lit-element-starter-ts

            by litJavaScript

            lit-element-starter-js

            by litJavaScript

            video-series-samples

            by litTypeScript