@symbo.ls/utils 2.6.0 → 2.6.14
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/package.json +3 -18
- package/src/codify.js +20 -1
package/package.json
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/utils",
|
|
3
|
-
"version": "2.6.
|
|
4
|
-
"description": "",
|
|
5
|
-
"source": "src/index.js",
|
|
3
|
+
"version": "2.6.14",
|
|
6
4
|
"main": "src/index.js",
|
|
7
|
-
"
|
|
8
|
-
"watch": "parcel watch --no-cache",
|
|
9
|
-
"build": "parcel build --no-cache"
|
|
10
|
-
},
|
|
11
|
-
"author": "",
|
|
5
|
+
"author": "symbo.ls",
|
|
12
6
|
"license": "ISC",
|
|
13
7
|
"dependencies": {
|
|
14
8
|
"@domql/utils": "latest"
|
|
15
9
|
},
|
|
16
|
-
"
|
|
17
|
-
"@babel/core": "^7.11.5",
|
|
18
|
-
"babel-eslint": "^10.0.3",
|
|
19
|
-
"eslint": "^6.1.0",
|
|
20
|
-
"standard": "^13.1.0"
|
|
21
|
-
},
|
|
22
|
-
"standard": {
|
|
23
|
-
"parser": "babel-eslint"
|
|
24
|
-
},
|
|
25
|
-
"gitHead": "41981d1b4f550992e08104002a6ca83398c03084"
|
|
10
|
+
"gitHead": "366fb9878348671e8ad0653ebd7347cf37b43bb2"
|
|
26
11
|
}
|
package/src/codify.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
import { toDashCase } from './'
|
|
4
|
+
|
|
3
5
|
export const stringifyProps = (props, indent = 2) => JSON.stringify(props, null, indent)
|
|
6
|
+
export const replaceKeysWithAttr = str => str
|
|
7
|
+
.replaceAll('": "', '="')
|
|
8
|
+
.replaceAll('\n "', ' ')
|
|
9
|
+
.replaceAll('{ ', '\n ')
|
|
10
|
+
.replaceAll('}', '')
|
|
11
|
+
.replaceAll(', ', '\n ')
|
|
4
12
|
|
|
5
13
|
export const codify = (key, props) => ({
|
|
6
14
|
react: `import { ${key} } from 'smbls/react'
|
|
@@ -16,5 +24,16 @@ const props = ${stringifyProps(props)}
|
|
|
16
24
|
const component = {
|
|
17
25
|
extend: ${key},
|
|
18
26
|
props
|
|
19
|
-
}
|
|
27
|
+
}`,
|
|
28
|
+
|
|
29
|
+
iframe: `<iframe
|
|
30
|
+
title="${key}"
|
|
31
|
+
style="border: 0; resize: both; padding: 0 10px 10px 0"
|
|
32
|
+
src="http://${window.location.host}/scene/${key}/fullscreen/smbls.symbo.ls"
|
|
33
|
+
referrerpolicy="no-referrer-when-downgrade"
|
|
34
|
+
></iframe>`,
|
|
35
|
+
|
|
36
|
+
html: `<script src="smbls.js"></script>
|
|
37
|
+
|
|
38
|
+
<${key && toDashCase(key)} ${replaceKeysWithAttr(stringifyProps(props))}/>`
|
|
20
39
|
})
|