atoms-element v5.0.0

#js

git clone https://git.pyrossh.dev/atoms-element

A simple web component library for defining your custom elements. It works on both client and server.


index.test.js.snapshot
4c11234 1
exports[`createElement styles are scoped and injected via SSR 1`] = `
4c11234 2
"@scope (styled-element) {\\n\\n    :scope {\\n      display: flex;\\n    }\\n    .count {\\n      color: magenta;\\n    }\\n  \\n}\\n"
4c11234 3
`;
4c11234 4
e955350 5
exports[`createElement with plain and declared attrs 1`] = `
e955350 6
"<!--lit-part Nrj3ntAoYvc=-->\\n      <div>\\n        <span>perPage: <!--lit-part-->5<!--/lit-part--></span>\\n        <span>Count: <!--lit-part-->3<!--/lit-part--></span>\\n        <!--lit-node 5--><button >Set</button>\\n      </div>\\n    <!--/lit-part-->"
4c11234 7
`;
4c11234 8
4c11234 9
exports[`createElement without attrs 1`] = `
25308a9 10
"<!--lit-part Wd91oPYJke0=--> <div></div> <!--/lit-part-->"
4c11234 11
`;
4c11234 12
4c11234 13
exports[`createPage 1`] = `
0000000 14
"\\n      <!DOCTYPE html>\\n      <html lang=\\"en\\">\\n        <head>\\n          <meta charset=\\"utf-8\\" />\\n          <meta http-equiv=\\"x-ua-compatible\\" content=\\"ie=edge\\" />\\n          <meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=utf-8\\">\\n          <meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=5.0, shrink-to-fit=no\\">\\n          <link rel=\\"sitemap\\" type=\\"application/xml\\" href=\\"/sitemap.xml\\" />\\n          <link rel=\\"icon\\" type=\\"image/png\\" href=\\"/assets/icon.png\\" />\\n          \\n      <title>123</title>\\n      <meta name=\\"title\\" content=\\"123\\" />\\n      <meta name=\\"description\\" content=\\"123\\" />\\n    \\n          <style id=\\"global\\">\\n            \\n          </style>\\n          <script type=\\"module\\"><script>\\n        </head>\\n        <body>\\n          \\n      <div>\\n        <app-header></app-header>\\n        <main class=\\"flex flex-1 flex-col mt-20 items-center\\">\\n          <h1 class=\\"text-5xl\\">123</h1>\\n        </main>\\n      </div>\\n    \\n          <script>\\n            window.props = {\\"config\\":{\\"title\\":\\"123\\"}};\\n          </script>\\n          <script type=\\"module\\"><script>\\n        </body>\\n      </html>\\n  "
4c11234 15
`;
4c11234 16
0000000 17
exports[`css tagged template ignores interpolated values 1`] = `
0000000 18
"\\n    :scope {\\n      display: flex;\\n    }\\n    button {\\n      color: ;\\n    }\\n  "
4c11234 19
`;
4c11234 20
2124035 21
exports[`jsonAttr round-trips array attrs through SSR expansion 1`] = `
2124035 22
"<!--lit-part BlC1BjVGRpM=--><!--lit-node 0--><tag-list tags=\\"[&#39;rust&#39;,&#39;js&#39;]\\"><!--lit-part om80B80ddXw=--><ul><!--lit-part--><!--lit-part PuAyB/F8cHw=--><li><!--lit-part-->rust<!--/lit-part--></li><!--/lit-part--><!--lit-part PuAyB/F8cHw=--><li><!--lit-part-->js<!--/lit-part--></li><!--/lit-part--><!--/lit-part--></ul><!--/lit-part--></tag-list><!--/lit-part-->"
2124035 23
`;
2124035 24
4c11234 25
exports[`render attribute keys 1`] = `
25308a9 26
"<!--lit-part Jm3yLdRDsSk=-->\\n    <div>\\n      <app-counter name=\\"123\\" perPage=\\"1\\"></app-counter>\\n    </div>\\n  <!--/lit-part-->"
4c11234 27
`;
4c11234 28
4c11234 29
exports[`render attributes within quotes 1`] = `
25308a9 30
"<!--lit-part NYzZmKc0ApY=-->\\n    <div>\\n      <!--lit-node 1--><app-counter name=\\"123\\" class=\\"high\\" age=\\"1\\" details1=\\"{&#39;name&#39;:&#39;123&#39;,&#39;address&#39;:{&#39;street&#39;:&#39;1&#39;}}\\" items=\\"[1,2,3]\\"></app-counter>\\n    </div>\\n  <!--/lit-part-->"
4c11234 31
`;
4c11234 32
4c11234 33
exports[`render multi template 1`] = `
25308a9 34
"<!--lit-part xbA0QwrFuvM=-->\\n    <div>\\n      <!--lit-part--><!--lit-part iq0TqtY/tw4=-->\\n          <!--lit-node 0--><app-item meta=\\"{&#39;index&#39;:1}\\"  >\\n            <!--lit-node 1--><button >+</button>\\n          </app-item>\\n        <!--/lit-part--><!--lit-part iq0TqtY/tw4=-->\\n          <!--lit-node 0--><app-item meta=\\"{&#39;index&#39;:2}\\"  >\\n            <!--lit-node 1--><button >+</button>\\n          </app-item>\\n        <!--/lit-part--><!--/lit-part-->\\n    </div>\\n  <!--/lit-part-->"
4c11234 35
`;
4c11234 36
4c11234 37
exports[`render single template 1`] = `
25308a9 38
"<!--lit-part Wd91oPYJke0=--> <div><!--lit-part 8PHODPkg0Ao=-->NoCountry <!--lit-part-->false<!--/lit-part--><?><!--/lit-part--></div> <!--/lit-part-->"
4c11234 39
`;
4c11234 40
4c11234 41
exports[`render unsafeHTML 1`] = `
25308a9 42
"<!--lit-part Wd91oPYJke0=--> <div><!--lit-part MbydkCRGgUo=--><div><p class=\\"123\\">this is unsafe</p></div><!--/lit-part--></div> <!--/lit-part-->"
4c11234 43
`;
4c11234 44
4c11234 45
exports[`renderHtml 1`] = `
25308a9 46
"<!--lit-part 4yM259EK+Bs=-->\\n    <div>\\n      <!--lit-node 1--><app-counter name=\\"123\\" class=\\"abc high\\" age=\\"1\\" details1=\\"{&#39;name&#39;:&#39;123&#39;,&#39;address&#39;:{&#39;street&#39;:&#39;1&#39;}}\\" items=\\"[1,2,3]\\"></app-counter>\\n    </div>\\n  <!--/lit-part-->"
4c11234 47
`;
4c11234 48
4c11234 49
exports[`renderHtml escapes text and attribute values 1`] = `
25308a9 50
"<!--lit-part PkF/hiJU4II=--><!--lit-node 0--><div class=\\"a&quot; onmouseover=&quot;alert(1)\\"><!--lit-part-->&lt;script&gt;alert(1)&lt;/script&gt;<!--/lit-part--></div><!--/lit-part-->"
4c11234 51
`;
e955350 52
e955350 53
exports[`watch resolves attribute values from preceding SSR markup via cheerio 1`] = `
e955350 54
"<!--lit-part vohwtdYoJ0A=-->\\n    <watch-source value=\\"3\\"><!--lit-part 94tjhjhkEYE=--><span><!--lit-part-->3<!--/lit-part--></span><!--/lit-part--></watch-source>\\n    <watch-source value=\\"4\\"><!--lit-part 94tjhjhkEYE=--><span><!--lit-part-->4<!--/lit-part--></span><!--/lit-part--></watch-source>\\n    <watch-total><!--lit-part AEmR7W+R0Ak=--><div><!--lit-part-->3,4<!--/lit-part--></div><!--/lit-part--></watch-total>\\n  <!--/lit-part-->"
e955350 55
`;