highmark-yapp 1.0.12 → 2.0.1

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 +13 -40
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -93,49 +93,22 @@ const content = `
93
93
  Then it is just a question of mounting the node:
94
94
 
95
95
  ```
96
- import { Element } from "easy";
97
- import { markdownUtilities } from "highmark-yapp";
98
-
99
- const { nodeFromContent } = markdownUtilities;
100
-
101
- class Article extends Element {
102
- didMount() {
103
- const { content } = this.constructor,
104
- tokens = tokensFromContent(node),
105
- node = nodeFromTokens(tokens);
106
- domElement = this.getDOMElement(),
107
- parentDOMElement = domElement, ///
108
- siblingDOMElement = null;
109
-
110
- node.mount(parentDOMElement, siblingDOMElement, context);
111
- }
112
-
113
- willUnmount() {
114
- ///
115
- }
116
-
117
- static tagName = "article";
118
- }
96
+ const body = document.querySelector("body"),
97
+ domElement = body, ///
98
+ parentDOMElement = domElement, ///
99
+ siblingDOMElement = null,
100
+ context = {
101
+ tokens
102
+ };
103
+
104
+ node.mount(parentDOMElement, siblingDOMElement, context);
119
105
  ```
120
106
 
121
- Here the `didMount()` method assumes that some content is defined by way of the static `content` property.
122
- One way to do this would be to extend the `Article` class thus:
123
-
124
- ```
125
- import Article from "../article";
126
-
127
- export default class ArchitectureArticle extends Article {
128
- static title = "Architecture";
129
-
130
- static content = `
131
-
132
- ...
133
-
134
- `;
135
- }
136
- ```
107
+ Note the use of the tokens in a `context` plain old JavaScript object that must be padded to the node's `mount()` method along with the parent and sibling DOM elements.
108
+ This is why there are two utility functions to create the node in two stages.
109
+ By the way, the sibling DOM element, if not null, must be a child of the parent DOM element, in which case the node will be mounted immediately *before* it.
137
110
 
138
- Note that the usual delimiters for block listings consisting of three backticks have been replaced with three single quotes `'''`.
111
+ Note also that the usual delimiters for block listings consisting of three backticks have been replaced with three single quotes `'''`.
139
112
  This generally makes things easier when working inside string template literals that use backticks for delimiters of course.
140
113
 
141
114
  ## Building
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "highmark-yapp",
3
3
  "author": "James Smith",
4
- "version": "1.0.12",
4
+ "version": "2.0.1",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/highmark-uapp",
7
7
  "description": "Highmark with Yapp listings.",