@symbo.ls/create 2.11.204 → 2.11.209

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/dist/cjs/index.js CHANGED
@@ -51,7 +51,7 @@ const mergeWithLocalFile = (options, optionsExternalFile) => {
51
51
  };
52
52
  const create = async (App, options = import_options.default, optionsExternalFile) => {
53
53
  const appIsKey = (0, import_utils.isString)(App);
54
- options = mergeWithLocalFile(options, optionsExternalFile);
54
+ options = { ...import_options.default, ...mergeWithLocalFile(options, optionsExternalFile) };
55
55
  const key = options.key || SYMBOLS_KEY || (appIsKey ? App : "");
56
56
  if (appIsKey)
57
57
  App = {};
@@ -34,20 +34,23 @@ module.exports = __toCommonJS(initEmotion_exports);
34
34
  var import_emotion = require("@domql/emotion");
35
35
  var import_emotion2 = require("@symbo.ls/emotion");
36
36
  var import_init = require("@symbo.ls/init");
37
- var import_options = __toESM(require("./options"), 1);
38
- const initEmotion = (key, options = import_options.default) => {
37
+ var import_utils = require("@domql/utils");
38
+ var import_options = require("./options");
39
+ var import_default_config = __toESM(require("@symbo.ls/default-config"), 1);
40
+ const initEmotion = (key, options = import_options.DESIGN_SYSTEM_OPTIONS) => {
39
41
  const doc = options.parent || options.document || document;
40
42
  const initOptions = options.initOptions || {};
41
- const emotion = initOptions.emotion || import_emotion2.emotion;
43
+ const emotion = initOptions.emotion;
42
44
  if (!initOptions.emotion)
43
- initOptions.emotion = emotion;
45
+ initOptions.emotion = import_emotion2.emotion;
44
46
  const registry = options.registry || (0, import_emotion.transformDOMQLEmotion)(initOptions.emotion, options);
45
- const scratchSystem = (0, import_init.init)(options.designSystem || {}, {
47
+ const designSystem = options.designSystem || (options.defaultConfig ? (0, import_utils.deepClone)(import_default_config.default) : {});
48
+ const scratchSystem = (0, import_init.init)(designSystem, {
46
49
  key,
47
50
  emotion,
48
51
  verbose: options.verbose,
49
52
  document: doc,
50
- ...import_options.default.designSystem,
53
+ ...import_options.DESIGN_SYSTEM_OPTIONS,
51
54
  ...initOptions
52
55
  });
53
56
  return [scratchSystem, emotion, registry];
@@ -18,27 +18,25 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var options_exports = {};
20
20
  __export(options_exports, {
21
+ CREATE_OPTIONS: () => CREATE_OPTIONS,
22
+ DESIGN_SYSTEM_OPTIONS: () => DESIGN_SYSTEM_OPTIONS,
21
23
  default: () => options_default
22
24
  });
23
25
  module.exports = __toCommonJS(options_exports);
24
26
  var import_define = require("./define");
25
- var import_emotion = require("@symbo.ls/emotion");
26
- var options_default = {
27
- editor: {},
27
+ const DESIGN_SYSTEM_OPTIONS = {
28
+ useReset: true,
29
+ useVariable: true,
30
+ useIconSprite: true,
31
+ useSvgSprite: true,
32
+ useDocumentTheme: true,
33
+ useFontImport: true
34
+ };
35
+ const CREATE_OPTIONS = {
36
+ defaultConfig: true,
28
37
  state: {},
29
38
  pages: {},
30
- designSystem: {
31
- useReset: true,
32
- useVariable: true,
33
- useIconSprite: true,
34
- useSvgSprite: true,
35
- useDocumentTheme: true,
36
- useFontImport: true
37
- },
38
39
  components: {},
39
- initOptions: {
40
- emotion: import_emotion.emotion
41
- },
42
40
  router: {
43
41
  initRouter: true,
44
42
  popState: true,
@@ -46,3 +44,4 @@ var options_default = {
46
44
  },
47
45
  define: import_define.defaultDefine
48
46
  };
47
+ var options_default = CREATE_OPTIONS;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.11.204",
3
+ "version": "2.11.209",
4
4
  "license": "MIT",
5
- "gitHead": "dab7f6d84335bca5af356b849c51204910670e76",
5
+ "gitHead": "1ae15deb38ce96bf2d1baaa68c4d1e38371c46c7",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -25,7 +25,7 @@
25
25
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
26
26
  "build:esm": "npx esbuild ./src/*.js --target=es2020 --format=esm --outdir=dist/esm",
27
27
  "build:cjs": "npx esbuild ./src/*.js --target=node16 --format=cjs --outdir=dist/cjs",
28
- "build:cjs:bundle": "npx esbuild ./src/index.js --target=node16 --format=cjs --outdir=dist/cjs/bundle --bundle ",
28
+ "build:cjs:bundle": "npx esbuild ./src/index.js --target=node16 --format=cjs --outdir=dist/cjs/bundle --bundle --loader:.svg=empty",
29
29
  "build:iife": "npx esbuild ./src/index.js --target=es2020 --format=iife --outdir=dist/iife --bundle --minify",
30
30
  "build": "yarn build:cjs; yarn build:cjs:bundle",
31
31
  "prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
package/src/index.js CHANGED
@@ -24,7 +24,7 @@ const mergeWithLocalFile = (options, optionsExternalFile) => {
24
24
 
25
25
  export const create = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
26
26
  const appIsKey = isString(App)
27
- options = mergeWithLocalFile(options, optionsExternalFile)
27
+ options = { ...DEFAULT_CREATE_OPTIONS, ...mergeWithLocalFile(options, optionsExternalFile) }
28
28
 
29
29
  const key = options.key || SYMBOLS_KEY || (appIsKey ? App : '')
30
30
 
@@ -3,22 +3,27 @@
3
3
  import { transformDOMQLEmotion } from '@domql/emotion'
4
4
  import { emotion as defaultEmotion } from '@symbo.ls/emotion'
5
5
  import { init } from '@symbo.ls/init'
6
+ import { deepClone } from '@domql/utils'
6
7
 
7
- import DEFAULT_CREATE_OPTIONS from './options'
8
+ import { DESIGN_SYSTEM_OPTIONS } from './options'
9
+ import DEFAULT_CONFIG from '@symbo.ls/default-config'
8
10
 
9
- export const initEmotion = (key, options = DEFAULT_CREATE_OPTIONS) => {
11
+ export const initEmotion = (key, options = DESIGN_SYSTEM_OPTIONS) => {
10
12
  const doc = options.parent || options.document || document
11
13
  const initOptions = options.initOptions || {}
12
- const emotion = initOptions.emotion || defaultEmotion
13
- if (!initOptions.emotion) initOptions.emotion = emotion
14
+ const emotion = initOptions.emotion
15
+
16
+ if (!initOptions.emotion) initOptions.emotion = defaultEmotion
17
+
14
18
  const registry = options.registry || transformDOMQLEmotion(initOptions.emotion, options)
19
+ const designSystem = options.designSystem || (options.defaultConfig ? deepClone(DEFAULT_CONFIG) : {})
15
20
 
16
- const scratchSystem = init(options.designSystem || {}, {
21
+ const scratchSystem = init(designSystem, {
17
22
  key,
18
23
  emotion,
19
24
  verbose: options.verbose,
20
25
  document: doc,
21
- ...DEFAULT_CREATE_OPTIONS.designSystem,
26
+ ...DESIGN_SYSTEM_OPTIONS,
22
27
  ...initOptions
23
28
  })
24
29
 
package/src/options.js CHANGED
@@ -1,24 +1,21 @@
1
1
  'use strict'
2
2
 
3
3
  import { defaultDefine } from './define'
4
- import { emotion as defaultEmotion } from '@symbo.ls/emotion'
5
4
 
6
- export default {
7
- editor: {},
5
+ export const DESIGN_SYSTEM_OPTIONS = {
6
+ useReset: true,
7
+ useVariable: true,
8
+ useIconSprite: true,
9
+ useSvgSprite: true,
10
+ useDocumentTheme: true,
11
+ useFontImport: true
12
+ }
13
+
14
+ export const CREATE_OPTIONS = {
15
+ defaultConfig: true,
8
16
  state: {},
9
17
  pages: {},
10
- designSystem: {
11
- useReset: true,
12
- useVariable: true,
13
- useIconSprite: true,
14
- useSvgSprite: true,
15
- useDocumentTheme: true,
16
- useFontImport: true
17
- },
18
18
  components: {},
19
- initOptions: {
20
- emotion: defaultEmotion
21
- },
22
19
  router: {
23
20
  initRouter: true,
24
21
  popState: true,
@@ -26,3 +23,5 @@ export default {
26
23
  },
27
24
  define: defaultDefine
28
25
  }
26
+
27
+ export default CREATE_OPTIONS