@medyll/cssfabric 0.2.0 → 0.2.3

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 (211) hide show
  1. package/.github/workflows/main.yml +33 -0
  2. package/.idea/cssfabric.iml +11 -0
  3. package/.idea/misc.xml +9 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/.vscode/settings.json +24 -0
  7. package/bin/index.js +8 -0
  8. package/cssfabric.sass.js +8 -0
  9. package/gulpfile.js +532 -0
  10. package/package.json +17 -61
  11. package/src/app.css +107 -0
  12. package/src/app.d.ts +15 -0
  13. package/src/app.html +13 -0
  14. package/src/components/Header.svelte +17 -0
  15. package/src/components/HeaderSiteTitle.svelte +12 -0
  16. package/src/components/InnerMenu.svelte +27 -0
  17. package/src/components/SubHeader.svelte +10 -0
  18. package/src/components/SubHeaderH.svelte +3 -0
  19. package/src/components/SubSubHeader.svelte +22 -0
  20. package/src/components/demo/DemoElement.svelte +86 -0
  21. package/src/components/demo/elements/DemoElementBackgroundColor.svelte +7 -0
  22. package/src/components/demo/elements/DemoElementBorder.svelte +8 -0
  23. package/src/components/demo/elements/DemoElementBorderColor.svelte +8 -0
  24. package/src/components/demo/elements/DemoElementColor.svelte +8 -0
  25. package/src/components/demo/elements/DemoElementGrid.svelte +53 -0
  26. package/src/components/demo/elements/DemoElementMargin.svelte +8 -0
  27. package/src/components/demo/elements/DemoElementPadding.svelte +10 -0
  28. package/src/components/demo/elements/DemoElementScale.svelte +9 -0
  29. package/src/components/demo/elements/DemoElementTable.svelte +34 -0
  30. package/src/components/demo/elements/DemoElementText.svelte +10 -0
  31. package/src/components/demo/proxy/ProxyDsp.svelte +12 -0
  32. package/src/components/demo/proxy/ProxyDspArray.svelte +19 -0
  33. package/src/components/demo/proxy/ProxyDspObject.svelte +17 -0
  34. package/src/components/docs/Docs.svelte +97 -0
  35. package/src/components/docs/DocsClassNames.svelte +34 -0
  36. package/src/components/docs/DocsDemo.svelte +84 -0
  37. package/src/components/header/Header.svelte +105 -0
  38. package/src/components/header/svelte-logo.svg +1 -0
  39. package/src/cssfabric/_utils.scss +203 -0
  40. package/{_generated → src/cssfabric}/index.d.ts +0 -0
  41. package/src/cssfabric/modules/_cssfabric-config.scss +173 -0
  42. package/src/cssfabric/modules/_mixins.scss +1 -0
  43. package/src/cssfabric/modules/animation/_animation-vars.scss +17 -0
  44. package/src/cssfabric/modules/animation/animation.scss +3 -0
  45. package/src/cssfabric/modules/base/_base-vars.scss +19 -0
  46. package/src/cssfabric/modules/base/base.scss +75 -0
  47. package/src/cssfabric/modules/box/_box-build.scss +304 -0
  48. package/src/cssfabric/modules/box/_box-vars.scss +121 -0
  49. package/src/cssfabric/modules/box/box-responsive.scss +18 -0
  50. package/src/cssfabric/modules/box/box.scss +3 -0
  51. package/src/cssfabric/modules/color/_color-build.scss +196 -0
  52. package/src/cssfabric/modules/color/_color-vars.scss +80 -0
  53. package/src/cssfabric/modules/color/color-responsive.scss +23 -0
  54. package/src/cssfabric/modules/color/color.scss +9 -0
  55. package/src/cssfabric/modules/css-fabric.scss +2 -0
  56. package/src/cssfabric/modules/flex/_flex-build.scss +150 -0
  57. package/src/cssfabric/modules/flex/_flex-vars.scss +84 -0
  58. package/src/cssfabric/modules/flex/flex-responsive.scss +25 -0
  59. package/src/cssfabric/modules/flex/flex.scss +3 -0
  60. package/src/cssfabric/modules/grid/_grid-build.scss +84 -0
  61. package/src/cssfabric/modules/grid/_grid-vars.scss +88 -0
  62. package/src/cssfabric/modules/grid/grid-responsive.scss +25 -0
  63. package/src/cssfabric/modules/grid/grid.scss +6 -0
  64. package/src/cssfabric/modules/menu/_menu-build.scss +120 -0
  65. package/src/cssfabric/modules/menu/_menu-vars.scss +29 -0
  66. package/src/cssfabric/modules/menu/menu-responsive.scss +19 -0
  67. package/src/cssfabric/modules/menu/menu.scss +6 -0
  68. package/src/cssfabric/modules/overflow/_overflow-build.scss +22 -0
  69. package/src/cssfabric/modules/overflow/_overflow-vars.scss +31 -0
  70. package/src/cssfabric/modules/overflow/overflow-responsive.scss +25 -0
  71. package/src/cssfabric/modules/overflow/overflow.scss +7 -0
  72. package/src/cssfabric/modules/scale/_scale-build.scss +142 -0
  73. package/src/cssfabric/modules/scale/_scale-vars.scss +84 -0
  74. package/src/cssfabric/modules/scale/scale-responsive.scss +23 -0
  75. package/src/cssfabric/modules/scale/scale.scss +8 -0
  76. package/src/cssfabric/modules/table/_table-build.scss +134 -0
  77. package/src/cssfabric/modules/table/_table-vars.scss +30 -0
  78. package/src/cssfabric/modules/table/table-responsive.scss +24 -0
  79. package/src/cssfabric/modules/table/table.scss +8 -0
  80. package/src/cssfabric/modules/text/_text-build.scss +166 -0
  81. package/src/cssfabric/modules/text/_text-vars.scss +87 -0
  82. package/src/cssfabric/modules/text/text-responsive.scss +26 -0
  83. package/src/cssfabric/modules/text/text.scss +6 -0
  84. package/src/cssfabric/modules/theme/_theme-build.scss +133 -0
  85. package/src/cssfabric/modules/theme/_theme-vars.scss +46 -0
  86. package/src/cssfabric/modules/theme/theme.scss +6 -0
  87. package/src/cssfabric/modules/vars.scss +49 -0
  88. package/src/cssfabric/modules/zindex/_zindex-vars.scss +14 -0
  89. package/src/cssfabric/modules/zindex/zindex.scss +15 -0
  90. package/src/hooks.ts +27 -0
  91. package/src/index.d.ts +3 -0
  92. package/src/index.ts +4 -0
  93. package/{_generated → src/lib/_generated}/cssFabric.vars.json +1 -1
  94. package/{_generated → src/lib/_generated}/export.variables.md +0 -0
  95. package/src/lib/_generated/index.d.ts +3 -0
  96. package/{_generated → src/lib/_generated}/readme.md +0 -0
  97. package/{init/importCssVars.js → src/lib/init/importCssVars.ts} +3 -2
  98. package/src/lib/scripts/cssfabric.ts +54 -0
  99. package/{scripts/cssfabricClassNames.js → src/lib/scripts/cssfabricClassNames.ts} +112 -42
  100. package/{scripts → src/lib/scripts}/index.d.ts +0 -0
  101. package/src/lib/scripts/index.ts +8 -0
  102. package/src/lib/scripts/utils.ts +37 -0
  103. package/{styles → src/lib/styles}/animation/animation.css +0 -0
  104. package/{styles → src/lib/styles}/animation/animation.min.css +0 -0
  105. package/{styles → src/lib/styles}/base/base.css +0 -0
  106. package/{styles → src/lib/styles}/base/base.min.css +0 -0
  107. package/{styles → src/lib/styles}/box/box.css +0 -0
  108. package/{styles → src/lib/styles}/box/box.min.css +0 -0
  109. package/{styles → src/lib/styles}/box/box.responsive.css +0 -0
  110. package/{styles → src/lib/styles}/box/box.responsive.min.css +0 -0
  111. package/{styles → src/lib/styles}/color/color.css +0 -0
  112. package/{styles → src/lib/styles}/color/color.min.css +0 -0
  113. package/{styles → src/lib/styles}/color/color.responsive.css +0 -0
  114. package/{styles → src/lib/styles}/color/color.responsive.min.css +0 -0
  115. package/src/lib/styles/cssfabric.css +129144 -0
  116. package/src/lib/styles/cssfabric.min.css +350 -0
  117. package/src/lib/styles/cssfabric.responsive.css +418463 -0
  118. package/src/lib/styles/cssfabric.responsive.min.css +225 -0
  119. package/{styles → src/lib/styles}/flex/flex.css +0 -0
  120. package/{styles → src/lib/styles}/flex/flex.min.css +0 -0
  121. package/{styles → src/lib/styles}/flex/flex.responsive.css +0 -0
  122. package/{styles → src/lib/styles}/flex/flex.responsive.min.css +0 -0
  123. package/{styles → src/lib/styles}/grid/grid.css +0 -0
  124. package/{styles → src/lib/styles}/grid/grid.min.css +0 -0
  125. package/{styles → src/lib/styles}/grid/grid.responsive.css +0 -0
  126. package/{styles → src/lib/styles}/grid/grid.responsive.min.css +0 -0
  127. package/{styles → src/lib/styles}/menu/menu.css +0 -0
  128. package/{styles → src/lib/styles}/menu/menu.min.css +0 -0
  129. package/{styles → src/lib/styles}/menu/menu.responsive.css +0 -0
  130. package/{styles → src/lib/styles}/menu/menu.responsive.min.css +0 -0
  131. package/{styles → src/lib/styles}/overflow/overflow.css +0 -0
  132. package/{styles → src/lib/styles}/overflow/overflow.min.css +0 -0
  133. package/{styles → src/lib/styles}/overflow/overflow.responsive.css +0 -0
  134. package/{styles → src/lib/styles}/overflow/overflow.responsive.min.css +0 -0
  135. package/{styles → src/lib/styles}/scale/scale.css +0 -0
  136. package/{styles → src/lib/styles}/scale/scale.min.css +0 -0
  137. package/{styles → src/lib/styles}/scale/scale.responsive.css +0 -0
  138. package/{styles → src/lib/styles}/scale/scale.responsive.min.css +0 -0
  139. package/{styles → src/lib/styles}/table/table.css +0 -0
  140. package/{styles → src/lib/styles}/table/table.min.css +0 -0
  141. package/{styles → src/lib/styles}/table/table.responsive.css +0 -0
  142. package/{styles → src/lib/styles}/table/table.responsive.min.css +0 -0
  143. package/{styles → src/lib/styles}/text/text.css +0 -0
  144. package/{styles → src/lib/styles}/text/text.min.css +0 -0
  145. package/{styles → src/lib/styles}/text/text.responsive.css +0 -0
  146. package/{styles → src/lib/styles}/text/text.responsive.min.css +0 -0
  147. package/{styles → src/lib/styles}/theme/theme.css +48 -0
  148. package/{styles → src/lib/styles}/theme/theme.min.css +1 -1
  149. package/{styles → src/lib/styles}/vars.css +1 -1
  150. package/{styles → src/lib/styles}/vars.min.css +0 -0
  151. package/{styles → src/lib/styles}/zindex/zindex.css +0 -0
  152. package/{styles → src/lib/styles}/zindex/zindex.min.css +0 -0
  153. package/src/routes/__layout.svelte +91 -0
  154. package/src/routes/cssfabric-modules/[module]/__layout.svelte +75 -0
  155. package/src/routes/cssfabric-modules/[module]/classnames/index.svelte +24 -0
  156. package/src/routes/cssfabric-modules/[module]/demo/index.svelte +24 -0
  157. package/src/routes/cssfabric-modules/[module]/docs/index.svelte +30 -0
  158. package/src/routes/cssfabric-modules/[module]/index.svelte +3 -0
  159. package/src/routes/cssfabric-modules/__layout.svelte +26 -0
  160. package/src/routes/cssfabric-modules/index.svelte +0 -0
  161. package/src/routes/index.svelte +62 -0
  162. package/src/routes/installation/__layout.svelte +1 -0
  163. package/src/routes/installation/index.svelte +28 -0
  164. package/src/scripts/utils.ts +26 -0
  165. package/src/utils.ts +71 -0
  166. package/src/vendor/index.d.ts +3 -0
  167. package/src/vendor/normalize/normalize.min.css +2 -0
  168. package/src/vendor/sass-json-export/CHANGELOG.md +26 -0
  169. package/src/vendor/sass-json-export/Gruntfile.js +60 -0
  170. package/src/vendor/sass-json-export/LICENSE +20 -0
  171. package/src/vendor/sass-json-export/README.md +90 -0
  172. package/src/vendor/sass-json-export/package.json +60 -0
  173. package/src/vendor/sass-json-export/stylesheets/encode/api/_json.scss +26 -0
  174. package/src/vendor/sass-json-export/stylesheets/encode/encode.scss +17 -0
  175. package/src/vendor/sass-json-export/stylesheets/encode/helpers/_quote.scss +9 -0
  176. package/src/vendor/sass-json-export/stylesheets/encode/mixins/_json.scss +42 -0
  177. package/src/vendor/sass-json-export/stylesheets/encode/types/_bool.scss +7 -0
  178. package/src/vendor/sass-json-export/stylesheets/encode/types/_color.scss +8 -0
  179. package/src/vendor/sass-json-export/stylesheets/encode/types/_list.scss +14 -0
  180. package/src/vendor/sass-json-export/stylesheets/encode/types/_map.scss +15 -0
  181. package/src/vendor/sass-json-export/stylesheets/encode/types/_null.scss +7 -0
  182. package/src/vendor/sass-json-export/stylesheets/encode/types/_number.scss +8 -0
  183. package/src/vendor/sass-json-export/stylesheets/encode/types/_string.scss +8 -0
  184. package/src/vendor/sass-json-export/stylesheets/sass-json-export.scss +2 -0
  185. package/src/vendor/sass-json-export/test/encode/_index.scss +14 -0
  186. package/src/vendor/sass-json-export/test/encode/api/_json.scss +29 -0
  187. package/src/vendor/sass-json-export/test/encode/helpers/_quote.scss +6 -0
  188. package/src/vendor/sass-json-export/test/encode/types/_bool.scss +6 -0
  189. package/src/vendor/sass-json-export/test/encode/types/_color.scss +7 -0
  190. package/src/vendor/sass-json-export/test/encode/types/_list.scss +25 -0
  191. package/src/vendor/sass-json-export/test/encode/types/_map.scss +17 -0
  192. package/src/vendor/sass-json-export/test/encode/types/_null.scss +8 -0
  193. package/src/vendor/sass-json-export/test/encode/types/_number.scss +68 -0
  194. package/src/vendor/sass-json-export/test/encode/types/_string.scss +9 -0
  195. package/src/vendor/sass-json-export/test/test.scss +9 -0
  196. package/static/favicon.png +0 -0
  197. package/static/robots.txt +3 -0
  198. package/svelte.config.js +25 -0
  199. package/tsconfig.json +3 -0
  200. package/webpack.config.js +55 -0
  201. package/init/importCssVars.d.ts +0 -1
  202. package/scripts/cssfabric.d.ts +0 -24
  203. package/scripts/cssfabric.js +0 -43
  204. package/scripts/cssfabricClassNames.d.ts +0 -14
  205. package/scripts/index.js +0 -4
  206. package/scripts/utils.d.ts +0 -5
  207. package/scripts/utils.js +0 -38
  208. package/styles/cssfabric.css +0 -61792
  209. package/styles/cssfabric.min.css +0 -168
  210. package/styles/cssfabric.responsive.css +0 -200596
  211. package/styles/cssfabric.responsive.min.css +0 -108
@@ -0,0 +1,33 @@
1
+ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ name: cssFabric CI
5
+
6
+ on:
7
+ push:
8
+ branches: [ main , dev ]
9
+ pull_request:
10
+ branches: [ main , dev ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ node-version: [16.x]
20
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21
+
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ - name: Use Node.js ${{ matrix.node-version }}
25
+ uses: actions/setup-node@v3
26
+ with:
27
+ node-version: ${{ matrix.node-version }}
28
+ cache: 'npm'
29
+ - run: npm ci
30
+ #- name: Tests execution
31
+ # run: npm test
32
+ - name: Build
33
+ run: npm run build
@@ -0,0 +1,11 @@
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
+ <excludeFolder url="file://$MODULE_DIR$/lib" />
6
+ <excludeFolder url="file://$MODULE_DIR$/package" />
7
+ </content>
8
+ <orderEntry type="inheritedJdk" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ </component>
11
+ </module>
package/.idea/misc.xml ADDED
@@ -0,0 +1,9 @@
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>
@@ -0,0 +1,8 @@
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 ADDED
@@ -0,0 +1,6 @@
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>
@@ -0,0 +1,24 @@
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 ADDED
@@ -0,0 +1,8 @@
1
+ #! /usr/bin/env node
2
+
3
+ /*
4
+ const fsx = require('fs-extra');
5
+
6
+ let createDir = './cssfabric/cssfabric.scss';
7
+
8
+ fsx.ensureFile(createDir);*/
@@ -0,0 +1,8 @@
1
+ export const cssFabricSassConf = {
2
+ "fabricRootDir": "./src/cssfabric",
3
+ "fabricConfDir": "./src/cssfabric/_config",
4
+ "fabricModuleDir": "./src/cssfabric/modules",
5
+ "fabricGeneratedDir": "./src/lib/_generated",
6
+ "fabricJsonExportFile": "export.variables.json",
7
+ "fabricStylesDir": "./src/lib/styles"
8
+ }
package/gulpfile.js ADDED
@@ -0,0 +1,532 @@
1
+ // ## WIP
2
+
3
+ import gulp from "gulp";
4
+ import jsonTransform from "gulp-json-transform"
5
+ import cache from "gulp-cached"
6
+ import gulFileList from "gulp-filelist"
7
+ import gulpConcat from "gulp-concat-util"
8
+ import gulpRename from "gulp-rename"
9
+ import json2md from "json2md"
10
+ import gulpIgnore from "gulp-ignore"
11
+ import {cssFabricSassConf} from "./cssfabric.sass.js";
12
+ import {Transform} from "stream";
13
+ import util from "util";
14
+
15
+ import dartSass from 'sass';
16
+ import gulpSass from 'gulp-sass';
17
+ import through2 from "through2";
18
+ const sass = gulpSass(dartSass);
19
+
20
+ const {
21
+ fabricRootDir,
22
+ fabricStylesDir,
23
+ fabricConfDir,
24
+ fabricModuleDir,
25
+ fabricGeneratedDir,
26
+ } = cssFabricSassConf;
27
+
28
+
29
+ const tr = new Transform({writableObjectMode: true, readableObjectMode: true});
30
+
31
+
32
+ function TransformStream(transformFunction) {
33
+ // Set the objectMode flag here if you're planning to iterate through a set of objects rather than bytes
34
+ Transform.call(this, { objectMode: true });
35
+ this.transformFunction = transformFunction;
36
+ }
37
+
38
+ util.inherits(TransformStream, Transform);
39
+
40
+ TransformStream.prototype._transform = function(obj, enc, done) {
41
+ return this.transformFunction(this, obj, done);
42
+ };
43
+
44
+
45
+
46
+ const doFabric = {
47
+ /**
48
+ * build readme fragment from _generated json file
49
+ * @param file_content
50
+ * @param file_info
51
+ * @returns {{}}
52
+ */
53
+ fabricReadmeFile: (file_content, file_info) => {
54
+ // name of the module, from path
55
+ const fileContent = file_content || {}
56
+ const moduleList = fileContent?.cssfabric?.modules;
57
+
58
+ let out = [];
59
+ const content = [];
60
+ const docContent = [];
61
+
62
+ const table = {headers: ["modules", ""]};
63
+ const rows = [];
64
+
65
+ const labelIn = "<span style='width:80px;display:inline-block;overflow:visible'><b>";
66
+ const labelOut = "</b></span>";
67
+
68
+ const labelNestedIn = "<span style='margin-left:20px;width:80px;display:inline-block;overflow:visible'>- ";
69
+ const labelNestedOut = "</span>";
70
+
71
+ const eol = '<br>&nbsp;&nbsp;-&nbsp;&nbsp;';
72
+
73
+ out.push({h1: "Welcome to cssfabric"});
74
+ out.push({p: "Willing to bring my utility-first 2011 css framework to a more decent life !"});
75
+ out.push({p: "This is also a learning point about gulp, webpack, packages and friends."});
76
+ out.push({blockquote: "yaocf !"});
77
+ out.push({p: "<br/>"});
78
+ out.push({h2: "Incoming features"});
79
+ out.push({p: "<br/>"});
80
+
81
+ Object.keys(moduleList).forEach((moduleListKey, moduleListIndex, a) => {
82
+ const moduleListValue = moduleList[moduleListKey];
83
+
84
+ let title = moduleListValue?._metadata?.title;
85
+ let description = moduleListValue?._metadata?.description;
86
+ let docs = moduleListValue?._docs || {};
87
+
88
+ let config = Object.keys(moduleListValue?._data);
89
+ let cssProps = config?.cssProps;
90
+ let collect;
91
+ let collectContentList;
92
+ let nestedLevels;
93
+
94
+
95
+ if (docs?.attributes) {
96
+
97
+ docContent.push({hr: ''});
98
+ docContent.push({h4: `<strong>module ${title}</strong>`});
99
+
100
+
101
+ Object.keys(docs.attributes).forEach((attributeCode) => {
102
+
103
+ collectContentList = [];
104
+ collect = {};
105
+ nestedLevels = [];
106
+
107
+ const attributeValue = docs.attributes[attributeCode];
108
+ // looking for tag
109
+
110
+ if (typeof attributeValue === "object" && !Array.isArray(attributeValue)) {
111
+ collect.title = `[${attributeCode}]`;
112
+ // si tag
113
+ if (attributeValue?.tag) {
114
+ collect.tag = `${labelIn}shorthand${labelOut}: ${attributeValue.tag}`;
115
+ }
116
+ // si about
117
+ if (attributeValue?.about) {
118
+ collect.about = `- ${attributeValue.about}`;
119
+ }
120
+ // si keys
121
+ if (attributeValue?.keys) {
122
+ console.log(title, 'keys isArrayOfType ', isArrayOfType(attributeValue.keys))
123
+ switch (isArrayOfType(attributeValue.keys)) {
124
+ case "strings":
125
+ case "numbers":
126
+ collect.keys = `${labelIn}keys${labelOut}: ${attributeValue.keys.join('&nbsp;&nbsp;')}`;
127
+ break;
128
+ case "arrays":
129
+ collect.keys = `${labelIn}keys${labelOut}:${eol}` + attributeValue.keys.map((x) => x.join('&nbsp;&nbsp;')).join(eol)
130
+ break;
131
+ case "objects":
132
+ break;
133
+ }
134
+ }
135
+ // si levels
136
+ if (attributeValue?.levels) {
137
+ // si typeof level array => array of string or of arrays
138
+ if (Array.isArray(attributeValue.levels)) {
139
+ // if [][]
140
+ console.log(title, 'levels isArrayOfType ', isArrayOfType(attributeValue.levels))
141
+ switch (isArrayOfType(attributeValue.levels)) {
142
+ case "strings":
143
+ case "numbers":
144
+ collect.levels = `${labelIn}levels${labelOut}: ${eol}${attributeValue.levels.join('&nbsp;&nbsp;')}`;
145
+ break;
146
+ case "arrays":
147
+ collect.levels = `${labelIn}levels${labelOut}:${eol}` + attributeValue.levels.map((x) => x.join('&nbsp;&nbsp;')).join(eol)
148
+ break;
149
+
150
+ }
151
+
152
+ // if {}[] ..... ?
153
+ if (attributeValue.levels.every(x => typeof x === 'object' && !Array.isArray(x))) {
154
+ collect.levels = `${labelIn}levels${labelOut}: ${eol}${attributeValue.levels.map((x) => x.join('&nbsp;&nbsp;')).join(eol)}`;
155
+ }
156
+
157
+ }
158
+ // si typeof level object
159
+ if (!Array.isArray(attributeValue.levels) && typeof (attributeValue.levels === "object")) {
160
+ nestedLevels.push(`${labelIn}level keys${labelOut}:`);
161
+ Object.keys(attributeValue.levels).forEach((levelKey) => {
162
+ let levelValue = attributeValue.levels[levelKey].join('&nbsp;&nbsp;&nbsp;&nbsp;')
163
+ // console.log(levelValue)
164
+ nestedLevels.push(`${labelNestedIn}${levelKey}${labelNestedOut}: ${levelValue}`);
165
+ })
166
+ // [].concat(...arr));
167
+ }
168
+ }
169
+ }
170
+
171
+ if (collect.title) docContent.push({h4: collect.title});
172
+ if (collect.about) docContent.push({"p": collect.about});
173
+
174
+ if (collect.tag) collectContentList.push(collect.tag);
175
+ if (collect.keys) collectContentList.push(collect.keys);
176
+ if (collect.levels) collectContentList.push(collect.levels);
177
+
178
+ if (nestedLevels && nestedLevels.length) collectContentList.push(nestedLevels.join('<br/>'));
179
+
180
+ docContent.push({"ul": collectContentList});
181
+
182
+ // docContent.push({"p": "<br/>"}) ;
183
+
184
+ });
185
+ //docContent.push({p: '<br/><br/>'});
186
+
187
+ }
188
+
189
+ rows.push([title, description]);
190
+
191
+ });
192
+
193
+ function isArrayOfType(arr) {
194
+ let ret = '';
195
+
196
+ if (!Array.isArray(arr)) {
197
+ console.log(Array.isArray(arr), {arr})
198
+ }
199
+ if (arr.every(x => Array.isArray(x))) ret = 'arrays'
200
+ if (arr.every(x => typeof x === 'string')) ret = 'strings'
201
+ if (arr.every(x => typeof x === 'number')) ret = 'numbers'
202
+ if (arr.every(x => typeof x === 'object' && !Array.isArray(x))) ret = 'objects'
203
+
204
+ return ret;
205
+ }
206
+
207
+
208
+ table.rows = rows;
209
+
210
+ out.push({table: table})
211
+ out.push({p: "<br/>"});
212
+ out.push({ul: content});
213
+ out.push({p: "<br/>"});
214
+ out.push({h3: "More details"});
215
+ out = out.concat(docContent);
216
+
217
+ return json2md(out);
218
+ },
219
+
220
+ /**
221
+ * transform scss to json file with all modules variables
222
+ * @param file
223
+ * @returns {string}
224
+ */
225
+ fabricSassToJson: (file) => {
226
+ let {file_content, file_info} = file;
227
+
228
+ let obj;
229
+ obj = file_content.obj;
230
+ obj = obj.split("|").filter(n => n);
231
+
232
+ const redPath = "";
233
+ const redModulePath = fabricModuleDir + "/";
234
+
235
+ let header = '';
236
+ let footer = '';
237
+
238
+ let importExport = `@import "./src/${redPath}vendor/sass-json-export/stylesheets/sass-json-export.scss";`;
239
+
240
+
241
+ Object.values(obj).forEach((v, k, a) => {
242
+ let module_path = redModulePath + v;
243
+ let module_name = v
244
+ .replace("_", "")
245
+ .split("/")
246
+ ?.pop()
247
+ .split(".")?.[0]
248
+ .replace("-vars", "");
249
+
250
+ if (v) {
251
+ header += makeHeader(module_path, module_name);
252
+ footer += makeFooter(module_name);
253
+ }
254
+ });
255
+
256
+ // return ""
257
+
258
+ let out = header;
259
+ out += "\r\n" + importExport + "\r\n";
260
+ out += footer;
261
+
262
+ function makeHeader(path, module_name) {
263
+ // form is module-vars.$module-config
264
+ return '@use "' + path + '.scss" as ' + module_name + "; \r\n";
265
+ }
266
+
267
+ function makeFooter(module_name) {
268
+ // form is module.$module-(config|*)
269
+ let out1 = ` ( _data: ${module_name}.$${module_name}-config , _metadata :${module_name}.$${module_name}-metadata , _docs :${module_name}.$${module_name}-docs )`;
270
+
271
+ return (
272
+ "@include json-encode(" + out1 + ",comment," + module_name + ");\r\n"
273
+ );
274
+ }
275
+
276
+
277
+ return out;
278
+ },
279
+ // todo use regexp
280
+ fabricCssVarExportFile: (filePath) => {
281
+ let module_path = filePath
282
+ .split("modules/")[1]
283
+ .replace("modules", "")
284
+ .replace(".scss", "");
285
+
286
+ let module_filename = filePath
287
+ .substring(filePath.lastIndexOf("/"))
288
+ .replace(".scss", "")
289
+ .replace("/", "");
290
+
291
+ let module_name = filePath
292
+ .substring(filePath.lastIndexOf("/_"))
293
+ .replace(".scss", "")
294
+ .replace("-vars", "")
295
+ .replace("_", "")
296
+ .replace("/", "");
297
+
298
+ return `|{"module_path" : "${module_path}","module_filename" : "${module_filename}","module_name" : "${module_name}"}`;
299
+ }
300
+ }
301
+
302
+
303
+ function fabricVarExportFile(filePath) {
304
+ // name of the module, from path
305
+ let module_name = filePath
306
+ .substring(filePath.lastIndexOf("modules/"))
307
+ .split("\\")
308
+ ?.pop()
309
+ .split(".")?.[0]
310
+ .replace("modules/", "");
311
+
312
+ return module_name + "|";
313
+ }
314
+
315
+
316
+ // exports sass maps to json
317
+ function task_varsExport(cb) {
318
+ let sourceFiles = fabricModuleDir + "/**/_*-vars.scss";
319
+
320
+ gulp
321
+ .src(sourceFiles)
322
+ //.pipe(cache(task_varsExport))
323
+ .pipe(
324
+ gulFileList("cssFabric-vars", {
325
+ destRowTemplate: fabricVarExportFile,
326
+ removeExtensions: false,
327
+ })
328
+ )
329
+ .pipe(through2.obj(function(file, _, cb) {
330
+ if (file.isBuffer()) {
331
+ const content = file.contents.toString();
332
+ const start = '{"obj":"';
333
+ const end = "\"}";
334
+
335
+ file.contents = Buffer.from(`${start}${content}${end}`)
336
+ }
337
+ cb(null, file);
338
+ }))
339
+ .pipe(
340
+ jsonTransform(function (file_content, file_info) {
341
+ return doFabric.fabricSassToJson({file_content: file_content, file_info});
342
+ })
343
+ )
344
+ .pipe(cache(task_varsExport))
345
+ .pipe(sass({outputStyle: "expanded"}).on("error", sass.logError))
346
+ .pipe(through2.obj(function(file, _, cb) {
347
+ if (file.isBuffer()) {
348
+ const content = file.contents.toString();
349
+ const start = '{"cssfabric":{"modules":{';
350
+ const end = " }}}";
351
+
352
+ const regexIn = /\/\*\! json-encode: {/gm;
353
+ const regexOut = /} \*\//gm;
354
+
355
+ let exp = content
356
+ .replace(regexIn, "")
357
+ .replace(regexOut, ",")
358
+ .replace(/,\s*$/, "");
359
+
360
+ file.contents = Buffer.from(`${start}${exp}${end}`)
361
+ }
362
+ cb(null, file);
363
+ }))
364
+ .pipe(
365
+ gulpRename(function (path) {
366
+ path.dirname = path.dirname;
367
+ path.extname = ".json";
368
+ path.basename = path.basename.replace("-", ".");
369
+ })
370
+ )
371
+ .pipe(gulp.dest(fabricGeneratedDir))
372
+ .on("end", () => {
373
+ return cb();
374
+ });
375
+
376
+ return cb();
377
+ }
378
+
379
+ export function task_readme(cb) {
380
+ gulp
381
+ .src(fabricGeneratedDir + "/*.json")
382
+ .pipe(
383
+ jsonTransform(function (file_content, file_info) {
384
+ return doFabric.fabricReadmeFile(file_content, file_info);
385
+ })
386
+ )
387
+ .pipe(
388
+ gulpRename(function (path) {
389
+ path.dirname = path.dirname;
390
+ path.extname = ".md";
391
+ path.basename = path.basename.replace("-", ".");
392
+ })
393
+ )
394
+ .pipe(gulp.dest(fabricGeneratedDir))
395
+ .on("end", () => {
396
+ return cb();
397
+ });
398
+ }
399
+
400
+ /**
401
+ * concatenate css files
402
+ * by min | responsive | ...
403
+ *
404
+ * @param {function} cb gulp callback
405
+ */
406
+ function task_mergeInclude(cb) {
407
+ //
408
+ const dest = fabricStylesDir;
409
+ // const dir = fabricStylesDir + "/core";
410
+ const dir = fabricStylesDir ;
411
+
412
+ const steps = [];
413
+ // normal stylesheets
414
+ steps.push(
415
+ gulp
416
+ .src([
417
+ `${dir}/**/*.css`,
418
+ `!${dir}/**/*responsive*.css`,
419
+ `!${dir}/**/*min*.css`,
420
+ ])
421
+ .pipe(gulpConcat("cssfabric.css"))
422
+ .pipe(through2.obj(function(file, _, cb) {
423
+ if (file.isBuffer()) {
424
+ const content = file.contents.toString();
425
+ const start = '/** Merged by Mydde */';
426
+ file.contents = Buffer.from(`${start}${content}`)
427
+ }
428
+ cb(null, file);
429
+ }))
430
+ .pipe(cache(task_mergeInclude))
431
+ .pipe(gulp.dest(dest))
432
+ .on("end", () => {
433
+ return cb();
434
+ })
435
+ );
436
+
437
+ // normal minified stylesheets
438
+ steps.push(
439
+ gulp
440
+ .src([`${dir}/**/*min.css`, `!${dir}/**/*responsive*.css`])
441
+ .pipe(gulpConcat("cssfabric.min.css"))
442
+ .pipe(cache(task_mergeInclude))
443
+ .pipe(gulp.dest(dest))
444
+ .on("end", () => {
445
+ return cb();
446
+ })
447
+ );
448
+
449
+ // responsive stylesheets
450
+ steps.push(
451
+ gulp
452
+ .src([`${dir}/**/*responsive.css`, `!${dir}/**/*min..css`])
453
+ .pipe(gulpConcat("cssfabric.responsive.css"))
454
+ .pipe(cache(task_mergeInclude))
455
+ .pipe(gulp.dest(dest))
456
+ .on("end", () => {
457
+ return cb();
458
+ })
459
+ );
460
+
461
+ // responsive minified stylesheets
462
+ steps.push(
463
+ gulp
464
+ .src([`${dir}/**/*responsive.min.css`])
465
+ .pipe(gulpConcat("cssfabric.responsive.min.css"))
466
+ .pipe(cache(task_mergeInclude))
467
+ .pipe(gulp.dest(dest))
468
+ .on("end", () => {
469
+ return cb();
470
+ })
471
+ );
472
+
473
+ return [...steps];
474
+ }
475
+
476
+ /**
477
+ * task_sass2css
478
+ * transform scss to css
479
+ * store files in /lib
480
+ *
481
+ * rename *-responsive to *.responsive, because not dot in sass file
482
+ *
483
+ * @param {function} cb
484
+ * @returns function
485
+ */
486
+ function task_sass2css(cb) {
487
+ return (
488
+ gulp
489
+ .src(`${fabricModuleDir}/**/*.scss`)
490
+ .pipe(gulpIgnore.exclude("**/*css-fabric*"))
491
+ .pipe(
492
+ gulpRename(function (path) {
493
+ path.basename = path.basename.replace("-", ".");
494
+ })
495
+ )
496
+ // to css and to /core
497
+ .pipe(
498
+ sass({outputStyle: "expanded"}).on("error", sass.logError)
499
+ )
500
+ .pipe(gulp.dest(`${fabricStylesDir}`))
501
+ // to css and minify and to /core
502
+ .pipe(sass({outputStyle:'compressed'}))
503
+ .pipe(
504
+ gulpRename(function (path) {
505
+ path.extname = ".min.css";
506
+ path.basename = path.basename.replace("-", ".");
507
+ })
508
+ )
509
+ .pipe(gulp.dest(`${fabricStylesDir}`))
510
+ .on("end", () => {
511
+ return cb();
512
+ })
513
+ );
514
+ }
515
+
516
+
517
+ export function watchSass(cb) {
518
+ gulp.watch(
519
+ fabricModuleDir + "/**/*.scss",
520
+ gulp.series(task_sass2css, task_mergeInclude, task_varsExport)
521
+ );
522
+ cb();
523
+ }
524
+
525
+ export function watchReadme(cb) {
526
+ gulp.watch(
527
+ [fabricModuleDir, "!" + fabricModuleDir + "/**/_*.scss"],
528
+ task_readme
529
+ );
530
+
531
+ cb();
532
+ }