smbls 0.15.37 → 0.15.39

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
@@ -3,7 +3,7 @@
3
3
  "description": "UI Library built on Scratch and DOMQL",
4
4
  "private": false,
5
5
  "author": "symbo.ls",
6
- "version": "0.15.37",
6
+ "version": "0.15.39",
7
7
  "repository": "https://github.com/symbo-ls/smbls",
8
8
  "main": "src/index.js",
9
9
  "files": [
@@ -1,18 +1,31 @@
1
1
  'use strict'
2
2
 
3
+ import { getSystemTheme } from './Theme'
4
+
3
5
  export const Picture = {
4
6
  tag: 'picture',
5
7
 
6
8
  childExtend: {
7
9
  tag: 'source',
8
10
  attr: {
9
- media: ({ props, key, context }) => {
11
+ media: element => {
12
+ const { props, key, context } = element
10
13
  const { MEDIA } = context.SYSTEM
11
- return MEDIA[(props.media || key).slice(1)]
14
+ const globalTheme = getSystemTheme(element)
15
+ const mediaName = (props.media || key).slice(1)
16
+
17
+ if (mediaName === globalTheme) return '(min-width: 0px)'
18
+ else if (mediaName === 'dark' || mediaName === 'light') return '(max-width: 0px)'
19
+
20
+ return MEDIA[mediaName]
12
21
  },
13
22
  srcset: ({ props }) => props.srcset
14
23
  }
15
24
  },
16
25
 
17
- Img: ({ props }) => ({ src: props.src })
26
+ Img: ({ props }) => ({
27
+ width: 'inherit',
28
+ height: 'inherit',
29
+ src: props.src
30
+ })
18
31
  }