dsh-motion-ui 0.8.0 → 0.8.2
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/CHANGELOG.md +35 -0
- package/README.md +10 -2
- package/VERIFICATION.md +14 -0
- package/client.js +254 -95
- package/lib/build-info.js +1 -1
- package/lib/canvas-source.js +27 -0
- package/lib/export-runtime-bundle.js +1 -1
- package/lib/sandbox.js +2 -1
- package/package.json +8 -7
package/lib/build-info.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by npm run build.
|
|
2
|
-
export const BUILD_INFO = Object.freeze({"version":"0.8.
|
|
2
|
+
export const BUILD_INFO = Object.freeze({"version":"0.8.2","id":"0.8.2+6fdf57d9db59","sourceHash":"6fdf57d9db591895145d01ed117f72cb06d080b49061ecb5a064d369ac6c3157"});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Repair formatting separators, preserving code samples, attribute values,
|
|
2
|
+
// CSS strings/comments and generated JavaScript.
|
|
3
|
+
export function normalizeCanvasHtml(html){
|
|
4
|
+
let protectedDepth=0;
|
|
5
|
+
return html.replace(/<!--[\s\S]*?-->|<(?:"[^"]*"|'[^']*'|[^'">])*>|[^<]+|</g,token=>{
|
|
6
|
+
if(token.startsWith('<')){
|
|
7
|
+
const tag=token.match(/^<(\/)?(pre|code|textarea|script|style)\b/i);
|
|
8
|
+
if(tag)protectedDepth=Math.max(0,protectedDepth+(tag[1]?-1:1));
|
|
9
|
+
return token;
|
|
10
|
+
}
|
|
11
|
+
return !protectedDepth&&/^(?:\s|\\[rn])+$/.test(token)?token.replace(/\\[rn]/g,'\n'):token;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function normalizeCanvasCss(css){
|
|
15
|
+
let out='',quote='',comment=false,last='';
|
|
16
|
+
for(let i=0;i<css.length;i++){
|
|
17
|
+
const c=css[i],next=css[i+1];
|
|
18
|
+
if(comment){out+=c;if(c==='*'&&next==='/'){out+=next;i++;comment=false}continue}
|
|
19
|
+
if(quote){out+=c;if(c==='\\'&&next!==undefined){out+=next;i++}else if(c===quote)quote='';continue}
|
|
20
|
+
if(c==='/'&&next==='*'){out+='/*';i++;comment=true;continue}
|
|
21
|
+
if(c==='"'||c==="'"){quote=c;out+=c;last=c;continue}
|
|
22
|
+
if(c==='\\'&&/[rn]/.test(next??'')&&/[{};]/.test(last)){out+='\n';i++;continue}
|
|
23
|
+
out+=c;if(!/\s/.test(c))last=c;
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
export const canvasSource=node=>({html:normalizeCanvasHtml(node.html),css:normalizeCanvasCss(node.css??''),script:node.script??''});
|