@webqit/oohtml 2.1.74 → 2.1.76

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 +26 -49
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -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
 
@@ -650,7 +650,7 @@ Here, we get the `binding` attribute for a declarative and neat, key/value data-
650
650
  | `@html` | Markup content | `<span binding="@html: '<i>'+firstName+'</i>';"></span>` |
651
651
  | `@items` | A list, with argument in the following format:<br>`<declaration> <of\|in> <iterable> / <importRef>` | *See next two tables* |
652
652
 
653
- <details><summary>About <code>For ... Of</code> Loops</summary>
653
+ <details><summary><code>For ... Of</code> Loops</summary>
654
654
 
655
655
  | Idea | Usage |
656
656
  | :---- | :---- |
@@ -661,7 +661,7 @@ Here, we get the `binding` attribute for a declarative and neat, key/value data-
661
661
 
662
662
  </details>
663
663
 
664
- <details><summary>About <code>For ... In</code> Loops</summary>
664
+ <details><summary><code>For ... In</code> Loops</summary>
665
665
 
666
666
  | Idea | Usage |
667
667
  | :---- | :---- |
@@ -682,25 +682,13 @@ Generated item elements are automatically assigned a corresponding index with a
682
682
 
683
683
  </details>
684
684
 
685
- **-->** *all of which could be seen below*:
685
+ ### Stateful Scripts
686
686
 
687
- ```html
688
- <section>
689
-
690
- <!-- The "items" template -->
691
- <template def="item" scoped>
692
- <li><a binding="~href: '/animals#'+name;"><?{ index+': '+name }?></a></li>
693
- </template>
694
-
695
- <!-- The loop -->
696
- <ul binding="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
697
-
698
- </section>
699
- ```
687
+ *[TODO]*
700
688
 
701
689
  ## Data Plumbing
702
690
 
703
- *[TODO]: The Context API and Bindings API*
691
+ *[TODO]: Bindings API & The Context API*
704
692
 
705
693
  <!--
706
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.
@@ -937,8 +925,8 @@ Here are a few examples in the wide range of use cases these features cover.
937
925
  + [Example 1: *Single Page Application*](#example-1-single-page-application)
938
926
  + [Example 2: *Multi-Level Namespacing*](#example-2-multi-level-namespacing)
939
927
  + [Example 3: *Dynamic Shadow DOM*](#example-3-dynamic-shadow-dom)
940
- + [Example 4: *List Items*](#example-4-list-items)
941
- + [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)
942
930
 
943
931
  ### Example 1: *Single Page Application*
944
932
 
@@ -1138,56 +1126,45 @@ The following is a custom element that derives its Shadow DOM from an imported `
1138
1126
 
1139
1127
  </details>
1140
1128
 
1141
- ### Example 4: *List Items*
1129
+ ### Example 4: *Declarative Lists*
1142
1130
 
1143
- 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!
1144
1132
 
1145
1133
  <details><summary>Code</summary>
1146
1134
 
1147
1135
  ```html
1148
- <div namespace>
1149
-
1150
- <ul id="list"></ul>
1136
+ <section>
1151
1137
 
1138
+ <!-- The "items" template -->
1152
1139
  <template def="item" scoped>
1153
- <li><a>Item</a></li>
1140
+ <li><a binding="~href: '/animals#'+name;"><?{ index+': '+name }?></a></li>
1154
1141
  </template>
1155
1142
 
1156
- <script scoped>
1157
- // Import item template
1158
- let itemImport = this.import('item');
1159
- let itemTemplate = itemImport.value;
1160
-
1161
- // Iterate
1162
- [ 'Item 1', 'Item 2', 'Item 3' ].forEach(entry => {
1163
- const currentItem = itemTemplate.content.cloneNode(true);
1164
- // Add to DOM
1165
- this.namespace.list.appendChild(currentItem);
1166
- // Render
1167
- currentItem.innerHTML = entry;
1168
- });
1169
- </script>
1143
+ <!-- The loop -->
1144
+ <ul binding="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1170
1145
 
1171
- </div>
1146
+ </section>
1172
1147
  ```
1173
1148
 
1174
1149
  </details>
1175
1150
 
1176
- ### Example 4: *Live List*
1151
+ ### Example 4: *Imperative Lists*
1177
1152
 
1178
- 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!
1179
1154
 
1180
1155
  <details><summary>Code</summary>
1181
1156
 
1182
1157
  ```html
1183
- <div namespace>
1184
-
1185
- <ul id="list"></ul>
1158
+ <section namespace>
1186
1159
 
1160
+ <!-- The "items" template -->
1187
1161
  <template def="item" scoped>
1188
1162
  <li><a>Item</a></li>
1189
1163
  </template>
1190
1164
 
1165
+ <!-- The loop -->
1166
+ <ul id="list"></ul>
1167
+
1191
1168
  <script scoped>
1192
1169
  // Import item template
1193
1170
  let itemImport = this.import('item');
@@ -1214,7 +1191,7 @@ The following is the same list as above but implemented as a live list! Here, we
1214
1191
  setTimeout(() => items.pop(), 2000);
1215
1192
  </script>
1216
1193
 
1217
- </div>
1194
+ </section>
1218
1195
  ```
1219
1196
 
1220
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.74",
17
+ "version": "2.1.76",
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",