Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v0.14.0-cdnjs' into v0.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MatAtBread committed Jun 18, 2024
2 parents 0b21218 + 13c3d01 commit a47c6a1
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ The /esm directory contains unbundled ESM files with inline sourcemaps and TypeS

### ES6 import
```
import * as AIUI from 'https://www.unpkg.com/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
import * as AIUI from 'https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
// You can, of course, just import the members you need...
import { tag } from 'https://www.unpkg.com/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
import { tag } from 'https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
```

### HTML `<script>` tag
```
<script src="https://www.unpkg.com/@matatbread/ai-ui/dist/ai-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.js"></script>
<!-- defines global AIUI -->
<script>
const { tag } = AIUI;
Expand Down
4 changes: 2 additions & 2 deletions guide/examples/ts/htm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//import htm from 'https://unpkg.com/htm@3.1.1/src/index.mjs';
import htm from 'https://unpkg.com/htm/mini/index.mjs';
//import htm from 'https://cdn.jsdelivr.net/npm/htm@3.1.1/src/index.mjs';
import htm from 'https://cdn.jsdelivr.net/npm/htm/mini/index.mjs';
import { tag, Iterators } from '../../../module/esm/ai-ui.js';
Iterators.augmentGlobalAsyncGenerators();

Expand Down
2 changes: 1 addition & 1 deletion guide/examples/ts/weather.htm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import htm from 'https://unpkg.com/htm/dist/htm.module.js';
import htm from 'https://cdn.jsdelivr.net/npm/htm/dist/htm.module.js';
import { ChildTags, tag } from '../../../module/esm/ai-ui.js';

const { input, div, img, createElement } = tag();;
Expand Down
6 changes: 3 additions & 3 deletions guide/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The first is easiest to use. If you use this method, you only need to do so once

```typescript
// Augments the global prototype and declares global types
import 'https://www.unpkg.com/@matatbread/ai-ui/esm/augment-iterators.js';
import 'https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/esm/augment-iterators.js';

async function *count(limit) {
for (let i=0; i<limit; i++)
Expand All @@ -42,7 +42,7 @@ The final two require that you import the functions that add the helpers:

```javascript
/* ES6 Import */
import { Iterators } from 'https://www.unpkg.com/@matatbread/ai-ui/esm/ai-ui.js';
import { Iterators } from 'https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/esm/ai-ui.js';
const { iterableHelpers, generatorHelpers } = Iterators;
```

Expand All @@ -54,7 +54,7 @@ const { iterableHelpers, generatorHelpers } = Iterators;


```html
<script src="https://www.unpkg.com/@matatbread/ai-ui/dist/ai-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.min.js"></script>
<script>
/* Static script */
const { iterableHelpers, generatorHelpers } = AIUI.Iterators;
Expand Down
4 changes: 2 additions & 2 deletions guide/tsx.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ HTM is a fabulously small library, however becuase the return of the HTML tagged
To use HTM, check out the [README](https://www.npmjs.com/package/htm), and use the following code to initialise it with AI-UI:

```javascript
import htm from 'https://unpkg.com/htm/mini/index.mjs';
import { tag } from 'https://unpkg.com/@matatbread/ai-ui/esm/ai-ui.js';
import htm from 'https://cdn.jsdelivr.net/npm/htm/mini/index.mjs';
import { tag } from 'https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/esm/ai-ui.js';
const { div, createElement } = tag() ; // You can of course also destructure any AI-UI base tag functions at the same time
const html = htm.bind(createElement); // Bind tag().createElement to `htm` as per the README

Expand Down
12 changes: 6 additions & 6 deletions guide/your-first-web-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Here's an example of a very simple web page, with the content generated by AI-UI

```html
<head>
<script src="https://unpkg.com/@matatbread/ai-ui/dist/ai-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.js"></script>
</head>

<body>
Expand All @@ -13,7 +13,7 @@ Here's an example of a very simple web page, with the content generated by AI-UI
/* Specify what base tags you reference in your UI */
const { h2, div } = AIUI.tag();
/* Define a _new_ tag type, called `App`, based on the standard "<div>" tag,
/* Define a _new_ tag type, called `App`, based on the standard "<div>" tag,
that is composed of an h2 and div elements. It will generate markup like:
<div>
Expand Down Expand Up @@ -50,7 +50,7 @@ Here's an example of a very simple web page, with the content generated by AI-UI

So far, so what? Another way of declaring HTML? Not exactly ground-breaking.

The `AIUI.tag()` API returns a collection of functions that create a standard DOM node of the specified name. These are just normal DOM nodes, created via [document.createElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement), and therefore have all the features and behaviours of standard DOM nodes.
The `AIUI.tag()` API returns a collection of functions that create a standard DOM node of the specified name. These are just normal DOM nodes, created via [document.createElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement), and therefore have all the features and behaviours of standard DOM nodes.

Like the `div(....)` method (and all tag functions returned by `AIUI.tag()`), the new `App(...)` function optionally accepts an object specifying its attributes as the first arguemnt, and an optional list of children and returns a standard DOM node.

Expand All @@ -59,8 +59,8 @@ In these docs, you'll see these kinds of functions (returned by `AIUI.tag()` or
### The general function signature of a tag creation function is:
```typescript
TagFunctionName(
attributes?: AttributesOfThisTag,
...children:(string | number | boolean | Node | Element | NodeList | undefined | HTMLCollection
attributes?: AttributesOfThisTag,
...children:(string | number | boolean | Node | Element | NodeList | undefined | HTMLCollection
/* Or an array or iterable of any combination of the former */)[]
): Element
```
Expand Down Expand Up @@ -125,7 +125,7 @@ In the following sections, we'll add:
Making the standard W3C DOM API dynamic using Promises and async generators.

* [TSX](./tsx.md) _coming soon_

____

| < Prev | ^ | Next > |
Expand Down
6 changes: 3 additions & 3 deletions module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ The /esm directory contains unbundled ESM files with inline sourcemaps and TypeS

### ES6 import
```
import * as AIUI from 'https://www.unpkg.com/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
import * as AIUI from 'https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
// You can, of course, just import the members you need...
import { tag } from 'https://www.unpkg.com/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
import { tag } from 'https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.mjs'; // or .min.mjs
```

### HTML `<script>` tag
```
<script src="https://www.unpkg.com/@matatbread/ai-ui/dist/ai-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@matatbread/ai-ui/dist/ai-ui.js"></script>
<!-- defines global AIUI -->
<script>
const { tag } = AIUI;
Expand Down
2 changes: 1 addition & 1 deletion module/dist/ai-ui.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion module/dist/ai-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion module/dist/ai-ui.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion module/src/ai-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface PoElementMethods {
*/
}

// Support for https://www.npmjs.com/package/htm (or import htm from 'https://unpkg.com/htm/dist/htm.module.js')
// Support for https://www.npmjs.com/package/htm (or import htm from 'https://cdn.jsdelivr.net/npm/htm/dist/htm.module.js')
// Note: same signature as React.createElement
export interface CreateElement {
// Support for htm, JSX, etc
Expand Down

0 comments on commit a47c6a1

Please sign in to comment.