@webqit/oohtml 4.3.15 → 4.3.17

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 CHANGED
@@ -221,7 +221,7 @@ If you'll be going ahead to build a real app with OOHTML, you may want to consid
221
221
 
222
222
  <details><summary>Show</summary>
223
223
 
224
- Amidst a multitude of approaches, vanilla HTML remains an attractive option for the UI author! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and certain modern paradigms like data binding! Authors still have to rely on tools - and, for the most part, have to do half of the work in HTML and half in JS - to express even basic concepts!
224
+ Amidst a multitude of approaches, vanilla HTML remains an attractive option for authoring modern UI! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and certain modern paradigms like data binding! Authors still have to rely on tools - and, for the most part, have to do half of the work in HTML and half in JS - to express even basic concepts!
225
225
 
226
226
  "As an author, I want to be able to do 'x' *declaratively* in HTML instead of *imperatively* in JavaScript or by means of a special Custom Element!" "As a Web Component author, I want to be able to leverage *conventions* that keep my component logic *concise*!" All such "user stories" represent important developer intuitions that has yet to be met in HTML; much of which belong under a broad subject: an object-oriented markup language! This subject is what we explore with OOHTML!
227
227
 
@@ -1033,7 +1033,7 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1033
1033
  **-->** *which would give us the following for a CSS property*:
1034
1034
 
1035
1035
  ```html
1036
- <div render="& color:someColor; & backgroundColor:'red'"></div>
1036
+ <div render="&color:someColor; &backgroundColor:'red'"></div>
1037
1037
  ```
1038
1038
 
1039
1039
  **-->** *without being space-sensitive*:
@@ -1046,23 +1046,24 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1046
1046
 
1047
1047
  | Directive | Type | Usage |
1048
1048
  | :---- | :---- | :---- |
1049
- | `&` | CSS Property | `<div render="& color:someColor; & backgroundColor:someBgColor;"></div>` |
1050
- | `%` | Class Name | `<div render="% active:app.isActive; % expanded:app.isExpanded;"></div>` |
1051
- | `~` | Attribute Name | `<a render="~ href:person.profileUrl+'#bio'; ~ title:'Click me';"></a>` |
1052
- | | Boolean Attribute | `<a render="~ ?required:formField.required; ~ ?aria-checked: formField.checked"></a>` |
1053
- | `@` | Structural Directive: | *See below* |
1054
- | `@text` | Plain text content | `<span render="@text:firstName+' '+lastName;"></span>` |
1055
- | `@html` | Markup content | `<span render="@html: '<i>'+firstName+'</i>';"></span>` |
1056
- | `@items` | A list, of the following format | `<declaration> <of\|in> <iterable> / <importRef>`<br>*See next two tables* |
1049
+ | `&` | CSS Property | `<div render="&color:someColor; &backgroundColor:someBgColor;"></div>` |
1050
+ | `%` | Class Name | `<div render="%active:app.isActive; %expanded:app.isExpanded;"></div>` |
1051
+ | `~` | Attribute Name | `<a render="~href:person.profileUrl+'#bio'; ~title:'Click me';"></a>` |
1052
+ | | Boolean Attribute | `<a render="~?required:formField.required; ~?aria-checked: formField.checked"></a>` |
1053
+ | `@` | DOM Event | `<div render="@click: this.methodCall(); @change: { state.prop1 = this.value };"></div>` |
1054
+ | `#` | Structural Directive: | *See below* |
1055
+ | `#text` | Plain text content | `<span render="#text:firstName+' '+lastName;"></span>` |
1056
+ | `#html` | Markup content | `<span render="#html: '<i>'+firstName+'</i>';"></span>` |
1057
+ | `#items` | A list, of the following format | `<declaration> <of\|in> <iterable> / <importRef>`<br>*See next two tables* |
1057
1058
 
1058
1059
  <details><summary><code>For ... Of</code> Loops</summary>
1059
1060
 
1060
1061
  | Idea | Usage |
1061
1062
  | :---- | :---- |
1062
- | A `for...of` loop over an array/iterable | `<ul render="@items: value of [1,2,3] / 'foo#fragment';"></ul>` |
1063
- | Same as above but with a `key` declaration | `<ul render="@items: (value,key) of [1,2,3] / 'foo#fragment';"></ul>` |
1064
- | Same as above but with different variable names | `<ul render="@items: (product,id) of store.products / 'foo#fragment';"></ul>` |
1065
- | Same as above but with a dynamic `importRef` | `<ul render="@items: (product,id) of store.products / store.importRef;"></ul>` |
1063
+ | A `for...of` loop over an array/iterable | `<ul render="#items: value of [1,2,3] / 'foo#fragment';"></ul>` |
1064
+ | Same as above but with a `key` declaration | `<ul render="#items: (value,key) of [1,2,3] / 'foo#fragment';"></ul>` |
1065
+ | Same as above but with different variable names | `<ul render="#items: (product,id) of store.products / 'foo#fragment';"></ul>` |
1066
+ | Same as above but with a dynamic `importRef` | `<ul render="#items: (product,id) of store.products / store.importRef;"></ul>` |
1066
1067
 
1067
1068
  </details>
1068
1069
 
@@ -1070,8 +1071,8 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1070
1071
 
1071
1072
  | Idea | Usage |
1072
1073
  | :---- | :---- |
1073
- | A `for...in` loop over an object | `<ul render="@items: key in {a:1,b:2} / 'foo#fragment';"></ul>` |
1074
- | Same as above but with a `value` and `index` declaration | `<ul render="@items: (key,value,index) in {a:1, b:2} / 'foo#fragment';"></ul>` |
1074
+ | A `for...in` loop over an object | `<ul render="#items: key in {a:1,b:2} / 'foo#fragment';"></ul>` |
1075
+ | Same as above but with a `value` and `index` declaration | `<ul render="#items: (key,value,index) in {a:1, b:2} / 'foo#fragment';"></ul>` |
1075
1076
 
1076
1077
  </details>
1077
1078
 
@@ -1811,7 +1812,7 @@ The following is a hypothetical list page!
1811
1812
  </template>
1812
1813
 
1813
1814
  <!-- The loop -->
1814
- <ul render="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1815
+ <ul render="#items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1815
1816
 
1816
1817
  </section>
1817
1818
  ```
@@ -1827,22 +1828,22 @@ The following is much like the above, but imperative. Additions and removals on
1827
1828
  <section namespace>
1828
1829
 
1829
1830
  <!-- The "items" template -->
1830
- <template def="item" scoped>
1831
- <li><a>Item</a></li>
1831
+ <template def="partials" scoped>
1832
+ <li def="item"></li>
1832
1833
  </template>
1833
1834
 
1834
1835
  <!-- The loop -->
1835
1836
  <ul id="list"></ul>
1836
1837
 
1837
- <script scoped>
1838
+ <script quantum scoped>
1838
1839
  // Import item template
1839
- let itemImport = this.import('item');
1840
+ let itemImport = this.import('partials#item');
1840
1841
  let itemTemplate = itemImport.value;
1841
1842
 
1842
1843
  // Iterate
1843
1844
  let items = [ 'Item 1', 'Item 2', 'Item 3' ];
1844
1845
  for (let entry of items) {
1845
- const currentItem = itemTemplate.content.cloneNode(true);
1846
+ const currentItem = itemTemplate.cloneNode(true);
1846
1847
  // Add to DOM
1847
1848
  this.namespace.list.appendChild(currentItem);
1848
1849
  // Remove from DOM whenever corresponding entry is removed