scu-web-components 0.0.38 → 0.0.40

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.
@@ -1,5 +1,5 @@
1
-
2
- // import type * as CSS from 'csstype';
1
+ /* eslint-disable */
2
+ import type * as CSS from 'csstype';
3
3
 
4
4
  declare module 'csstype' {
5
5
  interface Properties {
@@ -19,6 +19,7 @@ export type SCWProp = {
19
19
  borderBottom? : SCWColorValue,
20
20
  borderLeft? : SCWColorValue,
21
21
  borderRight? : SCWColorValue,
22
+ border? : SCWColorValue,
22
23
  font? : SCWTypeValue,
23
24
  size? : SCWSpacingValue,
24
25
  maxSize? : SCWSpacingValue,
@@ -118,6 +119,7 @@ export type SCWProp = {
118
119
  borderBottomXlg? : SCWColorValue,
119
120
  borderLeftXlg? : SCWColorValue,
120
121
  borderRightXlg? : SCWColorValue,
122
+ borderXlg? : SCWColorValue,
121
123
  fontXlg? : SCWTypeValue,
122
124
  sizeXlg? : SCWSpacingValue,
123
125
  maxSizeXlg? : SCWSpacingValue,
@@ -217,6 +219,7 @@ export type SCWProp = {
217
219
  borderBottomLg? : SCWColorValue,
218
220
  borderLeftLg? : SCWColorValue,
219
221
  borderRightLg? : SCWColorValue,
222
+ borderLg? : SCWColorValue,
220
223
  fontLg? : SCWTypeValue,
221
224
  sizeLg? : SCWSpacingValue,
222
225
  maxSizeLg? : SCWSpacingValue,
@@ -316,6 +319,7 @@ export type SCWProp = {
316
319
  borderBottomMd? : SCWColorValue,
317
320
  borderLeftMd? : SCWColorValue,
318
321
  borderRightMd? : SCWColorValue,
322
+ borderMd? : SCWColorValue,
319
323
  fontMd? : SCWTypeValue,
320
324
  sizeMd? : SCWSpacingValue,
321
325
  maxSizeMd? : SCWSpacingValue,
@@ -415,6 +419,7 @@ export type SCWProp = {
415
419
  borderBottomSm? : SCWColorValue,
416
420
  borderLeftSm? : SCWColorValue,
417
421
  borderRightSm? : SCWColorValue,
422
+ borderSm? : SCWColorValue,
418
423
  fontSm? : SCWTypeValue,
419
424
  sizeSm? : SCWSpacingValue,
420
425
  maxSizeSm? : SCWSpacingValue,
@@ -10,20 +10,30 @@ import type * as CSS from 'csstype';
10
10
  * @param {CSS.Properties} otherStyles
11
11
  * @return {string}
12
12
  */
13
- export function scw(
13
+ export default function style(
14
14
  dsysStyles: SCWProp,
15
15
  otherStyles: CSS.Properties = {},
16
16
  ) : string {
17
+
18
+ const toKebab = (str) => str.replace(/([a-z0–9])([A-Z])/g, "$1-$2").toLowerCase();
19
+
17
20
  return `style="${
18
21
  Object.entries(dsysStyles).map((entry) => {
19
- if (entry[1] === true) {
20
- return `--scw-${entry[0]}: 1;`;
22
+ if (!entry[0]) return '';
23
+ const name = toKebab(entry[0]);
24
+ const value = entry[1];
25
+ if (value === true) {
26
+ return `--scw-${name}: 1;`;
27
+ }else if (!isNaN(value as any)) {
28
+ return `--scw-${name}: ${value};`;
21
29
  }else{
22
- return `--scw-${entry[0]}: var( --scw-${entry[1]} );`;
30
+ return `--scw-${name}: var( --scw-${value} );`;
23
31
  }
24
32
  }).join('\n ')}${
25
33
  Object.entries(otherStyles).map((entry) => {
26
- return `${entry[0]}: ${entry[1]};`;
34
+ if (!entry[0]) return '';
35
+ const name = toKebab(entry[0]);
36
+ return `${name}: ${entry[1]};`;
27
37
  }).join('\n ')
28
38
  }"`;
29
39
  }
@@ -3,7 +3,7 @@ import { SCWProp } from "./cssPropertiesApi";
3
3
  import type * as CSS from 'csstype';
4
4
 
5
5
  /**
6
- * scw
6
+ * style
7
7
  * Function for dynamically creating and auto-completing
8
8
  * scw design system files.
9
9
  * @param {DSysProp} dsysStyles
@@ -14,12 +14,20 @@ export function scw(
14
14
  dsysStyles: SCWProp,
15
15
  otherStyles: CSS.Properties = {},
16
16
  ) : CSS.Properties {
17
+
18
+ const toKebab = (str) => str.replace(/([a-z0–9])([A-Z])/g, "$1-$2").toLowerCase();
19
+
17
20
  const dsysStylesObj: {[key:`--scw-${string}`]: string} = {};
18
21
  Object.entries(dsysStyles).map((entry) => {
19
- if (entry[1] === true) {
20
- dsysStylesObj[`--scw-${entry[0]}`] = '1';
22
+ if (!entry[0]) return '';
23
+ const name = toKebab(entry[0]);
24
+ const value = entry[1];
25
+ if (value === true) {
26
+ dsysStylesObj[`--scw-${name}`] = '1';
27
+ }else if (!isNaN(value as any)) {
28
+ return `--scw-${name}: ${value};`;
21
29
  }else{
22
- dsysStylesObj[`--scw-${entry[0]}`] = `var( --ex-${entry[1]} )`;
30
+ dsysStylesObj[`--scw-${name}`] = `var( --scw-${value} )`;
23
31
  }
24
32
  });
25
33
  return {
@@ -3,7 +3,7 @@
3
3
 
4
4
  constructor (config) {// version, extraCssPromise, config ) {
5
5
  this.prefix = 'scw';// dynamic
6
- this.buildUUID = '8d2268e6-003f-4dc2-ad6e-659211dfbf24';// dynamic
6
+ this.buildUUID = 'e2871242-47d3-4c65-83cc-ba7bf97f87cf';// dynamic
7
7
 
8
8
  this.generator = false;
9
9
  this.initialized = false;
Binary file