Skip to content

Commit

Permalink
Merge pull request #91 from break-stuff/custom-jsdoc-tags
Browse files Browse the repository at this point in the history
Custom jsdoc tags implementation
  • Loading branch information
break-stuff authored Feb 26, 2024
2 parents d1aaf41 + d1c006d commit f873bdc
Show file tree
Hide file tree
Showing 15 changed files with 1,525 additions and 313 deletions.
14 changes: 13 additions & 1 deletion demo/lit-app/custom-elements-manifest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { customElementReactWrapperPlugin } from "custom-element-react-wrappers";
import { customElementVuejsPlugin } from "custom-element-vuejs-integration";
import { customElementLazyLoaderPlugin } from "custom-element-lazy-loader";
import { customElementSveltePlugin } from "custom-element-svelte-integration";
import { customJSDocTagsPlugin } from "cem-plugin-custom-jsdoc-tags";

export default {
/** Globs to analyze */
Expand Down Expand Up @@ -75,6 +76,17 @@ export default {
}),
customElementLazyLoaderPlugin({
importPathTemplate: (name, tag) => `./dist/${tag}/${name}.js`,
})
}),
customJSDocTagsPlugin({
tags: {
since: {},
dependency: {
mappedName: 'dependencies',
isArray: true,
},
fancy: {},
default: {}
}
}),
],
};
70 changes: 56 additions & 14 deletions demo/lit-app/custom-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,32 @@
"package": "lit"
},
"tagName": "radio-group",
"since": {
"name": "1.2.5",
"description": ""
},
"dependencies": [
{
"name": "icon",
"description": ""
},
{
"name": "button",
"description": ""
}
],
"fancy": {
"name": "custom-tag",
"default": "default value",
"description": "This is a fancy attribute",
"type": {
"text": "string"
}
},
"default": {
"name": "",
"description": "This has no name"
},
"customElement": true
}
],
Expand Down Expand Up @@ -522,6 +548,22 @@
},
"tagName": "radio-button",
"summary": "Radio buttons allow users to select a single option from a group. Here is its [documentation](https://my-site.com/documentation).\\n\\nUse it like this:\\n```html\\n<radio-button value=\"1\" disabled>Your label</radio-button>\\n```",
"dependencies": [
{
"name": "icon",
"description": ""
}
],
"since": [
{
"name": "1.2.5",
"description": ""
},
{
"name": "1.3.0",
"description": "There was a major refactor in this release"
}
],
"customElement": true
}
],
Expand Down Expand Up @@ -577,46 +619,46 @@
},
{
"kind": "javascript-module",
"path": "src/radio-group/radio-group.ts",
"path": "src/radio-button/radio-button.ts",
"declarations": [],
"exports": [
{
"kind": "js",
"name": "RadioGroup",
"name": "RadioButton",
"declaration": {
"name": "RadioGroup",
"module": "src/radio-group/radio-group.ts"
"name": "RadioButton",
"module": "src/radio-button/radio-button.ts"
}
},
{
"kind": "custom-element-definition",
"name": "radio-group",
"name": "radio-button",
"declaration": {
"name": "RadioGroup",
"module": "/src/radio-group/RadioGroup.js"
"name": "RadioButton",
"module": "/src/radio-button/RadioButton.js"
}
}
]
},
{
"kind": "javascript-module",
"path": "src/radio-button/radio-button.ts",
"path": "src/radio-group/radio-group.ts",
"declarations": [],
"exports": [
{
"kind": "js",
"name": "RadioButton",
"name": "RadioGroup",
"declaration": {
"name": "RadioButton",
"module": "src/radio-button/radio-button.ts"
"name": "RadioGroup",
"module": "src/radio-group/radio-group.ts"
}
},
{
"kind": "custom-element-definition",
"name": "radio-button",
"name": "radio-group",
"declaration": {
"name": "RadioButton",
"module": "/src/radio-button/RadioButton.js"
"name": "RadioGroup",
"module": "/src/radio-group/RadioGroup.js"
}
}
]
Expand Down
18 changes: 16 additions & 2 deletions demo/lit-app/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@ let observer;
let components = {
"radio-group": {
importPath: "./dist/radio-group/RadioGroup.js",
dependencies: [],
dependencies: [
{
name: "icon",
description: "",
},
{
name: "button",
description: "",
},
],
},
"radio-button": {
importPath: "./dist/radio-button/RadioButton.js",
dependencies: [],
dependencies: [
{
name: "icon",
description: "",
},
],
},
};
const eagerLoad = [];
Expand Down
1 change: 1 addition & 0 deletions demo/lit-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"devDependencies": {
"cem-plugin-expanded-types": "*",
"cem-plugin-custom-jsdoc-tags": "*",
"custom-element-jet-brains-integration": "*",
"custom-element-jsx-integration": "*",
"custom-element-lazy-loader": "*",
Expand Down
5 changes: 5 additions & 0 deletions demo/lit-app/src/radio-button/RadioButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export enum Direction {
*
* @slot - add text here to label your radio button
*
* @dependency icon
*
* @since 1.2.5
* @since 1.3.0 - There was a major refactor in this release
*
*/
export class RadioButton extends LitElement {
/** The value assigned to the radio button. This will reflect in the radio group when clicked. */
Expand Down
9 changes: 9 additions & 0 deletions demo/lit-app/src/radio-group/RadioGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ export type Example = Test2 | 'valueA' | 'valueB';
* @fires {HTMLInputElement } typed-event - some description for typed-event
* @event {InterfaceEventType} typed-custom-event - some description for typed-custom-event
*
* @since 1.2.5
*
* @dependency icon
* @dependency button
*
* @fancy {string} [custom-tag=default value] - This is a fancy attribute
*
* @default - This has no name
*
*/
export class RadioGroup extends LitElement {
/** The value assigned to the radio button. This will reflect in the radio group when clicked. */
Expand Down
Loading

0 comments on commit f873bdc

Please sign in to comment.