@symbo.ls/scratch 2.10.164 → 2.10.174

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
@@ -16,6 +16,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var src_exports = {};
17
17
  module.exports = __toCommonJS(src_exports);
18
18
  __reExport(src_exports, require("./factory.js"), module.exports);
19
+ __reExport(src_exports, require("./defaultConfig"), module.exports);
20
+ __reExport(src_exports, require("./system"), module.exports);
19
21
  __reExport(src_exports, require("./utils"), module.exports);
20
22
  __reExport(src_exports, require("./set.js"), module.exports);
21
- __reExport(src_exports, require("./defaultConfig"), module.exports);
@@ -21,14 +21,15 @@ __export(document_exports, {
21
21
  applyDocument: () => applyDocument
22
22
  });
23
23
  module.exports = __toCommonJS(document_exports);
24
+ var import_utils = require("@domql/utils");
24
25
  var import_factory = require("../factory.js");
25
- var import_utils = require("../utils");
26
+ var import_utils2 = require("../utils");
26
27
  const applyDocument = () => {
27
28
  const CONFIG = (0, import_factory.getActiveConfig)();
28
29
  const { DOCUMENT, FONT_FAMILY, THEME, TYPOGRAPHY } = CONFIG;
29
30
  return (0, import_utils.merge)(DOCUMENT, {
30
31
  theme: THEME.document,
31
- fontFamily: (0, import_utils.getDefaultOrFirstKey)(FONT_FAMILY),
32
+ fontFamily: (0, import_utils2.getDefaultOrFirstKey)(FONT_FAMILY),
32
33
  fontSize: TYPOGRAPHY.base,
33
34
  lineHeight: TYPOGRAPHY.lineHeight
34
35
  });
@@ -24,17 +24,18 @@ __export(font_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(font_exports);
26
26
  var import_utils = require("@domql/utils");
27
+ var import_utils2 = require("@symbo.ls/utils");
27
28
  var import_factory = require("../factory.js");
28
- var import_utils2 = require("../utils");
29
+ var import_utils3 = require("../utils");
29
30
  const setFont = (val, key) => {
30
31
  const CSSvar = `--font-${key}`;
31
- const fontFace = val[0] ? (0, import_utils2.getFontFaceEach)(key, val) : (0, import_utils2.setCustomFontMedia)(key, val.url);
32
+ const fontFace = val[0] ? (0, import_utils3.getFontFaceEach)(key, val) : (0, import_utils3.setCustomFontMedia)(key, val.url);
32
33
  return { var: CSSvar, value: val, fontFace };
33
34
  };
34
35
  const getFontFamily = (key, factory) => {
35
36
  const CONFIG = (0, import_factory.getActiveConfig)();
36
37
  const { FONT_FAMILY } = CONFIG;
37
- return (0, import_utils2.getDefaultOrFirstKey)(factory || FONT_FAMILY, key);
38
+ return (0, import_utils3.getDefaultOrFirstKey)(factory || FONT_FAMILY, key);
38
39
  };
39
40
  const setFontFamily = (val, key) => {
40
41
  const CONFIG = (0, import_factory.getActiveConfig)();
@@ -43,7 +44,7 @@ const setFontFamily = (val, key) => {
43
44
  if (val.isDefault)
44
45
  FONT_FAMILY.default = key;
45
46
  if ((0, import_utils.isObject)(value))
46
- value = (0, import_utils2.arrayze)(value);
47
+ value = (0, import_utils2.arrayzeValue)(value);
47
48
  const CSSvar = `--font-family-${key}`;
48
49
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES[type]}`;
49
50
  return { var: CSSvar, value: str, arr: value, type };
@@ -21,9 +21,9 @@ __export(reset_exports, {
21
21
  applyReset: () => applyReset
22
22
  });
23
23
  module.exports = __toCommonJS(reset_exports);
24
+ var import_utils = require("@domql/utils");
24
25
  var import_factory = require("../factory.js");
25
26
  var import__ = require(".");
26
- var import_utils = require("@domql/utils");
27
27
  const applyReset = (reset = {}) => {
28
28
  const CONFIG = (0, import_factory.getActiveConfig)();
29
29
  const { CSS_VARS, RESET, TYPOGRAPHY, DOCUMENT } = CONFIG;
@@ -23,9 +23,10 @@ __export(spacing_exports, {
23
23
  getSpacingByKey: () => getSpacingByKey
24
24
  });
25
25
  module.exports = __toCommonJS(spacing_exports);
26
+ var import_utils = require("@symbo.ls/utils");
27
+ var import_utils2 = require("@domql/utils");
26
28
  var import_factory = require("../factory.js");
27
- var import_utils = require("@domql/utils");
28
- var import_utils2 = require("../utils");
29
+ var import_utils3 = require("../utils");
29
30
  const runThroughMedia = (sequenceProps) => {
30
31
  for (const prop in sequenceProps) {
31
32
  const mediaProps = sequenceProps[prop];
@@ -44,17 +45,17 @@ const runThroughMedia = (sequenceProps) => {
44
45
  templates: {},
45
46
  vars: {}
46
47
  });
47
- (0, import_utils2.generateSequence)(mediaProps);
48
+ (0, import_utils3.generateSequence)(mediaProps);
48
49
  const mediaName = prop.slice(1);
49
- (0, import_utils2.applySequenceVars)(mediaProps, mediaName);
50
+ (0, import_utils3.applySequenceVars)(mediaProps, mediaName);
50
51
  }
51
52
  }
52
53
  };
53
54
  const applySpacingSequence = () => {
54
55
  const CONFIG = (0, import_factory.getActiveConfig)();
55
56
  const { SPACING } = CONFIG;
56
- (0, import_utils2.generateSequence)(SPACING);
57
- (0, import_utils2.applySequenceVars)(SPACING);
57
+ (0, import_utils3.generateSequence)(SPACING);
58
+ (0, import_utils3.applySequenceVars)(SPACING);
58
59
  runThroughMedia(SPACING);
59
60
  };
60
61
  const getSequence = (sequenceProps) => {
@@ -63,14 +64,14 @@ const getSequence = (sequenceProps) => {
63
64
  if (!sequenceProps)
64
65
  return SPACING;
65
66
  const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
66
- return hasGenerated ? sequenceProps : (0, import_utils2.generateSequence)(sequenceProps);
67
+ return hasGenerated ? sequenceProps : (0, import_utils3.generateSequence)(sequenceProps);
67
68
  };
68
69
  const getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
69
70
  const sequence = getSequence(sequenceProps);
70
- const stack = (0, import_utils2.arrayze)(value);
71
+ const stack = (0, import_utils.arrayzeValue)(value);
71
72
  if (!stack)
72
73
  return;
73
- if ((0, import_utils.isString)(value) && value.includes("calc")) {
74
+ if ((0, import_utils2.isString)(value) && value.includes("calc")) {
74
75
  return { [propertyName]: value };
75
76
  }
76
77
  if (stack.length > 1) {
@@ -84,14 +85,14 @@ const getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
84
85
  3: ["BlockStart", "Inline", "BlockEnd"],
85
86
  4: ["BlockStart", "InlineEnd", "BlockEnd", "InlineStart"]
86
87
  };
87
- const wrapSequenceValueByDirection = (direction, i) => (0, import_utils2.getSequenceValuePropertyPair)(
88
+ const wrapSequenceValueByDirection = (direction, i) => (0, import_utils3.getSequenceValuePropertyPair)(
88
89
  stack[i],
89
90
  propertyName + direction + suffix,
90
91
  sequence
91
92
  );
92
93
  return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
93
94
  }
94
- return (0, import_utils2.getSequenceValuePropertyPair)(
95
+ return (0, import_utils3.getSequenceValuePropertyPair)(
95
96
  value,
96
97
  propertyName,
97
98
  sequence
@@ -122,7 +123,7 @@ const getSpacingBasedOnRatio = (props, propertyName, val) => {
122
123
  unit: SPACING.unit
123
124
  });
124
125
  }
125
- (0, import_utils2.applySequenceVars)(sequenceProps, null, { useDefault: false });
126
+ (0, import_utils3.applySequenceVars)(sequenceProps, null, { useDefault: false });
126
127
  return getSpacingByKey(value, propertyName, sequenceProps);
127
128
  }
128
129
  return getSpacingByKey(value, propertyName);
@@ -24,8 +24,9 @@ __export(typography_exports, {
24
24
  runThroughMedia: () => runThroughMedia
25
25
  });
26
26
  module.exports = __toCommonJS(typography_exports);
27
+ var import_utils = require("@domql/utils");
27
28
  var import_factory = require("../factory.js");
28
- var import_utils = require("../utils");
29
+ var import_utils2 = require("../utils");
29
30
  const runThroughMedia = (props) => {
30
31
  const CONFIG = (0, import_factory.getActiveConfig)();
31
32
  const { TYPOGRAPHY, MEDIA } = CONFIG;
@@ -46,9 +47,9 @@ const runThroughMedia = (props) => {
46
47
  templates: {},
47
48
  vars: {}
48
49
  });
49
- (0, import_utils.generateSequence)(mediaProps);
50
+ (0, import_utils2.generateSequence)(mediaProps);
50
51
  const mediaName = prop.slice(1);
51
- (0, import_utils.applySequenceVars)(mediaProps, mediaName);
52
+ (0, import_utils2.applySequenceVars)(mediaProps, mediaName);
52
53
  const query = MEDIA[mediaName];
53
54
  TYPOGRAPHY.templates[`@media screen and ${query}`] = {
54
55
  fontSize: mediaProps.base / TYPOGRAPHY.browserDefault + unit
@@ -60,7 +61,7 @@ const applyHeadings = (props) => {
60
61
  const CONFIG = (0, import_factory.getActiveConfig)();
61
62
  if (props.h1Matches) {
62
63
  const unit = props.unit;
63
- const HEADINGS = (0, import_utils.findHeadings)(props);
64
+ const HEADINGS = (0, import_utils2.findHeadings)(props);
64
65
  const { templates } = props;
65
66
  for (const k in HEADINGS) {
66
67
  const headerName = `h${parseInt(k) + 1}`;
@@ -78,15 +79,15 @@ const applyHeadings = (props) => {
78
79
  const applyTypographySequence = () => {
79
80
  const CONFIG = (0, import_factory.getActiveConfig)();
80
81
  const { TYPOGRAPHY } = CONFIG;
81
- (0, import_utils.generateSequence)(TYPOGRAPHY);
82
+ (0, import_utils2.generateSequence)(TYPOGRAPHY);
82
83
  applyHeadings(TYPOGRAPHY);
83
- (0, import_utils.applySequenceVars)(TYPOGRAPHY);
84
+ (0, import_utils2.applySequenceVars)(TYPOGRAPHY);
84
85
  runThroughMedia(TYPOGRAPHY);
85
86
  };
86
87
  const getFontSizeByKey = (value) => {
87
88
  const CONFIG = (0, import_factory.getActiveConfig)();
88
89
  const { TYPOGRAPHY } = CONFIG;
89
- return (0, import_utils.getSequenceValuePropertyPair)(
90
+ return (0, import_utils2.getSequenceValuePropertyPair)(
90
91
  value,
91
92
  "fontSize",
92
93
  TYPOGRAPHY
@@ -15,7 +15,6 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var utils_exports = {};
17
17
  module.exports = __toCommonJS(utils_exports);
18
- __reExport(utils_exports, require("./object.js"), module.exports);
19
18
  __reExport(utils_exports, require("./color.js"), module.exports);
20
19
  __reExport(utils_exports, require("./font.js"), module.exports);
21
20
  __reExport(utils_exports, require("./sequence.js"), module.exports);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "2.10.164",
5
+ "version": "2.10.174",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -36,5 +36,5 @@
36
36
  "> 1%",
37
37
  "ie >= 9"
38
38
  ],
39
- "gitHead": "f8297fb6782c23e6c54934d862719201e46bf048"
39
+ "gitHead": "27fc91e7f950d24e520a2219fbd5fc6d0f74a2c2"
40
40
  }
package/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  export * from './factory.js'
4
+ export * from './defaultConfig'
5
+ export * from './system'
4
6
  export * from './utils'
5
7
  export * from './set.js'
6
- export * from './defaultConfig'
@@ -1,7 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ import { merge } from '@domql/utils'
3
4
  import { getActiveConfig } from '../factory.js'
4
- import { getDefaultOrFirstKey, merge } from '../utils'
5
+ import { getDefaultOrFirstKey } from '../utils'
5
6
 
6
7
  export const applyDocument = () => {
7
8
  const CONFIG = getActiveConfig()
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
3
  import { isObject } from '@domql/utils'
4
+ import { arrayzeValue } from '@symbo.ls/utils'
4
5
  import { getActiveConfig } from '../factory.js'
5
6
 
6
7
  import {
7
- arrayze,
8
8
  getDefaultOrFirstKey,
9
9
  getFontFaceEach,
10
10
  setCustomFontMedia
@@ -32,7 +32,7 @@ export const setFontFamily = (val, key) => {
32
32
  let { value, type } = val
33
33
  if (val.isDefault) FONT_FAMILY.default = key
34
34
 
35
- if (isObject(value)) value = arrayze(value)
35
+ if (isObject(value)) value = arrayzeValue(value)
36
36
 
37
37
  const CSSvar = `--font-family-${key}`
38
38
  const str = `${value.join(', ')}, ${FONT_FAMILY_TYPES[type]}`
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ import { deepMerge, merge } from '@domql/utils'
3
4
  import { getActiveConfig } from '../factory.js'
4
5
  import { getMediaTheme } from '.'
5
- import { deepMerge, merge } from '@domql/utils' // eslint-disable-line no-unused-vars
6
6
 
7
7
  export const applyReset = (reset = {}) => {
8
8
  const CONFIG = getActiveConfig()
@@ -1,14 +1,13 @@
1
1
  'use strict'
2
2
 
3
- import { getActiveConfig } from '../factory.js'
3
+ import { arrayzeValue } from '@symbo.ls/utils'
4
+ import { isString, merge } from '@domql/utils'
4
5
 
5
- import { isString } from '@domql/utils'
6
+ import { getActiveConfig } from '../factory.js'
6
7
  import {
7
8
  applySequenceVars,
8
- arrayze,
9
9
  generateSequence,
10
- getSequenceValuePropertyPair,
11
- merge
10
+ getSequenceValuePropertyPair
12
11
  } from '../utils'
13
12
 
14
13
  const runThroughMedia = sequenceProps => {
@@ -62,7 +61,7 @@ export const getSpacingByKey = (
62
61
  ) => {
63
62
  const sequence = getSequence(sequenceProps)
64
63
 
65
- const stack = arrayze(value)
64
+ const stack = arrayzeValue(value)
66
65
  if (!stack) return
67
66
 
68
67
  if (isString(value) && value.includes('calc')) {
@@ -1,13 +1,13 @@
1
1
  'use strict'
2
2
 
3
+ import { merge } from '@domql/utils'
3
4
  import { getActiveConfig } from '../factory.js'
4
5
 
5
6
  import {
6
7
  applySequenceVars,
7
8
  findHeadings,
8
9
  generateSequence,
9
- getSequenceValuePropertyPair,
10
- merge
10
+ getSequenceValuePropertyPair
11
11
  } from '../utils'
12
12
 
13
13
  export const runThroughMedia = props => {
@@ -1,8 +1,7 @@
1
1
  'use strict'
2
2
 
3
- export * from './object.js'
4
3
  export * from './color.js'
5
4
  export * from './font.js'
6
5
  export * from './sequence.js'
7
6
  export * from './var.js'
8
- export * from './sprite.js'
7
+ export * from './sprite.js'
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var object_exports = {};
20
- __export(object_exports, {
21
- arrayze: () => arrayze,
22
- deepMerge: () => deepMerge,
23
- isArray: () => isArray,
24
- isFunction: () => isFunction,
25
- isObject: () => isObject,
26
- isObjectLike: () => isObjectLike,
27
- isString: () => isString,
28
- merge: () => merge
29
- });
30
- module.exports = __toCommonJS(object_exports);
31
- const isString = (arg) => typeof arg === "string";
32
- const isArray = (arg) => Array.isArray(arg);
33
- const isObject = (arg) => {
34
- if (arg === null)
35
- return false;
36
- return typeof arg === "object" && arg.constructor === Object;
37
- };
38
- const isObjectLike = (arg) => {
39
- if (arg === null)
40
- return false;
41
- return typeof arg === "object";
42
- };
43
- const merge = (obj, original) => {
44
- for (const e in original) {
45
- const objProp = obj[e];
46
- const originalProp = original[e];
47
- if (objProp === void 0) {
48
- obj[e] = originalProp;
49
- }
50
- }
51
- return obj;
52
- };
53
- const deepMerge = (obj, obj2) => {
54
- for (const e in obj2) {
55
- const objProp = obj[e];
56
- const obj2Prop = obj2[e];
57
- if (objProp === void 0) {
58
- obj[e] = obj2Prop;
59
- } else if (isObjectLike(objProp) && isObject(obj2Prop)) {
60
- deepMerge(objProp, obj2Prop);
61
- }
62
- }
63
- return obj;
64
- };
65
- const arrayze = (val) => {
66
- if (isString(val))
67
- return val.split(" ");
68
- if (isObject(val))
69
- return Object.keys(val).map((v) => val[v]);
70
- if (isArray(val))
71
- return val;
72
- };
73
- const isFunction = (arg) => typeof arg === "function";
@@ -1,47 +0,0 @@
1
- 'use strict'
2
-
3
- export const isString = arg => typeof arg === 'string'
4
-
5
- export const isArray = arg => Array.isArray(arg)
6
-
7
- export const isObject = arg => {
8
- if (arg === null) return false
9
- return (typeof arg === 'object') && (arg.constructor === Object)
10
- }
11
-
12
- export const isObjectLike = arg => {
13
- if (arg === null) return false
14
- return (typeof arg === 'object')
15
- }
16
-
17
- export const merge = (obj, original) => {
18
- for (const e in original) {
19
- const objProp = obj[e]
20
- const originalProp = original[e]
21
- if (objProp === undefined) {
22
- obj[e] = originalProp
23
- }
24
- }
25
- return obj
26
- }
27
-
28
- export const deepMerge = (obj, obj2) => {
29
- for (const e in obj2) {
30
- const objProp = obj[e]
31
- const obj2Prop = obj2[e]
32
- if (objProp === undefined) {
33
- obj[e] = obj2Prop
34
- } else if (isObjectLike(objProp) && isObject(obj2Prop)) {
35
- deepMerge(objProp, obj2Prop)
36
- }
37
- }
38
- return obj
39
- }
40
-
41
- export const arrayze = val => {
42
- if (isString(val)) return val.split(' ')
43
- if (isObject(val)) return Object.keys(val).map(v => val[v])
44
- if (isArray(val)) return val
45
- }
46
-
47
- export const isFunction = arg => typeof arg === 'function'