From 13c3d01fda1953a5c7d01023eb01295b66e3b6b3 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 18 Jun 2024 10:12:08 +0100 Subject: [PATCH] Move from unpkg to cdnjs due to reliability/performance issues --- README.md | 6 +++--- guide/examples/ts/htm.ts | 4 ++-- guide/examples/ts/weather.htm.ts | 2 +- guide/iterators.md | 6 +++--- guide/tsx.md | 4 ++-- guide/your-first-web-page.md | 12 ++++++------ module/README.md | 6 +++--- module/dist/ai-ui.cjs | 2 +- module/dist/ai-ui.js | 2 +- module/dist/ai-ui.mjs | 2 +- module/src/ai-ui.ts | 2 +- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 1273832..c9db989 100644 --- a/README.md +++ b/README.md @@ -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 ` + + + @@ -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 "
" tag, + /* Define a _new_ tag type, called `App`, based on the standard "
" tag, that is composed of an h2 and div elements. It will generate markup like:
@@ -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. @@ -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 ``` @@ -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 > | diff --git a/module/README.md b/module/README.md index 1273832..c9db989 100644 --- a/module/README.md +++ b/module/README.md @@ -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 ` +