feat: closed shadow root
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 32/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- frontend
Línea de trabajo
Comience con el objeto shadow existente de ComponentOptions y el decorador @Element(), utilizando Element.attachShadow() nativo como referencia de comportamiento. Confirme que la API elegida admite open de forma predeterminada y roots cerrados, y que el código del componente puede acceder a un root cerrado; documente o pruebe el comportamiento resultante.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Web components are created with an open shadow root. I would like this to be configurable so that components can be created with a closed shadow root.
Describe the Use Case
My team works on a design system, and many feature teams access the Shadow DOM of our components to make adjustments (rather than reporting feature requests or bug reports). We frequently release typical minor/patch updates, which turn into breaking changes instead as they conflict with the adjustments made by the feature teams.
This is in a complex enterprise environment, where we are unable to enforce our best practices. Enabling closed shadow roots would help us release changes with more confidence.
Describe Preferred Solution
Extend ComponentOptions
The existing shadow property supports an object. The object should have the mode property that can set a shadow root to 'open' (default) or 'closed'. This configuration is my preferred solution as it's identical to the native Element.attachShadow() option.
@Component({
tag: 'my-component',
shadow: { mode: 'closed' },
})
New decorator to access shadow root
With a closed shadow root, the @Element() decorator cannot be used to access its Shadow DOM, as the shadowRoot property is unavailable. So, perhaps a new decorator @ShadowRoot() can assign the shadow root reference. This decorator could also be used for open shadow roots, so it would not necessarily be a "closed shadow root"-only feature.
import { h, Component, ShadowRoot } from '@stencil/core';
@Component({
tag: 'my-component',
shadow: { mode: 'closed' },
})
export class MyComponent {
@ShadowRoot() private shadowRoot;
render() {
return <div></div>;
}
doSomething() {
this.shadowRoot.querySelector('div');
}
}
Describe Alternatives
Alternatively, an additional property is introduced called shadowRoot that accepts the values 'open' (default) or 'closed'. This property would not do anything if shadow was set to false.
@Component({
tag: 'my-component',
shadow: true,
shadowRoot: 'open',
})
Another suggestion is an additional property called closedShadow that accepts the boolean true or false (default). This property would not do anything if shadow was set to false.
@Component({
tag: 'my-component',
shadow: true,
closedShadow: true,
})
- Lenguaje dominante
- TypeScript
- Estrellas
- 13.2k
- Forks
- 865
- Merge medio
- 2 d 16 h
- PR fusionados (30 d)
- 29
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de stenciljs/core
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug(mock-doc): `Element.toggleAttribute()` is missing, so components that use it fail during SSRAbiertotriage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Stencil FOUC styles should use @layer to avoid cascade conflicts with React 19Posiblemente ocupada @johnjenkins la tomó hace 230 días. AbiertoStencil v5
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
stenciljs/core#7016 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
Los mantenedores suelen responder en 1 día
Todos los issues de stenciljs/core
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AykutSarac/jsoncrack.com#616 ·
-
nip27: long hashtag swallows the rest of the content, lone # gives an empty hashtagPosiblemente ocupada @bardrop la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
nbd-wtf/nostr-tools#578 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
backnotprop/plannotator#3427 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/Power-CAT-Copilot-Studio-Kit#942 ·
Los mantenedores suelen responder en 1 día
-
[BUG]: Duplicate preposition in heading and unformatted feedback text on Strengthen Argument pageAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AOSSIE-Org/DebateAI#801 · 1 comentario ·
Los mantenedores suelen responder en 1 día