Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@astrojs/lit

Package Overview
Dependencies
Maintainers
4
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/lit - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

8

CHANGELOG.md
# @astrojs/lit
## 0.3.0
### Minor Changes
- [#3652](https://github.com/withastro/astro/pull/3652) [`7373d61c`](https://github.com/withastro/astro/commit/7373d61cdcaedd64bf5fd60521b157cfa4343558) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Adds support for passing named slots from `.astro` => Lit components.
All slots are treated as Light DOM content.
## 0.2.0

@@ -4,0 +12,0 @@

4

package.json
{
"name": "@astrojs/lit",
"version": "0.2.0",
"version": "0.3.0",
"description": "Use Lit components within Astro",

@@ -32,3 +32,3 @@ "type": "module",

"devDependencies": {
"astro": "1.0.0-beta.48",
"astro": "1.0.0-beta.54",
"astro-scripts": "0.0.4",

@@ -35,0 +35,0 @@ "cheerio": "^1.0.0-rc.11",

@@ -29,3 +29,3 @@ import './server-shim.js';

function* render(Component, attrs, children) {
function* render(Component, attrs, slots) {
let tagName = Component;

@@ -61,11 +61,19 @@ if (typeof tagName !== 'string') {

}
yield children || ''; // don’t print “undefined” as string
if (slots) {
for (const [slot, value] of Object.entries(slots)) {
if (slot === 'default') {
yield `<astro-slot>${value || ''}</astro-slot>`;
} else {
yield `<astro-slot slot="${slot}">${value || ''}</astro-slot>`;
}
}
}
yield `</${tagName}>`;
}
async function renderToStaticMarkup(Component, props, children) {
async function renderToStaticMarkup(Component, props, slots) {
let tagName = Component;
let out = '';
for (let chunk of render(tagName, props, children)) {
for (let chunk of render(tagName, props, slots)) {
out += chunk;

@@ -72,0 +80,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc