Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix api doc #1178

Merged
merged 5 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 0 additions & 23 deletions docs/_api/copy_api.sh

This file was deleted.

6 changes: 3 additions & 3 deletions docs/_api/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Import the main lit-html functions from the [`lit-html`](./modules/lit_html.html
import {render, html, svg} from 'lit-html';
```

- [html](./modules/lit_html.html#html)
- [svg](./modules/lit_html.html#svg)
- [render](./modules/lit_html.html#render)
- [html](./modules/_lit_html_.html#html)
- [svg](./modules/_lit_html_.html#svg)
- [render](./modules/_lit_html_.html#render)

## Directives
lit-html comes with a set of directives. You can import them as individual modules from the `lit-html/directives/` folder:
Expand Down
16 changes: 8 additions & 8 deletions docs/guide/05-creating-directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ html`<div>

However, instead of _returning_ a value to render, the directive controls what gets rendered to its location in the DOM.

Internally, lit-html uses the [`Part`](/api/interfaces/lit_html.part.html) interface to represent the dynamic DOM associated with a binding. A directive has access to the `Part` associated with its binding. For example, it can find the current value of the part and set a new value for the part.
Internally, lit-html uses the [`Part`](/api/interfaces/_lit_html_.part.html) interface to represent the dynamic DOM associated with a binding. A directive has access to the `Part` associated with its binding. For example, it can find the current value of the part and set a new value for the part.

To create a directive, pass a factory function to lit-html's `directive` function:

Expand All @@ -27,11 +27,11 @@ The factory function can take optional arguments for configuration and values to

The returned function is called each time the part is rendered. The `part` argument is a `Part` object with an API for directly managing the dynamic DOM associated with expressions. Each type of binding has its own specific Part object:

* [`NodePart`](/api/classes/lit_html.nodepart.html) for content bindings.
* [`AttributePart`](/api/classes/lit_html.attributepart.html) for standard attribute bindings.
* [`BooleanAttributePart`](/api/classes/lit_html.booleanattributepart.html) for boolean attribute bindings.
* [`EventPart`](/api/classes/lit_html.eventpart.html) for event bindings.
* [`PropertyPart`](/api/classes/lit_html.propertypart.html) for property bindings.
* [`NodePart`](/api/classes/_lit_html_.nodepart.html) for content bindings.
* [`AttributePart`](/api/classes/_lit_html_.attributepart.html) for standard attribute bindings.
* [`BooleanAttributePart`](/api/classes/_lit_html_.booleanattributepart.html) for boolean attribute bindings.
* [`EventPart`](/api/classes/_lit_html_.eventpart.html) for event bindings.
* [`PropertyPart`](/api/classes/_lit_html_.propertypart.html) for property bindings.

Each of these part types implement a common API:

Expand Down Expand Up @@ -166,7 +166,7 @@ const statefulDirective = directive(() => (part) => {

Sometimes you want a directive to manage multiple nested parts. For example, a directive that renders a list of items (like `repeat`) might create a nested part for each item. Keeping separate parts lets you manipulate them efficiently: for example, you can change the value of a single part without re-rendering the entire list.

To create nested parts, you construct [`NodePart`](/api/classes/lit_html.nodepart.html) instances and associate them with specific locations in the DOM. The section of DOM controlled by a given `NodePart` needs to be delimited by static nodes that serve as markers. (lit-html usually uses comment nodes for these markers.)
To create nested parts, you construct [`NodePart`](/api/classes/_lit_html_.nodepart.html) instances and associate them with specific locations in the DOM. The section of DOM controlled by a given `NodePart` needs to be delimited by static nodes that serve as markers. (lit-html usually uses comment nodes for these markers.)

<img alt="Diagram showing a tree of DOM nodes and a NodePart object. The DOM tree consists of a parent node and several child nodes, with two of the child nodes identified as 'marker nodes.' The NodePart object has a startNode property, which points to the first marker node, and an endNode property, which points to the second marker node. Child nodes between the two marker nodes are identified as 'nodes managed by NodePart.'" src="/images/guides/node-part-markers.png" style="max-width: 515px;">

Expand Down Expand Up @@ -250,4 +250,4 @@ const duplicate = directive((value) => {
});
```

The `NodePart` class provides a number of other convenience methods, including other methods for adding nested parts, and a [`clear`](/api/classes/lit_html.nodepart.html#clear) method to remove all of the DOM associated with a part. See the [NodePart API docs](/api/classes/lit_html.nodepart.html) for details.
The `NodePart` class provides a number of other convenience methods, including other methods for adding nested parts, and a [`clear`](/api/classes/_lit_html_.nodepart.html#clear) method to remove all of the DOM associated with a part. See the [NodePart API docs](/api/classes/_lit_html_.nodepart.html) for details.
2 changes: 1 addition & 1 deletion docs/guide/release-notes/1.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ html`

`unsaveSVG` is the missing partner of [`unsafeHTML`](../template-reference#unsafehtml). It lets you render a frangment of SVG text as SVG elements rather than text. As with `unsafeHTML` this directive not safe to use with user-provided input, since if the input has `<script>` tags in it, there may be ways to get them to execute, etc.

`unsafeSVG` creates elements in the SVG namespace, so it's for use inside of `<svg>` tags or inside of lit-html [`svg`](/api/modules/lit_html.html#svg) templates. If the input contains an `<svg>` tag itself, continute to use `unsafeHTML`.
`unsafeSVG` creates elements in the SVG namespace, so it's for use inside of `<svg>` tags or inside of lit-html [`svg`](/api/modules/_lit_html_.html#svg) templates. If the input contains an `<svg>` tag itself, continute to use `unsafeHTML`.

```js
// shape is SVG partial text, with no <svg> element
Expand Down
182 changes: 60 additions & 122 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"build": "npm run build:api && npm run build:site",
"build:site": "eleventy",
"build:site:watch": "eleventy --watch",
"build:api": "(cd _api && sh copy_api.sh) && typedoc --name \"lit-html API\" --readme _api/readme.md --mode modules --theme _api/theme --tsconfig ../tsconfig.json --ignoreCompilerErrors --excludeNotExported --excludePrivate --out ./api --gaID UA-39334307-23 _api/tmp/lit-html.ts _api/tmp/lib/shady-render.ts",
"build:api": "typedoc ../src/lit-html.ts ../src/lib/shady-render.ts",
"assets": "cp ../node_modules/prismjs/themes/prism-okaidia.css css/",
"serve": "serve",
"deploy": "npm run build && gcloud app deploy _site/app.yaml --project polymer-lit-html --no-promote"
Expand All @@ -19,7 +19,6 @@
"markdown-it-attrs": "^3.0.1",
"serve": "^11.3.0",
"slugify": "^1.3.6",
"typedoc": "^0.13.0",
"typedoc-plugin-external-module-name": "^1.1.3"
"typedoc": "^0.17.0-3"
}
}
12 changes: 12 additions & 0 deletions docs/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"readme": "./_api/readme.md",
"tsconfig": "../tsconfig.json",
"mode": "library",
"theme": "./_api/theme",
"excludeNotExported": true,
"excludePrivate": true,
"ignoreCompilerErrors": true,
"exclude": ["**/*test*", "**/node_modules/**", "**/test/**"],
"out": "./api",
"gaID": "UA-39334307-23"
}
4 changes: 0 additions & 4 deletions src/lib/default-template-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
* http://polymer.github.io/PATENTS.txt
*/

/**
* @module lit-html
*/

import {Part} from './part.js';
import {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';
import {RenderOptions} from './render-options.js';
Expand Down