questmark-webrenderer 1.0.10 → 1.0.11

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.
@@ -1 +1 @@
1
- let firstTime=!1,log=()=>{console.log(arguments)},clear=()=>{window.logElement.clear()};window.choices=e=>{console.table&&console.table(e);const t=document.createElement("div");return t.setAttribute("style","\n display: grid;\n align-content: stretch;\n justify-content: start;\n align-items: center;\n justify-items: start;\n "),window.logElement.appendChild(t),new Promise(((n,o)=>{e.forEach((e=>{const o=document.createElement("button");o.textContent=e.title,o.classList.add("questmark");const l=new CustomEvent("selectQuestmarkOption",{detail:e});window.dispatchEvent(l),o.onclick=()=>{clear(),console.log(`Picked #${e.id}: "${e.title}" `),n(e.id)},t.appendChild(o)}))}))},window.emit=e=>{if(!1===firstTime){document.body.textContent="",firstTime=!0;const e=document.createElement("style");e.textContent="span.questmark {\n white-space: pre-line;\n }",document.head.appendChild(e),window.logElement=document.createElement("div"),document.body.appendChild(window.logElement),log=e=>{console.log(e);const t=document.createElement("span");t.textContent=e,t.classList.add("questmark"),window.logElement.appendChild(t)},clear=()=>{window.logElement.innerHTML=""}}log(e)};
1
+ let firstTime=!1,log=()=>{console.log(arguments)},clear=()=>{window.logElement.clear()};window.choices=e=>{console.table&&console.table(e);const t=document.createElement("div");return t.setAttribute("style","\n display: grid;\n align-content: stretch;\n justify-content: start;\n align-items: center;\n justify-items: start;\n "),window.logElement.appendChild(t),new Promise(((n,o)=>{e.forEach((e=>{const o=document.createElement("button");o.textContent=e.title,o.classList.add("questmark"),o.onclick=()=>{clear(),console.log(`Picked #${e.id}: "${e.title}" `);const t=new CustomEvent("selectQuestmarkOption",{detail:e});window.dispatchEvent(t),n(e.id)},t.appendChild(o)}))}))},window.emit=e=>{if(!1===firstTime){document.body.textContent="",firstTime=!0;const e=document.createElement("style");e.textContent="span.questmark {\n white-space: pre-line;\n }",document.head.appendChild(e),window.logElement=document.createElement("div"),document.body.appendChild(window.logElement),log=e=>{console.log(e);const t=document.createElement("span");t.textContent=e,t.classList.add("questmark"),window.logElement.appendChild(t)},clear=()=>{window.logElement.innerHTML=""}}log(e)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "questmark-webrenderer",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "A simple inline parser and renderer for Questmark, to create live testable Questmark documents easily",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
@@ -23,11 +23,11 @@ window.choices = (choices) => {
23
23
  const button = document.createElement('button');
24
24
  button.textContent = element.title;
25
25
  button.classList.add('questmark');
26
- const event = new CustomEvent('selectQuestmarkOption', { detail: element });
27
- window.dispatchEvent(event);
28
26
  button.onclick = () => {
29
27
  clear();
30
28
  console.log(`Picked #${element.id}: "${element.title}" `);
29
+ const event = new CustomEvent('selectQuestmarkOption', { detail: element });
30
+ window.dispatchEvent(event);
31
31
  resolve(element.id);
32
32
  }
33
33
  buttonsRoot.appendChild(button);