@medyll/cssfabric 0.1.12 → 0.2.0

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 (196) hide show
  1. package/README.md +38 -240
  2. package/_generated/cssFabric.vars.json +13 -0
  3. package/{src/_generated → _generated}/export.variables.md +0 -0
  4. package/{src/_generated → _generated}/index.d.ts +0 -0
  5. package/{src/_generated → _generated}/readme.md +0 -0
  6. package/init/importCssVars.d.ts +1 -0
  7. package/init/importCssVars.js +2 -0
  8. package/package.json +113 -69
  9. package/{lib/scripts → scripts}/cssfabric.d.ts +0 -0
  10. package/scripts/cssfabric.js +43 -0
  11. package/{lib/scripts → scripts}/cssfabricClassNames.d.ts +0 -0
  12. package/{lib/scripts → scripts}/cssfabricClassNames.js +5 -9
  13. package/{src/scripts → scripts}/index.d.ts +0 -0
  14. package/scripts/index.js +4 -0
  15. package/{lib/scripts → scripts}/utils.d.ts +0 -0
  16. package/{lib/scripts → scripts}/utils.js +1 -3
  17. package/{lib/styles/core → styles}/animation/animation.css +0 -0
  18. package/{lib/styles/core → styles}/animation/animation.min.css +0 -0
  19. package/{lib/styles/core → styles}/base/base.css +0 -7
  20. package/styles/base/base.min.css +1 -0
  21. package/{lib/styles/core → styles}/box/box.css +127 -111
  22. package/styles/box/box.min.css +1 -0
  23. package/{lib/styles/core → styles}/box/box.responsive.css +508 -444
  24. package/styles/box/box.responsive.min.css +1 -0
  25. package/{lib/styles/core → styles}/color/color.css +0 -0
  26. package/styles/color/color.min.css +1 -0
  27. package/{lib/styles/core → styles}/color/color.responsive.css +0 -0
  28. package/styles/color/color.responsive.min.css +1 -0
  29. package/styles/cssfabric.css +61792 -0
  30. package/styles/cssfabric.min.css +168 -0
  31. package/styles/cssfabric.responsive.css +200596 -0
  32. package/styles/cssfabric.responsive.min.css +108 -0
  33. package/{lib/styles/core → styles}/flex/flex.css +0 -0
  34. package/styles/flex/flex.min.css +1 -0
  35. package/{lib/styles/core → styles}/flex/flex.responsive.css +0 -0
  36. package/styles/flex/flex.responsive.min.css +1 -0
  37. package/{lib/styles/core → styles}/grid/grid.css +0 -0
  38. package/styles/grid/grid.min.css +1 -0
  39. package/{lib/styles/core → styles}/grid/grid.responsive.css +0 -0
  40. package/styles/grid/grid.responsive.min.css +1 -0
  41. package/{lib/styles/core → styles}/menu/menu.css +16 -12
  42. package/styles/menu/menu.min.css +1 -0
  43. package/{lib/styles/core → styles}/menu/menu.responsive.css +64 -48
  44. package/styles/menu/menu.responsive.min.css +1 -0
  45. package/{lib/styles/core → styles}/overflow/overflow.css +0 -0
  46. package/{lib/styles/core → styles}/overflow/overflow.min.css +0 -0
  47. package/{lib/styles/core → styles}/overflow/overflow.responsive.css +0 -0
  48. package/styles/overflow/overflow.responsive.min.css +1 -0
  49. package/{lib/styles/core → styles}/scale/scale.css +0 -0
  50. package/{lib/styles/core → styles}/scale/scale.min.css +0 -0
  51. package/{lib/styles/core → styles}/scale/scale.responsive.css +0 -0
  52. package/styles/scale/scale.responsive.min.css +1 -0
  53. package/{lib/styles/core → styles}/table/table.css +0 -0
  54. package/styles/table/table.min.css +1 -0
  55. package/{lib/styles/core → styles}/table/table.responsive.css +0 -0
  56. package/styles/table/table.responsive.min.css +1 -0
  57. package/{lib/styles/core → styles}/text/text.css +0 -0
  58. package/styles/text/text.min.css +1 -0
  59. package/{lib/styles/core → styles}/text/text.responsive.css +0 -0
  60. package/styles/text/text.responsive.min.css +1 -0
  61. package/{lib/styles/core → styles}/theme/theme.css +0 -0
  62. package/{lib/styles/core → styles}/theme/theme.min.css +0 -0
  63. package/{lib/styles/core → styles}/vars.css +6 -2
  64. package/styles/vars.min.css +1 -0
  65. package/{lib/styles/core → styles}/zindex/zindex.css +0 -0
  66. package/{lib/styles/core → styles}/zindex/zindex.min.css +0 -0
  67. package/.idea/cssfabric.iml +0 -8
  68. package/.idea/misc.xml +0 -9
  69. package/.idea/modules.xml +0 -8
  70. package/.idea/vcs.xml +0 -6
  71. package/.vscode/settings.json +0 -24
  72. package/bin/index.js +0 -7
  73. package/cssfabric.config.js +0 -3
  74. package/cssfabric.json +0 -8
  75. package/gulpfile.js +0 -598
  76. package/lib/_generated/export.variables.json +0 -583
  77. package/lib/index.d.ts +0 -2
  78. package/lib/index.js +0 -7
  79. package/lib/scripts/cssfabric.js +0 -48
  80. package/lib/scripts/index.d.ts +0 -2
  81. package/lib/scripts/index.js +0 -6
  82. package/lib/styles/core/base/base.min.css +0 -1
  83. package/lib/styles/core/box/box.min.css +0 -1
  84. package/lib/styles/core/box/box.responsive.min.css +0 -1
  85. package/lib/styles/core/color/color.min.css +0 -1
  86. package/lib/styles/core/color/color.responsive.min.css +0 -1
  87. package/lib/styles/core/flex/flex.min.css +0 -1
  88. package/lib/styles/core/flex/flex.responsive.min.css +0 -1
  89. package/lib/styles/core/grid/grid.min.css +0 -1
  90. package/lib/styles/core/grid/grid.responsive.min.css +0 -1
  91. package/lib/styles/core/main.min.css +0 -1
  92. package/lib/styles/core/menu/menu.min.css +0 -1
  93. package/lib/styles/core/menu/menu.responsive.min.css +0 -1
  94. package/lib/styles/core/overflow/overflow.responsive.min.css +0 -1
  95. package/lib/styles/core/scale/scale.responsive.min.css +0 -1
  96. package/lib/styles/core/table/table.min.css +0 -1
  97. package/lib/styles/core/table/table.responsive.min.css +0 -1
  98. package/lib/styles/core/text/text.min.css +0 -1
  99. package/lib/styles/core/text/text.responsive.min.css +0 -1
  100. package/lib/styles/core/vars.min.css +0 -1
  101. package/lib/styles/core/vars2.css +0 -4
  102. package/lib/styles/core/vars2.min.css +0 -1
  103. package/lib/styles/cssfabric.css +0 -5147
  104. package/lib/styles/cssfabric.min.css +0 -16
  105. package/lib/styles/cssfabric.responsive.css +0 -16679
  106. package/lib/styles/cssfabric.responsive.min.css +0 -9
  107. package/src/_generated/export.variables.json +0 -759
  108. package/src/cssfabric/_utils.scss +0 -203
  109. package/src/cssfabric/index.d.ts +0 -3
  110. package/src/cssfabric/modules/_cssfabric-config.scss +0 -163
  111. package/src/cssfabric/modules/_mixins.scss +0 -1
  112. package/src/cssfabric/modules/animation/_animation-vars.scss +0 -17
  113. package/src/cssfabric/modules/animation/animation.scss +0 -3
  114. package/src/cssfabric/modules/base/_base-vars.scss +0 -19
  115. package/src/cssfabric/modules/base/base.scss +0 -80
  116. package/src/cssfabric/modules/box/_box-build.scss +0 -287
  117. package/src/cssfabric/modules/box/_box-vars.scss +0 -121
  118. package/src/cssfabric/modules/box/box-responsive.scss +0 -18
  119. package/src/cssfabric/modules/box/box.scss +0 -3
  120. package/src/cssfabric/modules/color/_color-build.scss +0 -196
  121. package/src/cssfabric/modules/color/_color-vars.scss +0 -80
  122. package/src/cssfabric/modules/color/color-responsive.scss +0 -23
  123. package/src/cssfabric/modules/color/color.scss +0 -9
  124. package/src/cssfabric/modules/css-fabric.scss +0 -2
  125. package/src/cssfabric/modules/flex/_flex-build.scss +0 -150
  126. package/src/cssfabric/modules/flex/_flex-vars.scss +0 -84
  127. package/src/cssfabric/modules/flex/flex-responsive.scss +0 -25
  128. package/src/cssfabric/modules/flex/flex.scss +0 -3
  129. package/src/cssfabric/modules/grid/_grid-build.scss +0 -84
  130. package/src/cssfabric/modules/grid/_grid-vars.scss +0 -88
  131. package/src/cssfabric/modules/grid/grid-responsive.scss +0 -25
  132. package/src/cssfabric/modules/grid/grid.scss +0 -6
  133. package/src/cssfabric/modules/menu/_menu-build.scss +0 -119
  134. package/src/cssfabric/modules/menu/_menu-vars.scss +0 -29
  135. package/src/cssfabric/modules/menu/menu-responsive.scss +0 -19
  136. package/src/cssfabric/modules/menu/menu.scss +0 -6
  137. package/src/cssfabric/modules/overflow/_overflow-build.scss +0 -22
  138. package/src/cssfabric/modules/overflow/_overflow-vars.scss +0 -31
  139. package/src/cssfabric/modules/overflow/overflow-responsive.scss +0 -25
  140. package/src/cssfabric/modules/overflow/overflow.scss +0 -7
  141. package/src/cssfabric/modules/scale/_scale-build.scss +0 -142
  142. package/src/cssfabric/modules/scale/_scale-vars.scss +0 -84
  143. package/src/cssfabric/modules/scale/scale-responsive.scss +0 -23
  144. package/src/cssfabric/modules/scale/scale.scss +0 -8
  145. package/src/cssfabric/modules/table/_table-build.scss +0 -134
  146. package/src/cssfabric/modules/table/_table-vars.scss +0 -30
  147. package/src/cssfabric/modules/table/table-responsive.scss +0 -24
  148. package/src/cssfabric/modules/table/table.scss +0 -8
  149. package/src/cssfabric/modules/text/_text-build.scss +0 -166
  150. package/src/cssfabric/modules/text/_text-vars.scss +0 -87
  151. package/src/cssfabric/modules/text/text-responsive.scss +0 -26
  152. package/src/cssfabric/modules/text/text.scss +0 -6
  153. package/src/cssfabric/modules/theme/_theme-build.scss +0 -90
  154. package/src/cssfabric/modules/theme/_theme-vars.scss +0 -46
  155. package/src/cssfabric/modules/theme/theme.scss +0 -6
  156. package/src/cssfabric/modules/vars.scss +0 -49
  157. package/src/cssfabric/modules/zindex/_zindex-vars.scss +0 -14
  158. package/src/cssfabric/modules/zindex/zindex.scss +0 -15
  159. package/src/index.d.ts +0 -3
  160. package/src/index.ts +0 -4
  161. package/src/scripts/cssfabric.ts +0 -54
  162. package/src/scripts/cssfabricClassNames.ts +0 -216
  163. package/src/scripts/index.ts +0 -8
  164. package/src/scripts/utils.ts +0 -37
  165. package/src/vendor/index.d.ts +0 -3
  166. package/src/vendor/normalize/normalize.min.css +0 -2
  167. package/src/vendor/sass-json-export/CHANGELOG.md +0 -26
  168. package/src/vendor/sass-json-export/Gruntfile.js +0 -60
  169. package/src/vendor/sass-json-export/LICENSE +0 -20
  170. package/src/vendor/sass-json-export/README.md +0 -90
  171. package/src/vendor/sass-json-export/package.json +0 -60
  172. package/src/vendor/sass-json-export/stylesheets/encode/api/_json.scss +0 -26
  173. package/src/vendor/sass-json-export/stylesheets/encode/encode.scss +0 -17
  174. package/src/vendor/sass-json-export/stylesheets/encode/helpers/_quote.scss +0 -9
  175. package/src/vendor/sass-json-export/stylesheets/encode/mixins/_json.scss +0 -42
  176. package/src/vendor/sass-json-export/stylesheets/encode/types/_bool.scss +0 -7
  177. package/src/vendor/sass-json-export/stylesheets/encode/types/_color.scss +0 -8
  178. package/src/vendor/sass-json-export/stylesheets/encode/types/_list.scss +0 -14
  179. package/src/vendor/sass-json-export/stylesheets/encode/types/_map.scss +0 -15
  180. package/src/vendor/sass-json-export/stylesheets/encode/types/_null.scss +0 -7
  181. package/src/vendor/sass-json-export/stylesheets/encode/types/_number.scss +0 -8
  182. package/src/vendor/sass-json-export/stylesheets/encode/types/_string.scss +0 -8
  183. package/src/vendor/sass-json-export/stylesheets/sass-json-export.scss +0 -2
  184. package/src/vendor/sass-json-export/test/encode/_index.scss +0 -14
  185. package/src/vendor/sass-json-export/test/encode/api/_json.scss +0 -29
  186. package/src/vendor/sass-json-export/test/encode/helpers/_quote.scss +0 -6
  187. package/src/vendor/sass-json-export/test/encode/types/_bool.scss +0 -6
  188. package/src/vendor/sass-json-export/test/encode/types/_color.scss +0 -7
  189. package/src/vendor/sass-json-export/test/encode/types/_list.scss +0 -25
  190. package/src/vendor/sass-json-export/test/encode/types/_map.scss +0 -17
  191. package/src/vendor/sass-json-export/test/encode/types/_null.scss +0 -8
  192. package/src/vendor/sass-json-export/test/encode/types/_number.scss +0 -68
  193. package/src/vendor/sass-json-export/test/encode/types/_string.scss +0 -9
  194. package/src/vendor/sass-json-export/test/test.scss +0 -9
  195. package/tsconfig.json +0 -46
  196. package/webpack.config.js +0 -55
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="inheritedJdk" />
6
- <orderEntry type="sourceFolder" forTests="false" />
7
- </component>
8
- </module>
package/.idea/misc.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="ES6" />
5
- </component>
6
- <component name="WebPackConfiguration">
7
- <option name="mode" value="DISABLED" />
8
- </component>
9
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/cssfabric.iml" filepath="$PROJECT_DIR$/.idea/cssfabric.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,24 +0,0 @@
1
- {
2
- "githubIssues.queries": [
3
-
4
- {
5
- "label": "My Issues",
6
- "query": "default"
7
- },
8
- {
9
- "label": "Created Issues",
10
- "query": "author:${user} state:open repo:${owner}/${repository} sort:created-desc"
11
- },
12
- {
13
- "label": "Closed Issues",
14
- "query": "author:${user} state:close repo:${owner}/${repository} sort:created-desc"
15
- }
16
- ],
17
- "githubIssues.createInsertFormat": "url",
18
- "githubIssues.useBranchForIssues": "prompt",
19
- "cSpell.words": [
20
- "config",
21
- "cssfabric",
22
- "zindex"
23
- ]
24
- }
package/bin/index.js DELETED
@@ -1,7 +0,0 @@
1
- #! /usr/bin/env node
2
-
3
- const fsx = require('fs-extra');
4
-
5
- let createDir = './cssfabric/cssfabric.scss';
6
-
7
- fsx.ensureFile(createDir);
@@ -1,3 +0,0 @@
1
-
2
-
3
- module.exports = {}
package/cssfabric.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "fabricRootDir": "./src/cssfabric",
3
- "fabricConfDir": "./src/cssfabric/_config",
4
- "fabricModuleDir": "./src/cssfabric/modules",
5
- "fabricGeneratedDir": "./src/_generated",
6
- "fabricJsonExportFile": "export.variables.json",
7
- "fabricStylesDir": "./lib/styles"
8
- }
package/gulpfile.js DELETED
@@ -1,598 +0,0 @@
1
- // ## WIP
2
-
3
- const gulp = require("gulp"),
4
- jsonTransform = require("gulp-json-transform"),
5
- cache = require("gulp-cached"),
6
- gulpSass = require("gulp-sass"),
7
- gulFileList = require("gulp-filelist"),
8
- minifyCss = require("gulp-minify-css"),
9
- fs = require("fs"),
10
- gulpRename = require("gulp-rename"),
11
- gulpDownload = require("gulp-download-stream"),
12
- gulpConcat = require("gulp-concat-util"),
13
- gulpJsBeautifier = require('gulp-jsbeautifier'),
14
- modifyFile = require("gulp-modify-file"),
15
- json2md = require("json2md"),
16
- gulpIgnore = require("gulp-ignore");
17
-
18
-
19
- gulpSass.compiler = require("sass");
20
-
21
- const fabricConfig = require("./cssfabric.json");
22
-
23
- const {
24
- fabricRootDir,
25
- fabricStylesDir,
26
- fabricConfDir,
27
- fabricModuleDir,
28
- fabricGeneratedDir,
29
- } = fabricConfig;
30
-
31
- const doFabric = {
32
- /**
33
- * build readme fragment from _generated json file
34
- * @param file_content
35
- * @param file_info
36
- * @returns {{}}
37
- */
38
- fabricReadmeFile: (file_content, file_info) => {
39
- // name of the module, from path
40
- const fileContent = file_content || {}
41
- const moduleList = fileContent?.cssfabric?.modules;
42
-
43
- let out = [];
44
- const content = [];
45
- const docContent = [];
46
-
47
- const table = {headers: ["modules", ""]};
48
- const rows = [];
49
-
50
- const labelIn = "<span style='width:80px;display:inline-block;overflow:visible'><b>";
51
- const labelOut = "</b></span>";
52
-
53
- const labelNestedIn = "<span style='margin-left:20px;width:80px;display:inline-block;overflow:visible'>- ";
54
- const labelNestedOut = "</span>";
55
-
56
- const eol = '<br>&nbsp;&nbsp;-&nbsp;&nbsp;';
57
-
58
- out.push({h1: "Welcome to cssfabric"});
59
- out.push({p: "Willing to bring my utility-first 2011 css framework to a more decent life !"});
60
- out.push({p: "This is also a learning point about gulp, webpack, packages and friends."});
61
- out.push({blockquote: "yaocf !"});
62
- out.push({p: "<br/>"});
63
- out.push({h2: "Incoming features"});
64
- out.push({p: "<br/>"});
65
-
66
- Object.keys(moduleList).forEach((moduleListKey, moduleListIndex, a) => {
67
- const moduleListValue = moduleList[moduleListKey];
68
-
69
- let title = moduleListValue?._metadata?.title;
70
- let description = moduleListValue?._metadata?.description;
71
- let docs = moduleListValue?._docs || {};
72
-
73
- let config = Object.keys(moduleListValue?._data);
74
- let cssProps = config?.cssProps;
75
- let collect;
76
- let collectContentList;
77
- let nestedLevels;
78
-
79
-
80
- if (docs?.attributes) {
81
-
82
- docContent.push({hr: ''});
83
- docContent.push({h4: `<strong>module ${title}</strong>`});
84
-
85
-
86
- Object.keys(docs.attributes).forEach((attributeCode) => {
87
-
88
- collectContentList = [];
89
- collect = {};
90
- nestedLevels = [];
91
-
92
- const attributeValue = docs.attributes[attributeCode];
93
- // looking for tag
94
-
95
- if (typeof attributeValue === "object" && !Array.isArray(attributeValue)) {
96
- collect.title = `[${attributeCode}]`;
97
- // si tag
98
- if (attributeValue?.tag) {
99
- collect.tag = `${labelIn}shorthand${labelOut}: ${attributeValue.tag}`;
100
- }
101
- // si about
102
- if (attributeValue?.about) {
103
- collect.about = `- ${attributeValue.about}`;
104
- }
105
- // si keys
106
- if (attributeValue?.keys) {
107
- console.log(title,'keys isArrayOfType ', isArrayOfType(attributeValue.keys))
108
- switch (isArrayOfType(attributeValue.keys)) {
109
- case "strings":
110
- case "numbers":
111
- collect.keys = `${labelIn}keys${labelOut}: ${attributeValue.keys.join('&nbsp;&nbsp;')}`;
112
- break;
113
- case "arrays":
114
- collect.keys = `${labelIn}keys${labelOut}:${eol}` + attributeValue.keys.map((x) => x.join('&nbsp;&nbsp;')).join(eol)
115
- break;
116
- case "objects":
117
- break;
118
- }
119
- }
120
- // si levels
121
- if (attributeValue?.levels) {
122
- // si typeof level array => array of string or of arrays
123
- if (Array.isArray(attributeValue.levels)) {
124
- // if [][]
125
- console.log(title,'levels isArrayOfType ', isArrayOfType(attributeValue.levels))
126
- switch (isArrayOfType(attributeValue.levels)) {
127
- case "strings":
128
- case "numbers":
129
- collect.levels = `${labelIn}levels${labelOut}: ${eol}${attributeValue.levels.join('&nbsp;&nbsp;')}`;
130
- break;
131
- case "arrays":
132
- collect.levels = `${labelIn}levels${labelOut}:${eol}` + attributeValue.levels.map((x) => x.join('&nbsp;&nbsp;')).join(eol)
133
- break;
134
-
135
- }
136
-
137
- // if {}[] ..... ?
138
- if (attributeValue.levels.every(x => typeof x === 'object' && !Array.isArray(x))) {
139
- collect.levels = `${labelIn}levels${labelOut}: ${eol}${attributeValue.levels.map((x) => x.join('&nbsp;&nbsp;')).join(eol)}`;
140
- }
141
-
142
- }
143
- // si typeof level object
144
- if (!Array.isArray(attributeValue.levels) && typeof (attributeValue.levels === "object")) {
145
- nestedLevels.push(`${labelIn}level keys${labelOut}:`);
146
- Object.keys(attributeValue.levels).forEach((levelKey) => {
147
- let levelValue = attributeValue.levels[levelKey].join('&nbsp;&nbsp;&nbsp;&nbsp;')
148
- // console.log(levelValue)
149
- nestedLevels.push(`${labelNestedIn}${levelKey}${labelNestedOut}: ${levelValue}`);
150
- })
151
- // [].concat(...arr));
152
- }
153
- }
154
- }
155
-
156
- if (collect.title) docContent.push({h4: collect.title});
157
- if (collect.about) docContent.push({"p": collect.about});
158
-
159
- if (collect.tag) collectContentList.push(collect.tag);
160
- if (collect.keys) collectContentList.push(collect.keys);
161
- if (collect.levels) collectContentList.push(collect.levels);
162
-
163
- if (nestedLevels && nestedLevels.length) collectContentList.push(nestedLevels.join('<br/>'));
164
-
165
- docContent.push({"ul": collectContentList});
166
-
167
- // docContent.push({"p": "<br/>"}) ;
168
-
169
- });
170
- //docContent.push({p: '<br/><br/>'});
171
-
172
- }
173
-
174
- rows.push([title, description]);
175
-
176
- });
177
-
178
- function isArrayOfType(arr) {
179
- let ret = '';
180
-
181
- if(!Array.isArray(arr)){
182
- console.log(Array.isArray(arr),{arr})
183
- }
184
- if (arr.every(x => Array.isArray(x))) ret = 'arrays'
185
- if (arr.every(x => typeof x === 'string')) ret = 'strings'
186
- if (arr.every(x => typeof x === 'number')) ret = 'numbers'
187
- if (arr.every(x => typeof x === 'object' && !Array.isArray(x))) ret = 'objects'
188
-
189
- return ret;
190
- }
191
-
192
- console.log({docContent});
193
-
194
-
195
- table.rows = rows;
196
-
197
- out.push({table: table})
198
- out.push({p: "<br/>"});
199
- out.push({ul: content});
200
- out.push({p: "<br/>"});
201
- out.push({h3: "More details"});
202
- out = out.concat(docContent);
203
-
204
- return json2md(out);
205
- },
206
-
207
- /**
208
- * transform scss to json file with all modules variables
209
- * @param file
210
- * @returns {string}
211
- */
212
- fabricSassToJson: (file) => {
213
- let {file_content, file_info} = file;
214
-
215
- let obj;
216
- obj = file_content.obj;
217
- obj = obj.split("|").filter(n => n);
218
-
219
- const redPath = "";
220
- const redModulePath = fabricModuleDir + "/";
221
-
222
- let header = '';
223
- let footer = '';
224
-
225
- let importExport = `@import "./src/${redPath}vendor/sass-json-export/stylesheets/sass-json-export.scss";`;
226
-
227
-
228
- Object.values(obj).forEach((v, k, a) => {
229
- let module_path = redModulePath + v;
230
- let module_name = v
231
- .replace("_", "")
232
- .split("/")
233
- ?.pop()
234
- .split(".")?.[0]
235
- .replace("-vars", "");
236
-
237
- if (v) {
238
- header += makeHeader(module_path, module_name);
239
- footer += makeFooter(module_name);
240
- }
241
- });
242
-
243
- // return ""
244
-
245
- let out = header;
246
- out += "\r\n" + importExport + "\r\n";
247
- out += footer;
248
-
249
- function makeHeader(path, module_name) {
250
- // form is module-vars.$module-config
251
- return '@use "' + path + '.scss" as ' + module_name + "; \r\n";
252
- }
253
-
254
- function makeFooter(module_name) {
255
- // form is module.$module-(config|*)
256
- let out1 = ` ( _data: ${module_name}.$${module_name}-config , _metadata :${module_name}.$${module_name}-metadata , _docs :${module_name}.$${module_name}-docs )`;
257
-
258
- return (
259
- "@include json-encode(" + out1 + ",comment," + module_name + ");\r\n"
260
- );
261
- }
262
-
263
-
264
- return out;
265
- },
266
- // todo use regexp
267
- fabricCssVarExportFile: (filePath) => {
268
- let module_path = filePath
269
- .split("modules/")[1]
270
- .replace("modules", "")
271
- .replace(".scss", "");
272
-
273
- let module_filename = filePath
274
- .substring(filePath.lastIndexOf("/"))
275
- .replace(".scss", "")
276
- .replace("/", "");
277
-
278
- let module_name = filePath
279
- .substring(filePath.lastIndexOf("/_"))
280
- .replace(".scss", "")
281
- .replace("-vars", "")
282
- .replace("_", "")
283
- .replace("/", "");
284
-
285
- return `|{"module_path" : "${module_path}","module_filename" : "${module_filename}","module_name" : "${module_name}"}`;
286
- }
287
- }
288
-
289
-
290
- function fabricVarExportFile(filePath) {
291
- // name of the module, from path
292
- let module_name = filePath
293
- .substring(filePath.lastIndexOf("modules/"))
294
- .split("\\")
295
- ?.pop()
296
- .split(".")?.[0]
297
- .replace("modules/", "");
298
-
299
- return module_name + "|";
300
- }
301
-
302
-
303
- // exports sass maps to json
304
- function task_cssVarsExport(cb) {
305
- let sourceFiles = fabricModuleDir + "/**/_*-vars.scss";
306
- gulp
307
- .src(sourceFiles)
308
- .pipe(
309
- gulFileList("cssfabric-vars.css", {
310
- destRowTemplate: doFabric.fabricCssVarExportFile,
311
- removeExtensions: false,
312
- })
313
- )
314
- .pipe(
315
- modifyFile((content, path, file) => {
316
- let exp = content.split("|"); // JSON.parse()
317
- let header = '';
318
- let footer = "";
319
-
320
- let utils = `@use '${fabricRootDir}/utils' as utils;` + "\r\n";
321
- const openVarTag = ":root{";
322
- const closeVarTag = "}";
323
-
324
- Object.values(exp).forEach((v, k, a) => {
325
- if (v) {
326
- moduleConf = JSON.parse(v);
327
-
328
- if (moduleConf) {
329
- header +=
330
- `@use '${fabricModuleDir}/${moduleConf.module_path}' as ${moduleConf.module_name};` +
331
- "\r\n";
332
- footer +=
333
- `@include utils.scssVarsToCssVars(${moduleConf.module_name},${moduleConf.module_name}.$${moduleConf.module_name}-config);` +
334
- "\r\n";
335
- }
336
- }
337
- });
338
-
339
- const out = utils + header + openVarTag + footer + closeVarTag;
340
-
341
- return out;
342
- })
343
- )
344
- .pipe(gulpSass({outputStyle: "expanded", includePaths: [fabricModuleDir]}).on("error", gulpSass.logError))
345
- .pipe(gulp.dest(fabricStylesDir))
346
- .on("end", () => {
347
- return cb();
348
- });
349
- }
350
-
351
- // exports sass maps to json
352
- function task_varsExport(cb) {
353
- let sourceFiles = fabricModuleDir + "/**/_*-vars.scss";
354
-
355
- gulp
356
- .src(sourceFiles)
357
- //.pipe(cache(task_varsExport))
358
- .pipe(
359
- gulFileList("ghost", {
360
- destRowTemplate: fabricVarExportFile,
361
- removeExtensions: false,
362
- })
363
- )
364
- .pipe(gulpConcat("export-variables.try"))
365
- .pipe(gulpConcat.header('{"obj":"'))
366
- .pipe(gulpConcat.footer('"}'))
367
- .pipe(
368
- jsonTransform(function (file_content, file_info) {
369
- return doFabric.fabricSassToJson({file_content: file_content, file_info});
370
- })
371
- )
372
- .pipe(cache(task_varsExport))
373
- // .pipe(sass().on('error', sass.logError))
374
- .pipe(gulpSass({outputStyle: "expanded"}).on("error", gulpSass.logError))
375
- .pipe(
376
- modifyFile((content, path, file) => {
377
- const start = '{"cssfabric":{"modules":{';
378
- const end = " }}}";
379
-
380
- const regexIn = /\/\*\! json-encode: {/gm;
381
- const regexOut = /} \*\//gm;
382
-
383
- let exp = content
384
- .replace(regexIn, "")
385
- .replace(regexOut, ",")
386
- .replace(/,\s*$/, "");
387
-
388
- return `${start}${exp}${end}`;
389
- })
390
- )
391
- .pipe(gulpJsBeautifier())
392
- .pipe(
393
- gulpRename(function (path) {
394
- path.dirname = path.dirname;
395
- path.extname = ".json";
396
- path.basename = path.basename.replace("-", ".");
397
- })
398
- )
399
- .pipe(gulp.dest(fabricGeneratedDir))
400
- .on("end", () => {
401
- return cb();
402
- });
403
-
404
- return cb();
405
- }
406
-
407
- function task_readme(cb) {
408
- gulp
409
- .src(fabricGeneratedDir + "/*.json")
410
- .pipe(
411
- jsonTransform(function (file_content, file_info) {
412
- return doFabric.fabricReadmeFile(file_content, file_info);
413
- })
414
- )
415
- .pipe(
416
- gulpRename(function (path) {
417
- path.dirname = path.dirname;
418
- path.extname = ".md";
419
- path.basename = path.basename.replace("-", ".");
420
- })
421
- )
422
- .pipe(gulp.dest(fabricGeneratedDir))
423
- .on("end", () => {
424
- return cb();
425
- });
426
- }
427
-
428
- /**
429
- * concatenate css files
430
- * by min | responsive | ...
431
- *
432
- * @param {function} cb gulp callback
433
- */
434
- function task_mergeInclude(cb) {
435
- //
436
- const dest = fabricStylesDir;
437
- const dir = fabricStylesDir + "/core";
438
-
439
- const steps = [];
440
- // normal stylesheets
441
- steps.push(
442
- gulp
443
- .src([
444
- `${dir}/**/*.css`,
445
- `!${dir}/**/*responsive*.css`,
446
- `!${dir}/**/*min*.css`,
447
- ])
448
- .pipe(gulpConcat("cssfabric.css"))
449
- .pipe(gulpConcat.header("/** Merged by Mydde */"))
450
- .pipe(cache(task_mergeInclude))
451
- .pipe(gulp.dest(dest))
452
- .on("end", () => {
453
- return cb();
454
- })
455
- );
456
-
457
- // normal minified stylesheets
458
- steps.push(
459
- gulp
460
- .src([`${dir}/**/*min.css`, `!${dir}/**/*responsive*.css`])
461
- .pipe(gulpConcat("cssfabric.min.css"))
462
- .pipe(cache(task_mergeInclude))
463
- .pipe(gulp.dest(dest))
464
- .on("end", () => {
465
- return cb();
466
- })
467
- );
468
-
469
- // responsive stylesheets
470
- steps.push(
471
- gulp
472
- .src([`${dir}/**/*responsive.css`, `!${dir}/**/*min..css`])
473
- .pipe(gulpConcat("cssfabric.responsive.css"))
474
- .pipe(cache(task_mergeInclude))
475
- .pipe(gulp.dest(dest))
476
- .on("end", () => {
477
- return cb();
478
- })
479
- );
480
-
481
- // responsive minified stylesheets
482
- steps.push(
483
- gulp
484
- .src([`${dir}/**/*responsive.min.css`])
485
- .pipe(gulpConcat("cssfabric.responsive.min.css"))
486
- .pipe(cache(task_mergeInclude))
487
- .pipe(gulp.dest(dest))
488
- .on("end", () => {
489
- return cb();
490
- })
491
- );
492
-
493
- return [...steps];
494
- }
495
-
496
- /**
497
- * task_sass2css
498
- * transform scss to css
499
- * store files in /lib
500
- *
501
- * rename *-responsive to *.responsive, because not dot in sass file
502
- *
503
- * @param {function} cb
504
- * @returns function
505
- */
506
- function task_sass2css(cb) {
507
- return (
508
- gulp
509
- .src(`${fabricModuleDir}/**/*.scss`)
510
- .pipe(gulpIgnore.exclude("**/*css-fabric*"))
511
- .pipe(
512
- gulpRename(function (path) {
513
- /*path.dirname = path.dirname;
514
- path.extname = path.extname;*/
515
- path.basename = path.basename.replace("-", ".");
516
- })
517
- )
518
- // to css and to /core
519
- .pipe(
520
- gulpSass({outputStyle: "expanded"}).on("error", gulpSass.logError)
521
- )
522
- .pipe(gulp.dest(`${fabricStylesDir}/core`))
523
- // to css and minify and to /core
524
- .pipe(
525
- minifyCss({
526
- keepSpecialComments: 0,
527
- })
528
- )
529
- .pipe(
530
- gulpRename(function (path) {
531
- /*path.dirname = path.dirname;*/
532
- path.extname = ".min.css";
533
- path.basename = path.basename.replace("-", ".");
534
- })
535
- )
536
- .pipe(gulp.dest(`${fabricStylesDir}/core`))
537
- .on("end", () => {
538
- return cb();
539
- })
540
- );
541
- }
542
-
543
- function taskDownload(cb) {
544
- return gulpDownload(
545
- "https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
546
- )
547
- .pipe(gulp.dest("./src/vendor/normalize/"))
548
- .on("end", () => {
549
- return cb();
550
- });
551
- }
552
-
553
- function watchSassTask(cb) {
554
- gulp.watch(
555
- fabricModuleDir + "/**/*.scss",
556
- gulp.series(task_sass2css, task_mergeInclude, task_varsExport)
557
- );
558
- cb();
559
- }
560
-
561
- // todo change to styleDir
562
- function watchInclude(cb) {
563
-
564
- cb();
565
- }
566
-
567
- function watchReadme(cb) {
568
- gulp.watch(
569
- [fabricModuleDir, "!" + fabricModuleDir + "/**/_*.scss"],
570
- task_readme
571
- );
572
-
573
- cb();
574
- }
575
-
576
- function watchExportVars(cb) {
577
- gulp.watch(fabricRootDir, gulp.series(task_varsExport));
578
-
579
- cb();
580
- }
581
-
582
- function watchCssExportVars(cb) {
583
- gulp.watch(fabricModuleDir, gulp.series(task_cssVarsExport));
584
-
585
- cb();
586
- }
587
-
588
- // only one called by npm
589
- exports.watchSass = watchSassTask;
590
-
591
- exports.watchInclude = watchInclude;
592
- exports.watchReadme = watchReadme;
593
- exports.watchExportVars = watchExportVars;
594
-
595
- exports.watchCssExport = watchCssExportVars;
596
-
597
- exports.taskDownload = taskDownload;
598
- exports.task_readme = task_readme;