fomantic-ui 2.9.1-beta.17 → 2.9.1-beta.19

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 (252) hide show
  1. package/.eslintrc.js +109 -0
  2. package/.github/workflows/ci.yml +13 -3
  3. package/dist/components/accordion.css +1 -1
  4. package/dist/components/accordion.js +569 -598
  5. package/dist/components/accordion.min.css +1 -1
  6. package/dist/components/accordion.min.js +2 -2
  7. package/dist/components/ad.css +1 -1
  8. package/dist/components/ad.min.css +1 -1
  9. package/dist/components/api.js +1161 -1184
  10. package/dist/components/api.min.js +2 -2
  11. package/dist/components/breadcrumb.css +1 -1
  12. package/dist/components/breadcrumb.min.css +1 -1
  13. package/dist/components/button.css +1 -1
  14. package/dist/components/button.min.css +1 -1
  15. package/dist/components/calendar.css +1 -1
  16. package/dist/components/calendar.js +1895 -1818
  17. package/dist/components/calendar.min.css +1 -1
  18. package/dist/components/calendar.min.js +2 -2
  19. package/dist/components/card.css +1 -1
  20. package/dist/components/card.min.css +1 -1
  21. package/dist/components/checkbox.css +1 -1
  22. package/dist/components/checkbox.js +842 -841
  23. package/dist/components/checkbox.min.css +1 -1
  24. package/dist/components/checkbox.min.js +2 -2
  25. package/dist/components/comment.css +1 -1
  26. package/dist/components/comment.min.css +1 -1
  27. package/dist/components/container.css +3 -1
  28. package/dist/components/container.min.css +2 -2
  29. package/dist/components/dimmer.css +1 -1
  30. package/dist/components/dimmer.js +708 -737
  31. package/dist/components/dimmer.min.css +1 -1
  32. package/dist/components/dimmer.min.js +2 -2
  33. package/dist/components/divider.css +1 -1
  34. package/dist/components/divider.min.css +1 -1
  35. package/dist/components/dropdown.css +11 -8
  36. package/dist/components/dropdown.js +4161 -4238
  37. package/dist/components/dropdown.min.css +2 -2
  38. package/dist/components/dropdown.min.js +2 -2
  39. package/dist/components/embed.css +1 -1
  40. package/dist/components/embed.js +651 -675
  41. package/dist/components/embed.min.css +1 -1
  42. package/dist/components/embed.min.js +2 -2
  43. package/dist/components/feed.css +1 -1
  44. package/dist/components/feed.min.css +1 -1
  45. package/dist/components/flag.css +1 -1
  46. package/dist/components/flag.min.css +1 -1
  47. package/dist/components/flyout.css +6 -3
  48. package/dist/components/flyout.js +1464 -1467
  49. package/dist/components/flyout.min.css +2 -2
  50. package/dist/components/flyout.min.js +2 -2
  51. package/dist/components/form.css +1 -1
  52. package/dist/components/form.js +1979 -2004
  53. package/dist/components/form.min.css +1 -1
  54. package/dist/components/form.min.js +2 -2
  55. package/dist/components/grid.css +1 -1
  56. package/dist/components/grid.min.css +1 -1
  57. package/dist/components/header.css +1 -1
  58. package/dist/components/header.min.css +1 -1
  59. package/dist/components/icon.css +1 -1
  60. package/dist/components/icon.min.css +1 -1
  61. package/dist/components/image.css +1 -1
  62. package/dist/components/image.min.css +1 -1
  63. package/dist/components/input.css +1 -1
  64. package/dist/components/input.min.css +1 -1
  65. package/dist/components/item.css +1 -1
  66. package/dist/components/item.min.css +1 -1
  67. package/dist/components/label.css +1 -1
  68. package/dist/components/label.min.css +1 -1
  69. package/dist/components/list.css +1 -1
  70. package/dist/components/list.min.css +1 -1
  71. package/dist/components/loader.css +1 -1
  72. package/dist/components/loader.min.css +1 -1
  73. package/dist/components/message.css +1 -1
  74. package/dist/components/message.min.css +1 -1
  75. package/dist/components/modal.css +7 -1
  76. package/dist/components/modal.js +1491 -1487
  77. package/dist/components/modal.min.css +2 -2
  78. package/dist/components/modal.min.js +2 -2
  79. package/dist/components/nag.css +1 -1
  80. package/dist/components/nag.js +518 -529
  81. package/dist/components/nag.min.css +1 -1
  82. package/dist/components/nag.min.js +2 -2
  83. package/dist/components/placeholder.css +1 -1
  84. package/dist/components/placeholder.min.css +1 -1
  85. package/dist/components/popup.css +1 -1
  86. package/dist/components/popup.js +1437 -1456
  87. package/dist/components/popup.min.css +1 -1
  88. package/dist/components/popup.min.js +2 -2
  89. package/dist/components/progress.css +1 -1
  90. package/dist/components/progress.js +969 -997
  91. package/dist/components/progress.min.css +1 -1
  92. package/dist/components/progress.min.js +2 -2
  93. package/dist/components/rail.css +1 -1
  94. package/dist/components/rail.min.css +1 -1
  95. package/dist/components/rating.css +1 -1
  96. package/dist/components/rating.js +505 -523
  97. package/dist/components/rating.min.css +1 -1
  98. package/dist/components/rating.min.js +2 -2
  99. package/dist/components/reset.css +1 -1
  100. package/dist/components/reset.min.css +1 -1
  101. package/dist/components/reveal.css +1 -1
  102. package/dist/components/reveal.min.css +1 -1
  103. package/dist/components/search.css +3 -1
  104. package/dist/components/search.js +1498 -1534
  105. package/dist/components/search.min.css +2 -2
  106. package/dist/components/search.min.js +2 -2
  107. package/dist/components/segment.css +3 -1
  108. package/dist/components/segment.min.css +2 -2
  109. package/dist/components/shape.css +1 -1
  110. package/dist/components/shape.js +792 -809
  111. package/dist/components/shape.min.css +1 -1
  112. package/dist/components/shape.min.js +2 -2
  113. package/dist/components/sidebar.css +3 -1
  114. package/dist/components/sidebar.js +1071 -1098
  115. package/dist/components/sidebar.min.css +2 -2
  116. package/dist/components/sidebar.min.js +2 -2
  117. package/dist/components/site.css +1 -1
  118. package/dist/components/site.js +462 -471
  119. package/dist/components/site.min.css +1 -1
  120. package/dist/components/site.min.js +2 -2
  121. package/dist/components/slider.js +1287 -1311
  122. package/dist/components/slider.min.js +2 -2
  123. package/dist/components/state.js +639 -657
  124. package/dist/components/state.min.js +2 -2
  125. package/dist/components/statistic.css +1 -1
  126. package/dist/components/statistic.min.css +1 -1
  127. package/dist/components/step.css +1 -1
  128. package/dist/components/step.min.css +1 -1
  129. package/dist/components/sticky.css +1 -1
  130. package/dist/components/sticky.js +857 -903
  131. package/dist/components/sticky.min.css +1 -1
  132. package/dist/components/sticky.min.js +2 -2
  133. package/dist/components/tab.css +1 -1
  134. package/dist/components/tab.js +922 -963
  135. package/dist/components/tab.min.css +1 -1
  136. package/dist/components/tab.min.js +2 -2
  137. package/dist/components/table.css +5 -1
  138. package/dist/components/table.min.css +2 -2
  139. package/dist/components/text.css +1 -1
  140. package/dist/components/text.min.css +1 -1
  141. package/dist/components/toast.css +1 -1
  142. package/dist/components/toast.js +886 -890
  143. package/dist/components/toast.min.css +1 -1
  144. package/dist/components/toast.min.js +2 -2
  145. package/dist/components/transition.css +1 -1
  146. package/dist/components/transition.js +1041 -1077
  147. package/dist/components/transition.min.css +1 -1
  148. package/dist/components/transition.min.js +2 -2
  149. package/dist/components/visibility.js +1220 -1244
  150. package/dist/components/visibility.min.js +2 -2
  151. package/dist/semantic.css +84 -60
  152. package/dist/semantic.js +28949 -29435
  153. package/dist/semantic.min.css +2 -2
  154. package/dist/semantic.min.js +2 -2
  155. package/examples/assets/show-examples.js +13 -13
  156. package/gulpfile.js +9 -10
  157. package/package.json +5 -2
  158. package/scripts/nightly-version.js +81 -75
  159. package/src/definitions/behaviors/api.js +1162 -1185
  160. package/src/definitions/behaviors/form.js +1978 -2003
  161. package/src/definitions/behaviors/state.js +645 -663
  162. package/src/definitions/behaviors/visibility.js +1219 -1243
  163. package/src/definitions/collections/table.less +2 -0
  164. package/src/definitions/elements/container.less +1 -0
  165. package/src/definitions/elements/segment.less +1 -0
  166. package/src/definitions/globals/site.js +461 -470
  167. package/src/definitions/modules/accordion.js +568 -597
  168. package/src/definitions/modules/calendar.js +1894 -1817
  169. package/src/definitions/modules/checkbox.js +841 -840
  170. package/src/definitions/modules/dimmer.js +707 -736
  171. package/src/definitions/modules/dropdown.js +4160 -4237
  172. package/src/definitions/modules/dropdown.less +5 -8
  173. package/src/definitions/modules/embed.js +650 -674
  174. package/src/definitions/modules/flyout.js +1463 -1466
  175. package/src/definitions/modules/flyout.less +15 -12
  176. package/src/definitions/modules/modal.js +1490 -1486
  177. package/src/definitions/modules/modal.less +3 -0
  178. package/src/definitions/modules/nag.js +517 -528
  179. package/src/definitions/modules/popup.js +1436 -1455
  180. package/src/definitions/modules/progress.js +968 -996
  181. package/src/definitions/modules/rating.js +504 -522
  182. package/src/definitions/modules/search.js +1497 -1533
  183. package/src/definitions/modules/search.less +1 -0
  184. package/src/definitions/modules/shape.js +791 -808
  185. package/src/definitions/modules/sidebar.js +1070 -1097
  186. package/src/definitions/modules/sidebar.less +1 -0
  187. package/src/definitions/modules/slider.js +1286 -1310
  188. package/src/definitions/modules/sticky.js +873 -919
  189. package/src/definitions/modules/tab.js +921 -962
  190. package/src/definitions/modules/toast.js +885 -889
  191. package/src/definitions/modules/transition.js +1040 -1076
  192. package/src/themes/default/elements/container.variables +0 -7
  193. package/src/themes/default/elements/segment.variables +0 -7
  194. package/src/themes/default/globals/site.variables +7 -0
  195. package/src/themes/default/globals/variation.variables +1 -0
  196. package/tasks/admin/components/create.js +274 -276
  197. package/tasks/admin/components/init.js +123 -130
  198. package/tasks/admin/components/update.js +149 -157
  199. package/tasks/admin/distributions/create.js +184 -187
  200. package/tasks/admin/distributions/init.js +123 -130
  201. package/tasks/admin/distributions/update.js +145 -152
  202. package/tasks/admin/publish.js +5 -7
  203. package/tasks/admin/register.js +36 -38
  204. package/tasks/admin/release.js +8 -10
  205. package/tasks/build/assets.js +42 -39
  206. package/tasks/build/css.js +225 -216
  207. package/tasks/build/javascript.js +118 -113
  208. package/tasks/build.js +10 -10
  209. package/tasks/check-install.js +14 -16
  210. package/tasks/clean.js +5 -5
  211. package/tasks/collections/admin.js +34 -36
  212. package/tasks/collections/build.js +18 -20
  213. package/tasks/collections/docs.js +9 -11
  214. package/tasks/collections/install.js +9 -11
  215. package/tasks/collections/rtl.js +9 -11
  216. package/tasks/collections/various.js +8 -10
  217. package/tasks/config/admin/github.js +17 -17
  218. package/tasks/config/admin/oauth.example.js +4 -4
  219. package/tasks/config/admin/release.js +98 -98
  220. package/tasks/config/admin/templates/component-package.js +9 -10
  221. package/tasks/config/admin/templates/css-package.js +18 -20
  222. package/tasks/config/admin/templates/less-package.js +11 -13
  223. package/tasks/config/defaults.js +116 -116
  224. package/tasks/config/docs.js +23 -23
  225. package/tasks/config/npm/gulpfile.js +8 -9
  226. package/tasks/config/project/config.js +127 -134
  227. package/tasks/config/project/install.js +715 -713
  228. package/tasks/config/project/release.js +32 -38
  229. package/tasks/config/tasks.js +163 -164
  230. package/tasks/config/user.js +23 -29
  231. package/tasks/docs/build.js +97 -95
  232. package/tasks/docs/metadata.js +90 -96
  233. package/tasks/docs/serve.js +80 -81
  234. package/tasks/install.js +370 -378
  235. package/tasks/rtl/build.js +2 -2
  236. package/tasks/rtl/watch.js +2 -2
  237. package/tasks/version.js +4 -4
  238. package/tasks/watch.js +28 -30
  239. package/test/meteor/assets.js +10 -13
  240. package/test/meteor/fonts.js +12 -13
  241. package/test/modules/accordion.spec.js +6 -8
  242. package/test/modules/checkbox.spec.js +5 -7
  243. package/test/modules/dropdown.spec.js +5 -7
  244. package/test/modules/modal.spec.js +6 -8
  245. package/test/modules/module.spec.js +158 -178
  246. package/test/modules/popup.spec.js +5 -7
  247. package/test/modules/search.spec.js +5 -7
  248. package/test/modules/shape.spec.js +5 -7
  249. package/test/modules/sidebar.spec.js +5 -7
  250. package/test/modules/tab.spec.js +6 -8
  251. package/test/modules/transition.spec.js +5 -7
  252. package/test/modules/video.spec.js +5 -7
package/tasks/install.js CHANGED
@@ -11,430 +11,422 @@
11
11
  * (NPM) Install - Will ask for where to put semantic (outside pm folder)
12
12
  * (NPM) Upgrade - Will look for semantic install, copy over files and update if new version
13
13
  * Standard installer runs asking for paths to site files etc
14
-
15
14
  */
16
15
 
17
16
  var
18
- gulp = require('gulp'),
19
-
20
- // node dependencies
21
- console = require('better-console'),
22
- extend = require('extend'),
23
- fs = require('fs'),
24
- mkdirp = require('mkdirp'),
25
- path = require('path'),
26
-
27
- // gulp dependencies
28
- chmod = require('gulp-chmod'),
29
- del = require('del'),
30
- jsonEditor = require('gulp-json-editor'),
31
- plumber = require('gulp-plumber'),
32
- inquirer = require('inquirer'),
33
- rename = require('gulp-rename'),
34
- replace = require('gulp-replace'),
35
- requireDotFile = require('require-dot-file'),
36
- wrench = require('wrench-sui'),
37
-
38
- // install config
39
- install = require('./config/project/install'),
40
-
41
- // user config
42
- config = require('./config/user'),
43
-
44
- // release config (name/title/etc)
45
- release = require('./config/project/release'),
46
-
47
- // shorthand
48
- questions = install.questions,
49
- files = install.files,
50
- folders = install.folders,
51
- regExp = install.regExp,
52
- settings = install.settings,
53
- source = install.source
17
+ gulp = require('gulp'),
18
+
19
+ // node dependencies
20
+ console = require('better-console'),
21
+ extend = require('extend'),
22
+ fs = require('fs'),
23
+ mkdirp = require('mkdirp'),
24
+ path = require('path'),
25
+
26
+ // gulp dependencies
27
+ chmod = require('gulp-chmod'),
28
+ del = require('del'),
29
+ jsonEditor = require('gulp-json-editor'),
30
+ plumber = require('gulp-plumber'),
31
+ inquirer = require('inquirer'),
32
+ rename = require('gulp-rename'),
33
+ replace = require('gulp-replace'),
34
+ requireDotFile = require('require-dot-file'),
35
+ wrench = require('wrench-sui'),
36
+
37
+ // install config
38
+ install = require('./config/project/install'),
39
+
40
+ // user config
41
+ config = require('./config/user'),
42
+
43
+ // release config (name/title/etc)
44
+ release = require('./config/project/release'),
45
+
46
+ // shorthand
47
+ questions = install.questions,
48
+ files = install.files,
49
+ folders = install.folders,
50
+ regExp = install.regExp,
51
+ settings = install.settings,
52
+ source = install.source
54
53
  ;
55
54
 
56
55
  // Export install task
57
56
  module.exports = function (callback) {
58
-
59
- var
60
- currentConfig = requireDotFile('semantic.json', process.cwd()),
61
- manager = install.getPackageManager(),
62
- rootQuestions = questions.root,
63
- installFolder = false,
64
- answers
65
- ;
66
-
67
- console.clear();
68
-
69
- /* Test NPM install
70
- manager = {
71
- name : 'NPM',
72
- root : path.normalize(__dirname + '/../')
73
- };
74
- */
75
-
76
-
77
- /* Don't do end user config if SUI is a sub-module */
78
- if (install.isSubModule()) {
79
- console.info('SUI is a sub-module, skipping end-user install');
80
- callback();
81
- return;
82
- }
83
-
84
- /*-----------------
85
- Update SUI
86
- -----------------*/
87
-
88
- // run update scripts if semantic.json exists
89
- if (currentConfig && manager.name === 'NPM') {
90
-
91
57
  var
92
- updateFolder = path.join(manager.root, currentConfig.base),
93
- updatePaths = {
94
- config : path.join(manager.root, files.config),
95
- tasks : path.join(updateFolder, folders.tasks),
96
- themeImport : path.join(updateFolder, folders.themeImport),
97
- definition : path.join(currentConfig.paths.source.definitions),
98
- site : path.join(currentConfig.paths.source.site),
99
- theme : path.join(currentConfig.paths.source.themes),
100
- defaultTheme: path.join(currentConfig.paths.source.themes, folders.defaultTheme)
101
- }
58
+ currentConfig = requireDotFile('semantic.json', process.cwd()),
59
+ manager = install.getPackageManager(),
60
+ rootQuestions = questions.root,
61
+ installFolder = false,
62
+ answers
102
63
  ;
103
64
 
104
- // duck-type if there is a project installed
105
- if (fs.existsSync(updatePaths.definition)) {
106
-
107
- // perform update if new version
108
- if (currentConfig.version !== release.version) {
109
- console.log('Updating Fomantic UI from ' + currentConfig.version + ' to ' + release.version);
65
+ console.clear();
110
66
 
111
- console.info('Updating ui definitions...');
112
- wrench.copyDirSyncRecursive(source.definitions, updatePaths.definition, settings.wrench.overwrite);
67
+ /* Test NPM install
68
+ manager = {
69
+ name: 'NPM',
70
+ root: path.normalize(__dirname + '/../'),
71
+ }; */
113
72
 
114
- console.info('Updating default theme...');
115
- wrench.copyDirSyncRecursive(source.themes, updatePaths.theme, settings.wrench.merge);
116
- wrench.copyDirSyncRecursive(source.defaultTheme, updatePaths.defaultTheme, settings.wrench.overwrite);
73
+ /* Don't do end user config if SUI is a sub-module */
74
+ if (install.isSubModule()) {
75
+ console.info('SUI is a sub-module, skipping end-user install');
76
+ callback();
117
77
 
118
- console.info('Updating tasks...');
119
- wrench.copyDirSyncRecursive(source.tasks, updatePaths.tasks, settings.wrench.overwrite);
78
+ return;
79
+ }
120
80
 
121
- console.info('Updating gulpfile.js');
122
- gulp.src(source.userGulpFile)
123
- .pipe(plumber())
124
- .pipe(gulp.dest(updateFolder))
81
+ /* -----------------
82
+ Update SUI
83
+ ----------------- */
84
+
85
+ // run update scripts if semantic.json exists
86
+ if (currentConfig && manager.name === 'NPM') {
87
+ var
88
+ updateFolder = path.join(manager.root, currentConfig.base),
89
+ updatePaths = {
90
+ config: path.join(manager.root, files.config),
91
+ tasks: path.join(updateFolder, folders.tasks),
92
+ themeImport: path.join(updateFolder, folders.themeImport),
93
+ definition: path.join(currentConfig.paths.source.definitions),
94
+ site: path.join(currentConfig.paths.source.site),
95
+ theme: path.join(currentConfig.paths.source.themes),
96
+ defaultTheme: path.join(currentConfig.paths.source.themes, folders.defaultTheme),
97
+ }
125
98
  ;
126
99
 
127
- // copy theme import
128
- console.info('Updating theme import file');
129
- gulp.src(source.themeImport)
130
- .pipe(plumber())
131
- .pipe(gulp.dest(updatePaths.themeImport))
132
- ;
100
+ // duck-type if there is a project installed
101
+ if (fs.existsSync(updatePaths.definition)) {
102
+ // perform update if new version
103
+ if (currentConfig.version !== release.version) {
104
+ console.log('Updating Fomantic UI from ' + currentConfig.version + ' to ' + release.version);
133
105
 
134
- console.info('Adding new site theme files...');
135
- wrench.copyDirSyncRecursive(source.site, updatePaths.site, settings.wrench.merge);
106
+ console.info('Updating ui definitions...');
107
+ wrench.copyDirSyncRecursive(source.definitions, updatePaths.definition, settings.wrench.overwrite);
136
108
 
137
- console.info('Updating version...');
109
+ console.info('Updating default theme...');
110
+ wrench.copyDirSyncRecursive(source.themes, updatePaths.theme, settings.wrench.merge);
111
+ wrench.copyDirSyncRecursive(source.defaultTheme, updatePaths.defaultTheme, settings.wrench.overwrite);
138
112
 
139
- // update version number in semantic.json
140
- gulp.src(updatePaths.config)
141
- .pipe(plumber())
142
- .pipe(rename(settings.rename.json)) // preserve file extension
143
- .pipe(jsonEditor({
144
- version: release.version
145
- }))
146
- .pipe(gulp.dest(manager.root))
147
- ;
113
+ console.info('Updating tasks...');
114
+ wrench.copyDirSyncRecursive(source.tasks, updatePaths.tasks, settings.wrench.overwrite);
148
115
 
149
- console.info('Update complete! Run "\x1b[92mgulp build\x1b[0m" to rebuild dist/ files.');
116
+ console.info('Updating gulpfile.js');
117
+ gulp.src(source.userGulpFile)
118
+ .pipe(plumber())
119
+ .pipe(gulp.dest(updateFolder))
120
+ ;
150
121
 
151
- callback();
152
- return;
153
- } else {
154
- console.log('Current version of Fomantic UI already installed');
155
- callback();
156
- return;
157
- }
122
+ // copy theme import
123
+ console.info('Updating theme import file');
124
+ gulp.src(source.themeImport)
125
+ .pipe(plumber())
126
+ .pipe(gulp.dest(updatePaths.themeImport))
127
+ ;
158
128
 
159
- } else {
160
- console.error('Cannot locate files to update at path: ', updatePaths.definition);
161
- console.log('Running installer');
162
- }
129
+ console.info('Adding new site theme files...');
130
+ wrench.copyDirSyncRecursive(source.site, updatePaths.site, settings.wrench.merge);
163
131
 
164
- }
132
+ console.info('Updating version...');
165
133
 
166
- /*--------------
167
- Determine Root
168
- ---------------*/
134
+ // update version number in semantic.json
135
+ gulp.src(updatePaths.config)
136
+ .pipe(plumber())
137
+ .pipe(rename(settings.rename.json)) // preserve file extension
138
+ .pipe(jsonEditor({
139
+ version: release.version,
140
+ }))
141
+ .pipe(gulp.dest(manager.root))
142
+ ;
169
143
 
170
- // PM that supports Build Tools (NPM Only Now)
171
- if (manager.name === 'NPM') {
172
- rootQuestions[0].message = rootQuestions[0].message
173
- .replace('{packageMessage}', 'We detected you are using ' + manager.name + ' Nice!')
174
- .replace('{root}', manager.root)
175
- ;
176
- // set default path to detected PM root
177
- rootQuestions[0].default = manager.root;
178
- rootQuestions[1].default = manager.root;
179
-
180
- // insert PM questions after "Install Type" question
181
- Array.prototype.splice.apply(questions.setup, [2, 0].concat(rootQuestions));
182
-
183
- // omit cleanup questions for managed install
184
- questions.cleanup = [];
185
- }
186
-
187
-
188
- /*--------------
189
- Create SUI
190
- ---------------*/
191
-
192
- gulp.task('run setup', function (callback) {
193
-
194
- // If auto-install is switched on, we skip the configuration section and simply reuse the configuration from semantic.json
195
- if (install.shouldAutoInstall()) {
196
- answers = {
197
- overwrite : 'yes',
198
- install : 'auto',
199
- useRoot : true,
200
- semanticRoot: currentConfig.base
201
- };
202
- callback();
203
- } else {
204
- return inquirer.prompt(questions.setup)
205
- .then((setupAnswers) => {
206
- // hoist
207
- answers = setupAnswers;
208
- });
209
- }
210
- });
144
+ console.info('Update complete! Run "\x1b[92mgulp build\x1b[0m" to rebuild dist/ files.');
211
145
 
212
- gulp.task('create install files', function (callback) {
146
+ callback();
213
147
 
214
- /*--------------
215
- Exit Conditions
216
- ---------------*/
148
+ return;
149
+ } else {
150
+ console.log('Current version of Fomantic UI already installed');
151
+ callback();
217
152
 
218
- // if config exists and user specifies not to proceed
219
- if (answers.overwrite !== undefined && answers.overwrite == 'no') {
220
- callback();
221
- return;
222
- }
223
- console.clear();
224
- if (install.shouldAutoInstall()) {
225
- console.log('Auto-Installing (Without User Interaction)');
226
- } else {
227
- console.log('Installing');
153
+ return;
154
+ }
155
+ } else {
156
+ console.error('Cannot locate files to update at path: ', updatePaths.definition);
157
+ console.log('Running installer');
158
+ }
228
159
  }
229
- console.log('------------------------------');
230
160
 
161
+ /* --------------
162
+ Determine Root
163
+ --------------- */
231
164
 
232
- /*--------------
233
- Paths
234
- ---------------*/
165
+ // PM that supports Build Tools (NPM Only Now)
166
+ if (manager.name === 'NPM') {
167
+ rootQuestions[0].message = rootQuestions[0].message
168
+ .replace('{packageMessage}', 'We detected you are using ' + manager.name + ' Nice!')
169
+ .replace('{root}', manager.root)
170
+ ;
171
+ // set default path to detected PM root
172
+ rootQuestions[0].default = manager.root;
173
+ rootQuestions[1].default = manager.root;
235
174
 
236
- var
237
- installPaths = {
238
- config : files.config,
239
- configFolder : folders.config,
240
- site : answers.site || folders.site,
241
- themeConfig : files.themeConfig,
242
- themeConfigFolder: folders.themeConfig
243
- }
244
- ;
175
+ // insert PM questions after "Install Type" question
176
+ Array.prototype.splice.apply(questions.setup, [2, 0].concat(rootQuestions));
177
+
178
+ // omit cleanup questions for managed install
179
+ questions.cleanup = [];
180
+ }
181
+
182
+ /* --------------
183
+ Create SUI
184
+ --------------- */
185
+
186
+ gulp.task('run setup', function (callback) {
187
+ // If auto-install is switched on, we skip the configuration section and simply reuse the configuration from semantic.json
188
+ if (install.shouldAutoInstall()) {
189
+ answers = {
190
+ overwrite: 'yes',
191
+ install: 'auto',
192
+ useRoot: true,
193
+ semanticRoot: currentConfig.base,
194
+ };
195
+ callback();
196
+ } else {
197
+ return inquirer.prompt(questions.setup)
198
+ .then((setupAnswers) => {
199
+ // hoist
200
+ answers = setupAnswers;
201
+ })
202
+ ;
203
+ }
204
+ });
245
205
 
246
- /*--------------
247
- NPM Install
248
- ---------------*/
206
+ gulp.task('create install files', function (callback) {
207
+ /* --------------
208
+ Exit Conditions
209
+ --------------- */
249
210
 
250
- // Check if PM install
251
- if (manager && (answers.useRoot || answers.customRoot)) {
211
+ // if config exists and user specifies not to proceed
212
+ if (answers.overwrite !== undefined && answers.overwrite == 'no') {
213
+ callback();
252
214
 
253
- // Set root to custom root path if set
254
- if (answers.customRoot) {
255
- if (answers.customRoot === '') {
256
- console.log('Unable to proceed, invalid project root');
257
- callback();
258
- return;
215
+ return;
259
216
  }
260
- manager.root = answers.customRoot;
261
- }
262
-
263
- // special install paths only for PM install
264
- installPaths = extend(false, {}, installPaths, {
265
- definition : folders.definitions,
266
- lessImport : folders.lessImport,
267
- tasks : folders.tasks,
268
- theme : folders.themes,
269
- defaultTheme: path.join(folders.themes, folders.defaultTheme),
270
- themeImport : folders.themeImport
271
- });
272
-
273
- // add project root to semantic root
274
- installFolder = path.join(manager.root, answers.semanticRoot);
275
-
276
- // add install folder to all output paths
277
- for (var destination in installPaths) {
278
- if (installPaths.hasOwnProperty(destination)) {
279
- // config goes in project root, rest in install folder
280
- installPaths[destination] = (destination == 'config' || destination == 'configFolder')
281
- ? path.normalize(path.join(manager.root, installPaths[destination]))
282
- : path.normalize(path.join(installFolder, installPaths[destination]))
283
- ;
217
+ console.clear();
218
+ if (install.shouldAutoInstall()) {
219
+ console.log('Auto-Installing (Without User Interaction)');
220
+ } else {
221
+ console.log('Installing');
284
222
  }
285
- }
286
-
287
- // create project folders
288
- try {
289
- mkdirp.sync(installFolder);
290
- mkdirp.sync(installPaths.definition);
291
- mkdirp.sync(installPaths.theme);
292
- mkdirp.sync(installPaths.tasks);
293
- } catch (error) {
294
- console.error('NPM does not have permissions to create folders at your specified path. Adjust your folders permissions and run "npm install" again');
295
- }
296
-
297
- console.log('Installing to \x1b[92m' + answers.semanticRoot + '\x1b[0m');
298
-
299
- console.info('Copying UI definitions');
300
- wrench.copyDirSyncRecursive(source.definitions, installPaths.definition, settings.wrench.overwrite);
301
-
302
- console.info('Copying UI themes');
303
- wrench.copyDirSyncRecursive(source.themes, installPaths.theme, settings.wrench.merge);
304
- wrench.copyDirSyncRecursive(source.defaultTheme, installPaths.defaultTheme, settings.wrench.overwrite);
305
-
306
- console.info('Copying gulp tasks');
307
- wrench.copyDirSyncRecursive(source.tasks, installPaths.tasks, settings.wrench.overwrite);
308
-
309
- // copy theme import
310
- console.info('Adding theme files');
311
- gulp.src(source.themeImport)
312
- .pipe(plumber())
313
- .pipe(gulp.dest(installPaths.themeImport))
314
- ;
315
- gulp.src(source.lessImport)
316
- .pipe(plumber())
317
- .pipe(gulp.dest(installPaths.lessImport))
318
- ;
319
-
320
- // create gulp file
321
- console.info('Creating gulpfile.js');
322
- gulp.src(source.userGulpFile)
323
- .pipe(plumber())
324
- .pipe(gulp.dest(installFolder))
325
- ;
223
+ console.log('------------------------------');
224
+
225
+ /* --------------
226
+ Paths
227
+ --------------- */
228
+
229
+ var
230
+ installPaths = {
231
+ config: files.config,
232
+ configFolder: folders.config,
233
+ site: answers.site || folders.site,
234
+ themeConfig: files.themeConfig,
235
+ themeConfigFolder: folders.themeConfig,
236
+ }
237
+ ;
326
238
 
327
- }
239
+ /* --------------
240
+ NPM Install
241
+ --------------- */
242
+
243
+ // Check if PM install
244
+ if (manager && (answers.useRoot || answers.customRoot)) {
245
+ // Set root to custom root path if set
246
+ if (answers.customRoot) {
247
+ if (answers.customRoot === '') {
248
+ console.log('Unable to proceed, invalid project root');
249
+ callback();
250
+
251
+ return;
252
+ }
253
+ manager.root = answers.customRoot;
254
+ }
328
255
 
256
+ // special install paths only for PM install
257
+ installPaths = extend(false, {}, installPaths, {
258
+ definition: folders.definitions,
259
+ lessImport: folders.lessImport,
260
+ tasks: folders.tasks,
261
+ theme: folders.themes,
262
+ defaultTheme: path.join(folders.themes, folders.defaultTheme),
263
+ themeImport: folders.themeImport,
264
+ });
265
+
266
+ // add project root to semantic root
267
+ installFolder = path.join(manager.root, answers.semanticRoot);
268
+
269
+ // add install folder to all output paths
270
+ for (var destination in installPaths) {
271
+ if (installPaths.hasOwnProperty(destination)) {
272
+ // config goes in project root, rest in install folder
273
+ installPaths[destination] = (destination == 'config' || destination == 'configFolder')
274
+ ? path.normalize(path.join(manager.root, installPaths[destination]))
275
+ : path.normalize(path.join(installFolder, installPaths[destination]));
276
+ }
277
+ }
329
278
 
330
- /*--------------
331
- Site Theme
332
- ---------------*/
279
+ // create project folders
280
+ try {
281
+ mkdirp.sync(installFolder);
282
+ mkdirp.sync(installPaths.definition);
283
+ mkdirp.sync(installPaths.theme);
284
+ mkdirp.sync(installPaths.tasks);
285
+ } catch (error) {
286
+ console.error('NPM does not have permissions to create folders at your specified path. Adjust your folders permissions and run "npm install" again');
287
+ }
333
288
 
334
- // Copy _site templates folder to destination
335
- if (fs.existsSync(installPaths.site)) {
336
- console.info('Site folder exists, merging files (no overwrite)', installPaths.site);
337
- } else {
338
- console.info('Creating site theme folder', installPaths.site);
339
- }
340
- wrench.copyDirSyncRecursive(source.site, installPaths.site, settings.wrench.merge);
341
-
342
- /*--------------
343
- Theme Config
344
- ---------------*/
345
-
346
- gulp.task('create theme.config', function () {
347
- var
348
- // determine path to site theme folder from theme config
349
- // force CSS path variable to use forward slashes for paths
350
- pathToSite = path.relative(path.resolve(installPaths.themeConfigFolder), path.resolve(installPaths.site)).replace(/\\/g, '/'),
351
- siteVariable = "@siteFolder : '" + pathToSite + "/';"
352
- ;
353
-
354
- // rewrite site variable in theme.less
355
- console.info('Adjusting @siteFolder to: ', pathToSite + '/');
356
-
357
- if (fs.existsSync(installPaths.themeConfig)) {
358
- console.info('Modifying src/theme.config (LESS config)', installPaths.themeConfig);
359
- return gulp.src(installPaths.themeConfig)
360
- .pipe(plumber())
361
- .pipe(replace(regExp.siteVariable, siteVariable))
362
- .pipe(gulp.dest(installPaths.themeConfigFolder))
363
- ;
364
- } else {
365
- console.info('Creating src/theme.config (LESS config)', installPaths.themeConfig);
366
- return gulp.src(source.themeConfig)
367
- .pipe(plumber())
368
- .pipe(rename({extname: ''}))
369
- .pipe(replace(regExp.siteVariable, siteVariable))
370
- .pipe(gulp.dest(installPaths.themeConfigFolder))
371
- ;
372
- }
373
- });
289
+ console.log('Installing to \x1b[92m' + answers.semanticRoot + '\x1b[0m');
290
+
291
+ console.info('Copying UI definitions');
292
+ wrench.copyDirSyncRecursive(source.definitions, installPaths.definition, settings.wrench.overwrite);
293
+
294
+ console.info('Copying UI themes');
295
+ wrench.copyDirSyncRecursive(source.themes, installPaths.theme, settings.wrench.merge);
296
+ wrench.copyDirSyncRecursive(source.defaultTheme, installPaths.defaultTheme, settings.wrench.overwrite);
297
+
298
+ console.info('Copying gulp tasks');
299
+ wrench.copyDirSyncRecursive(source.tasks, installPaths.tasks, settings.wrench.overwrite);
300
+
301
+ // copy theme import
302
+ console.info('Adding theme files');
303
+ gulp.src(source.themeImport)
304
+ .pipe(plumber())
305
+ .pipe(gulp.dest(installPaths.themeImport))
306
+ ;
307
+ gulp.src(source.lessImport)
308
+ .pipe(plumber())
309
+ .pipe(gulp.dest(installPaths.lessImport))
310
+ ;
311
+
312
+ // create gulp file
313
+ console.info('Creating gulpfile.js');
314
+ gulp.src(source.userGulpFile)
315
+ .pipe(plumber())
316
+ .pipe(gulp.dest(installFolder))
317
+ ;
318
+ }
374
319
 
375
- /*--------------
376
- Semantic.json
377
- ---------------*/
378
-
379
- gulp.task('create semantic.json', function () {
380
-
381
- var
382
- jsonConfig = install.createJSON(answers)
383
- ;
384
-
385
- // adjust variables in theme.less
386
- if (fs.existsSync(installPaths.config)) {
387
- console.info('Extending config file (semantic.json)', installPaths.config);
388
- return gulp.src(installPaths.config)
389
- .pipe(plumber())
390
- .pipe(rename(settings.rename.json)) // preserve file extension
391
- .pipe(jsonEditor(jsonConfig))
392
- .pipe(gulp.dest(installPaths.configFolder))
393
- ;
394
- } else {
395
- console.info('Creating config file (semantic.json)', installPaths.config);
396
- return gulp.src(source.config)
397
- .pipe(plumber())
398
- .pipe(rename({extname: ''})) // remove .template from ext
399
- .pipe(jsonEditor(jsonConfig, {end_with_newline: true}))
400
- .pipe(gulp.dest(installPaths.configFolder))
401
- ;
402
- }
320
+ /* --------------
321
+ Site Theme
322
+ --------------- */
403
323
 
404
- });
324
+ // Copy _site templates folder to destination
325
+ if (fs.existsSync(installPaths.site)) {
326
+ console.info('Site folder exists, merging files (no overwrite)', installPaths.site);
327
+ } else {
328
+ console.info('Creating site theme folder', installPaths.site);
329
+ }
330
+ wrench.copyDirSyncRecursive(source.site, installPaths.site, settings.wrench.merge);
331
+
332
+ /* --------------
333
+ Theme Config
334
+ --------------- */
335
+
336
+ gulp.task('create theme.config', function () {
337
+ var
338
+ // determine path to site theme folder from theme config
339
+ // force CSS path variable to use forward slashes for paths
340
+ pathToSite = path.relative(path.resolve(installPaths.themeConfigFolder), path.resolve(installPaths.site)).replace(/\\/g, '/'),
341
+ siteVariable = "@siteFolder : '" + pathToSite + "/';"
342
+ ;
343
+
344
+ // rewrite site variable in theme.less
345
+ console.info('Adjusting @siteFolder to: ', pathToSite + '/');
346
+
347
+ if (fs.existsSync(installPaths.themeConfig)) {
348
+ console.info('Modifying src/theme.config (LESS config)', installPaths.themeConfig);
349
+
350
+ return gulp.src(installPaths.themeConfig)
351
+ .pipe(plumber())
352
+ .pipe(replace(regExp.siteVariable, siteVariable))
353
+ .pipe(gulp.dest(installPaths.themeConfigFolder))
354
+ ;
355
+ } else {
356
+ console.info('Creating src/theme.config (LESS config)', installPaths.themeConfig);
357
+
358
+ return gulp.src(source.themeConfig)
359
+ .pipe(plumber())
360
+ .pipe(rename({ extname: '' }))
361
+ .pipe(replace(regExp.siteVariable, siteVariable))
362
+ .pipe(gulp.dest(installPaths.themeConfigFolder))
363
+ ;
364
+ }
365
+ });
405
366
 
406
- gulp.series('create theme.config', 'create semantic.json')(callback);
407
- });
408
-
409
- gulp.task('clean up install', function (callback) {
410
-
411
- // Completion Message
412
- if (installFolder && !install.shouldAutoInstall()) {
413
- console.log('\n Setup Complete! \n Installing Peer Dependencies. \x1b[0;31mPlease refrain from ctrl + c\x1b[0m... \n After completion navigate to \x1b[92m' + answers.semanticRoot + '\x1b[0m and run "\x1b[92mgulp build\x1b[0m" to build');
414
- callback();
415
- } else {
416
- console.log('');
417
- console.log('');
418
-
419
- // If auto-install is switched on, we skip the configuration section and simply build the dependencies
420
- if (install.shouldAutoInstall()) {
421
- gulp.series('build')(callback);
422
- } else {
423
- // We don't return the inquirer promise on purpose because we handle the callback ourselves
424
- inquirer.prompt(questions.cleanup)
425
- .then((answers) => {
426
- if (answers.cleanup === 'yes') {
427
- del(install.setupFiles);
367
+ /* --------------
368
+ Semantic.json
369
+ --------------- */
370
+
371
+ gulp.task('create semantic.json', function () {
372
+ var
373
+ jsonConfig = install.createJSON(answers)
374
+ ;
375
+
376
+ // adjust variables in theme.less
377
+ if (fs.existsSync(installPaths.config)) {
378
+ console.info('Extending config file (semantic.json)', installPaths.config);
379
+
380
+ return gulp.src(installPaths.config)
381
+ .pipe(plumber())
382
+ .pipe(rename(settings.rename.json)) // preserve file extension
383
+ .pipe(jsonEditor(jsonConfig))
384
+ .pipe(gulp.dest(installPaths.configFolder))
385
+ ;
386
+ } else {
387
+ console.info('Creating config file (semantic.json)', installPaths.config);
388
+
389
+ return gulp.src(source.config)
390
+ .pipe(plumber())
391
+ .pipe(rename({ extname: '' })) // remove .template from ext
392
+ .pipe(jsonEditor(jsonConfig, { end_with_newline: true }))
393
+ .pipe(gulp.dest(installPaths.configFolder))
394
+ ;
428
395
  }
429
- if (answers.build === 'yes') {
430
- gulp.series('build')(callback);
396
+ });
397
+
398
+ gulp.series('create theme.config', 'create semantic.json')(callback);
399
+ });
400
+
401
+ gulp.task('clean up install', function (callback) {
402
+ // Completion Message
403
+ if (installFolder && !install.shouldAutoInstall()) {
404
+ console.log('\n Setup Complete! \n Installing Peer Dependencies. \x1b[0;31mPlease refrain from ctrl + c\x1b[0m... \n After completion navigate to \x1b[92m' + answers.semanticRoot + '\x1b[0m and run "\x1b[92mgulp build\x1b[0m" to build');
405
+ callback();
406
+ } else {
407
+ console.log('');
408
+ console.log('');
409
+
410
+ // If auto-install is switched on, we skip the configuration section and simply build the dependencies
411
+ if (install.shouldAutoInstall()) {
412
+ gulp.series('build')(callback);
431
413
  } else {
432
- callback();
414
+ // We don't return the inquirer promise on purpose because we handle the callback ourselves
415
+ inquirer.prompt(questions.cleanup)
416
+ .then((answers) => {
417
+ if (answers.cleanup === 'yes') {
418
+ del(install.setupFiles);
419
+ }
420
+ if (answers.build === 'yes') {
421
+ gulp.series('build')(callback);
422
+ } else {
423
+ callback();
424
+ }
425
+ })
426
+ ;
433
427
  }
434
- });
435
- }
436
- }
437
- });
428
+ }
429
+ });
438
430
 
439
- gulp.series('run setup', 'create install files', 'clean up install')(callback);
431
+ gulp.series('run setup', 'create install files', 'clean up install')(callback);
440
432
  };