@symbo.ls/init 2.11.446 → 2.11.452

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/index.js +12 -7
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -17,8 +17,8 @@ import DYNAMIC_JSON from './dynamic.json'
17
17
 
18
18
  const CONFIG = getActiveConfig()
19
19
 
20
- const mergeWithLocalFile = (config = CONFIG, RC_FILE) => {
21
- const rcfile = isObject(RC_FILE) ? RC_FILE : DYNAMIC_JSON || {}
20
+ const mergeWithLocalFile = (config = CONFIG, options) => {
21
+ const rcfile = isObject(options.localFile) ? options.localFile : DYNAMIC_JSON || {}
22
22
  const clonedFile = deepClone(rcfile.designSystem || {})
23
23
  return deepMerge(config, clonedFile)
24
24
  }
@@ -35,7 +35,7 @@ const SET_OPTIONS = {
35
35
 
36
36
  export const init = (config, options = SET_OPTIONS) => {
37
37
  const emotion = options.emotion || defaultEmotion
38
- const resultConfig = mergeWithLocalFile(config || {})
38
+ const resultConfig = mergeWithLocalFile(config || {}, options)
39
39
 
40
40
  const conf = set({
41
41
  verbose: options.verbose,
@@ -76,15 +76,20 @@ const UPDATE_OPTIONS = {
76
76
  emotion: defaultEmotion
77
77
  }
78
78
 
79
- export const reInit = (config, RC_FILE, options = UPDATE_OPTIONS) => {
79
+ export const reinit = (config, options = UPDATE_OPTIONS) => {
80
80
  const emotion = options.emotion || defaultEmotion
81
- const resultConfig = mergeWithLocalFile(config || {}, RC_FILE)
81
+ const resultConfig = mergeWithLocalFile(config || {}, options)
82
+ const prevStyles = document.querySelector('[data-emotion="smbls"]')
83
+ console.log(prevStyles)
82
84
  const conf = set({
83
85
  verbose: false,
84
86
  ...resultConfig
85
87
  })
86
- emotion.injectGlobal({ ':root': conf.CSS_VARS })
87
- emotion.injectGlobal(conf.RESET)
88
+ if (!options.preventInject) {
89
+ emotion.injectGlobal({ ':root': conf.CSS_VARS })
90
+ emotion.injectGlobal(conf.RESET)
91
+ }
92
+ return conf
88
93
  }
89
94
 
90
95
  export const applyCSS = (styles, options = UPDATE_OPTIONS) => {
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@symbo.ls/init",
3
- "version": "2.11.446",
3
+ "version": "2.11.452",
4
4
  "license": "MIT",
5
- "gitHead": "d042e0c4fc9379b0ca7584f6405cfa2e7c1301d4",
5
+ "gitHead": "65799b9b9cb6d7e6e5e3f0cfc0b1140ccc506b2b",
6
6
  "source": "index.js",
7
7
  "main": "index.js",
8
8
  "dependencies": {
9
9
  "@domql/utils": "^2.5.0",
10
10
  "@symbo.ls/default-config": "^2.11.446",
11
11
  "@symbo.ls/emotion": "^2.11.0",
12
- "@symbo.ls/scratch": "^2.11.446"
12
+ "@symbo.ls/scratch": "^2.11.450"
13
13
  },
14
14
  "browserslist": "> 0.5%, last 2 versions, not dead",
15
15
  "devDependencies": {