@webqit/oohtml 2.1.61 → 2.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,33 +5,26 @@
|
|
|
5
5
|
[![bundle][bundle-src]][bundle-href]
|
|
6
6
|
[![License][license-src]][license-href]
|
|
7
7
|
|
|
8
|
-
**[Overview](#overview) • [Modular HTML](#modular-html) • [HTML Imports](#html-imports) • [
|
|
8
|
+
**[Overview](#overview) • [Modular HTML](#modular-html) • [HTML Imports](#html-imports) • [Data Binding](#data-binding) • [Data Plumbing](#data-plumbing) • [Polyfill](#polyfill) • [Examples](#examples) • [License](#license)**
|
|
9
9
|
|
|
10
|
-
Object-Oriented HTML (OOHTML) is a set of
|
|
10
|
+
Object-Oriented HTML (OOHTML) is a set of features that extend standard HTML and the DOM to enable authoring modular, reusable and reactive markup - with a "buildless", web-native workflow as design goal! This project presents what "modern" HTML could look like!
|
|
11
11
|
|
|
12
12
|
## Motivation
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Vanilla HTML is increasingly becoming a more attractive option for web developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and data binding! Authors still have to rely on tools - or, to say the least, do half of the work in HTML and half in JS - to get even basic things working!
|
|
14
|
+
Vanilla HTML is increasingly becoming the compelling option for web developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and data binding! Authors still have to rely on tools - or, to say the least, do half of the work in HTML and half in JS - to get even basic things working!
|
|
17
15
|
|
|
18
16
|
This project pursues an object-oriented approach to HTML and implicitly revisits much of what inhibits the idea of a *component* architecture for HTML!
|
|
19
17
|
|
|
20
18
|
└ [See more in the introductory blog post](https://dev.to/oxharris/the-web-native-equations-1m1p-temp-slug-6661657?preview=ba70ad2c17f05b5761bc74516dbde8c9eff8b581a0420d87334fd9ef6bab9d6e6d3ab6aaf3fe02542bb9e7250d0a88a6df91dae40919aabcc9a07320)<sup>draft</sup>
|
|
21
19
|
|
|
22
|
-
</details>
|
|
23
|
-
|
|
24
20
|
## Overview
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
We go in three main focus areas:
|
|
22
|
+
On the agenda is a set of features that normalises how the modern UI lends itself to be built! And all of it comes as a special love letter to Single Page Applications!
|
|
29
23
|
|
|
30
24
|
+ [Modular HTML](#modular-html)
|
|
31
25
|
+ [HTML Imports](#html-imports)
|
|
32
26
|
+ [Data Binding](#data-binding)
|
|
33
|
-
+ [Data
|
|
34
|
-
+ [Put Together](#put-together)
|
|
27
|
+
+ [Data Plumbing](#data-plumbing)
|
|
35
28
|
|
|
36
29
|
> **Note** This is documentation for `OOHTML@2.x`. (Looking for [`OOHTML@1.x`](https://github.com/webqit/oohtml/tree/v1.10.4)?)
|
|
37
30
|
|
|
@@ -43,7 +36,7 @@ OOHTML makes this possible in just simple conventions - via two new attributes:
|
|
|
43
36
|
|
|
44
37
|
### Namespacing
|
|
45
38
|
|
|
46
|
-
|
|
39
|
+
The `namespace` attribute for designating an element as own naming context for identifiers - i.e. the `id` and `name` attributes:
|
|
47
40
|
|
|
48
41
|
```html
|
|
49
42
|
<div id="user" namespace>
|
|
@@ -88,7 +81,7 @@ console.log(window.foo); // div
|
|
|
88
81
|
|
|
89
82
|
</details>
|
|
90
83
|
|
|
91
|
-
└
|
|
84
|
+
└ A Namespace API that reflects the real-DOM™ in real-time, in conjunction with the general-purpose object observability API - [Observer API](https://github.com/webqit/observer):
|
|
92
85
|
|
|
93
86
|
```js
|
|
94
87
|
// Observing the addition or removal of elements with an ID
|
|
@@ -109,9 +102,15 @@ span.setAttribute('id', 'baz');
|
|
|
109
102
|
paragraph.appendChild(span); // Reported synchronously
|
|
110
103
|
```
|
|
111
104
|
|
|
105
|
+
```js
|
|
106
|
+
function changeCallback(changes) {
|
|
107
|
+
console.log(changes[0].type, changes[0].key, changes[0].value, changes[0].oldValue);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
112
111
|
### Style and Script Scoping
|
|
113
112
|
|
|
114
|
-
|
|
113
|
+
The `scoped` attribute for *scoping* element-specific stylesheets and scripts:
|
|
115
114
|
|
|
116
115
|
```html
|
|
117
116
|
<div>
|
|
@@ -143,7 +142,7 @@ OOHTML makes this possible in just simple conventions - via a new `def` attribut
|
|
|
143
142
|
|
|
144
143
|
### Module Definition
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
The `def` attribute for defining reusable markup - either as whole *module* or as *fragment*:
|
|
147
146
|
|
|
148
147
|
```html
|
|
149
148
|
<head>
|
|
@@ -175,7 +174,7 @@ OOHTML makes this possible in just simple conventions - via a new `def` attribut
|
|
|
175
174
|
|
|
176
175
|
### Remote Modules
|
|
177
176
|
|
|
178
|
-
|
|
177
|
+
The `<template src>` element for remote modules:
|
|
179
178
|
|
|
180
179
|
```html
|
|
181
180
|
<template def="foo" src="/foo.html"></template>
|
|
@@ -204,7 +203,7 @@ foo.addEventListener('error', errorCallback);
|
|
|
204
203
|
|
|
205
204
|
### Declarative Module Imports
|
|
206
205
|
|
|
207
|
-
|
|
206
|
+
The `<import>` element for declarative module import:
|
|
208
207
|
|
|
209
208
|
```html
|
|
210
209
|
<body>
|
|
@@ -261,7 +260,7 @@ Now that extra bit of information gets decoded and original relationships are fo
|
|
|
261
260
|
|
|
262
261
|
### Programmatic Module Imports
|
|
263
262
|
|
|
264
|
-
|
|
263
|
+
The *HTMLImports* API for programmatic module import:
|
|
265
264
|
|
|
266
265
|
```js
|
|
267
266
|
const moduleObject1 = document.import('/foo#fragment1');
|
|
@@ -335,7 +334,7 @@ setTimeout(() => abortController.abort(), 1000);
|
|
|
335
334
|
|
|
336
335
|
### Lazy-Loading Modules
|
|
337
336
|
|
|
338
|
-
|
|
337
|
+
Remote modules with lazy-loading - which has modules loading on first time access:
|
|
339
338
|
|
|
340
339
|
```html
|
|
341
340
|
<!-- Loading doesn't happen until the first time this is being accessed -->
|
|
@@ -353,7 +352,7 @@ const moduleObject2 = document.import('/foo#fragment1'); // Triggers module load
|
|
|
353
352
|
|
|
354
353
|
### Scoped Modules
|
|
355
354
|
|
|
356
|
-
|
|
355
|
+
The `scoped` attribute for an *object-scoped* module system:
|
|
357
356
|
|
|
358
357
|
```html
|
|
359
358
|
<section> <!-- object with own modules -->
|
|
@@ -388,7 +387,7 @@ console.log(globalImport1); // { value: div }
|
|
|
388
387
|
|
|
389
388
|
### Module Inheritance
|
|
390
389
|
|
|
391
|
-
|
|
390
|
+
Module nesting with inheritance:
|
|
392
391
|
|
|
393
392
|
```html
|
|
394
393
|
<template def="foo">
|
|
@@ -434,7 +433,7 @@ console.log(globalImport1); // { value: div }
|
|
|
434
433
|
|
|
435
434
|
### Imports Contexts
|
|
436
435
|
|
|
437
|
-
|
|
436
|
+
"Imports Contexts" for context-based *import resolution*:
|
|
438
437
|
|
|
439
438
|
```html
|
|
440
439
|
<body importscontext="/foo">
|
|
@@ -499,7 +498,7 @@ console.log(globalImport2); // { value: div }
|
|
|
499
498
|
|
|
500
499
|
### Scoped Modules and Imports Contexts
|
|
501
500
|
|
|
502
|
-
|
|
501
|
+
Object-scoped module system with context inheritance:
|
|
503
502
|
|
|
504
503
|
```html
|
|
505
504
|
<body contextname="context1" importscontext="/bar">
|
|
@@ -539,7 +538,7 @@ OOHTML makes this possible in just simple conventions - via a new comment-based
|
|
|
539
538
|
|
|
540
539
|
### Comment-Based Data-Binding
|
|
541
540
|
|
|
542
|
-
|
|
541
|
+
A web-native, comment-based data-binding syntax `<?{ }?>` which works like regular comment but stay "data-charged":
|
|
543
542
|
|
|
544
543
|
```js
|
|
545
544
|
<html>
|
|
@@ -573,7 +572,7 @@ Now that extra bit of information gets decoded and original relationships are fo
|
|
|
573
572
|
|
|
574
573
|
### Directives-Based Data-Binding
|
|
575
574
|
|
|
576
|
-
|
|
575
|
+
The `binding` attribute for a declarative and neat, key/value data-binding syntax:
|
|
577
576
|
|
|
578
577
|
```html
|
|
579
578
|
<div binding="<type><parameter>: <argument>;"></div>
|
|
@@ -666,7 +665,7 @@ Generated item elements are automatically assigned a corresponding index with a
|
|
|
666
665
|
|
|
667
666
|
</details>
|
|
668
667
|
|
|
669
|
-
##
|
|
668
|
+
## Data Plumbing
|
|
670
669
|
|
|
671
670
|
*[TODO]: The Context API and Bindings API*
|
|
672
671
|
|