ssleptsov / ninja-keys

Keyboard shortcuts interface for your website. Working with static HTML, Vanilla JS, Vue, React, Svelte.
https://ninja-keys-demo.vercel.app/
MIT License
1.62k stars 60 forks source link

Module error for lit-html@3.0.0/lit-html.js #51

Closed saurabh69912162 closed 3 months ago

saurabh69912162 commented 11 months ago

image

lit-html@3.0.0/lit-html.js - This file is responding with error 500, resulting in the non-functioning of Ninja Keys in HTML.

Ninja-keys HTML Sandbox is also not working.

blairanderson commented 11 months ago

I am getting the same: https://unpkg.com/lit-html@3.0.0/async-directive.js?module

Cannot generate module for lit-html@3.0.0/async-directive.js

SyntaxError: unknown: Support for the experimental syntax 'logicalAssignment' isn't currently enabled (6:616):

  4 |  * Copyright 2017 Google LLC
  5 |  * SPDX-License-Identifier: BSD-3-Clause
> 6 |  */const s=(i,t)=>{const e=i._$AN;if(void 0===e)return!1;for(const i of e)i._$AO?.(t,!1),s(i,t);return!0},o=i=>{let t,e;do{if(void 0===(t=i._$AM))break;e=t._$AN,e.delete(i),i=t}while(0===e?.size)},r=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),c(t)}};function h(i){void 0!==this._$AN?(o(this),this._$AM=i,r(this)):this._$AM=i}function n(i,t=!1,e=0){const r=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)s(r[i],!1),o(r[i]);else null!=r&&(s(r,!1),o(r));else s(this,i)}const c=i=>{i.type==e.CHILD&&(i._$AP??=n,i._$AQ??=h)};class f extends t{constructor(){super(...arguments),this._$AN=void 0}_$AT(i,t,e){super._$AT(i,t,e),r(this),this.isConnected=i._$AU}_$AO(i,t=!0){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(s(this,i),o(this))}setValue(t){if(i(this._$Ct))this._$Ct._$AI(t,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}}export{f as AsyncDirective};
    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ^
  7 | 
  8 | 

Add @babel/plugin-proposal-logical-assignment-operators (https://git.io/vAlRe) to the 'plugins' section of your Babel config to enable transformation.

undefined
blairanderson commented 11 months ago

@saurabh69912162 ninja-keys has not been updated since July 2022.

Somehow its using a lit component with latest version of lit-html and that latest version is broken.

Lit is probably going to fix itself.

ls-jf-gagnon commented 11 months ago

As a workaround, for now, you can add an import map to overwrite the path of the lit-html lib


<script type="importmap">
    {
        "imports": {
            "https://unpkg.com/lit-html@latest/directives/ref.js?module": "https://unpkg.com/lit-html@2.2.6/directives/ref.js?module"
        }
    }
</script>
saurabh69912162 commented 11 months ago

@ls-jf-gagnon - Thanks! it worked

As a workaround, for now, you can add an import map to overwrite the path of the lit-html lib

<script type="importmap">
    {
        "imports": {
            "https://unpkg.com/lit-html@latest/directives/ref.js?module": "https://unpkg.com/lit-html@2.2.6/directives/ref.js?module"
        }
    }
</script>
legend80s commented 11 months ago

You man are awesome!

tiagorangel2011 commented 10 months ago

As a workaround, for now, you can add an import map to overwrite the path of the lit-html lib

<script type="importmap">
    {
        "imports": {
            "https://unpkg.com/lit-html@latest/directives/ref.js?module": "https://unpkg.com/lit-html@2.2.6/directives/ref.js?module"
        }
    }
</script>

Thank you so much, it works!