Skip to content

Commit 3c1146e

Browse files
authored
docs: add cross-references, minor improvements (#112)
1 parent e94b737 commit 3c1146e

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

docs/docs/api/elements.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# API >> Elements || 10
22

33
API Viewer consists of two major features: documentation and demo (interactive live playground).
4-
Both features reuse the same manifest data, by default you can switch between them using radio buttons.
4+
Both features reuse the same [manifest data](../../guide/writing-jsdoc/), by default you can switch between them using radio buttons.
55

66
Alternatively, you can use separate elements for documentation and demo.
77
This does not mean having to load manifest data twice: it can be fetched once and then passed to the elements using `manifest` property.
@@ -50,7 +50,7 @@ Do not pass any base class directly to `customElements.define()`: make sure to e
5050
### `ApiViewerBase` class
5151

5252
A class that you can use to create your own version of `<api-viewer>`.
53-
If you don't need `<template>` support in the live demo, feel free to remove corresponding code.
53+
If you don't need [`<template>` support](../templates/) in the live demo, feel free to remove corresponding code.
5454
API documentation does not use templates.
5555

5656
```js

docs/docs/api/templates.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# API >> Templates || 30
22

3-
API Viewer uses the [`<template>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) element to configure the live demo.
4-
Templates can be used to customize the default values for properties, to setup custom knobs, and to provide wrapper, prefix, or suffix elements.
3+
API Viewer uses the [`<template>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) element for configuring the live demo.
4+
With templates, you can customize the default properties values, set up custom [knobs](../../guide/using-demo/#knobs), or provide additional HTML to be shown in the demo.
55

66
## Setting templates
77

8-
Both `<api-viewer>` and `<api-demo>` elements collect template passing to them declaratively at the time of initialization.
9-
Alternatively, you can call `setTemplates()` method to provide `<template>` elements lazily.
8+
Both `<api-viewer>` and `<api-demo>` elements collect `<template>` elements passed to them declaratively at the time of initialization.
9+
Alternatively, you can call `setTemplates()` method to provide a set of templates lazily.
1010

1111
```js
1212
// Father the template elements placed in the DOM

docs/docs/guide/using-demo.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Several panels are available depending on the functionality the component suppor
55

66
## Importing
77

8-
In order to enable live demos, import the components documented in the manifest.
8+
In order to use live demo, import the components documented in the manifest.
99
The demo component uses [`customElements.whenDefined()`](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined), which returns a Promise, so importing the components lazily also works.
1010

1111
```html
@@ -15,12 +15,13 @@ The demo component uses [`customElements.whenDefined()`](https://developer.mozil
1515
<api-viewer src="./custom-elements.json"></api-viewer>
1616
```
1717

18-
If you want to render live demo separately from the API documentation, consider using `<api-demo>` element instead of the `<api-viewer>`.
18+
If you want to render live demo separately from the API documentation, consider using [`<api-demo>`](../../examples/api-demo/) element instead of the `<api-viewer>`.
1919
All of the features and use cases listed below apply to both components.
2020

2121
## Source
2222

23-
The Source panel contains an HTML code snippet representing the component with its properties, HTML attributes and slots.
23+
The Source panel contains an HTML code snippet representing the component with its
24+
[properties](../writing-jsdoc/#properties), HTML attributes and [slots](../writing-jsdoc/#slots).
2425
When setting knobs or styles using corresponding panels, code snippet is updated.
2526

2627
For example, changing a custom CSS property to the value other than the default one will add `<style>` tag to the snippet.
@@ -34,7 +35,8 @@ Play with the component to tweak its appearance, set `textContent` for its `<slo
3435
Knobs panel is of the live demo inspired by corresponding Storybook addon.
3536
It allows to toggle properties, attributes and set slots content on the element instance, and updates the code snippet accordingly.
3637

37-
The playground listens to the events dispatched by the component and uses `[property]-changed` events to sync knobs controls with the component's state.
38+
The playground listens to the [events](../writing-jsdoc/#events) dispatched by the component
39+
and uses `[property]-changed` events to sync knobs controls with the component's state.
3840
This is useful if the component handles user input:
3941

4042
```js
@@ -50,7 +52,7 @@ This is useful if the component handles user input:
5052

5153
## Styles
5254

53-
The live demo relies on the analyzer to get default values for documented custom CSS properties.
55+
The live demo relies on the analyzer to get default values for documented [CSS Custom Properties](../writing-jsdoc/#css-custom-properties).
5456
As a fallback, it collects the values on the rendered component using `getComputedStyle(element).getPropertyValue()`.
5557

5658
We recommend using the following CSS structure to provide styling API for web components to make Styles panel work.

0 commit comments

Comments
 (0)