@symbo.ls/init 1.1.7 → 1.1.9

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/init",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "license": "MIT",
5
5
  "gitHead": "54fa6500c697604b3f48ba33a573545d7bff35fa",
6
6
  "source": "src/index.js",
package/src/index.js CHANGED
@@ -2,41 +2,45 @@
2
2
 
3
3
  import {
4
4
  set,
5
- FONT,
6
- RESET,
7
- getFontFaceString,
8
- CONFIG
5
+ getActiveConfig,
6
+ getFontFaceString
9
7
  } from '@symbo.ls/scratch'
10
8
 
11
- import { deepMerge, isObject } from '@domql/utils'
9
+ import { isObject, deepMerge } from '@domql/utils'
10
+ import { initDOMQLEmotion } from 'domql/packages/emotion'
12
11
 
13
- import CONFIG_DEFAULT from '@symbo.ls/config-default'
14
- import SYMBOLSRC_FILE from '../.symbolsrc.json'
12
+ import { emotion } from '@symbo.ls/create-emotion'
13
+ import { setClassname } from 'css-in-props'
15
14
 
16
15
  import DYNAMIC_JSON from './dynamic.json'
17
16
 
18
- import createEmotion from '@symbo.ls/create-emotion'
19
- import { setClassname } from 'css-in-props'
17
+ const CONFIG = getActiveConfig()
20
18
 
21
- const { css, injectGlobal } = createEmotion
19
+ const prepareInit = (config = {}, RC_FILE) => {
20
+ // const defaultConfig = merge(config, CONFIG_DEFAULT)
21
+ const rcfile = isObject(RC_FILE) ? RC_FILE : DYNAMIC_JSON || {}
22
+ return deepMerge(config, rcfile)
23
+ }
22
24
 
23
- export const init = (config, RC_FILE, options = { emotion: createEmotion }) => {
24
- const defaultConfig = config || CONFIG_DEFAULT || SYMBOLSRC_FILE
25
+ export const init = (config, RC_FILE, options = { emotion, initDOMQLDefine: true }) => {
26
+ if (options.initDOMQLDefine) initDOMQLEmotion(options.emotion, options)
25
27
 
26
- const rcfile = isObject(RC_FILE) ? RC_FILE : DYNAMIC_JSON
27
- const resultConfig = deepMerge(rcfile, defaultConfig)
28
+ const resultConfig = prepareInit(config)
28
29
 
29
- const conf = set({ verbose: false, ...resultConfig })
30
- const FontFace = getFontFaceString(FONT)
30
+ const conf = set({ verbose: false, ...resultConfig }, { newConfig: options.newConfig })
31
+ const FontFace = getFontFaceString(conf.FONT)
31
32
 
32
- injectGlobal(FontFace)
33
- if (conf.useReset) injectGlobal(RESET)
33
+ options.emotion.injectGlobal(FontFace)
34
+ if (conf.useReset) options.emotion.injectGlobal(conf.RESET)
34
35
 
35
36
  return conf
36
37
  }
37
38
 
38
- export const updateReset = () => injectGlobal(RESET)
39
+ export const updateReset = (options = { emotion }) => {
40
+ const CONFIG = getActiveConfig()
41
+ options.emotion.injectGlobal(CONFIG.RESET)
42
+ }
39
43
 
40
- export const setClass = props => setClassname(props, css)
44
+ export const setClass = (props, options = { emotion }) => setClassname(props, options.emotion.css)
41
45
 
42
46
  export { CONFIG }
package/.symbolsrc.json DELETED
@@ -1 +0,0 @@
1
- {"version":"0.0.1","COLOR":{"transparent":"rgba(0, 0, 0, 0)","black":"black","blue":"#0079FD","indigo":"#50E1FF","green":"#59AC56","red":"#FE5B47","yellow":"#EDCB38","orange":"#E2862F","brown":"#7D6755","pink":"#FD8ABF","purple":"#7345AF","white":"white"},"GRADIENT":{"gradient-dark":"linear-gradient(0deg,\n rgba(0,0,0,0.06) 0%,\n rgba(0,0,0,0.07) 100%\n )","gradient-dark-active":"linear-gradient(0deg,\n rgba(0,0,0,0.09) 0%,\n rgba(0,0,0,0.1) 100%\n )","gradient-light":"linear-gradient(\n 0deg,\n rgba(255,255,255,0.05) 0%,\n rgba(255,255,255,0.06) 100%\n )","gradient-light-active":"linear-gradient(\n 0deg,\n rgba(255,255,255,0.09) 0%,\n rgba(255,255,255,0.10) 100%\n )"},"THEME":{"document":{"variants":{"light":{"color":"black","background":"white"},"dark":{"color":"white","background":"black"}}},"primary":{"color":"white","background":"blue"},"secondary":{"variants":{"light":{"color":"white","background":"gradient-light"},"dark":{"color":"white","background":"gradient-dark-active"}}}},"FONT":{"Karla":[{"url":"https://symbols-fonts.s3.us-west-1.amazonaws.com/Karla/Karla-VariableFont_wght.ttf","fontWeight":"variable","fontStyle":"normal","fontDisplay":"swap","unicodeRange":"U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF"},{"url":"https://symbols-fonts.s3.us-west-1.amazonaws.com/Karla/Karla-VariableFont_wght.ttf","fontStyle":"normal","fontWeight":"variable","fontDisplay":"swap","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"}]},"FONT_FAMILY":{"StartWithKarla":{"default":true,"value":["\"Karla\""],"type":"serif"}}}