feat: closed shadow root
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 32/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- frontend
調査の方向性
既存の ComponentOptions shadow オブジェクトと @Element() デコレーターを起点にし、ネイティブの Element.attachShadow() を動作のリファレンスとして使用してください。選択した API がデフォルトで open と closed roots をサポートしていること、そしてコンポーネントコードが closed root にアクセスできることを確認し、その結果の動作を文書化またはテストしてください。
索引モデルが issue の本文から書いたものです。
説明
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,
})
- 主要言語
- TypeScript
- スター
- 13.2k
- フォーク
- 865
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 29
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stenciljs/core のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug(mock-doc): `Element.toggleAttribute()` is missing, so components that use it fail during SSRオープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Stencil FOUC styles should use @layer to avoid cascade conflicts with React 19対応中かも @johnjenkins が 230 日前に担当しました。 オープンStencil v5
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
stenciljs/core#7016 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AykutSarac/jsoncrack.com#616 ·
-
nip27: long hashtag swallows the rest of the content, lone # gives an empty hashtag対応中かも @bardrop が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
nbd-wtf/nostr-tools#578 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
backnotprop/plannotator#3427 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/Power-CAT-Copilot-Studio-Kit#942 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Duplicate preposition in heading and unformatted feedback text on Strengthen Argument pageオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AOSSIE-Org/DebateAI#801 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信