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

Commit c552658

Browse files
authored
Merge pull request #91 from github/cem
Custom Element Manifest
2 parents 3539591 + 07fdac5 commit c552658

7 files changed

+5884
-97
lines changed

README.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# <details-dialog> element
22

3-
A modal dialog that's opened with a <details> button.
3+
A modal dialog opened with a <details> button.
44

55
## Installation
6-
6+
Available on [npm](https://www.npmjs.com/) as [**@github/details-dialog-element**](https://www.npmjs.com/package/@github/details-dialog-element).
77
```
88
$ npm install --save @github/details-dialog-element
99
```
@@ -77,23 +77,14 @@ document.addEventListener('details-dialog-close', function(event) {
7777
## Browser support
7878
7979
Browsers without native [custom element support][support] require a [polyfill][].
80-
8180
- Chrome
8281
- Firefox
8382
- Safari
8483
- Microsoft Edge
8584
86-
## Development
87-
88-
```
89-
npm install
90-
npm test
91-
```
85+
[support]: https://caniuse.com/custom-elementsv1
86+
[polyfill]: https://github.com/webcomponents/custom-elements
9287
9388
## License
9489
95-
Distributed under the MIT license. See LICENSE for details.
96-
97-
[fragment]: https://github.com/github/include-fragment-element/
98-
[support]: https://caniuse.com/#feat=custom-elementsv1
99-
[polyfill]: https://github.com/webcomponents/custom-elements
90+
Distributed under the MIT license. See LICENSE for details.

custom-elements-manifest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {generateCustomData} from 'cem-plugin-vs-code-custom-data-generator'
2+
import {readme} from '@github/cem-plugin-readme'
3+
4+
export default {
5+
packagejson: true,
6+
globs: ['src/index.ts'],
7+
plugins: [
8+
readme(),
9+
generateCustomData()
10+
]
11+
}

custom-elements.json

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"schemaVersion": "1.0.0",
3+
"readme": "",
4+
"modules": [
5+
{
6+
"kind": "javascript-module",
7+
"path": "src/index.ts",
8+
"declarations": [
9+
{
10+
"kind": "class",
11+
"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```",
12+
"name": "DetailsDialogElement",
13+
"members": [
14+
{
15+
"kind": "field",
16+
"name": "CLOSE_ATTR",
17+
"static": true
18+
},
19+
{
20+
"kind": "field",
21+
"name": "CLOSE_SELECTOR",
22+
"static": true
23+
},
24+
{
25+
"kind": "field",
26+
"name": "src",
27+
"type": {
28+
"text": "string | null"
29+
}
30+
},
31+
{
32+
"kind": "field",
33+
"name": "preload",
34+
"type": {
35+
"text": "boolean"
36+
}
37+
},
38+
{
39+
"kind": "method",
40+
"name": "toggle",
41+
"return": {
42+
"type": {
43+
"text": "void"
44+
}
45+
},
46+
"parameters": [
47+
{
48+
"name": "open",
49+
"type": {
50+
"text": "boolean"
51+
}
52+
}
53+
]
54+
}
55+
],
56+
"attributes": [
57+
{
58+
"name": "src"
59+
},
60+
{
61+
"name": "preload"
62+
}
63+
],
64+
"superclass": {
65+
"name": "HTMLElement"
66+
},
67+
"tagName": "details-dialog",
68+
"customElement": true
69+
}
70+
],
71+
"exports": [
72+
{
73+
"kind": "js",
74+
"name": "default",
75+
"declaration": {
76+
"name": "DetailsDialogElement",
77+
"module": "src/index.ts"
78+
}
79+
},
80+
{
81+
"kind": "custom-element-definition",
82+
"name": "details-dialog",
83+
"declaration": {
84+
"name": "DetailsDialogElement",
85+
"module": "src/index.ts"
86+
}
87+
}
88+
]
89+
}
90+
]
91+
}

0 commit comments

Comments
 (0)