questmark-webrenderer 1.0.7 → 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.
- package/README.md +4 -4
- package/dist/main.js +2 -26550
- package/dist/main.js.LICENSE.txt +11 -0
- package/dist/webRender-basic.js +1 -61
- package/package.json +2 -2
- package/webRender-basic.js +2 -1
- package/webpack.config.js +12 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! https://mths.be/codepointat v0.2.0 by @mathias */
|
|
2
|
+
|
|
3
|
+
/*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @author Richard Smith-Unna
|
|
7
|
+
* @copyright 2016 Richard Smith-Unnar
|
|
8
|
+
* @license MIT
|
|
9
|
+
* @module unist:find
|
|
10
|
+
* @fileoverview Unist node finder
|
|
11
|
+
*/
|
package/dist/webRender-basic.js
CHANGED
|
@@ -1,61 +1 @@
|
|
|
1
|
-
let firstTime =
|
|
2
|
-
let log = () => {
|
|
3
|
-
console.log(arguments);
|
|
4
|
-
};
|
|
5
|
-
let clear = () => {
|
|
6
|
-
window.logElement.clear();
|
|
7
|
-
};
|
|
8
|
-
window.choices = (choices) => {
|
|
9
|
-
if (console.table) {
|
|
10
|
-
console.table(choices);
|
|
11
|
-
}
|
|
12
|
-
const buttonsRoot = document.createElement('div');
|
|
13
|
-
buttonsRoot.setAttribute('style', `
|
|
14
|
-
display: grid;
|
|
15
|
-
align-content: stretch;
|
|
16
|
-
justify-content: start;
|
|
17
|
-
align-items: center;
|
|
18
|
-
justify-items: start;
|
|
19
|
-
`);
|
|
20
|
-
window.logElement.appendChild(buttonsRoot);
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
choices.forEach(element => {
|
|
23
|
-
const button = document.createElement('button');
|
|
24
|
-
button.textContent = element.title;
|
|
25
|
-
button.classList.add('questmark');
|
|
26
|
-
button.onclick = () => {
|
|
27
|
-
clear();
|
|
28
|
-
console.log(`Picked #${element.id}: "${element.title}" `);
|
|
29
|
-
resolve(element.id);
|
|
30
|
-
}
|
|
31
|
-
buttonsRoot.appendChild(button);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
window.emit = (body) => {
|
|
36
|
-
if (firstTime === false) {
|
|
37
|
-
document.body.textContent = '';
|
|
38
|
-
firstTime = true;
|
|
39
|
-
|
|
40
|
-
const style = document.createElement('style');
|
|
41
|
-
style.textContent = `span.questmark {
|
|
42
|
-
white-space: pre-line;
|
|
43
|
-
}`;
|
|
44
|
-
document.head.appendChild(style);
|
|
45
|
-
|
|
46
|
-
window.logElement = document.createElement('div');
|
|
47
|
-
document.body.appendChild(window.logElement);
|
|
48
|
-
log = (body) => {
|
|
49
|
-
console.log(body);
|
|
50
|
-
const span = document.createElement('span');
|
|
51
|
-
span.textContent = body;
|
|
52
|
-
span.classList.add('questmark');
|
|
53
|
-
window.logElement.appendChild(span);
|
|
54
|
-
}
|
|
55
|
-
clear = () => {
|
|
56
|
-
window.logElement.innerHTML = "";
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
log(body);
|
|
60
|
-
};
|
|
61
|
-
document.body.textcontent = '';
|
|
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.
|
|
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": {
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
"webpack-cli": "^4.8.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"questmark": "^0.0.
|
|
19
|
+
"questmark": "^0.0.34"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/webRender-basic.js
CHANGED
|
@@ -26,6 +26,8 @@ window.choices = (choices) => {
|
|
|
26
26
|
button.onclick = () => {
|
|
27
27
|
clear();
|
|
28
28
|
console.log(`Picked #${element.id}: "${element.title}" `);
|
|
29
|
+
const event = new CustomEvent('selectQuestmarkOption', { detail: element });
|
|
30
|
+
window.dispatchEvent(event);
|
|
29
31
|
resolve(element.id);
|
|
30
32
|
}
|
|
31
33
|
buttonsRoot.appendChild(button);
|
|
@@ -58,4 +60,3 @@ window.emit = (body) => {
|
|
|
58
60
|
}
|
|
59
61
|
log(body);
|
|
60
62
|
};
|
|
61
|
-
document.body.textcontent = '';
|
package/webpack.config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
3
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
3
4
|
|
|
4
5
|
module.exports = {
|
|
5
6
|
entry: './main.mjs',
|
|
@@ -9,7 +10,17 @@ module.exports = {
|
|
|
9
10
|
},
|
|
10
11
|
resolve: { fallback: { fs: false } },
|
|
11
12
|
optimization: {
|
|
12
|
-
minimize:
|
|
13
|
+
minimize: true,
|
|
14
|
+
mangleExports: false,
|
|
15
|
+
minimizer: [
|
|
16
|
+
new TerserPlugin({
|
|
17
|
+
parallel: true,
|
|
18
|
+
terserOptions: {
|
|
19
|
+
keep_classnames: true,
|
|
20
|
+
keep_fnames: true
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
13
24
|
},
|
|
14
25
|
plugins: [
|
|
15
26
|
new CopyPlugin({
|