@webqit/oohtml 2.1.75 → 2.1.77

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.
Files changed (2) hide show
  1. package/README.md +25 -46
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -19,7 +19,7 @@ Building Single Page Applications? OOHTML is a special love letter!
19
19
 
20
20
  ## Motivation
21
21
 
22
- Vanilla HTML is surprisingly becoming a compelling option for an increasing number of developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and other fundamental capabilities like 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!
22
+ Vanilla HTML is unsurprisingly becoming a compelling option for an increasing number of developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and other fundamental capabilities like 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!
23
23
 
24
24
  This project pursues an object-oriented approach to HTML and implicitly revisits much of what inhibits the idea of a *component* architecture for HTML!
25
25
 
@@ -572,9 +572,9 @@ console.log(localOrGlobalImport2); // { value: div }
572
572
 
573
573
  Data binding is the concept of having a mechanism that declaratively drives the UI from application data, ensuring that the relevant parts of the UI are *automatically* updated as application state changes.
574
574
 
575
- OOHTML makes this possible in just simple conventions - via a new comment-based data-binding syntax `<?{ }?>` and a complementary new `binding` attribute!
575
+ OOHTML makes this possible in just simple conventions - via a new comment-based data-binding syntax `<?{ }?>` and a complementary new `binding` attribute! And there's one more: Stateful Scripts which brings the most advanced form of reactivity to HTML!
576
576
 
577
- ### Comment-Based Data-Binding
577
+ ### Discrete Data-Binding
578
578
 
579
579
  Here, we get a comment-based data-binding syntax `<?{ }?>` which works like regular comment but stay "data-charged":
580
580
 
@@ -608,7 +608,7 @@ Now that extra bit of information gets decoded and original relationships are fo
608
608
 
609
609
  </details>
610
610
 
611
- ### Directives-Based Data-Binding
611
+ ### Inline Data-Binding
612
612
 
613
613
  Here, we get the `binding` attribute for a declarative and neat, key/value data-binding syntax:
614
614
 
@@ -682,23 +682,13 @@ Generated item elements are automatically assigned a corresponding index with a
682
682
 
683
683
  </details>
684
684
 
685
- ```html
686
- <section>
685
+ ### Stateful Scripts
687
686
 
688
- <!-- The "items" template -->
689
- <template def="item" scoped>
690
- <li><a binding="~href: '/animals#'+name;"><?{ index+': '+name }?></a></li>
691
- </template>
692
-
693
- <!-- The loop -->
694
- <ul binding="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
695
-
696
- </section>
697
- ```
687
+ *[TODO]*
698
688
 
699
689
  ## Data Plumbing
700
690
 
701
- *[TODO]: The Context API and Bindings API*
691
+ *[TODO]: Bindings API & The Context API*
702
692
 
703
693
  <!--
704
694
  The last set of features covers the concept of "state", "bindings", and "reactivity" for those objects at the DOM level - in the most exciting form of the terms and as an upgrade path! This comes factored into the design as something intrinsic to the problem.
@@ -935,8 +925,8 @@ Here are a few examples in the wide range of use cases these features cover.
935
925
  + [Example 1: *Single Page Application*](#example-1-single-page-application)
936
926
  + [Example 2: *Multi-Level Namespacing*](#example-2-multi-level-namespacing)
937
927
  + [Example 3: *Dynamic Shadow DOM*](#example-3-dynamic-shadow-dom)
938
- + [Example 4: *List Items*](#example-4-list-items)
939
- + [Example 5: *Live List*](#example-4-live-list)
928
+ + [Example 4: *Declarative Lists*](#example-4-declarative-lists)
929
+ + [Example 5: *Imperative Lists*](#example-4-imperative-lists)
940
930
 
941
931
  ### Example 1: *Single Page Application*
942
932
 
@@ -1136,56 +1126,45 @@ The following is a custom element that derives its Shadow DOM from an imported `
1136
1126
 
1137
1127
  </details>
1138
1128
 
1139
- ### Example 4: *List Items*
1129
+ ### Example 4: *Declarative Lists*
1140
1130
 
1141
- The following is a "component" that derives its list items and other reusable snippets from "scoped" `<tenplate>` elements. The idea is to have a "self-contained" component that's all markup-based, not class-based!
1131
+ The following is a hypothetical list page!
1142
1132
 
1143
1133
  <details><summary>Code</summary>
1144
1134
 
1145
1135
  ```html
1146
- <div namespace>
1147
-
1148
- <ul id="list"></ul>
1136
+ <section>
1149
1137
 
1138
+ <!-- The "items" template -->
1150
1139
  <template def="item" scoped>
1151
- <li><a>Item</a></li>
1140
+ <li><a binding="~href: '/animals#'+name;"><?{ index+': '+name }?></a></li>
1152
1141
  </template>
1153
1142
 
1154
- <script scoped>
1155
- // Import item template
1156
- let itemImport = this.import('item');
1157
- let itemTemplate = itemImport.value;
1158
-
1159
- // Iterate
1160
- [ 'Item 1', 'Item 2', 'Item 3' ].forEach(entry => {
1161
- const currentItem = itemTemplate.content.cloneNode(true);
1162
- // Add to DOM
1163
- this.namespace.list.appendChild(currentItem);
1164
- // Render
1165
- currentItem.innerHTML = entry;
1166
- });
1167
- </script>
1143
+ <!-- The loop -->
1144
+ <ul binding="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1168
1145
 
1169
- </div>
1146
+ </section>
1170
1147
  ```
1171
1148
 
1172
1149
  </details>
1173
1150
 
1174
- ### Example 4: *Live List*
1151
+ ### Example 4: *Imperative Lists*
1175
1152
 
1176
- The following is the same list as above but implemented as a live list! Here, we make a few changes: the script element is Stateful; the loop itself now uses the literal `for ... of` construct, [which is capable of rendering live lists](https://github.com/webqit/stateful-js/wiki#with-control-structures), so that any additions and removals on the original list is statically reflected!
1153
+ The following is much like the above, but imperative. Additions and removals on the data items are also statically reflected!
1177
1154
 
1178
1155
  <details><summary>Code</summary>
1179
1156
 
1180
1157
  ```html
1181
- <div namespace>
1182
-
1183
- <ul id="list"></ul>
1158
+ <section namespace>
1184
1159
 
1160
+ <!-- The "items" template -->
1185
1161
  <template def="item" scoped>
1186
1162
  <li><a>Item</a></li>
1187
1163
  </template>
1188
1164
 
1165
+ <!-- The loop -->
1166
+ <ul id="list"></ul>
1167
+
1189
1168
  <script scoped>
1190
1169
  // Import item template
1191
1170
  let itemImport = this.import('item');
@@ -1212,7 +1191,7 @@ The following is the same list as above but implemented as a live list! Here, we
1212
1191
  setTimeout(() => items.pop(), 2000);
1213
1192
  </script>
1214
1193
 
1215
- </div>
1194
+ </section>
1216
1195
  ```
1217
1196
 
1218
1197
  </details>
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "wicg-proposal"
15
15
  ],
16
16
  "homepage": "https://webqit.io/tooling/oohtml",
17
- "version": "2.1.75",
17
+ "version": "2.1.77",
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",