@symbo.ls/init 2.6.9 → 2.6.10

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +18 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/init",
3
- "version": "2.6.9",
3
+ "version": "2.6.10",
4
4
  "license": "MIT",
5
5
  "gitHead": "54fa6500c697604b3f48ba33a573545d7bff35fa",
6
6
  "source": "src/index.js",
package/src/index.js CHANGED
@@ -9,20 +9,20 @@ import {
9
9
  import { isObject, deepMerge } from '@domql/utils'
10
10
  import { initDOMQLEmotion } from 'domql/packages/emotion'
11
11
 
12
- import { emotion } from '@symbo.ls/create-emotion'
12
+ import { emotion as defaultEmotion } from '@symbo.ls/create-emotion'
13
13
  // import { setClassname } from 'css-in-props'
14
14
 
15
15
  import DYNAMIC_JSON from './dynamic.json'
16
16
 
17
17
  const CONFIG = getActiveConfig()
18
18
 
19
- const prepareInit = (config = {}, RC_FILE) => {
19
+ const prepareInit = (config = CONFIG, RC_FILE) => {
20
20
  const rcfile = isObject(RC_FILE) ? RC_FILE : DYNAMIC_JSON || {}
21
21
  return deepMerge(config, rcfile)
22
22
  }
23
23
 
24
24
  const SET_OPTIONS = {
25
- emotion,
25
+ emotion: defaultEmotion,
26
26
  useVariable: true,
27
27
  useReset: true,
28
28
  initDOMQLDefine: true
@@ -32,6 +32,7 @@ export const init = (config, RC_FILE, options = SET_OPTIONS) => {
32
32
  if (options.initDOMQLDefine) initDOMQLEmotion(options.emotion, options)
33
33
 
34
34
  const resultConfig = prepareInit(config, RC_FILE)
35
+ const emotion = options.emotion || defaultEmotion
35
36
 
36
37
  const conf = set({
37
38
  verbose: false,
@@ -41,17 +42,25 @@ export const init = (config, RC_FILE, options = SET_OPTIONS) => {
41
42
 
42
43
  const FontFace = getFontFaceString(conf.FONT)
43
44
 
44
- options.emotion.injectGlobal(FontFace)
45
- if (options.useReset) options.emotion.injectGlobal(conf.RESET)
45
+ emotion.injectGlobal(FontFace)
46
+ if (options.useVariable) emotion.injectGlobal({ ':root': conf.CSS_VARS })
47
+ if (options.useReset) emotion.injectGlobal(conf.RESET)
46
48
 
47
49
  return conf
48
50
  }
49
51
 
50
- export const updateReset = (options = { emotion }) => {
51
- const CONFIG = getActiveConfig()
52
- options.emotion.injectGlobal(CONFIG.RESET)
52
+ export const updateReset = (config, RC_FILE, options = { emotion: defaultEmotion }) => {
53
+ const resultConfig = prepareInit(config, RC_FILE)
54
+ // console.log(resultConfig)
55
+ const conf = set({
56
+ verbose: false,
57
+ ...resultConfig
58
+ })
59
+ console.log(conf.CSS_VARS)
60
+ options.emotion.injectGlobal({ ':root': conf.CSS_VARS })
61
+ options.emotion.injectGlobal(conf.RESET)
53
62
  }
54
63
 
55
- export const setClass = (props, options = { emotion }) => {}// setClassname(props, options.emotion.css)
64
+ export const setClass = (props, options = { emotion: defaultEmotion }) => {}// setClassname(props, options.emotion.css)
56
65
 
57
66
  export { CONFIG }