@symbo.ls/utils 2.6.7 → 2.6.19

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 CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "2.6.7",
3
+ "version": "2.6.19",
4
4
  "main": "src/index.js",
5
5
  "author": "symbo.ls",
6
6
  "license": "ISC",
7
7
  "dependencies": {
8
8
  "@domql/utils": "latest"
9
9
  },
10
- "gitHead": "15a1535659649deb922f75cf1051bb47e697752d"
10
+ "gitHead": "a8084c6c657bf107b430d1a567cd05c1288eb76c"
11
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
  })
package/src/index.js CHANGED
@@ -31,8 +31,7 @@ export const toDashCase = val => val
31
31
  .replace(/[A-Z]/g, (match, offset) => (offset > 0 ? '-' : '') + match.toLowerCase())
32
32
  .replace('.', '-')
33
33
 
34
-
35
34
  export const toDescriptionCase = str => {
36
- const result = str.replace(/([A-Z])/g, " $1")
35
+ const result = str.replace(/([A-Z])/g, ' $1')
37
36
  return result.charAt(0).toUpperCase() + result.slice(1)
38
- }
37
+ }