@symbo.ls/utils
Advanced tools
Comparing version 2.6.7 to 2.6.14
{ | ||
"name": "@symbo.ls/utils", | ||
"version": "2.6.7", | ||
"version": "2.6.14", | ||
"main": "src/index.js", | ||
@@ -10,3 +10,3 @@ "author": "symbo.ls", | ||
}, | ||
"gitHead": "15a1535659649deb922f75cf1051bb47e697752d" | ||
"gitHead": "366fb9878348671e8ad0653ebd7347cf37b43bb2" | ||
} |
'use strict' | ||
import { toDashCase } from './' | ||
export const stringifyProps = (props, indent = 2) => JSON.stringify(props, null, indent) | ||
export const replaceKeysWithAttr = str => str | ||
.replaceAll('": "', '="') | ||
.replaceAll('\n "', ' ') | ||
.replaceAll('{ ', '\n ') | ||
.replaceAll('}', '') | ||
.replaceAll(', ', '\n ') | ||
@@ -19,3 +27,14 @@ export const codify = (key, props) => ({ | ||
props | ||
}` | ||
}`, | ||
iframe: `<iframe | ||
title="${key}" | ||
style="border: 0; resize: both; padding: 0 10px 10px 0" | ||
src="http://${window.location.host}/scene/${key}/fullscreen/smbls.symbo.ls" | ||
referrerpolicy="no-referrer-when-downgrade" | ||
></iframe>`, | ||
html: `<script src="smbls.js"></script> | ||
<${key && toDashCase(key)} ${replaceKeysWithAttr(stringifyProps(props))}/>` | ||
}) |
5736
152