@symbo.ls/atoms 2.11.352 → 2.11.357

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.
Files changed (3) hide show
  1. package/Collection.js +2 -1
  2. package/Img.js +13 -4
  3. package/package.json +2 -2
package/Collection.js CHANGED
@@ -12,7 +12,8 @@ export const Collection = {
12
12
  if (hasChildren) {
13
13
  param = el.props?.children
14
14
  const childrenAs = el.props?.childrenAs
15
- if (childrenAs) param = param.map(v => ({ [childrenAs]: v }))
15
+ const extend = el.props?.childrenExtend
16
+ if (childrenAs) param = param.map(v => ({ extend, [childrenAs]: v }))
16
17
  } else if (!param) return
17
18
 
18
19
  if (isString(param)) {
package/Img.js CHANGED
@@ -4,13 +4,22 @@ export const Img = {
4
4
  tag: 'img',
5
5
 
6
6
  attr: {
7
- src: ({ props, context }) => {
8
- const src = props.src
9
- const file = context.files[src]
7
+ src: (el) => {
8
+ const { props, context } = el
9
+ const { exec, isString, replaceLiteralsWithObjectFields } = context.utils
10
+ let src = exec(props.src, el)
11
+
12
+ if (isString(src) && src.includes('{{')) {
13
+ src = replaceLiteralsWithObjectFields(src, el.state)
14
+ }
15
+
16
+ let isUrl
17
+ try { isUrl = new URL(src) } catch (e) {}
18
+ if (isUrl) return src
19
+ const file = context.files && context.files[src]
10
20
  if (src.startsWith('/') && file) {
11
21
  return file.content.src
12
22
  }
13
- return src
14
23
  },
15
24
  alt: ({ props }) => props.alt,
16
25
  title: ({ props }) => props.title || props.alt
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.11.352",
3
+ "version": "2.11.357",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "c294479f06e6f576951c7c1cb3df309a08d59dc4",
6
+ "gitHead": "b5300a7b7e31509580190626af6c392176d2942d",
7
7
  "dependencies": {
8
8
  "@domql/state": "latest",
9
9
  "@domql/utils": "latest",