Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 22, 2022. It is now read-only.

Custom Element Manifest #91

Merged
merged 13 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# <details-dialog> element

A modal dialog that's opened with a <details> button.
A modal dialog opened with a <details> button.

## Installation

Available on [npm](https://www.npmjs.com/) as [**@github/details-dialog-element**](https://www.npmjs.com/package/@github/details-dialog-element).
```
$ npm install --save @github/details-dialog-element
```
Expand Down Expand Up @@ -77,23 +77,14 @@ document.addEventListener('details-dialog-close', function(event) {
## Browser support

Browsers without native [custom element support][support] require a [polyfill][].

- Chrome
- Firefox
- Safari
- Microsoft Edge

## Development

```
npm install
npm test
```
[support]: https://caniuse.com/custom-elementsv1
[polyfill]: https://github.com/webcomponents/custom-elements

## License

Distributed under the MIT license. See LICENSE for details.

[fragment]: https://github.com/github/include-fragment-element/
[support]: https://caniuse.com/#feat=custom-elementsv1
[polyfill]: https://github.com/webcomponents/custom-elements
Distributed under the MIT license. See LICENSE for details.
11 changes: 11 additions & 0 deletions custom-elements-manifest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {generateCustomData} from 'cem-plugin-vs-code-custom-data-generator'
import {readme} from '@github/cem-plugin-readme'

export default {
packagejson: true,
globs: ['src/index.ts'],
plugins: [
readme(),
generateCustomData()
]
}
91 changes: 91 additions & 0 deletions custom-elements.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"schemaVersion": "1.0.0",
"readme": "",
"modules": [
{
"kind": "javascript-module",
"path": "src/index.ts",
"declarations": [
{
"kind": "class",
"description": "### Markup\n\n```html\n<details>\n <summary>Open dialog</summary>\n <details-dialog>\n Modal content\n <button type=\"button\" data-close-dialog>Close</button>\n </details-dialog>\n</details>\n```\n\n## Deferred loading\n\nDialog content can be loaded from a server by embedding an [`<include-fragment>`][fragment] element.\n\n```html\n<details>\n <summary>Robots</summary>\n <details-dialog src=\"/robots\" preload>\n <include-fragment>Loading…</include-fragment>\n </details-dialog>\n</details>\n```\n\nThe `src` attribute value is copied to the `<include-fragment>` the first time the `<details>` button is toggled open, which starts the server fetch.\n\nIf the `preload` attribute is present, hovering over the `<details>` element will trigger the server fetch.\n\n## Events\n\n### `details-dialog-close`\n\n`details-dialog-close` event is fired from `<details-dialog>` when a request to close the dialog is made from\n\n- pressing <kbd>escape</kbd>,\n- submitting a `form[method=\"dialog\"]`\n- clicking on `summary, form button[formmethod=\"dialog\"], [data-close-dialog]`, or\n- `dialog.toggle(false)`\n\nThis event bubbles, and can be canceled to keep the dialog open.\n\n```js\ndocument.addEventListener('details-dialog-close', function(event) {\n if (!confirm('Are you sure?')) {\n event.preventDefault()\n }\n})\n```",
"name": "DetailsDialogElement",
"members": [
{
"kind": "field",
"name": "CLOSE_ATTR",
"static": true
},
{
"kind": "field",
"name": "CLOSE_SELECTOR",
"static": true
},
{
"kind": "field",
"name": "src",
"type": {
"text": "string | null"
}
},
{
"kind": "field",
"name": "preload",
"type": {
"text": "boolean"
}
},
{
"kind": "method",
"name": "toggle",
"return": {
"type": {
"text": "void"
}
},
"parameters": [
{
"name": "open",
"type": {
"text": "boolean"
}
}
]
}
],
"attributes": [
{
"name": "src"
},
{
"name": "preload"
}
],
"superclass": {
"name": "HTMLElement"
},
"tagName": "details-dialog",
"customElement": true
}
],
"exports": [
{
"kind": "js",
"name": "default",
"declaration": {
"name": "DetailsDialogElement",
"module": "src/index.ts"
}
},
{
"kind": "custom-element-definition",
"name": "details-dialog",
"declaration": {
"name": "DetailsDialogElement",
"module": "src/index.ts"
}
}
]
}
]
}
Loading