Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@astropub/experiments
Advanced tools
A collection of experimental Astro components and tooling.
---
import Poly from '@astropub/experiments/Poly'
import PolyProxy from '@astropub/experiments/PolyProxy'
import ShadowRoot from '@astropub/experiments/ShadowRoot'
---
---
import { Poly, PolyProxy, ShadowRoot } from '@astropub/experiments'
---
The Poly
component generates any type of element from an as
attribute.
---
import Poly from '@astropub/experiments/Poly'
---
<Poly as="h1">
<!-- renders within `<h1>` -->
</Poly>
---
import Poly from '@astropub/experiments/Poly'
---
<Poly as="custom-element">
<!-- renders within `<custom-element>` -->
</Poly>
The PolyProxy
component generates any type of element using dot syntax.
---
import PolyProxy from '@astropub/experiments/PolyProxy'
---
<PolyProxy.h1>
<!-- renders within `<h1>` -->
</PolyProxy.h1>
---
import PolyProxy from '@astropub/experiments/PolyProxy'
---
<PolyProxy.CustomElement>
<!-- renders within `<custom-element>` -->
</PolyProxy>
The ShadowRoot
component generates a <template shadowroot="open">
wrapper.
---
import ShadowRoot from '@astropub/experiments/ShadowRoot'
---
<custom-tabs>
<ShadowRoot>
<!-- renders within `<template shadowroot="open">` -->
<!-- anything here renders within an open shadow dom -->
</ShadowRoot>
</custom-tabs>
---
import ShadowRoot from '@astropub/experiments/ShadowRoot'
---
<custom-tabs>
<ShadowRoot closed>
<!-- renders within `<template shadowroot="closed">` -->
<!-- anything here renders within a closed shadow dom -->
</ShadowRoot>
</custom-tabs>
The toAstroWebComponent
component generates an Astro wrapper for a genuine Web Component.
---
import toAstroWebComponent from '@astropub/experiments/toAstroWebComponent'
const Heading = toAstroWebComponent(
import.meta.glob('../components/HTMLHeadingElement.js'), import.meta.url
)
---
<Heading>
<!-- renders within `<html-heading>` -->
<!-- or whatever name the component is given from `customElements.define` -->
</Heading>
// ../components/HTMLHeadingElement.js
export default class HTMLHeadingElement extends HTMLElement {
connectedCallback() {
const shadowRoot = this.shadowRoot || this.attachShadow({ mode: 'open' })
const h1 = shadowRoot.firstChild || shadowRoot.appendChild(document.createElement('h1'))
h1.firstChild || h1.appendChild(document.createElement('slot'))
}
}
FAQs
A collection of experimental Astro components and tooling.
The npm package @astropub/experiments receives a total of 1 weekly downloads. As such, @astropub/experiments popularity was classified as not popular.
We found that @astropub/experiments demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.