Skip to content

Commit

Permalink
Missing hint for webcomponent prop for LuigiContainer (#3806)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer authored Jul 8, 2024
1 parent 1cc7493 commit 061b9fe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions container/typings/LuigiContainer.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ export default class LuigiContainer extends HTMLElement {
* @param {boolean} WebComponentSettings.selfRegistered: if it is true, the web component bundle will be added via script tag.
* @param {string} WebComponentSettings.tagName: tag name where web component is added to DOM.
* @param {string} string must be a stringified boolean or JSON object from type `WebComponentSettings`.
*
* </br></br>
* <blockquote class="warning">
* <p>
* <strong>Note:</strong> If you have to use the mechanism of `selfRegistered`, we recommend using the following code in your web component:
* </p>
* </blockquote>
* <pre><code>
* window.Luigi._registerWebcomponent(new URL(document.currentScript?.getAttribute('src'), location), <YOUR_WEBCOMPONENT_CLASS>);
* </code></pre>
* The advantage of this line of code is: you don't have to specify a tag name, thus avoiding the duplication of self-defined tag names.
* </br>
* @since 1.0.0
*/
webcomponent: boolean | WebComponentSettings | string;
Expand Down
11 changes: 10 additions & 1 deletion docs/luigi-container-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ Type: ([boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Glo
- `WebComponentSettings.type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : string, like module.
- `WebComponentSettings.selfRegistered` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** : if it is true, the web component bundle will be added via script tag.
- `WebComponentSettings.tagName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : tag name where web component is added to DOM.
- `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** must be a stringified boolean or JSON object from type `WebComponentSettings`.
- `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** must be a stringified boolean or JSON object from type `WebComponentSettings`.</br></br><blockquote class="warning">
<p>
<strong>Note:</strong> If you have to use the mechanism of `selfRegistered`, we recommend using the following code in your web component:
</p>
</blockquote>
<pre><code>
window.Luigi._registerWebcomponent(new URL(document.currentScript?.getAttribute('src'), location), <YOUR_WEBCOMPONENT_CLASS>);
</code></pre>
The advantage of this line of code is: you don't have to specify a tag name, thus avoiding the duplication of self-defined tag names.
</br>

**Meta**

Expand Down

0 comments on commit 061b9fe

Please sign in to comment.