Skip to content

Commit

Permalink
Merge pull request #87 from break-stuff/make-description-src-a-loose-…
Browse files Browse the repository at this point in the history
…string

allow any string to be set for `descriptionSrc` option
  • Loading branch information
break-stuff authored Feb 24, 2024
2 parents 0b93a31 + 697d7e0 commit a59eb2c
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 17 deletions.
4 changes: 4 additions & 0 deletions packages/jet-brains-integration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.4.4

- Allow any string for `descriptionSrc`

## 1.4.3

- Exclude private methods and properties using the `#` access modifier
Expand Down
2 changes: 1 addition & 1 deletion packages/jet-brains-integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-element-jet-brains-integration",
"version": "1.4.3",
"version": "1.4.4",
"description": "Tools for integrating web components/custom elements into JetBrains IDEs",
"main": "index.js",
"module": "index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/jsx-integration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.3.1

- Allow any string for `descriptionSrc`

## 1.3.0

- Added additional default attributes - `className`, `dir`, `exportparts`, `htmlFor`, `hidden`, `id`, `lang`, `ref`, `tabIndex`, `title`, and `translate`.
Expand Down
2 changes: 1 addition & 1 deletion packages/jsx-integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-element-jsx-integration",
"version": "1.3.0",
"version": "1.3.1",
"description": "Tools for integrating custom elements into JSX projects",
"main": "index.js",
"module": "index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/react-wrappers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.4.1

- Allow any string for `descriptionSrc`

## 1.4.0

- Added additional default attributes - `classList`, `dir`, `exportparts`, `id`, `lang`, `part`, `title`, and `translate`
Expand Down
2 changes: 1 addition & 1 deletion packages/react-wrappers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The configuration has the following optional parameters:
/** Class names of any components you would like to exclude from the custom data */
exclude?: string[];
/** The property name from the component object that you would like to use for the description of your component */
descriptionSrc?: "description" | "summary";
descriptionSrc?: "description" | "summary" | string;
/** Indicates if the component classes are a default export rather than a named export */
defaultExport?: boolean;
/** Displays the slot section of the element description */
Expand Down
2 changes: 1 addition & 1 deletion packages/react-wrappers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-element-react-wrappers",
"version": "1.4.0",
"version": "1.4.1",
"description": "A tool for generating react-compatible wrappers for custom elements",
"main": "index.js",
"module": "index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/solidjs-integration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.6.1

- Allow any string for `descriptionSrc`

## 1.6.0

- Added `innerHTML` and `textContent` attributes
Expand Down
2 changes: 1 addition & 1 deletion packages/solidjs-integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-element-solidjs-integration",
"version": "1.6.0",
"version": "1.6.1",
"description": "Tools for integrating custom elements into SolidJS",
"main": "index.js",
"module": "index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/vs-code-integration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.2.3

- Allow any string for `descriptionSrc`

## 1.2.2

- Exclude private methods and properties using the `#` access modifier
Expand Down
2 changes: 1 addition & 1 deletion packages/vs-code-integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-element-vs-code-integration",
"version": "1.2.2",
"version": "1.2.3",
"description": "Tools for integrating web components/custom elements into VS Code",
"main": "index.js",
"module": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion tools/cem-utils/src/description-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function getComponentDetailsTemplate(
);

let description =
getComponentDescription(component, options?.descriptionSrc) +
getComponentDescription(component, options?.descriptionSrc as string) +
"\n---\n" +
events +
methods +
Expand Down
16 changes: 7 additions & 9 deletions tools/configurations/src/__tests__/test-data.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { BaseConfiguration } from "../config";
import { BaseOptions } from "../config";

export const config: BaseConfiguration = {
export const config: BaseOptions = {
outdir: "./",
htmlFileName: "vscode.html-custom-data.json",
cssFileName: "vscode.css-custom-data.json",
exclude: [],
descriptionSrc: undefined,
slotDocs: true,
eventDocs: true,
cssPropertiesDocs: true,
cssPartsDocs: true,
methodDocs: true,
hideSlotDocs: false,
hideEventDocs: false,
hideCssPropertiesDocs: false,
hideCssPartsDocs: false,
hideMethodDocs: false,
labels: {
slots: "Slots",
events: "Events",
Expand Down
4 changes: 3 additions & 1 deletion tools/configurations/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { LooseString } from "../../utilities";

export interface BaseOptions {
/** Path to output directory */
outdir?: string;
/** Class names of any components you would like to exclude from the custom data */
exclude?: string[];
/** The property name from the component object that you would like to use for the description of your component */
descriptionSrc?: "description" | "summary";
descriptionSrc?: LooseString<"description" | "summary">;
/** Displays the slot section of the element description */
hideSlotDocs?: boolean;
/** Displays the event section of the element description */
Expand Down
3 changes: 3 additions & 0 deletions tools/utilities/src/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://twitter.com/mattpocockuk/status/1506607945445949446
export type LooseString<T extends string> = T | Omit<string, T>;

export const toKebabCase = (value: string): string =>
value.replace(/([a-z09])([A-Z])/g, "$1-$2").toLowerCase();

Expand Down

0 comments on commit a59eb2c

Please sign in to comment.